package com.yutou.tools.utils;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * 服务启动后执行
 */
@Component
public class ApplicationInit implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                String time = new SimpleDateFormat("HH:mm").format(new Date());
                switch (time){
                    case "00:00":
                        break;
                    case "08:00":
                    case "20:00":
                        break;
                    case "23:59":
                        break;

                }
            }
        },0,35 * 1000);
    }
}
