Authored by bblu

联盟增加APP类型

... ... @@ -102,13 +102,13 @@ public class GDTServiceImpl implements MainUnionService {
UnionLogs logs = new UnionLogs();
// 去重,排除重复激活
if (ClientTypeEnum.IOS.getName().equalsIgnoreCase(request.getClient_type())) {
logs = unionLogsDAO.selectIOS(String.valueOf(request.getAppid()), request.getIdfa(), request.getClient_type(), 3, request.getApp_key());
logs = unionLogsDAO.selectIOS(String.valueOf(request.getAppid()), request.getIdfa(), request.getClient_type(), 3, request.getAppkey());
if (null != logs && logs.getIsActivate() == 1) {
log.warn("GDT activeUnion exists with request={}", request);
return new UnionResponseBO(false, "activeUnion exists");
}
} else {
logs = unionLogsDAO.selectAndroid(String.valueOf(request.getAppid()), request.getImei(), request.getClient_type(), 3, request.getApp_key());
logs = unionLogsDAO.selectAndroid(String.valueOf(request.getAppid()), request.getImei(), request.getClient_type(), 3, request.getAppkey());
if (null != logs && logs.getIsActivate() == 1) {
log.warn("GDT activeUnion exists with request={}", request);
return new UnionResponseBO(false, "activeUnion exists");
... ... @@ -173,7 +173,7 @@ public class GDTServiceImpl implements MainUnionService {
unionLogs.setAppId(String.valueOf(request.getAppid()));
unionLogs.setUdid("");
unionLogs.setClientType(request.getClient_type());
unionLogs.setAppKey(request.getApp_key());
unionLogs.setAppKey(request.getAppkey());
if (ClientTypeEnum.IOS.getName().equalsIgnoreCase(request.getClient_type())) {
unionLogs.setIdfa(request.getIdfa());
} else {
... ...
... ... @@ -104,13 +104,13 @@ public class UnionServiceImpl implements IUnionService {
//组装redis保存的key
String key;
if (StringUtils.isNotEmpty(request.getIdfa())) {
key = UNION_KEY + "_" + request.getIdfa() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getIdfa() + "_" + request.getAppkey();
} else if (StringUtils.isNotEmpty(request.getImei())) {
key = UNION_KEY + "_" + request.getImei() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getImei() + "_" + request.getAppkey();
} else {
key = UNION_KEY + "_" + request.getClientIp();
if (StringUtils.isNotEmpty(request.getTd())) {
key += "_" + request.getTd() + "_" + request.getApp_key();
key += "_" + request.getTd() + "_" + request.getAppkey();
}
}
// String value = yhValueOperations.get(key);
... ... @@ -196,14 +196,14 @@ public class UnionServiceImpl implements IUnionService {
// 组装redis保存的key
String key = "";
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
key = UNION_KEY + "_" + request.getIdfa() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getIdfa() + "_" + request.getAppkey();
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
key = UNION_KEY + "_" + request.getImei() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getImei() + "_" + request.getAppkey();
}
String value = yhValueOperations.get(key);
log.info("activateUnion with get redis first with key={}, value={}", key, value);
if (StringUtils.isEmpty(value)) {
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd() + "_" + request.getAppkey();
value = yhValueOperations.get(key);
log.info("activateUnion with get redis first with key={}, value={}", key, value);
}
... ... @@ -211,13 +211,13 @@ public class UnionServiceImpl implements IUnionService {
String[] arr = request.getTd().split("_");
if (arr.length > 3) {
request.setTd(arr[2] + "_" + arr[3]);
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd() + "_" + request.getAppkey();
value = yhValueOperations.get(key);
log.info("activateUnion with get redis second with key={}, value={}", key, value);
}
if (StringUtils.isEmpty(value)) {
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getApp_key();
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey();
value = yhValueOperations.get(key);
log.info("activateUnion with get redis thred with key={}, value={}", key, value);
}
... ... @@ -232,7 +232,7 @@ public class UnionServiceImpl implements IUnionService {
// 把存储的字符串变为对象
ClickUnionRequestBO click = JSON.parseObject(value, ClickUnionRequestBO.class);
// 查询该td在90天内是否已经激活过
UnionLogs union = unionLogsDAO.selectByClientType(request.getClient_type(), request.getIdfa(), request.getImei(), request.getApp_key());
UnionLogs union = unionLogsDAO.selectByClientType(request.getClient_type(), request.getIdfa(), request.getImei(), request.getAppkey());
log.info("activateUnion in selectByClientType result is {}", union);
// 没有点击记录,则退出
// if (union == null) {
... ... @@ -250,8 +250,8 @@ public class UnionServiceImpl implements IUnionService {
//如果是ios系统,还要到大数据表里面判断这个用户是否90天内的活跃用户,如果是的话,这次激活就不成功
String yesterday = DateUtil.dateAdd(DateUtil.getToday("yyyyMMdd"), "d", -1, "yyyyMMdd");
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), request.getApp_key()));
List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), request.getApp_key()));
List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), request.getAppkey()));
List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), request.getAppkey()));
//判断90天内是否在大数据有记录
if (CollectionUtils.isNotEmpty(_90DayIdfaList)) {
log.warn("activateUnion error because 90 days has activate in bigdata database info with param is {}", request);
... ... @@ -272,7 +272,7 @@ public class UnionServiceImpl implements IUnionService {
j.put("source", u == null ? "" : u.getName());
j.put("ip", request.getClientIp());
j.put("collect_ip", "");
j.put("app_key", request.getApp_key());
j.put("app_key", request.getAppkey());
j.put("active_type", "15");
activeDingdang.info(j.toString());
}
... ... @@ -296,7 +296,7 @@ public class UnionServiceImpl implements IUnionService {
logs.setUnionType(Integer.valueOf(click.getUnion_type()));
logs.setAddParams(value);
logs.setTd(request.getTd());
logs.setAppKey(request.getApp_key());
logs.setAppKey(request.getAppkey());
unionLogsDAO.insert(logs);
log.info("activateUnion add db success with request is {}, and dbData={}", request, logs);
... ... @@ -315,7 +315,7 @@ public class UnionServiceImpl implements IUnionService {
j.put("source", u == null ? "" : u.getName());
j.put("ip", request.getClientIp());
j.put("collect_ip", "");
j.put("app_key", request.getApp_key());
j.put("app_key", request.getAppkey());
j.put("active_type", "90");
//打印90天的大数据日志
activeDingdang.info(j.toString());
... ...