yaozc
2023-01-17 43e80e0148b02f1cc54409971dd565e7ff6402b6
Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into yaozc

# Conflicts:
# eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/WeekReportMethod.java
# eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
1 files added
7 files modified
1 files deleted
214 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/WeekReportMethod.java 10 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDailyInterface.java 22 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliyCollectInterface.java 43 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java 20 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskUserDto.java 9 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/task/index.vue 52 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/taskDaliy/index.vue 15 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/taskUser/index.vue 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/WeekReportMethod.java
@@ -13,6 +13,7 @@
import java.util.Map.Entry;
import java.util.stream.Collectors;
import me.zhengjie.modules.task.domain.TaskDailyInterface;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -26,7 +27,6 @@
import me.zhengjie.modules.project.service.ProjectCostService;
import me.zhengjie.modules.task.domain.Task;
import me.zhengjie.modules.task.domain.TaskDaliy;
import me.zhengjie.modules.task.domain.TaskDaliyCollectInterface;
import me.zhengjie.modules.task.repository.TaskDaliyRepository;
import me.zhengjie.modules.task.repository.TaskRepository;
@@ -124,15 +124,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,9 +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 me.zhengjie.modules.task.domain.TaskDaliyCostGroupByUserInterface;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@@ -52,8 +51,8 @@
    TaskDaliy findNextByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Timestamp fillDate);
    @Query(value = "SELECT COALESCE(avg(task_progress), 0.0) as taskProgress, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, COALESCE(sum(consumed_hours), 0.0) as consumedHours FROM task_daliy WHERE task_id = ?1 AND create_time < ?2", nativeQuery = true)
    TaskDaliyCollectInterface collectTaskDaliyUntilDate(Long taskId, Date belongDate);
    @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)
    TaskDailyInterface collectTaskDaliyUntilDate(Long taskId, Date belongDate);
    /**
     * 根据项目ID、任务ID查询各用户填报的最大任务进度日报信息
@@ -96,5 +95,16 @@
     * @return
     */
    @Query(value = "SELECT user_id AS userId, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 GROUP BY user_id", nativeQuery = true)
    List<TaskDaliyCostGroupByUserInterface> collectCostByProjectIdGroupUser(Long projectId);
    List<TaskDailyInterface> collectCostByProjectIdGroupUser(Long projectId);
    /**
     * 根据项目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/task/index.vue
@@ -53,6 +53,32 @@
        >
          分配
        </el-button>
        <el-button
          slot="right"
          v-permission="permission.seeDivide"
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-share"
          :disabled="crud.selections.length !== 1"
          style="margin-left: 4px !important;"
          @click="toSeeDivide(crud.selections[0])"
        >
          查看分配
        </el-button>
        <el-button
          slot="right"
          v-permission="permission.seeDaliy"
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-share"
          :disabled="crud.selections.length !== 1"
          style="margin-left: 4px !important;"
          @click="toSeeDaliy(crud.selections[0])"
        >
          查看日报
        </el-button>
      </crudOperation>
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
@@ -300,7 +326,9 @@
        edit: ['admin', 'task:edit'],
        del: ['admin', 'task:del'],
        download: ['admin', 'task:download'],
        divide: ['admin', 'task:divide']
        divide: ['admin', 'task:divide'],
        seeDivide: ['admin', 'task:seeDivide'],
        seeDaliy: ['admin', 'task:seeDaliy']
      },
      rules: {
        name: [
@@ -480,6 +508,28 @@
      // 分配表单状态
      this.divideStatus = true
    },
    // 查看任务分配
    toSeeDivide(data) {
      // 跳转页面
      this.$router.push({
        name: 'TaskUser',
        params: {
          projectId: data.projectId,
          taskId: data.id
        }
      })
    },
    // 查看任务日报
    toSeeDaliy(data) {
      // 跳转页面
      this.$router.push({
        name: 'TaskDaliy',
        params: {
          projectId: data.projectId,
          taskId: data.id
        }
      })
    },
    // 分配表单关闭
    divideClose() {
      // 分配表单状态
eladmin-web-master/src/views/task/taskDaliy/index.vue
@@ -273,6 +273,21 @@
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 判断传参是否为空
      if (this.$route.params.projectId != null && this.$route.params.projectId !== '' && this.crud.query.projectId === undefined) {
        // 检索条件赋值
        this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId))
        // 获取任务列表
        crudTask.getAll({ projectId: this.query.projectId }).then(res => {
          // 检索任务列表
          this.queryTasks = res
        })
      }
      // 判断传参是否为空
      if (this.$route.params.taskId != null && this.$route.params.taskId !== '' && this.crud.query.taskId === undefined) {
        // 检索条件赋值
        this.$set(this.crud.query, 'taskId', Number(this.$route.params.taskId))
      }
      // 用户角色级别数组
      const userRolesLevel = this.user.roles.map(({ level }) => level)
      // 用户最大角色级别
eladmin-web-master/src/views/task/taskUser/index.vue
@@ -130,11 +130,24 @@
        </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">
@@ -275,6 +288,21 @@
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 判断传参是否为空
      if (this.$route.params.projectId != null && this.$route.params.projectId !== '' && this.crud.query.projectId === undefined) {
        // 检索条件赋值
        this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId))
        // 获取任务列表
        crudTask.getAll({ projectId: this.query.projectId }).then(res => {
          // 检索任务列表
          this.queryTasks = res
        })
      }
      // 判断传参是否为空
      if (this.$route.params.taskId != null && this.$route.params.taskId !== '' && this.crud.query.taskId === undefined) {
        // 检索条件赋值
        this.$set(this.crud.query, 'taskId', Number(this.$route.params.taskId))
      }
      // 用户角色级别数组
      const userRolesLevel = this.user.roles.map(({ level }) => level)
      // 用户最大角色级别
@@ -310,7 +338,7 @@
        // 检索任务列表
        this.queryTasks = []
      } else {
        // 获取父级任务
        // 获取任务列表
        crudTask.getAll({ projectId: this.query.projectId }).then(res => {
          // 检索任务列表
          this.queryTasks = res