zouyu
2 天以前 2ea3b36a810adcb639f4d3c72c860f722f601927
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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("--------同步考勤记录定时任务结束--------");
    }
 
}