|
@@ -141,17 +141,23 @@ public class DownloadController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 根据file表id下载,支持多个同时下载
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
@ApiOperation("下载")
|
|
|
- @GetMapping("download/{id}")
|
|
|
- public Result download(@PathVariable Long id) throws IOException {
|
|
|
- DownloadResponse entity = downloadService.rFindById(id);
|
|
|
- if (entity == null) {
|
|
|
- log.error("对象不存在: {}", id);
|
|
|
- return Result.failure("对象不存在");
|
|
|
+ @GetMapping("download/{ids}")
|
|
|
+ public Result download(@PathVariable String ids) throws IOException {
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(ids)) {
|
|
|
+ log.error("对象id不能为空");
|
|
|
+ Result.failure("对象id不能为空");
|
|
|
}
|
|
|
- String fileIds = entity.getFileIds();
|
|
|
- List<FileEntity> files = StringUtils.isNotBlank(fileIds) ? fileService.findByIds(fileIds) : new ArrayList<>();
|
|
|
+
|
|
|
+ List<FileEntity> files = fileService.findByIds(ids);
|
|
|
+ log.info("file size: {}" , files.size());
|
|
|
|
|
|
// 1.将oss资源下载到服务器
|
|
|
String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
|