xuhy
2025-07-01 dfc3e4b2dd3b648032d0a57688766bf9404cdda3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java
@@ -19,6 +19,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -67,7 +68,9 @@
    public R<List<TProjectDept>> queryProject() {
        Integer deptType = tokenService.getLoginUser().getUser().getDeptType();
        String deptId = tokenService.getLoginUser().getUser().getDeptId();
        Long userId = tokenService.getLoginUser().getUserId();
        List<TProjectDept> projectDeptList = new ArrayList<>();
        if(userId != 1L){
        if (deptType == 1) {
            // 查询片区
            TProjectDept projectDept = projectDeptService.getById(deptId);
@@ -75,7 +78,7 @@
            TProjectDept parent = projectDeptService.getById(projectDept.getParentId());
            List<TProjectDept> children = new ArrayList<>();
            children.add(projectDept);
//            parent.setChildren(children);
                parent.setChildren(children);
            projectDeptList.add(parent);
        }else {
            projectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
@@ -85,7 +88,18 @@
            projectDeptList.forEach(projectDept -> {
                List<TProjectDept> children = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getParentId, projectDept.getId()));
//                projectDept.setChildren(children);
                    projectDept.setChildren(children);
                });
            }
        }else {
            projectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                    .eq(TProjectDept::getStatus,1)
                    .eq(TProjectDept::getParentId,0));
            // 查询片区
            projectDeptList.forEach(projectDept -> {
                List<TProjectDept> children = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getParentId, projectDept.getId()));
                projectDept.setChildren(children);
            });
        }
        return R.ok(projectDeptList);
@@ -115,13 +129,12 @@
        String deptId = tokenService.getLoginUser().getUser().getDeptId();
        Long userId = tokenService.getLoginUser().getUserId();
        String startTime = LocalDate.now() + " 00:00:00";
        String endTime = LocalDate.now() + " 23:59:59";
        LambdaQueryWrapper<TTask> wrapper = new LambdaQueryWrapper<>();
        String startTime = LocalDate.now() + " 00:00:00";
        String endTime = LocalDate.now() + " 23:59:59";
        wrapper.between(TTask::getImplementTime, startTime, endTime);
        if(userId != 1L){
        // 查询点位类型
        if(StringUtils.isNotEmpty(query.getLocationTypeId())){
            // 查询点位
@@ -174,6 +187,51 @@
        map.put("taskUnExecutedCount", list.stream().filter(task -> task.getStatus() == 1).count());
        map.put("taskPendingCount", list.stream().filter(task -> task.getStatus() == 3).count());
        map.put("taskFinishCount", list.stream().filter(task -> task.getStatus() == 6).count());
        }else {
            // 超级管理员
            // 查询点位类型
            if(StringUtils.isNotEmpty(query.getLocationTypeId())){
                // 查询点位
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getLocationType, query.getLocationTypeId()));
                if(!CollectionUtils.isEmpty(locationList)){
                    List<String> locationIds = locationList.stream().map(TLocation::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getLocationId, locationIds);
                }
            }
            // 超级管理员 查询所有任务列表
            List<TTask> taskList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class)
                    .between(TTask::getImplementTime, startTime, endTime));
            if(CollectionUtils.isEmpty(query.getProjectId())){
                // 查询所有项目部的任务列表
                List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus, 1)
                        .ne(TProjectDept::getParentId, 0));
                if(!CollectionUtils.isEmpty(tProjectDeptList)){
                    List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getProjectId, projectIds);
                }
            }
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
            List<TTask> list = taskCleanService.list(wrapper);
            if(CollectionUtils.isEmpty(list)){
                return R.ok(map);
            }
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            map.put("taskCount", list.size());
            map.put("taskUnExecutedCount", list.stream().filter(task -> task.getStatus() == 1).count());
            map.put("taskPendingCount", list.stream().filter(task -> task.getStatus() == 3).count());
            map.put("taskFinishCount", list.stream().filter(task -> task.getStatus() == 6).count());
        }
        return R.ok(map);
    }
@@ -184,7 +242,9 @@
        Map<String, Object> map = new HashMap<>();
        Integer deptType = tokenService.getLoginUser().getUser().getDeptType();
        String deptId = tokenService.getLoginUser().getUser().getDeptId();
        Long userId = tokenService.getLoginUser().getUserId();
        if(userId != 1L){
        // 查询点位类型
        if(StringUtils.isNotEmpty(query.getLocationTypeId())){
            // 查询点位
@@ -225,7 +285,7 @@
        // 查询片区
        if(!CollectionUtils.isEmpty(query.getProjectId())){
            List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                    .eq(TLocation::getProjectId, query.getProjectId()));
                        .in(TLocation::getProjectId, query.getProjectId()));
            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));
