yangzian 3 years ago
parent
commit
3d13da137a

+ 7 - 0
jeecg-boot-base/jeecg-boot-base-core/pom.xml

@@ -240,6 +240,13 @@
 			<version>2.8.6</version>
 		</dependency>
 
+		<!-- aliyun oss -->
+		<dependency>
+			<groupId>com.aliyun.oss</groupId>
+			<artifactId>aliyun-sdk-oss</artifactId>
+			<version>${aliyun.oss.version}</version>
+		</dependency>
+
 	</dependencies>
 
 </project>

+ 60 - 44
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/CommonUtils.java

@@ -1,13 +1,18 @@
 package org.jeecg.common.util;
 
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.DataBaseConstant;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.common.util.oss.OssBootUtil;
+import org.jeecgframework.poi.util.PoiPublicUtil;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.sql.DataSource;
+import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.IOException;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.SQLException;
@@ -20,6 +25,35 @@ public class CommonUtils {
    //中文正则
     private static Pattern ZHONGWEN_PATTERN = Pattern.compile("[\u4e00-\u9fa5]");
 
+    public static String uploadOnlineImage(byte[] data,String basePath,String bizPath,String uploadType){
+        String dbPath = null;
+        String fileName = "image" + Math.round(Math.random() * 100000000000L);
+        fileName += "." + PoiPublicUtil.getFileExtendName(data);
+        try {
+            if(CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
+                File file = new File(basePath + File.separator + bizPath + File.separator );
+                if (!file.exists()) {
+                    file.mkdirs();// 创建文件根目录
+                }
+                String savePath = file.getPath() + File.separator + fileName;
+                File savefile = new File(savePath);
+                FileCopyUtils.copy(data, savefile);
+                dbPath = bizPath + File.separator + fileName;
+            }else {
+                InputStream in = new ByteArrayInputStream(data);
+                String relativePath = bizPath+"/"+fileName;
+                if(CommonConstant.UPLOAD_TYPE_MINIO.equals(uploadType)){
+                    dbPath = MinioUtil.upload(in,relativePath);
+                }else if(CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)){
+                    dbPath = OssBootUtil.upload(in,relativePath);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dbPath;
+    }
+
     /**
      * 判断文件名是否带盘符,重新处理
      * @param fileName
@@ -38,8 +72,7 @@ public class CommonUtils {
             fileName = fileName.substring(pos + 1);
         }
         //替换上传文件名字的特殊字符
-        fileName = fileName.replace("=","").replace(",","").replace("&","")
-                .replace("#", "").replace("“", "").replace("”", "");
+        fileName = fileName.replace("=","").replace(",","").replace("&","").replace("#", "");
         //替换上传文件名字中的空格
         fileName=fileName.replaceAll("\\s","");
         return fileName;
@@ -58,47 +91,33 @@ public class CommonUtils {
         }
     }
 
-
     /**
-     * 本地文件上传
-     * @param mf 文件
-     * @param bizPath  自定义路径
-     * @return
+     * 统一全局上传
+     * @Return: java.lang.String
      */
-    public static String uploadLocal(MultipartFile mf,String bizPath,String uploadpath){
-        try {
-            String fileName = null;
-            File file = new File(uploadpath + File.separator + bizPath + File.separator );
-            if (!file.exists()) {
-                file.mkdirs();// 创建文件根目录
-            }
-            String orgName = mf.getOriginalFilename();// 获取文件名
-            orgName = CommonUtils.getFileName(orgName);
-            if(orgName.indexOf(".")!=-1){
-                fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
-            }else{
-                fileName = orgName+ "_" + System.currentTimeMillis();
-            }
-            String savePath = file.getPath() + File.separator + fileName;
-            File savefile = new File(savePath);
-            FileCopyUtils.copy(mf.getBytes(), savefile);
-            String dbpath = null;
-            if(oConvertUtils.isNotEmpty(bizPath)){
-                dbpath = bizPath + File.separator + fileName;
-            }else{
-                dbpath = fileName;
-            }
-            if (dbpath.contains("\\")) {
-                dbpath = dbpath.replace("\\", "/");
-            }
-            return dbpath;
-        } catch (IOException e) {
-            log.error(e.getMessage(), e);
+    public static String upload(MultipartFile file, String bizPath, String uploadType) {
+        String url = "";
+        if(CommonConstant.UPLOAD_TYPE_MINIO.equals(uploadType)){
+            url = MinioUtil.upload(file,bizPath);
+        }else{
+            url = OssBootUtil.upload(file,bizPath);
         }
-        return "";
+        return url;
     }
 
-
+    /**
+     * 统一全局上传 带桶
+     * @Return: java.lang.String
+     */
+    public static String upload(MultipartFile file, String bizPath, String uploadType, String customBucket) {
+        String url = "";
+        if(CommonConstant.UPLOAD_TYPE_MINIO.equals(uploadType)){
+            url = MinioUtil.upload(file,bizPath,customBucket);
+        }else{
+            url = OssBootUtil.upload(file,bizPath,customBucket);
+        }
+        return url;
+    }
 
     /** 当前系统数据库类型 */
     private static String DB_TYPE = "";
@@ -111,7 +130,7 @@ public class CommonUtils {
             return getDatabaseTypeByDataSource(dataSource);
         } catch (SQLException e) {
             //e.printStackTrace();
-            log.warn(e.getMessage(),e);
+            log.warn(e.getMessage());
             return "";
         }
     }
@@ -136,11 +155,8 @@ public class CommonUtils {
                     DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
                 }else if(dbType.indexOf("postgresql")>=0) {
                     DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
-                }else if(dbType.indexOf("mariadb")>=0) {
-                    DB_TYPE = DataBaseConstant.DB_TYPE_MARIADB;
                 }else {
-                    log.error("数据库类型:[" + dbType + "]不识别!");
-                    //throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
+                    throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
                 }
             } catch (Exception e) {
                 log.error(e.getMessage(), e);

+ 209 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java

@@ -0,0 +1,209 @@
+package org.jeecg.common.util;
+
+import io.minio.*;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.filter.StrAttackFilter;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.InputStream;
+import java.net.URLDecoder;
+
+/**
+ * minio文件上传工具类
+ */
+@Slf4j
+public class MinioUtil {
+    private static String minioUrl;
+    private static String minioName;
+    private static String minioPass;
+    private static String bucketName;
+
+    public static void setMinioUrl(String minioUrl) {
+        MinioUtil.minioUrl = minioUrl;
+    }
+
+    public static void setMinioName(String minioName) {
+        MinioUtil.minioName = minioName;
+    }
+
+    public static void setMinioPass(String minioPass) {
+        MinioUtil.minioPass = minioPass;
+    }
+
+    public static void setBucketName(String bucketName) {
+        MinioUtil.bucketName = bucketName;
+    }
+
+    public static String getMinioUrl() {
+        return minioUrl;
+    }
+
+    public static String getBucketName() {
+        return bucketName;
+    }
+
+    private static MinioClient minioClient = null;
+
+    /**
+     * 上传文件
+     * @param file
+     * @return
+     */
+    public static String upload(MultipartFile file, String bizPath, String customBucket) {
+        String file_url = "";
+        //update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
+        bizPath=StrAttackFilter.filter(bizPath);
+        //update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
+        String newBucket = bucketName;
+        if(oConvertUtils.isNotEmpty(customBucket)){
+            newBucket = customBucket;
+        }
+        try {
+            initMinio(minioUrl, minioName,minioPass);
+            // 检查存储桶是否已经存在
+            if(minioClient.bucketExists(BucketExistsArgs.builder().bucket(newBucket).build())) {
+                log.info("Bucket already exists.");
+            } else {
+                // 创建一个名为ota的存储桶
+                minioClient.makeBucket(MakeBucketArgs.builder().bucket(newBucket).build());
+                log.info("create a new bucket.");
+            }
+            InputStream stream = file.getInputStream();
+            // 获取文件名
+            String orgName = file.getOriginalFilename();
+            if("".equals(orgName)){
+                orgName=file.getName();
+            }
+            orgName = CommonUtils.getFileName(orgName);
+            String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
+
+            // 使用putObject上传一个本地文件到存储桶中。
+            if(objectName.startsWith("/")){
+                objectName = objectName.substring(1);
+            }
+            PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName)
+                    .bucket(newBucket)
+                    .contentType("application/octet-stream")
+                    .stream(stream,stream.available(),-1).build();
+            minioClient.putObject(objectArgs);
+            stream.close();
+            file_url = minioUrl+newBucket+"/"+objectName;
+        }catch (Exception e){
+            log.error(e.getMessage(), e);
+        }
+        return file_url;
+    }
+
+    /**
+     * 文件上传
+     * @param file
+     * @param bizPath
+     * @return
+     */
+    public static String upload(MultipartFile file, String bizPath) {
+        return  upload(file,bizPath,null);
+    }
+
+    /**
+     * 获取文件流
+     * @param bucketName
+     * @param objectName
+     * @return
+     */
+    public static InputStream getMinioFile(String bucketName,String objectName){
+        InputStream inputStream = null;
+        try {
+            initMinio(minioUrl, minioName, minioPass);
+            GetObjectArgs objectArgs = GetObjectArgs.builder().object(objectName)
+                    .bucket(bucketName).build();
+            inputStream = minioClient.getObject(objectArgs);
+        } catch (Exception e) {
+            log.info("文件获取失败" + e.getMessage());
+        }
+        return inputStream;
+    }
+
+    /**
+     * 删除文件
+     * @param bucketName
+     * @param objectName
+     * @throws Exception
+     */
+    public static void removeObject(String bucketName, String objectName) {
+        try {
+            initMinio(minioUrl, minioName,minioPass);
+            RemoveObjectArgs objectArgs = RemoveObjectArgs.builder().object(objectName)
+                    .bucket(bucketName).build();
+            minioClient.removeObject(objectArgs);
+        }catch (Exception e){
+            log.info("文件删除失败" + e.getMessage());
+        }
+    }
+
+    /**
+     * 获取文件外链
+     * @param bucketName
+     * @param objectName
+     * @param expires
+     * @return
+     */
+    public static String getObjectURL(String bucketName, String objectName, Integer expires) {
+        initMinio(minioUrl, minioName,minioPass);
+        try{
+            GetPresignedObjectUrlArgs objectArgs = GetPresignedObjectUrlArgs.builder().object(objectName)
+                    .bucket(bucketName)
+                    .expiry(expires).build();
+            String url = minioClient.getPresignedObjectUrl(objectArgs);
+            return URLDecoder.decode(url,"UTF-8");
+        }catch (Exception e){
+            log.info("文件路径获取失败" + e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * 初始化客户端
+     * @param minioUrl
+     * @param minioName
+     * @param minioPass
+     * @return
+     */
+    private static MinioClient initMinio(String minioUrl, String minioName,String minioPass) {
+        if (minioClient == null) {
+            try {
+                minioClient = MinioClient.builder()
+                        .endpoint(minioUrl)
+                        .credentials(minioName, minioPass)
+                        .build();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return minioClient;
+    }
+
+    /**
+     * 上传文件到minio
+     * @param stream
+     * @param relativePath
+     * @return
+     */
+    public static String upload(InputStream stream,String relativePath) throws Exception {
+        initMinio(minioUrl, minioName,minioPass);
+        if(minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {
+            log.info("Bucket already exists.");
+        } else {
+            // 创建一个名为ota的存储桶
+            minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
+            log.info("create a new bucket.");
+        }
+        PutObjectArgs objectArgs = PutObjectArgs.builder().object(relativePath)
+                .bucket(bucketName)
+                .contentType("application/octet-stream")
+                .stream(stream,stream.available(),-1).build();
+        minioClient.putObject(objectArgs);
+        stream.close();
+        return minioUrl+bucketName+"/"+relativePath;
+    }
+
+}

+ 329 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java

@@ -0,0 +1,329 @@
+package org.jeecg.common.util.oss;
+
+import com.aliyun.oss.ClientConfiguration;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.common.auth.DefaultCredentialProvider;
+import com.aliyun.oss.model.CannedAccessControlList;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.PutObjectResult;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.tomcat.util.http.fileupload.FileItemStream;
+import org.jeecg.common.util.CommonUtils;
+import org.jeecg.common.util.filter.StrAttackFilter;
+import org.jeecg.common.util.oConvertUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ * @Description: 阿里云 oss 上传工具类(高依赖版)
+ * @Date: 2019/5/10
+ */
+@Slf4j
+public class OssBootUtil {
+
+    private static String endPoint;
+    private static String accessKeyId;
+    private static String accessKeySecret;
+    private static String bucketName;
+    private static String staticDomain;
+
+    public static void setEndPoint(String endPoint) {
+        OssBootUtil.endPoint = endPoint;
+    }
+
+    public static void setAccessKeyId(String accessKeyId) {
+        OssBootUtil.accessKeyId = accessKeyId;
+    }
+
+    public static void setAccessKeySecret(String accessKeySecret) {
+        OssBootUtil.accessKeySecret = accessKeySecret;
+    }
+
+    public static void setBucketName(String bucketName) {
+        OssBootUtil.bucketName = bucketName;
+    }
+
+    public static void setStaticDomain(String staticDomain) {
+        OssBootUtil.staticDomain = staticDomain;
+    }
+
+    public static String getStaticDomain() {
+        return staticDomain;
+    }
+
+    public static String getEndPoint() {
+        return endPoint;
+    }
+
+    public static String getAccessKeyId() {
+        return accessKeyId;
+    }
+
+    public static String getAccessKeySecret() {
+        return accessKeySecret;
+    }
+
+    public static String getBucketName() {
+        return bucketName;
+    }
+
+    public static OSSClient getOssClient() {
+        return ossClient;
+    }
+
+    /**
+     * oss 工具客户端
+     */
+    private static OSSClient ossClient = null;
+
+    /**
+     * 上传文件至阿里云 OSS
+     * 文件上传成功,返回文件完整访问路径
+     * 文件上传失败,返回 null
+     *
+     * @param file    待上传文件
+     * @param fileDir 文件保存目录
+     * @return oss 中的相对文件路径
+     */
+    public static String upload(MultipartFile file, String fileDir,String customBucket) {
+        String FILE_URL = null;
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        StringBuilder fileUrl = new StringBuilder();
+        String newBucket = bucketName;
+        if(oConvertUtils.isNotEmpty(customBucket)){
+            newBucket = customBucket;
+        }
+        try {
+            //判断桶是否存在,不存在则创建桶
+            if(!ossClient.doesBucketExist(newBucket)){
+                ossClient.createBucket(newBucket);
+            }
+            // 获取文件名
+            String orgName = file.getOriginalFilename();
+            if("" == orgName){
+              orgName=file.getName();
+            }
+            orgName = CommonUtils.getFileName(orgName);
+            String fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
+            if (!fileDir.endsWith("/")) {
+                fileDir = fileDir.concat("/");
+            }
+            //update-begin-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
+            fileDir=StrAttackFilter.filter(fileDir);
+            //update-end-author:wangshuai date:20201012 for: 过滤上传文件夹名特殊字符,防止攻击
+            fileUrl = fileUrl.append(fileDir + fileName);
+
+            if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+                FILE_URL = staticDomain + "/" + fileUrl;
+            } else {
+                FILE_URL = "https://" + newBucket + "." + endPoint + "/" + fileUrl;
+            }
+            PutObjectResult result = ossClient.putObject(newBucket, fileUrl.toString(), file.getInputStream());
+            // 设置权限(公开读)
+//            ossClient.setBucketAcl(newBucket, CannedAccessControlList.PublicRead);
+            if (result != null) {
+                log.info("------OSS文件上传成功------" + fileUrl);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        return FILE_URL;
+    }
+
+    /**
+     * 获取原始URL
+    * @param url: 原始URL
+    * @Return: java.lang.String
+    */
+    public static String getOriginalUrl(String url) {
+        String originalDomain = "https://" + bucketName + "." + endPoint;
+        if(url.indexOf(staticDomain)!=-1){
+            url = url.replace(staticDomain,originalDomain);
+        }
+        return url;
+    }
+
+    /**
+     * 文件上传
+     * @param file
+     * @param fileDir
+     * @return
+     */
+    public static String upload(MultipartFile file, String fileDir) {
+        return upload(file, fileDir,null);
+    }
+
+    /**
+     * 上传文件至阿里云 OSS
+     * 文件上传成功,返回文件完整访问路径
+     * 文件上传失败,返回 null
+     *
+     * @param file    待上传文件
+     * @param fileDir 文件保存目录
+     * @return oss 中的相对文件路径
+     */
+    public static String upload(FileItemStream file, String fileDir) {
+        String FILE_URL = null;
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        StringBuilder fileUrl = new StringBuilder();
+        try {
+            String suffix = file.getName().substring(file.getName().lastIndexOf('.'));
+            String fileName = UUID.randomUUID().toString().replace("-", "") + suffix;
+            if (!fileDir.endsWith("/")) {
+                fileDir = fileDir.concat("/");
+            }
+            fileDir = StrAttackFilter.filter(fileDir);
+            fileUrl = fileUrl.append(fileDir + fileName);
+            if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+                FILE_URL = staticDomain + "/" + fileUrl;
+            } else {
+                FILE_URL = "https://" + bucketName + "." + endPoint + "/" + fileUrl;
+            }
+            PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(), file.openStream());
+            // 设置权限(公开读)
+            ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
+            if (result != null) {
+                log.info("------OSS文件上传成功------" + fileUrl);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        return FILE_URL;
+    }
+
+    /**
+     * 删除文件
+     * @param url
+     */
+    public static void deleteUrl(String url) {
+        deleteUrl(url,null);
+    }
+
+    /**
+     * 删除文件
+     * @param url
+     */
+    public static void deleteUrl(String url,String bucket) {
+        String newBucket = bucketName;
+        if(oConvertUtils.isNotEmpty(bucket)){
+            newBucket = bucket;
+        }
+        String bucketUrl = "";
+        if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+            bucketUrl = staticDomain + "/" ;
+        } else {
+            bucketUrl = "https://" + newBucket + "." + endPoint + "/";
+        }
+        url = url.replace(bucketUrl,"");
+        ossClient.deleteObject(newBucket, url);
+    }
+
+    /**
+     * 删除文件
+     * @param fileName
+     */
+    public static void delete(String fileName) {
+        ossClient.deleteObject(bucketName, fileName);
+    }
+
+    /**
+     * 获取文件流
+     * @param objectName
+     * @param bucket
+     * @return
+     */
+    public static InputStream getOssFile(String objectName,String bucket){
+        InputStream inputStream = null;
+        try{
+            String newBucket = bucketName;
+            if(oConvertUtils.isNotEmpty(bucket)){
+                newBucket = bucket;
+            }
+            initOSS(endPoint, accessKeyId, accessKeySecret);
+            OSSObject ossObject = ossClient.getObject(newBucket,objectName);
+            inputStream = new BufferedInputStream(ossObject.getObjectContent());
+        }catch (Exception e){
+            log.info("文件获取失败" + e.getMessage());
+        }
+        return inputStream;
+    }
+
+    /**
+     * 获取文件流
+     * @param objectName
+     * @return
+     */
+    public static InputStream getOssFile(String objectName){
+        return getOssFile(objectName,null);
+    }
+
+    /**
+     * 获取文件外链
+     * @param bucketName
+     * @param objectName
+     * @param expires
+     * @return
+     */
+    public static String getObjectURL(String bucketName, String objectName, Date expires) {
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        try{
+            if(ossClient.doesObjectExist(bucketName,objectName)){
+                URL url = ossClient.generatePresignedUrl(bucketName,objectName,expires);
+                return URLDecoder.decode(url.toString(),"UTF-8");
+            }
+        }catch (Exception e){
+            log.info("文件路径获取失败" + e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * 初始化 oss 客户端
+     *
+     * @return
+     */
+    private static OSSClient initOSS(String endpoint, String accessKeyId, String accessKeySecret) {
+        if (ossClient == null) {
+            ossClient = new OSSClient(endpoint,
+                    new DefaultCredentialProvider(accessKeyId, accessKeySecret),
+                    new ClientConfiguration());
+        }
+        return ossClient;
+    }
+
+
+    /**
+     * 上传文件到oss
+     * @param stream
+     * @param relativePath
+     * @return
+     */
+    public static String upload(InputStream stream, String relativePath) {
+        String FILE_URL = null;
+        String fileUrl = relativePath;
+        initOSS(endPoint, accessKeyId, accessKeySecret);
+        if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) {
+            FILE_URL = staticDomain + "/" + relativePath;
+        } else {
+            FILE_URL = "https://" + bucketName + "." + endPoint + "/" + fileUrl;
+        }
+        PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(),stream);
+        // 设置权限(公开读)
+        ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
+        if (result != null) {
+            log.info("------OSS文件上传成功------" + fileUrl);
+        }
+        return FILE_URL;
+    }
+
+
+}