| | |
| | | |
| | | private static BattEnduranceService battEnduranceService; |
| | | |
| | | private static BaoJiGroupService baoJiGroupService; |
| | | private static StationInfService stationService; |
| | | |
| | | private static PowerInfService powerInfService; |
| | | |
| | | //private static BatttestdataInfService testInfService; |
| | | |
| | | private static BatttestdataInfService batttestdataInfService; |
| | | |
| | | private static BattRtstateService battRtStateService; |
| | | |
| | | @Autowired |
| | | public void setPowerAlarmService(PwrdevAlarmService powerAlarmService) { |
| | |
| | | public void setBattEnduranceService(BattEnduranceService battEnduranceService) { |
| | | ScreenForNWKMSocket.battEnduranceService = battEnduranceService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setBaoJiGroupService(BaoJiGroupService baoJiGroupService) { |
| | | ScreenForNWKMSocket.baoJiGroupService = baoJiGroupService; |
| | | public void setStationService(StationInfService stationService) { |
| | | ScreenForNWKMSocket.stationService = stationService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setPowerInfService(PowerInfService powerInfService) { |
| | | ScreenForNWKMSocket.powerInfService = powerInfService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setBatttestdataInfService(BatttestdataInfService batttestdataInfService) { |
| | | ScreenForNWKMSocket.batttestdataInfService = batttestdataInfService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setBattRtStateService(BattRtstateService battRtStateService) { |
| | | ScreenForNWKMSocket.battRtStateService = battRtStateService; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | Map<String, Object> res = new HashMap<>(); |
| | | while (!currentThread().isInterrupted()) { |
| | | ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(9); |
| | | CountDownLatch latch = new CountDownLatch(8); |
| | | poolExecutor.execute(()->{ |
| | | //1.统计:电池统计 分为品牌和标称电压 |
| | | Response res_battGroupInfo = new Response(); |
| | |
| | | }); |
| | | poolExecutor.execute(()->{ |
| | | //2.统计:设备状态 |
| | | Response<Map> res_devStates = fbs9100StateService.getBTSEquipStatus2(userId); |
| | | Response<Map> res_devStates = fbs9100StateService.getBTSEquipStatus2(userId,2); |
| | | res.put("devStates", res_devStates); |
| | | latch.countDown(); |
| | | }); |
| | |
| | | latch.countDown(); |
| | | }); |
| | | |
| | | //5.统计:TODO 每个省的机房数统计 |
| | | /*//5.统计:每个省的机房数统计 |
| | | poolExecutor.execute(()->{ |
| | | Response res_stationCount = null; |
| | | Response res_stationCount = stationService.getProvinceCountMap(userId); |
| | | res.put("stationCount", res_stationCount); |
| | | latch.countDown(); |
| | | }); |
| | | });*/ |
| | | poolExecutor.execute(()->{ |
| | | //6.统计:TODO 实时告警 |
| | | Response res_devAlarmNum = new Response(); |
| | | Map<String, Integer> devAlarmNumMap = new HashMap<>(); |
| | | try { |
| | | int battAlarmNum = battAlarmDataService.getRealTimeWithLevel1(userId).getCode(); |
| | | int devAlarmNum = devAlarmDataService.getRealTimeWithLevel1(userId); |
| | | int powerAlarmNum = powerAlarmService.getRealTimeWithLevel1(userId); |
| | | 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()); |
| | | } |
| | | res.put("devAlarmNum", res_devAlarmNum); |
| | | //6.统计:实时放电信息 正在放电的电池信息展示 |
| | | Response dischargingList = battRtStateService.getDischargingList(userId); |
| | | res.put("dischargingBattery", dischargingList); |
| | | latch.countDown(); |
| | | }); |
| | | poolExecutor.execute(()->{ |
| | | //7.统计:TODO 资产统计 |
| | | Response res_asset = new Response(); |
| | | //7.统计:电源统计 |
| | | Response res_powerProducer = new Response(); |
| | | try { |
| | | |
| | | Response producersCount = powerInfService.getProducerCount(userId); |
| | | res_powerProducer.setII(1,true,producersCount,null); |
| | | }catch (Exception e){ |
| | | res_asset.set(1,false,"发生异常:"+e.getCause()); |
| | | res_powerProducer.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | res.put("asset", res_asset); |
| | | res.put("powerProducerCount", res_powerProducer); |
| | | latch.countDown(); |
| | | }); |
| | | poolExecutor.execute(()->{ |
| | | //8.统计:能效统计 |
| | | /*//8.统计:能效统计,默认取五年的能效 |
| | | Response resNX = new Response(); |
| | | Map<String, Integer> devAlarmNumMap = new HashMap<>(); |
| | | try { |
| | | |
| | | resNX=testInfService.getEnergyStatistics_nj(5,userId); |
| | | }catch (Exception e){ |
| | | resNX.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | res.put("nx", resNX); |
| | | res.put("nx", resNX);*/ |
| | | //测试信息 |
| | | Response resTestdataInfAnalysis = new Response(); |
| | | try { |
| | | resTestdataInfAnalysis = batttestdataInfService.getTestdataInfAnalysis(userId); |
| | | }catch (Exception e){ |
| | | resTestdataInfAnalysis.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | res.put("resTestdataInfAnalysis", resTestdataInfAnalysis); |
| | | latch.countDown(); |
| | | }); |
| | | poolExecutor.execute(()->{ |
| | | /*poolExecutor.execute(()->{ |
| | | //9.统计:告警统计 电源,设备,电池 |
| | | Response res_devAlarmNum = new Response(); |
| | | Map<String, Integer> devAlarmNumMap = new HashMap<>(); |
| | |
| | | } |
| | | res.put("devAlarmNum", res_devAlarmNum); |
| | | latch.countDown(); |
| | | });*/ |
| | | poolExecutor.execute(()->{ |
| | | //9-2.统计:告警统计 级别及类型统计 |
| | | Response res_alarmLevel = new Response(); |
| | | Map<String, Integer> devAlarmNumMap = new HashMap<>(); |
| | | try { |
| | | Response alarmsCountByLevel = battAlarmDataService.getByLevel(userId); |
| | | res_alarmLevel.setII(1,true,alarmsCountByLevel,null); |
| | | }catch (Exception e){ |
| | | res_alarmLevel.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | res.put("alarmsLevel", res_alarmLevel); |
| | | latch.countDown(); |
| | | }); |
| | | |
| | | latch.await(10, TimeUnit.MINUTES); |