Authored by zhengwen.ge

IP整改

... ... @@ -101,8 +101,11 @@ public class ActivateUnionRest {
}
//IP取出来的有可能是42.239.40.36,123.151.42.50,只取第一个
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
String clientIp = null;
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
bo.setClientIp(clientIp);
//多线程处理
exe.execute(new RunActivate(bo));
... ...
... ... @@ -62,8 +62,11 @@ public class ClickUnionRest {
}
String IP = RemoteIPInterceptor.getRemoteIP();
// String IP = "42.236.215.29, 123.151.42.48";
String[] IPS = IP.split(",");
String clientIp = IPS[0];
String clientIp = null;
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
request.setClientIp(clientIp);
clickUnion.info("addUnion with param is {}", request);
UnionResponse response = unionService.clickUnion(request);
... ... @@ -90,8 +93,11 @@ public class ClickUnionRest {
request = unionService.clickHttpRequestTOBO(httpServletRequest,request);
}
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
String clientIp = null;
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
request.setClientIp(clientIp);
// IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
clickUnion.info("addCommonUnion request is {}",request);
... ... @@ -111,9 +117,12 @@ public class ClickUnionRest {
public void addUnion4Special(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
log.info("addUnion4Special with param is {}", bo);
try {
String clientIp = null;
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
bo.setClientIp(clientIp);
String agent = request.getHeader("user-agent");
log.info("user-agent={}", agent);
... ... @@ -165,9 +174,12 @@ public class ClickUnionRest {
if (StringUtils.isEmpty(bo.getUnion_type())) {
return;
}
String clientIp = null;
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
bo.setClientIp(clientIp);
bo.setClient_type("android");
bo.setAppid("com.yoho");
... ... @@ -229,8 +241,11 @@ public class ClickUnionRest {
log.info("addMonitor with key={}, value={}", key, request.getParameter(key));
}
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
String clientIp = null;
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
bo.setClientIp(clientIp);
String agent = request.getHeader("user-agent");
... ...
... ... @@ -65,9 +65,12 @@ public class MobvistaUnionRest {
req.setAppid("android");
downloadURL = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
}
String clientIp = null;
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
req.setIp(clientIp);
String url = "http://stat.mobvista.com/install?mobvista_pl="+req.getDevice_type()+"&mobvista_campuuid="+req.getUuid()+""
+ "&mobvista_ip="+req.getIp()+"&mobvista_clickid="+req.getClickid()+"&mobvista_gaid=&mobvista_devid=";
... ...
... ... @@ -9,6 +9,7 @@ import com.yoho.service.model.union.request.ClickUnionRequestBO;
import com.yoho.service.model.union.response.UnionResponse;
import com.yoho.unions.common.enums.ClientTypeEnum;
import com.yoho.unions.interceptor.RemoteIPInterceptor;
import org.apache.commons.lang.StringUtils;
import javax.servlet.http.HttpServletRequest;
... ... @@ -38,9 +39,12 @@ public interface IUnionService {
clickUnionRequestBO.setImei(request.getParameter("imei"));
clickUnionRequestBO.setTd(request.getParameter("td"));
String clientIp = null;
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
if(StringUtils.isNotEmpty(IP)){
String[] IPS = IP.split(",");
clientIp = IPS[0];
}
clickUnionRequestBO.setClientIp(clientIp);
return clickUnionRequestBO;
... ...
... ... @@ -300,8 +300,13 @@ public class UnionServiceImpl implements IUnionService {
}
if (StringUtils.isEmpty(value)) {
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey();
value = yhValueOperations.get(key);
if(StringUtils.isEmpty(request.getClientIp())){
value = null;
}else{
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey();
value = yhValueOperations.get(key);
}
log.info("activateUnion with get redis forth with key={}, value={}", key, value);
clickUnion.info("activateUnion with get redis forth with key={}, value={}", key, value);
}
... ...