...
|
...
|
@@ -72,12 +72,25 @@ public class GDTServiceImpl implements MainUnionService { |
|
|
|
|
|
@Override
|
|
|
public UnionResponseBO activeUnion(ActivateUnionRequestBO request) {
|
|
|
log.info("activateUnion with param is{}", request);
|
|
|
UnionResponseBO response = check(request);
|
|
|
if (!response.getIsSuccess()) {
|
|
|
return response;
|
|
|
}
|
|
|
UnionLogs logs = new UnionLogs();
|
|
|
//去重,排除重复激活
|
|
|
if(ClientTypeEnum.IPHONE.getName().equalsIgnoreCase(request.getClient_type())){
|
|
|
logs = unionLogsDAO.selectIOS(String.valueOf(request.getAppid()), request.getIdfa(), request.getClient_type());
|
|
|
if(null !=logs &&logs.getIsActivate()==1){
|
|
|
return response;
|
|
|
}
|
|
|
}else{
|
|
|
logs = unionLogsDAO.selectAndroid(String.valueOf(request.getAppid()), request.getImei(), request.getClient_type());
|
|
|
if(null !=logs && logs.getIsActivate()==1){
|
|
|
return response;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
log.info("activateUnion with param is{}", request);
|
|
|
// 对url进行加密,拼接
|
|
|
String url = urlEode(request);
|
|
|
|
...
|
...
|
@@ -109,7 +122,14 @@ public class GDTServiceImpl implements MainUnionService { |
|
|
unionLogs.setIsActivate((byte) 1);
|
|
|
unionLogs.setCreateTime(DateUtil.getCurrentTimeSecond());
|
|
|
unionLogs.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
|
|
|
log.debug("add to unionLogs db with param is {}", unionLogs);
|
|
|
if(logs!= null&&logs.getIsActivate() ==0){
|
|
|
unionLogs.setId(logs.getId());
|
|
|
unionLogsDAO.updateByPrimaryKey(unionLogs);
|
|
|
}else{
|
|
|
unionLogsDAO.insert(unionLogs);
|
|
|
}
|
|
|
response = new UnionResponseBO(true, msg);
|
|
|
}
|
|
|
// 广点通返回错误
|
...
|
...
|
@@ -118,6 +138,14 @@ public class GDTServiceImpl implements MainUnionService { |
|
|
unionLogs.setCreateTime(DateUtil.getCurrentTimeSecond());
|
|
|
unionLogs.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
response = new UnionResponseBO(false, msg);
|
|
|
if(logs!= null&&logs.getIsActivate() ==0){
|
|
|
logs.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
logs.setIsActivate((byte)0);
|
|
|
unionLogs.setId(logs.getId());
|
|
|
unionLogsDAO.updateByPrimaryKey(unionLogs);
|
|
|
}else{
|
|
|
unionLogsDAO.insert(unionLogs);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
// 激活失败
|
...
|
...
|
@@ -125,8 +153,16 @@ public class GDTServiceImpl implements MainUnionService { |
|
|
unionLogs.setCreateTime(DateUtil.getCurrentTimeSecond());
|
|
|
unionLogs.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
response = new UnionResponseBO(false, "激活失败");
|
|
|
if(logs!=null&&logs.getIsActivate() ==0){
|
|
|
logs.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
logs.setIsActivate((byte)1);
|
|
|
unionLogs.setId(logs.getId());
|
|
|
unionLogsDAO.updateByPrimaryKey(unionLogs);
|
|
|
}else{
|
|
|
unionLogsDAO.insert(unionLogs);
|
|
|
}
|
|
|
}
|
|
|
unionLogsDAO.insert(unionLogs);
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
...
|
...
|
|