master:档口热卖标签改为销量前5;

pull/1121/head
liujiang 2025-10-09 15:16:13 +08:00
parent ac1dcb9e20
commit 788070fdce
1 changed files with 5 additions and 5 deletions

View File

@ -461,7 +461,7 @@ public class XktTask {
// 3. 当月(近一月)爆款
this.tagMonthHot(yesterday, oneMonthAgo, tagList);
// 4. 档口热卖
this.tagStoreHotTop10(yesterday, oneWeekAgo, tagList);
this.tagStoreHotTop5(yesterday, oneWeekAgo, tagList);
// 5. 图搜榜
this.tagImgSearchTop10(yesterday, oneMonthAgo, tagList);
// 6. 收藏榜
@ -1345,21 +1345,21 @@ public class XktTask {
* @param oneWeekAgo
* @param tagList
*/
private void tagStoreHotTop10(Date yesterday, Date oneWeekAgo, List<DailyProdTag> tagList) {
private void tagStoreHotTop5(Date yesterday, Date oneWeekAgo, List<DailyProdTag> tagList) {
// 筛选近一周档口销量
List<DailySaleProduct> saleProdList = this.dailySaleProdMapper.selectList(new LambdaQueryWrapper<DailySaleProduct>()
.eq(DailySaleProduct::getDelFlag, Constants.UNDELETED).between(DailySaleProduct::getVoucherDate, oneWeekAgo, yesterday));
if (CollectionUtils.isEmpty(saleProdList)) {
return;
}
// 筛选每个档口,销量排名前10的商品
// 筛选每个档口,销量排名前5的商品
Map<Long, Map<Long, Integer>> storeHotSaleMap = saleProdList.stream().collect(Collectors
.groupingBy(DailySaleProduct::getStoreId, Collectors.groupingBy(DailySaleProduct::getStoreProdId, Collectors
.summingInt(DailySaleProduct::getSaleNum))));
storeHotSaleMap.forEach((storeId, prodSaleMap) -> {
// 筛选prodSaleMap中销量前10的商品
// 筛选prodSaleMap中销量前5的商品
List<Map.Entry<Long, Integer>> top5ProdList = prodSaleMap.entrySet().stream().sorted(Map.Entry.<Long, Integer>comparingByValue().reversed())
.limit(10).collect(Collectors.toList());
.limit(5).collect(Collectors.toList());
top5ProdList.forEach(entry -> tagList.add(DailyProdTag.builder().storeId(storeId).storeProdId(entry.getKey()).type(ProdTagType.STORE_HOT.getValue())
.tag(ProdTagType.STORE_HOT.getLabel()).voucherDate(yesterday).build()));
});