liyong
2026-05-22 2d03ec79e1892248b520cf097e8a58dd82a4892f
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -178,8 +178,8 @@
            BigDecimal noInvoiceAmountTotal = salesLedgerProducts.stream().map(SalesLedgerProduct::getNoInvoiceAmount)
                    .filter(Objects::nonNull)
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
            homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(2, RoundingMode.HALF_UP).toString());
            homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(2, RoundingMode.HALF_UP).toString());
            homeBusinessDto.setMonthSaleMoney(contractAmount.setScale(3, RoundingMode.HALF_UP).toString());
            homeBusinessDto.setMonthSaleHaveMoney(noInvoiceAmountTotal.setScale(3, RoundingMode.HALF_UP).toString());
        }
        // 创建LambdaQueryWrapper
        LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>();
@@ -208,16 +208,16 @@
                    .filter(Objects::nonNull)
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
            homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString());
            homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString());
            homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(3, RoundingMode.HALF_UP).toString());
            homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(3, RoundingMode.HALF_UP).toString());
        }
        // 统计库存
        BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal();
        homeBusinessDto.setInventoryNum(stockQuantityTotal.setScale(2, RoundingMode.HALF_UP).toString());
        homeBusinessDto.setInventoryNum(stockQuantityTotal.setScale(3, RoundingMode.HALF_UP).toString());
        // 获取当天入库数量
        BigDecimal bigDecimal = stockInventoryMapper.selectTotalByDate(LocalDate.now());
        homeBusinessDto.setTodayInventoryNum(bigDecimal.setScale(2, RoundingMode.HALF_UP).toString());
        homeBusinessDto.setTodayInventoryNum(bigDecimal.setScale(3, RoundingMode.HALF_UP).toString());
        return homeBusinessDto;
    }
@@ -298,8 +298,12 @@
        analysisCustomerContractAmountsDto.setChain(chain);
        Map<String, BigDecimal> collect = salesLedgers.stream()
                .collect(Collectors.groupingBy(SalesLedger::getCustomerName, Collectors.reducing(BigDecimal.ZERO,
                        SalesLedger::getContractAmount, BigDecimal::add)));
                .collect(Collectors.groupingBy(
                        salesLedger -> StringUtils.isBlank(salesLedger.getCustomerName()) ? "未分配客户" : salesLedger.getCustomerName(),
                        Collectors.reducing(BigDecimal.ZERO,
                                salesLedger -> Objects.nonNull(salesLedger.getContractAmount())
                                        ? salesLedger.getContractAmount() : BigDecimal.ZERO,
                                BigDecimal::add)));
        List<MapDto> mapDtos = new ArrayList<>();
        collect.forEach((k, v) -> {
            MapDto mapDto = new MapDto();