...
|
...
|
@@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled; |
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -20,9 +21,6 @@ import java.util.List; |
|
|
@Component
|
|
|
public class PinYouTask {
|
|
|
|
|
|
@Autowired
|
|
|
private RedisListCache redisListCache;
|
|
|
|
|
|
private static final String UNION_VIEW_KEY = "union:pinyou:view";
|
|
|
|
|
|
private static final String UNION_TRANS_KEY = "union:pinyou:trans";
|
...
|
...
|
@@ -30,19 +28,57 @@ public class PinYouTask { |
|
|
@Resource
|
|
|
IPinYouService pinYouService;
|
|
|
|
|
|
@Scheduled(cron = "0 0/10 * * * ?")
|
|
|
@Autowired
|
|
|
private RedisListCache redisListCache;
|
|
|
|
|
|
@Scheduled(cron = "0/10 * * * * ?")
|
|
|
public void run(){
|
|
|
//从redis里面获取大数据的数据
|
|
|
List<ViewPinYouRequestBO> viewPinYouRequestBOList = redisListCache.rightPop(UNION_VIEW_KEY, List.class);
|
|
|
Long viewSize = redisListCache.size(UNION_VIEW_KEY);
|
|
|
Long transSize = redisListCache.size(UNION_TRANS_KEY);
|
|
|
List<ViewPinYouRequestBO> viewPinYouRequestBOList = new ArrayList<>();
|
|
|
int viewSizeInt = viewSize == null ? 0 : viewSize.intValue();
|
|
|
int transSizeInt = transSize == null ? 0:transSize.intValue();
|
|
|
List<TransPinYouRequestBO> transPinYouRequestBOList = new ArrayList<>();
|
|
|
|
|
|
List<TransPinYouRequestBO> transPinYouRequestBOList = redisListCache.rightPop(UNION_TRANS_KEY,List.class);
|
|
|
//将取出来的值按照品友的要求发给品友
|
|
|
if(viewSizeInt>0){
|
|
|
for(int i=0; i < viewSizeInt; i++){
|
|
|
viewPinYouRequestBOList = redisListCache.rightPop(UNION_VIEW_KEY, List.class);
|
|
|
}
|
|
|
}
|
|
|
if(transSizeInt>0){
|
|
|
for(int i=0; i < transSizeInt; i++){
|
|
|
transPinYouRequestBOList = redisListCache.rightPop(UNION_TRANS_KEY, List.class);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// //将取出来的值按照品友的要求发给品友
|
|
|
// ViewPinYouRequestBO viewPinYouRequestBO = new ViewPinYouRequestBO();
|
|
|
// viewPinYouRequestBOList = new ArrayList<>();
|
|
|
// viewPinYouRequestBO.setImei("aea6497538a822838d07661b89a18c5e");
|
|
|
// viewPinYouRequestBO.setEvent("viewItem");
|
|
|
// viewPinYouRequestBO.setEvent_value("387650");
|
|
|
// viewPinYouRequestBO.setUser_id("1357821");
|
|
|
// viewPinYouRequestBO.setIp("172.16.6.153");
|
|
|
// viewPinYouRequestBO.setOs("iphone");
|
|
|
// viewPinYouRequestBOList.add(viewPinYouRequestBO);
|
|
|
if(CollectionUtils.isNotEmpty(viewPinYouRequestBOList)){
|
|
|
for(ViewPinYouRequestBO requestBO:viewPinYouRequestBOList){
|
|
|
sendView(requestBO);
|
|
|
}
|
|
|
}
|
|
|
if(CollectionUtils.isNotEmpty(viewPinYouRequestBOList)){
|
|
|
// TransPinYouRequestBO transPinYouRequest = new TransPinYouRequestBO();
|
|
|
// transPinYouRequest.setImei("aea6497538a822838d07661b89a18c5e");
|
|
|
// transPinYouRequest.setOs("iphone");
|
|
|
// transPinYouRequest.setMoney("20");
|
|
|
// transPinYouRequest.setOrderStatus("1");
|
|
|
// transPinYouRequest.setPlist("2999,2;3000,3");
|
|
|
// transPinYouRequest.setIp("172.16.6.153");
|
|
|
// transPinYouRequest.setUser_id("13054");
|
|
|
// transPinYouRequest.setOrder("342321");
|
|
|
// transPinYouRequestBOList = new ArrayList<>();
|
|
|
// transPinYouRequestBOList.add(transPinYouRequest);
|
|
|
if(CollectionUtils.isNotEmpty(transPinYouRequestBOList)){
|
|
|
for(TransPinYouRequestBO transPinYouRequestBO:transPinYouRequestBOList){
|
|
|
sendTrans(transPinYouRequestBO);
|
|
|
}
|
...
|
...
|
|