From fbff8d87d3e4c7a99725bfc25d8e616bdb373d46 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 03 七月 2025 23:41:39 +0800 Subject: [PATCH] bug修改 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java | 107 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 92 insertions(+), 15 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 6c9655d..347c13e 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 @@ -77,12 +77,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) @@ -153,8 +162,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 { @@ -264,8 +282,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 { @@ -337,6 +364,9 @@ // 查询片区 List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class) .in(TLocation::getProjectId, query.getProjectId())); + if (locationList.isEmpty()){ + return R.ok(map); + } List<String> locationTypeList = locationList.stream().map(TLocation::getLocationType).distinct().collect(Collectors.toList()); List<TLocationType> locationTypes = locationTypeService.list(Wrappers.lambdaQuery(TLocationType.class) .in(TLocationType::getId, locationTypeList)); @@ -376,8 +406,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 { @@ -515,8 +554,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 { @@ -558,6 +606,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) { @@ -573,7 +622,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()); @@ -626,6 +675,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<>(); @@ -642,7 +692,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()); @@ -704,8 +754,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 { @@ -991,8 +1050,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 { @@ -1138,8 +1206,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 { -- Gitblit v1.7.1