Showing
2 changed files
with
41 additions
and
14 deletions
@@ -20,6 +20,7 @@ import com.yoho.unions.common.utils.DateUtil; | @@ -20,6 +20,7 @@ import com.yoho.unions.common.utils.DateUtil; | ||
20 | import com.yoho.unions.common.utils.HttpUtils; | 20 | import com.yoho.unions.common.utils.HttpUtils; |
21 | import com.yoho.unions.dal.IUnionConfigDAO; | 21 | import com.yoho.unions.dal.IUnionConfigDAO; |
22 | import com.yoho.unions.dal.model.UnionConfig; | 22 | import com.yoho.unions.dal.model.UnionConfig; |
23 | +import com.yoho.unions.interceptor.RemoteIPInterceptor; | ||
23 | import com.yoho.unions.server.service.IUnionService; | 24 | import com.yoho.unions.server.service.IUnionService; |
24 | 25 | ||
25 | /** | 26 | /** |
@@ -36,20 +37,28 @@ public class GDT3ServiceImpl extends UnionServiceImpl implements IUnionService { | @@ -36,20 +37,28 @@ public class GDT3ServiceImpl extends UnionServiceImpl implements IUnionService { | ||
36 | IUnionConfigDAO unionConfigDAO; | 37 | IUnionConfigDAO unionConfigDAO; |
37 | 38 | ||
38 | @Override | 39 | @Override |
39 | - public String getCallbackUrl(ClickUnionRequestBO clickBO,ActivateUnionRequestBO activateUnionRequestBO) { | 40 | + public String getCallbackUrl(ClickUnionRequestBO clickBO, ActivateUnionRequestBO activateUnionRequestBO) { |
40 | 41 | ||
41 | - //直接调用原有的广点通获取URL的方法 | ||
42 | - ActivateUnionRequestBO requestBO = new ActivateUnionRequestBO(); | ||
43 | - requestBO.setAppid(clickBO.getAppid()); | ||
44 | - requestBO.setClient_type(clickBO.getClient_type()); | 42 | + // 直接调用原有的广点通获取URL的方法 |
43 | + ActivateUnionRequestBO requestBO = new ActivateUnionRequestBO(); | ||
44 | + requestBO.setAppid(clickBO.getAppid()); | ||
45 | + requestBO.setClient_type(clickBO.getClient_type()); | ||
45 | 46 | ||
46 | - requestBO.setIdfa(clickBO.getIdfa()); | ||
47 | - requestBO.setImei(clickBO.getImei()); | ||
48 | - requestBO.setCommonUse(clickBO.getCommonUse()); | ||
49 | - //广点通后台生成的点击id | ||
50 | - requestBO.setUdid(clickBO.getClickId()); | ||
51 | - return processUrl(requestBO); | ||
52 | - } | 47 | + requestBO.setIdfa(clickBO.getIdfa()); |
48 | + requestBO.setImei(clickBO.getImei()); | ||
49 | + requestBO.setCommonUse(clickBO.getCommonUse()); | ||
50 | + // 广点通后台生成的点击id | ||
51 | + requestBO.setUdid(clickBO.getClickId()); | ||
52 | + | ||
53 | + String clientIp = RemoteIPInterceptor.getRemoteIP(); | ||
54 | + if (StringUtils.isNotEmpty(clientIp)) { | ||
55 | + String[] ips = clientIp.split(","); | ||
56 | + if (ips.length > 0) { | ||
57 | + requestBO.setClientIp(ips[0]); | ||
58 | + } | ||
59 | + } | ||
60 | + return processUrl(requestBO); | ||
61 | + } | ||
53 | 62 | ||
54 | @Override | 63 | @Override |
55 | public ClickUnionRequestBO clickHttpRequestTOBO(HttpServletRequest request,ClickUnionRequestBO bo){ | 64 | public ClickUnionRequestBO clickHttpRequestTOBO(HttpServletRequest request,ClickUnionRequestBO bo){ |
@@ -366,6 +366,18 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | @@ -366,6 +366,18 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | ||
366 | } | 366 | } |
367 | } | 367 | } |
368 | } | 368 | } |
369 | + | ||
370 | + if (StringUtils.isEmpty(value) && "100000000003503".equals(request.getChannelId())) { | ||
371 | + ClickUnionRequestBO clickInfo = new ClickUnionRequestBO(); | ||
372 | + clickInfo.setClient_type(request.getClient_type()); | ||
373 | + clickInfo.setIdfa(request.getIdfa()); | ||
374 | + clickInfo.setImei(request.getImei()); | ||
375 | + clickInfo.setAppid(request.getAppid()); | ||
376 | + clickInfo.setCommonUse(request.getCommonUse()); | ||
377 | + clickInfo.setClickId(request.getUdid()); | ||
378 | + clickInfo.setUnion_type(request.getChannelId()); | ||
379 | + value = JSON.toJSONString(clickInfo); | ||
380 | + } | ||
369 | 381 | ||
370 | if (StringUtils.isEmpty(value)) { | 382 | if (StringUtils.isEmpty(value)) { |
371 | if(StringUtils.isEmpty(request.getClientIp())){ | 383 | if(StringUtils.isEmpty(request.getClientIp())){ |
@@ -591,8 +603,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | @@ -591,8 +603,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | ||
591 | union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch()); | 603 | union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch()); |
592 | } | 604 | } |
593 | String bean =buffer.append("UnionServiceImpl").append("_").append(union_type).toString(); | 605 | String bean =buffer.append("UnionServiceImpl").append("_").append(union_type).toString(); |
606 | + IUnionService uniteService = null; | ||
594 | if(SpringContextUtil.containsBean(bean)){ | 607 | if(SpringContextUtil.containsBean(bean)){ |
595 | - IUnionService uniteService = SpringContextUtil.getBean(bean, IUnionService.class); | 608 | + uniteService = SpringContextUtil.getBean(bean, IUnionService.class); |
596 | url = uniteService.getCallbackUrl(click,request); | 609 | url = uniteService.getCallbackUrl(click,request); |
597 | }else{ | 610 | }else{ |
598 | url = unionService.getCallbackUrl(click,request); | 611 | url = unionService.getCallbackUrl(click,request); |
@@ -612,7 +625,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | @@ -612,7 +625,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher | ||
612 | } | 625 | } |
613 | activeUnion.info("activateUnion in call url={}", url); | 626 | activeUnion.info("activateUnion in call url={}", url); |
614 | //改成httpclient方式调用 | 627 | //改成httpclient方式调用 |
615 | - Pair<Integer, String> pair = visitCallbackUrl(url); | 628 | + Pair<Integer, String> pair; |
629 | + if (uniteService != null) { | ||
630 | + pair = uniteService.visitCallbackUrl(url); | ||
631 | + } else { | ||
632 | + pair = visitCallbackUrl(url); | ||
633 | + } | ||
616 | 634 | ||
617 | try{ | 635 | try{ |
618 | UnionCallbackLogs unionCallbackLogs = new UnionCallbackLogs(); | 636 | UnionCallbackLogs unionCallbackLogs = new UnionCallbackLogs(); |
-
Please register or login to post a comment