fix:作品快照序列化问题导致报错

This commit is contained in:
litianxiang
2025-10-16 11:51:29 +08:00
parent d5b972ab16
commit 8c3e1fdda5
2 changed files with 9 additions and 5 deletions

View File

@@ -21,6 +21,8 @@ import com.ai.da.model.enums.Sex;
import com.ai.da.model.vo.*;
import com.ai.da.service.*;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -267,7 +269,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
}
projectSnapshot.setUserLikeList(list);
}
String snapshotJson = JSONObject.toJSONString(projectSnapshot);
String snapshotJson = JSONObject.toJSONString(projectSnapshot, SerializerFeature.DisableCircularReferenceDetect);
portfolio.setSnapshot(snapshotJson);
} else {
@@ -543,7 +545,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
if (vo.getOpenSource() == 1) {
if (!StringUtils.isEmpty(portfolio.getSnapshot())) {
ProjectSnapshot projectSnapshot = JSONObject.parseObject(portfolio.getSnapshot(), ProjectSnapshot.class);
ProjectSnapshot projectSnapshot = JSONObject.parseObject(portfolio.getSnapshot(), ProjectSnapshot.class, Feature.DisableCircularReferenceDetect);
List<CollectionElement> collectionElementList = projectSnapshot.getCollectionElementList();
for (CollectionElement element : collectionElementList) {
if (StringUtils.isEmpty(element.getUrl())) {
@@ -557,8 +559,10 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
List<TDesignPythonOutfit> list = new ArrayList<>();
for (UserLikeSnapshot userLikeSnapshot : userLikeList) {
TDesignPythonOutfit designPythonOutfit = userLikeSnapshot.getDesignPythonOutfit();
designPythonOutfit.setDesignUrl(minioUtil.getPreSignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
list.add(designPythonOutfit);
if (designPythonOutfit != null && !StringUtils.isEmpty(designPythonOutfit.getDesignUrl())) {
designPythonOutfit.setDesignUrl(minioUtil.getPreSignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
list.add(designPythonOutfit);
}
}
vo.setDesignPythonOutfitList(list);
}