shiyunteng
2026-05-25 633a003d232e37c79b7135ccda35eda1c69952c6
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
@@ -120,7 +120,7 @@
            }
            //更新付款阶段付款
            List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
                  .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
                  .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
                  .orderByAsc(ContractPaymentSchedule::getCreateTime));
            if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
               BigDecimal remain = addDTO.getTransationAmount();
@@ -295,7 +295,8 @@
               break;
            } else {
               entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
               entity.setTotalAmount(transtionAmount);
               entity.setReceivableAmount(transtionRemainAmount.multiply(new BigDecimal("-1")));
               entity.setTotalAmount(transtionRemainAmount);
               entity.setConfirmTime(payDate);
               baseMapper.insert(entity);
               payContractList.add(contract);
@@ -307,6 +308,7 @@
            //更新付款阶段付款
            List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
                  .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
                  .ne(ContractPaymentSchedule::getPaymentStatus, 3)
                  .orderByAsc(ContractPaymentSchedule::getCreateTime));
            if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
               BigDecimal remain = transtionAmount;
@@ -361,16 +363,18 @@
            //合同所有付款阶段
            List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
                  .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0)
                  );
                  .ne(ContractPaymentSchedule::getPaymentStatus, 3));
            if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())){
               BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :
               BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "2") ? item.getPlannedAmount() :
                     item.getActualAmount()).reduce(BigDecimal.ZERO,BigDecimal::add);
               contract.setPaidAmount(payTotal);
               if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
                  contract.setContractStatus(3);
               }
//               if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
//                  contract.setContractStatus(3);
//               }
               contractService.updateById(contract);
               if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
                  contract.setBillingStatus("2");
                  contract.setContractStatus(3);
                  payCompleteContractList.add(contract);
               }
               //付款 且 付款未全付
@@ -619,7 +623,7 @@
      payContractList.stream().forEach(contract -> {
         //更新付款阶段付款
         List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
               .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2)
               .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
               .orderByAsc(ContractPaymentSchedule::getCreateTime));
         if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
            BigDecimal remain = transtionAmount;
@@ -673,7 +677,7 @@
         }
         //合同所有付款阶段
         List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
               .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0)
               .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0).ne(ContractPaymentSchedule::getPaymentStatus,3)
         );
         if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())){
            BigDecimal payTotal = payComScheduleList.stream().map(item->StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :