无关风月
5 天以前 c785652a9fc4524ad1801adf0f7b44dd0892f2c4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/WorkbenchesController.java
@@ -115,12 +115,21 @@
            if (deptType == 1) {
                // 查询片区
                TProjectDept projectDept = projectDeptService.getById(deptId);
                // 查询项目部
                TProjectDept parent = projectDeptService.getById(projectDept.getParentId());
                List<TProjectDept> children = new ArrayList<>();
                children.add(projectDept);
                parent.setChildren(children);
                projectDeptList.add(parent);
                if("0".equals(projectDept.getParentId())){
                    // 查询项目部
                    List<TProjectDept> childProjectDept = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .eq(TProjectDept::getStatus,1)
                            .eq(TProjectDept::getParentId,projectDept.getId()));
                    projectDept.setChildren(childProjectDept);
                    projectDeptList.add(projectDept);
                }else {
                    // 查询项目部
                    TProjectDept parent = projectDeptService.getById(projectDept.getParentId());
                    List<TProjectDept> children = new ArrayList<>();
                    children.add(projectDept);
                    parent.setChildren(children);
                    projectDeptList.add(parent);
                }
            }else {
                projectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus,1)
@@ -180,8 +189,17 @@
            if (deptType == 1) {
                // 项目部人员
                if(CollectionUtils.isEmpty(query.getProjectId())){
                    TProjectDept projectDept = projectDeptService.getById(deptId);
                    List<String> projectIds = new ArrayList<>();
                    projectIds.add(deptId);
                    if("0".equals(projectDept.getParentId())){
                        List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getStatus, 1)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                        List<String> ids = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        projectIds.addAll(ids);
                    }else {
                        projectIds.add(deptId);
                    }
                    query.setProjectId(projectIds);
                }
            }else {
@@ -203,6 +221,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
                // 查询点位数
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
@@ -218,6 +237,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
        }else {
            // 超级管理员
            // 查询点位类型
@@ -246,6 +266,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getProjectId, query.getProjectId()));
@@ -260,6 +281,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
        }
        // 查询任务相关数据
@@ -336,8 +358,17 @@
            if (deptType == 1) {
                // 项目部人员
                if(CollectionUtils.isEmpty(query.getProjectId())){
                    TProjectDept projectDept = projectDeptService.getById(deptId);
                    List<String> projectIds = new ArrayList<>();
                    projectIds.add(deptId);
                    if("0".equals(projectDept.getParentId())){
                        List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getStatus, 1)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                        List<String> ids = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        projectIds.addAll(ids);
                    }else {
                        projectIds.add(deptId);
                    }
                    query.setProjectId(projectIds);
                }
            }else {
@@ -360,6 +391,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -371,6 +403,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
        }else {
            // 超级管理员
            // 查询点位类型
@@ -399,6 +432,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -410,6 +444,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
        }
        // 任务总数
        taskSituationVO.setTotalTaskNum(list.size());
