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()