lxw
2023-05-19 b2a6afe40aa6b50d686ef247c30a9a8cfc368071
管理员任务websocket修改
1个文件已修改
29 ■■■■ 已修改文件
src/main/java/com/whyc/webSocket/TaskManageAdminWebsocket.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/TaskManageAdminWebsocket.java
@@ -2,7 +2,6 @@
import com.whyc.config.WebSocketConfig;
import com.whyc.dto.Response;
import com.whyc.factory.ThreadPoolExecutorFactory;
import com.whyc.pojo.FaultUpload;
import com.whyc.pojo.UserInf;
import com.whyc.service.FaultUploadService;
@@ -15,9 +14,6 @@
import javax.websocket.server.ServerEndpoint;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Component
@ServerEndpoint(value = "/taskMAdmin", encoders = WebSocketEncoder.class, configurator = WebSocketConfig.class)
@@ -93,6 +89,29 @@
    //获取管理员的数据
    public Map getTaskMAdmin(int userId, FaultUpload upload) {
        Map<String, Object> res = new HashMap<>();
        //本月
        Response monRes = faultUploadService.groupNameCount(1, userId);
        res.put("monRes", monRes);
        //本季度
        Response quarterRes = faultUploadService.groupNameCount(2, userId);
        res.put("quarterRes", quarterRes);
        //本年
        Response yearRes = faultUploadService.groupNameCount(3, userId);
        res.put("yearRes", yearRes);
        //隐患故障上报进度-最近一周及最近一月-管理
        Response lastPeriodRes = faultUploadService.getListOfLastPeriod(1, userId);
        res.put("lastPeriodRes", lastPeriodRes);
        //列表分页-管理
        Response listRes = faultUploadService.listPage2(upload.getPageNum(), upload.getPageSize(), upload, userId);
        res.put("listRes", listRes);
        return res;
    }
   /* //获取管理员的数据
    public Map getTaskMAdmin(int userId, FaultUpload upload) {
        Map<String, Object> res = new HashMap<>();
        try {
            ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor();
            CountDownLatch latch = new CountDownLatch(3);
@@ -125,7 +144,7 @@
            e.printStackTrace();
        }
        return res;
    }
    }*/
    @OnClose
    public void onClose(CloseReason closeReason) {