mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-10 08:57:19 +08:00
chore(storage): 优化部分代码格式和注释
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
package top.continew.starter.storage.constant;
|
||||
|
||||
/**
|
||||
* 存储 常量
|
||||
* 存储常量
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/16 19:09
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class StorageConstant {
|
||||
|
||||
|
@@ -22,7 +22,7 @@ import top.continew.starter.storage.model.resp.UploadResp;
|
||||
* 存储记录持久层接口
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/17 16:49
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public interface StorageDao {
|
||||
|
||||
|
@@ -20,14 +20,15 @@ import top.continew.starter.storage.dao.StorageDao;
|
||||
import top.continew.starter.storage.model.resp.UploadResp;
|
||||
|
||||
/**
|
||||
* 默认记录实现,此类并不能真正保存记录,只是用来脱离数据库运行,保证文件上传功能可以正常使用
|
||||
* 存储记录持久层接口默认实现
|
||||
* <p>此类并不能真正保存记录,只是用来脱离数据库运行,保证文件上传功能可以正常使用</p>
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/18 08:48
|
||||
**/
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class StorageDaoDefaultImpl implements StorageDao {
|
||||
|
||||
@Override
|
||||
public void add(UploadResp uploadResp) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -23,10 +23,10 @@ import top.continew.starter.storage.strategy.StorageStrategy;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 装饰器基类 - 用于重写
|
||||
* 装饰器基类
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/30 19:33
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public abstract class AbstractStorageDecorator<C> implements StorageStrategy<C> {
|
||||
|
||||
|
@@ -27,9 +27,9 @@ import java.util.List;
|
||||
* 文件类型枚举
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2023/12/23 13:38
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public enum FileTypeEnum implements BaseEnum<Integer> {
|
||||
public enum FileType implements BaseEnum<Integer> {
|
||||
|
||||
/**
|
||||
* 其他
|
||||
@@ -67,14 +67,14 @@ public enum FileTypeEnum implements BaseEnum<Integer> {
|
||||
* @param extension 扩展名
|
||||
* @return 文件类型
|
||||
*/
|
||||
public static FileTypeEnum getByExtension(String extension) {
|
||||
return Arrays.stream(FileTypeEnum.values())
|
||||
public static FileType getByExtension(String extension) {
|
||||
return Arrays.stream(FileType.values())
|
||||
.filter(t -> t.getExtensions().contains(StrUtil.emptyIfNull(extension).toLowerCase()))
|
||||
.findFirst()
|
||||
.orElse(FileTypeEnum.UNKNOWN);
|
||||
.orElse(FileType.UNKNOWN);
|
||||
}
|
||||
|
||||
FileTypeEnum(Integer value, String description, List<String> extensions) {
|
||||
FileType(Integer value, String description, List<String> extensions) {
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
this.extensions = extensions;
|
||||
@@ -98,5 +98,4 @@ public enum FileTypeEnum implements BaseEnum<Integer> {
|
||||
public String getColor() {
|
||||
return BaseEnum.super.getColor();
|
||||
}
|
||||
|
||||
}
|
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 存储策略管理器
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/16
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class StorageManager {
|
||||
|
||||
@@ -64,7 +64,7 @@ public class StorageManager {
|
||||
*/
|
||||
public static StorageStrategy<?> instance(String code) {
|
||||
StorageStrategy<?> strategy = STORAGE_STRATEGY.get(code);
|
||||
ValidationUtils.throwIfEmpty(strategy, "未找到存储配置:" + code);
|
||||
ValidationUtils.throwIfEmpty(strategy, "未找到存储配置: {}", code);
|
||||
return strategy;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ package top.continew.starter.storage.model.resp;
|
||||
* 缩略图
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/20 17:00
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class ThumbnailResp {
|
||||
|
||||
|
@@ -22,7 +22,7 @@ import java.time.LocalDateTime;
|
||||
* 上传结果
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/10
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class UploadResp {
|
||||
|
||||
|
@@ -25,7 +25,7 @@ import java.io.InputStream;
|
||||
* 存储策略接口
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/16 11:19
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public interface StorageStrategy<C> {
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface StorageStrategy<C> {
|
||||
/**
|
||||
* 创建桶
|
||||
* <p> S3: 创建桶 </p>
|
||||
* <p> local: 创建 默认路径下 指定文件夹 </p>
|
||||
* <p> local: 在默认路径下创建指定文件夹 </p>
|
||||
*
|
||||
* @param bucketName 桶名称
|
||||
*/
|
||||
|
@@ -27,7 +27,7 @@ import java.io.OutputStream;
|
||||
* 图像缩略图工具
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/20 16:49
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class ImageThumbnailUtils {
|
||||
|
||||
|
@@ -34,7 +34,7 @@ import java.time.format.DateTimeFormatter;
|
||||
* 储存工具
|
||||
*
|
||||
* @author echo
|
||||
* @date 2024/12/16 19:55
|
||||
* @since 2.9.0
|
||||
*/
|
||||
public class StorageUtils {
|
||||
public StorageUtils() {
|
||||
|
Reference in New Issue
Block a user