|
|
@@ -3,6 +3,8 @@ package cn.reghao.oss.store.controller;
|
|
|
import cn.reghao.oss.store.service.ObjectMultipartUploadService;
|
|
|
import cn.reghao.jutil.jdk.result.WebResult;
|
|
|
import cn.reghao.oss.api.rest.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -14,6 +16,7 @@ import java.util.*;
|
|
|
* @author reghao
|
|
|
* @date 2022-12-08 20:40:55
|
|
|
*/
|
|
|
+@Api(tags = "分片上传接口")
|
|
|
@RestController
|
|
|
public class ObjectMultipartUploadController {
|
|
|
private final ObjectMultipartUploadService objectMultipartUploadService;
|
|
|
@@ -22,12 +25,14 @@ public class ObjectMultipartUploadController {
|
|
|
this.objectMultipartUploadService = objectMultipartUploadService;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "创建对象分片上传")
|
|
|
@PostMapping(value = "/", params = {"create"}, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String create(@Validated UploadPrepare uploadPrepare) {
|
|
|
UploadPrepareRet uploadPrepareRet = objectMultipartUploadService.prepareUpload(uploadPrepare);
|
|
|
return WebResult.success(uploadPrepareRet);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取已上传的对象分片")
|
|
|
@GetMapping(value = "/", params = {"multipart"}, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String getUploadedPart() {
|
|
|
UploadedPart uploadedPart = new UploadedPart();
|
|
|
@@ -38,12 +43,14 @@ public class ObjectMultipartUploadController {
|
|
|
return WebResult.success(uploadedPart);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "上传对象分片")
|
|
|
@PostMapping(value = "/", params = {"multipart"}, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String uploadPart(MultipartFile file, @Validated UploadFilePart uploadFilePart) throws Exception {
|
|
|
UploadFileRet uploadFileRet = objectMultipartUploadService.putFilePart(file.getInputStream(), uploadFilePart);
|
|
|
return WebResult.success(uploadFileRet);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "合并对象分片")
|
|
|
@PostMapping(value = "/", params = {"merge"}, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String merge() {
|
|
|
return WebResult.success();
|