| | |
| | | // 判断角色等级 |
| | | if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) { |
| | | // 根据用户ID查询参与的项目ID |
| | | List<Long> taskUserProjectIdList = taskDaliyRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | List<Long> taskUserProjectIdList = taskUserRepository.findProjectIdByUserId(SecurityUtils.getCurrentUserId()); |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | |
| | | taskDto.setDivideWorkload(sumTaskWorkload); |
| | | // 已完成工时 |
| | | Double completedHours = 0D; |
| | | // 根据项目ID、任务ID查询各用户填报的最大任务进度日报信息 |
| | | List<Map> taskDaliyMapList = taskDaliyRepository.findMaxTaskProgressByProjectIdAndTaskId(taskDto.getProjectId(), taskDto.getId()); |
| | | // 循环最大任务进度日报 |
| | | for (int i = 0; i < taskDaliyMapList.size(); i ++) { |
| | | // 最大任务进度日报信息 |
| | | Map taskDaliyMap = taskDaliyMapList.get(i); |
| | | // 已完成工时 |
| | | completedHours += new BigDecimal(taskDaliyMap.get("task_hours").toString()).multiply(new BigDecimal(taskDaliyMap.get("task_progress").toString())).doubleValue() / 100; |
| | | if (Constant.PERFORMANCE_TYPE_ON.equals(taskDto.getPerformanceType())) { |
| | | // 根据项目ID、任务ID查询各用户填报的最大任务进度日报信息 |
| | | List<Map> taskDaliyMapList = taskDaliyRepository.findMaxTaskProgressByProjectIdAndTaskId(taskDto.getProjectId(), taskDto.getId()); |
| | | // 循环最大任务进度日报 |
| | | for (int i = 0; i < taskDaliyMapList.size(); i ++) { |
| | | // 最大任务进度日报信息 |
| | | Map taskDaliyMap = taskDaliyMapList.get(i); |
| | | // 已完成工时 |
| | | completedHours += new BigDecimal(taskDaliyMap.get("task_hours").toString()).multiply(new BigDecimal(taskDaliyMap.get("task_progress").toString())).doubleValue() / 100; |
| | | } |
| | | } else { |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectIdAndTaskId(taskDto.getProjectId(), taskDto.getId()); |
| | | for (TaskDaliy taskDaliy : taskDaliyList) { |
| | | completedHours += taskDaliy.getConsumedHours(); |
| | | } |
| | | } |
| | | // 已完成工时 |
| | | taskDto.setCompletedHours(completedHours); |
| | |
| | | } |
| | | // 项目检索条件 |
| | | criteria.setIdInList(partakeTaskIds); |
| | | criteria.setTaskStatusNotEqual(Constant.TASK_STATUS_COMPLETED); |
| | | return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | } |