|
@@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.data.repository.query.Param;
|
|
import org.springframework.data.repository.query.Param;
|
|
import org.springframework.stereotype.Repository;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -16,36 +17,39 @@ import java.util.List;
|
|
* @author kxuan
|
|
* @author kxuan
|
|
*/
|
|
*/
|
|
@Repository
|
|
@Repository
|
|
-public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfWorkHourDO,String> {
|
|
|
|
|
|
+public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfWorkHourDO, String> {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据项目id,用户id,日期获取工时数据
|
|
* 根据项目id,用户id,日期获取工时数据
|
|
- * @param userId 用户Id
|
|
|
|
- * @param projectId 项目Id
|
|
|
|
- * @param dayLogDate 日志日期
|
|
|
|
- * @return 日工时记录
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户Id
|
|
|
|
+ * @param projectId 项目Id
|
|
|
|
+ * @param dayLogDate 日志日期
|
|
|
|
+ * @return 日工时记录
|
|
*/
|
|
*/
|
|
- List<ChuanyunSelfWorkHourDO> findByUserIdAndProjectIdAndDayLogDateAndProjectTypeAndStatus(String userId, String projectId, LocalDateTime dayLogDate,String projectType,String status);
|
|
|
|
|
|
+ List<ChuanyunSelfWorkHourDO> findByUserIdAndProjectIdAndDayLogDateAndProjectTypeAndStatus(String userId, String projectId, LocalDateTime dayLogDate, String projectType, String status);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据项目id,用户id,日期获取工时数据
|
|
* 根据项目id,用户id,日期获取工时数据
|
|
|
|
+ *
|
|
* @param userId
|
|
* @param userId
|
|
* @param projectId
|
|
* @param projectId
|
|
* @param dayLogDate
|
|
* @param dayLogDate
|
|
* @param projectType
|
|
* @param projectType
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- List<ChuanyunSelfWorkHourDO> findByUserIdAndProjectIdAndDayLogDateAndProjectType(String userId, String projectId, LocalDateTime dayLogDate,String projectType);
|
|
|
|
|
|
+ List<ChuanyunSelfWorkHourDO> findByUserIdAndProjectIdAndDayLogDateAndProjectType(String userId, String projectId, LocalDateTime dayLogDate, String projectType);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据userId获取工时数据
|
|
* 根据userId获取工时数据
|
|
|
|
+ *
|
|
* @param userId
|
|
* @param userId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
List<ChuanyunSelfWorkHourDO> findByUserId(String userId);
|
|
List<ChuanyunSelfWorkHourDO> findByUserId(String userId);
|
|
|
|
|
|
|
|
|
|
- @Query(value="SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
|
|
|
|
+ @Query(value = "SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
@@ -66,38 +70,42 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据用户id,日期获取工时
|
|
* 根据用户id,日期获取工时
|
|
|
|
+ *
|
|
* @param userId
|
|
* @param userId
|
|
* @param dayLogDate
|
|
* @param dayLogDate
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- List<ChuanyunSelfWorkHourDO> findByUserIdAndDayLogDate(String userId,LocalDateTime dayLogDate);
|
|
|
|
|
|
+ List<ChuanyunSelfWorkHourDO> findByUserIdAndDayLogDate(String userId, LocalDateTime dayLogDate);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据用户Id,项目Id,起止时间获取工时列表
|
|
* 根据用户Id,项目Id,起止时间获取工时列表
|
|
|
|
+ *
|
|
* @param userId 用户Id
|
|
* @param userId 用户Id
|
|
* @param projectId 项目Id
|
|
* @param projectId 项目Id
|
|
* @param status 状态
|
|
* @param status 状态
|
|
* @param start 开始时间
|
|
* @param start 开始时间
|
|
* @param end 结束时间
|
|
* @param end 结束时间
|
|
- * @return 日工时列表
|
|
|
|
|
|
+ * @return 日工时列表
|
|
*/
|
|
*/
|
|
- List<ChuanyunSelfWorkHourDO> findAllByUserIdAndProjectIdAndProjectTypeAndStatusAndDayLogDateBetween(String userId,String projectId,String projectType,String status,LocalDateTime start,LocalDateTime end);
|
|
|
|
|
|
+ List<ChuanyunSelfWorkHourDO> findAllByUserIdAndProjectIdAndProjectTypeAndStatusAndDayLogDateBetween(String userId, String projectId, String projectType, String status, LocalDateTime start, LocalDateTime end);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取最近一个月日工时
|
|
* 获取最近一个月日工时
|
|
|
|
+ *
|
|
* @param pageable
|
|
* @param pageable
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT * FROM chuanyun_self_work_hour WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(chuanyun_self_work_hour.day_log_date)\n",
|
|
|
|
- countQuery="SELECT count(1) FROM chuanyun_self_work_hour WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(chuanyun_self_work_hour.day_log_date)\n",nativeQuery = true)
|
|
|
|
|
|
+ @Query(value = "SELECT * FROM chuanyun_self_work_hour WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(chuanyun_self_work_hour.day_log_date)\n",
|
|
|
|
+ countQuery = "SELECT count(1) FROM chuanyun_self_work_hour WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(chuanyun_self_work_hour.day_log_date)\n", nativeQuery = true)
|
|
Page<ChuanyunSelfWorkHourDO> getRecentlyDayHour(PageRequest pageable);
|
|
Page<ChuanyunSelfWorkHourDO> getRecentlyDayHour(PageRequest pageable);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取人员-项目-月度标准总工时
|
|
* 获取人员-项目-月度标准总工时
|
|
- * @param userId 用户ID
|
|
|
|
- * @return 汇总数据
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户ID
|
|
|
|
+ * @return 汇总数据
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
|
|
|
|
+ @Query(value = "SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
@@ -119,10 +127,11 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取最近一个月工时
|
|
* 获取最近一个月工时
|
|
|
|
+ *
|
|
* @param userId
|
|
* @param userId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
|
|
|
|
+ @Query(value = "SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
@@ -144,12 +153,13 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取人员月度标准工时汇总
|
|
* 获取人员月度标准工时汇总
|
|
- * @param userId 用户ID
|
|
|
|
- * @param dayLogDate 查询月份日期
|
|
|
|
- * @param status 工时状态
|
|
|
|
- * @return 汇总数据
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户ID
|
|
|
|
+ * @param dayLogDate 查询月份日期
|
|
|
|
+ * @param status 工时状态
|
|
|
|
+ * @return 汇总数据
|
|
*/
|
|
*/
|
|
- @Query(value="SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
|
|
|
|
+ @Query(value = "SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.day_log_date," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.status," +
|
|
"chuanyun_self_work_hour.status," +
|
|
@@ -157,14 +167,51 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
|
|
"chuanyun_self_work_hour.project_id," +
|
|
"chuanyun_self_work_hour.project_id," +
|
|
"chuanyun_self_work_hour.department_id," +
|
|
"chuanyun_self_work_hour.department_id," +
|
|
"chuanyun_self_work_hour.department_name," +
|
|
"chuanyun_self_work_hour.department_name," +
|
|
- "chuanyun_self_work_hour.object_id "+
|
|
|
|
|
|
+ "chuanyun_self_work_hour.object_id " +
|
|
"FROM chuanyun_self_work_hour " +
|
|
"FROM chuanyun_self_work_hour " +
|
|
"WHERE chuanyun_self_work_hour.user_id= ?1 " +
|
|
"WHERE chuanyun_self_work_hour.user_id= ?1 " +
|
|
- "AND chuanyun_self_work_hour.status= ?3 "+
|
|
|
|
- "AND DATE_FORMAT(chuanyun_self_work_hour.day_log_date,'%Y-%m')=DATE_FORMAT(?2,'%Y-%m') "+
|
|
|
|
|
|
+ "AND chuanyun_self_work_hour.status= ?3 " +
|
|
|
|
+ "AND DATE_FORMAT(chuanyun_self_work_hour.day_log_date,'%Y-%m')=DATE_FORMAT(?2,'%Y-%m') " +
|
|
"GROUP BY chuanyun_self_work_hour.user_id," +
|
|
"GROUP BY chuanyun_self_work_hour.user_id," +
|
|
"chuanyun_self_work_hour.status," +
|
|
"chuanyun_self_work_hour.status," +
|
|
"DATE_FORMAT(chuanyun_self_work_hour.day_log_date,'%Y-%m')",
|
|
"DATE_FORMAT(chuanyun_self_work_hour.day_log_date,'%Y-%m')",
|
|
nativeQuery = true)
|
|
nativeQuery = true)
|
|
- ChuanyunSelfWorkHourDO getMonthHour(@Param("userId") String userId,@Param("dayLogDate") String dayLogDate,@Param("status")String status);
|
|
|
|
|
|
+ ChuanyunSelfWorkHourDO getMonthHour(@Param("userId") String userId, @Param("dayLogDate") String dayLogDate, @Param("status") String status);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据userId获取工时数据
|
|
|
|
+ *
|
|
|
|
+ * @param userId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ List<ChuanyunSelfWorkHourDO> findByUserIdAndDayLogDateAfter(String userId, LocalDateTime halfYearDate);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取人员-项目-月度标准总工时
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户ID
|
|
|
|
+ * @return 汇总数据
|
|
|
|
+ */
|
|
|
|
+ @Query(value = "SELECT SUM(chuanyun_self_work_hour.standard_work_hour) AS standard_work_hour," +
|
|
|
|
+ "chuanyun_self_work_hour.day_log_date," +
|
|
|
|
+ "chuanyun_self_work_hour.user_id," +
|
|
|
|
+ "chuanyun_self_work_hour.project_id," +
|
|
|
|
+ "chuanyun_self_work_hour.project_type," +
|
|
|
|
+ "chuanyun_self_work_hour.status," +
|
|
|
|
+ "chuanyun_self_work_hour.department_name," +
|
|
|
|
+ "chuanyun_self_work_hour.department_id," +
|
|
|
|
+ "chuanyun_self_work_hour.object_id " +
|
|
|
|
+ "FROM chuanyun_self_work_hour " +
|
|
|
|
+ "WHERE chuanyun_self_work_hour.user_id=? " +
|
|
|
|
+ "and DATEDIFF(chuanyun_self_work_hour.day_log_date,NOW()) <= 0 " +
|
|
|
|
+ "and DATEDIFF(chuanyun_self_work_hour.day_log_date,NOW()) > -180 " +
|
|
|
|
+ "GROUP BY chuanyun_self_work_hour.user_id," +
|
|
|
|
+ "DATE_FORMAT(chuanyun_self_work_hour.day_log_date,'%Y-%m')," +
|
|
|
|
+ "chuanyun_self_work_hour.project_id," +
|
|
|
|
+ "chuanyun_self_work_hour.status," +
|
|
|
|
+ "chuanyun_self_work_hour.project_type",
|
|
|
|
+ nativeQuery = true)
|
|
|
|
+ List<ChuanyunSelfWorkHourDO> getHalfYearMonthProjectHour(String userId);
|
|
}
|
|
}
|