|
@ -74,7 +74,7 @@ public class StatisticsController extends BaseController {
|
|
|
|
|
|
if (index != null) {
|
|
|
for (String idx : indexes) {
|
|
|
result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, level,idx,level2_type));
|
|
|
result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, level, idx, level2_type));
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -119,11 +119,11 @@ public class StatisticsController extends BaseController {
|
|
|
/**
|
|
|
* 指标截止日期累积量
|
|
|
*
|
|
|
* @param endDate 结束时间
|
|
|
* @param area 父code
|
|
|
* @param level 等级 1 团队,2 机构,3 区,4 市
|
|
|
* @param index 指标代码
|
|
|
* @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
|
|
|
* @param endDate 结束时间
|
|
|
* @param area 父code
|
|
|
* @param level 等级 1 团队,2 机构,3 区,4 市
|
|
|
* @param index 指标代码
|
|
|
* @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/total")
|
|
@ -138,7 +138,7 @@ public class StatisticsController extends BaseController {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
for (String idx : indexes) {
|
|
|
result.put("index_" + idx, statisticsService.getTotalAmount(endDate, area, level, idx,level2_type));
|
|
|
result.put("index_" + idx, statisticsService.getTotalAmount(endDate, area, level, idx, level2_type));
|
|
|
}
|
|
|
|
|
|
return write(200, "查询成功", "data", result);
|
|
@ -184,13 +184,13 @@ public class StatisticsController extends BaseController {
|
|
|
/**
|
|
|
* 指标截止日期增量
|
|
|
*
|
|
|
* @param endDate 结束时间
|
|
|
* @param area 父code
|
|
|
* @param level 等级 1 团队,2 机构,3 区,4 市
|
|
|
* @param index 指标代码
|
|
|
* @param sort 排序 1倒叙 2是 正序
|
|
|
* @param endDate 结束时间
|
|
|
* @param area 父code
|
|
|
* @param level 等级 1 团队,2 机构,3 区,4 市
|
|
|
* @param index 指标代码
|
|
|
* @param sort 排序 1倒叙 2是 正序
|
|
|
* @param lowLevel
|
|
|
* @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
|
|
|
* @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/lowlevel_total")
|
|
@ -207,7 +207,7 @@ public class StatisticsController extends BaseController {
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
for (String idx : indexes) {
|
|
|
result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel,level2_type));
|
|
|
result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel, level2_type));
|
|
|
}
|
|
|
|
|
|
return write(200, "查询成功", "data", result);
|
|
@ -240,39 +240,56 @@ public class StatisticsController extends BaseController {
|
|
|
JSONArray returnJa = new JSONArray();
|
|
|
List<JSONArray> jsonArrays = new ArrayList<>();
|
|
|
|
|
|
JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel,null);
|
|
|
JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null);
|
|
|
jsonArrays.add(jsonArray1);
|
|
|
|
|
|
JSONArray jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
|
|
|
jsonArrays.add(jsonArray2);
|
|
|
|
|
|
//遍历合并2个指标中key值一样的
|
|
|
for (int i = 0; i < jsonArrays.get(0).length(); i++) {
|
|
|
if (jsonArrays.get(1).length() == 0) {
|
|
|
if (jsonArrays.get(1).length() == 0) {
|
|
|
//如果只有一个指标的时候 另外一个指标默认是0
|
|
|
for (int i = 0; i < jsonArrays.get(0).length(); i++) {
|
|
|
//未回复咨询不存在的时候默认是0
|
|
|
JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
|
|
|
String amount = map1.get("amount").toString() + ",0";
|
|
|
map1.put("amount", amount);
|
|
|
returnJa.put(map1);
|
|
|
} else {
|
|
|
for (int j = 0; j < jsonArrays.get(1).length(); j++) {
|
|
|
JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
|
|
|
JSONObject map2 = jsonArrays.get(1).getJSONObject(j);
|
|
|
String amount = "";
|
|
|
if (map1.get("code").equals(map2.get("code"))) {
|
|
|
amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
|
|
|
map1.put("amount", amount);
|
|
|
returnJa.put(map1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
//如果是2个指标的时候,分别放入map中,以减少查询次数
|
|
|
Map<String,JSONObject> index1=new HashMap<>();
|
|
|
Map<String,JSONObject> index2=new HashMap<>();
|
|
|
for (int i = 0; i < jsonArrays.get(0).length(); i++) {
|
|
|
JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
|
|
|
index1.put(map1.get("code").toString(),map1);
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < jsonArrays.get(1).length(); i++) {
|
|
|
JSONObject map1 = jsonArrays.get(1).getJSONObject(i);
|
|
|
index2.put(map1.get("code").toString(),map1);
|
|
|
}
|
|
|
|
|
|
for(Map.Entry<String , JSONObject> one:index1.entrySet()){
|
|
|
JSONObject map1 = one.getValue();
|
|
|
JSONObject map2 = index2.get(one.getKey());
|
|
|
String amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
|
|
|
map1.put("amount", amount);
|
|
|
returnJa.put(map1);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.put("index_" + indexes[0], returnJa);
|
|
|
return write(200, "查询成功", "data", result);
|
|
|
} catch (Exception e) {
|
|
|
} catch (
|
|
|
Exception e
|
|
|
)
|
|
|
|
|
|
{
|
|
|
e.printStackTrace();
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -450,6 +467,7 @@ public class StatisticsController extends BaseController {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取三师转签或高危人群
|
|
|
*
|
|
@ -572,13 +590,13 @@ public class StatisticsController extends BaseController {
|
|
|
@RequestMapping("/Consulting_StatList")
|
|
|
@ResponseBody
|
|
|
public String getConsultingStatisticsList(@RequestParam(required = true) Integer level,
|
|
|
@RequestParam(required = true) String area ,
|
|
|
@RequestParam(required = false) String lowlevel) {
|
|
|
@RequestParam(required = true) String area,
|
|
|
@RequestParam(required = false) String lowlevel) {
|
|
|
try {
|
|
|
JSONObject data = statisticsService.getConsultingStatisticsList(level,area,lowlevel);
|
|
|
if(data!=null){
|
|
|
JSONObject data = statisticsService.getConsultingStatisticsList(level, area, lowlevel);
|
|
|
if (data != null) {
|
|
|
return write(200, "查询成功", "data", data);
|
|
|
}else{
|
|
|
} else {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@ -599,12 +617,12 @@ public class StatisticsController extends BaseController {
|
|
|
@RequestMapping("/Consulting_Title")
|
|
|
@ResponseBody
|
|
|
public String getConsultingTitle(@RequestParam(required = true) Integer level,
|
|
|
@RequestParam(required = true) String area) {
|
|
|
@RequestParam(required = true) String area) {
|
|
|
try {
|
|
|
JSONObject data = statisticsService.getConsultingTitle(level,area);
|
|
|
if(data!=null){
|
|
|
JSONObject data = statisticsService.getConsultingTitle(level, area);
|
|
|
if (data != null) {
|
|
|
return write(200, "查询成功", "data", data);
|
|
|
}else{
|
|
|
} else {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@ -614,15 +632,16 @@ public class StatisticsController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 获取回复数时间分布数
|
|
|
*
|
|
|
* @param level
|
|
|
* @param area
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/getCoutListByTime")
|
|
|
@ResponseBody
|
|
|
public String getCoutListByTime(@RequestParam(required = true)String level,@RequestParam(required = true) String area){
|
|
|
public String getCoutListByTime(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
|
|
|
try {
|
|
|
return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level,area));
|
|
|
return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level, area));
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|