|
@@ -186,6 +186,22 @@ public class TlCommonController extends BaseController {
|
|
List<TlIncident> tlIncidents = incidentService.selectTlIncidentList(new TlIncident());
|
|
List<TlIncident> tlIncidents = incidentService.selectTlIncidentList(new TlIncident());
|
|
long unDealTotal = tlIncidents.stream().filter(obj -> "1".equals(obj.getStatus())).count();
|
|
long unDealTotal = tlIncidents.stream().filter(obj -> "1".equals(obj.getStatus())).count();
|
|
Map<String, Map<String, Integer>> incidentDetailCount = tlIncidents.stream().collect(Collectors.groupingBy(TlIncident::getArea, Collectors.groupingBy(TlIncident::getStatus, Collectors.summingInt(e -> 1))));
|
|
Map<String, Map<String, Integer>> incidentDetailCount = tlIncidents.stream().collect(Collectors.groupingBy(TlIncident::getArea, Collectors.groupingBy(TlIncident::getStatus, Collectors.summingInt(e -> 1))));
|
|
|
|
+ Map<String, Map<String, Integer>> modifiedMap = incidentDetailCount.entrySet().stream()
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
+ Map.Entry::getKey,
|
|
|
|
+ entry -> entry.getValue().entrySet().stream()
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
+ e -> {
|
|
|
|
+ if ("1".equals(e.getKey())) {
|
|
|
|
+ return "key1";
|
|
|
|
+ } else if ("2".equals(e.getKey())) {
|
|
|
|
+ return "key2";
|
|
|
|
+ }
|
|
|
|
+ return e.getKey();
|
|
|
|
+ },
|
|
|
|
+ Map.Entry::getValue
|
|
|
|
+ ))
|
|
|
|
+ ));
|
|
Map<String, Integer> incidentCount = tlIncidents.stream().collect(Collectors.groupingBy(TlIncident::getArea, Collectors.summingInt(e -> 1)));
|
|
Map<String, Integer> incidentCount = tlIncidents.stream().collect(Collectors.groupingBy(TlIncident::getArea, Collectors.summingInt(e -> 1)));
|
|
map.put("unDealTotal", unDealTotal); // 未处理隐患总数
|
|
map.put("unDealTotal", unDealTotal); // 未处理隐患总数
|
|
map.put("incidentTotal", tlIncidents.size()); // 隐患总数
|
|
map.put("incidentTotal", tlIncidents.size()); // 隐患总数
|
|
@@ -202,7 +218,7 @@ public class TlCommonController extends BaseController {
|
|
|
|
|
|
IncidentDetailAreaNum incidentDetailAreaNum = new IncidentDetailAreaNum();
|
|
IncidentDetailAreaNum incidentDetailAreaNum = new IncidentDetailAreaNum();
|
|
incidentDetailAreaNum.setAreaName(area.getAreaName());
|
|
incidentDetailAreaNum.setAreaName(area.getAreaName());
|
|
- incidentDetailAreaNum.setDetail(incidentDetailCount.get(Convert.toStr(area.getId())));
|
|
|
|
|
|
+ incidentDetailAreaNum.setDetail(modifiedMap.get(Convert.toStr(area.getId())));
|
|
incidentDetailCounts.add(incidentDetailAreaNum);
|
|
incidentDetailCounts.add(incidentDetailAreaNum);
|
|
}
|
|
}
|
|
map.put("areaIncidentTotal", areaIncidentTotals); // 各区域隐患占比
|
|
map.put("areaIncidentTotal", areaIncidentTotals); // 各区域隐患占比
|