| | |
| | | return new Response().set(1, powerAlarmNum); |
| | | } |
| | | |
| | | //电源告警个数 |
| | | public int getAlarmNumByUserId(int userId) { |
| | | return mapper.getAlarmNum(userId); |
| | | } |
| | | //实时1级电源告警个数 |
| | | public int getRealTimeWithLevel1(int userId) { |
| | | return mapper.getRealTimeWithLevel1(userId); |
| | | } |
| | | |
| | | //首页电源总个数 |
| | | public int getHomeAlarmNum(int uId) { |
| | | int powerAlarmNum = mapper.getAlarmNum(uId); |
| | |
| | | List<Map<String, Integer>> mapList = Arrays.asList(resultMap, map2); |
| | | return new Response<>().setII(1, true, mapList, null); |
| | | } catch (Exception e) { |
| | | return new Response<>().set(0, false, "发生异常"); |
| | | return new Response<>().set(0, false, "发生异常:"+e.getCause()); |
| | | } |
| | | } |
| | | |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | int ptatolNum = 0; |
| | | Map<String, Integer> pAlmClearMap = new HashMap<>(); |
| | | pAlmClearMap.put("clear0", 0); |
| | | pAlmClearMap.put("clear1", 0); |
| | | List<PwrdevAlarm> pAlmList = mapper.getPalmToday(userId); |
| | | Map<Integer, List<PwrdevAlarm>> pclearedMap = pAlmList.stream().collect(Collectors.groupingBy(PwrdevAlarm::getAlmClearedType)); |
| | | for (Integer cleared : pclearedMap.keySet()) { |
| | | pAlmClearMap.put(String.valueOf(cleared), pclearedMap.get(cleared).size()); |
| | | pAlmClearMap.put("clear" + String.valueOf(cleared), pclearedMap.get(cleared).size()); |
| | | ptatolNum += pclearedMap.get(cleared).size(); |
| | | } |
| | | Map<String, Integer> pAlmLevelMap = new HashMap<>(); |
| | | pAlmLevelMap.put("level1", 0); |
| | | pAlmLevelMap.put("level2", 0); |
| | | pAlmLevelMap.put("level3", 0); |
| | | pAlmLevelMap.put("level4", 0); |
| | | Map<Integer, List<PwrdevAlarm>> plevelMap = pAlmList.stream().collect(Collectors.groupingBy(PwrdevAlarm::getAlmLevel)); |
| | | for (Integer level : plevelMap.keySet()) { |
| | | pAlmLevelMap.put(String.valueOf(level), plevelMap.get(level).size()); |
| | | ptatolNum += plevelMap.get(level).size(); |
| | | pAlmLevelMap.put("level" + String.valueOf(level), plevelMap.get(level).size()); |
| | | //ptatolNum += plevelMap.get(level).size(); |
| | | } |
| | | map.put("pAlmClearMap", pAlmClearMap); |
| | | map.put("pAlmLevelMap", pAlmLevelMap); |
| | |
| | | public List<Integer> getStationList(int userId) { |
| | | return mapper.getStationList(userId); |
| | | } |
| | | |
| | | public int getCountByStationIds(List<String> stationIdList, Integer level) { |
| | | return mapper.getCountByStationIds(stationIdList,level); |
| | | } |
| | | |
| | | public List<PwrdevAlarm> getListByStationIds(List<String> stationIdList) { |
| | | return mapper.getListByStationIds(stationIdList); |
| | | } |
| | | } |