mirror of https://gitee.com/stylefeng/roses
【7.1.6】【file】修复文件存储类型的错误
parent
e10eec144f
commit
a33b413456
|
@ -25,6 +25,7 @@
|
|||
package cn.stylefeng.roses.kernel.file.api;
|
||||
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -188,4 +189,12 @@ public interface FileOperatorApi {
|
|||
*/
|
||||
void deleteFile(String bucketName, String key);
|
||||
|
||||
/**
|
||||
* 获取当前api的文件存储类型
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/1/2 20:50
|
||||
*/
|
||||
FileLocationEnum getFileLocationEnum();
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileStatusEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
|
||||
|
@ -103,7 +102,7 @@ public class FileInfoFactory {
|
|||
// 封装存储文件信息(上传替换公共信息)
|
||||
SysFileInfo sysFileInfo = new SysFileInfo();
|
||||
sysFileInfo.setFileId(fileId);
|
||||
sysFileInfo.setFileLocation(FileLocationEnum.LOCAL.getCode());
|
||||
sysFileInfo.setFileLocation(fileOperatorApi.getFileLocationEnum().getCode());
|
||||
sysFileInfo.setFileBucket(fileBucket);
|
||||
sysFileInfo.setFileObjectName(finalFileName);
|
||||
sysFileInfo.setFileOriginName(originalFilename);
|
||||
|
|
|
@ -28,6 +28,7 @@ import cn.hutool.core.io.IoUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.pojo.props.AliyunOssProperties;
|
||||
|
@ -209,4 +210,9 @@ public class AliyunFileOperator implements FileOperatorApi {
|
|||
ossClient.deleteObject(bucketName, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileLocationEnum getFileLocationEnum() {
|
||||
return FileLocationEnum.ALIYUN;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
|||
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
|
||||
|
@ -199,4 +200,10 @@ public class LocalFileOperator implements FileOperatorApi {
|
|||
FileUtil.del(file);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileLocationEnum getFileLocationEnum() {
|
||||
return FileLocationEnum.LOCAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
|||
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
|
||||
|
@ -233,6 +234,11 @@ public class MinIoFileOperator implements FileOperatorApi {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileLocationEnum getFileLocationEnum() {
|
||||
return FileLocationEnum.MINIO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件后缀对应的contentType
|
||||
*
|
||||
|
|
|
@ -28,6 +28,7 @@ import cn.hutool.core.io.IoUtil;
|
|||
import cn.hutool.core.thread.ExecutorBuilder;
|
||||
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
|
||||
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
|
||||
|
@ -261,4 +262,9 @@ public class TenFileOperator implements FileOperatorApi {
|
|||
cosClient.deleteObject(bucketName, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileLocationEnum getFileLocationEnum() {
|
||||
return FileLocationEnum.TENCENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue