BUGFIX:未生成完成的项目获取moduleContent报错

This commit is contained in:
2025-07-07 14:14:45 +08:00
parent 0a2c5e028f
commit ec7d84b354

View File

@@ -1708,7 +1708,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
if (null != collectionElement.getIsCompositeImage() && collectionElement.getIsCompositeImage() == 1) {
moodBoardModuleChooseVO.setMoodTemplateId(String.valueOf(collectionElement.getId()));
moodBoardModuleChooseVO.setMoodTemplateName(collectionElement.getName());
moodBoardModuleChooseVO.setMoodTemplateUrl(minioUtil.getPreSignedUrl(collectionElement.getUrl(), 24 * 60));
moodBoardModuleChooseVO.setMoodTemplateUrl(getMinioUrl(collectionElement.getUrl()));
String moodboardPositionString = collectionService.getMoodboardPositionString(collectionElement.getId());
if (!StringUtils.isEmpty(moodboardPositionString)) {
@@ -1721,7 +1721,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String url = collectionElement.getUrl();
collectionElementVO.setOriginalUrl(url);
if (minioUtil.doesObjectExist(url)) {
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60));
collectionElementVO.setUrl(getMinioUrl(url));
}
if (minioUtil.doesObjectExist(collectionElementVO.getOriginalUrl())) {
list.add(collectionElementVO);
@@ -1744,7 +1744,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String url = collectionElement.getUrl();
collectionElementVO.setOriginalUrl(url);
if (minioUtil.doesObjectExist(url)) {
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60));
collectionElementVO.setUrl(getMinioUrl(url));
}
if (minioUtil.doesObjectExist(collectionElementVO.getOriginalUrl())) {
list.add(collectionElementVO);
@@ -1766,12 +1766,12 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String url = collectionElement.getUrl();
collectionElementVO.setOriginalUrl(url);
if (minioUtil.doesObjectExist(url)) {
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(url, 24 * 60));
collectionElementVO.setUrl(getMinioUrl(url));
if (url.contains(".")) {
String[] split = url.split("\\.");
collectionElementVO.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60));
collectionElementVO.setUrlWithWhiteSide(getMinioUrl(split[0] + "-show." + split[1]));
} else {
collectionElementVO.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60));
collectionElementVO.setUrlWithWhiteSide(getMinioUrl(url + "-show"));
}
}
if (minioUtil.doesObjectExist(collectionElementVO.getOriginalUrl())) {
@@ -1784,9 +1784,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
String url = collectionElement.getUrl();
if (url.contains(".")) {
String[] split = url.split("\\.");
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60, true));
vo.setUrlWithWhiteSide(getMinioUrl(split[0] + "-show." + split[1], true));
}else {
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60, true));
vo.setUrlWithWhiteSide(getMinioUrl(url + "-show", true));
}
vo.setIsPin(collectionElement.getHasPin());
vo.setLevel2Type(collectionElement.getLevel2Type());
@@ -1819,7 +1819,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
int index = o.getUrl().lastIndexOf("/");
o.setPictureName(o.getUrl().substring(index + 1));
}
o.setDesignOutfitUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
o.setDesignOutfitUrl(getMinioUrl(o.getUrl()));
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
@@ -1885,10 +1885,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
poseTransformationVO.setId(item.getId());
poseTransformationVO.setProductImage(minioUtil.getPreSignedUrl(item.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(item.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(item.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(item.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
poseTransformationVO.setProductImage(getMinioUrl(item.getProductImage()));
poseTransformationVO.setGifUrl(getMinioUrl(item.getGifUrl()));
poseTransformationVO.setVideoUrl(getMinioUrl(item.getVideoUrl()));
poseTransformationVO.setFirstFrameUrl(getMinioUrl(item.getFirstFrameUrl()));
poseTransformationVO.setIsLiked(item.getIsLiked());
poseTransformationVO.setCollectionType(CollectionType.POSE_TRANSFORM.getValue());
poseTransformationVO.setSort(userLikeSort.getSort());
@@ -2007,7 +2007,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
if (null != threeDModule.getCollectionElementId()) {
CollectionElement collectionElement = collectionElementMapper.selectById(threeDModule.getCollectionElementId());
if (Objects.nonNull(collectionElement)) {
threeDModuleVO.setPrintMinioUrl(minioUtil.getPreSignedUrl(collectionElement.getUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
threeDModuleVO.setPrintMinioUrl(getMinioUrl(collectionElement.getUrl()));
}
}
// if (!StringUtils.isEmpty(threeDModuleVO.getPrintMinioUrl())) {
@@ -2026,7 +2026,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
for (CollectionElement collectionElement : collectionElements) {
CollectionElementVO collectionElementVO = CopyUtil.copyObject(collectionElement, CollectionElementVO.class);
CollectionElementRelModel relModel = getCollectionElementRelModel(collectionElementVO.getId());
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(collectionElementVO.getUrl(), 24 * 60));
collectionElementVO.setUrl(getMinioUrl(collectionElementVO.getUrl()));
collectionElementVO.setMannequinRelationId(relModel.getRelationId());
collectionElementVO.setMannequinRelationType(relModel.getRelationType());
collectionElementVO.setCollectionId(collectionElement.getId());
@@ -2039,7 +2039,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
qw.lambda().eq(ToProductElement::getProjectId, projectDTO.getId());
List<ToProductElement> toProductElements = toProductElementMapper.selectList(qw);
for (ToProductElement toProductElement : toProductElements) {
toProductElement.setUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
toProductElement.setUrl(getMinioUrl(toProductElement.getUrl()));
}
moduleChooseVO.setUploadElement(toProductElements);
}
@@ -2054,6 +2054,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
return null;
}
private String getMinioUrl(String minioPath, boolean resetCatch){
if (!StringUtil.isNullOrEmpty(minioPath)){
return minioUtil.getPreSignedUrl(minioPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME, resetCatch);
}
return null;
}
private CollectionElementRelModel getCollectionElementRelModel(Long id) {
QueryWrapper<CollectionElementRelModel> qw = new QueryWrapper<>();
qw.lambda().eq(CollectionElementRelModel::getCollectionElementId, id);