diff --git a/minio-plus-model/pom.xml b/minio-plus-api/pom.xml similarity index 93% rename from minio-plus-model/pom.xml rename to minio-plus-api/pom.xml index 325d9be58..ad91d41b2 100644 --- a/minio-plus-model/pom.xml +++ b/minio-plus-api/pom.xml @@ -9,7 +9,8 @@ 4.0.0 - minio-plus-model + minio-plus-api + jar diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/StorageService.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/StorageService.java similarity index 75% rename from minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/StorageService.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/StorageService.java index 83037f7b8..906b0dc8d 100644 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/StorageService.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/StorageService.java @@ -1,34 +1,26 @@ -package org.liuxp.minioplus.core.service; +package org.liuxp.minioplus.api; import cn.hutool.core.lang.Pair; -import org.liuxp.minioplus.model.dto.FileMetadataInfoDTO; -import org.liuxp.minioplus.model.dto.FileSaveDTO; -import org.liuxp.minioplus.model.vo.FileMetadataInfoVo; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoDTO; +import org.liuxp.minioplus.api.model.dto.FileSaveDTO; +import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo; import java.io.InputStream; import java.util.List; /** - * 存储组件Service层公共方法 - * 本类的方法是给后端业务研发提供的公共方法,后端业务研发可以@Resources引用本类使用 + * MinIO Plus 接口定义 * @author contact@liuxp.me - * @since 2023/06/26 + * @since 2024/06/05 */ public interface StorageService { - /** - * 根据文件id查询 - * @param id 文件ID - * @return 文件元数据信息 - */ - FileMetadataInfoVo oneById(Long id); - /** * 根据文件key查询 * @param key 文件key * @return 文件元数据信息 */ - FileMetadataInfoVo oneByKey(String key); + FileMetadataInfoVo one(String key); /** * 列表数据查询 diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/bo/CreateUploadUrlReqBO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/bo/CreateUploadUrlReqBO.java similarity index 96% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/bo/CreateUploadUrlReqBO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/bo/CreateUploadUrlReqBO.java index a66ae8d9d..89aaf3863 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/bo/CreateUploadUrlReqBO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/bo/CreateUploadUrlReqBO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.bo; +package org.liuxp.minioplus.api.model.bo; import lombok.Getter; import lombok.Setter; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/bo/CreateUploadUrlRespBO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/bo/CreateUploadUrlRespBO.java similarity index 87% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/bo/CreateUploadUrlRespBO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/bo/CreateUploadUrlRespBO.java index 2b9a192a0..fd04cd40b 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/bo/CreateUploadUrlRespBO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/bo/CreateUploadUrlRespBO.java @@ -1,9 +1,9 @@ -package org.liuxp.minioplus.model.bo; +package org.liuxp.minioplus.api.model.bo; import lombok.Getter; import lombok.Setter; import lombok.ToString; -import org.liuxp.minioplus.model.vo.FileCheckResultVo; +import org.liuxp.minioplus.api.model.vo.FileCheckResultVo; import java.util.List; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileCheckDTO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileCheckDTO.java similarity index 94% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileCheckDTO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileCheckDTO.java index cbbac92c9..b058561e6 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileCheckDTO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileCheckDTO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.dto; +package org.liuxp.minioplus.api.model.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileCompleteDTO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileCompleteDTO.java similarity index 91% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileCompleteDTO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileCompleteDTO.java index 848431651..9dc8deb44 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileCompleteDTO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileCompleteDTO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.dto; +package org.liuxp.minioplus.api.model.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoDTO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoDTO.java similarity index 96% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoDTO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoDTO.java index 485c1aa1a..5c748c03f 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoDTO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoDTO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.dto; +package org.liuxp.minioplus.api.model.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoSaveDTO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoSaveDTO.java similarity index 98% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoSaveDTO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoSaveDTO.java index 8ee46a9df..9961e15f5 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoSaveDTO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoSaveDTO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.dto; +package org.liuxp.minioplus.api.model.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoUpdateDTO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoUpdateDTO.java similarity index 97% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoUpdateDTO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoUpdateDTO.java index 33f2794ea..23ecd3daa 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileMetadataInfoUpdateDTO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileMetadataInfoUpdateDTO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.dto; +package org.liuxp.minioplus.api.model.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileSaveDTO.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileSaveDTO.java similarity index 93% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileSaveDTO.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileSaveDTO.java index 0169c5aa1..78c7184b8 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/dto/FileSaveDTO.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/dto/FileSaveDTO.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.dto; +package org.liuxp.minioplus.api.model.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/CompleteResultVo.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/CompleteResultVo.java similarity index 93% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/CompleteResultVo.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/CompleteResultVo.java index 1978a4350..1e55b690c 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/CompleteResultVo.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/CompleteResultVo.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.vo; +package org.liuxp.minioplus.api.model.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/FileCheckResultVo.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/FileCheckResultVo.java similarity index 97% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/FileCheckResultVo.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/FileCheckResultVo.java index f776509c5..e282420ce 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/FileCheckResultVo.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/FileCheckResultVo.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.vo; +package org.liuxp.minioplus.api.model.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/FileMetadataInfoVo.java b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/FileMetadataInfoVo.java similarity index 97% rename from minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/FileMetadataInfoVo.java rename to minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/FileMetadataInfoVo.java index be4950958..49a223a05 100644 --- a/minio-plus-model/src/main/java/org/liuxp/minioplus/model/vo/FileMetadataInfoVo.java +++ b/minio-plus-api/src/main/java/org/liuxp/minioplus/api/model/vo/FileMetadataInfoVo.java @@ -1,4 +1,4 @@ -package org.liuxp.minioplus.model.vo; +package org.liuxp.minioplus.api.model.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/minio-plus-application/minio-plus-application-mysql/pom.xml b/minio-plus-application/minio-plus-application-mysql/pom.xml index 35ec4484d..8d9d5c612 100644 --- a/minio-plus-application/minio-plus-application-mysql/pom.xml +++ b/minio-plus-application/minio-plus-application-mysql/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-plus-application-mysql + jar diff --git a/minio-plus-application/minio-plus-application-mysql/src/main/java/org/liuxp/minioplus/application/dao/MetadataRepositoryImpl.java b/minio-plus-application/minio-plus-application-mysql/src/main/java/org/liuxp/minioplus/application/dao/MetadataRepositoryImpl.java index 7e27117e4..d7c4708e6 100644 --- a/minio-plus-application/minio-plus-application-mysql/src/main/java/org/liuxp/minioplus/application/dao/MetadataRepositoryImpl.java +++ b/minio-plus-application/minio-plus-application-mysql/src/main/java/org/liuxp/minioplus/application/dao/MetadataRepositoryImpl.java @@ -7,10 +7,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.liuxp.minioplus.application.entity.FileMetadataInfoEntity; import org.liuxp.minioplus.application.mapper.FileMetadataInfoMapper; -import org.liuxp.minioplus.model.dto.FileMetadataInfoDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoSaveDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoUpdateDTO; -import org.liuxp.minioplus.model.vo.FileMetadataInfoVo; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoSaveDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoUpdateDTO; +import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo; import org.liuxp.minioplus.core.repository.MetadataRepository; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; diff --git a/minio-plus-common/pom.xml b/minio-plus-common/pom.xml index 823854c58..548cf1553 100644 --- a/minio-plus-common/pom.xml +++ b/minio-plus-common/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-plus-common + jar diff --git a/minio-plus-core/pom.xml b/minio-plus-core/pom.xml index 1d8fbe9dd..efa81b8e5 100644 --- a/minio-plus-core/pom.xml +++ b/minio-plus-core/pom.xml @@ -10,35 +10,20 @@ 4.0.0 minio-plus-core + jar org.springframework.boot spring-boot-starter - - - io.minio - minio - - - okhttp - com.squareup.okhttp3 - - - - - com.squareup.okhttp3 - okhttp - 4.11.0 - org.liuxp minio-plus-common org.liuxp - minio-plus-model + minio-plus-api org.liuxp diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/common/context/ListPartsResultCopy.java b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/common/context/ListPartsResultCopy.java deleted file mode 100644 index 392d0835f..000000000 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/common/context/ListPartsResultCopy.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.liuxp.minioplus.core.common.context; - -import io.minio.messages.ListPartsResult; -import io.minio.messages.Part; - -import java.util.ArrayList; -import java.util.List; - -public class ListPartsResultCopy extends ListPartsResult { - - public List partList() { - return new ArrayList<>(); - } - -} diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/common/context/MultipartUploadCreateDTO.java b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/common/context/MultipartUploadCreateDTO.java deleted file mode 100644 index 8ba57ba63..000000000 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/common/context/MultipartUploadCreateDTO.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.liuxp.minioplus.core.common.context; - -import com.google.common.collect.Multimap; -import io.minio.messages.Part; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 创建分片上传需要的参数 - * - * @author contact@liuxp.me - * @date 2023/06/28 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class MultipartUploadCreateDTO { - /** - * 桶名字 - */ - private String bucketName; - /** - * 区名字 - */ - private String region; - /** - * 对象名字 - */ - private String objectName; - /** - * 请求头 - */ - private Multimap headers; - /** - * 查询参数 - */ - private Multimap extraQueryParams; - /** - * minio的id - */ - private String uploadId; - /** - * 最大块数量 - */ - private Integer maxParts; - /** - * 块信息 - */ - private Part[] parts; - /** - * 块编号 - */ - private Integer partNumberMarker; - - -} \ No newline at end of file diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/StorageEngineService.java b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/StorageEngineService.java index 031c994fe..e802f212d 100644 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/StorageEngineService.java +++ b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/StorageEngineService.java @@ -1,11 +1,11 @@ package org.liuxp.minioplus.core.engine; import cn.hutool.core.lang.Pair; -import org.liuxp.minioplus.model.dto.FileCheckDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoSaveDTO; -import org.liuxp.minioplus.model.vo.CompleteResultVo; -import org.liuxp.minioplus.model.vo.FileCheckResultVo; -import org.liuxp.minioplus.model.vo.FileMetadataInfoVo; +import org.liuxp.minioplus.api.model.dto.FileCheckDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoSaveDTO; +import org.liuxp.minioplus.api.model.vo.CompleteResultVo; +import org.liuxp.minioplus.api.model.vo.FileCheckResultVo; +import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo; import java.util.List; diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/impl/StorageEngineServiceImpl.java b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/impl/StorageEngineServiceImpl.java index 72c600ece..845bef8ad 100644 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/impl/StorageEngineServiceImpl.java +++ b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/engine/impl/StorageEngineServiceImpl.java @@ -6,23 +6,22 @@ import cn.hutool.core.lang.Pair; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.IdUtil; import lombok.extern.slf4j.Slf4j; +import org.liuxp.minioplus.common.config.MinioPlusProperties; import org.liuxp.minioplus.common.enums.MinioPlusErrorCode; import org.liuxp.minioplus.common.enums.StorageBucketEnums; import org.liuxp.minioplus.common.exception.MinioPlusException; -import org.liuxp.minioplus.common.config.MinioPlusProperties; -import org.liuxp.minioplus.core.common.context.MultipartUploadCreateDTO; import org.liuxp.minioplus.core.common.utils.MinioPlusCommonUtil; import org.liuxp.minioplus.core.engine.StorageEngineService; import org.liuxp.minioplus.core.repository.MetadataRepository; -import org.liuxp.minioplus.model.bo.CreateUploadUrlReqBO; -import org.liuxp.minioplus.model.bo.CreateUploadUrlRespBO; -import org.liuxp.minioplus.model.dto.FileCheckDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoSaveDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoUpdateDTO; -import org.liuxp.minioplus.model.vo.CompleteResultVo; -import org.liuxp.minioplus.model.vo.FileCheckResultVo; -import org.liuxp.minioplus.model.vo.FileMetadataInfoVo; +import org.liuxp.minioplus.api.model.bo.CreateUploadUrlReqBO; +import org.liuxp.minioplus.api.model.bo.CreateUploadUrlRespBO; +import org.liuxp.minioplus.api.model.dto.FileCheckDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoSaveDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoUpdateDTO; +import org.liuxp.minioplus.api.model.vo.CompleteResultVo; +import org.liuxp.minioplus.api.model.vo.FileCheckResultVo; +import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo; import org.liuxp.minioplus.s3.def.ListParts; import org.liuxp.minioplus.s3.def.MinioS3Client; import org.springframework.beans.BeanUtils; @@ -31,7 +30,9 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; /** * 存储引擎Service接口实现类 @@ -52,11 +53,6 @@ public class StorageEngineServiceImpl implements StorageEngineService { @Resource MinioS3Client minioS3Client; - /** - * MinIO中上传编号名称 - */ - private static final String UPLOAD_ID = "uploadId"; - /** * 上传任务初始化 * @@ -572,19 +568,20 @@ public class StorageEngineServiceImpl implements StorageEngineService { /** * 构建响应给前端的分片信息 * - * @param uploadCreateDTO 分片dto - * @param uploadId 上传任务编号 - * @param fileSize 文件大小 - * @param start 开始位置 - * @param partNumber 块号 + * @param bucketName 桶名称 + * @param objectName 对象名称(含路径) + * @param uploadId 上传任务编号 + * @param fileSize 文件大小 + * @param start 开始位置 + * @param partNumber 块号 * @return {@link FileCheckResultVo.Part} */ - private FileCheckResultVo.Part buildResultPart(MultipartUploadCreateDTO uploadCreateDTO, String uploadId, Long fileSize, long start, Integer partNumber) { + private FileCheckResultVo.Part buildResultPart(String bucketName,String objectName,String uploadId, Long fileSize, long start, Integer partNumber) { // 计算起始位置 long end = Math.min(start + properties.getPart().getSize(), fileSize); - String uploadUrl = minioS3Client.getUploadObjectUrl(uploadCreateDTO.getBucketName(), uploadCreateDTO.getObjectName(), uploadId,String.valueOf(partNumber)); + String uploadUrl = minioS3Client.getUploadObjectUrl(bucketName, objectName, uploadId,String.valueOf(partNumber)); FileCheckResultVo.Part part = new FileCheckResultVo.Part(); - part.setUploadId(uploadCreateDTO.getUploadId()); + part.setUploadId(uploadId); // 上传地址 part.setUrl(uploadUrl); // 开始位置 @@ -757,22 +754,17 @@ public class StorageEngineServiceImpl implements StorageEngineService { // 断点续传 if (Boolean.TRUE.equals(bo.getIsSequel()) && CollUtil.isNotEmpty(bo.getMissPartNum()) && CharSequenceUtil.isNotBlank(bo.getUploadId())) { // 断点续传需要使用已创建的任务信息构建分片信息 - MultipartUploadCreateDTO uploadCreateDTO = MultipartUploadCreateDTO.builder() - .bucketName(bo.getStorageBucket()) - .objectName(MinioPlusCommonUtil.getObjectName(bo.getFileMd5())) - .build(); // 存储桶 - bucketName = uploadCreateDTO.getBucketName(); + bucketName = bo.getStorageBucket(); // 存储路径 - storagePath = uploadCreateDTO.getObjectName(); + storagePath = MinioPlusCommonUtil.getObjectName(bo.getFileMd5()); // 文件key fileKey = bo.getFileKey(); uploadId = bo.getUploadId(); - uploadCreateDTO.setUploadId(bo.getUploadId()); // 开始位置 long start = (long) (bo.getMissPartNum().get(0) - 1) * properties.getPart().getSize(); for (int partNumber : bo.getMissPartNum()) { - FileCheckResultVo.Part part = this.buildResultPart(uploadCreateDTO, uploadId, bo.getFileSize(), start, partNumber); + FileCheckResultVo.Part part = this.buildResultPart(bucketName,storagePath, uploadId, bo.getFileSize(), start, partNumber); // 更改下一次的开始位置 start = start + properties.getPart().getSize(); partList.add(part); @@ -806,15 +798,10 @@ public class StorageEngineServiceImpl implements StorageEngineService { uploadId = fileKey; } else { // 创建分片请求,获取uploadId - MultipartUploadCreateDTO uploadCreateDTO = MultipartUploadCreateDTO.builder() - .bucketName(bucketName) - .objectName(MinioPlusCommonUtil.getObjectName(bo.getFileMd5())) - .build(); uploadId = minioS3Client.createMultipartUpload(bucketName,MinioPlusCommonUtil.getObjectName(bo.getFileMd5())); - uploadCreateDTO.setUploadId(uploadId); long start = 0; for (Integer partNumber = 1; partNumber <= chunkNum; partNumber++) { - FileCheckResultVo.Part part = this.buildResultPart(uploadCreateDTO, uploadId, bo.getFileSize(), start, partNumber); + FileCheckResultVo.Part part = this.buildResultPart(bucketName,MinioPlusCommonUtil.getObjectName(bo.getFileMd5()), uploadId, bo.getFileSize(), start, partNumber); // 更改下一次的开始位置 start = start + properties.getPart().getSize(); partList.add(part); diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/repository/MetadataRepository.java b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/repository/MetadataRepository.java index 5f075f735..846d2c07b 100644 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/repository/MetadataRepository.java +++ b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/repository/MetadataRepository.java @@ -1,9 +1,9 @@ package org.liuxp.minioplus.core.repository; -import org.liuxp.minioplus.model.dto.FileMetadataInfoDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoSaveDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoUpdateDTO; -import org.liuxp.minioplus.model.vo.FileMetadataInfoVo; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoSaveDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoUpdateDTO; +import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo; import java.util.List; diff --git a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/impl/StorageServiceImpl.java b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/impl/StorageServiceImpl.java index c100292df..8246b3c6b 100644 --- a/minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/impl/StorageServiceImpl.java +++ b/minio-plus-core/src/main/java/org/liuxp/minioplus/core/service/impl/StorageServiceImpl.java @@ -9,18 +9,18 @@ import cn.hutool.crypto.SecureUtil; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import org.liuxp.minioplus.common.config.MinioPlusProperties; -import org.liuxp.minioplus.model.dto.FileMetadataInfoDTO; -import org.liuxp.minioplus.model.dto.FileMetadataInfoSaveDTO; -import org.liuxp.minioplus.model.dto.FileSaveDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoDTO; +import org.liuxp.minioplus.api.model.dto.FileMetadataInfoSaveDTO; +import org.liuxp.minioplus.api.model.dto.FileSaveDTO; import org.liuxp.minioplus.common.enums.MinioPlusErrorCode; import org.liuxp.minioplus.common.enums.StorageBucketEnums; import org.liuxp.minioplus.common.exception.MinioPlusException; import org.liuxp.minioplus.core.common.utils.ContentTypeUtil; import org.liuxp.minioplus.core.common.utils.MinioPlusCommonUtil; -import org.liuxp.minioplus.model.vo.FileMetadataInfoVo; +import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo; import org.liuxp.minioplus.core.engine.StorageEngineService; import org.liuxp.minioplus.core.repository.MetadataRepository; -import org.liuxp.minioplus.core.service.StorageService; +import org.liuxp.minioplus.api.StorageService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -54,16 +54,7 @@ public class StorageServiceImpl implements StorageService { MinioPlusProperties properties; @Override - public FileMetadataInfoVo oneById(Long id) { - - FileMetadataInfoDTO fileMetadataInfo = new FileMetadataInfoDTO(); - fileMetadataInfo.setId(id); - return fileMetadataRepository.one(fileMetadataInfo); - - } - - @Override - public FileMetadataInfoVo oneByKey(String key) { + public FileMetadataInfoVo one(String key) { FileMetadataInfoDTO fileMetadataInfo = new FileMetadataInfoDTO(); fileMetadataInfo.setFileKey(key); diff --git a/minio-plus-extension/pom.xml b/minio-plus-extension/pom.xml index 71b86cd56..7cce7cd2e 100644 --- a/minio-plus-extension/pom.xml +++ b/minio-plus-extension/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-plus-extension + jar diff --git a/minio-plus-extension/src/main/java/org/liuxp/minioplus/extension/controller/StorageController.java b/minio-plus-extension/src/main/java/org/liuxp/minioplus/extension/controller/StorageController.java index 101d3c0fa..99251a9ce 100644 --- a/minio-plus-extension/src/main/java/org/liuxp/minioplus/extension/controller/StorageController.java +++ b/minio-plus-extension/src/main/java/org/liuxp/minioplus/extension/controller/StorageController.java @@ -7,10 +7,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.liuxp.minioplus.common.config.MinioPlusProperties; import org.liuxp.minioplus.extension.context.Response; -import org.liuxp.minioplus.model.dto.FileCheckDTO; -import org.liuxp.minioplus.model.dto.FileCompleteDTO; -import org.liuxp.minioplus.model.vo.CompleteResultVo; -import org.liuxp.minioplus.model.vo.FileCheckResultVo; +import org.liuxp.minioplus.api.model.dto.FileCheckDTO; +import org.liuxp.minioplus.api.model.dto.FileCompleteDTO; +import org.liuxp.minioplus.api.model.vo.CompleteResultVo; +import org.liuxp.minioplus.api.model.vo.FileCheckResultVo; import org.liuxp.minioplus.core.engine.StorageEngineService; import org.springframework.stereotype.Controller; import org.springframework.validation.annotation.Validated; diff --git a/minio-plus-spring-boot-starter/minio-plus-all-spring-boot-starter/pom.xml b/minio-plus-spring-boot-starter/minio-plus-all-spring-boot-starter/pom.xml index 35022f8a3..cde73b0b4 100644 --- a/minio-plus-spring-boot-starter/minio-plus-all-spring-boot-starter/pom.xml +++ b/minio-plus-spring-boot-starter/minio-plus-all-spring-boot-starter/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-plus-all-spring-boot-starter + jar diff --git a/minio-s3-api/minio-s3-api-custom/pom.xml b/minio-s3-api/minio-s3-api-custom/pom.xml index 928965e19..e17227e27 100644 --- a/minio-s3-api/minio-s3-api-custom/pom.xml +++ b/minio-s3-api/minio-s3-api-custom/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-s3-api-custom + jar diff --git a/minio-s3-api/minio-s3-api-definition/pom.xml b/minio-s3-api/minio-s3-api-definition/pom.xml index f1007f196..d1fc736a6 100644 --- a/minio-s3-api/minio-s3-api-definition/pom.xml +++ b/minio-s3-api/minio-s3-api-definition/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-s3-api-definition + jar diff --git a/minio-s3-api/minio-s3-api-official/pom.xml b/minio-s3-api/minio-s3-api-official/pom.xml index d641cc534..d3df15d1f 100644 --- a/minio-s3-api/minio-s3-api-official/pom.xml +++ b/minio-s3-api/minio-s3-api-official/pom.xml @@ -10,6 +10,7 @@ 4.0.0 minio-s3-api-official + jar diff --git a/pom.xml b/pom.xml index 6da986618..315993b07 100644 --- a/pom.xml +++ b/pom.xml @@ -35,11 +35,11 @@ + minio-plus-api minio-plus-application minio-plus-common minio-plus-core minio-plus-extension - minio-plus-model minio-plus-spring-boot-starter minio-s3-api @@ -153,7 +153,7 @@ org.liuxp - minio-plus-model + minio-plus-api ${revision}