| src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/mapper/stock/StockInventoryMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -1032,28 +1032,20 @@ @Override public List<MapDto> salesPurchaseStorageProductCount() { LocalDate now = LocalDate.now(); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); String currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).format(dtf); String currentMonthNow = now.format(dtf); LocalDate lastMonth = now.minusMonths(1); String lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).format(dtf); String lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).format(dtf); LocalDateTime now = LocalDateTime.now(); LocalDateTime currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); LocalDateTime lastMonth = now.minusMonths(1); LocalDateTime lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); LocalDateTime lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); // 销售 int currentSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, currentMonthStart, currentMonthNow); int currentSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, currentMonthStart, now); int lastSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, lastMonthStart, lastMonthEnd); // 采购 int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, currentMonthNow); int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, now); int lastPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, lastMonthStart, lastMonthEnd); // 储存 int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, currentMonthNow); int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, now); int lastStorage = stockInventoryMapper.selectStorageProductCountByDate(lastMonthStart, lastMonthEnd); List<MapDto> list = new ArrayList<>(); src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -39,7 +40,7 @@ List<Map<String, Object>> selectRawMaterialPurchaseAnalysis(); int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") String startDate, @Param("endDate") String endDate); int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); BigDecimal selectRawMaterialExpense(); } src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
@@ -12,6 +12,7 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -41,7 +42,7 @@ BigDecimal selectTotal(); int selectStorageProductCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); int selectStorageProductCountByDate(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); List<Map<String, Object>> selectDailyStockInCounts(@Param("rootCategoryId") Long rootCategoryId, @Param("startDate") String startDate, @Param("endDate") String endDate); src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -196,11 +196,15 @@ </select> <select id="selectProductCountByTypeAndDate" resultType="int"> SELECT COUNT(*) SELECT IFNULL(COUNT(*), 0) FROM sales_ledger_product WHERE type = #{type} <if test="startDate != null"> AND register_date >= #{startDate} </if> <if test="endDate != null"> AND register_date <= #{endDate} </if> </select> <select id="selectRawMaterialExpense" resultType="java.math.BigDecimal"> src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -199,14 +199,16 @@ </select> <select id="selectStorageProductCountByDate" resultType="int"> SELECT COUNT(*) FROM (SELECT create_time SELECT SUM(total_count) FROM (SELECT COUNT(*) as total_count FROM stock_inventory UNION ALL SELECT create_time FROM stock_uninventory) combined WHERE create_time >= #{startDate} AND create_time <= #{endDate} UNION ALL SELECT COUNT(*) as total_count FROM stock_uninventory WHERE create_time >= #{startDate} AND create_time <= #{endDate}) AS combined_counts </select> <select id="selectDailyStockInCounts" resultType="java.util.Map">