|
@@ -62,6 +62,21 @@ public class SystemConfigService {
|
|
@Value(value="${file.path}")
|
|
@Value(value="${file.path}")
|
|
private String filePath;
|
|
private String filePath;
|
|
|
|
|
|
|
|
+ @Value(value="${aliyun.oss.endPoint}")
|
|
|
|
+ private String endpoint;
|
|
|
|
+
|
|
|
|
+ @Value(value="${aliyun.accessKeyId}")
|
|
|
|
+ private String accessKeyId;
|
|
|
|
+
|
|
|
|
+ @Value(value="${aliyun.secretAccessKey}")
|
|
|
|
+ private String accessKeySecret;
|
|
|
|
+
|
|
|
|
+ @Value(value="${aliyun.oss.bucketName}")
|
|
|
|
+ private String bucketName;
|
|
|
|
+
|
|
|
|
+ @Value(value="${aliyun.oss.linkUrl}")
|
|
|
|
+ private String aliOssLinkUrl;
|
|
|
|
+
|
|
private static String DELETED = "deleted";
|
|
private static String DELETED = "deleted";
|
|
|
|
|
|
public SystemConfig getSystemConfig(long id)throws Exception {
|
|
public SystemConfig getSystemConfig(long id)throws Exception {
|
|
@@ -248,10 +263,6 @@ public class SystemConfigService {
|
|
String token = request.getHeader("X-Access-Token");
|
|
String token = request.getHeader("X-Access-Token");
|
|
Long tenantId = Tools.getTenantIdByToken(token);
|
|
Long tenantId = Tools.getTenantIdByToken(token);
|
|
bizPath = bizPath + "/" + tenantId;
|
|
bizPath = bizPath + "/" + tenantId;
|
|
- String endpoint = platformConfigService.getPlatformConfigByKey("aliOss_endpoint").getPlatformValue();
|
|
|
|
- String accessKeyId = platformConfigService.getPlatformConfigByKey("aliOss_accessKeyId").getPlatformValue();
|
|
|
|
- String accessKeySecret = platformConfigService.getPlatformConfigByKey("aliOss_accessKeySecret").getPlatformValue();
|
|
|
|
- String bucketName = platformConfigService.getPlatformConfigByKey("aliOss_bucketName").getPlatformValue();
|
|
|
|
// 填写Object完整路径,完整路径中不能包含Bucket名称,例如exampledir/exampleobject.txt。
|
|
// 填写Object完整路径,完整路径中不能包含Bucket名称,例如exampledir/exampleobject.txt。
|
|
String fileName = "";
|
|
String fileName = "";
|
|
String orgName = mf.getOriginalFilename();// 获取文件名
|
|
String orgName = mf.getOriginalFilename();// 获取文件名
|
|
@@ -310,7 +321,7 @@ public class SystemConfigService {
|
|
ossClient.putObject(putSmallObjectRequest);
|
|
ossClient.putObject(putSmallObjectRequest);
|
|
}
|
|
}
|
|
// 返回路径
|
|
// 返回路径
|
|
- return bizPath + "/" + fileName;
|
|
|
|
|
|
+ return getFileUrlAliOss(bizPath + "/" + fileName);
|
|
} catch (OSSException oe) {
|
|
} catch (OSSException oe) {
|
|
logger.error("Caught an OSSException, which means your request made it to OSS, "
|
|
logger.error("Caught an OSSException, which means your request made it to OSS, "
|
|
+ "but was rejected with an error response for some reason.");
|
|
+ "but was rejected with an error response for some reason.");
|
|
@@ -336,7 +347,7 @@ public class SystemConfigService {
|
|
}
|
|
}
|
|
|
|
|
|
public String getFileUrlAliOss(String imgPath) throws Exception {
|
|
public String getFileUrlAliOss(String imgPath) throws Exception {
|
|
- String linkUrl = platformConfigService.getPlatformConfigByKey("aliOss_linkUrl").getPlatformValue();
|
|
|
|
|
|
+ String linkUrl = aliOssLinkUrl;
|
|
return linkUrl + filePath + "/" + imgPath;
|
|
return linkUrl + filePath + "/" + imgPath;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -381,10 +392,6 @@ public class SystemConfigService {
|
|
}
|
|
}
|
|
} else if(fileUploadType == 2) {
|
|
} else if(fileUploadType == 2) {
|
|
//oss
|
|
//oss
|
|
- String endpoint = platformConfigService.getPlatformConfigByKey("aliOss_endpoint").getPlatformValue();
|
|
|
|
- String accessKeyId = platformConfigService.getPlatformConfigByKey("aliOss_accessKeyId").getPlatformValue();
|
|
|
|
- String accessKeySecret = platformConfigService.getPlatformConfigByKey("aliOss_accessKeySecret").getPlatformValue();
|
|
|
|
- String bucketName = platformConfigService.getPlatformConfigByKey("aliOss_bucketName").getPlatformValue();
|
|
|
|
for(String pathStr: pathList) {
|
|
for(String pathStr: pathList) {
|
|
if(StringUtil.isNotEmpty(pathStr)) {
|
|
if(StringUtil.isNotEmpty(pathStr)) {
|
|
String[] pathArr = pathStr.split(",");
|
|
String[] pathArr = pathStr.split(",");
|
|
@@ -647,4 +654,4 @@ public class SystemConfigService {
|
|
File file = ExcelUtils.exportObjectsOneSheet(title, tip, names, title, objects);
|
|
File file = ExcelUtils.exportObjectsOneSheet(title, tip, names, title, objects);
|
|
ExcelUtils.downloadExcel(file, file.getName(), response);
|
|
ExcelUtils.downloadExcel(file, file.getName(), response);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|