|
@ -4,6 +4,7 @@ import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
|
|
|
import com.yihu.wlyy.service.app.statistics.StatisticsService;
|
|
|
import com.yihu.wlyy.service.app.statisticsES.StatisticsESService;
|
|
|
import com.yihu.wlyy.util.Constant;
|
|
|
import com.yihu.wlyy.util.ElasticsearchUtil;
|
|
|
import com.yihu.wlyy.util.ValueComparator;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import com.yihu.wlyy.web.quota.vo.SaveModel;
|
|
@ -39,7 +40,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
StatisticsService statisticsService;
|
|
|
@Autowired
|
|
|
StatisticsAllService statisticsAllService;
|
|
|
|
|
|
@Autowired
|
|
|
ElasticsearchUtil elasticsearchUtil;
|
|
|
/**
|
|
|
* 获取统计时间
|
|
|
*
|
|
@ -79,6 +81,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String level2_type) {
|
|
|
String tag = "";
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
if (index != null) {
|
|
@ -114,6 +118,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = true) String index,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@ -150,6 +156,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = true) String index,
|
|
|
@RequestParam(required = false) String level2_type) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@ -189,6 +197,11 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String level2_type,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
if(StringUtils.isNotEmpty(lowLevel)){
|
|
|
lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel))+"";
|
|
|
}
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@ -224,6 +237,11 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String lowLevel,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
if(StringUtils.isNotEmpty(lowLevel)){
|
|
|
lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel))+"";
|
|
|
}
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
JSONArray returnJa = new JSONArray();
|
|
@ -323,6 +341,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = true) int level,
|
|
|
@RequestParam(required = true) String index) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
for (String idx : indexes) {
|
|
@ -354,6 +374,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String year
|
|
|
) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
JSONObject result = new JSONObject();
|
|
|
//year没传默认是今年
|
|
|
if (org.springframework.util.StringUtils.isEmpty(year)) {
|
|
@ -414,7 +436,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
|
|
|
level=changeLevel(level);
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
JSONArray result = statisticsESService.getSixFiveStatistics(endDate, area, level);
|
|
|
|
|
|
return write(200, "查询成功", "data", result);
|
|
@ -449,6 +472,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String lowCode,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@ -492,9 +517,14 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String lowLevel,
|
|
|
@RequestParam(required = false) String lowCode) {
|
|
|
try {
|
|
|
int levelTemp = level;
|
|
|
String lowLevelTemp = lowLevel;
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
if(StringUtils.isNotEmpty(lowLevel)){
|
|
|
lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel))+"";
|
|
|
}
|
|
|
String[] indexes = index.split(",");
|
|
|
level=changeLevel(level);
|
|
|
lowLevel=changeLevel(Integer.valueOf(lowLevel))+"";
|
|
|
JSONObject result = new JSONObject();
|
|
|
String year = Constant.getNowYearByDate(date);
|
|
|
if (StringUtils.isNotEmpty(lowCode)) {
|
|
@ -509,7 +539,7 @@ public class EsStatisticsController extends BaseController {
|
|
|
// 未指定level下特定查询级别
|
|
|
for (String idx : indexes) {
|
|
|
if (idx.equals("18") || index.equals("19")) {
|
|
|
result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, level, idx, sort, lowLevel));
|
|
|
result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, levelTemp, idx, sort, lowLevelTemp));
|
|
|
} else if (index.equals("21")) {
|
|
|
result.put("index_" + idx, statisticsESService.getLowLevelTotal2(date, area, level, idx, sort, lowLevel));
|
|
|
} else if (idx.equals("28")) {
|
|
@ -547,8 +577,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
try {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
JSONObject sszq = statisticsESService.getSszqAndGwrq(endDate, area, level, "18");
|
|
|
JSONObject gwrq = statisticsESService.getSszqAndGwrq(endDate, area, level, "19");
|
|
|
JSONObject sszq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "18");
|
|
|
JSONObject gwrq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "19");
|
|
|
|
|
|
result.put("sszq", sszq);
|
|
|
result.put("gwrq", gwrq);
|
|
@ -577,6 +607,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = true) String index,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
String[] indexes = index.split(",");
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@ -632,7 +664,11 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = false) String lowlevel,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
|
|
|
//新 版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
if(StringUtils.isNotEmpty(lowlevel)){
|
|
|
lowlevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowlevel))+"";
|
|
|
}
|
|
|
JSONObject data = null;
|
|
|
if (Constant.getNowYear().equals(year)) {
|
|
|
data = statisticsESService.getConsultingStatisticsList(level, area, lowlevel, null);
|
|
@ -670,6 +706,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = true) String area,
|
|
|
@RequestParam(required = false) String year) {
|
|
|
try {
|
|
|
//版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
JSONObject data = null;
|
|
|
// if (Constant.getNowYear().equals(year)) {
|
|
|
// //查今年的查找redis即可
|
|
@ -715,6 +753,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
// } else {
|
|
|
// return write(200, "查询成功", "data", statisticsService.getCoutListByTimeYear(level, area, year));
|
|
|
// }
|
|
|
//版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
|
|
|
return write(200, "查询成功", "data", statisticsESService.getCoutListByTime(level, area, year));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -1407,10 +1447,9 @@ public class EsStatisticsController extends BaseController {
|
|
|
* 前端:续签进展
|
|
|
* <p>
|
|
|
* //@param index 42,43,44 (52,53,54 服务类型维度)
|
|
|
*
|
|
|
* @param level 等级 4 市 3区 2社区 1团队
|
|
|
* @param area 市 默认是厦门市 350200 区 就是区的code 社区就是社区的code 团队就是团队的code
|
|
|
* @param year 年份 非比传
|
|
|
* @param level 等级 4 市 3区 2社区 1团队
|
|
|
* @param area 市 默认是厦门市 350200 区 就是区的code 社区就是社区的code 团队就是团队的code.
|
|
|
* @param year 年份 非比传
|
|
|
* @param lowCode 服务类型维度code(老年人3,高血压4,糖尿病5)
|
|
|
* @return
|
|
|
*/
|
|
@ -1425,7 +1464,7 @@ public class EsStatisticsController extends BaseController {
|
|
|
try {
|
|
|
|
|
|
//return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(index,level, code, year,lowCode));
|
|
|
return write(200, "查询成功!", "data", statisticsESService.getRenewPercentAndChangePercent(changeLevel(level), area, year, lowCode));
|
|
|
return write(200,"查询成功!","data",statisticsESService.getRenewPercentAndChangePercent(elasticsearchUtil.changeLevel(level),area,year,lowCode));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败");
|
|
@ -1446,6 +1485,8 @@ public class EsStatisticsController extends BaseController {
|
|
|
@RequestParam(required = true) String level,
|
|
|
@RequestParam(required = true) String code) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
|
|
|
String switchIndex = "";
|
|
|
String switchIndexReson = "";
|
|
|
String signIn = "";
|
|
@ -1521,7 +1562,7 @@ public class EsStatisticsController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, changeLevel(level), index, sort, String.valueOf(changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
|
|
|
// result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, changeLevel(level), index, sort, String.valueOf(changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
|
|
|
|
|
|
return write(200, "查询成功", "data", result);
|
|
|
} catch (Exception e) {
|
|
@ -1536,39 +1577,12 @@ public class EsStatisticsController extends BaseController {
|
|
|
@ApiParam(name = "area", value = "区域code") @RequestParam(required = true) String area,
|
|
|
@ApiParam(name = "level", value = "级别") @RequestParam(required = true) int level) {
|
|
|
try {
|
|
|
//新版与旧版统计适配
|
|
|
level = elasticsearchUtil.changeLevel(level);
|
|
|
return write(200, "查询成功", "data", statisticsESService.getLowLevelTotalSingle2(date, area, level));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 将参数转换成需要的SaveModel里的标识
|
|
|
*
|
|
|
* @param level 等级 4 市 3区 2社区 1团队
|
|
|
* @return
|
|
|
* @author zhangdan
|
|
|
* @time 2017-10-18
|
|
|
*/
|
|
|
public int changeLevel(int level) {
|
|
|
int resultLevel = 0;
|
|
|
if (level == 1) {
|
|
|
//团队转成SaveModel里的标识
|
|
|
resultLevel = Integer.valueOf(SaveModel.teamLevel);
|
|
|
} else if (level == 2) {
|
|
|
//社区转成SaveModel里的标识
|
|
|
resultLevel = Integer.valueOf(SaveModel.OrgLevel);
|
|
|
} else if (level == 3) {
|
|
|
//区转成SaveModel里的标识
|
|
|
resultLevel = Integer.valueOf(SaveModel.townLevel);
|
|
|
} else if (level == 4) {
|
|
|
//市转成SaveModel里的标识
|
|
|
resultLevel = Integer.valueOf(SaveModel.cityLevel);
|
|
|
}
|
|
|
if (resultLevel == 0) {
|
|
|
resultLevel = level;
|
|
|
}
|
|
|
return resultLevel;
|
|
|
}
|
|
|
}
|