whycxzp
2025-02-28 78bdbf03741d03e047d034a1418a240e10b75c9f
src/main/java/com/whyc/webSocket/ScreenForSZSocket.java
@@ -104,9 +104,9 @@
    public void onOpen(Session session, EndpointConfig config){
        this.session = session;
        HttpSession httpSession = (HttpSession) config.getUserProperties().get("httpSession");
        UserInf user = (UserInf) httpSession.getAttribute("user");
        final int userId = user.getUId().intValue();
        //final int userId = 1001;
        //UserInf user = (UserInf) httpSession.getAttribute("user");
        //final int userId = user.getUId().intValue();
        final int userId = 1001;
        Thread thread = new Thread() {
            @Override
            public void run() {
@@ -114,7 +114,7 @@
                    Map<String, Object> res = new HashMap<>();
                    while (!currentThread().isInterrupted()) {
                        ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor();
                        CountDownLatch latch = new CountDownLatch(8);
                        CountDownLatch latch = new CountDownLatch(5);
                        /*poolExecutor.execute(()->{
                            //1.统计:电池统计 分为品牌和标称电压
                            Response res_battGroupInfo = new Response();
@@ -205,17 +205,16 @@
                            latch.countDown();
                        });*/
                        poolExecutor.execute(()->{
                            //9-1.统计:区县(StationName5)的 告警统计 级别及类型统计 TODO
                            //9-1.统计:区县(StationName5)的 告警统计 级别及类型统计
                            //查询出所有的区县,并按照区县来进行告警的分类统计
                            Response res_alarmLevel = new Response();
                            Map<String, Integer> devAlarmNumMap = new HashMap<>();
                            try {
                                Response alarmsCountByLevel = battAlarmDataService.getByLevel(userId);
                                Response alarmsCountByLevel = battAlarmDataService.getByLevelAndStationName5(userId);
                                res_alarmLevel.setII(1,true,alarmsCountByLevel,null);
                            }catch (Exception e){
                                res_alarmLevel.set(1,false,"发生异常:"+e.getCause());
                            }
                            res.put("alarmsLevel", res_alarmLevel);
                            res.put("alarmsLevelWithStationName5", res_alarmLevel);
                            latch.countDown();
                        });
                        poolExecutor.execute(()->{