|
|
@ -456,6 +456,101 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String,Object>> cityComprehensiveManage(BusinessAlertBo businessAlertBo) { |
|
|
|
if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { |
|
|
|
throw new ServiceException("【postCode】 岗位编码为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
|
|
|
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(postVoList)) { |
|
|
|
return ListUtil.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
aiNameMap.keySet().forEach(key -> { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
Map<String,Object> keyMap = new HashMap<>(); |
|
|
|
|
|
|
|
List<String> aiLabelList = aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList(); |
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(aiLabelList); |
|
|
|
|
|
|
|
List<String> monthList = getLastSixMonths(); |
|
|
|
String startTime = monthList.get(monthList.size() - 1); |
|
|
|
String endTime = monthList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); |
|
|
|
|
|
|
|
Map<String,Object> labelMap = new HashMap<>(); |
|
|
|
labelMapList.forEach(label -> { |
|
|
|
labelMap.put(label.get("labelCn")+ "",label.get("total")); |
|
|
|
}); |
|
|
|
|
|
|
|
keyMap.put("handlerStat", labelMap); |
|
|
|
|
|
|
|
//事件高发区
|
|
|
|
Long deptId = LoginHelper.getDeptId(); |
|
|
|
//获取街道信息
|
|
|
|
List<RemoteDeptVo> streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); |
|
|
|
|
|
|
|
Map<String,Integer> streeMap = new HashMap<>(); |
|
|
|
streetList.forEach(street -> { |
|
|
|
businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); |
|
|
|
Integer alertCount = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime); |
|
|
|
streeMap.put(street.getDeptName(),alertCount); |
|
|
|
}); |
|
|
|
|
|
|
|
//降序排序,取前五个
|
|
|
|
String topMap = streeMap.entrySet().stream() |
|
|
|
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) |
|
|
|
.limit(1) |
|
|
|
.map(Map.Entry::getKey) |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
|
|
|
|
keyMap.put("topAlert",topMap); |
|
|
|
|
|
|
|
//处理效率top5
|
|
|
|
Map<String,Integer> streeRateMap = new HashMap<>(); |
|
|
|
streetList.forEach(street -> { |
|
|
|
businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); |
|
|
|
Integer alertCount = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime); |
|
|
|
if (ObjectUtil.isEmpty(alertCount)) { |
|
|
|
streeRateMap.put(street.getDeptName(),0); |
|
|
|
}else { |
|
|
|
streeRateMap.put(street.getDeptName(),alertCount); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
String topKey = streeRateMap.entrySet().stream() |
|
|
|
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) |
|
|
|
.limit(1) |
|
|
|
.map(Map.Entry::getKey) |
|
|
|
.findFirst() |
|
|
|
.orElse(null); |
|
|
|
|
|
|
|
keyMap.put("handlerRate", topKey); |
|
|
|
|
|
|
|
|
|
|
|
//识别类型存储
|
|
|
|
result.put(key, keyMap); |
|
|
|
|
|
|
|
|
|
|
|
resultList.add(result); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取近6个月的月份集合(格式:yyyy-MM) |
|
|
|
*/ |
|
|
|