package com.qianwen.smartman.modules.system.runner;
|
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import com.qianwen.core.launch.utils.PropsUtil;
|
import com.qianwen.smartman.modules.cps.mapper.InitMapper;
|
import com.qianwen.smartman.modules.cps.service.IInitService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.core.env.Environment;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/runner/SystemApplicationInitRunner.class */
|
public class SystemApplicationInitRunner implements ApplicationRunner {
|
private static final Logger log = LoggerFactory.getLogger(SystemApplicationInitRunner.class);
|
@Autowired
|
private IInitService initService;
|
@Autowired
|
private InitMapper initMapper;
|
@Autowired
|
private Environment environment;
|
|
public void run(ApplicationArguments args) throws Exception {
|
PropsUtil.setProperty(System.getProperties(), "blade.system.need_init", this.initService.checkIsNeedInit().toString());
|
try {
|
String apiUrl = "http://127.0.0.1:" + this.environment.getProperty("local.server.port");
|
if (!checkRunInIDEA()) {
|
this.initMapper.initBladeReport(apiUrl);
|
log.info("替换报表api地址成功,替换为:{}", apiUrl);
|
}
|
} catch (Exception e) {
|
log.error("---替换api地址异常,若未初始化则初始化后会重新自动替换---");
|
}
|
}
|
|
private static boolean checkRunInIDEA() {
|
try {
|
Class.forName("com.intellij.rt.execution.application.AppMainV2");
|
return Boolean.TRUE.booleanValue();
|
} catch (ClassNotFoundException e) {
|
return Boolean.FALSE.booleanValue();
|
}
|
}
|
}
|