2025-07-02 00:57:46 +08:00

55 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.sxpcwlkj.system.runner;
import com.sxpcwlkj.system.service.SysConfigService;
import com.sxpcwlkj.system.service.SysDictService;
import com.sxpcwlkj.system.service.SysOssConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* @author mmsAdmin
* @ClassName SystemRunner
* @description: 项目初始化
* @date 2024年03月29日
* @version: 1.0
*/
@Slf4j
@Component
@RequiredArgsConstructor
@Order(1) // 可以通过@Order注解指定执行顺序数字越小越先执行
public class SystemRunner implements CommandLineRunner {
private final ApplicationContext applicationContext;
private final SysDictService sysDictService;
private final SysOssConfigService sysOssConfigService;
private final SysConfigService sysConfigService;
@Override
public void run(String... args) throws Exception {
// 在这里执行启动时需要执行的操作
log.info("=== 1.字典已初始化:"+sysDictService.initSysDict(null)+"个: ===");
log.info("=== 2.Oss配置已初始化:"+sysOssConfigService.initOss()+ "===");
log.info("=== 3.Base配置已初始化:"+sysConfigService.initBase()+ "===");
log.info("=== 4.Sms配置已初始化:"+sysConfigService.initSms()+ "===");
log.info("=== 5.Email配置已初始化:"+sysConfigService.initEmail()+ "===");
log.info("=== 6.Wx配置已初始化:"+sysConfigService.initWx()+ "===");
applicationContext.publishEvent(new ContextRefreshedEvent(applicationContext));
}
}