@@ -510,8 +545,17 @@
            if (deptType == 1) {
                // 项目部人员
                if(CollectionUtils.isEmpty(query.getProjectId())){
                    TProjectDept projectDept = projectDeptService.getById(deptId);
                    List<String> projectIds = new ArrayList<>();
                    projectIds.add(deptId);
                    if("0".equals(projectDept.getParentId())){
                        List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getStatus, 1)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                        List<String> ids = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        projectIds.addAll(ids);
                    }else {
                        projectIds.add(deptId);
                    }
                    query.setProjectId(projectIds);
                }
            }else {
@@ -534,6 +578,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -545,6 +590,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> result = list.stream().filter(task -> task.getStatus() == 2).collect(Collectors.toList());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
@@ -603,6 +649,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -614,6 +661,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> result = list.stream().filter(task -> task.getStatus() == 2).collect(Collectors.toList());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
@@ -673,8 +721,17 @@
            if (deptType == 1) {
                // 项目部人员
                if(CollectionUtils.isEmpty(query.getProjectId())){
                    TProjectDept projectDept = projectDeptService.getById(deptId);
                    List<String> projectIds = new ArrayList<>();
                    projectIds.add(deptId);
                    if("0".equals(projectDept.getParentId())){
                        List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getStatus, 1)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                        List<String> ids = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        projectIds.addAll(ids);
                    }else {
                        projectIds.add(deptId);
                    }
                    query.setProjectId(projectIds);
                }
            }else {
@@ -696,6 +753,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -707,6 +765,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> result = list.stream().filter(task -> task.getStatus() == 3).collect(Collectors.toList());
            for (TTask task : result) {
                TLocation tLocation = locations.stream().filter(location -> location.getId().equals(task.getLocationId())).findFirst().orElse(null);
@@ -742,6 +801,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -753,6 +813,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> result = list.stream().filter(task -> task.getStatus() == 3).collect(Collectors.toList());
            for (TTask task : result) {
                TLocation tLocation = locations.stream().filter(location -> location.getId().equals(task.getLocationId())).findFirst().orElse(null);
@@ -787,8 +848,17 @@
            if (deptType == 1) {
                // 项目部人员
                if(CollectionUtils.isEmpty(query.getProjectId())){
                    TProjectDept projectDept = projectDeptService.getById(deptId);
                    List<String> projectIds = new ArrayList<>();
                    projectIds.add(deptId);
                    if("0".equals(projectDept.getParentId())){
                        List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getStatus, 1)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                        List<String> ids = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        projectIds.addAll(ids);
                    }else {
                        projectIds.add(deptId);
                    }
                    query.setProjectId(projectIds);
                }
            }else {
@@ -810,6 +880,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -821,6 +892,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                map.put("unqualifiedWarn", 0);
@@ -876,6 +948,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -887,6 +960,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                map.put("unqualifiedWarn", 0);
@@ -942,8 +1016,17 @@
            if (deptType == 1) {
                // 项目部人员
                if(CollectionUtils.isEmpty(query.getProjectId())){
                    TProjectDept projectDept = projectDeptService.getById(deptId);
                    List<String> projectIds = new ArrayList<>();
                    projectIds.add(deptId);
                    if("0".equals(projectDept.getParentId())){
                        List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getStatus, 1)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                        List<String> ids = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        projectIds.addAll(ids);
                    }else {
                        projectIds.add(deptId);
                    }
                    query.setProjectId(projectIds);
                }
            }else {
@@ -965,6 +1048,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -976,7 +1060,7 @@
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                return R.ok();
@@ -985,6 +1069,7 @@
            List<TTaskDetail> taskDetails = tTaskDetailService.list(Wrappers.lambdaQuery(TTaskDetail.class)
                    .in(TTaskDetail::getTaskId, taskIds)
                    .eq(TTaskDetail::getClearStatus, 2)
                    .eq(TTaskDetail::getHandleType,1)
                    .orderByDesc(TTaskDetail::getCreateTime));
            List<TTaskDetail> taskDetailList = new ArrayList<>();
            for (TTask task : list) {
@@ -1000,7 +1085,7 @@
                    .eq(TDictData::getDataType, 2));
            List<AnalysisUnqualifiedCleaningDetailVO> analysisUnqualifiedCleaningDetailVOS = new ArrayList<>();
            for (TDictData tDictData : dictDataList) {
                List<TTaskDetail> tTaskDetails = taskDetailList.stream().filter(taskDetail -> taskDetail.getUnqualified().equals(tDictData.getId())).collect(Collectors.toList());
                List<TTaskDetail> tTaskDetails = taskDetailList.stream().filter(taskDetail -> StringUtils.isNotEmpty(taskDetail.getUnqualified())&&taskDetail.getUnqualified().equals(tDictData.getId())).collect(Collectors.toList());
                AnalysisUnqualifiedCleaningDetailVO analysisUnqualifiedCleaningDetailVO = new AnalysisUnqualifiedCleaningDetailVO();
                analysisUnqualifiedCleaningDetailVO.setUnqualifiedName(tDictData.getDataContent());
                analysisUnqualifiedCleaningDetailVO.setCount(tTaskDetails.size());
@@ -1034,6 +1119,7 @@
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList()));
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
@@ -1046,6 +1132,8 @@
                list.addAll(taskList);
            }
            list = list.stream().distinct().collect(Collectors.toList());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                return R.ok();
@@ -1053,6 +1141,7 @@
            List<String> taskIds = tasks.stream().map(TTask::getId).collect(Collectors.toList());
            List<TTaskDetail> taskDetails = tTaskDetailService.list(Wrappers.lambdaQuery(TTaskDetail.class)
                    .in(TTaskDetail::getTaskId, taskIds)
                    .eq(TTaskDetail::getHandleType,1)
                    .eq(TTaskDetail::getClearStatus, 2)
                    .orderByDesc(TTaskDetail::getCreateTime));
            List<TTaskDetail> taskDetailList = new ArrayList<>();
@@ -1069,7 +1158,7 @@
                    .eq(TDictData::getDataType, 2));
            List<AnalysisUnqualifiedCleaningDetailVO> analysisUnqualifiedCleaningDetailVOS = new ArrayList<>();
            for (TDictData tDictData : dictDataList) {
                List<TTaskDetail> tTaskDetails = taskDetailList.stream().filter(taskDetail -> taskDetail.getUnqualified().equals(tDictData.getId())).collect(Collectors.toList());
                List<TTaskDetail> tTaskDetails = taskDetailList.stream().filter(taskDetail -> StringUtils.isNotEmpty(taskDetail.getUnqualified())&&taskDetail.getUnqualified().equals(tDictData.getId())).collect(Collectors.toList());
                AnalysisUnqualifiedCleaningDetailVO analysisUnqualifiedCleaningDetailVO = new AnalysisUnqualifiedCleaningDetailVO();
                analysisUnqualifiedCleaningDetailVO.setUnqualifiedName(tDictData.getDataContent());
                analysisUnqualifiedCleaningDetailVO.setCount(tTaskDetails.size());