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

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

changhaoning 1 год назад
Родитель
Сommit
c01ef470e7
28 измененных файлов с 319 добавлено и 56 удалено
  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. 3 0
      src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml
  4. 25 18
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java
  5. 18 1
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml
  6. 15 1
      src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml
  7. 1 1
      src/main/java/com/dk/mdm/mapper/mst/OrgMapper.xml
  8. 9 0
      src/main/java/com/dk/mdm/mapper/mst/SaleChannelMapper.java
  9. 10 1
      src/main/java/com/dk/mdm/mapper/mst/SaleChannelMapper.xml
  10. 5 0
      src/main/java/com/dk/mdm/mapper/mst/WarehouseMapper.java
  11. 8 6
      src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml
  12. 4 1
      src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml
  13. 6 0
      src/main/java/com/dk/mdm/model/pojo/mac/RecPay.java
  14. 2 1
      src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java
  15. 8 0
      src/main/java/com/dk/mdm/model/query/mac/RecPayQuery.java
  16. 8 0
      src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java
  17. 11 0
      src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java
  18. 8 0
      src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java
  19. 1 1
      src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java
  20. 1 1
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java
  21. 1 6
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java
  22. 31 10
      src/main/java/com/dk/mdm/service/mac/AccountService.java
  23. 2 2
      src/main/java/com/dk/mdm/service/mac/OtherPayableService.java
  24. 2 2
      src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java
  25. 38 0
      src/main/java/com/dk/mdm/service/mac/PaymentService.java
  26. 39 0
      src/main/java/com/dk/mdm/service/mac/ReceiptService.java
  27. 16 0
      src/main/java/com/dk/mdm/service/mst/SaleChannelService.java
  28. 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);
+    }
 }

+ 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>

+ 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);
 }
 

+ 18 - 1
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>
@@ -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",
@@ -312,6 +318,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 +351,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 +396,7 @@
             biznis_type,
             biznis_id,
             biznis_no,
+            flg_order_handle,
             flg_lock,
             make_staff,
             make_time,
@@ -418,6 +427,7 @@
                 #{item.biznisType},
                 #{item.biznisId}::uuid,
                 #{item.biznisNo},
+                #{item.flgOrderHandle},
                 #{item.flgLock},
                 #{item.makeStaff}::uuid,
                 #{item.makeTime},
@@ -456,6 +466,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 +518,10 @@
             )
         </if>
     </select>
+
+    <!-- 删除收款单 -->
+    <delete id="deleteById">
+        DELETE FROM dkic_b.t_mac_rec_pay
+        WHERE rp_id = #{id}::uuid;
+    </delete>
 </mapper>

+ 15 - 1
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>
 
     <!-- 通用条件列 -->
@@ -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

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

@@ -275,7 +275,7 @@
         SELECT
         <include refid="Base_Column_List_view"/>
         ,tmg.org_name as parent_name
-        FROM t_mst_org AS parent
+        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
     </select>

+ 9 - 0
src/main/java/com/dk/mdm/mapper/mst/SaleChannelMapper.java

@@ -36,5 +36,14 @@ public interface SaleChannelMapper extends BaseMapper<SaleChannel> {
      * @date :  2023/1/4 9:39
      */
     Integer updateBatchSaleChannelDisplayNo(List<Map<String,Object>> dataIds);
+
+
+
+    /**
+     * @desc : 修改默认
+     * @author : 于继渤
+     * @date :  2023/1/4 9:39
+     */
+    Integer updateFlgDefault(Integer id);
 }
 

+ 10 - 1
src/main/java/com/dk/mdm/mapper/mst/SaleChannelMapper.xml

@@ -115,7 +115,7 @@
         <include refid="Base_Column_List"/>
         FROM dkic_b.t_mst_sale_channel
         <include refid="Condition"/>
-        order by display_no
+        order by CASE WHEN flg_default = true THEN 0 ELSE 1 END, display_no
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
@@ -197,4 +197,13 @@
             WHERE channel_id = #{item.id}::uuid
         </foreach>
     </update>
+
+
+
+    <update id="updateFlgDefault">
+        UPDATE dkic_b.t_mst_sale_channel
+        SET
+            flg_default = false
+        WHERE    cp_id = #{id} AND (flg_default = true OR flg_default is null)
+    </update>
 </mapper>

+ 5 - 0
src/main/java/com/dk/mdm/mapper/mst/WarehouseMapper.java

