Просмотр исходного кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

koushanshan 1 год назад
Родитель
Сommit
94f86ade11
37 измененных файлов с 419 добавлено и 120 удалено
  1. 22 0
      src/main/java/com/dk/mdm/controller/mac/PaymentController.java
  2. 21 0
      src/main/java/com/dk/mdm/controller/mac/ReceiptController.java
  3. 2 0
      src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml
  4. 3 0
      src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml
  5. 3 0
      src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml
  6. 1 1
      src/main/java/com/dk/mdm/mapper/mac/RecPayHandleItemMapper.xml
  7. 1 1
      src/main/java/com/dk/mdm/mapper/mac/RecPayItemMapper.xml
  8. 25 18
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java
  9. 28 10
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml
  10. 19 5
      src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml
  11. 4 2
      src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml
  12. 4 3
      src/main/java/com/dk/mdm/mapper/mst/OrgMapper.xml
  13. 8 6
      src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml
  14. 4 1
      src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml
  15. 6 0
      src/main/java/com/dk/mdm/model/pojo/mac/RecPay.java
  16. 7 0
      src/main/java/com/dk/mdm/model/pojo/mst/GoodsSku.java
  17. 2 1
      src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java
  18. 8 0
      src/main/java/com/dk/mdm/model/query/mac/RecPayQuery.java
  19. 8 0
      src/main/java/com/dk/mdm/model/query/mst/GoodsSkuQuery.java
  20. 3 0
      src/main/java/com/dk/mdm/model/response/mac/OtherPayableResponse.java
  21. 3 0
      src/main/java/com/dk/mdm/model/response/mac/OtherReceivableResponse.java
  22. 8 0
      src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java
  23. 11 0
      src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java
  24. 6 0
      src/main/java/com/dk/mdm/model/response/mst/GoodsSkuResponse.java
  25. 8 0
      src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java
  26. 6 0
      src/main/java/com/dk/mdm/model/vo/mst/GoodsSkuVO.java
  27. 0 7
      src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseReturnService.java
  28. 1 1
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java
  29. 1 6
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java
  30. 31 10
      src/main/java/com/dk/mdm/service/mac/AccountService.java
  31. 40 19
      src/main/java/com/dk/mdm/service/mac/OtherPayableService.java
  32. 35 15
      src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java
  33. 41 3
      src/main/java/com/dk/mdm/service/mac/PaymentService.java
  34. 42 3
      src/main/java/com/dk/mdm/service/mac/ReceiptService.java
  35. 1 4
      src/main/java/com/dk/mdm/service/mst/OrgService.java
  36. 2 0
      src/main/java/com/dk/mdm/service/mst/StaffService.java
  37. 4 4
      src/main/java/com/dk/mdm/service/sale/OrderService.java

+ 22 - 0
src/main/java/com/dk/mdm/controller/mac/PaymentController.java

@@ -69,6 +69,17 @@ public class PaymentController {
     }
 
     /**
+     * @desc : 更新应付付款(小编辑)
+     * @author : 付斌
+     * @date : 2023/1/9 10:48
+     */
+    @ApiOperation(value = "更新应付付款", notes = "更新应付付款")
+    @PostMapping({"update_payable_payment"})
+    public ResponseResultVO<?> updatePayablePayment(@RequestBody RecPayVO recPayVO) {
+        return paymentService.updatePayablePayment(recPayVO);
+    }
+
+    /**
      * @desc : 作废
      * @author : 付斌
      * @date : 2024-03-08 16:36
@@ -79,4 +90,15 @@ public class PaymentController {
         return paymentService.invalid(id);
     }
 
+    /**
+     * @desc : 获取应付付款(编辑用)
+     * @author : 付斌
+     * @date : 2024-03-03 9:28
+     */
+    @ApiOperation(value = "获取应付付款(编辑用)", notes = "获取应付付款(编辑用)")
+    @PostMapping({"get_payable_payment_for_update/{id}"})
+    public ResponseResultVO<?> getPayablePaymentForUpdate(@PathVariable String id) {
+        return paymentService.getPayablePaymentForUpdate(id);
+    }
+
 }

+ 21 - 0
src/main/java/com/dk/mdm/controller/mac/ReceiptController.java

@@ -113,6 +113,17 @@ public class ReceiptController {
     }
 
     /**
+     * @desc : 更新应收收款(小编辑)
+     * @author : 付斌
+     * @date : 2023/1/9 10:48
+     */
+    @ApiOperation(value = "更新应收收款", notes = "更新应收收款")
+    @PostMapping({"update_receivable_receipt"})
+    public ResponseResultVO<?> updateReceivableReceipt(@RequestBody RecPayVO recPayVO) {
+        return receiptService.updateReceivableReceipt(recPayVO);
+    }
+
+    /**
      * @desc : 作废
      * @author : 付斌
      * @date : 2024-03-08 16:36
@@ -123,4 +134,14 @@ public class ReceiptController {
         return receiptService.invalid(id);
     }
 
+    /**
+     * @desc : 获取应收收款(编辑用)
+     * @author : 付斌
+     * @date : 2024-03-03 9:28
+     */
+    @ApiOperation(value = "获取应收收款(编辑用)", notes = "获取应收收款(编辑用)")
+    @PostMapping({"get_receivable_receipt_for_update/{id}"})
+    public ResponseResultVO<?> getReceivableReceiptForUpdate(@PathVariable String id) {
+        return receiptService.getReceivableReceiptForUpdate(id);
+    }
 }

+ 2 - 0
src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

@@ -191,6 +191,8 @@
     <select id="selectByCond" resultMap="BaseResultMapResponse">
         SELECT
         <include refid="Base_Column_List_Response"/>
+        ,tpii.wh_id as "whId"
+        ,tmw.wh_name as "whName"
         ,tmgs.sku_code  as "skuCode"
         ,tmgs.sku_model as "skuModel"
         ,tmgs.sku_name  as "skuName"

+ 3 - 0
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -182,6 +182,7 @@
         <result column="sku_code" property="skuCode"/>
         <result column="sku_name" property="skuName"/>
         <result column="sku_model" property="skuModel"/>
+        <result column="short_name" property="shortName"/>
         <result column="price_purchase" property="pricePurchase"/>
         <result column="reject_qty" property="rejectQty"/>
         <result column="sku_images" property="skuImages"  typeHandler="JsonTypeHandler"/>
@@ -603,6 +604,7 @@
         tmgs.sku_code AS  list_sku_code,
         tmgs.sku_name AS  list_sku_name,
         tmgs.sku_model AS  list_sku_model,
+        tmgb.short_name AS  list_short_name,
         tmgs.price_purchase AS  list_price_purchase,
         tmgs.sku_images AS  list_sku_images,
 
@@ -630,6 +632,7 @@
         left  join dkic_b.t_psi_inbound_item tpii  on tpi.into_id = tpii.into_id and  ( tpii.into_qty - tpii.return_qty) > 0
         left  join  dkic_b.t_mst_warehouse tmw on  tmw.wh_id =   tpii.wh_id
         inner join  dkic_b.t_mst_goods_sku  tmgs on tmgs.sku_id = tpii.sku_id
