diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java index c93283f6..9bbeb028 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java @@ -1305,15 +1305,34 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { Map region = eventList.stream() .collect(Collectors.groupingBy(item -> getRange(item.getStakeMark()), Collectors.counting())); List> list = new ArrayList<>(); - region.forEach((key, count) -> { + for (String key : region.keySet()) { Map map = new HashMap<>(); map.put("regionName", key); - map.put("num", count); + map.put("num", region.get(key)); list.add(map); - }); + } + list = list.stream().sorted(Comparator.comparing(item -> getCitySorted(item.get("regionName").toString()))).collect(Collectors.toList()); 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) { Long stakeMarkMetre = StakeMarkUtils.formatMetreLong(stakeMark); @@ -1640,12 +1659,13 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { if (eventList.size() > 0) { //根据详细类型 分组计数 Map subclass = eventList.stream().collect(Collectors.groupingBy(DcSdhsEvent::getEventSubclass, Collectors.counting())); - subclass.forEach((key, count) -> { + for (String key : subclass.keySet()) { Map map = new HashMap<>(); map.put("subclassName", key); - map.put("num", count); + map.put("num", subclass.get(key)); list.add(map); - }); + } + list = list.stream().sorted(Comparator.comparing(item -> Long.valueOf(((Map) item).get("num").toString())).reversed()).collect(Collectors.toList()); } return AjaxResult.success(list);