Bläddra i källkod

1.定时任务计算历史考勤数据中的工作时长。

zhengqiang 3 år sedan
förälder
incheckning
7a2b351dcb

+ 11 - 11
web/src/main/java/com/jpsoft/shinestar/scheduled/UpdateWorkMinuteTask.java

@@ -29,12 +29,12 @@ public class UpdateWorkMinuteTask {
         for (WorkScheduleAttendance wsa : list) {
             int workMinutes = 0;
 
-            List<WorkScheduleAttendance> onWorkList = workScheduleAttendanceService.findByPersonScheduleIdAndClassify(wsa.getPersonScheduleId(), wsa.getWorkShiftId(), "1");
+            try {
+                List<WorkScheduleAttendance> onWorkList = workScheduleAttendanceService.findByPersonScheduleIdAndClassify(wsa.getPersonScheduleId(), wsa.getWorkShiftId(), "1");
 
-            if(onWorkList.size()>0){
-                WorkScheduleAttendance workStartAttendance = onWorkList.get(0);
+                if(onWorkList.size()>0){
+                    WorkScheduleAttendance workStartAttendance = onWorkList.get(0);
 
-                try {
                     if (StringUtils.isNotEmpty(workStartAttendance.getResult())
                             && !"0".equals(workStartAttendance.getResult())
                             && workStartAttendance.getRecordTime() != null
@@ -44,14 +44,14 @@ public class UpdateWorkMinuteTask {
                                 .getMinutes();
                     }
                 }
-                catch (Exception ex){
-                    log.error(ex.getMessage(),ex);
-                }
-            }
 
-            wsa.setWorkMinute(new BigDecimal(workMinutes));
-            wsa.setUpdateTime(new Date());
-            workScheduleAttendanceService.updateWorkMinute(wsa);
+                wsa.setWorkMinute(new BigDecimal(workMinutes));
+                wsa.setUpdateTime(new Date());
+                workScheduleAttendanceService.updateWorkMinute(wsa);
+            }
+            catch (Exception ex){
+                log.error(ex.getMessage(),ex);
+            }
         }
     }
 }