From a4b79226f1fd7bfaf1cc5a0fc7b7b87e82a49d16 Mon Sep 17 00:00:00 2001 From: welsir <1824379011@qq.com> Date: Sun, 24 Dec 2023 02:57:13 +0800 Subject: [PATCH] =?UTF-8?q?[DEV:=E6=96=87=E4=BB=B6=E6=9C=8D=E5=8A=A1]=20?= =?UTF-8?q?=E4=B8=8A=E7=BA=BF=E6=B5=8B=E8=AF=95=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?2=20-e:test=20-m:file-service=20-type:single=20-v:1.4.1?= =?UTF-8?q?=20-rp:8089=20-de:<-e=20ACTIVE=3Ddev=20-e=20UNIQUE=5FID=3D0=20-?= =?UTF-8?q?e=20SERVER=5FPORT=3D8089>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filesystem/controller/OSSOperatorController.java | 12 ++++++------ .../core/oss/aliyun/AliyunOSSOperator.java | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/example/filesystem/controller/OSSOperatorController.java b/src/main/java/com/example/filesystem/controller/OSSOperatorController.java index 673624e..11e7047 100644 --- a/src/main/java/com/example/filesystem/controller/OSSOperatorController.java +++ b/src/main/java/com/example/filesystem/controller/OSSOperatorController.java @@ -61,14 +61,14 @@ public Result upload(@RequestParam("file") MultipartFile[] files, ossFileVO.setMd5(md5List.get(0)); ossFileVO.setBucket(bucket); Callable file1 = ()->strategy.upload(ossFileVO); - ossFileVO.setFile(files[1]); - ossFileVO.setPath(pathList.get(0)); - ossFileVO.setMd5(md5List.get(0)); - Callable file2 = ()->strategy.upload(ossFileVO); - + OSSFileVO ossFileVO1 = new OSSFileVO(); + ossFileVO1.setFile(files[1]); + ossFileVO1.setPath(pathList.get(1)); + ossFileVO1.setMd5(md5List.get(1)); + ossFileVO1.setBucket(bucket); + Callable file2 = ()->strategy.upload(ossFileVO1); Future res1 = ConcurrentUtil.doJob(executorService, file1); Future res2 = ConcurrentUtil.doJob(executorService, file2); - res.add(ConcurrentUtil.futureGet(res1)); res.add(ConcurrentUtil.futureGet(res2)); return Result.success(res); diff --git a/src/main/java/com/example/filesystem/core/oss/aliyun/AliyunOSSOperator.java b/src/main/java/com/example/filesystem/core/oss/aliyun/AliyunOSSOperator.java index ce28365..7236e7b 100644 --- a/src/main/java/com/example/filesystem/core/oss/aliyun/AliyunOSSOperator.java +++ b/src/main/java/com/example/filesystem/core/oss/aliyun/AliyunOSSOperator.java @@ -83,10 +83,12 @@ public UploadFileVO uploadFile(OSSFileVO ossFileVO) { } catch (IOException e) { throw new RuntimeException(e); } + logger.info("文件上传成功"); fileMapper.insert(singleFile); fileBucketMapper.insertFileBucketRelative(singleFile.getId().toString(),uploadBucket, CommonConstant.ALIYUN_OSS); return Boolean.TRUE; }); + return UploadFileVO.builder() .fileId(String.valueOf(singleFile.getId())) .url("https://" + uploadBucket + "." + uploadEndpoint +"/"+uploadPath)