BUGFIX: 隐藏加载不出minio的相关数据;

This commit is contained in:
shahaibo
2025-03-12 22:06:39 +08:00
parent 484a8d1d93
commit d3ee0e5f4f

View File

@@ -115,6 +115,7 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
Map<String, List<CollectionElement>> maps = collectionElements Map<String, List<CollectionElement>> maps = collectionElements
.stream() .stream()
.collect(Collectors.groupingBy(CollectionElement::getLevel1Type)); .collect(Collectors.groupingBy(CollectionElement::getLevel1Type));
maps.forEach((k, v) -> { maps.forEach((k, v) -> {
CollectionLevel1TypeEnum level1TypeEnum = CollectionLevel1TypeEnum.uploadOf(k); CollectionLevel1TypeEnum level1TypeEnum = CollectionLevel1TypeEnum.uploadOf(k);
if (Objects.isNull(level1TypeEnum)) { if (Objects.isNull(level1TypeEnum)) {
@@ -122,30 +123,34 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
} }
switch (level1TypeEnum) { switch (level1TypeEnum) {
case MOOD_BOARD: case MOOD_BOARD:
response.setMoodBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { List<CollectionElementVO> moodBoards = CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
String url = o.getUrl(); String url = o.getUrl();
if (minioUtil.doesObjectExist(url)) { if (minioUtil.doesObjectExist(url)) {
d.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60)); 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; break;
case PRINT_BOARD: case PRINT_BOARD:
response.setPrintBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { List<CollectionElementVO> printBoards = CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
d.setIsPin(o.getHasPin()); d.setIsPin(o.getHasPin());
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
String url = o.getUrl(); String url = o.getUrl();
if (minioUtil.doesObjectExist(url)) { if (minioUtil.doesObjectExist(url)) {
d.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60)); 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; break;
case SKETCH_BOARD: case SKETCH_BOARD:
response.setSketchBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { List<CollectionElementVO> sketchBoards = CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
d.setIsPin(o.getHasPin()); d.setIsPin(o.getHasPin());
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
String url = o.getUrl(); String url = o.getUrl();
@@ -157,22 +162,28 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
} else { } else {
d.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60)); d.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60));
} }
} else {
response.getSketchBoards().remove(d);
} }
})); });
response.setSketchBoards(sketchBoards.stream()
.filter(d -> minioUtil.doesObjectExist(d.getUrl()))
.collect(Collectors.toList()));
break; break;
case COLOR_BOARD: case COLOR_BOARD:
response.setColorBoards(resolveColorBoard(v)); response.setColorBoards(resolveColorBoard(v));
break; break;
case MARKETING_SKETCH: case MARKETING_SKETCH:
response.setMarketingSketchs(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> { response.setMarketingSketchs(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName()); d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
})); }));
break; break;
default: default:
break;
} }
}); });
if (CollectionUtil.isNotEmpty(response.getColorBoards())) { if (CollectionUtil.isNotEmpty(response.getColorBoards())) {
List<CollectionColorVO> collect = response.getColorBoards().stream() List<CollectionColorVO> collect = response.getColorBoards().stream()
.distinct() .distinct()