shiyunteng
2026-08-26 b967d23ae6c1f7761feb3c5328e3b591df6a735d
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
@@ -138,7 +138,8 @@
                        PaymentConfirm contractLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,completeContract.getId())
                              .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
                        //查询客户付款完成合同中最后明细金额 有预收转入当前合同
                        if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0){
                        if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0&&
                        contract.getContractNo().startsWith("ZB-")){
                           //新增完成付款合同 资金转出
                           PaymentConfirm outConfirm = BeanUtil.copyProperties(contractLastConfirm,PaymentConfirm.class,"id","transationAmount",
                                 "advanceAmount","receivableAmount","overdueAmount","totalAmount");
@@ -167,13 +168,16 @@
                           }else if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0"))<0){
                              inConfirm.setReceivableAmount(inConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
                           }
                           paymentConfirmMapper.insert(inConfirm);
                           if (contract.getContractNo().startsWith("ZB-")) {
                              paymentConfirmMapper.insert(inConfirm);
                           }
                        }
                     }
                  }
               }
               currentConfim.setTotalAmount(lastTotal.subtract(currentConfim.getReceivableAmount()));
               if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
               if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&
                     contract.getContractNo().startsWith("ZB-")) {
                  paymentConfirmMapper.insert(currentConfim);
                  //更新当前阶段付款情况
                  if (lastTotal.compareTo(new BigDecimal("0"))>0){
@@ -222,7 +226,7 @@
                        lastNewTotal = lastNewConfirm.getTotalAmount();
                     }
                     newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
                     if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
                     if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&contract.getContractNo().startsWith("ZB-")){
                        paymentConfirmMapper.insert(newConfim);
                     }
@@ -276,7 +280,7 @@
            lastTotal = lastConfirm.getTotalAmount();
         }
         currentConfim.setTotalAmount(lastTotal.subtract(currentConfim.getReceivableAmount()));
         if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
         if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&contract.getContractNo().startsWith("ZB-")){
            paymentConfirmMapper.insert(currentConfim);
            //更新当前阶段付款情况
            if (lastTotal.compareTo(new BigDecimal("0"))>0){
@@ -388,7 +392,7 @@
            lastNewTotal = lastNewConfirm.getTotalAmount();
         }
         newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
         if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
         if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0&&contract.getContractNo().startsWith("ZB-")) {
            paymentConfirmMapper.insert(newConfim);
            //更新当前阶段付款情况
            if (lastNewTotal.compareTo(new BigDecimal("0"))>0){