fix: 修复个人中心问题

This commit is contained in:
ray
2024-08-19 00:50:59 +08:00
parent fd3f889f56
commit dfccc03f48
6 changed files with 60 additions and 14 deletions

View File

@@ -14,7 +14,6 @@ import jakarta.annotation.PostConstruct;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@@ -30,7 +29,7 @@ import java.time.LocalDateTime;
* @since 2.3.0
*/
@Component
@ConditionalOnExpression("'${oss.enabled}' == 'true' and '${oss.type}' == 'aliyun'")
@ConditionalOnProperty(value = "oss.type", havingValue = "aliyun")
@ConfigurationProperties(prefix = "oss.aliyun")
@RequiredArgsConstructor
@Data

View File

@@ -14,7 +14,6 @@ import jakarta.annotation.PostConstruct;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@@ -33,7 +32,7 @@ import java.time.LocalDateTime;
* @since 2023/6/2
*/
@Component
@ConditionalOnExpression("'${oss.enabled}' == 'true' and '${oss.type}' == 'minio'")
@ConditionalOnProperty(value = "oss.enabled", havingValue = "true" )
@ConfigurationProperties(prefix = "oss.minio")
@RequiredArgsConstructor
@Data
@@ -69,8 +68,8 @@ public class MinioOssService implements OssService {
.endpoint(endpoint)
.credentials(accessKey, secretKey)
.build();
// 创建存储桶
createBucketIfAbsent(bucketName);
// 创建存储桶(存储桶不存在)
// createBucketIfAbsent(bucketName);
}
@@ -83,6 +82,9 @@ public class MinioOssService implements OssService {
@Override
public FileInfo uploadFile(MultipartFile file) {
// 创建存储桶(存储桶不存在)如果有搭建好的minio服务建议放在init方法中
createBucketIfAbsent(bucketName);
// 生成文件名(日期文件夹)
String suffix = FileUtil.getSuffix(file.getOriginalFilename());
String uuid = IdUtil.simpleUUID();