update 完成OSS模块页面功能

This commit is contained in:
疯狂的狮子li
2021-07-20 17:26:20 +08:00
parent a4c019ace2
commit ed197ce7ac
10 changed files with 107 additions and 64 deletions

View File

@ -12,7 +12,4 @@ public class CloudConstant {
*/
public final static String CLOUD_STORAGE_CONFIG_KEY = "sys.oss.cloudStorageService";
public final static String DEFAULT_CONTENT_TYPE = "application/octet-stream";
}

View File

@ -1,7 +1,6 @@
package com.ruoyi.oss.service.impl;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.oss.constant.CloudConstant;
import com.ruoyi.oss.entity.UploadResult;
import com.ruoyi.oss.enumd.CloudServiceEnumd;
import com.ruoyi.oss.enumd.PolicyType;
@ -14,6 +13,7 @@ import io.minio.*;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
@ -70,7 +70,7 @@ public class MinioCloudStorageServiceImpl extends AbstractCloudStorageService im
minioClient.putObject(PutObjectArgs.builder()
.bucket(properties.getBucketName())
.object(path)
.contentType(StrUtil.blankToDefault(contentType, CloudConstant.DEFAULT_CONTENT_TYPE))
.contentType(StrUtil.blankToDefault(contentType, MediaType.APPLICATION_OCTET_STREAM_VALUE))
.stream(inputStream, inputStream.available(), -1)
.build());
} catch (Exception e) {