whycxzp
2024-03-07 2cb95a87ab7f14fdfeefd1e079307e47d011a317
src/main/java/com/whyc/webSocket/ScreenForNWKMSocket.java
@@ -46,6 +46,8 @@
    private static BaoJiGroupService baoJiGroupService;
    private static StationInfService stationService;
    @Autowired
    public void setPowerAlarmService(PwrdevAlarmService powerAlarmService) {
        ScreenForNWKMSocket.powerAlarmService = powerAlarmService;
@@ -74,6 +76,11 @@
    @Autowired
    public void setBaoJiGroupService(BaoJiGroupService baoJiGroupService) {
        ScreenForNWKMSocket.baoJiGroupService = baoJiGroupService;
    }
    @Autowired
    public void setStationService(StationInfService stationService) {
        ScreenForNWKMSocket.stationService = stationService;
    }
    @OnOpen
@@ -138,32 +145,27 @@
                            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();
                            //6.统计:实时告警 跟告警统计逻辑一致
                            Response res_alarm = 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);
                                Response realAlarmList = battAlarmDataService.getRealAlarmListWithLevel1(userId);
                                res_alarm.setII(1,true,realAlarmList,null);
                            }catch (Exception e){
                                res_devAlarmNum.set(1,false,"发生异常:"+e.getCause());
                                res_alarm.set(1,false,"发生异常:"+e.getCause());
                            }
                            res.put("devAlarmNum", res_devAlarmNum);
                            res.put("res_alarm", res_alarm);
                            latch.countDown();
                        });
                        poolExecutor.execute(()->{
                            //7.统计:TODO 资产统计
                            //7.统计:TODO 电源统计
                            Response res_asset = new Response();
                            try {
@@ -174,7 +176,7 @@
                            latch.countDown();
                        });
                        poolExecutor.execute(()->{
                            //8.统计:能效统计
                            //8.统计:TODO 能效统计
                            Response resNX = new Response();
                            Map<String, Integer> devAlarmNumMap = new HashMap<>();
                            try {