| | |
| | | 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) |
| | |
| | | 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 { |
| | |
| | | |
| | | // 查询片区 |
| | | 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) |
| | |
| | | if(!CollectionUtils.isEmpty(taskList)){ |
| | | list.addAll(taskList); |
| | | } |
| | | list = list.stream().distinct().collect(Collectors.toList()); |
| | | }else { |
| | | // 超级管理员 |
| | | // 查询点位类型 |
| | |
| | | |
| | | // 查询片区 |
| | | 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())); |
| | |
| | | if(!CollectionUtils.isEmpty(taskList)){ |
| | | list.addAll(taskList); |
| | | } |
| | | list = list.stream().distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | // 查询任务相关数据 |
| | |
| | | map.put("waitTaskNum", list.stream().filter(tTask -> tTask.getStatus() == 1).count()); |
| | | |
| | | // 总计员工数 |
| | | Integer totalEmployeeNum = sysUserService.selectUserCount(query.getProjectId(),deptType); |
| | | Integer totalEmployeeNum = sysUserService.selectUserCount(null,deptType); |
| | | if (deptType != 1) { |
| | | totalEmployeeNum = totalEmployeeNum + 1; |
| | | } |
| | |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | |
| | | TaskSituationVO taskSituationVO = new TaskSituationVO(); |
| | | |
| | | LambdaQueryWrapper<TTask> wrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | if(StringUtils.isEmpty(query.getStartTime()) || StringUtils.isNotEmpty(query.getEndTime())){ |
| | | if(StringUtils.isEmpty(query.getStartTime()) || StringUtils.isEmpty(query.getEndTime())){ |
| | | LocalDate now = LocalDate.now(); |
| | | String startTime = now.minusDays(6) + " 00:00:00"; |
| | | String endTime = now + " 23:59:59"; |
| | |
| | | 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 { |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | if(!CollectionUtils.isEmpty(taskList)){ |
| | | list.addAll(taskList); |
| | | } |
| | | list = list.stream().distinct().collect(Collectors.toList()); |
| | | }else { |
| | | // 超级管理员 |
| | | // 查询点位类型 |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | if(!CollectionUtils.isEmpty(taskList)){ |
| | | list.addAll(taskList); |
| | | } |
| | | list = list.stream().distinct().collect(Collectors.toList()); |
| | | } |
| | | // 任务总数 |
| | | taskSituationVO.setTotalTaskNum(list.size()); |
| | |
| | | } |
| | | } |
| | | } |
| | | taskSituationVO.setPassRate(new BigDecimal(qualifiedWarn).divide(new BigDecimal(tasks.size()), 2, RoundingMode.HALF_UP)); |
| | | taskSituationVO.setPassRate(new BigDecimal(qualifiedWarn).divide(new BigDecimal(tasks.size()), 2, RoundingMode.HALF_DOWN)); |
| | | |
| | | // 过滤每天的任务 |
| | | LocalDateTime start = DateUtils.stringToLocalDateTime(query.getStartTime()); |
| | |
| | | if(tTasks.isEmpty()){ |
| | | taskSituationDayVO.setCompleteRate(BigDecimal.ZERO); |
| | | }else { |
| | | taskSituationDayVO.setCompleteRate(new BigDecimal(qualifiedWarnChild).divide(new BigDecimal(tTasks.size()), 2, RoundingMode.HALF_UP)); |
| | | taskSituationDayVO.setCompleteRate(new BigDecimal(qualifiedWarnChild).divide(new BigDecimal(tTasks.size()), 2, RoundingMode.HALF_DOWN)); |
| | | } |
| | | taskSituationDayVOList.add(taskSituationDayVO); |
| | | } |
| | |
| | | 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 { |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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)){ |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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)){ |
| | |
| | | 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 { |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | 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 { |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | 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 { |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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(); |
| | |
| | | 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) { |
| | |
| | | .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()); |
| | |
| | | |
| | | // 查询片区 |
| | | if(!CollectionUtils.isEmpty(query.getProjectId())){ |
| | | query.setProjectId(query.getProjectId().stream().distinct().collect(Collectors.toList())); |
| | | wrapper.in(TTask::getProjectId, query.getProjectId()); |
| | | } |
| | | |
| | |
| | | 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(); |
| | |
| | | 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<>(); |
| | |
| | | .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()); |
| | | analysisUnqualifiedCleaningDetailVOS.add(analysisUnqualifiedCleaningDetailVO); |
| | | } |
| | | // 按照数量倒序排序 |
| | | analysisUnqualifiedCleaningDetailVOS.sort(Comparator.comparingInt(AnalysisUnqualifiedCleaningDetailVO::getCount).reversed()); |
| | | analysisUnqualifiedCleaningVO.setAnalysisUnqualifiedCleaningDetailVOS(analysisUnqualifiedCleaningDetailVOS); |
| | | } |
| | | |