|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.yohoufo.dal.order.SuperEntrySellerMapper;
|
|
|
import com.yohoufo.dal.order.model.SuperEntrySeller;
|
|
|
import com.yohoufo.order.common.SurperEntrySellerStatus;
|
|
|
import com.yohoufo.order.service.IStoredSellerService;
|
|
|
import com.yohoufo.order.service.cache.StoredSellerCacheService;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import com.yohoufo.user.cache.CacheKeyEnum;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 卖家服务(竞价提醒)
|
...
|
...
|
@@ -17,6 +27,14 @@ public class SellerService { |
|
|
|
|
|
private final Logger logger = LoggerUtils.getSellerOrderLogger();
|
|
|
|
|
|
@Autowired
|
|
|
private StoredSellerCacheService storedSellerCacheService;
|
|
|
|
|
|
@Autowired
|
|
|
private IStoredSellerService storedSellerService;
|
|
|
|
|
|
@Autowired
|
|
|
private SuperEntrySellerMapper superEntrySellerMapper;
|
|
|
/**更低出价提醒
|
|
|
* 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子)
|
|
|
*2)同一卖家的同一SKU 1小时内仅推送一条提醒(最先推送的那条)
|
...
|
...
|
@@ -41,4 +59,44 @@ public class SellerService { |
|
|
//倒计时 需要考虑跨天,计算当前日期的最后一秒
|
|
|
|
|
|
}
|
|
|
|
|
|
public List<Integer> getSuperEntrySellerUids(){
|
|
|
CacheKeyEnum cke = CacheKeyEnum.SUPER_ENTRY_SELLER_LIST;
|
|
|
|
|
|
List<Integer> uidList = storedSellerCacheService.getSuperEntrySellerList(cke.getKey());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(uidList)){
|
|
|
//hit in cache
|
|
|
logger.info("in getSuperEntrySellerUids hit cache uidList {}", uidList);
|
|
|
return uidList;
|
|
|
}
|
|
|
List<SuperEntrySeller> sesList = superEntrySellerMapper.selectAll(SurperEntrySellerStatus.SURPER.getCode());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(sesList)){
|
|
|
uidList = sesList.parallelStream().map(SuperEntrySeller::getUid).collect(Collectors.toList());
|
|
|
storedSellerCacheService.setSuperEntrySellerList(cke.getKey(), uidList);
|
|
|
logger.info("in getSuperEntrySellerUids fetch from DB uidList {}", uidList);
|
|
|
}
|
|
|
return uidList;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSuperEntrySeller(int uid){
|
|
|
|
|
|
if(storedSellerService.isStoredSeller(uid)){
|
|
|
|
|
|
List<Integer> uidList = getSuperEntrySellerUids();
|
|
|
logger.info("isSuperEntrySeller check uid {} uidList {}", uid, uidList);
|
|
|
if (CollectionUtils.isNotEmpty(uidList)){
|
|
|
//hit or not
|
|
|
return uidList.contains(uid);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|