diff --git a/src/main/java/im/zhaojun/zfile/module/storage/controller/file/FileOperatorController.java b/src/main/java/im/zhaojun/zfile/module/storage/controller/file/FileOperatorController.java index b4f4649..040fe76 100644 --- a/src/main/java/im/zhaojun/zfile/module/storage/controller/file/FileOperatorController.java +++ b/src/main/java/im/zhaojun/zfile/module/storage/controller/file/FileOperatorController.java @@ -10,11 +10,7 @@ import im.zhaojun.zfile.module.password.service.PasswordConfigService; import im.zhaojun.zfile.module.storage.annotation.CheckPassword; import im.zhaojun.zfile.module.storage.context.StorageSourceContext; import im.zhaojun.zfile.module.storage.model.enums.FileTypeEnum; -import im.zhaojun.zfile.module.storage.model.request.operator.BatchDeleteRequest; -import im.zhaojun.zfile.module.storage.model.request.operator.NewFolderRequest; -import im.zhaojun.zfile.module.storage.model.request.operator.RenameFileRequest; -import im.zhaojun.zfile.module.storage.model.request.operator.RenameFolderRequest; -import im.zhaojun.zfile.module.storage.model.request.operator.UploadFileRequest; +import im.zhaojun.zfile.module.storage.model.request.operator.*; import im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -160,7 +156,6 @@ public class FileOperatorController { } } - @ApiOperationSupport(order = 5) @ApiOperation(value = "上传文件") @PostMapping("/upload/file") @@ -174,4 +169,67 @@ public class FileOperatorController { return AjaxJson.getSuccessData(uploadUrl); } + //@ApiOperationSupport(order = 6) + //@ApiOperation(value = "移动文件") + //@PostMapping("/move/file") + //@CheckPassword(storageKeyFieldExpression = "[0].storageKey", + // pathFieldExpression = "[0].path", + // passwordFieldExpression = "[0].password") + //public AjaxJson moveFile(@Valid @RequestBody MoveFileRequest moveFileRequest) { + // AbstractBaseFileService fileService = storageSourceContext.getByStorageKey(moveFileRequest.getStorageKey()); + // boolean flag = fileService.moveFile(moveFileRequest.getPath(), moveFileRequest.getName(), moveFileRequest.getTargetPath(), moveFileRequest.getTargetName()); + // if (flag) { + // return AjaxJson.getSuccess("移动成功"); + // } else { + // return AjaxJson.getError("移动失败"); + // } + //} + // + //@ApiOperationSupport(order = 7) + //@ApiOperation(value = "移动文件夹") + //@PostMapping("/move/folder") + //@CheckPassword(storageKeyFieldExpression = "[0].storageKey", + // pathFieldExpression = "[0].path", + // passwordFieldExpression = "[0].password") + //public AjaxJson moveFolder(@Valid @RequestBody MoveFolderRequest moveFolderRequest) { + // AbstractBaseFileService fileService = storageSourceContext.getByStorageKey(moveFolderRequest.getStorageKey()); + // boolean flag = fileService.moveFolder(moveFolderRequest.getPath(), moveFolderRequest.getName(), moveFolderRequest.getTargetPath(), moveFolderRequest.getTargetName()); + // if (flag) { + // return AjaxJson.getSuccess("移动成功"); + // } else { + // return AjaxJson.getError("移动失败"); + // } + //} + // + //@ApiOperationSupport(order = 8) + //@ApiOperation(value = "复制文件") + //@PostMapping("/copy/file") + //@CheckPassword(storageKeyFieldExpression = "[0].storageKey", + // pathFieldExpression = "[0].path", + // passwordFieldExpression = "[0].password") + //public AjaxJson copyFile(@Valid @RequestBody CopyFileRequest copyFileRequest) { + // AbstractBaseFileService fileService = storageSourceContext.getByStorageKey(copyFileRequest.getStorageKey()); + // boolean flag = fileService.copyFile(copyFileRequest.getPath(), copyFileRequest.getName(), copyFileRequest.getTargetPath(), copyFileRequest.getTargetName()); + // if (flag) { + // return AjaxJson.getSuccess("复制成功"); + // } else { + // return AjaxJson.getError("复制失败"); + // } + //} + // + //@ApiOperationSupport(order = 9) + //@ApiOperation(value = "复制文件夹") + //@PostMapping("/copy/folder") + //@CheckPassword(storageKeyFieldExpression = "[0].storageKey", + // pathFieldExpression = "[0].path", + // passwordFieldExpression = "[0].password") + //public AjaxJson copyFolder(@Valid @RequestBody CopyFolderRequest copyFolderRequest) { + // AbstractBaseFileService fileService = storageSourceContext.getByStorageKey(copyFolderRequest.getStorageKey()); + // boolean flag = fileService.copyFolder(copyFolderRequest.getPath(), copyFolderRequest.getName(), copyFolderRequest.getTargetPath(), copyFolderRequest.getTargetName()); + // if (flag) { + // return AjaxJson.getSuccess("复制成功"); + // } else { + // return AjaxJson.getError("复制失败"); + // } + //} } \ No newline at end of file diff --git a/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/CopyFileRequest.java b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/CopyFileRequest.java new file mode 100644 index 0000000..bf7744d --- /dev/null +++ b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/CopyFileRequest.java @@ -0,0 +1,40 @@ +package im.zhaojun.zfile.module.storage.model.request.operator; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 复制文件请求参数 + * + * @author zhaojun + */ +@Data +@ApiModel(description = "复制文件请求") +public class CopyFileRequest { + + @ApiModelProperty(value = "存储源 key", required = true, example = "local") + @NotBlank(message = "存储源 key 不能为空") + private String storageKey; + + @ApiModelProperty(value = "请求路径", example = "/", notes = "表示要复制的文件所在的文件夹") + private String path; + + @ApiModelProperty(value = "文件名称", example = "a.txt", notes = "表示要复制的文件名称") + private String name; + + @ApiModelProperty(value = "目标路径", example = "/", notes = "表示要复制到的文件夹") + private String targetPath; + + @ApiModelProperty(value = "目标文件名称", example = "b.txt", notes = "表示要复制到的文件名称") + private String targetName; + + @ApiModelProperty(value = "源文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String srcPassword; + + @ApiModelProperty(value = "目标文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String targetPassword; + +} diff --git a/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/CopyFolderRequest.java b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/CopyFolderRequest.java new file mode 100644 index 0000000..018b2a9 --- /dev/null +++ b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/CopyFolderRequest.java @@ -0,0 +1,40 @@ +package im.zhaojun.zfile.module.storage.model.request.operator; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 复制文件夹请求参数 + * + * @author zhaojun + */ +@Data +@ApiModel(description = "复制文件夹请求") +public class CopyFolderRequest { + + @ApiModelProperty(value = "存储源 key", required = true, example = "local") + @NotBlank(message = "存储源 key 不能为空") + private String storageKey; + + @ApiModelProperty(value = "请求路径", example = "/", notes = "表示要复制的文件夹所在的文件夹") + private String path; + + @ApiModelProperty(value = "文件夹名称", example = "movie", notes = "表示要复制的文件夹名称") + private String name; + + @ApiModelProperty(value = "目标路径", example = "/", notes = "表示要复制到的文件夹") + private String targetPath; + + @ApiModelProperty(value = "目标文件夹名称", example = "电影", notes = "表示要复制到的文件夹名称") + private String targetName; + + @ApiModelProperty(value = "源文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String srcPassword; + + @ApiModelProperty(value = "目标文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String targetPassword; + +} diff --git a/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/MoveFileRequest.java b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/MoveFileRequest.java new file mode 100644 index 0000000..f9fd504 --- /dev/null +++ b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/MoveFileRequest.java @@ -0,0 +1,40 @@ +package im.zhaojun.zfile.module.storage.model.request.operator; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 移动文件请求参数 + * + * @author zhaojun + */ +@Data +@ApiModel(description = "移动文件请求类") +public class MoveFileRequest { + + @ApiModelProperty(value = "存储源 key", required = true, example = "local") + @NotBlank(message = "存储源 key 不能为空") + private String storageKey; + + @ApiModelProperty(value = "请求路径", example = "/", notes = "表示要移动的文件所在的文件夹") + private String path; + + @ApiModelProperty(value = "文件名称", example = "a.txt", notes = "表示要移动的文件名称") + private String name; + + @ApiModelProperty(value = "目标路径", example = "/", notes = "表示要移动到的文件夹") + private String targetPath; + + @ApiModelProperty(value = "目标文件名称", example = "b.txt", notes = "表示要移动到的文件名称") + private String targetName; + + @ApiModelProperty(value = "源文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String srcPassword; + + @ApiModelProperty(value = "目标文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String targetPassword; + +} diff --git a/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/MoveFolderRequest.java b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/MoveFolderRequest.java new file mode 100644 index 0000000..43b9f1b --- /dev/null +++ b/src/main/java/im/zhaojun/zfile/module/storage/model/request/operator/MoveFolderRequest.java @@ -0,0 +1,40 @@ +package im.zhaojun.zfile.module.storage.model.request.operator; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 移动文件夹请求参数 + * + * @author zhaojun + */ +@Data +@ApiModel(description = "移动文件夹请求") +public class MoveFolderRequest { + + @ApiModelProperty(value = "存储源 key", required = true, example = "local") + @NotBlank(message = "存储源 key 不能为空") + private String storageKey; + + @ApiModelProperty(value = "请求路径", example = "/", notes = "表示要移动的文件夹所在的文件夹") + private String path; + + @ApiModelProperty(value = "文件夹名称", example = "movie", notes = "表示要移动的文件夹名称") + private String name; + + @ApiModelProperty(value = "目标路径", example = "/", notes = "表示要移动到的文件夹") + private String targetPath; + + @ApiModelProperty(value = "目标文件夹名称", example = "电影", notes = "表示要移动到的文件夹名称") + private String targetName; + + @ApiModelProperty(value = "源文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String srcPassword; + + @ApiModelProperty(value = "目标文件夹密码, 如果文件夹需要密码才能访问,则支持请求密码", example = "123456") + private String targetPassword; + +}