package com.lantone.qc.security.config;

import com.lantone.qc.security.util.TokenUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @description: 定时器
 * @author: zhoutg
 * @time: 2019/11/19 13:52
 */
@Component
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
@ConditionalOnProperty(prefix = "mysecurity", value = { "enable" }, havingValue = "true")
public class ScheduleTask {

    // 添加定时任务，每天12点执行
    @Scheduled(cron = "0 59 23 * * ?")
    public void configureTasks() {
        // 有效时间天数 -1
        TokenUtil.dealDay();
    }
}