Commit ce2b5f33 by carrieyzzhang

event stats total

parent 7672f5d8
...@@ -228,7 +228,7 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{ ...@@ -228,7 +228,7 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{
EventReportCallable c1 = new EventReportCallable(conditions,selectList,groupJsonArray, EventReportCallable c1 = new EventReportCallable(conditions,selectList,groupJsonArray,
app,accountId,startDate,endDate,eventCondition,viewType, url); app,accountId,startDate,endDate,eventCondition,viewType, url);
EventReportCallable c2 = new EventReportCallable(null,null,null, EventReportCallable c2 = new EventReportCallable(null,null,null,
app,accountId,startDate,endDate,eventCondition,viewType, url); app,accountId,startDate,endDate,eventCondition,viewType, null);
//执行任务并获取Future对象 //执行任务并获取Future对象
Future<Map<String, List>> f1 = pool.submit(c1); Future<Map<String, List>> f1 = pool.submit(c1);
Future<Map<String, List>> f2 = pool.submit(c2); Future<Map<String, List>> f2 = pool.submit(c2);
...@@ -276,6 +276,9 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{ ...@@ -276,6 +276,9 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{
return jsonObject.getString("field"); return jsonObject.getString("field");
} }
}); });
//数据权限过滤 //数据权限过滤
Account account = accountRepository.findOne(accountId); Account account = accountRepository.findOne(accountId);
querySql = querySql.replace("$campaign",""); querySql = querySql.replace("$campaign","");
...@@ -284,9 +287,24 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{ ...@@ -284,9 +287,24 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{
Map<String, String> conditions = buildQueryPrestoCondition(querySql, app.getAppkey()); Map<String, String> conditions = buildQueryPrestoCondition(querySql, app.getAppkey());
Map<String, List> responseJson = reportService.reportBySql(conditions); String demoApps = configParamService.getConfigParamByKey("demo_appkey");
List<String> demoAppList = Arrays.asList(demoApps.split(","));
Map<String, List> responseJson = new HashMap<>();
if (demoAppList.contains(app.getAppkey())) {
String url = "http://localhost:9010/api/trackingio/eventstats/complicated/total/" + app.getAppkey();
try {
String responseStr = HttpClientUtil.doHttpPostRequest(url, "trackingio", conditions);
ObjectMapper mapper = new ObjectMapper();
responseJson = mapper.readValue(responseStr, Map.class);
} catch (Exception e) {
logger.error("fail to get demo data......");
}
} else {
responseJson = reportService.reportBySql(conditions);
}
//格式化汇总数据 //格式化汇总数据
return formatTotalValueDate(appId, accountId, responseJson, groupArray, selectFieldList); return formatTotalValueDate(appId, accountId, responseJson, groupArray, selectFieldList);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment