From 851ffb98081bdbbb9b02ae087fe40b3167e95bc2 Mon Sep 17 00:00:00 2001 From: liujiang <569804566@qq.com> Date: Sun, 13 Jul 2025 00:25:58 +0800 Subject: [PATCH] =?UTF-8?q?master=EF=BC=9A=E6=89=AB=E7=A0=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E5=96=84=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DailyTaskController.java | 2 +- .../com/ruoyi/xkt/mapper/DailySaleMapper.java | 9 ++++- .../mapper/StoreProductColorSizeMapper.java | 39 ++++++++++++------- .../StoreProductColorSizeServiceImpl.java | 20 ++++++++-- .../xkt/service/impl/StoreServiceImpl.java | 8 ++-- .../mapper/StoreProductColorSizeMapper.xml | 13 +++---- 6 files changed, 60 insertions(+), 31 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/DailyTaskController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/DailyTaskController.java index 478b7db71..bfa57e4b3 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/DailyTaskController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/DailyTaskController.java @@ -24,7 +24,7 @@ public class DailyTaskController extends BaseController { final XktTask task; - @PostMapping("") + @PostMapping("/daily-sale") public R dailySale(SysJob sysJob) { task.dailySale(); return R.ok(); diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/DailySaleMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/DailySaleMapper.java index 329f6effe..2b4c03780 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/DailySaleMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/DailySaleMapper.java @@ -16,6 +16,12 @@ import java.util.List; */ public interface DailySaleMapper extends BaseMapper { + /** + * 查询指定日期销售数据 + * + * @param voucherDate 凭证日期 + * @return List + */ List selectDailySale(Date voucherDate); /** @@ -29,7 +35,8 @@ public interface DailySaleMapper extends BaseMapper { /** * 获取销量前十的档口 - * @param yesterday 昨天 + * + * @param yesterday 昨天 * @param oneMonthAgo 昨天往前推1个月 * @return List */ diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorSizeMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorSizeMapper.java index 4abc5c0fb..bdc7b4fb0 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorSizeMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorSizeMapper.java @@ -56,27 +56,38 @@ public interface StoreProductColorSizeMapper extends BaseMapper selectStorageTotalSnList(@Param("storeId") String storeId, - @Param("buJuPrefixSnList") List buJuPrefixSnList, - @Param("otherPrefixSnList") List otherPrefixSnList); + List selectStorageBuJuSnList(@Param("storeId") String storeId, @Param("buJuPrefixSnList") List buJuPrefixSnList); /** - * 获取档口商品盘点的条码信息 + * 获取其它系统入库的条码信息 + * @param storeId 档口id + * @param otherPrefixSnList 步橘网条码列表 + * @return List + */ + List selectStorageOtherSnList(@Param("storeId") String storeId, @Param("otherPrefixSnList") List otherPrefixSnList); + + + /** + * 获取步橘网档口商品盘点的条码信息 * * @param storeId 档口ID * @param buJuPrefixSnList 步橘网条码列表 - * @param otherPrefixSnList 其他系统条码列表 - * @return + * @return List */ - List selectStockSnList(@Param("storeId") String storeId, - @Param("buJuPrefixSnList") List buJuPrefixSnList, - @Param("otherPrefixSnList") List otherPrefixSnList); + List selectStockBuJuSnList(@Param("storeId") String storeId, @Param("buJuPrefixSnList") List buJuPrefixSnList); + + /** + * 获取其它系统档口商品盘点的条码信息 + * @param storeId 档口ID + * @param otherPrefixSnList 其它系统条码列表 + * @return List + */ + List selectStockOtherSnList(@Param("storeId") String storeId, @Param("otherPrefixSnList") List otherPrefixSnList); + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductColorSizeServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductColorSizeServiceImpl.java index d87113686..1509af619 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductColorSizeServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductColorSizeServiceImpl.java @@ -99,9 +99,15 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS Set buJuPrefixSnSet = snList.stream().filter(x -> x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, buJuEndIndex)).collect(Collectors.toSet()); // 其它系统条码 Set otherPrefixSnSet = snList.stream().filter(x -> !x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet()); + List existList = new ArrayList<>(); // 根据条码查询数据库数据 - List existList = this.prodColorSizeMapper - .selectStorageTotalSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet), new ArrayList<>(otherPrefixSnSet)); + if (CollectionUtils.isNotEmpty(buJuPrefixSnSet)) { + List buJuExistList = this.prodColorSizeMapper.selectStorageBuJuSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet)); + CollectionUtils.addAll(existList, buJuExistList); + } else if (CollectionUtils.isNotEmpty(otherPrefixSnSet)) { + List otherExistList = this.prodColorSizeMapper.selectStorageOtherSnList(snDTO.getStoreId(), new ArrayList<>(otherPrefixSnSet)); + CollectionUtils.addAll(existList, otherExistList); + } // 数据库前缀对应的商品数量 Map existMap = existList.stream().collect(Collectors.toMap(StoreStorageSnDTO.SSSDetailDTO::getPrefixPart, x -> x)); Set successSet = new HashSet<>(); @@ -152,9 +158,15 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS Set buJuPrefixSnSet = snList.stream().filter(x -> x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, buJuEndIndex)).collect(Collectors.toSet()); // 其它系统条码 Set otherPrefixSnSet = snList.stream().filter(x -> !x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet()); + List existList = new ArrayList<>(); // 查询出的所有条码 - List existList = this.prodColorSizeMapper.selectStockSnList(snDTO.getStoreId(), - new ArrayList<>(buJuPrefixSnSet), new ArrayList<>(otherPrefixSnSet)); + if (CollectionUtils.isNotEmpty(buJuPrefixSnSet)) { + List buJuExistList = this.prodColorSizeMapper.selectStockBuJuSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet)); + CollectionUtils.addAll(existList, buJuExistList); + } else if (CollectionUtils.isNotEmpty(otherPrefixSnSet)) { + List otherExistList = this.prodColorSizeMapper.selectStockOtherSnList(snDTO.getStoreId(), new ArrayList<>(otherPrefixSnSet)); + CollectionUtils.addAll(existList, otherExistList); + } Map existMap = existList.stream().collect(Collectors.toMap(StoreStockTakingSnTempDTO.SSTSTDetailDTO::getPrefixPart, x -> x)); // 唯一的 storeProdColorId + size Set stockSet = new HashSet<>(); diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java index 17bf819a0..7d10cc489 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreServiceImpl.java @@ -274,13 +274,13 @@ public class StoreServiceImpl implements IStoreService { // 总的销售退货金额 BigDecimal refundAmount = saleList.stream().map(x -> ObjectUtils.defaultIfNull(x.getRefundAmount(), BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add); // 总的累计销量 - Integer saleNum = saleList.stream().map(DailySale::getSaleNum).reduce(0, Integer::sum); + Integer saleNum = saleList.stream().map(x -> ObjectUtils.defaultIfNull(x.getSaleNum(), 0)).reduce(0, Integer::sum); // 总的累计退货量 - Integer refundNum = saleList.stream().map(DailySale::getRefundNum).reduce(0, Integer::sum); + Integer refundNum = saleList.stream().map(x -> ObjectUtils.defaultIfNull(x.getRefundNum(), 0)).reduce(0, Integer::sum); // 总的累计入库数量 - Integer storageNum = saleList.stream().map(DailySale::getStorageNum).reduce(0, Integer::sum); + Integer storageNum = saleList.stream().map(x -> ObjectUtils.defaultIfNull(x.getStorageNum(), 0)).reduce(0, Integer::sum); // 总的累计客户数 - Integer customerNum = saleList.stream().map(DailySale::getCustomerNum).reduce(0, Integer::sum); + Integer customerNum = saleList.stream().map(x -> ObjectUtils.defaultIfNull(x.getCustomerNum(), 0)).reduce(0, Integer::sum); return new StoreIndexOverviewResDTO().setSaleAmount(saleAmount).setRefundAmount(refundAmount).setSaleNum(saleNum).setRefundNum(refundNum) .setStorageNum(storageNum).setCustomerNum(customerNum); } diff --git a/xkt/src/main/resources/mapper/StoreProductColorSizeMapper.xml b/xkt/src/main/resources/mapper/StoreProductColorSizeMapper.xml index bbf9045b1..6239ee68c 100644 --- a/xkt/src/main/resources/mapper/StoreProductColorSizeMapper.xml +++ b/xkt/src/main/resources/mapper/StoreProductColorSizeMapper.xml @@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND sp.store_id = #{storeId} - SELECT spcs.store_prod_id, spc.id AS storeProdColorId, @@ -84,9 +84,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item} + - UNION ALL - + - SELECT spc.id AS storeProdColorId, spc.color_name, @@ -130,9 +130,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item} + - UNION ALL - + \ No newline at end of file