Browse Source

1.修改工时统计

WoNiu 4 years ago
parent
commit
60c3845ad0

+ 3 - 2
src/main/java/com/galaxis/manatee/dao/ChuanyunSelfCostDao.java

@@ -40,6 +40,7 @@ public interface ChuanyunSelfCostDao extends GalaxisRepository<ChuanyunSelfCostD
     @Query(value="SELECT * FROM chuanyun_self_cost " +
             "WHERE user_id = ?1 " +
             "AND project_id = ?2 " +
-            "AND DATE_FORMAT(chuanyun_self_cost.day_log_date,'%Y-%m')=DATE_FORMAT(?3,'%Y-%m') AND status=?4",nativeQuery = true)
-    ChuanyunSelfCostDO getOldSelfDO(@Param("userId")String userId,@Param("projectId")String projectId,@Param("dayLogDate")String dayLogDate,String status);
+            "AND project_type=?3" +
+            "AND DATE_FORMAT(chuanyun_self_cost.day_log_date,'%Y-%m')=DATE_FORMAT(?4,'%Y-%m') AND status=?5",nativeQuery = true)
+    ChuanyunSelfCostDO getOldSelfDO(@Param("userId")String userId,@Param("projectId")String projectId,@Param("projectType") String projectType,@Param("dayLogDate")String dayLogDate,String status);
 }

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

@@ -35,7 +35,7 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
      * @param end       结束时间
      * @return  日工时列表
      */
-    List<ChuanyunSelfWorkHourDO> findAllByUserIdAndProjectIdAndStatusAndDayLogDateBetween(String userId,String projectId,String status,LocalDateTime start,LocalDateTime end);
+    List<ChuanyunSelfWorkHourDO> findAllByUserIdAndProjectIdAndProjectTypeAndStatusAndDayLogDateBetween(String userId,String projectId,String projectType,String status,LocalDateTime start,LocalDateTime end);
 
     /**
      * 获取人员-项目-月度标准总工时

+ 2 - 0
src/main/java/com/galaxis/manatee/dao/ChuanyunWeekMemberHourDao.java

@@ -35,6 +35,7 @@ public interface ChuanyunWeekMemberHourDao extends GalaxisRepository<ChuanyunWee
             "FROM chuanyun_self_work_hour " +
             "WHERE project_id !='' " +
             "GROUP BY chuanyun_self_work_hour.project_id," +
+            "chuanyun_self_work_hour.project_type," +
             "chuanyun_self_work_hour.user_id," +
             "DATE_FORMAT(day_log_date,'%Y')," +
             "WEEKOFYEAR(chuanyun_self_work_hour.day_log_date)," +
@@ -56,6 +57,7 @@ public interface ChuanyunWeekMemberHourDao extends GalaxisRepository<ChuanyunWee
             "WHERE project_id=?1 and user_id=?2 and DATE_FORMAT(day_log_date,'%Y')=?3 and " +
             "WEEKOFYEAR(chuanyun_self_work_hour.day_log_date)=?4 and status=2 and project_type=?5" +
             " GROUP BY chuanyun_self_work_hour.project_id," +
+            "chuanyun_self_work_hour.project_type," +
             "chuanyun_self_work_hour.user_id," +
             "DATE_FORMAT(day_log_date,'%Y')," +
             "WEEKOFYEAR(chuanyun_self_work_hour.day_log_date)," +

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

@@ -199,9 +199,10 @@ public class WorkHourStatistics {
     private void standardMonthlyHour(ChuanyunUserCompanyDO chuanyunUserCompanyDO) {
         //删除上一次状态为审核中,但本次已经审核通过的数据
         chuanyunSelfCostDao.findAllByStatusAndUserId(ChuanYunConstant.IN_PROCESS,chuanyunUserCompanyDO.getUserId()).forEach(chuanyunSelfCostDO -> {
-            List<ChuanyunSelfWorkHourDO> chuanyunSelfWorkHourList=chuanyunSelfWorkHourDao.findAllByUserIdAndProjectIdAndStatusAndDayLogDateBetween(
+            List<ChuanyunSelfWorkHourDO> chuanyunSelfWorkHourList=chuanyunSelfWorkHourDao.findAllByUserIdAndProjectIdAndProjectTypeAndStatusAndDayLogDateBetween(
                     chuanyunSelfCostDO.getUserId(),
                     chuanyunSelfCostDO.getProjectId(),
+                    chuanyunSelfCostDO.getProjectType(),
                     ChuanYunConstant.IN_PROCESS,
                     chuanyunSelfCostDO.getDayLogDate(),
                     chuanyunSelfCostDO.getDayLogDate().plusMonths(1L));
@@ -214,6 +215,7 @@ public class WorkHourStatistics {
                 matchers.add("F0000003_2,"+chuanyunSelfCostDO.getProjectId());
                 matchers.add("F0000009_2,"+ChuanYunConstant.IN_PROCESS);
                 matchers.add("F0000002_2,"+chuanyunSelfCostDO.getUserId());
+                matchers.add("F0000008_2,"+chuanyunSelfCostDO.getProjectType());
                 matchers.add("F0000004_2,"+chuanyunSelfCostDO.getDayLogDate());
                 var filter= Filter.instance(0,1,true,"And",matchers);
                 try {
@@ -254,6 +256,7 @@ public class WorkHourStatistics {
             chuanyunSelfCostDO.setDepartmentId(chuanyunUserCompanyDO.getDepartmentId());
             ChuanyunSelfCostDO oldSelfDO = chuanyunSelfCostDao.getOldSelfDO(chuanyunSelfCostDO.getUserId(),
                     chuanyunSelfCostDO.getProjectId(),
+                    chuanyunSelfCostDO.getProjectType(),
                     df.format(chuanyunSelfCostDO.getDayLogDate()),
                     projectMonth.getStatus());
             if (oldSelfDO !=null) {