eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/WeekReportMethod.java
@@ -8,6 +8,7 @@ import java.util.Date; import java.util.List; import me.zhengjie.modules.task.domain.TaskDailyInterface; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -19,7 +20,6 @@ import me.zhengjie.modules.project.repository.ProjectProgressRepository; import me.zhengjie.modules.project.repository.ProjectRepository; import me.zhengjie.modules.task.domain.Task; import me.zhengjie.modules.task.domain.TaskDaliyCollectInterface; import me.zhengjie.modules.task.repository.TaskDaliyRepository; import me.zhengjie.modules.task.repository.TaskRepository; @@ -89,15 +89,15 @@ for (Task task : taskList) { timeTotalInit = timeTotalInit + task.getPlanHours(); workTotalInit = workTotalInit + (task.getPlanWorkload() == null ? 0.0 : task.getPlanWorkload()); TaskDaliyCollectInterface taskDaliyCollection = taskDaliyRepository.collectTaskDaliyUntilDate(task.getId(), projectProgress.getBelongDate()); TaskDailyInterface taskDailyInterface = taskDaliyRepository.collectTaskDaliyUntilDate(task.getId(), projectProgress.getBelongDate()); boolean flg = true; if (flg) { // TODO 任务状态:未结束 task.getStatus() timeTotalCost += BigDecimal.valueOf(task.getPlanHours()).multiply(BigDecimal.valueOf(taskDaliyCollection.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); timeTotalCost += BigDecimal.valueOf(task.getPlanHours()).multiply(BigDecimal.valueOf(taskDailyInterface.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); } else { timeTotalCost += task.getPlanHours(); } workTotalCost += taskDaliyCollection.getConsumedWorkload(); realLastCost += taskDaliyCollection.getConsumedHours(); workTotalCost += taskDailyInterface.getConsumedWorkload(); realLastCost += taskDailyInterface.getConsumedHours(); } // 真实时长 projectProgress.setRealLastCost(realLastCost); eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDailyInterface.java
New file @@ -0,0 +1,22 @@ package me.zhengjie.modules.task.domain; public interface TaskDailyInterface { /** * 消耗工时 * @return */ Double getConsumedHours(); /** * 消耗工作量 * @return */ Double getConsumedWorkload(); /** * 任务进度 * @return */ Double getTaskProgress(); } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliyCollectInterface.java
File was deleted eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -15,8 +15,8 @@ */ package me.zhengjie.modules.task.repository; import me.zhengjie.modules.task.domain.TaskDailyInterface; import me.zhengjie.modules.task.domain.TaskDaliy; import me.zhengjie.modules.task.domain.TaskDaliyCollectInterface; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; @@ -52,7 +52,7 @@ @Query(value = "SELECT avg(task_progress) as taskProgress, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, sum(consumed_hours) as consumedHours FROM task_daliy WHERE task_id = ?1 AND create_time < ?2", nativeQuery = true) TaskDaliyCollectInterface collectTaskDaliyUntilDate(Long taskId, Date belongDate); TaskDailyInterface collectTaskDaliyUntilDate(Long taskId, Date belongDate); /** * 根据项目ID、任务ID查询各用户填报的最大任务进度日报信息 @@ -79,4 +79,14 @@ * @return */ List<TaskDaliy> findByProjectIdAndTaskId(Long projectId, Long taskId); /** * 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 * @param projectId * @param taskId * @param userId * @return */ @Query(value = "SELECT COALESCE(SUM(consumed_hours), 0) AS consumedHours, COALESCE(SUM(consumed_workload), 0) AS consumedWorkload, COALESCE(MAX(task_progress), 0) AS taskProgress FROM task_daliy WHERE project_id = ?1 AND task_id = ?2 AND user_id = ?3", nativeQuery = true) TaskDailyInterface findSumConsumedHoursAndSumConsumedWorkloadAndMaxTaskProgressByProjectIdAndTaskIdAndUserId(Long projectId, Long taskId, Long userId); } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskUserDto.java
@@ -73,6 +73,15 @@ /** 用户昵称 */ private String userNickName; /** 消耗工时 */ private Double consumedHours; /** 消耗工作量 */ private Double consumedWorkload; /** 任务进度 */ private Double taskProgress; /** 多用户ID */ private List<Long> userIds; } eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java
@@ -23,6 +23,7 @@ import me.zhengjie.modules.system.repository.DictDetailRepository; import me.zhengjie.modules.system.repository.UserRepository; import me.zhengjie.modules.task.domain.Task; import me.zhengjie.modules.task.domain.TaskDailyInterface; import me.zhengjie.modules.task.domain.TaskDaliy; import me.zhengjie.modules.task.domain.TaskUser; import me.zhengjie.modules.task.repository.TaskDaliyRepository; @@ -93,6 +94,14 @@ ValidationUtil.isNull(user.getId(),"User","id",taskUserDto.getUserId()); // 用户昵称 taskUserDto.setUserNickName(user.getNickName()); // 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 TaskDailyInterface taskDailyInterface = taskDaliyRepository.findSumConsumedHoursAndSumConsumedWorkloadAndMaxTaskProgressByProjectIdAndTaskIdAndUserId(taskUserDto.getProjectId(), taskUserDto.getTaskId(), taskUserDto.getUserId()); // 消耗工时 taskUserDto.setConsumedHours(taskDailyInterface.getConsumedHours()); // 消耗工作量 taskUserDto.setConsumedWorkload(taskDailyInterface.getConsumedWorkload()); // 任务进度 taskUserDto.setTaskProgress(taskDailyInterface.getTaskProgress()); // 返回处理好的DTO return taskUserDto; } eladmin-web-master/src/views/task/taskUser/index.vue
@@ -130,13 +130,26 @@ </el-table-column> <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" /> <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" /> <el-table-column :show-overflow-tooltip="true" prop="taskHours" label="任务工时" width="80" /> <el-table-column :show-overflow-tooltip="true" prop="taskWorkload" label="任务工作量" width="80" /> <el-table-column :show-overflow-tooltip="true" label="消耗 / 任务工时" width="110"> <template slot-scope="scope"> {{ scope.row.consumedHours }} / {{ scope.row.taskHours }} </template> </el-table-column> <el-table-column :show-overflow-tooltip="true" label="消耗 / 任务工作量" width="120"> <template slot-scope="scope"> {{ scope.row.consumedWorkload }} / {{ scope.row.taskWorkload == null || scope.row.taskWorkload == '' ? 0 : scope.row.taskWorkload }} </template> </el-table-column> <el-table-column :show-overflow-tooltip="true" prop="taskWorkloadUnit" label="任务工作量单位" width="110"> <template slot-scope="scope"> <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag> </template> </el-table-column> <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" width="80"> <template slot-scope="scope"> {{ scope.row.taskProgress }}% </template> </el-table-column> <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> <template slot-scope="scope"> <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag>