13693261870
2025-07-08 ea96e4fd148c14b94b939e3deaa43cb049b810ef
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
72
73
74
75
76
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 {
            //String enable1 = env.getProperty("spring.datasource.druid.stat-view-servlet.enabled");
            //String enable2 = env.getProperty("spring.datasource.druid.web-stat-filter.enabled");
            //String filters = env.getProperty("spring.datasource.druid.filters");
            //String pattern = env.getProperty("spring.datasource.druid.stat-view-servlet.url-pattern");
            
            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 + "/swagger-ui.html");
 
            String autoQuery = env.getProperty("sys.autoQuery");
            if (StaticData.S1.equals(autoQuery)) {
                autoQueryService.autoQuery();
            }
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}