liyong
11 小时以前 e69dc34457a700a27659d17501957ed1dd5be66c
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());
@@ -288,6 +289,8 @@
            detailPagination.put("pageSize", detailPageSize);
            detailPagination.put("pages", (int) Math.ceil((double) totalDetails / detailPageSize));
            // 应付金额逻辑不采用合同金额改成  发票金额减付款金额
            payableAmount = invoiceAmount.subtract(paymentAmount);
            res.put("invoiceAmount", invoiceAmount);
            res.put("payableAmount", payableAmount);
            res.put("paymentAmount", paymentAmount);
@@ -374,7 +377,6 @@
                                                                                Collectors.toList()
                                                                        )
                                                                        );
            BigDecimal amountDateTotal = BigDecimal.ZERO;
            for (LocalDate localDate : dateListMap.keySet()) {
                BigDecimal currentPaymentAmount = BigDecimal.ZERO;
                BigDecimal invoiceAmount = BigDecimal.ZERO;
@@ -396,7 +398,7 @@
                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);
            }
@@ -405,6 +407,17 @@
        return result;
    }
    /**
     * 查询付款登记列表分页
     *
     * @param paymentRegistrationDto 付款登记
     * @return 付款登记集合
     */
    @Override
    public IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto) {
        return paymentRegistrationMapper.paymentHistoryListPage(page, paymentRegistrationDto);
    }
    // 批量查询采购台账(当月)
    private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) {
        LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>();