| | |
| | | } |
| | | |
| | | @Override |
| | | public TaskDto customHandleMini(TaskDto taskDto) { |
| | | // 据任务ID查询任务工时总和 |
| | | Double sumTaskHours = taskUserRepository.sumTaskHoursByTaskId(taskDto.getId()); |
| | | // 已分配工时 |
| | | taskDto.setDivideHours(sumTaskHours); |
| | | // 已完成工时 |
| | | Double completedHours = 0D; |
| | | 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); |
| | | // 返回 |
| | | return taskDto; |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskDto> queryAll(TaskQueryCriteria criteria){ |
| | | return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |