maven
3 天以前 bcb36b7dd1f5727670ab52c65af85f8b29394ca9
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -220,10 +220,10 @@
                            new QueryWrapper<SalesLedgerProduct>().eq("sales_ledger_id", id).eq("type",2)
                    ).stream())
                    .collect(Collectors.toList());
            payableAmount = salesLedgerProducts.stream()
                    .map(SalesLedgerProduct::getTaxInclusiveTotalPrice)
                    .filter(Objects::nonNull)
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
//            payableAmount = salesLedgerProducts.stream()
//                    .map(SalesLedgerProduct::getTaxInclusiveTotalPrice)
//                    .filter(Objects::nonNull)
//                    .reduce(BigDecimal.ZERO, BigDecimal::add);
            // 来票金额计算
            List<TicketRegistration> ticketRegistrations = purchaseLedgers.stream()
@@ -247,6 +247,11 @@
                    .map(PaymentRegistration::getCurrentPaymentAmount)
                    .filter(Objects::nonNull)
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
            // 核心过滤逻辑:当paymentAmount和invoiceAmount同时为0时,跳过该记录
            if (BigDecimal.ZERO.compareTo(paymentAmount) == 0 && BigDecimal.ZERO.compareTo(invoiceAmount) == 0) {
                continue; // 跳过当前供应商,不加入结果集
            }
            // 详情分页处理
            detailPageNum = detailPageNum != null ? detailPageNum : 1;
@@ -301,6 +306,8 @@
            result.add(res);
        }
        // 修正总条数:过滤后需要重新计算总条数
        resultPage.setTotal(result.size());
        resultPage.setRecords(result);
        return resultPage;
    }
@@ -373,13 +380,14 @@
        // 应付总金额金额计算
        BigDecimal amountTotal = BigDecimal.ZERO;
        if(CollectionUtils.isNotEmpty(paymentRecordList)) {
            // 核心分组求和逻辑
            Map<LocalDate, List<PaymentHistoryRecordVo>> dateListMap = paymentRecordList.stream().collect(
                                                                        Collectors.groupingBy(
                                                                                PaymentHistoryRecordVo::getHappenTime,
                                                                                LinkedHashMap::new,
                                                                                Collectors.toList()
                                                                        )
                                                                        );
                    Collectors.groupingBy(
                            PaymentHistoryRecordVo::getHappenTime,
                            LinkedHashMap::new,
                            Collectors.toList()
                    )
            );
            for (LocalDate localDate : dateListMap.keySet()) {
                BigDecimal currentPaymentAmount = BigDecimal.ZERO;
                BigDecimal invoiceAmount = BigDecimal.ZERO;