广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
package cn.huge.module.timer;
 
import cn.huge.module.griddata.service.GridDataSyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
 
/**
 *
 */
@Slf4j
@Component
public class scheduledTask {
 
    @Resource
    private GridDataSyncService gridDataSyncService;
    //周一到周六,UTC时间0点-12点,每2小时执行一次(对应北京时间8点-20点)
    @Scheduled(cron = "0 0/30 0-12 * * 1-6")
    public void syncData(){
        log.info("开始同步数据");
        gridDataSyncService.syncData();
    }
 
 
}