Sfoglia il codice sorgente

1.修改每日工时统计

WoNiu 4 anni fa
parent
commit
285eb376f6

+ 21 - 1
src/main/java/com/galaxis/manatee/dao/ChuanyunSelfWorkHourDao.java

@@ -25,7 +25,7 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
      * @param dayLogDate    日志日期
      * @return  日工时记录
      */
-    ChuanyunSelfWorkHourDO findByUserIdAndAndProjectIdAndAndDayLogDateAndProjectType(String userId, String projectId, LocalDateTime dayLogDate,String projectType);
+    ChuanyunSelfWorkHourDO findByUserIdAndProjectIdAndDayLogDateAndProjectTypeAndStatus(String userId, String projectId, LocalDateTime dayLogDate,String projectType,String status);
 
     /**
      * 根据userId获取工时数据
@@ -34,6 +34,26 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
      */
     List<ChuanyunSelfWorkHourDO> findByUserId(String userId);
 
+
+    @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=? " +
+            "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> findDayWorkHour(String userId);
+
     /**
      * 根据用户id,日期获取工时
      * @param userId

+ 1 - 1
src/main/java/com/galaxis/manatee/service/LogStandardService.java

@@ -160,7 +160,7 @@ public class LogStandardService {
                 ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO=this.fromChuanyunWorkHourDO(self);
                 //查询系统中是否有重复的标准化工时数据,如果有重复的人、天、项目数据,将原数据删除后更新为最新的数据
                 try{
-                    ChuanyunSelfWorkHourDO tmpChuanyunSelfWorkHourDO = chuanyunSelfWorkHourDao.findByUserIdAndAndProjectIdAndAndDayLogDateAndProjectType(chuanyunSelfWorkHourDO.getUserId(), ChuanYunConstant.PRODUCTION_PROJECT.equals(self.getProjectType()) ? ChuanYunConstant.PRODUCTION_PROJECT_ID : self.getProjectId(), self.getDayLogDate(), self.getProjectType());
+                    ChuanyunSelfWorkHourDO tmpChuanyunSelfWorkHourDO = chuanyunSelfWorkHourDao.findByUserIdAndProjectIdAndDayLogDateAndProjectTypeAndStatus(chuanyunSelfWorkHourDO.getUserId(), ChuanYunConstant.PRODUCTION_PROJECT.equals(self.getProjectType()) ? ChuanYunConstant.PRODUCTION_PROJECT_ID : self.getProjectId(), self.getDayLogDate(), self.getProjectType(),self.getStatus());
                     if (tmpChuanyunSelfWorkHourDO != null) {
                         chuanyunSelfWorkHourDao.delete(tmpChuanyunSelfWorkHourDO);
                     }

+ 1 - 1
src/main/java/com/galaxis/manatee/task/WorkHourStatistics.java

@@ -114,7 +114,7 @@ public class WorkHourStatistics {
                         BigDecimal personDays = (self.getHoursWorked().divide(chuanyunWorkHourDO.getHoursWorked(), 2, RoundingMode.HALF_UP)).multiply(standard);
                         chuanyunSelfWorkHourDO.setStandardWorkHour(personDays);
                     }
-                    ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO1 = chuanyunSelfWorkHourDao.findByUserIdAndAndProjectIdAndAndDayLogDateAndProjectType(self.getUserId(), ChuanYunConstant.PRODUCTION_PROJECT.equals(self.getProjectType()) ? ChuanYunConstant.PRODUCTION_PROJECT_ID : self.getProjectId(), self.getDayLogDate(), self.getProjectType());
+                    ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO1 = chuanyunSelfWorkHourDao.findByUserIdAndProjectIdAndDayLogDateAndProjectTypeAndStatus(self.getUserId(), ChuanYunConstant.PRODUCTION_PROJECT.equals(self.getProjectType()) ? ChuanYunConstant.PRODUCTION_PROJECT_ID : self.getProjectId(), self.getDayLogDate(), self.getProjectType(),self.getStatus());
                     if (chuanyunSelfWorkHourDO1 != null) {
                         chuanyunSelfWorkHourDao.delete(chuanyunSelfWorkHourDO1);
                     }