|
@ -1503,7 +1503,7 @@ public class StatisticsService extends BaseService {
|
|
|
JSONArray onRely = new JSONArray();
|
|
|
onRely.put(onRelyObject);
|
|
|
|
|
|
result.put("result", getCoutList(level,rely, total, onRely));
|
|
|
result.put("result", getCoutListTitle(level,rely, total, onRely));
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@ -1602,6 +1602,92 @@ public class StatisticsService extends BaseService {
|
|
|
return resultMaps;
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> getCoutListTitle(Integer level,JSONArray rely, JSONArray total, JSONArray onRely) {
|
|
|
|
|
|
Map<String, Object> relyMap = new HashMap<>();
|
|
|
Map<String, Object> totalMap = new HashMap<>();
|
|
|
Map<String, Object> onRelyMap = new HashMap<>();
|
|
|
|
|
|
//将List转换为Map,Key为要比较的CODE,降低循环层数
|
|
|
//转换回复数
|
|
|
Iterator iterator = rely.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
JSONObject jsonObject = (JSONObject) iterator.next();
|
|
|
relyMap.put(jsonObject.get("code").toString(), jsonObject);
|
|
|
}
|
|
|
//转换总咨询数
|
|
|
Iterator iterator2 = total.iterator();
|
|
|
while (iterator2.hasNext()) {
|
|
|
JSONObject jsonObject = (JSONObject) iterator2.next();
|
|
|
totalMap.put(jsonObject.get("code").toString(), jsonObject);
|
|
|
}
|
|
|
|
|
|
//转换总咨询数
|
|
|
Iterator iterator3 = onRely.iterator();
|
|
|
while (iterator3.hasNext()) {
|
|
|
JSONObject jsonObject = (JSONObject) iterator3.next();
|
|
|
onRelyMap.put(jsonObject.get("code").toString(), jsonObject);
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> resultMaps = new ArrayList<>();
|
|
|
for (String key : totalMap.keySet()) {
|
|
|
Map<String, Object> rs = new HashMap<>();
|
|
|
JSONObject relyRs = (JSONObject) relyMap.get(key);
|
|
|
JSONObject totalRs = (JSONObject) totalMap.get(key);
|
|
|
JSONObject onRelyRs = (JSONObject) onRelyMap.get(key);
|
|
|
//合并结果集
|
|
|
Long totalNm = totalRs.getLong("num");
|
|
|
Long relyNm = relyRs.getLong("num");
|
|
|
Long noRelyNm = onRelyRs.getLong("num");
|
|
|
rs.put("name", relyRs.get("name"));
|
|
|
rs.put("noRelyCount", noRelyNm);
|
|
|
rs.put("relyCount", relyNm);
|
|
|
rs.put("total", totalNm);
|
|
|
rs.put("code", key);
|
|
|
if (totalNm != null && totalNm != 0) {
|
|
|
if (relyNm != null && relyNm != 0) {
|
|
|
double rr = (double) relyNm / totalNm * 100;
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
rs.put("relyRate", df.format(rr) + "%");
|
|
|
rs.put("relyDoubleRate", rr);
|
|
|
} else {
|
|
|
rs.put("relyRate", "0.00%");
|
|
|
rs.put("relyDoubleRate", 0.0);
|
|
|
}
|
|
|
if (noRelyNm != null && noRelyNm != 0) {
|
|
|
double rr = (double) noRelyNm / totalNm * 100;
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
rs.put("noRelyRate", df.format(rr) + "%");
|
|
|
rs.put("noRelyDoubleRate", rr);
|
|
|
} else {
|
|
|
rs.put("noRelyRate", "0.00%");
|
|
|
rs.put("noRelyDoubleRate", 0.0);
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
rs.put("relyRate", "0.00%");
|
|
|
rs.put("relyDoubleRate", 0.0);
|
|
|
rs.put("noRelyRate", "0.00%");
|
|
|
rs.put("noRelyDoubleRate", 0.0);
|
|
|
}
|
|
|
|
|
|
resultMaps.add(rs);
|
|
|
}
|
|
|
if(level==1){
|
|
|
statisticsAllService.translateTeamLeaderName(resultMaps);
|
|
|
}
|
|
|
//根据为回复数排序
|
|
|
Collections.sort(resultMaps, new Comparator<Map<String, Object>>() {
|
|
|
|
|
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
return (double) o1.get("noRelyDoubleRate") < (double) o2.get("noRelyDoubleRate") ? 1 : ((double) o1.get("noRelyDoubleRate") == (double) o2.get("noRelyDoubleRate") ? 0 : -1);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return resultMaps;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取及时回复的时间分布
|
|
|
*
|
|
@ -4205,7 +4291,7 @@ public class StatisticsService extends BaseService {
|
|
|
JSONArray onRely = new JSONArray();
|
|
|
onRely.put(onRelyObject);
|
|
|
|
|
|
result.put("result", getCoutList(level,rely, total, onRely));
|
|
|
result.put("result", getCoutListTitle(level,rely, total, onRely));
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@ -4246,7 +4332,7 @@ public class StatisticsService extends BaseService {
|
|
|
JSONArray onRely = new JSONArray();
|
|
|
onRely.put(onRelyObject);
|
|
|
|
|
|
result.put("result", getCoutList(level,rely, total, onRely));
|
|
|
result.put("result", getCoutListTitle(level,rely, total, onRely));
|
|
|
|
|
|
return result;
|
|
|
}
|