...
|
...
|
@@ -2,8 +2,11 @@ package com.yoho.unions.server.service.impl; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.unions.common.enums.SourceEnum;
|
|
|
import com.yoho.unions.dal.IUnionDepartmentUrlDAO;
|
|
|
import com.yoho.unions.dal.model.UnionDepartmentUrl;
|
|
|
import com.yoho.unions.dal.model.UnionType;
|
|
|
import com.yoho.unions.server.service.IRedirectService;
|
|
|
import com.yoho.unions.vo.CommonJumpReqVO;
|
|
|
import com.yoho.unions.vo.UnionReqVO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -36,7 +39,7 @@ public class RedirectServiceImpl implements IRedirectService { |
|
|
private static final String WEB_REDIRECT_URL = "http://www.yohobuy.com/3party/ads";
|
|
|
|
|
|
@Autowired
|
|
|
private I
|
|
|
private IUnionDepartmentUrlDAO unionDepartmentUrlDAO;
|
|
|
|
|
|
@Override
|
|
|
public void jump(UnionReqVO uionReqVO, HttpServletRequest request, HttpServletResponse response) {
|
...
|
...
|
@@ -70,6 +73,31 @@ public class RedirectServiceImpl implements IRedirectService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void go(CommonJumpReqVO commonJumpReqVO, HttpServletRequest request, HttpServletResponse response){
|
|
|
logger.info("Enter go: request param is {} ", commonJumpReqVO);
|
|
|
try{
|
|
|
if (null == commonJumpReqVO) {
|
|
|
logger.warn("jump: request params is null");
|
|
|
return;
|
|
|
}
|
|
|
String client_id = commonJumpReqVO.getClient_id();
|
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
|
logger.warn("jump: channelId is null, requst param is {}", commonJumpReqVO);
|
|
|
return;
|
|
|
}
|
|
|
if (StringUtils.isEmpty(commonJumpReqVO.getChannel_code())) {
|
|
|
logger.warn("jump: trackCode is null, requst param is {}", uionReqVO);
|
|
|
return;
|
|
|
}
|
|
|
String redirectUrl = builderCommonUrl(commonJumpReqVO);
|
|
|
|
|
|
}catch (IOException e){
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private String builderUrlForPanshi(UnionReqVO uionReqVO) {
|
|
|
uionReqVO.setUnion_type(uionReqVO.getChannel_id());
|
|
|
String param = this.generateReqParam(uionReqVO);
|
...
|
...
|
@@ -131,22 +159,22 @@ public class RedirectServiceImpl implements IRedirectService { |
|
|
if(Integer.parseInt(channelId.trim())==2891&&!uionReqVO.getTracking_code().equals("mbdcpc2")){
|
|
|
url = "http://m.yohobuy.com/";
|
|
|
}else{
|
|
|
UnionType unionType = unionTypeDAO.selectByUnionType(Integer.parseInt(channelId.trim()));
|
|
|
url = unionType.getGoUrl();
|
|
|
UnionDepartmentUrl unionDepartmentUrl = unionDepartmentUrlDAO.selectByUnionType(channelId.trim());
|
|
|
url = unionDepartmentUrl.getSrcUrl();
|
|
|
}
|
|
|
|
|
|
logger.info("builderCommonUrl find the channelId={}", channelId);
|
|
|
if( StringUtils.isBlank(url))
|
|
|
return "";
|
|
|
|
|
|
StringBuilder targetUrl = new StringBuilder("http://union.yohobuy.com/go?client_id=");
|
|
|
StringBuilder targetUrl = new StringBuilder("http://union.yoho.cn/union/jump?client_id=");
|
|
|
targetUrl.append(channelId.trim());
|
|
|
targetUrl.append("&channel_code=");
|
|
|
targetUrl.append(uionReqVO.getTracking_code());
|
|
|
targetUrl.append("&append=&go_url=");
|
|
|
targetUrl.append(url);
|
|
|
targetUrl.append("?utm_source=").append(uionReqVO.getUtm_source()).append("&utm_medium=").append(uionReqVO.getUtm_medium()).append("&utm_campaign=").append(uionReqVO.getUtm_campaign());
|
|
|
logger.info("builderCommonUrl url is {}",targetUrl.toString());
|
|
|
logger.info("builderCommonUrl url is {}", targetUrl.toString());
|
|
|
return targetUrl.toString();
|
|
|
}
|
|
|
|
...
|
...
|
|