@@ -235,6 +295,51 @@
            }
            return R.ok(map);
        }
        }else {
            // 超级管理员
            // 查询点位类型
            if(StringUtils.isNotEmpty(query.getLocationTypeId())){
                // 查询点位
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getLocationType, query.getLocationTypeId()));
                // 查询类型
                TLocationType locationType = locationTypeService.getById(query.getLocationTypeId());
                map.put(locationType.getLocationName(), locationList.size());
                return R.ok(map);
            }
            if(CollectionUtils.isEmpty(query.getProjectId())) {
                // 查询所有项目部的任务列表
                List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus, 1)
                        .ne(TProjectDept::getParentId, 0));
                if (!CollectionUtils.isEmpty(tProjectDeptList)) {
                    List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                            .in(TLocation::getProjectId, projectIds));
                    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));
                    for (TLocationType locationType : locationTypes) {
                        List<TLocation> locationList1 = locationList.stream().filter(location -> location.getLocationType().equals(locationType.getId())).collect(Collectors.toList());
                        map.put(locationType.getLocationName(), locationList1.size());
                    }
                    return R.ok(map);
                }
            }else {
                // 查询片区
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getProjectId, query.getProjectId()));
                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));
                for (TLocationType locationType : locationTypes) {
                    List<TLocation> locationList1 = locationList.stream().filter(location -> location.getLocationType().equals(locationType.getId())).collect(Collectors.toList());
                    map.put(locationType.getLocationName(), locationList1.size());
                }
                return R.ok(map);
            }
        }
        return R.ok(map);
    }
@@ -242,10 +347,13 @@
    @PostMapping(value = "/warningSummary")
    public R<Map<String, Object>> warningSummary(@RequestBody DataStatisticsQuery query) {
        Map<String, Object> map = new HashMap<>();
        map.put("timeoutWarn", 0);
        map.put("unqualifiedWarn", 0);
        Integer deptType = tokenService.getLoginUser().getUser().getDeptType();
        String deptId = tokenService.getLoginUser().getUser().getDeptId();
        Long userId = tokenService.getLoginUser().getUserId();
        LambdaQueryWrapper<TTask> wrapper = new LambdaQueryWrapper<>();
        if (userId != 1L) {
        // 查询点位类型
        if(StringUtils.isNotEmpty(query.getLocationTypeId())){
            // 查询点位
@@ -312,6 +420,65 @@
            }
        }
        map.put("unqualifiedWarn", unqualifiedWarn);
        }else {
            // 超级管理员
            // 查询点位类型
            if(StringUtils.isNotEmpty(query.getLocationTypeId())){
                // 查询点位
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getLocationType, query.getLocationTypeId()));
                if(!CollectionUtils.isEmpty(locationList)){
                    List<String> locationIds = locationList.stream().map(TLocation::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getLocationId, locationIds);
                }
            }
            // 超级管理员 查询所有的任务列表
            List<TTask> taskList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class));
            if(CollectionUtils.isEmpty(query.getProjectId())){
                // 查询所有项目部的任务列表
                List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus, 1)
                        .ne(TProjectDept::getParentId, 0));
                if(!CollectionUtils.isEmpty(tProjectDeptList)){
                    List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getProjectId, projectIds);
                }
            }
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
            List<TTask> list = taskCleanService.list(wrapper);
            if(CollectionUtils.isEmpty(list)){
                return R.ok(map);
            }
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            map.put("timeoutWarn", list.stream().filter(task -> task.getStatus() == 2).count());
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                map.put("unqualifiedWarn", 0);
                return R.ok(map);
            }
            List<String> taskIds = tasks.stream().map(TTask::getId).collect(Collectors.toList());
            List<TTaskDetail> taskDetails = tTaskDetailService.list(Wrappers.lambdaQuery(TTaskDetail.class)
                    .in(TTaskDetail::getTaskId, taskIds)
                    .orderByDesc(TTaskDetail::getCreateTime));
            int unqualifiedWarn = 0;
            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){
                        unqualifiedWarn++;
                    }
                }
            }
            map.put("unqualifiedWarn", unqualifiedWarn);
        }
        return R.ok(map);
    }
@@ -321,7 +488,9 @@
        Integer deptType = tokenService.getLoginUser().getUser().getDeptType();
        String deptId = tokenService.getLoginUser().getUser().getDeptId();
        Long userId = tokenService.getLoginUser().getUserId();
        AnalysisUnqualifiedCleaningVO analysisUnqualifiedCleaningVO = new AnalysisUnqualifiedCleaningVO();
        LambdaQueryWrapper<TTask> wrapper = new LambdaQueryWrapper<>();
        if(userId != 1L){
        // 查询点位类型
        if(StringUtils.isNotEmpty(query.getLocationTypeId())){
            // 查询点位
@@ -385,8 +554,6 @@
                taskDetailList.add(tTaskDetail);
            }
        }
        AnalysisUnqualifiedCleaningVO analysisUnqualifiedCleaningVO = new AnalysisUnqualifiedCleaningVO();
        analysisUnqualifiedCleaningVO.setTotal(taskDetailList.size());
        // 查询所有的不合格原因
