master:扫码功能完善;
parent
d128ef42c1
commit
851ffb9808
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<>();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Reference in New Issue