|
@@ -2,13 +2,7 @@ package org.fouram.job;
|
|
|
|
|
|
import org.fouram.core.util.DateUtil;
|
|
|
import org.fouram.core.util.LoggerUtil;
|
|
|
-import org.fouram.service.SapApprovalInfoService;
|
|
|
-import org.fouram.service.SapCheckOptionService;
|
|
|
-import org.fouram.service.SapCheckService;
|
|
|
-import org.fouram.service.SapCheckdateService;
|
|
|
-import org.fouram.service.SapEmployeeTimeService;
|
|
|
-import org.fouram.service.WxDepartService;
|
|
|
-import org.fouram.service.WxUserService;
|
|
|
+import org.fouram.service.CheckTaskService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -16,64 +10,31 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@Service
|
|
|
public class AutoCheckJob {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WxUserService wxUserService;
|
|
|
- @Autowired
|
|
|
- private WxDepartService wxDepartService;
|
|
|
- @Autowired
|
|
|
- private SapCheckService sapCheckService;
|
|
|
- @Autowired
|
|
|
- private SapCheckdateService sapCheckdateService;
|
|
|
- @Autowired
|
|
|
- private SapCheckOptionService sapCheckOptionService;
|
|
|
- @Autowired
|
|
|
- private SapEmployeeTimeService employeeTimeService;
|
|
|
+
|
|
|
@Autowired
|
|
|
- private SapApprovalInfoService sapApprovalInfoService;
|
|
|
+ private CheckTaskService checkTaskService;
|
|
|
|
|
|
- public void executeBiz(String checkinDay) {
|
|
|
- String startDay = checkinDay;
|
|
|
- String endDay = checkinDay;
|
|
|
- try {
|
|
|
- wxDepartService.saveDeparts();
|
|
|
- wxUserService.saveUsers();
|
|
|
- sapCheckService.saveCheckInOffOuts(startDay, endDay);
|
|
|
- // 判断打卡记录小于10条记录认为是假期
|
|
|
- if(sapCheckService.queryCheckInTotal() < 10) {
|
|
|
- return;
|
|
|
- }
|
|
|
- sapCheckdateService.saveCheckout(startDay);
|
|
|
- employeeTimeService.saveEmployeeTimes();
|
|
|
- sapCheckOptionService.saveOptions(endDay);
|
|
|
- sapApprovalInfoService.saveApprovalInfos(endDay.substring(0, 7));
|
|
|
- sapCheckService.saveReportResultData(startDay, endDay);
|
|
|
- } catch (Exception e) {
|
|
|
- LoggerUtil.error(e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Scheduled(cron = "0 30 10 * * ?")
|
|
|
+ @Scheduled(cron = "0 30 10/2 * * ?")
|
|
|
@Transactional
|
|
|
public void executeJob1() {
|
|
|
LoggerUtil.info("executeJob1 : " + DateUtil.getTime());
|
|
|
- executeBiz(DateUtil.getDate());
|
|
|
+ checkTaskService.executeBiz(DateUtil.getDate());
|
|
|
LoggerUtil.info("executeJob1 : " + DateUtil.getTime());
|
|
|
}
|
|
|
-
|
|
|
- @Scheduled(cron = "0 30 14 * * ?")
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 15/7 * * ?")
|
|
|
@Transactional
|
|
|
public void executeJob2() {
|
|
|
LoggerUtil.info("executeJob2 : " + DateUtil.getTime());
|
|
|
- executeBiz(DateUtil.getDate());
|
|
|
+ checkTaskService.executeBiz(DateUtil.getDate());
|
|
|
LoggerUtil.info("executeJob2 : " + DateUtil.getTime());
|
|
|
}
|
|
|
-
|
|
|
- @Scheduled(cron = "0 0 20 * * ?")
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0 20/12 * * ?")
|
|
|
@Transactional
|
|
|
public void executeJob3() {
|
|
|
LoggerUtil.info("executeJob3 : " + DateUtil.getTime());
|
|
|
- executeBiz(DateUtil.getDate());
|
|
|
+ checkTaskService.executeBiz(DateUtil.getDate());
|
|
|
LoggerUtil.info("executeJob3 : " + DateUtil.getTime());
|
|
|
}
|
|
|
}
|