管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-21 b9b490e0ec226389c6e2502fecf918f7537d8c57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.lf.server.config;
 
import com.lf.server.entity.all.StaticData;
import com.lf.server.helper.*;
import com.lf.server.service.all.TestService;
import com.lf.server.service.all.UploadAttachService;
import com.lf.server.service.show.AutoQueryService;
import com.lf.server.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);
        }
    }
}