From 092c8c53480ae4e54fddc9cd678e9c699e50e1ca Mon Sep 17 00:00:00 2001
From: yaozc <unbelievers@yeah.net>
Date: Thu, 02 Feb 2023 07:25:49 +0000
Subject: [PATCH] 按照个人排班调整时间初始值 任务分配时默认继承任务开始结束时间
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java | 44 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
index 73c915a..b885d33 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -23,6 +23,7 @@
import org.springframework.data.jpa.repository.Query;
import java.sql.Timestamp;
+import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -85,8 +86,24 @@
* @param projectId
* @return
*/
- @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 ORDER BY user_id, fill_date ASC", nativeQuery = true)
- List<TaskDaliy> findByProjectId(Long projectId);
+ @Query(value = "SELECT COALESCE(SUM(consumed_hours), 0.0) AS consumedHours, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload FROM task_daliy WHERE project_id = ?1 AND fill_date < ?2", nativeQuery = true)
+ TaskDailyInterface collectByProjectIdAndFillDateLessThan(Long projectId, Timestamp fillDate);
+
+ /**
+ * 根据项目ID查询任务日报信息
+ * @param projectId
+ * @return
+ */
+ @Query(value = "SELECT td.task_id AS taskId, COALESCE(MAX(td.task_progress), 0) AS taskProgress, COALESCE(SUM(consumed_hours), 0) AS consumedHours, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, plan_hours AS planHours FROM task_daliy td INNER JOIN task t ON (td.task_id = t.id) WHERE td.project_id = ?1 AND td.fill_date < ?2 GROUP BY td.task_id", nativeQuery = true)
+ List<TaskDailyInterface> collectByProjectIdAndFillDateLessThanGroupByTaskIdJoinTask(Long projectId, Timestamp fillDate);
+
+ /**
+ * 根据项目ID查询任务日报信息
+ * @param projectId
+ * @return
+ */
+ @Query(value = "SELECT user_id AS userId, fill_date AS fillDate, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 AND fill_date < ?2 GROUP BY user_id, fill_date", nativeQuery = true)
+ List<TaskDailyInterface> collectByProjectIdAndFillDateLessThanGroupByUserIdAndFillDate(Long projectId, Timestamp fillDate);
/**
* 根据项目ID、任务ID查询
@@ -100,11 +117,10 @@
/**
* 根据项目ID、任务ID查询
* @param projectId
- * @param taskId
* @return
*/
- @Query(value = "SELECT user_id AS userId, task_id AS taskId, COALESCE(MAX(task_progress), 0) AS TaskProgress FROM task_daliy WHERE project_id = ?1 AND fill_date BETWEEN ?2 AND ?3 GROUP BY user_id, task_id", nativeQuery = true)
- List<TaskDailyInterface> collectCostByProjectIdAndFillDateBetweenGroupUserAndTaskId(Long projectId, Timestamp sdate, Timestamp edate);
+ @Query(value = "SELECT user_id AS userId, task_id AS taskId, COALESCE(MAX(task_progress), 0) AS taskProgress FROM task_daliy WHERE project_id = ?1 AND fill_date <= ?2 GROUP BY user_id, task_id", nativeQuery = true)
+ List<TaskDailyInterface> collectCostByProjectIdAndFillDateLessThanGroupUserAndTaskId(Long projectId, Timestamp edate);
/**
@@ -116,4 +132,22 @@
*/
@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);
+
+ /**
+ * 根据userId,开始时间结束时间范围查询日志表
+ * @param userId
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ @Query(value = "SELECT id,project_id,task_id,user_id,fill_date,consumed_workload,task_progress,settlement_status,SUM( consumed_hours ) AS consumed_hours,remarks,create_by,create_time,update_by,update_time from task_daliy where user_id = ?1 and fill_date <= ?3 and fill_date >= ?2 group by fill_date", nativeQuery = true)
+ List<TaskDaliy> findAllByUserAndDate(Long userId, LocalDate startDate, LocalDate endDate);
+
+ /**
+ * 根据用户ID查询参与的项目ID
+ * @param userId
+ * @return
+ */
+ @Query(value = "SELECT DISTINCT(project_id) FROM task_user WHERE user_id = ?1", nativeQuery = true)
+ List<Long> findProjectIdByUserId(Long userId);
}
\ No newline at end of file
--
Gitblit v1.9.3