package com.yunfeiyun.agmp.fms.scheduler;

import com.yunfeiyun.agmp.fms.service.ITmnBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TmnBaseScheduler {

    @Autowired
    private ITmnBaseService iTmnBaseService;

    /**
     * 设备定时同步定时任务
     */
//    @Scheduled(cron = "0 1 */1 * * ?")
    @Scheduled(cron = "0 */5 * * * ?")
    public void syncTmnBase() throws Exception{
        log.info("最新设备定时同步定时任务开始");
        this.iTmnBaseService.syncTmnBase();
        log.info("最新设备定时同步定时任务结束");
    }
    // 每天凌晨2点执行一次
    @Scheduled(cron = "0 0 2 * * ?")
    public void syncTmnBaseAll() throws Exception{
        log.info("全部设备定时同步定时任务开始");
        this.iTmnBaseService.syncTmnBase("0");
        log.info("全部设备定时同步定时任务结束");
    }
}
