From 28609963f2a2c5ca4e9c3ed2ae058ee4845ddd1e Mon Sep 17 00:00:00 2001 From: xudawei Date: Mon, 29 Jul 2024 16:19:01 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=80=83=E5=8B=A4=E5=AF=B9=E6=8E=A5]=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E4=BF=9D=E5=AD=98file=E7=9A=84appCode=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oss/service/impl/FileServiceImpl.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/oss-service/src/main/java/cn/axzo/oss/service/impl/FileServiceImpl.java b/oss-service/src/main/java/cn/axzo/oss/service/impl/FileServiceImpl.java index 9ddc1e8..b4670c7 100644 --- a/oss-service/src/main/java/cn/axzo/oss/service/impl/FileServiceImpl.java +++ b/oss-service/src/main/java/cn/axzo/oss/service/impl/FileServiceImpl.java @@ -59,6 +59,7 @@ import cn.axzo.oss.service.api.FileService; import cn.axzo.oss.service.metafile.WithFileFactory; import cn.axzo.oss.service.metafile.WithFileService; import cn.azxo.framework.common.model.CommonResponse; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -886,7 +887,33 @@ public class FileServiceImpl implements FileService { List fileBusinessSceneList = fileBusinessSceneManager.queryByBucketNoAndScene(fileList.stream().map(File::getAppChannelBucketNo).collect(Collectors.toSet()), bizScene); Map bizSceneExpireMap = fileBusinessSceneList.stream().collect(Collectors.toMap(FileBusinessScene::getAppChannelBucketNo, FileBusinessScene::getDownloadExpiration, (x, y) -> y)); //构建返回集合 - return this.buildFileKeyRespByFile(fileList, bucketTypeMap, bizSceneExpireMap, style, hasFileName, expiration); + List responseList = this.buildFileKeyRespByFile(fileList, bucketTypeMap, bizSceneExpireMap, style, hasFileName, expiration); + //获取不在dbFile中,但是在默认axzo-obs-private中的key + responseList.addAll(fetchNoFileAndObsPrivate(fileKeys, fileList)); + return responseList; + } + + /** + * 获取不在dbFile中,但是在默认axzo-obs-private中的key + */ + private List fetchNoFileAndObsPrivate(List fileKeys, List fileList) { + if (CollectionUtil.isEmpty(fileKeys)) { + return Lists.newArrayList(); + } + List fileDbList = Lists.newArrayList(); + if (CollectionUtil.isNotEmpty(fileList)) { + fileDbList = fileList.stream().map(File::getFileUuid).collect(Collectors.toList()); + } + List subtractToList = CollUtil.subtractToList(fileKeys, fileDbList); + + List collect = Lists.newArrayList(); + if (CollectionUtil.isNotEmpty(subtractToList)) { + collect = subtractToList.stream().map(item -> this.buildSignUrlDownloadResponse(BucketTypeEnum.PRIVATE_BUCKET.getCode(), + "axzo-obs-private", item, ChannelTypeEnum.OBS.getChannelCode() + , item, null)) + .collect(Collectors.toList()); + } + return collect; } /**