master:扫码功能完善;

pull/1121/head
liujiang 2025-07-13 00:25:58 +08:00
parent d128ef42c1
commit 851ffb9808
6 changed files with 60 additions and 31 deletions

View File

@ -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();

View File

@ -16,6 +16,12 @@ import java.util.List;
*/
public interface DailySaleMapper extends BaseMapper<DailySale> {
/**
*
*
* @param voucherDate
* @return List<DailySaleDTO>
*/
List<DailySaleDTO> selectDailySale(Date voucherDate);
/**
@ -29,7 +35,8 @@ public interface DailySaleMapper extends BaseMapper<DailySale> {
/**
*
* @param yesterday
*
* @param yesterday
* @param oneMonthAgo 1
* @return List<DailyStoreTagDTO>
*/

View File

@ -56,27 +56,38 @@ public interface StoreProductColorSizeMapper extends BaseMapper<StoreProductColo
StoreSaleSnResDTO selectOtherSn(@Param("snPrefix") String snPrefix, @Param("storeId") String storeId, @Param("storeCusId") Long storeCusId);
/**
*
*
* @param storeId ID
* @param buJuPrefixSnList
* @param otherPrefixSnList
*
* @param storeId ID
* @param buJuPrefixSnList
* @return
*/
List<StoreStorageSnDTO.SSSDetailDTO> selectStorageTotalSnList(@Param("storeId") String storeId,
@Param("buJuPrefixSnList") List<String> buJuPrefixSnList,
@Param("otherPrefixSnList") List<String> otherPrefixSnList);
List<StoreStorageSnDTO.SSSDetailDTO> selectStorageBuJuSnList(@Param("storeId") String storeId, @Param("buJuPrefixSnList") List<String> buJuPrefixSnList);
/**
*
*
* @param storeId id
* @param otherPrefixSnList
* @return List<StoreStorageSnDTO.SSSDetailDTO>
*/
List<StoreStorageSnDTO.SSSDetailDTO> selectStorageOtherSnList(@Param("storeId") String storeId, @Param("otherPrefixSnList") List<String> otherPrefixSnList);
/**
*
*
* @param storeId ID
* @param buJuPrefixSnList
* @param otherPrefixSnList
* @return
* @return List<StoreStockTakingSnTempDTO.SSTSTDetailDTO>
*/
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> selectStockSnList(@Param("storeId") String storeId,
@Param("buJuPrefixSnList") List<String> buJuPrefixSnList,
@Param("otherPrefixSnList") List<String> otherPrefixSnList);
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> selectStockBuJuSnList(@Param("storeId") String storeId, @Param("buJuPrefixSnList") List<String> buJuPrefixSnList);
/**
*
* @param storeId ID
* @param otherPrefixSnList
* @return List<StoreStockTakingSnTempDTO.SSTSTDetailDTO>
*/
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> selectStockOtherSnList(@Param("storeId") String storeId, @Param("otherPrefixSnList") List<String> otherPrefixSnList);
}

View File

@ -99,9 +99,15 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
Set<String> buJuPrefixSnSet = snList.stream().filter(x -> x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, buJuEndIndex)).collect(Collectors.toSet());
// 其它系统条码
Set<String> otherPrefixSnSet = snList.stream().filter(x -> !x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet());
List<StoreStorageSnDTO.SSSDetailDTO> existList = new ArrayList<>();
// 根据条码查询数据库数据
List<StoreStorageSnDTO.SSSDetailDTO> existList = this.prodColorSizeMapper
.selectStorageTotalSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet), new ArrayList<>(otherPrefixSnSet));
if (CollectionUtils.isNotEmpty(buJuPrefixSnSet)) {
List<StoreStorageSnDTO.SSSDetailDTO> buJuExistList = this.prodColorSizeMapper.selectStorageBuJuSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet));
CollectionUtils.addAll(existList, buJuExistList);
} else if (CollectionUtils.isNotEmpty(otherPrefixSnSet)) {
List<StoreStorageSnDTO.SSSDetailDTO> otherExistList = this.prodColorSizeMapper.selectStorageOtherSnList(snDTO.getStoreId(), new ArrayList<>(otherPrefixSnSet));
CollectionUtils.addAll(existList, otherExistList);
}
// 数据库前缀对应的商品数量
Map<String, StoreStorageSnDTO.SSSDetailDTO> existMap = existList.stream().collect(Collectors.toMap(StoreStorageSnDTO.SSSDetailDTO::getPrefixPart, x -> x));
Set<StoreStorageSnResDTO.SSSDetailDTO> successSet = new HashSet<>();
@ -152,9 +158,15 @@ public class StoreProductColorSizeServiceImpl implements IStoreProductColorSizeS
Set<String> buJuPrefixSnSet = snList.stream().filter(x -> x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, buJuEndIndex)).collect(Collectors.toSet());
// 其它系统条码
Set<String> otherPrefixSnSet = snList.stream().filter(x -> !x.startsWith(snDTO.getStoreId())).map(x -> x.substring(0, otherSysEndIndex)).collect(Collectors.toSet());
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> existList = new ArrayList<>();
// 查询出的所有条码
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> existList = this.prodColorSizeMapper.selectStockSnList(snDTO.getStoreId(),
new ArrayList<>(buJuPrefixSnSet), new ArrayList<>(otherPrefixSnSet));
if (CollectionUtils.isNotEmpty(buJuPrefixSnSet)) {
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> buJuExistList = this.prodColorSizeMapper.selectStockBuJuSnList(snDTO.getStoreId(), new ArrayList<>(buJuPrefixSnSet));
CollectionUtils.addAll(existList, buJuExistList);
} else if (CollectionUtils.isNotEmpty(otherPrefixSnSet)) {
List<StoreStockTakingSnTempDTO.SSTSTDetailDTO> otherExistList = this.prodColorSizeMapper.selectStockOtherSnList(snDTO.getStoreId(), new ArrayList<>(otherPrefixSnSet));
CollectionUtils.addAll(existList, otherExistList);
}
Map<String, StoreStockTakingSnTempDTO.SSTSTDetailDTO> existMap = existList.stream().collect(Collectors.toMap(StoreStockTakingSnTempDTO.SSTSTDetailDTO::getPrefixPart, x -> x));
// 唯一的 storeProdColorId + size
Set<StoreStockTakingSnResDTO.SSTSDetailDTO> stockSet = new HashSet<>();

View File

@ -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);
}

View File

@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND sp.store_id = #{storeId}
</select>
<select id="selectStorageTotalSnList">
<select id="selectStorageBuJuSnList">
SELECT
spcs.store_prod_id,
spc.id AS storeProdColorId,
@ -84,9 +84,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
</select>
UNION ALL
<select id="selectStorageOtherSnList">
SELECT
spcs.store_prod_id,
spc.id AS storeProdColorId,
@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="selectStockSnList">
<select id="selectStockBuJuSnList">
SELECT
spc.id AS storeProdColorId,
spc.color_name,
@ -130,9 +130,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
</select>
UNION ALL
<select id="selectStockOtherSnList">
SELECT
spc.id AS storeProdColorId,
spc.color_name,
@ -151,7 +151,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
</select>
</mapper>