From 0c9ee949b6a7ea8ce2bbc42cbbd2c64fb977e509 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 01 六月 2026 14:58:39 +0800
Subject: [PATCH] Merge branch 'dev_新疆马铃薯pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_新疆马铃薯pro
---
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
index d3c21a2..affc030 100644
--- a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -179,6 +179,34 @@
homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString());
homeBusinessDto.setMonthPurchaseHaveMoney(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
}
+
+ // 涓婃湀閿�鍞噾棰�
+ YearMonth lastMonth = currentMonth.minusMonths(1);
+ LambdaQueryWrapper<SalesLedger> lastMonthSalesWrapper = new LambdaQueryWrapper<>();
+ lastMonthSalesWrapper.ge(SalesLedger::getEntryDate, lastMonth.atDay(1).atStartOfDay())
+ .lt(SalesLedger::getEntryDate, lastMonth.plusMonths(1).atDay(1).atStartOfDay());
+ List<SalesLedger> lastMonthSalesLedgers = salesLedgerMapper.selectList(lastMonthSalesWrapper);
+ if (!CollectionUtils.isEmpty(lastMonthSalesLedgers)) {
+ BigDecimal lastMonthContractAmount = lastMonthSalesLedgers.stream()
+ .map(SalesLedger::getContractAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ homeBusinessDto.setLastMonthSaleMoney(lastMonthContractAmount.setScale(2, RoundingMode.HALF_UP).toString());
+ }
+
+ // 涓婃湀閲囪喘閲戦
+ LambdaQueryWrapper<PurchaseLedger> lastMonthPurchaseWrapper = new LambdaQueryWrapper<>();
+ lastMonthPurchaseWrapper.ge(PurchaseLedger::getEntryDate, lastMonth.atDay(1).atStartOfDay())
+ .lt(PurchaseLedger::getEntryDate, lastMonth.plusMonths(1).atDay(1).atStartOfDay());
+ List<PurchaseLedger> lastMonthPurchaseLedgers = purchaseLedgerMapper.selectList(lastMonthPurchaseWrapper);
+ if (!CollectionUtils.isEmpty(lastMonthPurchaseLedgers)) {
+ BigDecimal lastMonthPurchaseAmount = lastMonthPurchaseLedgers.stream()
+ .map(PurchaseLedger::getContractAmount)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ homeBusinessDto.setLastMonthPurchaseMoney(lastMonthPurchaseAmount.setScale(2, RoundingMode.HALF_UP).toString());
+ }
+
// 缁熻搴撳瓨
BigDecimal stockQuantityTotal = stockInventoryMapper.selectTotal();
homeBusinessDto.setInventoryNum(stockQuantityTotal.setScale(2, RoundingMode.HALF_UP).toString());
--
Gitblit v1.9.3