| | |
| | | } |
| | | //历史头部统计 |
| | | public Response getCountByLevel() throws InterruptedException { |
| | | Map<Integer,Integer> countMap = new HashMap<>(); |
| | | countMap.put(0,0); |
| | | countMap.put(1,0); |
| | | countMap.put(2,0); |
| | | countMap.put(3,0); |
| | | Map<String,Integer> countMap = new HashMap<>(); |
| | | countMap.put("0",0); |
| | | countMap.put("1",0); |
| | | countMap.put("2",0); |
| | | countMap.put("3",0); |
| | | countMap.put("ac",0); |
| | | countMap.put("dc",0); |
| | | countMap.put("gc",0); |
| | | List<CKPowerDevAlarmHistory> allList=new ArrayList<>(); |
| | | //查询所有的历史时间表 |
| | | List<String> tableYearListInDB=subTablePageInfoService.getDevAlmHisList(); |
| | |
| | | }); |
| | | } |
| | | latch.await(); |
| | | countMap.put(0,allList.size()); |
| | | countMap.put("0",allList.size()); |
| | | Map<Integer, List<CKPowerDevAlarmHistory>> levelMap = allList.stream().collect(Collectors.groupingBy(CKPowerDevAlarmHistory::getAlmLevel)); |
| | | Set<Integer> levelKeyMap = levelMap.keySet(); |
| | | for (Integer level : levelKeyMap) { |
| | | countMap.put(level,levelMap.get(level).size()); |
| | | countMap.put(level.toString(),levelMap.get(level).size()); |
| | | } |
| | | Map<Integer, List<CKPowerDevAlarmHistory>> typeMap = allList.stream().collect(Collectors.groupingBy(CKPowerDevAlarmHistory::getDevType)); |
| | | Set<Integer> typeKeyMap = typeMap.keySet(); |
| | | for (Integer type : typeKeyMap) { |
| | | if(type==1){ |
| | | countMap.put("ac",levelMap.get(type).size()); |
| | | } |
| | | if(type==2){ |
| | | countMap.put("dc",levelMap.get(type).size()); |
| | | } |
| | | if(type==3){ |
| | | countMap.put("gc",levelMap.get(type).size()); |
| | | } |
| | | |
| | | } |
| | | return new Response().set(1,countMap); |
| | | } |
| | |
| | | } |
| | | //统计按照等级的告警信息 |
| | | public List<CKPowerDevAlarmHistory> selectLevelCountList(String tableYear) { |
| | | String sql="select alm_level from db_ckpwrdev_alarm." +tableYear; |
| | | String sql="select alm_level,dev_type from db_ckpwrdev_alarm." +tableYear; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | |
| | | while (rs.next()){ |
| | | CKPowerDevAlarmHistory ph=new CKPowerDevAlarmHistory(); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setDevType(rs.getInt("dev_type")); |
| | | list.add(ph); |
| | | } |
| | | return list; |