whyclxw
2025-03-25 a7fef2846505b08e0711345b17902e7381612d23
src/main/java/com/whyc/webSocket/HomeSocket.java
@@ -45,12 +45,12 @@
    @OnOpen
    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();
        //final int urole = user.getUrole();
        final int userId = 10001;
        final int urole = 1;
        HttpSession httpSession = (HttpSession) config.getUserProperties().get("httpSession");
        UserInf user = (UserInf) httpSession.getAttribute("user");
        final int userId = user.getUid();
        final int urole = user.getUrole();
        /*final int userId = 10001;
        final int urole = 1;*/
        Thread thread = new Thread("Thread_HomeSocket") {
            @Override
            public void run() {
@@ -76,7 +76,7 @@
        Map<String, Object> res = new HashMap<>();
        try {
            ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor();
            CountDownLatch latch = new CountDownLatch(5);
            CountDownLatch latch = new CountDownLatch(6);
            poolExecutor.execute(() -> {
                //锁的工作状态
                Response resLockState = ainfService.getLockState(userId,urole);
@@ -107,6 +107,12 @@
                res.put("resAllCtlLog", resAllCtlLog);
                latch.countDown();
            });
            poolExecutor.execute(() -> {
                //地图顶部的管理的区域包含子区域
                Response resAllAinf = ainfService.getHomeAllAinf(userId,urole);
                res.put("resAllAinf", resAllAinf);
                latch.countDown();
            });
            latch.await(4, TimeUnit.MINUTES);
        } catch (InterruptedException e) {
            e.printStackTrace();