提交 e7a614c8 编写于 作者: liugen.wen's avatar liugen.wen

xiu

上级 a565a218
...@@ -3,7 +3,9 @@ package com.pica.cloud.clickhouse.clickhouse.server.controller; ...@@ -3,7 +3,9 @@ package com.pica.cloud.clickhouse.clickhouse.server.controller;
import com.pica.cloud.foundation.clickhouse.service.ClickHouseService; import com.pica.cloud.foundation.clickhouse.service.ClickHouseService;
import com.pica.cloud.foundation.clickhouse.service.config.TableEnum; import com.pica.cloud.foundation.clickhouse.service.config.TableEnum;
import com.pica.cloud.foundation.entity.PicaResponse; import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.utils.controller.BaseController; import com.pica.cloud.foundation.utils.controller.BaseController;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,41 +40,74 @@ public class CrashController extends BaseController { ...@@ -38,41 +40,74 @@ public class CrashController extends BaseController {
@ApiOperation(value = "init data", response = PicaResponse.class) @ApiOperation(value = "init data", response = PicaResponse.class)
@RequestMapping(value = "/init",method = RequestMethod.GET) @RequestMapping(value = "/init",method = RequestMethod.GET)
public PicaResponse init(){ public PicaResponse init(){
String sql ="select doctor_id,web_data,view_path,class_name,pseudo_session,pseudo_id,action,created from trace_app where action='ACTION_WEB_ENTER' and view_path like '%healthNotice%' and web_data like '%eduComId%' order by created desc "; PicaResponse.Builder builder = new PicaResponse.Builder();
String sql ="select distinct pseudo_id,doctor_id,web_data,view_path,class_name,pseudo_session,action,created from trace_app where action='ACTION_WEB_ENTER' and class_name like '%healthNotice%' and web_data like '%eduComId%' order by created desc ";
List<com.alibaba.fastjson.JSONObject> res = clickHouseService.query(sql, TableEnum.traceappp); List<com.alibaba.fastjson.JSONObject> res = clickHouseService.query(sql, TableEnum.traceappp);
String sql2 ="select doctor_id,web_data,view_path,class_name,pseudo_session,pseudo_id,action,created from trace_app where action='ACTION_WEB_ENTER' and view_path like '%messageTemp%' and web_data like '%eduComId%' order by created desc "; String sql2 ="select distinct pseudo_id,doctor_id,web_data,view_path,class_name,pseudo_session,action,created from trace_app where action='ACTION_WEB_ENTER' and class_name like '%messageTemp%' order by created desc ";
List<com.alibaba.fastjson.JSONObject> res2 = clickHouseService.query(sql2, TableEnum.traceappp); List<com.alibaba.fastjson.JSONObject> res2 = clickHouseService.query(sql2, TableEnum.traceappp);
Map<String,List> map = new HashMap<String,List>(); Map<String,List> map = new HashMap<String,List>();
map.put("healthNotice",res); map.put("healthNotice",res);
map.put("messageTemp",res2); map.put("messageTemp",res2);
return PicaResponse.toResponse(map); return builder.setData(map).build();
} }
@ApiOperation(value = "页面查看次数", response = PicaResponse.class) @ApiOperation(value = "页面查看次数", response = PicaResponse.class)
@RequestMapping(value = "/countOnPage",method = RequestMethod.GET) @RequestMapping(value = "/countOnPage",method = RequestMethod.GET)
public PicaResponse countOnPage(@RequestParam(name = "begin", required = true) String begin,@RequestParam(name = "end", required = true) String end){ public PicaResponse countOnPage(@RequestParam(name = "begin", required = true) String begin,@RequestParam(name = "end", required = true) String end){
PicaResponse.Builder builder = new PicaResponse.Builder();
if(StringUtil.isEmpty(begin) || StringUtil.isEmpty(end)){
return builder.setData(null).setCode(PicaResultCode.PARAM_IS_BLANK.code()).setMessage(PicaResultCode.PARAM_IS_BLANK.message()).build();
}
if( StringUtil.isNotNull(begin) && StringUtil.isNotNull(end) ){
if( begin.length()!=10 || ( !begin.contains("-")) || end.length()!=10 || ( !end.contains("-")) ){
return builder.setData(null).setCode(PicaResultCode.PARAM_IS_INVALID.code()).setMessage(PicaResultCode.PARAM_IS_INVALID.message()+",please use like '2019-05-03' ").build();
}
}
String sql ="select web_data from trace_app where action='ACTION_WEB_ENTER' and view_path like '%healthNotice%' and web_data like '%eduComId%' " ; String sql ="select web_data from trace_app where action='ACTION_WEB_ENTER' and view_path like '%healthNotice%' and web_data like '%eduComId%' " ;
sql = sql + " and created_day >= "; sql = sql + " and created_day >= '";
sql = sql + begin ; sql = sql + begin ;
sql = sql + " and created_day <= "; sql = sql + "' and created_day <= '";
sql = sql + end ; sql = sql + end ;
sql = sql + " order by created desc "; sql = sql + "' order by created desc ";
List<com.alibaba.fastjson.JSONObject> res = clickHouseService.query(sql, TableEnum.traceappp); List<com.alibaba.fastjson.JSONObject> res = clickHouseService.query(sql, TableEnum.traceappp);
String sql2 ="select web_data from trace_app where action='ACTION_WEB_ENTER' and view_path like '%messageTemp%' and web_data like '%eduComId%' " ; String sql2 ="select web_data from trace_app where action='ACTION_WEB_ENTER' and view_path like '%messageTemp%' " ;
sql2 = sql2 + " and created_day >= "; sql2 = sql2 + " and created_day >= '";
sql2 = sql2 + begin ; sql2 = sql2 + begin ;
sql2 = sql2 + " and created_day <= "; sql2 = sql2 + "' and created_day <= '";
sql2 = sql2 + end ; sql2 = sql2 + end ;
sql2 = sql2 + " order by created desc "; sql2 = sql2 + "' order by created desc ";
List<com.alibaba.fastjson.JSONObject> res2 = clickHouseService.query(sql2, TableEnum.traceappp); List<com.alibaba.fastjson.JSONObject> res2 = clickHouseService.query(sql2, TableEnum.traceappp);
Map<String,List> map = new HashMap<String,List>(); Map<String,List> map = new HashMap<String,List>();
map.put("healthNotice",res); map.put("healthNotice",res);
map.put("messageTemp",res2); map.put("messageTemp",res2);
return PicaResponse.toResponse(map); return builder.setData(map).build();
}
@ApiOperation(value = "音频播放次数", response = PicaResponse.class)
@RequestMapping(value = "/countMusic",method = RequestMethod.GET)
public PicaResponse countMusic(@RequestParam(name = "begin", required = true) String begin,@RequestParam(name = "end", required = true) String end){
PicaResponse.Builder builder = new PicaResponse.Builder();
if(StringUtil.isEmpty(begin) || StringUtil.isEmpty(end)){
return builder.setData(null).setCode(PicaResultCode.PARAM_IS_BLANK.code()).setMessage(PicaResultCode.PARAM_IS_BLANK.message()).build();
}
if( StringUtil.isNotNull(begin) && StringUtil.isNotNull(end) ){
if( begin.length()!=10 || ( !begin.contains("-")) || end.length()!=10 || ( !end.contains("-")) ){
return builder.setData(null).setCode(PicaResultCode.PARAM_IS_INVALID.code()).setMessage(PicaResultCode.PARAM_IS_INVALID.message()+",please use like '2019-05-03' ").build();
}
}
String sql ="select web_data from trace_app where action='ACTION_WEB_STAY' and view_path like '%healthNotice%' and web_data like '%eduComId%' " ;
sql = sql + " and created_day >= '";
sql = sql + begin ;
sql = sql + "' and created_day <= '";
sql = sql + end ;
sql = sql + "' order by created desc ";
List<com.alibaba.fastjson.JSONObject> res = clickHouseService.query(sql, TableEnum.traceappp);
return builder.setData(res).build();
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册