package cn.com.qmth.examcloud.tool.config;

import cn.com.qmth.examcloud.tool.service.TaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class ScheduleHandler implements CommandLineRunner {

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

    @Autowired
    private TaskService taskService;

    @Override
    public void run(String... args) throws Exception {
        int x = taskService.clearExpiredTaskStatus();
        log.warn("结束过期任务数：" + x);
    }

}
