فهرست منبع

定时任务修改,从关联考勤班次的部门改为查询所有部门。

zq 2 سال پیش
والد
کامیت
4fe9c7b27c

+ 10 - 3
web/src/main/java/com/jpsoft/shinestar/scheduled/WorkScheduleTask.java

@@ -1,5 +1,7 @@
 package com.jpsoft.shinestar.scheduled;
 
+import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
+import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
 import com.jpsoft.shinestar.modules.base.service.WorkOverPersonService;
 import com.jpsoft.shinestar.modules.base.service.WorkShiftCompanyService;
 import com.jpsoft.shinestar.modules.business.service.WorkScheduleAttendanceService;
@@ -24,13 +26,18 @@ public class WorkScheduleTask {
     @Autowired
     private WorkOverPersonService workOverPersonService;
 
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
     /**
      * 每天5,18点统计昨天的考勤情况
      */
     @Scheduled(cron = "0 0 5,18 * * ?")
     public void run() {
         //查询出关联了班次考勤的单位
-        List<String> companyList = workShiftCompanyService.findDistinctCompanyId();
+
+        //List<String> companyList = workShiftCompanyService.findDistinctCompanyId();
+        List<CompanyInfo> companyList = companyInfoService.list();
 
         DateTime prevTime = DateTime.now().minusDays(1).withTimeAtStartOfDay();
         String prevDay = prevTime.toString("yyyy-MM-dd");
@@ -39,9 +46,9 @@ public class WorkScheduleTask {
         int affectCount = workOverPersonService.updateFinishTime(prevDay);
         log.warn("更新{}加班结束时间共{}条", prevDay, affectCount);
 
-        for (String companyId : companyList) {
+        for (CompanyInfo companyInfo : companyList) {
             //查询前天考勤情况
-            workScheduleAttendanceService.batchUpdate(companyId,null,null,null,
+            workScheduleAttendanceService.batchUpdate(companyInfo.getId(),null,null,null,
                     prevTime.toDate(),prevTime.plusDays(1).toDate(),false);
         }
     }

+ 5 - 5
web/src/main/resources/application-dev.yml

@@ -9,13 +9,13 @@ spring:
 #     username: root
 #     password: jpsoft2016
      #测试环境下
-     url: jdbc:log4jdbc:mysql://47.111.136.126:8100/shine_star?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-     username: root
-     password: jpsoft8121234
-     #正式环境下
-#     url: jdbc:log4jdbc:mysql://223.75.170.44:3366/shine_star?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#     url: jdbc:log4jdbc:mysql://47.111.136.126:8100/shine_star?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
 #     username: root
 #     password: jpsoft8121234
+     #正式环境下
+     url: jdbc:log4jdbc:mysql://223.75.170.44:3366/shine_star?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+     username: root
+     password: jpsoft8121234
   devtools:
     add-properties: false
     restart: