瀏覽代碼

1.更新日工时统计

WoNiu 4 年之前
父節點
當前提交
b517fca2e4

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

@@ -30,6 +30,14 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
     ChuanyunSelfWorkHourDO findByUserIdAndAndProjectIdAndAndDayLogDateAndProjectType(String userId, String projectId, LocalDateTime dayLogDate,String projectType);
 
     /**
+     * 根据用户id,日期获取工时
+     * @param userId
+     * @param dayLogDate
+     * @return
+     */
+    List<ChuanyunSelfWorkHourDO> findByUserIdAndDayLogDate(String userId,LocalDateTime dayLogDate);
+
+    /**
      * 根据用户Id,项目Id,起止时间获取工时列表
      * @param userId    用户Id
      * @param projectId 项目Id

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

@@ -132,9 +132,11 @@ public class WorkHourStatistics {
                             BigDecimal personDays = (self.getHoursWorked().divide(chuanyunWorkHourDO.getHoursWorked(), 2, RoundingMode.HALF_UP)).multiply(standard);
                             chuanyunSelfWorkHourDO.setStandardWorkHour(personDays);
                         }
-                        ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO1 = chuanyunSelfWorkHourDao.findByUserIdAndAndProjectIdAndAndDayLogDateAndProjectType(chuanyunUserCompanyDO.getUserId(),ChuanYunConstant.PRODUCTION_PROJECT.equals(self.getProjectType())?ChuanYunConstant.PRODUCTION_PROJECT_ID:self.getProjectId(),self.getDayLogDate(),self.getProjectType());
-                        if (chuanyunSelfWorkHourDO1!=null) {
-                            chuanyunSelfWorkHourDao.delete(chuanyunSelfWorkHourDO1);
+                        List<ChuanyunSelfWorkHourDO> list = chuanyunSelfWorkHourDao.findByUserIdAndDayLogDate(chuanyunUserCompanyDO.getUserId(),self.getDayLogDate());
+                        if (list!=null && list.size()>0) {
+                            for (ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO1 : list){
+                                chuanyunSelfWorkHourDao.delete(chuanyunSelfWorkHourDO1);
+                            }
                         }
                         chuanyunSelfWorkHourDao.save(chuanyunSelfWorkHourDO);
                     }

+ 5 - 3
src/main/java/com/galaxis/manatee/task/WorkHourStatisticsRecently.java

@@ -223,9 +223,11 @@ public class WorkHourStatisticsRecently {
                         BigDecimal personDays = (self.getHoursWorked().divide(chuanyunWorkHourDO.getHoursWorked(), 2, RoundingMode.HALF_UP)).multiply(standard);
                         chuanyunSelfWorkHourDO.setStandardWorkHour(personDays);
                     }
-                    ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO1 = chuanyunSelfWorkHourDao.findByUserIdAndAndProjectIdAndAndDayLogDateAndProjectType(chuanyunUserCompanyDO.getUserId(),ChuanYunConstant.PRODUCTION_PROJECT.equals(self.getProjectType())?ChuanYunConstant.PRODUCTION_PROJECT_ID:self.getProjectId(),self.getDayLogDate(),self.getProjectType());
-                    if (chuanyunSelfWorkHourDO1!=null) {
-                        chuanyunSelfWorkHourDao.delete(chuanyunSelfWorkHourDO1);
+                    List<ChuanyunSelfWorkHourDO> list = chuanyunSelfWorkHourDao.findByUserIdAndDayLogDate(chuanyunUserCompanyDO.getUserId(),self.getDayLogDate());
+                    if (list!=null && list.size()>0) {
+                        for (ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO1 : list){
+                            chuanyunSelfWorkHourDao.delete(chuanyunSelfWorkHourDO1);
+                        }
                     }
                     chuanyunSelfWorkHourDao.save(chuanyunSelfWorkHourDO);
                 }