|
|
@@ -16,20 +16,20 @@
|
|
|
*/
|
|
|
package org.springblade.resource.endpoint;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.oss.model.OssFile;
|
|
|
-import org.springblade.core.secure.annotation.PreAuth;
|
|
|
import org.springblade.core.tenant.annotation.NonDS;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
-import org.springblade.core.tool.constant.RoleConstant;
|
|
|
import org.springblade.core.tool.utils.FileUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.resource.builder.oss.OssBuilder;
|
|
|
import org.springblade.resource.entity.Attach;
|
|
|
import org.springblade.resource.service.IAttachService;
|
|
|
+import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -55,6 +55,8 @@ public class OssEndpoint {
|
|
|
*/
|
|
|
private final IAttachService attachService;
|
|
|
|
|
|
+ private final ISysClient sysClient;
|
|
|
+
|
|
|
/**
|
|
|
* 创建存储桶
|
|
|
*
|
|
|
@@ -147,7 +149,16 @@ public class OssEndpoint {
|
|
|
BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
|
|
|
String link = bladeFile.getLink();
|
|
|
//String replace = link.replace("http://121.37.83.47:9000/", "https://trade.tubaosoft.com/file/");
|
|
|
- String replace = link.replace("http://121.37.83.47:9000/", "http://121.37.83.47/file/");
|
|
|
+ String status = sysClient.getParamService("upload.url");
|
|
|
+ System.out.println("link:" + link);
|
|
|
+ System.out.println("upload.url:" + status);
|
|
|
+ String replace = "";
|
|
|
+ if (ObjectUtils.isNotNull(status)) {
|
|
|
+ replace = link.replace(status + ":9000/", status + "/file/");
|
|
|
+ } else {
|
|
|
+ replace = link.replace("http://121.37.83.47:9000/", "http://121.37.83.47/file/");
|
|
|
+ }
|
|
|
+ System.out.println("replace:" + replace);
|
|
|
bladeFile.setLink(replace);
|
|
|
return R.data(bladeFile);
|
|
|
}
|
|
|
@@ -163,9 +174,15 @@ public class OssEndpoint {
|
|
|
public R<BladeFile> app_put(@RequestParam("file") MultipartFile file) {
|
|
|
BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
|
|
|
String link = bladeFile.getLink();
|
|
|
- System.out.println("link======>"+link);
|
|
|
- String replace = link.replace("http://121.37.83.47:9000/", "https://trade.re-king.cn/file/");
|
|
|
- System.out.println("replace======>"+replace);
|
|
|
+ System.out.println("link======>" + link);
|
|
|
+ String status = sysClient.getParamService("upload.url");
|
|
|
+ String replace = "";
|
|
|
+ if (ObjectUtils.isNotNull(status)) {
|
|
|
+ replace = link.replace(status + ":9000/", status + "/file/");
|
|
|
+ } else {
|
|
|
+ replace = link.replace("http://121.37.83.47:9000/", "https://trade.re-king.cn/file/");
|
|
|
+ }
|
|
|
+ System.out.println("replace======>" + replace);
|
|
|
bladeFile.setLink(replace);
|
|
|
return R.data(bladeFile);
|
|
|
}
|
|
|
@@ -182,7 +199,13 @@ public class OssEndpoint {
|
|
|
BladeFile bladeFile = ossBuilder.initTemplate(tenantId).putFile(file.getOriginalFilename(), file.getInputStream());
|
|
|
String link = bladeFile.getLink();
|
|
|
//String replace = link.replace("http://121.37.83.47:9000/", "https://trade.tubaosoft.com/file/");
|
|
|
- String replace = link.replace("http://121.37.83.47:9000/", "http://121.37.83.47/file/");
|
|
|
+ String status = sysClient.getParamService("upload.url");
|
|
|
+ String replace = "";
|
|
|
+ if (ObjectUtils.isNotNull(status)) {
|
|
|
+ replace = link.replace(status + ":9000/", status + "/file/");
|
|
|
+ } else {
|
|
|
+ replace = link.replace("http://121.37.83.47:9000/", "http://121.37.83.47/file/");
|
|
|
+ }
|
|
|
bladeFile.setLink(replace);
|
|
|
return R.data(bladeFile);
|
|
|
}
|