| | |
| | | |
| | | @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<>(); |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @date 2025-05-08 |
| | | */ |
| | | public interface SalesLedgerProductMapper extends MyBaseMapper<SalesLedgerProduct> { |
| | | List<SalesLedgerProduct> selectProduct() ; |
| | | List<SalesLedgerProduct> selectProduct(); |
| | | |
| | | List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct); |
| | | |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | |
| | | 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(); |
| | | } |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="selectProductCountByTypeAndDate" resultType="int"> |
| | | SELECT COUNT(*) |
| | | SELECT IFNULL(COUNT(*), 0) |
| | | FROM sales_ledger_product |
| | | WHERE type = #{type} |
| | | AND register_date >= #{startDate} |
| | | AND register_date <= #{endDate} |
| | | <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"> |
| | |
| | | </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 >= #{startDate} |
| | | AND create_time <= #{endDate} |
| | | UNION ALL |
| | | SELECT create_time |
| | | FROM stock_uninventory) combined |
| | | WHERE create_time >= #{startDate} |
| | | AND create_time <= #{endDate} |
| | | 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"> |