| | |
| | | |
| | | } |
| | | |
| | | private void saveScheduleProcess(ContractPaymentScheduleProcessAddDTO addDTO, ContractPaymentSchedule schedule) { |
| | | //履约 |
| | | ContractPaymentScheduleProcess contractPaymentScheduleProcess = BeanUtil.copyProperties(addDTO, ContractPaymentScheduleProcess.class); |
| | | public void saveScheduleProcess(Date date, ContractPaymentSchedule schedule) { |
| | | //更新履约 |
| | | ContractPaymentScheduleProcess contractPaymentScheduleProcess = new ContractPaymentScheduleProcess(); |
| | | contractPaymentScheduleProcess.setContractId(schedule.getContractId()); |
| | | contractPaymentScheduleProcess.setContractName(schedule.getContractName()); |
| | | contractPaymentScheduleProcess.setScheduleId(schedule.getId()); |
| | | contractPaymentScheduleProcess.setScheduleName(schedule.getStageName()); |
| | | contractPaymentScheduleProcess.setProcessDate(date); |
| | | ContractPaymentScheduleProcess lastProcess = baseMapper.selectOne(Wrappers.<ContractPaymentScheduleProcess>lambdaQuery().eq(ContractPaymentScheduleProcess::getContractId, schedule.getContractId()) |
| | | .eq(ContractPaymentScheduleProcess::getScheduleId, schedule.getId()).last("limit 1")); |
| | | if (ObjUtil.isNull(lastProcess)) { |
| | |
| | | |
| | | updateCurrentSchedule(addDTO.getProcessDate(), schedule, contract); |
| | | //保存履约记录 |
| | | saveScheduleProcess(addDTO, schedule); |
| | | saveScheduleProcess(addDTO.getProcessDate(), schedule); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | public void handleBeforeRemain(PaymentConfirm currentConfim, Contract contract) { |
| | | //客户付款完成合同 |
| | | List<Contract> customerCompleteContractList = contractMapper.selectList(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, contract.getPartyAId()) |
| | | .eq(Contract::getPartyBId, SecurityUtils.getUser().getCompId()).eq(Contract::getContractStatus, 3)); |
| | | .eq(Contract::getPartyBId, contract.getCompId()).eq(Contract::getContractStatus, 3)); |
| | | if (CollUtil.isNotEmpty(customerCompleteContractList)) { |
| | | List<BigDecimal> outAmountList = new ArrayList<>(); |
| | | for (Contract completeContract : customerCompleteContractList) { |
| | |
| | | outConfirm.setTransationAmount(contractLastConfirm.getTotalAmount()); |
| | | outConfirm.setTotalAmount(new BigDecimal("0")); |
| | | if (contract.getContractNo().startsWith("ZB-")) { |
| | | outConfirm.setCompId(contract.getCompId()); |
| | | paymentConfirmMapper.insert(outConfirm); |
| | | } |
| | | outAmountList.add(contractLastConfirm.getTotalAmount()); |
| | |
| | | inConfirm.setReceivableAmount(inConfirm.getTotalAmount().multiply(new BigDecimal("-1"))); |
| | | } |
| | | if (contract.getContractNo().startsWith("ZB-")) { |
| | | inConfirm.setCompId(contract.getCompId()); |
| | | paymentConfirmMapper.insert(inConfirm); |
| | | } |
| | | contract.setPaidAmount(currentSum); |