| | |
| | | if (ObjUtil.isNull(contract)) { |
| | | return R.failed("合同查询失败,请检查合同编号"); |
| | | } |
| | | BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery() |
| | | .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getRegisterName, addDTO.getBusGuestName()) |
| | | .eq(StrUtil.isNotBlank(addDTO.getBusGuestId()), BusinessCustomer::getId, addDTO.getBusGuestId())); |
| | | BusinessCustomer customer = businessCustomerService.getById(contract.getPartyAId()); |
| | | if (ObjUtil.isNull(customer)) { |
| | | return R.failed("客商查询失败,请检查客商"); |
| | | } |
| | |
| | | lastTotal = lastConfirm.getTotalAmount(); |
| | | } |
| | | |
| | | |
| | | //转入 |
| | | if (StrUtil.equals(addDTO.getInOrOut(), "1")) { |
| | | |
| | | |
| | | //新增付款单 |
| | | PaymentSlip slip = new PaymentSlip(); |
| | | slip.setBusGuestId(customer.getId()); |
| | | slip.setBusGuestName(customer.getRegisterName()); |
| | | slip.setPayeeCompId(SecurityUtils.getUser().getCompId()); |
| | | slip.setPaymentTime(addDTO.getConfirmTime()); |
| | | slip.setPaymentAmount(addDTO.getTransationAmount()); |
| | | slip.setPayType(addDTO.getPayType()); |
| | | paymentSlipMapper.insert(slip); |
| | | |
| | | BigDecimal newtotal = addDTO.getTransationAmount().add(lastTotal); |
| | | PaymentConfirm entity = new PaymentConfirm(); |
| | | entity.setContractId(contract.getId()); |
| | |
| | | historyOverdue.setPaymentTime(addDTO.getConfirmTime()); |
| | | historyOverdue.setCompId(schedule.getCompId()); |
| | | historyOverdueMapper.insert(historyOverdue); |
| | | //查询历史已付逾期金额 |
| | | List<HistoryOverdue> historyOverdueList = historyOverdueMapper.selectList(Wrappers.<HistoryOverdue>lambdaQuery().eq(HistoryOverdue::getScheduleId, currentOverdue.getScheduleId())); |
| | | BigDecimal hisTotal = historyOverdueList.stream().map(item -> item.getReceivableAmount()).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //更新当前逾期 |
| | | currentOverdue.setReceivableAmount(schedule.getPlannedAmount().subtract(hisTotal)); |
| | | currentOverdue.setReceivableAmount(schedule.getPlannedAmount().subtract(schedule.getActualAmount())); |
| | | currentOverdueMapper.updateById(currentOverdue); |
| | | } |
| | | break; |