| | |
| | | //更新付款阶段付款 |
| | | List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery() |
| | | .eq(ContractPaymentSchedule::getContractId,contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus,2) |
| | | .orderByAsc(ContractPaymentSchedule::getCreateTime)); |
| | | .ne(ContractPaymentSchedule::getPaymentStatus,3).orderByAsc(ContractPaymentSchedule::getCreateTime)); |
| | | if (ArrayUtil.isNotEmpty(scheduleList.toArray())){ |
| | | BigDecimal remain = paymentOffset.getOffsetAmount(); |
| | | for (ContractPaymentSchedule schedule:scheduleList) { |
| | |
| | | } |
| | | paid = paid.add(paymentOffset.getOffsetAmount()); |
| | | contract.setPaidAmount(paid); |
| | | if (paid.compareTo(contract.getAmount())>0){ |
| | | contract.setPaidAmount(contract.getAmount()); |
| | | if (paid.compareTo(contract.getAmount())==0){ |
| | | contract.setBillingStatus("2"); |
| | | contract.setContractStatus(3); |
| | | } |
| | | contractService.updateById(contract); |
| | | // 查询所有付款阶段是否都付款完成 |
| | | if (ArrayUtil.isNotEmpty(scheduleList.toArray())){ |
| | | if (scheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))){ |
| | | contract.setContractStatus(3); |
| | | contractService.updateById(contract); |
| | | }; |
| | | } |
| | | // if (ArrayUtil.isNotEmpty(scheduleList.toArray())){ |
| | | // if (scheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))){ |
| | | // contract.setContractStatus(3); |
| | | // contractService.updateById(contract); |
| | | // }; |
| | | // } |
| | | return R.ok(); |
| | | } |
| | | } |