Authored by zhengwen.ge

代码优化

... ... @@ -7,6 +7,8 @@ public class CommonJumpReqVO {
private String client_id;
private String union_type;
private String channel_code;
private String go_url;
... ... @@ -74,4 +76,12 @@ public class CommonJumpReqVO {
public void setU_id(String u_id) {
this.u_id = u_id;
}
public String getUnion_type() {
return union_type;
}
public void setUnion_type(String union_type) {
this.union_type = union_type;
}
}
... ...
... ... @@ -86,8 +86,10 @@ public class UnionRest {
}
public static void main(String[] args) {
UnionResponseBO u = new UnionResponseBO();
System.out.println(u);
System.out.println(JSON.toJSONString(u));
String clientId = "80003419";
if(clientId.startsWith("800")){
clientId = clientId.substring(3);
}
System.out.print(clientId);
}
}
... ...
... ... @@ -208,6 +208,7 @@ public class DDServiceImpl implements MainUnionService {
j.put("udid", request.getUdid());
j.put("dateid", DateUtil.getcurrentDateTime());
j.put("source", type == null ? "" : type.getName());
j.put("source_id",1);
j.put("ip", request.getClientIp());
j.put("collect_ip", "");
j.put("active_type", "15");
... ...
... ... @@ -73,7 +73,8 @@ public class RedirectServiceImpl implements IRedirectService {
return;
}
String client_id = commonJumpReqVO.getClient_id();
if (StringUtils.isEmpty(client_id)) {
String union_type = commonJumpReqVO.getUnion_type();
if (StringUtils.isEmpty(client_id)&&StringUtils.isEmpty(union_type)) {
logger.warn("jump: channelId is null, requst param is {}", commonJumpReqVO);
return;
}
... ... @@ -145,7 +146,7 @@ public class RedirectServiceImpl implements IRedirectService {
}
private String builderCommonUrl(CommonJumpReqVO commonJumpReqVO){
logger.info("builderCommonUrl request is {}",commonJumpReqVO);
logger.info("builderCommonUrl request is {}", commonJumpReqVO);
String param = this.generateReqParam(commonJumpReqVO);
String go_url = commonJumpReqVO.getGo_url();
StringBuffer targetUrl = new StringBuffer(commonJumpReqVO.getGo_url());
... ... @@ -221,9 +222,15 @@ public class RedirectServiceImpl implements IRedirectService {
private String generateReqParam(CommonJumpReqVO commonJumpReqVO){
JSONObject param = new JSONObject();
param.put("client_id", commonJumpReqVO.getClient_id());
param.put("channel_code", commonJumpReqVO.getChannel_code());
String union_type = commonJumpReqVO.getUnion_type();
if(StringUtils.isNotBlank(union_type)){
param.put("client_id", union_type);
param.put("channel", union_type);
}else{
param.put("client_id",commonJumpReqVO.getClient_id());
param.put("channel", commonJumpReqVO.getClient_id());
}
param.put("channel_code", commonJumpReqVO.getChannel_code());
param.put("fl_uid", commonJumpReqVO.getU_id());
param.put("go_url", commonJumpReqVO.getGo_url());
return param.toString();
... ...
... ... @@ -409,6 +409,7 @@ public class UnionServiceImpl implements IUnionService {
j.put("udid", request.getUdid());
j.put("dateid", DateUtil.getcurrentDateTime());
j.put("source", u == null ? "" : u.getName());
j.put("source_id",click.getUnion_type());
j.put("ip", request.getClientIp());
j.put("collect_ip", "");
j.put("app_key", request.getAppkey());
... ... @@ -451,6 +452,7 @@ public class UnionServiceImpl implements IUnionService {
j.put("udid", request.getUdid());
j.put("dateid", DateUtil.getcurrentDateTime());
j.put("source", u == null ? "" : u.getName());
j.put("source_id",click.getUnion_type());
j.put("ip", request.getClientIp());
j.put("collect_ip", "");
j.put("app_key", request.getAppkey());
... ...
... ... @@ -78,7 +78,7 @@ public class BigDataOrderInfoTask {
Map<String, List<OrderInfo>> orderInfoMap = Maps.newHashMap();
for (UserOrders userOrders : userOrderList) {
OrderInfo orderInfo = orderMap.get(userOrders.getOrderCode());
logger.info("execute: get orderInfo is {}", orderInfo);
logger.info("execute: get orderInfo is {}", orderInfo.getClientId());
//为空直接return
if (null == orderInfo) {
continue;
... ... @@ -88,18 +88,25 @@ public class BigDataOrderInfoTask {
//获取trackingCode
orderInfo.setTrackingCode(userOrders.getTrackingCode());
orderInfo.setMbrName(userOrders.getMbrName());
String clientId = orderInfo.getClientId();
if(clientId.startsWith("800")){
clientId = clientId.substring(3);
}
//组装分类
if (!orderInfoMap.containsKey(orderInfo.getClientId())) {
if (!orderInfoMap.containsKey(clientId)) {
orderInfoMap.put(orderInfo.getClientId(), Lists.newArrayList(orderInfo));
continue;
}
orderInfoMap.get(orderInfo.getClientId()).add(orderInfo);
orderInfoMap.get(clientId).add(orderInfo);
}
//应该推送的clientId
List<UnionTypeManage> unionTypeManageList = unionTypeManageDAO.selectAll();
//按source分类推送
for (String clientId : orderInfoMap.keySet()) {
if(clientId.startsWith("800")){
clientId = clientId.substring(3);
}
if(!checkIsPush(clientId,unionTypeManageList))
continue;
IOrderPushService orderPushService = orderPushServiceMap.get(clientId);
... ...
... ... @@ -14,6 +14,8 @@ datasources:
password: 9nm0icOwt6bMHjMusIfMLw==
daos:
- com.yoho.unions.dal.IUnionLogsDAO
- com.yoho.unions.dal.IUnionClickLogsDAO
- com.yoho.unions.dal.IUnionActivityLogsDAO
app:
servers:
... ...
... ... @@ -14,6 +14,8 @@ datasources:
password: ${jdbc.mysql.yohologs.password}
daos:
- com.yoho.unions.dal.IUnionLogsDAO
- com.yoho.unions.dal.IUnionClickLogsDAO
- com.yoho.unions.dal.IUnionActivityLogsDAO
app:
... ...