|
@@ -9,10 +9,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
-import java.io.ByteArrayInputStream;
|
|
|
|
|
-import java.io.InputStream;
|
|
|
|
|
-import java.util.Base64;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 阿里云图片上传工具类
|
|
* 阿里云图片上传工具类
|
|
|
* @author Qin
|
|
* @author Qin
|
|
@@ -36,15 +32,11 @@ public class OssUtils {
|
|
|
@Value("${aliyun.oss.dir}")
|
|
@Value("${aliyun.oss.dir}")
|
|
|
private String dir;
|
|
private String dir;
|
|
|
|
|
|
|
|
- private InputStream base64ToInputStream(String base64String) {
|
|
|
|
|
- byte[] bytes = Base64.getDecoder().decode(base64String);
|
|
|
|
|
- return new ByteArrayInputStream(bytes);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public VaultsResponse<String> uploadOneFile(MultipartFile dto,Long orderId) {
|
|
public VaultsResponse<String> uploadOneFile(MultipartFile dto,Long orderId) {
|
|
|
// 创建OSSClient实例。
|
|
// 创建OSSClient实例。
|
|
|
OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, secretAccessKey);
|
|
OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, secretAccessKey);
|
|
|
try {
|
|
try {
|
|
|
|
|
+ log.info("fileName==="+dto.getOriginalFilename());
|
|
|
//设置文件名
|
|
//设置文件名
|
|
|
Integer pos = dto.getOriginalFilename().lastIndexOf('.');
|
|
Integer pos = dto.getOriginalFilename().lastIndexOf('.');
|
|
|
String suffix = "";
|
|
String suffix = "";
|