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
.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<CollectionMapper, Collect
}
switch (level1TypeEnum) {
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());
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<CollectionElementVO> 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<CollectionElementVO> 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<CollectionMapper, Collect
} else {
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;
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<CollectionColorVO> collect = response.getColorBoards().stream()
.distinct()