@@ -401,12 +568,83 @@
            analysisUnqualifiedCleaningDetailVOS.add(analysisUnqualifiedCleaningDetailVO);
        }
        analysisUnqualifiedCleaningVO.setAnalysisUnqualifiedCleaningDetailVOS(analysisUnqualifiedCleaningDetailVOS);
        }else {
            // 超级管理员
            // 查询点位类型
            if(StringUtils.isNotEmpty(query.getLocationTypeId())){
                // 查询点位
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getLocationType, query.getLocationTypeId()));
                if(!CollectionUtils.isEmpty(locationList)){
                    List<String> locationIds = locationList.stream().map(TLocation::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getLocationId, locationIds);
                }
            }
            // 超级管理员 查询所有的任务列表
            List<TTask> taskList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class));
            if(CollectionUtils.isEmpty(query.getProjectId())){
                // 查询所有项目部的任务列表
                List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus, 1)
                        .ne(TProjectDept::getParentId, 0));
                if(!CollectionUtils.isEmpty(tProjectDeptList)){
                    List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getProjectId, projectIds);
                }
            }
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
            List<TTask> list = taskCleanService.list(wrapper);
            if(CollectionUtils.isEmpty(list)){
                return R.ok();
            }
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                return R.ok();
            }
            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::getClearStatus, 2)
                    .orderByDesc(TTaskDetail::getCreateTime));
            List<TTaskDetail> taskDetailList = new ArrayList<>();
            for (TTask task : list) {
                TTaskDetail tTaskDetail = taskDetails.stream().filter(taskDetail -> taskDetail.getTaskId().equals(task.getId())).findFirst().orElse(null);
                if(Objects.nonNull(tTaskDetail)){
                    taskDetailList.add(tTaskDetail);
                }
            }
            analysisUnqualifiedCleaningVO.setTotal(taskDetailList.size());
            // 查询所有的不合格原因
            List<TDictData> dictDataList = dictDataService.list(Wrappers.lambdaQuery(TDictData.class)
                    .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());
                AnalysisUnqualifiedCleaningDetailVO analysisUnqualifiedCleaningDetailVO = new AnalysisUnqualifiedCleaningDetailVO();
                analysisUnqualifiedCleaningDetailVO.setUnqualifiedName(tDictData.getDataContent());
                analysisUnqualifiedCleaningDetailVO.setCount(tTaskDetails.size());
                analysisUnqualifiedCleaningDetailVOS.add(analysisUnqualifiedCleaningDetailVO);
            }
            analysisUnqualifiedCleaningVO.setAnalysisUnqualifiedCleaningDetailVOS(analysisUnqualifiedCleaningDetailVOS);
        }
        return R.ok(analysisUnqualifiedCleaningVO);
    }
    @ApiOperation(value = "巡检排行榜")
    @PostMapping(value = "/inspectionRankingList")
    public R<List<DataStatisticsRankVO>> inspectionRankingList(@RequestBody DataStatisticsRankQuery query) {
    public R<List<DataStatisticsRankVO>> inspectionRankingList(@Validated @RequestBody DataStatisticsRankQuery query) {
        Integer deptType = tokenService.getLoginUser().getUser().getDeptType();
        String deptId = tokenService.getLoginUser().getUser().getDeptId();
        Long userId = tokenService.getLoginUser().getUserId();
@@ -434,7 +672,8 @@
        }
        wrapper.between(TTask::getCreateTime, startTime, endTime);
        List<DataStatisticsRankVO> result = new ArrayList<>();
        if(userId != 1L){
        // 查询点位类型
        if(StringUtils.isNotEmpty(query.getLocationTypeId())){
            // 查询点位
@@ -515,8 +754,6 @@
                .eq(TTaskDetail::getClearStatus, 1)
                .orderByDesc(TTaskDetail::getCreateTime));
        List<DataStatisticsRankVO> result = new ArrayList<>();
        if(query.getRankType() == 1){
            // 用户排名
            for (SysUser sysUser : sysUsers) {
@@ -576,6 +813,131 @@
                dataStatisticsRankVO.setQualifiedCount(count);
            }
        }
        }else {
            // 超级管理员
            // 查询点位类型
            if(StringUtils.isNotEmpty(query.getLocationTypeId())){
                // 查询点位
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getLocationType, query.getLocationTypeId()));
                if(!CollectionUtils.isEmpty(locationList)){
                    List<String> locationIds = locationList.stream().map(TLocation::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getLocationId, locationIds);
                }
            }
            List<SysUser> sysUsers = new ArrayList<>();
            if(query.getRankType() == 1){
                sysUsers = sysUserService.selectListByDeptId(deptId);
            }
            // 超级管理员 查询所有的任务列表
            List<TTask> taskList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class));
            if(CollectionUtils.isEmpty(query.getProjectId())){
                // 查询所有项目部的任务列表
                List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus, 1)
                        .ne(TProjectDept::getParentId, 0));
                if(!CollectionUtils.isEmpty(tProjectDeptList)){
                    List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    wrapper.in(TTask::getProjectId, projectIds);
                }
                if(query.getRankType() == 1){
                    // 查询所有项目部的人员
                    List<SysUser> sysUserList = sysUserService.selectListByDeptType(1);
                    if(!CollectionUtils.isEmpty(sysUserList)){
                        sysUsers.addAll(sysUserList);
                    }
                }
            }else {
                if(query.getRankType() == 1){
                    // 查询所有片区
                    List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .eq(TProjectDept::getStatus, 1)
                            .in(TProjectDept::getId, query.getProjectId()));
                    if(!CollectionUtils.isEmpty(tProjectDeptList)){
                        List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).distinct().collect(Collectors.toList());
                        List<SysUser> sysUserList = sysUserService.selectListByDeptIds(projectIds);
                        sysUsers.addAll(sysUserList);
                    }
                }
            }
            // 查询片区
            if(!CollectionUtils.isEmpty(query.getProjectId())){
                wrapper.in(TTask::getProjectId, query.getProjectId());
            }
            List<TTask> list = taskCleanService.list(wrapper);
            if(CollectionUtils.isEmpty(list)){
                return R.ok();
            }
            if(!CollectionUtils.isEmpty(taskList)){
                list.addAll(taskList);
            }
            List<TTask> tasks = list.stream().filter(task -> task.getStatus() != 1 && task.getStatus() != 2).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(tasks)){
                return R.ok();
            }
            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::getClearStatus, 1)
                    .orderByDesc(TTaskDetail::getCreateTime));
            if(query.getRankType() == 1){
                // 用户排名
                for (SysUser sysUser : sysUsers) {
                    DataStatisticsRankVO dataStatisticsRankVO = new DataStatisticsRankVO();
                    dataStatisticsRankVO.setName(sysUser.getNickName());
                    List<String> taskIdList = tasks.stream().filter(task -> task.getPatrolInspector().equals(String.valueOf(sysUser.getUserId()))).map(TTask::getId).collect(Collectors.toList());
                    dataStatisticsRankVO.setTaskCount(taskIdList.size());
                    long count = taskDetails.stream().filter(taskDetail -> taskIdList.contains(taskDetail.getTaskId())).count();
                    dataStatisticsRankVO.setQualifiedCount(count);
                }
            }else {
                // 超级管理员 查询所有项目部
                List<TProjectDept> projectDepts;
                if (CollectionUtils.isEmpty(query.getProjectId())){
                    projectDepts = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .eq(TProjectDept::getStatus, 1)
                            .eq(TProjectDept::getParentId, 0));
                }else {
                    List<TProjectDept> projectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .eq(TProjectDept::getStatus, 1)
                            .in(TProjectDept::getId, query.getProjectId()));
                    List<String> parentIds = projectDeptList.stream().map(TProjectDept::getParentId).collect(Collectors.toList());
                    projectDepts = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .eq(TProjectDept::getStatus, 1)
                            .in(TProjectDept::getId, parentIds));
                }
                if(CollectionUtils.isEmpty(projectDepts)){
                    return R.ok();
                }
                // 查询所有片区
                List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .eq(TProjectDept::getStatus, 1)
                        .ne(TProjectDept::getParentId, 0));
                for (TProjectDept projectDept : projectDepts) {
                    DataStatisticsRankVO dataStatisticsRankVO = new DataStatisticsRankVO();
                    dataStatisticsRankVO.setName(projectDept.getProjectName());
                    List<String> taskIdList;
                    if(!CollectionUtils.isEmpty(tProjectDeptList)){
                        List<String> projectIds = tProjectDeptList.stream().map(TProjectDept::getId).collect(Collectors.toList());
                        taskIdList = tasks.stream().filter(task -> projectIds.contains(task.getProjectId())).map(TTask::getId).collect(Collectors.toList());
                    } else {
                        taskIdList = new ArrayList<>();
                    }
                    dataStatisticsRankVO.setTaskCount(taskIdList.size());
                    if(CollectionUtils.isEmpty(taskIdList)){
                        dataStatisticsRankVO.setQualifiedCount(0L);
                        continue;
                    }
                    long count = taskDetails.stream().filter(taskDetail -> taskIdList.contains(taskDetail.getTaskId())).count();
                    dataStatisticsRankVO.setQualifiedCount(count);
                }
            }
        }
        return R.ok(result);
    }