+        left join  dkic_b.t_mst_goods_brand  tmgb on tmgb.brand_id = tmgs.brand_id
         left join(SELECT T.*
         FROM (select tpi.inv_id,
         tpi.wh_id,

+ 3 - 0
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml

@@ -52,6 +52,9 @@
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            <if test="flgValid != null">
+                AND t.flg_valid = #{flgValid}
+            </if>
             <if test="receivableNo != null and receivableNo != ''">
                 AND t.receivable_no LIKE concat('%',my_ex.likequery(#{receivableNo}),'%')
             </if>

+ 1 - 1
src/main/java/com/dk/mdm/mapper/mac/RecPayHandleItemMapper.xml

@@ -42,7 +42,7 @@
             AND t.rp_id = #{rpId}::uuid
         </if>
         <if test="accItemId != null and accItemId != ''">
-            AND t.acc_item_id = #{accItemId}
+            AND t.acc_item_id = #{accItemId}::uuid
         </if>
         <if test="amtReceivableHandle != null">
             AND t.amt_receivable_handle = #{amtReceivableHandle}

+ 1 - 1
src/main/java/com/dk/mdm/mapper/mac/RecPayItemMapper.xml

@@ -50,7 +50,7 @@
                 AND t.rp_id = #{rpId}::uuid
             </if>
             <if test="macId != null and macId != ''">
-                AND t.mac_id = #{macId}
+                AND t.mac_id = #{macId}::uuid
             </if>
             <if test="amtRec != null">
                 AND t.amt_rec = #{amtRec}

+ 25 - 18
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java

@@ -10,57 +10,64 @@ import org.springframework.stereotype.Repository;
 import java.util.List;
 
 /**
-*  收付款单 Mapper
-*/
+ * 收付款单 Mapper
+ */
 @Repository
-public interface RecPayMapper extends BaseMapper<RecPay>{
+public interface RecPayMapper extends BaseMapper<RecPay> {
     /**
-     * @desc   : 根据条件进行查询
+     * @desc : 根据条件进行查询
      * @author : 付斌
-     * @date   : 2024-02-28 10:18
+     * @date : 2024-02-28 10:18
      */
     List<RecPayResponse> selectByCond(RecPayQuery recPayQuery);
 
     /**
-     * @desc   : 根据条件进行查询(数量)
+     * @desc : 根据条件进行查询(数量)
      * @author : 付斌
-     * @date   : 2024-02-28 10:19
+     * @date : 2024-02-28 10:19
      */
     Long countByCond(RecPayQuery recPayQuery);
 
     /**
-     * @desc   : 根据Id进行查询
+     * @desc : 根据Id进行查询
      * @author : 付斌
-     * @date   : 2024-03-03 9:25
+     * @date : 2024-03-03 9:25
      */
     RecPayResponse selectById(@Param("id") String id);
 
     /**
-     * @desc   : 根据BiznisId进行查询
+     * @desc : 根据BiznisId进行查询
      * @author : 付斌
-     * @date   : 2024-03-03 9:25
+     * @date : 2024-03-03 9:25
      */
-    RecPay selectByBiznisIdForUpdate(String id);
+    RecPay selectByBiznisIdForUpdate(@Param("id") String id, @Param("flgOrderHandle") Boolean flgOrderHandle);
 
     /**
-     * @desc   : 根据BiznisId进行查询
+     * @desc : 根据BiznisId进行查询
      * @author : 付斌
-     * @date   : 2024-03-03 9:25
+     * @date : 2024-03-03 9:25
      */
     RecPay selectByBiznisId(String id);
 
     /**
-     * @desc   : 根据条件进行查询
+     * @desc : 根据条件进行查询
      * @author : 付斌
-     * @date   : 2024-02-28 10:18
+     * @date : 2024-02-28 10:18
      */
     List<RecPayResponse> selectPaymentByCond(RecPayQuery recPayQuery);
 
     /**
-     * @desc   : 根据条件进行查询(数量)
+     * @desc : 根据条件进行查询(数量)
      * @author : 付斌
-     * @date   : 2024-02-28 10:19
+     * @date : 2024-02-28 10:19
      */
     Long countPaymentByCond(RecPayQuery recPayQuery);
+
+    /**
+     * @desc : 删除收款单
+     * @author : 付斌
+     * @date : 2024-04-28 9:10
+     */
+    int deleteById(@Param("id") String id);
 }
 

+ 28 - 10
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml

@@ -5,7 +5,7 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        rp_id, rp_no, rp_type, object_id, org_id, staff_id, sum_amt_rec, sum_amt_pay, sum_should_handle, sum_use_receipt_residue, sum_use_payment_residue, sum_amt_receivable_handle, sum_amt_payable_handle, sum_waive_amt, acc_date, annex_paths, remarks, biznis_type, biznis_id, biznis_no, flg_lock, make_staff, make_time, flg_valid, cp_id
+        rp_id, rp_no, rp_type, object_id, org_id, staff_id, sum_amt_rec, sum_amt_pay, sum_should_handle, sum_use_receipt_residue, sum_use_payment_residue, sum_amt_receivable_handle, sum_amt_payable_handle, sum_waive_amt, acc_date, annex_paths, remarks, biznis_type, biznis_id, biznis_no, flg_order_handle, flg_lock, make_staff, make_time, flg_valid, cp_id
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -30,6 +30,7 @@
             <result column="biznis_type" property="biznisType"/>
             <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
             <result column="biznis_no" property="biznisNo"/>
+            <result column="flg_order_handle" property="flgOrderHandle"/>
             <result column="flg_lock" property="flgLock"/>
             <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
             <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
@@ -59,6 +60,7 @@
             <result column="biznis_type" property="biznisType"/>
             <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
             <result column="biznis_no" property="biznisNo"/>
+            <result column="flg_order_handle" property="flgOrderHandle"/>
             <result column="flg_lock" property="flgLock"/>
             <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
             <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
@@ -130,6 +132,9 @@
         <if test="biznisNo != null and biznisNo != ''">
             AND t.biznis_no = #{biznisNo}
         </if>
+        <if test="flgOrderHandle != null">
+            AND t.flg_order_handle = #{flgOrderHandle}
+        </if>
         <if test="flgLock != null">
             AND t.flg_lock = #{flgLock}
         </if>
@@ -174,15 +179,15 @@
             AND t.op_create_time &gt;= #{createtimeStart}::timestamp with time zone
             AND t.op_create_time &lt; #{createtimeEnd}::timestamp with time zone + interval '1 day'
         </if>
-        <if  test="searchText != null">
-            AND ( t.rp_no  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR   tmc.cus_code  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR  tmc.cus_name  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR   tmc.cus_phone  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR   tmc.address_full  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR  t.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')
-            )
-        </if>
+<!--        <if  test="searchText != null">-->
+<!--            AND ( t.rp_no  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR   tmc.cus_code  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR  tmc.cus_name  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR   tmc.cus_phone  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR   tmc.address_full  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR  t.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            )-->
+<!--        </if>-->
         <if test="staffName != null and staffName != ''">
             AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
         </if>
@@ -228,6 +233,7 @@
                t.biznis_type,
                t.biznis_id,
                t.biznis_no,
+               t.flg_order_handle,
                t.flg_lock,
                t.make_staff,
                makestaff.staff_name as "makeStaffName",
@@ -246,6 +252,7 @@
 
         where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
         <include refid="Condition"/>
+
         <if test="searchText !=null and searchText != ''">
             AND (
             t.rp_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
@@ -312,6 +319,7 @@
                t.biznis_type,
                t.biznis_id,
                t.biznis_no,
+               t.flg_order_handle,
                t.flg_lock,
                t.make_staff,
                makestaff.staff_name as "makeStaffName",
@@ -344,6 +352,7 @@
         FROM dkic_b.t_mac_rec_pay
         WHERE flg_valid
           and biznis_id = #{id}::uuid
+          and flg_order_handle = #{flgOrderHandle}
         for update
     </select>
 
@@ -388,6 +397,7 @@
             biznis_type,
             biznis_id,
             biznis_no,
+            flg_order_handle,
             flg_lock,
             make_staff,
             make_time,
@@ -418,6 +428,7 @@
                 #{item.biznisType},
                 #{item.biznisId}::uuid,
                 #{item.biznisNo},
+                #{item.flgOrderHandle},
                 #{item.flgLock},
                 #{item.makeStaff}::uuid,
                 #{item.makeTime},
@@ -456,6 +467,7 @@
                t.biznis_type,
                t.biznis_id,
                t.biznis_no,
+               t.flg_order_handle,
                t.flg_lock,
                t.make_staff,
                makestaff.staff_name as "makeStaffName",
@@ -507,4 +519,10 @@
             )
         </if>
     </select>
+
+    <!-- 删除收款单 -->
+    <delete id="deleteById">
+        DELETE FROM dkic_b.t_mac_rec_pay
+        WHERE rp_id = #{id}::uuid;
+    </delete>
 </mapper>

+ 19 - 5
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -97,6 +97,12 @@
         <result column="follow_staff_name" property="followStaffName"/>
         <result column="receivable_residue" property="receivableResidue"/>
         <result column="receipt_residue" property="receiptResidue"/>
+        <result column="orderQuantity" property="orderQuantity"/>
+        <result column="orderAmount" property="orderAmount"/>
+
+        <result column="outboundQuantity" property="outboundQuantity"/>
+        <result column="outboundAmount" property="outboundAmount"/>
+
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -106,10 +112,10 @@
                 AND tmc.cus_code = #{cusCode}
             </if>
             <if test="cusName != null and cusName != ''">
-                AND tmc.cus_name = #{cusName}
+                AND tmc.cus_name like concat('%', my_ex.likequery(#{cusName}) , '%')
             </if>
             <if test="cusPhone != null and cusPhone != ''">
-                AND tmc.cus_phone = #{cusPhone}
+                AND tmc.cus_phone like concat('%', my_ex.likequery(#{cusPhone}) , '%')
             </if>
             <if test="addressArea != null and addressArea != ''">
                 AND tmc.address_area = #{addressArea}
@@ -127,10 +133,10 @@
                 AND tmc.address_full = #{addressFull}
             </if>
             <if test="contactName != null and contactName != ''">
-                AND tmc.contact_name = #{contactName}
+                AND tmc.contact_name like concat('%', my_ex.likequery(#{contactName}) , '%')
             </if>
             <if test="contactPhone != null and contactPhone != ''">
-                AND tmc.contact_phone = #{contactPhone}
+                AND tmc.contact_phone like concat('%', my_ex.likequery(#{contactPhone}) , '%')
             </if>
             <if test="cusFrom != null and cusFrom != ''">
                 AND tmc.cus_from = #{cusFrom}::uuid
@@ -256,9 +262,15 @@
         tmo.org_name  AS  "orgName",
         tms.staff_name  AS  "staffName",
         tms2.staff_name  AS  "reportStaffName",
-        tdk.kind_name_i18n  ->>  #{i18n} AS "saleStatusName"
+        tdk.kind_name_i18n  ->>  #{i18n} AS "saleStatusName",
 --         tccfs.follow_staff  as follow_staff,
 --         tms1.staff_name  as follow_staff_name
+        (SELECT COUNT(1) FROM  dkic_b.t_psi_order tpo  WHERE tpo.cus_id = tmc.cus_id AND  tpo.cp_id = tmc.cp_id AND tpo.flg_valid) AS "orderQuantity",
+        (SELECT sum(tpo.sum_amount) FROM  dkic_b.t_psi_order tpo  WHERE tpo.cus_id = tmc.cus_id AND  tpo.cp_id = tmc.cp_id AND tpo.flg_valid) AS "orderAmount",
+
+
+        (SELECT COUNT(1) FROM  dkic_b.t_psi_outbound tpob  WHERE tpob.cus_id = tmc.cus_id AND  tpob.cp_id = tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS "outboundQuantity",
+        (SELECT sum(tpob.out_amt) FROM  dkic_b.t_psi_outbound tpob  WHERE tpob.cus_id = tmc.cus_id AND  tpob.cp_id = tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS "outboundAmount"
         FROM dkic_b.t_mst_customer tmc
         LEFT JOIN  dkic_b.t_mst_dictionary_data tmd  on tmd.data_id =  tmc.cus_from
         LEFT JOIN  dkic_b.t_mst_sale_channel tmsc  on tmsc.channel_id =  tmc.channel_id
@@ -266,6 +278,8 @@
         LEFT JOIN  dkic_b.t_mst_staff tms  on tms.staff_id =  tmc.staff_id
         LEFT JOIN  dkic_b.t_mst_staff tms2  on tms2.staff_id =  tmc.report_staff
         LEFT JOIN  sys.t_data_kind tdk  on tdk.kind_code =  tmc.sale_status
+
+
 --         LEFT JOIN  dkic_b.t_crm_cus_follow_staff  tccfs on tccfs.follow_staff = any(tmc.follow_staffs)
 --         LEFT JOIN  dkic_b.t_mst_staff tms1  on tms1.staff_id =  tccfs.follow_staff
         WHERE tmc.cus_id = #{id}::uuid

+ 4 - 2
src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml

@@ -6,7 +6,7 @@
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
         sku_id, sku_code, sku_name, sku_model, brand_id, category_id, unit_id, sub_unit_id, conversion_factor
-        , series_id, sku_spec, price_purchase, price_standard, price_wholesale, price_limited, sku_images
+        , series_id, sku_spec, price_purchase, price_standard, price_wholesale, price_limited, price_other,sku_images
         , remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id
         , op_app_code, op_timestamp, op_db_user
     </sql>
@@ -28,6 +28,7 @@
                 <result column="price_standard" property="priceStandard"/>
                 <result column="price_wholesale" property="priceWholesale"/>
                 <result column="price_limited" property="priceLimited"/>
+                <result column="price_other" property="priceOther"/>
                 <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
                 <result column="remarks" property="remarks"/>
                 <result column="flg_valid" property="flgValid"/>
@@ -44,7 +45,7 @@
     <sql id="Base_Column_List_JOIN">
         tmgs.sku_id, tmgs.sku_code, tmgs.sku_name, tmgs.sku_model, tmgs.brand_id, tmgs.category_id, tmgs.unit_id, tmgs.sub_unit_id,
               tmgs.conversion_factor, tmgs.series_id, tmgs.sku_spec, tmgs.price_purchase, tmgs.price_standard,
-              tmgs.price_wholesale, tmgs.price_limited, tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.cp_id
+              tmgs.price_wholesale, tmgs.price_limited, tmgs.price_other,tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.cp_id
     </sql>
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.GoodsSkuResponse">
         <id column="sku_id" property="skuId"/>
@@ -61,6 +62,7 @@
         <result column="price_purchase" property="pricePurchase"/>
         <result column="price_standard" property="priceStandard"/>
         <result column="price_wholesale" property="priceWholesale"/>
+        <result column="price_other" property="priceOther"/>
         <result column="price_limited" property="priceLimited"/>
         <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
         <result column="remarks" property="remarks"/>

+ 4 - 3
src/main/java/com/dk/mdm/mapper/mst/OrgMapper.xml

@@ -275,16 +275,17 @@
         SELECT
         <include refid="Base_Column_List_view"/>
         ,tmg.org_name as parent_name
-        FROM t_mst_org AS parent
+        ,parent.org_code 
+        FROM dkic_b.t_mst_org AS parent
         left join dkic_b.t_mst_org tmg on tmg.org_id=parent.parent_id
-        WHERE parent.org_id = #{orgId}::uuid
+        WHERE parent.org_id = #{id}::uuid
     </select>
 
     <!-- 根据主键锁定表t_mst_org的一行数据 -->
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mst_org
+        FROM dkic_b.t_mst_org
         WHERE org_id = #{orgId}
         for update
     </select>

+ 8 - 6
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -1643,7 +1643,7 @@
         <result column="sumShouldHandle" property="sumShouldHandle"/>
         <result column="sumUsePaymentResidue" property="sumUsePaymentResidue"/>
         <result column="sumWaiveAmt" property="sumWaiveAmt"/>
-
+        <result column="makeTime" property="makeTime" typeHandler="TimestampTypeHandler"/>
         <collection property="itemResponseList" resultMap="PurTrackingReportItemListMap" columnPrefix="list_"/>
     </resultMap>
 
@@ -1664,6 +1664,7 @@
         <result column="remarks" property="remarks"/>
         <result column="sumQuantity" property="sumQuantity"/>
         <result column="sumAmount" property="sumAmount"/>
+        <result column="no" property="no"/>
     </resultMap>
     
     <!--采购跟踪表 明细查询-->
@@ -1698,6 +1699,7 @@
              ,T."remarks"  AS list_remarks
              ,T."sumQuantity"  AS list_sumQuantity
              ,T."sumAmount"  AS list_sumAmount
+             ,T."no" AS list_no
         FROM
             (
                 SELECT
@@ -1706,7 +1708,6 @@
                      ,tpp.contact_name AS "contactName"
                      ,tpp.contact_phone AS "contactPhone"
                      ,tpp.wh_id AS "whId"
-                     ,tpp.make_time AS "makeTime"
                      ,tpp.pickup_date AS "pickupDate"
                      ,tpp.sum_quantity AS "sumQuantity"
                      ,tpp.sum_amount AS "sumAmount"
@@ -1728,6 +1729,7 @@
                      ,tppi.price_pur AS "pricePur"
                      ,tppi.item_qty AS "itemQty"
                      ,tppi.remarks AS "remarks"
+                     ,tpp.make_time AS  "makeTime"
                 FROM
                     dkic_b.t_psi_purchase_item tppi
                         LEFT JOIN dkic_b.t_psi_purchase tpp ON tpp.pur_id = tppi.pur_id
@@ -1742,7 +1744,6 @@
                         ,NULL AS "contactName"
                         ,NULL AS "contactPhone"
                         ,NULL AS "whId"
-                        ,NULL AS "makeTime"
                         ,NULL AS "pickupDate"
                         ,0.00 AS "sumQuantity"
                         ,0.00 AS "sumAmount"
@@ -1753,7 +1754,7 @@
                         ,0.00 AS "sumUsePaymentResidue"
                         ,0.00 AS "sumWaiveAmt"
                         ,tpii.item_id AS "itemId"
-                        ,'采购入库' AS "type"
+                        ,'入库信息' AS "type"
                         ,tpii.sku_id AS "skuId"
                         ,tmgs.sku_code AS "skuCode"
                         ,tmgs.sku_name AS "skuName"
@@ -1767,6 +1768,7 @@
                     ELSE tpii.into_qty
                     END AS "itemQty"
                         ,tpii.remarks AS "remarks"
+                        ,tpi.make_time AS  "makeTime"
                 FROM
                     dkic_b.t_psi_inbound_item tpii
                     LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
@@ -1782,7 +1784,6 @@
                         ,NULL AS "contactName"
                         ,NULL AS "contactPhone"
                         ,NULL AS "whId"
-                        ,NULL AS "makeTime"
                         ,NULL AS "pickupDate"
                         ,0.00 AS "sumQuantity"
                         ,0.00 AS "sumAmount"
@@ -1807,6 +1808,7 @@
                     ELSE tpii.into_qty
                     END AS "itemQty"
                         ,tpii.remarks AS "remarks"
+                        ,tpi.make_time AS  "makeTime"
                 FROM
                     dkic_b.t_psi_inbound_item tpii
                     LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
@@ -1822,7 +1824,6 @@
                         ,NULL AS "contactName"
                         ,NULL AS "contactPhone"
                         ,NULL AS "whId"
-                        ,NULL AS "makeTime"
                         ,NULL AS "pickupDate"
                         ,0.00 AS "sumQuantity"
                         ,0.00 AS "sumAmount"
@@ -1844,6 +1845,7 @@
                         ,Null AS "pricePur"
                         ,Null AS "itemQty"
                         ,Null AS "remarks"
+                        ,tmrp.make_time AS  "makeTime"
                 FROM
                     dkic_b.t_mac_rec_pay tmrp
 

+ 4 - 1
src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml

@@ -334,10 +334,13 @@
                0                                                    as out_qty,
                0                                                    as out_amt,
                t.non_std_code,
-               tpobi.remarks
+               tpobi.remarks,
+               t.wh_id,
+               tmw.wh_name
         FROM dkic_b.t_psi_outbound_item as tpobi
                  inner join dkic_b.t_psi_order_item as t on t.item_id = tpobi.from_item_id
                  inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+                 left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
         where tpobi.flg_valid
           and tpobi.out_type = '出库类型-销售出库'
           and tpobi.out_qty > tpobi.return_qty

+ 6 - 0
src/main/java/com/dk/mdm/model/pojo/mac/RecPay.java

@@ -189,6 +189,12 @@ public class RecPay extends PageInfo<RecPay> implements Serializable {
     @ApiModelProperty(value = "业务单号")
     private String biznisNo;
 
+    /**
+     * 核销标识(是否是订单的出库的核销单)
+     */
+    @Excel(name = "核销标识(是否是订单的出库的核销单)")
+    @ApiModelProperty(value = "核销标识(是否是订单的出库的核销单)")
+    private Boolean flgOrderHandle;
 
     /**
      * 锁定标识

+ 7 - 0
src/main/java/com/dk/mdm/model/pojo/mst/GoodsSku.java

@@ -164,6 +164,13 @@ public class GoodsSku extends PageInfo<GoodsSku> implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
+
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)

+ 2 - 1
src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java

@@ -58,7 +58,8 @@ public class OtherReceivableQuery extends PageInfo<OtherReceivableQuery> impleme
     @ApiModelProperty(value = "其它收入单号")
     private String receivableNo;
 
-
+    @ApiModelProperty(value = "模糊查询")
+    private String searchText;
     /**
      * 对象类型 (【系统字典】客户、供应商)
      */

+ 8 - 0
src/main/java/com/dk/mdm/model/query/mac/RecPayQuery.java

@@ -196,6 +196,14 @@ public class RecPayQuery extends PageInfo<RecPayQuery> implements Serializable {
 
 
     /**
+     * 核销标识(是否是订单的出库的核销单)
+     */
+    @Excel(name = "核销标识(是否是订单的出库的核销单)")
+    @ApiModelProperty(value = "核销标识(是否是订单的出库的核销单)")
+    private Boolean flgOrderHandle;
+
+
+    /**
      * 锁定标识
      */
     @Excel(name = "锁定标识")

+ 8 - 0
src/main/java/com/dk/mdm/model/query/mst/GoodsSkuQuery.java

@@ -168,6 +168,13 @@ public class GoodsSkuQuery extends PageInfo<GoodsSku> implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
+
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
@@ -273,6 +280,7 @@ public class GoodsSkuQuery extends PageInfo<GoodsSku> implements Serializable {
     @ApiModelProperty(value = "品牌")
     private String brandIds;
 
+
     /**
      * @desc   : 有效标识List
      * @author : 宋扬

+ 3 - 0
src/main/java/com/dk/mdm/model/response/mac/OtherPayableResponse.java

@@ -201,5 +201,8 @@ public class OtherPayableResponse extends PageInfo<OtherPayableResponse> impleme
     @ApiModelProperty(value = "合计付款")
     private BigDecimal sumAmtPay;
 
+    @ApiModelProperty(value = "大编辑标识")
+    private Boolean daEdit;
+
     private static final long serialVersionUID = 1L;
 }

+ 3 - 0
src/main/java/com/dk/mdm/model/response/mac/OtherReceivableResponse.java

@@ -211,6 +211,9 @@ public class OtherReceivableResponse extends PageInfo<OtherReceivableResponse> i
     @ApiModelProperty(value = "合计收款")
     private BigDecimal sumAmtRec;
 
+    @ApiModelProperty(value = "大编辑标识")
+    private Boolean daEdit;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 8 - 0
src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java

@@ -193,6 +193,14 @@ public class RecPayResponse extends PageInfo<RecPayResponse> implements Serializ
 
 
     /**
+     * 核销标识(是否是订单的出库的核销单)
+     */
+    @Excel(name = "核销标识(是否是订单的出库的核销单)")
+    @ApiModelProperty(value = "核销标识(是否是订单的出库的核销单)")
+    private Boolean flgOrderHandle;
+
+
+    /**
      * 锁定标识
      */
     @Excel(name = "锁定标识")

+ 11 - 0
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -313,6 +313,17 @@ public class CustomerResponse extends PageInfo<CustomerResponse> implements Seri
     private BigDecimal receiptResidue;
 
 
+    private BigDecimal orderQuantity;
+
+    private BigDecimal orderAmount;
+
+    private BigDecimal outboundQuantity;
+
+    private BigDecimal outboundAmount;
+
+
+
+
     private static final long serialVersionUID = 1L;
 
 }

+ 6 - 0
src/main/java/com/dk/mdm/model/response/mst/GoodsSkuResponse.java

@@ -169,6 +169,12 @@ public class GoodsSkuResponse implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)

+ 8 - 0
src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java

@@ -194,6 +194,14 @@ public class RecPayVO extends PageInfo<RecPayVO> implements Serializable {
 
 
     /**
+     * 核销标识(是否是订单的出库的核销单)
+     */
+    @Excel(name = "核销标识(是否是订单的出库的核销单)")
+    @ApiModelProperty(value = "核销标识(是否是订单的出库的核销单)")
+    private Boolean flgOrderHandle;
+
+
+    /**
      * 锁定标识
      */
     @Excel(name = "锁定标识")

+ 6 - 0
src/main/java/com/dk/mdm/model/vo/mst/GoodsSkuVO.java

@@ -164,6 +164,12 @@ public class GoodsSkuVO implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)

+ 0 - 7
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseReturnService.java

@@ -620,13 +620,6 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
 
         //region 编辑明细
         for (InboundItemVO inboundItemVO : inboundVO.getItemList()) {
-            //region  不能新建
-            if (inboundItemVO.getSPurItemId() == null) {
-                throw new BaseBusinessException(ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getCode(),
-                        ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getMessage());
-            }
-            //endregion
-
             //查询原单
             InboundItemResponse inboundItemResponse = inboundItemMapper.selectById(inboundItemVO.getItemId());
             //region 校验数量是否超出

+ 1 - 1
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -922,7 +922,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                         .setOutQty(outboundItemResponse.getOutQty().add(outboundItemVO.getOutingQty()))
                         .setOutAmt(outboundItemResponse.getOutAmt().add(outboundItemVO.getOutingAmt()))
                         .setOutingQty(BigDecimal.ZERO)
-                        .setOutAmt(BigDecimal.ZERO)
+                        .setOutingAmt(BigDecimal.ZERO)
                         .setCostPrice(outboundItemVO.getPriceOut())
                         .setCostAmt(outboundItemVO.getOutQty().multiply(outboundItemVO.getPriceOut()).setScale(2, BigDecimal.ROUND_HALF_UP))
                 ;

+ 1 - 6
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java

@@ -233,7 +233,7 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
      */
     @Transactional(rollbackFor = {Exception.class})
     public void rollBackTotalAndDetail(List<OutboundItemVO> deleteItemList) {
-        if (deleteItemList.get(0).getFromItemId() != null) {
+        if (deleteItemList.size() > 0 &&  deleteItemList.get(0).getFromItemId() != null) {
             //出库单
             Map<String, List<OutboundItemVO>> collect = deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getSOutId));
             for (String outId : collect.keySet()) {
@@ -866,11 +866,6 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
 
         //region 编辑明细
         for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
-            //region  不能新建
-            if (outboundItemVO.getSOrderItemId() == null) {
-                throw new BaseBusinessException(ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getCode(),
-                        ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getMessage());
-            }
             //endregion
 
             //查询原单

+ 31 - 10
src/main/java/com/dk/mdm/service/mac/AccountService.java

@@ -24,12 +24,14 @@ import com.dk.mdm.model.pojo.sale.Order;
 import com.dk.mdm.model.query.mac.AccountItemQuery;
 import com.dk.mdm.model.response.mac.AccountItemResponse;
 import com.dk.mdm.model.response.mac.AccountResponse;
+import com.dk.mdm.service.common.CommonService;
 import com.dk.mdm.service.mst.MoneyAccountService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -94,6 +96,9 @@ public class AccountService extends BaseService<Account> {
     @Autowired
     private RecPayHandleItemMapper recPayHandleItemMapper;
 
+    @Autowired
+    private CommonService commonService;
+
     /**
      * @desc : 查看来源单据,总单加明细
      * @author : 姜永辉
@@ -357,7 +362,7 @@ public class AccountService extends BaseService<Account> {
                 Order orderForUpdate = orderMapper.selectByIdForUpdate(outbound.getFromId());
                 // 如果当前订单已经全部出库
                 if (orderForUpdate != null && orderForUpdate.getOutQty().compareTo(orderForUpdate.getSumQuantity()) == 0) {
-                    RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(orderForUpdate.getOrderId());
+                    RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(orderForUpdate.getOrderId(),false);
                     if (recPayForUpdate != null && recPayForUpdate.getFlgLock()) {
                         // 先把收款单解锁
                         RecPay recPayUpdate = new RecPay();
@@ -385,6 +390,17 @@ public class AccountService extends BaseService<Account> {
                                 new AccountItemQuery().setObjectId(objectId).setOrderId(orderForUpdate.getOrderId()));
 
                         if (accountItemResponseList.size() > 0) {
+                            // 生成核销总单
+                            RecPay recPayHandle = new RecPay();
+                            // 获取单号
+                            Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+                            recPayHandle.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
+                                    .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(objectId)
+                                    .setOrgId(recPayForUpdate.getOrgId()).setStaffId(recPayForUpdate.getStaffId()).setAccDate(LocalDate.now())
+                                    .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(recPayForUpdate.getBiznisId()).setBiznisNo(recPayForUpdate.getBiznisNo())
+                                    .setMakeStaff(recPayForUpdate.getMakeStaff()).setCpId(recPayForUpdate.getCpId()).setFlgOrderHandle(true);
+                            recPayMapper.insert(recPayHandle);
+
                             // 记录核销了哪些应收账
                             List<RecPayHandleItem> receivableList = new ArrayList<>();
 
@@ -393,7 +409,7 @@ public class AccountService extends BaseService<Account> {
 
                             for (AccountItemResponse accountItemResponse : accountItemResponseList) {
                                 RecPayHandleItem recPayHandleItem = new RecPayHandleItem();
-                                recPayHandleItem.setRpId(recPayForUpdate.getRpId()).setCpId(recPayForUpdate.getCpId()).setAccDate(recPayForUpdate.getAccDate())
+                                recPayHandleItem.setRpId(recPayHandle.getRpId()).setCpId(recPayHandle.getCpId()).setAccDate(recPayHandle.getAccDate())
                                         .setAccItemId(accountItemResponse.getAccItemId());
                                 // 如果定金比应收金额大
                                 if (lockAmt.compareTo(accountItemResponse.getAmtResidue()) == 1) {
@@ -436,11 +452,11 @@ public class AccountService extends BaseService<Account> {
                             recPayUpdate = new RecPay();
                             recPayUpdate.setSumAmtReceivableHandle(recPayHandleItem.getAmtReceivableHandle())
                                     .setSumShouldHandle(recPayHandleItem.getAmtReceivableHandle())
-                                    .setRpId(recPayForUpdate.getRpId());
+                                    .setRpId(recPayHandle.getRpId());
                             receiptService.updateByUuid(recPayUpdate);
 
                             // 更新总账上
-                            accountForUpdate = accountMapper.selectByIdForUpdate(recPayForUpdate.getObjectId());
+                            accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
                             accountUpdate = new Account();
                             accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().add(recPayHandleItem.getAmtReceivableHandle()))// 总应收收款金额
                                     .setObjectId(accountForUpdate.getObjectId());
@@ -522,10 +538,11 @@ public class AccountService extends BaseService<Account> {
             // 如果当前出库单对应的订单做了应收收款,则自动作废应收核销,并且锁定金额订单收款(锁定金额)
             // 如果是销售出库
             if (outbound.getOutType().equals(Constant.OutType.SALE.getName())) {
-                RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId());
-                if (recPayForUpdate != null) {
+                RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId(),false);        // 款
+                RecPay recPayHandleForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId(),true);   // 账
+                if (recPayForUpdate != null && recPayHandleForUpdate != null) {
                     // 查出并锁定所有应收核销明细
-                    List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
+                    List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayHandleForUpdate.getRpId());
                     if (recPayHandleItemForUpdateList.size() > 0) {
                         for (RecPayHandleItem recPayHandleItemForUpdate : recPayHandleItemForUpdateList) {
                             // 更新账款明细应收收款
@@ -541,10 +558,10 @@ public class AccountService extends BaseService<Account> {
                         }
 
                         // 把总帐上的钱加回来
-                        accountForUpdate = accountMapper.selectByIdForUpdate(recPayForUpdate.getObjectId());
+                        accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
                         accountUpdate = new Account();
-                        accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().subtract(recPayForUpdate.getSumAmtReceivableHandle()))// 总应收收款金额
-                                .setObjectId(accountForUpdate.getObjectId());
+                        accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().subtract(recPayHandleForUpdate.getSumAmtReceivableHandle()))// 总应收收款金额
+                                .setObjectId(objectId);
                         // 剩余应收 = 总应收账款-总应收收款金额
                         accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
                         // 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
@@ -557,6 +574,9 @@ public class AccountService extends BaseService<Account> {
                         }
                         super.updateByUuid(accountUpdate);
 
+                        // 删掉收款核销单
+                        recPayMapper.deleteById(recPayHandleForUpdate.getRpId());
+
                         // 先把收款单锁定
                         RecPay recPayUpdate = new RecPay();
                         recPayUpdate.setFlgLock(true).setRpId(recPayForUpdate.getRpId());
@@ -571,6 +591,7 @@ public class AccountService extends BaseService<Account> {
                         }
 
                         // 钱进到锁定金额中
+                        accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
                         accountUpdate = new Account();
                         accountUpdate.setReceipt(accountForUpdate.getReceipt().subtract(recPayForUpdate.getSumAmtRec()))
                                 .setReceiptResidue(accountForUpdate.getReceiptResidue().subtract(recPayForUpdate.getSumAmtRec()))

+ 40 - 19
src/main/java/com/dk/mdm/service/mac/OtherPayableService.java

@@ -23,11 +23,9 @@ import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.mdm.model.pojo.mst.MoneyAccountItem;
 import com.dk.mdm.model.query.mac.OtherPayableItemQuery;
 import com.dk.mdm.model.query.mac.OtherPayableQuery;
+import com.dk.mdm.model.query.mac.RecPayHandleItemQuery;
 import com.dk.mdm.model.query.mac.RecPayItemQuery;
-import com.dk.mdm.model.response.mac.OtherPayableItemResponse;
-import com.dk.mdm.model.response.mac.OtherPayableResponse;
-import com.dk.mdm.model.response.mac.RecPayItemResponse;
-import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.response.mac.*;
 import com.dk.mdm.model.vo.mac.OtherPayableItemVO;
 import com.dk.mdm.model.vo.mac.OtherPayableVO;
 import com.dk.mdm.model.vo.mac.RecPayItemVO;
@@ -148,7 +146,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
     )
     public ResponseResultVO<?> insert(OtherPayableVO otherPayableVO) {
         // 付款金额不能大于支出金额
-        if(otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1){
+        if (otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1) {
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
         }
 
@@ -268,9 +266,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 
             // 更新前的最后校验
             // 剩余应付为负数,则不能保存
-            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-            }
+//            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -300,13 +298,13 @@ public class OtherPayableService extends BaseService<OtherPayable> {
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVOICE_ISQICHU.getMessage());
         }
         // 付款金额不能大于支出金额
-        if(otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1){
+        if (otherPayableVO.getSumAmtPay().compareTo(otherPayableVO.getSumAmtPayable()) == 1) {
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.PAYABLE_NO_LESS_PAYMENT.getMessage());
         }
 
         /*******************************************  应付付款的处理 begin ********************************************/
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherPayableVO.getPayableId());
-        if(recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherPayableVO.getPayableId(), false);
+        if (recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
             // 查出并锁定所有应付核销明细
             AccountItem accountItemForUpdate;
             List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
@@ -339,9 +337,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 
             // 更新前的最后校验
             // 剩余应付为负数,则不能保存
-            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-            }
+//            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -497,9 +495,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 
             // 更新前的最后校验
             // 剩余应付为负数,则不能保存
-            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-            }
+//            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -518,6 +516,29 @@ public class OtherPayableService extends BaseService<OtherPayable> {
     public ResponseResultVO<?> getOtherPayableForUpdate(String id) {
         Map<String, Object> dataInfo = new HashMap<>();
         OtherPayableResponse otherPayableResponse = otherPayableMapper.selectById(id);
+
+        // 判断是否能大编辑
+        otherPayableResponse.setDaEdit(true);
+        if (otherPayableResponse.getAccItemId() != null) {
+            // 查出新建时是否付款了
+            RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
+            // 查出有多少次付款
+            List<RecPayHandleItemResponse> RecPayHandleItemResponseList = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setAccItemId(otherPayableResponse.getAccItemId()));
+            if (RecPayHandleItemResponseList != null && RecPayHandleItemResponseList.size() > 0) {
+                // 如果有付款,并且新建时没付款,则不能大编辑
+                if(recPayForUpdate == null){
+                    otherPayableResponse.setDaEdit(false);
+                }else{
+                    for(RecPayHandleItemResponse  recPayHandleItemResponse :RecPayHandleItemResponseList){
+                        // 如果核销id不是第一次付款id,不能大编辑
+                        if(!recPayHandleItemResponse.getRpId().equals(recPayForUpdate.getRpId())){
+                            otherPayableResponse.setDaEdit(false);
+                        }
+                    }
+                }
+            }
+        }
+        // 支出明细
         dataInfo.put("data", otherPayableResponse);
 
         // 商品明细
@@ -550,8 +571,8 @@ public class OtherPayableService extends BaseService<OtherPayable> {
         // 如果所在月份已结账,则不能作废 todo
 
         /*******************************************  应付付款的处理 begin ********************************************/
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id);
-        if(recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
+        if (recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
             // 查出并锁定所有应付核销明细
             AccountItem accountItemForUpdate;
             List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());

+ 35 - 15
src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java

@@ -22,11 +22,9 @@ import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.mdm.model.pojo.mst.MoneyAccountItem;
 import com.dk.mdm.model.query.mac.OtherReceivableItemQuery;
 import com.dk.mdm.model.query.mac.OtherReceivableQuery;
+import com.dk.mdm.model.query.mac.RecPayHandleItemQuery;
 import com.dk.mdm.model.query.mac.RecPayItemQuery;
-import com.dk.mdm.model.response.mac.OtherReceivableItemResponse;
-import com.dk.mdm.model.response.mac.OtherReceivableResponse;
-import com.dk.mdm.model.response.mac.RecPayItemResponse;
-import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.response.mac.*;
 import com.dk.mdm.model.vo.mac.OtherReceivableItemVO;
 import com.dk.mdm.model.vo.mac.OtherReceivableVO;
 import com.dk.mdm.model.vo.mac.RecPayItemVO;
@@ -267,9 +265,9 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 
             // 更新前的最后校验
             // 剩余应收为负数,则不能保存
-            if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-            }
+//            if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -305,7 +303,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 
         /***********************************  应收收款的处理 begin ************************************/
         // 如果收款了,先把收款作废掉
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherReceivableVO.getReceivableId());
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherReceivableVO.getReceivableId(), false);
         if(recPayForUpdate != null && recPayForUpdate.getFlgValid()){
             // 查出并锁定所有应收核销明细
             AccountItem accountItemForUpdate;
@@ -339,9 +337,9 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 
             // 更新前的最后校验
             // 剩余应收为负数,则不能保存
-            if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-            }
+//            if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -498,9 +496,9 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 
             // 更新前的最后校验
             // 剩余应收为负数,则不能保存
-            if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-            }
+//            if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -519,6 +517,28 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
     public ResponseResultVO<?> getOtherReceivableForUpdate(String id) {
         Map<String, Object> dataInfo = new HashMap<>();
         OtherReceivableResponse otherReceivableResponse = otherReceivableMapper.selectById(id);
+
+        // 判断是否能大编辑
+        otherReceivableResponse.setDaEdit(true);
+        if (otherReceivableResponse.getAccItemId() != null) {
+            // 查出新建时是否收款了
+            RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
+            // 查出有多少次收款
+            List<RecPayHandleItemResponse> RecPayHandleItemResponseList = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setAccItemId(otherReceivableResponse.getAccItemId()));
+            if (RecPayHandleItemResponseList != null && RecPayHandleItemResponseList.size() > 0) {
+                // 如果有收款,并且新建时没收款,则不能大编辑
+                if(recPayForUpdate == null){
+                    otherReceivableResponse.setDaEdit(false);
+                }else{
+                    for(RecPayHandleItemResponse  recPayHandleItemResponse :RecPayHandleItemResponseList){
+                        // 如果核销id不是第一次收款id,不能大编辑
+                        if(!recPayHandleItemResponse.getRpId().equals(recPayForUpdate.getRpId())){
+                            otherReceivableResponse.setDaEdit(false);
+                        }
+                    }
+                }
+            }
+        }
         dataInfo.put("data", otherReceivableResponse);
 
         // 收入明细
@@ -551,7 +571,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
         // 如果所在月份已结账,则不能作废 todo
 
         /***********************************  应收收款的处理 begin ************************************/
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id);
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
         if(recPayForUpdate != null && recPayForUpdate.getFlgValid()){
             // 查出并锁定所有应收核销明细
             AccountItem accountItemForUpdate;

+ 41 - 3
src/main/java/com/dk/mdm/service/mac/PaymentService.java

@@ -280,6 +280,22 @@ public class PaymentService extends BaseService<RecPay> {
     }
 
     /**
+     * @desc : 更新应收核销(小编辑)
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> updatePayablePayment(RecPayVO recPayVO) {
+        // 先只改备注和附件
+        RecPay recPay = new RecPay();
+        recPay.setRemarks(recPayVO.getRemarks()).setAnnexPaths(recPayVO.getAnnexPaths()).setRpId(recPayVO.getRpId());
+        super.updateByUuid(recPay);
+        return ResponseResultUtil.success();
+    }
+
+    /**
      * @desc : 作废
      * @author : 付斌
      * @date : 2024-03-08 16:38
@@ -327,9 +343,9 @@ public class PaymentService extends BaseService<RecPay> {
 
         // 更新前的最后校验
         // 剩余应付为负数,则不能保存
-        if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
-            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-        }
+//        if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//        }
         // 可用金额为负数,则不能保存
         if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -364,4 +380,26 @@ public class PaymentService extends BaseService<RecPay> {
         super.updateByUuid(recPayUpdate);
         return ResponseResultUtil.success();
     }
+
+    /**
+     * @desc : 获取应付付款(编辑用)
+     * @author : 付斌
+     * @date : 2024-02-28 13:25
+     */
+    @Pagination
+    public ResponseResultVO getPayablePaymentForUpdate(String id) {
+        Map<String, Object> result = new HashMap<>();
+        RecPayResponse recPayResponse = recPayMapper.selectById(id);
+        result.put("data", recPayResponse);
+        // 付款明细
+        List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
+        result.put("dataItem", recPayItem);
+
+        // 应付核销明细
+        List<RecPayHandleItemResponse> recPayHandleItem = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setRpId(id));
+        result.put("recPayHandleItem", recPayHandleItem);
+
+        // 附件
+        return ResponseResultUtil.success(result);
+    }
 }

+ 42 - 3
src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -515,6 +515,22 @@ public class ReceiptService extends BaseService<RecPay> {
     }
 
     /**
+     * @desc : 更新应收核销(小编辑)
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> updateReceivableReceipt(RecPayVO recPayVO) {
+        // 先只改备注和附件
+        RecPay recPay = new RecPay();
+        recPay.setRemarks(recPayVO.getRemarks()).setAnnexPaths(recPayVO.getAnnexPaths()).setRpId(recPayVO.getRpId());
+        super.updateByUuid(recPay);
+        return ResponseResultUtil.success();
+    }
+
+    /**
      * @desc : 作废
      * @author : 付斌
      * @date : 2024-03-08 16:38
@@ -562,9 +578,9 @@ public class ReceiptService extends BaseService<RecPay> {
 
         // 更新前的最后校验
         // 剩余应收为负数,则不能保存
-        if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
-            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-        }
+//        if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//        }
         // 可用金额为负数,则不能保存
         if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
             throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
@@ -599,4 +615,27 @@ public class ReceiptService extends BaseService<RecPay> {
         super.updateByUuid(recPayUpdate);
         return ResponseResultUtil.success();
     }
+
+    /**
+     * @desc : 获取应收收款(编辑用)
+     * @author : 付斌
+     * @date : 2024-02-28 13:25
+     */
+    @Pagination
+    public ResponseResultVO getReceivableReceiptForUpdate(String id) {
+        Map<String, Object> result = new HashMap<>();
+        RecPayResponse recPayResponse = recPayMapper.selectById(id);
+        result.put("data", recPayResponse);
+        // 收款明细
+        List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
+        result.put("dataItem", recPayItem);
+
+        // 应收核销明细
+        List<RecPayHandleItemResponse> recPayHandleItem = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setRpId(id));
+        result.put("recPayHandleItem", recPayHandleItem);
+
+        // 附件
+        return ResponseResultUtil.success(result);
+    }
+
 }

+ 1 - 4
src/main/java/com/dk/mdm/service/mst/OrgService.java

@@ -133,17 +133,15 @@ public class OrgService extends BaseService<Org> {
     public ResponseResultVO<?> insert(OrgVO orgVO) {
         // 转化实体
         Org organization = orgConvert.convertToPo(orgVO);
-        // 获取显示顺序
-        Integer displayNo = commonService.getMaxDisplayNo(Constant.DisplayNoTable.ORG);
         Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.ORG.getName(), true);
         // 获取编码和主键UuId
-        organization.setDisplayNo(displayNo);
         organization.setOrgId(codeMap.get("outId").toString());
         organization.setOrgCode(codeMap.get("outNote").toString());
 
         //查询 本次要加的 部门的 父级下 最大的DisplayNo  然后加1  就是现在要加的DisplayNo
         Map<String, Object> param = new HashMap<>();
         param.put("otherCond", "parent_id = #{parentID} ::uuid");
+        param.put("parentId",organization.getParentId());
         organization.setDisplayNo(commonService.getMaxDisplayNo(Constant.DisplayNoTable.ORG ,param));
         if (organization.getParentId() != null) {
             Org org = orgMapper.selectById(organization.getParentId());
@@ -151,7 +149,6 @@ public class OrgService extends BaseService<Org> {
             organization.setTopId(org.getTopId());
         }
 
-
         // 插入组织部门数据
         super.insert(organization);
         //执行函数

+ 2 - 0
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -26,6 +26,7 @@ import com.dk.mdm.model.query.mst.StaffQuery;
 import com.dk.common.model.response.mst.StaffResponse;
 import com.dk.common.model.vo.mst.StaffVO;
 import com.dk.mdm.service.common.CommonService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +41,7 @@ import java.util.*;
  * @date : 2023/1/4 9:25
  */
 @Service
+@Slf4j
 public class StaffService extends BaseService<Staff> {
     @Resource
     private CompanyFeign companyFeign;

+ 4 - 4
src/main/java/com/dk/mdm/service/sale/OrderService.java

@@ -171,7 +171,7 @@ public class OrderService extends BaseService<Order> {
         result.put("orderItem", orderItem);
 
         // 收款明细
-        List<RecPayResponse> recPayList = recPayMapper.selectByCond(new RecPayQuery().setBiznisId(id));
+        List<RecPayResponse> recPayList = recPayMapper.selectByCond(new RecPayQuery().setBiznisId(id).setFlgOrderHandle(false));
         if (recPayList != null && recPayList.size() > 0) {
             List<RecPayItemResponse> receiptItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(recPayList.get(0).getRpId()));
             result.put("receiptItem", receiptItem);
@@ -431,7 +431,7 @@ public class OrderService extends BaseService<Order> {
         // 需要重新计算的资金账户
         List<String> macList = new ArrayList<>();
         // 收款明细
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(orderVO.getOrderId());
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(orderVO.getOrderId(), false);
         if (recPayForUpdate != null) {
             // 将之前的明细全部删除
             List<RecPayItem> recPayItemOriginalList = recPayItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
@@ -553,7 +553,7 @@ public class OrderService extends BaseService<Order> {
         // 需要重新计算的资金账户
         List<String> macList = new ArrayList<>();
         // 收款明细
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id);
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
         if (recPayForUpdate != null) {
             // 将之前的明细全部删除
             List<RecPayItem> recPayItemOriginalList = recPayItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
@@ -601,7 +601,7 @@ public class OrderService extends BaseService<Order> {
         dataInfo.put("dataItem", orderItemResponse);
 
         // 收款明细
-        List<RecPayResponse> recPayList = recPayMapper.selectByCond(new RecPayQuery().setBiznisId(id));
+        List<RecPayResponse> recPayList = recPayMapper.selectByCond(new RecPayQuery().setBiznisId(id).setFlgOrderHandle(false));
         if (recPayList != null && recPayList.size() > 0) {
             List<RecPayItemResponse> receiptItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(recPayList.get(0).getRpId()));
             dataInfo.put("receiptItem", receiptItem);