123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package com.malk.rongzhi.schedule;
- import com.malk.rongzhi.service.RZService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.annotation.Scheduled;
- /**
- * @EnableScheduling 开启定时任务 [配置参考McScheduleTask]
- */
- @Slf4j
- @Configuration
- @EnableScheduling
- @ConditionalOnProperty(name = {"spel.scheduling"})
- public class RZScheduleTask {
- @Autowired
- private RZService rzService;
- private void syncAttendance2EKB() {
- try {
- log.info("###### [RZ]同步考勤数据至易快报 ######");
- rzService.uploadTravelData();
- } catch (Exception e) {
- log.error(e.getMessage(), e); // 记录错误日志
- }
- log.info("###### [RZ]同步考勤数据至易快报 ######");
- }
- /**
- * 同步考勤数据☞易快报, [0...5分钟/次]
- */
- @Scheduled(cron = "0 0/5 22-23 * * ?")
- public void Time_Period_1() {
- syncAttendance2EKB();
- }
- /**
- * 同步考勤数据☞易快报, [0...5分钟/次]
- */
- @Scheduled(cron = "0 0/5 0-6 * * ?")
- public void Time_Period_2() {
- syncAttendance2EKB();
- }
- /**
- * 同步考勤数据☞易快报, [0...5分钟/次]
- */
- @Scheduled(cron = "0 0,5,10,15,20,25,30 7 * * ? ")
- public void Time_Period_3() {
- syncAttendance2EKB();
- }
- }
|