Authored by linlong

Merge branch 'union_1101' of git.yoho.cn:yoho30/yohobuy-union into union_1101

# By zhouxiang
# Via zhouxiang
* 'union_1101' of git.yoho.cn:yoho30/yohobuy-union:
  no message
... ... @@ -20,13 +20,13 @@ public class RedirectServiceImpl implements IRedirectService{
Logger logger = LoggerFactory.getLogger(RedirectServiceImpl.class);
private static final String WAP_URL = "http://www.yohobuy.com";
private static final String WAP_URL = "http://m.yohobuy.com";
private static final String WEB_URL = "http://m.yohobuy.com";
private static final String WEB_URL = "http://www.yohobuy.com";
private static final String WAP_REDIRECT_URL = "http://www.yohobuy.com/3party/ads";
private static final String WAP_REDIRECT_URL = "http://m.yohobuy.com/3party/ads";
private static final String WEB_REDIRECT_URL = "http://m.yohobuy.com/3party/ads";
private static final String WEB_REDIRECT_URL = "http://www.yohobuy.com/3party/ads";
@Override
public void jump(UnionReqVO uionReqVO, HttpServletRequest request, HttpServletResponse response) {
... ...
package com.yoho.unions.server.task;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.unions.common.redis.RedisValueCache;
import com.yoho.unions.dal.IUserOrdersDAO;
import com.yoho.unions.server.service.IOrderPushService;
import com.yoho.unions.vo.OrderInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
... ... @@ -29,8 +32,40 @@ public class BigDataOrderInfoTask {
@Scheduled(cron = "0 0/10 * * * ?")
public void run() {
Map<String, List<OrderInfo>> orderInfoMap = serviceCaller.call("bigdata.get", null, Map.class, 3);
for (String clientId : orderInfoMap.keySet()) {
Map<String, Object> param = Maps.newHashMap();
param.put("limit", 100);
//调bigdata获去订单集合
List<OrderInfo> orderInfoList = serviceCaller.call("bigdata.get", param, List.class, 3);
if (CollectionUtils.isEmpty(orderInfoList)) {
return;
}
//订单列表转map key:orderCode value:OrderInfo
Map<Integer,OrderInfo> orderMap = Maps.uniqueIndex(orderInfoList, new Function<OrderInfo, Integer>() {
@Override
public Integer apply(OrderInfo input) {
return input.getOrderCode();
}
});
//获取校验后的订单code
List<Integer> orderCodeList = null;
//按source分类
Map<Integer,List<OrderInfo>> orderInfoMap = Maps.newHashMap();
for(Integer orderCode : orderCodeList){
OrderInfo orderInfo = orderMap.get(orderCode);
//为空直接return
if(null == orderInfo){
continue;
}
//组装分类
if(!orderInfoMap.containsKey(orderInfo.getClientId())){
orderInfoMap.put(orderInfo.getClientId(),Lists.newArrayList(orderInfo));
continue;
}
orderInfoMap.get(orderInfo.getClientId()).add(orderInfo);
}
//按source分类推送
for (Integer clientId : orderInfoMap.keySet()) {
IOrderPushService orderPushService = orderPushServiceMap.get(clientId);
orderPushService.pushOrder(orderInfoMap.get(clientId));
}
... ...