package com.ssm.core.bean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
/**
 * 说明：启动运行，没有使用
 */
@Component
@Order(2)
@Slf4j
public class MyApplicationRunnerImpl implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("开始执行MyApplicationRunnerImpl-run方法");
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.MONTH,1);
        Date time = calendar.getTime();
        String format1 = format.format(time);
        //下一个月1号
        format1=format1+"-01";

        //执行redis定时任务
        redisTask(format1);
        System.out.println("MyApplicationRunnerImpl-run方法执行完毕");
    }

    public void redisTask(String Date){

    }

}