liyong
48 分钟以前 1212e2b0dea3b44668c5293a3267a6fb780b420f
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -99,11 +99,12 @@
        PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(paymentRegistration.getPurchaseLedgerId());
        SalesLedger salesLedger = salesLedgerMapper.selectOne(new QueryWrapper<SalesLedger>().
                eq("sales_contract_no", purchaseLedger.getSalesContractNo()));
        if (salesLedger == null) {
            throw new RuntimeException("关联销售合同号不存在");
//        if (salesLedger == null) {
//            throw new RuntimeException("关联销售合同号不存在");
//        }
        if (salesLedger != null) {
            paymentRegistration.setSaleLedgerId(salesLedger.getId());
        }
        paymentRegistration.setSaleLedgerId(salesLedger.getId());
        paymentRegistration.setSupplierId(purchaseLedger.getSupplierId());
        TicketRegistration tr = ticketRegistrationMapper.selectOne(new LambdaQueryWrapper<TicketRegistration>().eq(TicketRegistration::getId, paymentRegistration.getTicketRegistrationId()));
@@ -121,8 +122,8 @@
        }
        LoginUser loginUser = SecurityUtils.getLoginUser();
        Integer tenantId = loginUser.getTenantId();
        paymentRegistration.setTenantId(tenantId.longValue());
        Long tenantId = loginUser.getTenantId();
        paymentRegistration.setTenantId(tenantId);
        paymentRegistration.setRegistrantId(loginUser.getUserId());
        paymentRegistration.setCreateTime(DateUtils.getNowDate());
        paymentRegistration.setUpdateTime(DateUtils.getNowDate());
@@ -366,6 +367,7 @@
    public List<PaymentHistoryRecordVo> getPaymentRecordList(Long supplierId) {
        List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationMapper.getPaymentRecordList(supplierId);
        List<PaymentHistoryRecordVo> result = new ArrayList<>();
        List<PaymentHistoryRecordVo> newResult = new ArrayList<>();
        // 应付总金额金额计算
        BigDecimal amountTotal = BigDecimal.ZERO;
        if(CollectionUtils.isNotEmpty(paymentRecordList)) {
@@ -397,13 +399,25 @@
                paymentHistoryRecordVo.setHappenTime(localDate);
                paymentHistoryRecordVo.setCurrentPaymentAmount(currentPaymentAmount);
                paymentHistoryRecordVo.setInvoiceAmount(invoiceAmount);
                amountTotal = amountTotal.add(currentDateTotal);
                amountTotal = paymentHistoryRecordVo.getInvoiceAmount().subtract(paymentHistoryRecordVo.getCurrentPaymentAmount());
                paymentHistoryRecordVo.setPayableAmount(amountTotal);
                result.add(paymentHistoryRecordVo);
            }
            for (int i = 0; i < result.size(); i++) {
                PaymentHistoryRecordVo paymentHistoryRecordVo = result.get(i);
                if (i == 0) {
                    paymentHistoryRecordVo.setPayableAmount(paymentHistoryRecordVo.getInvoiceAmount().subtract(paymentHistoryRecordVo.getCurrentPaymentAmount()));
                }else {
                    PaymentHistoryRecordVo paymentHistoryRecordVo1 = result.get(i-1);
                    paymentHistoryRecordVo.setPayableAmount(paymentHistoryRecordVo1.getPayableAmount()
                            .add(paymentHistoryRecordVo.getInvoiceAmount()).subtract(paymentHistoryRecordVo.getCurrentPaymentAmount()));
                }
                newResult.add(paymentHistoryRecordVo);
            }
        }
        return result;
        return newResult;
    }
    /**