package com.ruoyi.dj.mqtt.runner;

import com.ruoyi.dj.mqtt.service.TaskSchedulingService;
import com.ruoyi.system.domain.ScheduleTask;
import com.ruoyi.system.service.IScheduleTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @auther 周志雄
 * @date 2024/7/24 9:39
 */
@Slf4j
@Component
public class TaskInitializer implements CommandLineRunner {
    @Autowired
    private TaskSchedulingService taskSchedulingService;

    @Override
    public void run(String... args) throws Exception {
        log.info("初始化所有的定时任务并启动周期性任务更新");
        taskSchedulingService.scheduleUpdateTasks();
    }
}
