From d3ee0e5f4f0c5288b4bedd37e06a88882f381a82 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Wed, 12 Mar 2025 22:06:39 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:=20=E9=9A=90=E8=97=8F=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=B8=8D=E5=87=BAminio=E7=9A=84=E7=9B=B8=E5=85=B3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CollectionServiceImpl.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/CollectionServiceImpl.java b/src/main/java/com/ai/da/service/impl/CollectionServiceImpl.java index 5999d78c..bf598dcd 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionServiceImpl.java @@ -115,6 +115,7 @@ public class CollectionServiceImpl extends ServiceImpl> maps = collectionElements .stream() .collect(Collectors.groupingBy(CollectionElement::getLevel1Type)); + maps.forEach((k, v) -> { CollectionLevel1TypeEnum level1TypeEnum = CollectionLevel1TypeEnum.uploadOf(k); if (Objects.isNull(level1TypeEnum)) { @@ -122,30 +123,34 @@ public class CollectionServiceImpl extends ServiceImpl { + List moodBoards = CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); String url = o.getUrl(); if (minioUtil.doesObjectExist(url)) { d.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60)); - } else { - response.getMoodBoards().remove(d); } - })); + }); + response.setMoodBoards(moodBoards.stream() + .filter(d -> minioUtil.doesObjectExist(d.getUrl())) + .collect(Collectors.toList())); break; + case PRINT_BOARD: - response.setPrintBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { + List printBoards = CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { d.setIsPin(o.getHasPin()); d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); String url = o.getUrl(); if (minioUtil.doesObjectExist(url)) { d.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60)); - } else { - response.getPrintBoards().remove(d); } - })); + }); + response.setPrintBoards(printBoards.stream() + .filter(d -> minioUtil.doesObjectExist(d.getUrl())) + .collect(Collectors.toList())); break; + case SKETCH_BOARD: - response.setSketchBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { + List sketchBoards = CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { d.setIsPin(o.getHasPin()); d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); String url = o.getUrl(); @@ -157,22 +162,28 @@ public class CollectionServiceImpl extends ServiceImpl minioUtil.doesObjectExist(d.getUrl())) + .collect(Collectors.toList())); break; + case COLOR_BOARD: response.setColorBoards(resolveColorBoard(v)); break; + case MARKETING_SKETCH: response.setMarketingSketchs(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); })); break; + default: + break; } }); + if (CollectionUtil.isNotEmpty(response.getColorBoards())) { List collect = response.getColorBoards().stream() .distinct()