feat: update
This commit is contained in:
@@ -87,7 +87,6 @@ public interface SchisandraAuthUserDomainService {
|
|||||||
* @author: landaiqing
|
* @author: landaiqing
|
||||||
* @date: 2024/5/26 17:27
|
* @date: 2024/5/26 17:27
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "userInfo", key = "#userId")
|
|
||||||
SchisandraAuthUserBO queryById(String userId);
|
SchisandraAuthUserBO queryById(String userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -167,12 +167,12 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
List<OssInfo> object = (List<OssInfo>) caffeineUtil.caffeineBuild().getIfPresent(userId + bucket + dirName);
|
List<OssInfo> object = (List<OssInfo>) caffeineUtil.caffeineBuild().getIfPresent("MinioListDir" + userId + bucket + dirName);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
return Result.ok(object);
|
return Result.ok(object);
|
||||||
} else {
|
} else {
|
||||||
List<OssInfo> list = bean.listDir(bucket, dirName);
|
List<OssInfo> list = bean.listDir(bucket, dirName);
|
||||||
caffeineUtil.caffeineBuild().put(userId + bucket + dirName, list);
|
caffeineUtil.caffeineBuild().put("MinioListDir" + userId + bucket + dirName, list);
|
||||||
return Result.ok(list);
|
return Result.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
Preconditions.checkNotNull(filePath, "不能为空");
|
Preconditions.checkNotNull(filePath, "不能为空");
|
||||||
int index = filePath.lastIndexOf("/");
|
int index = filePath.lastIndexOf("/");
|
||||||
String fileName = filePath.substring(index + 1);
|
String fileName = filePath.substring(0,index + 1);
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + fileName);
|
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + fileName);
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
@@ -255,14 +255,15 @@ public class SchisandraOssMinioController {
|
|||||||
String path = schisandraOssMinioDTO.getPath();
|
String path = schisandraOssMinioDTO.getPath();
|
||||||
String bucket = schisandraOssMinioDTO.getBucketName();
|
String bucket = schisandraOssMinioDTO.getBucketName();
|
||||||
String userId = schisandraOssMinioDTO.getUserId();
|
String userId = schisandraOssMinioDTO.getUserId();
|
||||||
Preconditions.checkNotNull(path, "path不能为空");
|
|
||||||
Preconditions.checkNotNull(bucket, "bucket不能为空");
|
Preconditions.checkNotNull(bucket, "bucket不能为空");
|
||||||
Preconditions.checkNotNull(userId, "userId不能为空");
|
Preconditions.checkNotNull(userId, "userId不能为空");
|
||||||
if (path.lastIndexOf("") == path.length() - 1) {
|
if (path == null || "".equals(path)) {
|
||||||
path = path + file.getName();
|
path = "/";
|
||||||
} else {
|
}
|
||||||
|
if (path.lastIndexOf("/") < path.length() - 1) {
|
||||||
path = path + "/" + file.getOriginalFilename();
|
path = path + "/" + file.getOriginalFilename();
|
||||||
}
|
}
|
||||||
|
path=path+file.getOriginalFilename();
|
||||||
// 获取文件输入流
|
// 获取文件输入流
|
||||||
InputStream is = file.getInputStream();
|
InputStream is = file.getInputStream();
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
|
@@ -1,60 +1,60 @@
|
|||||||
package com.schisandra.oss.application.oss.constant;
|
package com.schisandra.oss.application.oss.constant;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author landaiqing
|
* @author landaiqing
|
||||||
*/
|
*/
|
||||||
public class OssConstant {
|
public class OssConstant {
|
||||||
|
|
||||||
public static final String OSS = "oss";
|
public static final String OSS = "oss";
|
||||||
public static final String ENABLE = "enable";
|
public static final String ENABLE = "enable";
|
||||||
public static final String DEFAULT_ENABLE_VALUE = "true";
|
public static final String DEFAULT_ENABLE_VALUE = "true";
|
||||||
|
|
||||||
public static final int KB = 1024;
|
public static final int KB = 1024;
|
||||||
|
|
||||||
public static final int MB = 1024 * KB;
|
public static final int MB = 1024 * KB;
|
||||||
/**
|
/**
|
||||||
* 默认分片大小
|
* 默认分片大小
|
||||||
*/
|
*/
|
||||||
public static final Long DEFAULT_PART_SIZE = 5L * MB;
|
public static final Long DEFAULT_PART_SIZE = 5L * MB;
|
||||||
/**
|
/**
|
||||||
* 默认缓冲区大小
|
* 默认缓冲区大小
|
||||||
*/
|
*/
|
||||||
public static final int DEFAULT_BUFFER_SIZE = 8 * KB;
|
public static final int DEFAULT_BUFFER_SIZE = 8 * KB;
|
||||||
/**
|
/**
|
||||||
* 默认最大分片数
|
* 默认最大分片数
|
||||||
*/
|
*/
|
||||||
public static final Long DEFAULT_PART_NUM = 10000L;
|
public static final Long DEFAULT_PART_NUM = 10000L;
|
||||||
/**
|
/**
|
||||||
* 默认并发线程数
|
* 默认并发线程数
|
||||||
*/
|
*/
|
||||||
public static final Integer DEFAULT_TASK_NUM = Runtime.getRuntime().availableProcessors();
|
public static final Integer DEFAULT_TASK_NUM = Runtime.getRuntime().availableProcessors();
|
||||||
|
|
||||||
public static final Long DEFAULT_CONNECTION_TIMEOUT = TimeUnit.MINUTES.toMillis(5);
|
public static final Long DEFAULT_CONNECTION_TIMEOUT = TimeUnit.MINUTES.toMillis(10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OSS存储类型
|
* OSS存储类型
|
||||||
*/
|
*/
|
||||||
public interface OssType {
|
public interface OssType {
|
||||||
String LOCAL = "local";
|
String LOCAL = "local";
|
||||||
String FTP = "ftp";
|
String FTP = "ftp";
|
||||||
String SFTP = "sftp";
|
String SFTP = "sftp";
|
||||||
String ALI = "ali";
|
String ALI = "ali";
|
||||||
String QINIU = "qiniu";
|
String QINIU = "qiniu";
|
||||||
String MINIO = "minio";
|
String MINIO = "minio";
|
||||||
String BAIDU = "baidu";
|
String BAIDU = "baidu";
|
||||||
String TENCENT = "tencent";
|
String TENCENT = "tencent";
|
||||||
String HUAWEI = "huawei";
|
String HUAWEI = "huawei";
|
||||||
String JD = "jd";
|
String JD = "jd";
|
||||||
String UP = "up";
|
String UP = "up";
|
||||||
String JINSHAN = "jinshan";
|
String JINSHAN = "jinshan";
|
||||||
String WANGYI = "wangyi";
|
String WANGYI = "wangyi";
|
||||||
String UCLOUD = "ucloud";
|
String UCLOUD = "ucloud";
|
||||||
String PINGAN = "pingan";
|
String PINGAN = "pingan";
|
||||||
String QINGYUN = "qingyun";
|
String QINGYUN = "qingyun";
|
||||||
String JDBC = "jdbc";
|
String JDBC = "jdbc";
|
||||||
String AWS = "aws";
|
String AWS = "aws";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,52 +1,52 @@
|
|||||||
package com.schisandra.oss.application.oss.core.minio.model;
|
package com.schisandra.oss.application.oss.core.minio.model;
|
||||||
|
|
||||||
import com.schisandra.oss.application.oss.constant.OssConstant;
|
import com.schisandra.oss.application.oss.constant.OssConstant;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.context.annotation.ScopedProxyMode;
|
import org.springframework.context.annotation.ScopedProxyMode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author landaiqing
|
* @author landaiqing
|
||||||
* @version MinioOssClientConfig.java, v 1.0 2022/3/24 9:59 chenmin Exp $
|
* @version MinioOssClientConfig.java, v 1.0 2022/3/24 9:59 chenmin Exp $
|
||||||
* Created on 2022/3/24
|
* Created on 2022/3/24
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class MinioOssClientConfig implements Serializable {
|
public class MinioOssClientConfig implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 连接超时时间(单位:毫秒)
|
* 连接超时时间(单位:毫秒)
|
||||||
*/
|
*/
|
||||||
private Long connectTimeout = OssConstant.DEFAULT_CONNECTION_TIMEOUT;
|
private Long connectTimeout = OssConstant.DEFAULT_CONNECTION_TIMEOUT;
|
||||||
/**
|
/**
|
||||||
* 写超时时间(单位:毫秒)
|
* 写超时时间(单位:毫秒)
|
||||||
*/
|
*/
|
||||||
private Long writeTimeout = OssConstant.DEFAULT_CONNECTION_TIMEOUT;
|
private Long writeTimeout = OssConstant.DEFAULT_CONNECTION_TIMEOUT;
|
||||||
/**
|
/**
|
||||||
* 读超时时间(单位:毫秒)
|
* 读超时时间(单位:毫秒)
|
||||||
*/
|
*/
|
||||||
private Long readTimeout = OssConstant.DEFAULT_CONNECTION_TIMEOUT;
|
private Long readTimeout = OssConstant.DEFAULT_CONNECTION_TIMEOUT;
|
||||||
/**
|
/**
|
||||||
* 调用超时时间(单位:毫秒)
|
* 调用超时时间(单位:毫秒)
|
||||||
*/
|
*/
|
||||||
private Long callTimeout = (long) Integer.MAX_VALUE;
|
private Long callTimeout = (long) Integer.MAX_VALUE;
|
||||||
/**
|
/**
|
||||||
* 是否支持重定向,默认支持
|
* 是否支持重定向,默认支持
|
||||||
*/
|
*/
|
||||||
private boolean followRedirects = true;
|
private boolean followRedirects = true;
|
||||||
/**
|
/**
|
||||||
* 是否支持HTTP到HTTPS,HTTPS到HTTP的重定向,默认支持
|
* 是否支持HTTP到HTTPS,HTTPS到HTTP的重定向,默认支持
|
||||||
*/
|
*/
|
||||||
private boolean followSslRedirects = true;
|
private boolean followSslRedirects = true;
|
||||||
/**
|
/**
|
||||||
* 是否开始连接失败重试,默认不支持
|
* 是否开始连接失败重试,默认不支持
|
||||||
*/
|
*/
|
||||||
private boolean retryOnConnectionFailure = false;
|
private boolean retryOnConnectionFailure = true;
|
||||||
/**
|
/**
|
||||||
* 连接健康检测间隔时长(单位:毫秒)
|
* 连接健康检测间隔时长(单位:毫秒)
|
||||||
*/
|
*/
|
||||||
private int pingInterval;
|
private int pingInterval;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
server:
|
server:
|
||||||
port: 4000
|
port: 4000
|
||||||
spring:
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB # 设置单个文件最大大小为10MB
|
||||||
|
max-request-size: 100MB # 设置多个文件大小为100MB
|
||||||
datasource:
|
datasource:
|
||||||
username: root
|
username: root
|
||||||
password: BZbVbGDBePiA2q8/mt0eMxKNpHniDzxBtOxFadQiAOTDzCDlopC4qOKwwBEi9CAZcuFsCrRJdwn0wP6jwsnzxw==
|
password: BZbVbGDBePiA2q8/mt0eMxKNpHniDzxBtOxFadQiAOTDzCDlopC4qOKwwBEi9CAZcuFsCrRJdwn0wP6jwsnzxw==
|
||||||
|
Reference in New Issue
Block a user