From 3f2f6df1e2b5be220b379348c3c0594a00133857 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期二, 01 七月 2025 16:54:21 +0800 Subject: [PATCH] 工作台 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java | 83 +++++++++++++++++++++++------------------ 1 files changed, 47 insertions(+), 36 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java index bee8d01..81a2230 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java @@ -107,17 +107,18 @@ @ApiOperation(value = "通过片区id查询点位类型") @GetMapping(value = "/queryLocationByProjectId") - public R<List<TLocationType>> queryLocationByProjectId(@RequestParam(value = "projectId") String projectId) { - List<TLocationType> locationTypes = new ArrayList<>(); - // 通过片区id查询点位 - List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class) - .eq(TLocation::getProjectId, projectId)); - if(CollectionUtils.isEmpty(locationList)){ - return R.ok(locationTypes); - } - List<String> typeIds = locationList.stream().map(TLocation::getLocationType).collect(Collectors.toList()); - locationTypes = locationTypeService.list(Wrappers.lambdaQuery(TLocationType.class) - .in(TLocationType::getId, typeIds)); + public R<List<TLocationType>> queryLocationByProjectId() { +// List<TLocationType> locationTypes = new ArrayList<>(); +// // 通过片区id查询点位 +// List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class) +// .eq(TLocation::getProjectId, projectId)); +// if(CollectionUtils.isEmpty(locationList)){ +// return R.ok(locationTypes); +// } +// List<String> typeIds = locationList.stream().map(TLocation::getLocationType).collect(Collectors.toList()); +// locationTypes = locationTypeService.list(Wrappers.lambdaQuery(TLocationType.class) +// .in(TLocationType::getId, typeIds)); + List<TLocationType> locationTypes = locationTypeService.list(); return R.ok(locationTypes); } @@ -148,9 +149,11 @@ List<TTask> taskList = new ArrayList<>(); if (deptType == 1) { // 项目部人员 - List<String> projectIds = new ArrayList<>(); - projectIds.add(deptId); - query.setProjectId(projectIds); + if(CollectionUtils.isEmpty(query.getProjectId())){ + List<String> projectIds = new ArrayList<>(); + projectIds.add(deptId); + query.setProjectId(projectIds); + } }else { // 公司人员 // 查询自己的任务列表 @@ -164,7 +167,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } } } @@ -209,7 +212,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } } @@ -257,9 +260,11 @@ } if (deptType == 1) { // 项目部人员 - List<String> projectIds = new ArrayList<>(); - projectIds.add(deptId); - query.setProjectId(projectIds); + if(CollectionUtils.isEmpty(query.getProjectId())){ + List<String> projectIds = new ArrayList<>(); + projectIds.add(deptId); + query.setProjectId(projectIds); + } }else { if(CollectionUtils.isEmpty(query.getProjectId())) { // 查询所有项目部的任务列表 @@ -367,9 +372,11 @@ List<TTask> taskList = new ArrayList<>(); if (deptType == 1) { // 项目部人员 - List<String> projectIds = new ArrayList<>(); - projectIds.add(deptId); - query.setProjectId(projectIds); + if(CollectionUtils.isEmpty(query.getProjectId())){ + List<String> projectIds = new ArrayList<>(); + projectIds.add(deptId); + query.setProjectId(projectIds); + } }else { // 公司人员 // 查询自己的任务列表 @@ -382,7 +389,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } } } @@ -414,7 +421,7 @@ for (TTask task : list) { TTaskDetail tTaskDetail = taskDetails.stream().filter(taskDetail -> taskDetail.getTaskId().equals(task.getId())).findFirst().orElse(null); if(Objects.nonNull(tTaskDetail)){ - if(tTaskDetail.getClearStatus() == 2){ + if(Objects.nonNull(tTaskDetail.getClearStatus()) && tTaskDetail.getClearStatus() == 2){ unqualifiedWarn++; } } @@ -441,7 +448,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } } @@ -472,7 +479,7 @@ for (TTask task : list) { TTaskDetail tTaskDetail = taskDetails.stream().filter(taskDetail -> taskDetail.getTaskId().equals(task.getId())).findFirst().orElse(null); if(Objects.nonNull(tTaskDetail)){ - if(tTaskDetail.getClearStatus() == 2){ + if(Objects.nonNull(tTaskDetail.getClearStatus()) && tTaskDetail.getClearStatus() == 2){ unqualifiedWarn++; } } @@ -504,9 +511,11 @@ List<TTask> taskList = new ArrayList<>(); if (deptType == 1) { // 项目部人员 - List<String> projectIds = new ArrayList<>(); - projectIds.add(deptId); - query.setProjectId(projectIds); + if(CollectionUtils.isEmpty(query.getProjectId())){ + List<String> projectIds = new ArrayList<>(); + projectIds.add(deptId); + query.setProjectId(projectIds); + } }else { // 公司人员 // 查询自己的任务列表 @@ -519,7 +528,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } } } @@ -589,7 +598,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } } @@ -691,9 +700,11 @@ } if (deptType == 1) { // 项目部人员 - List<String> projectIds = new ArrayList<>(); - projectIds.add(deptId); - query.setProjectId(projectIds); + if(CollectionUtils.isEmpty(query.getProjectId())){ + List<String> projectIds = new ArrayList<>(); + projectIds.add(deptId); + query.setProjectId(projectIds); + } }else { // 公司人员 // 查询自己的任务列表 @@ -706,7 +717,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } if(query.getRankType() == 1){ // 查询所有项目部的人员 @@ -838,7 +849,7 @@ .ne(TProjectDept::getParentId, 0)); if(!CollectionUtils.isEmpty(tProjectDeptList)){ List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList()); - wrapper.in(TTask::getProjectId, projectIds); + query.setProjectId(projectIds); } if(query.getRankType() == 1){ // 查询所有项目部的人员 -- Gitblit v1.7.1