package com.terra.system.config;
|
|
import com.terra.system.entity.all.StaticData;
|
import com.terra.system.helper.*;
|
import com.terra.system.service.all.TestService;
|
import com.terra.system.service.all.UploadAttachService;
|
import com.terra.system.service.show.AutoQueryService;
|
import com.terra.system.service.sys.ArgsService;
|
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.LogFactory;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.core.env.Environment;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
|
/**
|
* 初始化完成配置类
|
* @author WWW
|
*/
|
@Component
|
public class InitConfig implements ApplicationRunner {
|
private final static Log log = LogFactory.getLog(InitConfig.class);
|
|
@Resource
|
PathHelper pathHelper;
|
|
@Resource
|
ArgsService argsService;
|
|
@Resource
|
Environment env;
|
|
@Resource
|
TestService testService;
|
|
@Resource
|
AutoQueryService autoQueryService;
|
|
@Value("${server.port}")
|
String serverPort;
|
|
@Value("${server.servlet.context-path}")
|
String contextPath;
|
|
@Override
|
public void run(ApplicationArguments args) {
|
// noinspection AlibabaRemoveCommentedCode
|
try {
|
GdalHelper.init(env.getProperty("sys.gdal_path"));
|
UploadAttachService.init(env.getProperty("sys.attachTabs"));
|
|
//testService.testExcel();
|
pathHelper.init();
|
StaticData.ADMIN = env.getProperty("sys.admin");
|
argsService.initSettingData();
|
|
log.info("***************** 系统启动完毕 *****************" + "\n");
|
log.info("API文档:http://localhost:" + serverPort + contextPath + "/swagger-ui.html");
|
|
String autoQuery = env.getProperty("sys.autoQuery");
|
if (StaticData.S1.equals(autoQuery)) {
|
autoQueryService.autoQuery();
|
}
|
} catch (Exception ex) {
|
log.error(ex.getMessage(), ex);
|
}
|
}
|
}
|