Commit dc6b2d5b authored by wangqiang's avatar wangqiang

将固定地址修改为动态地址

parent 1771276d
package com.yonde.dcs.core.constants; package com.yonde.dcs.core.constants;
import com.yonde.dcs.core.util.ResourceHelper;
/** /**
* @author xfchai * @author xfchai
* @ClassName Constants.java * @ClassName Constants.java
...@@ -87,11 +89,12 @@ public class Constants { ...@@ -87,11 +89,12 @@ public class Constants {
/** /**
* 合并后生成的 word-绝对路径 * 合并后生成的 word-绝对路径
*/ */
public static final String MERGER_FILE_ABSOLUTE_PATH = "D:\\InetService\\resource\\template\\words\\"; public static final String MERGER_FILE_ABSOLUTE_PATH = ResourceHelper.getTempFileDir();
/** /**
* 模板的路径 * 模板的路径
*/ */
public static final String MTEMPLATE_ABSOLUTE_PATH = "D:\\InetService\\resource\\template\\"; public static final String MTEMPLATE_ABSOLUTE_PATH = ResourceHelper.getTempFileDir();
/** /**
* 生成多个合并前的模板路径 * 生成多个合并前的模板路径
*/ */
...@@ -99,7 +102,7 @@ public class Constants { ...@@ -99,7 +102,7 @@ public class Constants {
/** /**
* 生成多个合并前的模板路径 * 生成多个合并前的模板路径
*/ */
public static final String JD_BEFORE_MERGER_PATH = "D:/InetService/resource/template/words/"; public static final String JD_BEFORE_MERGER_PATH = ResourceHelper.getTempFileDir();
/** /**
* 模板路径 * 模板路径
*/ */
...@@ -288,11 +291,11 @@ public class Constants { ...@@ -288,11 +291,11 @@ public class Constants {
/** /**
* 批量下载文件路径 * 批量下载文件路径
*/ */
public static final String DOWLOAD_FILE_PATH = "D:\\bathDocFile"; public static final String DOWLOAD_FILE_PATH = ResourceHelper.getTempFileDir();
/** /**
* 将bathDocFile目录下的所有文件目录打包到d:/bathDocFile.zip * 将bathDocFile目录下的所有文件目录打包到d:/bathDocFile.zip
*/ */
public static final String BATH_FILE_PATH = "D:/bathDocFile"; public static final String BATH_FILE_PATH = ResourceHelper.getTempFileDir();
/** /**
* 未开启 * 未开启
*/ */
......
package com.yonde.dcs.core.util; package com.yonde.dcs.core.util;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.system.ApplicationHome; import org.springframework.boot.system.ApplicationHome;
...@@ -9,6 +11,7 @@ import java.io.FileInputStream; ...@@ -9,6 +11,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import java.util.UUID;
/** /**
* @program: service * @program: service
...@@ -20,17 +23,19 @@ import java.util.Properties; ...@@ -20,17 +23,19 @@ import java.util.Properties;
public class ResourceHelper { public class ResourceHelper {
public static String baseHomeDir; public static String baseHomeDir;
/** /**
* 获取外部资源配置 * 获取外部资源配置
*
* @return * @return
*/ */
public static Properties getResource(){ public static Properties getResource() {
Properties prop = new Properties(); Properties prop = new Properties();
try{ try {
prop.load(new FileInputStream("resource/esignConfig.properties")); prop.load(new FileInputStream("resource/esignConfig.properties"));
}catch (FileNotFoundException e){ } catch (FileNotFoundException e) {
log.error("找不到配置资源文件:" + e.getMessage()); log.error("找不到配置资源文件:" + e.getMessage());
}catch (IOException e){ } catch (IOException e) {
log.error("读取外部配置资源文件报错:" + e.getMessage()); log.error("读取外部配置资源文件报错:" + e.getMessage());
} }
return prop; return prop;
...@@ -39,16 +44,17 @@ public class ResourceHelper { ...@@ -39,16 +44,17 @@ public class ResourceHelper {
/** /**
* 项目经费 模板文件目录 * 项目经费 模板文件目录
*
* @return * @return
*/ */
public static String getFundsDir() { public static String getTempFileDir() {
return getBaseHomeDir() + File.separator + return getBaseHomeDir() + File.separator +
"config" + File.separator + "config";
"funds";
} }
/** /**
* 项目经费 模板文件目录 * 项目经费 模板文件目录
*
* @return * @return
*/ */
public static String getIndexDir() { public static String getIndexDir() {
...@@ -75,7 +81,7 @@ public class ResourceHelper { ...@@ -75,7 +81,7 @@ public class ResourceHelper {
*/ */
public static String getSKImage() { public static String getSKImage() {
return getBaseHomeDir() + File.separator + return getBaseHomeDir() + File.separator +
"config" + File.separator +"doc"+File.separator+ "config" + File.separator + "doc" + File.separator +
"skImage.png" "skImage.png"
; ;
} }
...@@ -87,7 +93,7 @@ public class ResourceHelper { ...@@ -87,7 +93,7 @@ public class ResourceHelper {
*/ */
public static String getZFImage() { public static String getZFImage() {
return getBaseHomeDir() + File.separator + return getBaseHomeDir() + File.separator +
"config" + File.separator +"doc"+File.separator+ "config" + File.separator + "doc" + File.separator +
"zfImage.png"; "zfImage.png";
} }
...@@ -161,4 +167,14 @@ public class ResourceHelper { ...@@ -161,4 +167,14 @@ public class ResourceHelper {
} }
return baseHomeDir; return baseHomeDir;
} }
public static File createTemDir() {
String uuid = UUID.randomUUID().toString().replace("-", "");
String temDir = getBaseHomeDir() + File.separator +
"tem" + File.separator +
uuid;
return FileUtil.mkdir(temDir);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment