package com.prolog.cs.biz.inbound.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class AutoTask implements ApplicationRunner {

    private static Logger log = LoggerFactory.getLogger(AutoTask.class);

    //@Scheduled(cron = "0 0 */2 * * ?")
    //@Scheduled(cron="0/30 * * * * ? ")//每30秒执行一次
    public void autoTask() {
//        log.info("开始定时任务");
//        try {
//            if(DateUtil.compare(new Date(),DateUtil.parse("2022-01-31","yyyy-MM-dd"))>0){
//                //if(DateUtil.compare(new Date(),DateUtil.parse("2021-12-18","yyyy-MM-dd"))>0){
//                //System.exit(0);
//                new Thread(() -> System.exit(1)).start(); // 程序能按期望退出
//            }
//        } catch (Exception e) {
//            log.error("开始定时任务",e);
//        }
    }
    
    @Override
    public void run(ApplicationArguments args) throws Exception {

    }

}
