| | |
| | | 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"); |
| | |
| | | }else if (inConfirm.getTotalAmount().compareTo(new BigDecimal("0"))<0){ |
| | | inConfirm.setReceivableAmount(inConfirm.getTotalAmount().multiply(new BigDecimal("-1"))); |
| | | } |
| | | 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){ |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | 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){ |
| | |
| | | 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){ |