package com.ruoyi.inspect.task; import com.ruoyi.inspect.service.StaffAttendanceTrackingRecordService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; /** * 同步拉取icc开放平台考勤记录定时任务 */ @Slf4j @Component public class SyncStaffAttendanceRecordSchedule { @Autowired private StaffAttendanceTrackingRecordService trackingRecordService; @Scheduled(cron = "0 0 1 * * ?") public void sync() { log.info("--------同步考勤记录定时任务开始--------"); LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1L); LocalDateTime startTime = LocalDateTime.of(yesterday, LocalTime.MIN); LocalDateTime endTime = LocalDateTime.of(yesterday, LocalTime.MAX); trackingRecordService.syncAttendanceRecord(startTime,endTime); log.info("--------同步考勤记录定时任务结束--------"); } }