...
|
...
|
@@ -603,12 +603,13 @@ 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;
|
|
|
final IUnionService uniteService;
|
|
|
if(SpringContextUtil.containsBean(bean)){
|
|
|
uniteService = SpringContextUtil.getBean(bean, IUnionService.class);
|
|
|
url = uniteService.getCallbackUrl(click,request);
|
|
|
}else{
|
|
|
url = unionService.getCallbackUrl(click,request);
|
|
|
uniteService = null;
|
|
|
}
|
|
|
if (StringUtils.isEmpty(url)) {
|
|
|
log.info("activateUnion in success request is {}", request);
|
...
|
...
|
@@ -624,13 +625,26 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
url += "?identify_id=" + click.getIdentify_id();
|
|
|
}
|
|
|
activeUnion.info("activateUnion in call url={}", url);
|
|
|
//改成httpclient方式调用
|
|
|
Pair<Integer, String> pair;
|
|
|
if (uniteService != null) {
|
|
|
pair = uniteService.visitCallbackUrl(url);
|
|
|
} else {
|
|
|
pair = visitCallbackUrl(url);
|
|
|
}
|
|
|
final String finalUrl = url;
|
|
|
final String finalUnionType = union_type;
|
|
|
// 改成httpclient方式调用:异步
|
|
|
taskExecutor.execute(() -> {
|
|
|
Pair<Integer, String> pair;
|
|
|
if (uniteService != null) {
|
|
|
pair = uniteService.visitCallbackUrl(finalUrl);
|
|
|
} else {
|
|
|
pair = visitCallbackUrl(finalUrl);
|
|
|
}
|
|
|
activeUnion.info("activateUnion call union success url={}, and result={}", finalUrl, pair);
|
|
|
if (pair.getLeft() != 200) {
|
|
|
log.warn("callback error with request={}", request);
|
|
|
return;
|
|
|
}
|
|
|
// 如果来源是广点通,则把广点通的一些信息记入表,给之后做转化上报使用
|
|
|
if (finalUnionType.equals("3")) {
|
|
|
saveUnionActivity(click, request);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
try{
|
|
|
UnionCallbackLogs unionCallbackLogs = new UnionCallbackLogs();
|
...
|
...
|
@@ -640,23 +654,13 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
unionCallbackLogs.setUrl(url);
|
|
|
unionCallbackLogs.setIdfa(request.getIdfa());
|
|
|
unionCallbackLogs.setImei(request.getImei());
|
|
|
int code = pair.getLeft();
|
|
|
int code = 200 /*pair.getLeft()*/;
|
|
|
unionCallbackLogs.setResult(String.valueOf(code));
|
|
|
unionCallbackLogs.setCreatetime(DateUtils.getCurrentTimeSecond());
|
|
|
saveUnionCallbackLogs(unionCallbackLogs);
|
|
|
}catch (Exception e){
|
|
|
log.warn("save union_callback_logs e={}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
activeUnion.info("activateUnion call union success url={}, and result={}", url, pair);
|
|
|
if (pair.getLeft() != 200) {
|
|
|
log.warn("callback error with request={}", request);
|
|
|
return new UnionResponse(200, "callback error",result);
|
|
|
}
|
|
|
//如果来源是广点通,则把广点通的一些信息记入表,给之后做转化上报使用
|
|
|
if(union_type.equals("3")){
|
|
|
saveUnionActivity(click,request);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("callback error with request={}", request, e);
|
|
|
//return new UnionResponse(204, "callback error");
|
...
|
...
|
|