Authored by Lixiaodi

广点通加密体系变更

... ... @@ -20,6 +20,7 @@ import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.common.utils.HttpUtils;
import com.yoho.unions.dal.IUnionConfigDAO;
import com.yoho.unions.dal.model.UnionConfig;
import com.yoho.unions.interceptor.RemoteIPInterceptor;
import com.yoho.unions.server.service.IUnionService;
/**
... ... @@ -36,9 +37,9 @@ public class GDT3ServiceImpl extends UnionServiceImpl implements IUnionService {
IUnionConfigDAO unionConfigDAO;
@Override
public String getCallbackUrl(ClickUnionRequestBO clickBO,ActivateUnionRequestBO activateUnionRequestBO) {
public String getCallbackUrl(ClickUnionRequestBO clickBO, ActivateUnionRequestBO activateUnionRequestBO) {
//直接调用原有的广点通获取URL的方法
// 直接调用原有的广点通获取URL的方法
ActivateUnionRequestBO requestBO = new ActivateUnionRequestBO();
requestBO.setAppid(clickBO.getAppid());
requestBO.setClient_type(clickBO.getClient_type());
... ... @@ -46,8 +47,16 @@ public class GDT3ServiceImpl extends UnionServiceImpl implements IUnionService {
requestBO.setIdfa(clickBO.getIdfa());
requestBO.setImei(clickBO.getImei());
requestBO.setCommonUse(clickBO.getCommonUse());
//广点通后台生成的点击id
// 广点通后台生成的点击id
requestBO.setUdid(clickBO.getClickId());
String clientIp = RemoteIPInterceptor.getRemoteIP();
if (StringUtils.isNotEmpty(clientIp)) {
String[] ips = clientIp.split(",");
if (ips.length > 0) {
requestBO.setClientIp(ips[0]);
}
}
return processUrl(requestBO);
}
... ...
... ... @@ -367,6 +367,18 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
}
}
if (StringUtils.isEmpty(value) && "100000000003503".equals(request.getChannelId())) {
ClickUnionRequestBO clickInfo = new ClickUnionRequestBO();
clickInfo.setClient_type(request.getClient_type());
clickInfo.setIdfa(request.getIdfa());
clickInfo.setImei(request.getImei());
clickInfo.setAppid(request.getAppid());
clickInfo.setCommonUse(request.getCommonUse());
clickInfo.setClickId(request.getUdid());
clickInfo.setUnion_type(request.getChannelId());
value = JSON.toJSONString(clickInfo);
}
if (StringUtils.isEmpty(value)) {
if(StringUtils.isEmpty(request.getClientIp())){
value = null;
... ... @@ -591,8 +603,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch());
}
String bean =buffer.append("UnionServiceImpl").append("_").append(union_type).toString();
IUnionService uniteService = null;
if(SpringContextUtil.containsBean(bean)){
IUnionService uniteService = SpringContextUtil.getBean(bean, IUnionService.class);
uniteService = SpringContextUtil.getBean(bean, IUnionService.class);
url = uniteService.getCallbackUrl(click,request);
}else{
url = unionService.getCallbackUrl(click,request);
... ... @@ -612,7 +625,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
}
activeUnion.info("activateUnion in call url={}", url);
//改成httpclient方式调用
Pair<Integer, String> pair = visitCallbackUrl(url);
Pair<Integer, String> pair;
if (uniteService != null) {
pair = uniteService.visitCallbackUrl(url);
} else {
pair = visitCallbackUrl(url);
}
try{
UnionCallbackLogs unionCallbackLogs = new UnionCallbackLogs();
... ...