@@ -40,6 +40,11 @@ public interface WarehouseMapper extends BaseMapper<Warehouse>{
      * @date :  2023/1/4 9:39
      */
     Integer updateBatchWarehouseDisplayNo(List<Map<String,Object>> dataIds);
+    /**
+     * @desc : 修改默认
+     * @author : 于继渤
+     * @date :  2023/1/4 9:39
+     */
     Integer updateFlgDefault(Integer id);
 
 }

+ 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;
 
     /**
      * 锁定标识

+ 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/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;
 
 }

+ 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 = "锁定标识")

+ 1 - 1
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java

@@ -770,7 +770,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                 Purchase purchase = new Purchase();
                 purchase.setPurId(inboundResponse.getFromId());
                 purchase.setIntoQty(inboundResponse.getIntoQty().negate());
-                purchase.setIntoQty(inboundResponse.getIntoAmt().negate());
+                purchase.setIntoAmt(inboundResponse.getIntoAmt().negate());
                 //入库状态
                 String intoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty(),
                         purchaseResponse.getIntoQty().add(purchase.getIntoQty()), purchaseResponse.getSumQuantity());

+ 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()))

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

@@ -305,7 +305,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
         }
 
         /*******************************************  应付付款的处理 begin ********************************************/
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherPayableVO.getPayableId());
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(otherPayableVO.getPayableId(), false);
         if(recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
             // 查出并锁定所有应付核销明细
             AccountItem accountItemForUpdate;
@@ -550,7 +550,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
         // 如果所在月份已结账,则不能作废 todo
 
         /*******************************************  应付付款的处理 begin ********************************************/
-        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id);
+        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(id, false);
         if(recPayForUpdate != null && recPayForUpdate.getFlgValid()) {
             // 查出并锁定所有应付核销明细
             AccountItem accountItemForUpdate;

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

@@ -305,7 +305,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;
@@ -551,7 +551,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;

+ 38 - 0
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
@@ -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);
+    }
 }

+ 39 - 0
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
@@ -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);
+    }
+
 }

+ 16 - 0
src/main/java/com/dk/mdm/service/mst/SaleChannelService.java

@@ -8,10 +8,12 @@ import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mst.SaleChannelConvert;
+import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.model.pojo.mst.SaleChannel;
 import com.dk.mdm.mapper.mst.SaleChannelMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mst.Warehouse;
 import com.dk.mdm.model.query.mst.SaleChannelQuery;
 import com.dk.mdm.model.response.mst.SaleChannelResponse;
 import com.dk.mdm.model.response.mst.WarehouseResponse;
@@ -44,6 +46,10 @@ public class SaleChannelService extends BaseService<SaleChannel> {
 	@Autowired
 	private SaleChannelConvert saleChannelConvert;
 
+
+	@Autowired
+	private AuthUtils authUtils;
+
 	/**
 	 * @desc : 重写主键
 	 * @author : 于继渤
@@ -91,6 +97,11 @@ public class SaleChannelService extends BaseService<SaleChannel> {
 		if(saleChannelResponses.size() > 0){
 			return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SALECHANNEL_NAME_NOT.getMessage());
 		}else{
+			//新建如果是默认取消其他默认
+			if(saleChannelVO.getFlgDefault()){
+				//默认  把其他置为非默认
+				saleChannelMapper.updateFlgDefault(authUtils.getStaff().getCpId());
+			}
 			//新建
 			saleChannelMapper.insert(saleChannel);
 		}
@@ -112,6 +123,11 @@ public class SaleChannelService extends BaseService<SaleChannel> {
 			rollbackFor = {Exception.class}
 	)
 	public ResponseResultVO<?> update(SaleChannelVO saleChannelVO) {
+		SaleChannel saleChannel1 = saleChannelMapper.selectById(saleChannelVO.getChannelId());
+		if ((saleChannel1.getFlgDefault() == null || !saleChannel1.getFlgDefault()) && saleChannelVO.getFlgDefault() != null && saleChannelVO.getFlgDefault()) {
+			//默认  把其他置为非默认
+			saleChannelMapper.updateFlgDefault(saleChannelVO.getCpId());
+		}
 		SaleChannel saleChannel = saleChannelConvert.convertToPo(saleChannelVO);
 		super.updateByUuid(saleChannel);
 		return ResponseResultUtil.success();

+ 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);