|
@@ -1,8 +1,14 @@
|
|
|
package cn.com.qmth.examcloud.web.config;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
+import java.io.File;
|
|
|
+
|
|
|
/**
|
|
|
* 系统配置
|
|
|
*
|
|
@@ -13,6 +19,8 @@ import org.springframework.stereotype.Component;
|
|
|
@Component
|
|
|
public class SystemProperties {
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(SystemProperties.class);
|
|
|
+
|
|
|
/**
|
|
|
* 配置文件环境
|
|
|
*/
|
|
@@ -86,4 +94,23 @@ public class SystemProperties {
|
|
|
this.tempDataDir = tempDataDir;
|
|
|
}
|
|
|
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ if (StringUtils.isNotEmpty(dataDir)) {
|
|
|
+ File dir = new File(dataDir);
|
|
|
+ if (!dir.exists()) {
|
|
|
+ dir.mkdirs();
|
|
|
+ }
|
|
|
+ log.info(dataDir + " init...");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(tempDataDir)) {
|
|
|
+ File dir = new File(tempDataDir);
|
|
|
+ if (!dir.exists()) {
|
|
|
+ dir.mkdirs();
|
|
|
+ }
|
|
|
+ log.info(tempDataDir + " init...");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|