|
|
@@ -10,6 +10,8 @@ import cn.reghao.devops.manager.app.service.config.BuildDirService;
|
|
|
import cn.reghao.devops.manager.log.Appenders;
|
|
|
import cn.reghao.devops.manager.log.LoggerConfig;
|
|
|
import cn.reghao.devops.manager.machine.service.MachineService;
|
|
|
+import cn.reghao.devops.manager.sys.db.repository.SysMessageRepository;
|
|
|
+import cn.reghao.devops.manager.sys.model.po.SysMessage;
|
|
|
import cn.reghao.devops.manager.ws.handler.LogHandler;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
|
@@ -35,10 +37,11 @@ public class AppLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
private final FileService fileService;
|
|
|
private final RoleService roleService;
|
|
|
private final AccountService accountService;
|
|
|
+ private final SysMessageRepository sysMessageRepository;
|
|
|
|
|
|
public AppLifecycle(BuildDirService buildDirService, MachineService machineService, LogHandler logHandler,
|
|
|
CompilerConfigRepository compilerConfigRepository, FileService fileService,
|
|
|
- RoleService roleService, AccountService accountService) {
|
|
|
+ RoleService roleService, AccountService accountService, SysMessageRepository sysMessageRepository) {
|
|
|
this.buildDirService = buildDirService;
|
|
|
this.machineService = machineService;
|
|
|
this.logHandler = logHandler;
|
|
|
@@ -46,6 +49,7 @@ public class AppLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
this.fileService = fileService;
|
|
|
this.roleService = roleService;
|
|
|
this.accountService = accountService;
|
|
|
+ this.sysMessageRepository = sysMessageRepository;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -117,7 +121,9 @@ public class AppLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
String homePath = compilerConfig.getHomePath();
|
|
|
File file = new File(homePath);
|
|
|
if (!file.exists()) {
|
|
|
- log.error("编译配置 {} 的编译器 {} 不存在", name, homePath);
|
|
|
+ String errMsg = String.format("编译配置 %s 的编译器 %s 不存在", name, homePath);
|
|
|
+ SysMessage sysMessage = new SysMessage("系统异常", errMsg);
|
|
|
+ sysMessageRepository.save(sysMessage);
|
|
|
}
|
|
|
}
|
|
|
}
|