GlobalConfig新加uploadDir配置
This commit is contained in:
@@ -23,6 +23,7 @@ public class GlobalConfig {
|
||||
private String host;
|
||||
private String service;
|
||||
private String version;
|
||||
private String uploadDir = System.getProperty("user.dir");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 逻辑方法
|
||||
@@ -80,6 +81,15 @@ public class GlobalConfig {
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getUploadDir() {
|
||||
return uploadDir;
|
||||
}
|
||||
|
||||
public void setUploadDir(String uploadDir) {
|
||||
this.uploadDir = uploadDir;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.tiesheng.util.config.GlobalConfig;
|
||||
|
||||
public class FileUploadPath {
|
||||
|
||||
@@ -46,7 +48,7 @@ public class FileUploadPath {
|
||||
}
|
||||
pathBean.setHttpPath(tempPath);
|
||||
|
||||
String tempAbs = String.format("%s/static%s", System.getProperty("user.dir"), tempPath);
|
||||
String tempAbs = String.format("%s/static%s", SpringUtil.getBean(GlobalConfig.class).getUploadDir(), tempPath);
|
||||
tempAbs = FileUtil.normalize(tempAbs);
|
||||
pathBean.setAbsolutePath(tempAbs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user