| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 对象存储端点 |
| | | * |
| | |
| | | } |
| | | |
| | | /** |
| | | * 上传文件 |
| | | * 自定义前缀上传文件 |
| | | * |
| | | * @param file 文件 |
| | | * @param prefixPath 文件 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 批量自定义前缀上传文件 |
| | | * |
| | | * @param files 文件 |
| | | * @param prefixPath 文件 |
| | | * @return ObjectStat |
| | | */ |
| | | @SneakyThrows |
| | | @PostMapping("/batch-put-file-by-prefix-path") |
| | | public R batchPutFileByPrefixPath(@RequestParam MultipartFile[] files,@RequestParam String prefixPath) { |
| | | List<BladeFile> list = new ArrayList<>(); |
| | | for (MultipartFile file : files) { |
| | | BladeFile bladeFile = ossBuilder.templateByPrefixPath(prefixPath).putFile(file.getOriginalFilename(), file.getInputStream()); |
| | | list.add(bladeFile); |
| | | } |
| | | return R.data(list); |
| | | } |
| | | |
| | | /** |
| | | * 上传文件 |
| | | * |
| | | * @param fileName 存储桶对象名称 |