gongchunyi
5 小时以前 47b42159fbe69fb2b4dbc13c75dd45abd00a55ae
fix: 查询日期缺少时分秒
已修改5个文件
68 ■■■■ 文件已修改
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockInventoryMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | 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");
        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);
        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);
        // 销售
        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;
@@ -21,7 +22,7 @@
 * @date 2025-05-08
 */
public interface SalesLedgerProductMapper extends MyBaseMapper<SalesLedgerProduct> {
     List<SalesLedgerProduct> selectProduct() ;
    List<SalesLedgerProduct> selectProduct();
    List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct);
@@ -29,9 +30,9 @@
    IPage<SalesLedgerProductDto> listPage(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct);
    IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page,@Param("req") SalesLedgerProductDto salesLedgerProduct);
    IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct);
    IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page,@Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto);
    IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page, @Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto);
    List<LossProductModelDto> selectProductBomStructure(@Param("salesLedegerId") Long salesLedegerId);
@@ -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,11 +42,11 @@
    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);
    List<Map<String, Object>> selectDailyStockOutCounts(@Param("rootCategoryId") Long rootCategoryId, @Param("startDate") String startDate, @Param("endDate") String endDate);
    BigDecimal selectTotalByDate( @Param("now") LocalDate now);
    BigDecimal selectTotalByDate(@Param("now") LocalDate now);
}
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}
        AND register_date &gt;= #{startDate}
        AND register_date &lt;= #{endDate}
        <if test="startDate != null">
            AND register_date &gt;= #{startDate}
        </if>
        <if test="endDate != null">
            AND register_date &lt;= #{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
              WHERE create_time &gt;= #{startDate}
                AND create_time &lt;= #{endDate}
              UNION ALL
              SELECT create_time
              FROM stock_uninventory) combined
        WHERE create_time &gt;= #{startDate}
          AND create_time &lt;= #{endDate}
              SELECT COUNT(*) as total_count
              FROM stock_uninventory
              WHERE create_time &gt;= #{startDate}
                AND create_time &lt;= #{endDate}) AS combined_counts
    </select>
    <select id="selectDailyStockInCounts" resultType="java.util.Map">