Authored by linlong

update

package com.yoho.unions.server.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.netflix.config.DynamicIntProperty;
import com.netflix.config.DynamicPropertyFactory;
... ... @@ -39,6 +40,8 @@ public class DingdangServiceImpl implements DingdangService {
static Logger addDingdang = LoggerFactory.getLogger("addDingdang");
static Logger activeDingdang = LoggerFactory.getLogger("activeDingdang");
static Logger bigData = LoggerFactory.getLogger("bigData");
static Logger ipMatch = LoggerFactory.getLogger("ipMatch");
@Resource
CacheClient cacheClient;
... ... @@ -240,8 +243,10 @@ public class DingdangServiceImpl implements DingdangService {
public UnionResponseBO addBigData(int beginTime,int endTime){
// int beginTime = 1486339800;
// int endTime = 1486366200;
StringBuffer sb = new StringBuffer();
try{
List<UnionActivityLogs> unionActivityLogsList = unionActivityLogsDAO.selectByTime(beginTime,endTime);
for(UnionActivityLogs unionActivityLogs:unionActivityLogsList){
String idfa = unionActivityLogs.getIdfa();
String imei = unionActivityLogs.getImei();
... ... @@ -274,12 +279,12 @@ public class DingdangServiceImpl implements DingdangService {
}
}
JSONObject j = new JSONObject();
//如果能找到对应的unionClickLogs,则记录大数据的日志
if(unionClickLogs!=null){
log.info("match success idfa is {}",unionActivityLogs.getIdfa());
// 记录日志
JSONObject j = new JSONObject();
String dateid = DateUtil.timeStamp2Date(String.valueOf(createTime), "yyyy-MM-dd HH:mm:ss");
String unionType = unionClickLogs.getUnionType();
String unionTypekey = "yh:union:uniontype:"+unionType;
... ... @@ -294,6 +299,7 @@ public class DingdangServiceImpl implements DingdangService {
}else{
clientType = "android";
}
log.info("begin save bigData log.");
j.put("apptype", clientType);
j.put("appid", unionActivityLogs.getAppId());
j.put("idfa", unionActivityLogs.getIdfa());
... ... @@ -307,21 +313,27 @@ public class DingdangServiceImpl implements DingdangService {
j.put("app_key", unionActivityLogs.getAppKey());
j.put("active_type", "90");
j.put("tdid", "");
//打印90天的大数据日志
bigData.info(j.toString());
ipMatch.info(j.toString());
j.put("active_type", "15");
//打印15天的大数据日志
bigData.info(j.toString());
ipMatch.info(j.toString());
}
if(j.size()!=0){
sb.append(j.toString()+"\n");
j.put("active_type", "90");
sb.append(j.toString()+"\n");
}
}
}catch (Exception e){
log.error("addBigData exception is ",e.getMessage());
}
UnionResponseBO response = new UnionResponseBO();
response.setMsg("success");
response.setMsg(sb.toString());
response.setIsSuccess(true);
return response;
}
... ...