Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 3 months ago
parent
commit
29d4b4005e
  1. 32
      zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java

32
zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java

@ -1305,15 +1305,34 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
Map<String, Long> region = eventList.stream() Map<String, Long> region = eventList.stream()
.collect(Collectors.groupingBy(item -> getRange(item.getStakeMark()), Collectors.counting())); .collect(Collectors.groupingBy(item -> getRange(item.getStakeMark()), Collectors.counting()));
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
region.forEach((key, count) -> { for (String key : region.keySet()) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("regionName", key); map.put("regionName", key);
map.put("num", count); map.put("num", region.get(key));
list.add(map); list.add(map);
}); }
list = list.stream().sorted(Comparator.comparing(item -> getCitySorted(item.get("regionName").toString()))).collect(Collectors.toList());
return AjaxResult.success(list); return AjaxResult.success(list);
} }
private int getCitySorted(String city){
if (StringUtils.isEmpty(city)){
return 5;
}
if ("济南".equals(city)){
return 1;
} else if ("泰安".equals(city)){
return 2;
} else if ("济宁".equals(city)){
return 3;
} else if ("菏泽".equals(city)){
return 4;
} else {
return 5;
}
}
private static String getRange(String stakeMark) { private static String getRange(String stakeMark) {
Long stakeMarkMetre = StakeMarkUtils.formatMetreLong(stakeMark); Long stakeMarkMetre = StakeMarkUtils.formatMetreLong(stakeMark);
@ -1640,12 +1659,13 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
if (eventList.size() > 0) { if (eventList.size() > 0) {
//根据详细类型 分组计数 //根据详细类型 分组计数
Map<String, Long> subclass = eventList.stream().collect(Collectors.groupingBy(DcSdhsEvent::getEventSubclass, Collectors.counting())); Map<String, Long> subclass = eventList.stream().collect(Collectors.groupingBy(DcSdhsEvent::getEventSubclass, Collectors.counting()));
subclass.forEach((key, count) -> { for (String key : subclass.keySet()) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("subclassName", key); map.put("subclassName", key);
map.put("num", count); map.put("num", subclass.get(key));
list.add(map); list.add(map);
}); }
list = list.stream().sorted(Comparator.comparing(item -> Long.valueOf(((Map<String, Object>) item).get("num").toString())).reversed()).collect(Collectors.toList());
} }
return AjaxResult.success(list); return AjaxResult.success(list);

Loading…
Cancel
Save