| | |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Map<String, Response> res = new HashMap<>(); |
| | | Map<String, Object> res = new HashMap<>(); |
| | | Response sessionRes = new Response().set(1, httpSession.getId()); |
| | | while (!currentThread().isInterrupted()) { |
| | | //一体 告警:交流ABC |
| | |
| | | //一体 告警:单体容量 |
| | | Response res_monCapacityLowAnalysis = battAlarmDataService.getMonCapacityLowAnalysis(userId); |
| | | //一体 告警:单体温度内阻温度 |
| | | Response<Map> res_monVRTAnalysis = battAlarmDataService.getMonVRTAnalysis(userId); |
| | | Response res_monVRTAnalysis = battAlarmDataService.getMonVRTAnalysis(userId); |
| | | //一体 统计:三种设备类型 告警数统计 |
| | | int battAlarmNum = battAlarmDataService.serchRealTime(userId).getCode(); |
| | | int devAlarmNum = devAlarmDataService.getAlarmNum(userId); |
| | | int powerAlarmNum = (int) powerAlarmService.getAlarmNum().getData(); |
| | | //一体 统计:电池统计 分为品牌和标称电压 |
| | | List<Battinf> battinfList = battInfService.getBattGroupList(userId); |
| | | Map<String, List<Battinf>> battProducerMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getBattProducer)); |
| | | Map<Float, List<Battinf>> battMonVolStdMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getMonVolStd)); |
| | | Map<String,Object> battGroupInfoMap = new HashMap<>(); |
| | | for(String producer : battGroupInfoMap.keySet()){ |
| | | Response res_devAlarmNum = new Response(); |
| | | Map<String, Integer> devAlarmNumMap = new HashMap<>(); |
| | | try { |
| | | int battAlarmNum = battAlarmDataService.serchRealTime(userId).getCode(); |
| | | int devAlarmNum = devAlarmDataService.getAlarmNum(userId); |
| | | int powerAlarmNum = (int) powerAlarmService.getAlarmNum().getData(); |
| | | devAlarmNumMap.put("battAlarmNum",battAlarmNum); |
| | | devAlarmNumMap.put("devAlarmNum",devAlarmNum); |
| | | devAlarmNumMap.put("powerAlarmNum",powerAlarmNum); |
| | | res_devAlarmNum.setII(1,true,devAlarmNumMap,null); |
| | | }catch (Exception e){ |
| | | res_devAlarmNum.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | |
| | | //一体 统计:电池统计 分为品牌和标称电压 |
| | | Response res_battGroupInfo = new Response(); |
| | | try { |
| | | List<Battinf> battinfList = battInfService.getBattGroupList(userId); |
| | | Map<String, List<Battinf>> battProducerMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getBattProducer)); |
| | | Map<Float, List<Battinf>> battMonVolStdMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getMonVolStd)); |
| | | Map<String, Object> battGroupInfoMap = new HashMap<>(); |
| | | for (String producer : battProducerMap.keySet()) { |
| | | battGroupInfoMap.put(producer, battProducerMap.get(producer).size()); |
| | | } |
| | | for (Float monVolStd : battMonVolStdMap.keySet()) { |
| | | battGroupInfoMap.put(Float.toString(monVolStd), battMonVolStdMap.get(monVolStd).size()); |
| | | } |
| | | res_battGroupInfo.setII(1,true,battGroupInfoMap,null); |
| | | }catch (Exception e){ |
| | | res_battGroupInfo.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | |
| | | //一体 统计:设备状态 |
| | | Response<Map> res_devStates = fbs9100StateService.getBTSEquipStatus(userId); |
| | | //一体 统计:各种设备类型总数 电池 设备 电源 站点 |
| | | Response<Map> res_devCountMap = battInfService.getDevCountMap(userId); |
| | | //续航检测??? TODO |
| | | |
| | | //续航检测:按照电池组为单位进行检测,告警判定:实际容量/标称容量<=某个百分比 TODO 续航表中读取需要询问李军确认 |
| | | Response res_capAlarmNum = new Response(); |
| | | try { |
| | | int capAlarmNum = battInfService.getCapAlarmNum(userId); |
| | | res_capAlarmNum.setII(1,true,capAlarmNum,null); |
| | | }catch (Exception e){ |
| | | res_capAlarmNum.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | |
| | | res.put("acABC", res_acABC); |
| | | res.put("monCapacityLowAnalysis", res_monCapacityLowAnalysis); |
| | | res.put("monVRTAnalysis", res_monVRTAnalysis); |
| | | res.put("devAlarmNum", res_devAlarmNum); |
| | | res.put("battGroupInfo", res_battGroupInfo); |
| | | res.put("devStates", res_devStates); |
| | | res.put("devCountMap", res_devCountMap); |
| | | res.put("capAlarmNum", res_capAlarmNum); |
| | | session.getBasicRemote().sendObject(new Response().set(1, res)); |
| | | sleep(4000); |
| | | } |