shiyunteng
1 天以前 8de09297dcc5393cc8542f29318b17f5696d4f8d
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
@@ -84,9 +84,7 @@
         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("客商查询失败,请检查客商");
         }
@@ -98,8 +96,21 @@
            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());
@@ -173,11 +184,8 @@
                        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;