You've already forked FrameTour-BE
refactor(mobile): 重构商品页面逻辑
- 引入 ScenicConfigManager 接口以更好地处理景点配置 - 优化源素材查询和处理逻辑 -改进商品类型的处理方式,增加未知商品类型处理 - 优化商品封面图的获取逻辑,优先使用景点配置中的封面图
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ycwl.basic.service.mobile.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.ycwl.basic.integration.common.manager.ScenicConfigManager;
|
||||
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
|
||||
import com.ycwl.basic.utils.JacksonUtil;
|
||||
import com.ycwl.basic.biz.CouponBiz;
|
||||
@@ -147,27 +148,32 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
sourceReqQuery.setMemberId(Long.valueOf(BaseContextHandler.getUserId()));
|
||||
//查询源素材
|
||||
List<SourceRespVO> sourceList = sourceMapper.queryByRelation(sourceReqQuery);
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(scenicId);
|
||||
List<GoodsPageVO> sourceGoods = sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getFaceId)).entrySet().stream().flatMap((faceEntry) -> {
|
||||
Long faceId = faceEntry.getKey();
|
||||
List<SourceRespVO> goods = faceEntry.getValue();
|
||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().filter(type -> {
|
||||
if (Integer.valueOf(1).equals(type)) {
|
||||
return !Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo());
|
||||
return !Boolean.TRUE.equals(scenicConfig.getBoolean("disable_source_video"));
|
||||
} else if (Integer.valueOf(2).equals(type)) {
|
||||
return !Boolean.TRUE.equals(scenicConfig.getDisableSourceImage());
|
||||
return !Boolean.TRUE.equals(scenicConfig.getBoolean("disable_source_image"));
|
||||
}
|
||||
return true;
|
||||
}).map(type -> {
|
||||
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
||||
goodsPageVO.setTemplateCoverUrl(goods.getFirst().getUrl());
|
||||
goodsPageVO.setFaceId(faceId);
|
||||
goodsPageVO.setGoodsType(type);
|
||||
if (type == 1) {
|
||||
goodsPageVO.setGoodsName("录像集");
|
||||
goodsPageVO.setGoodsType(1);
|
||||
} else {
|
||||
goodsPageVO.setTemplateCoverUrl(scenicConfig.getString("video_cover_url"));
|
||||
} else if (type == 2) {
|
||||
goodsPageVO.setGoodsName("照片集");
|
||||
goodsPageVO.setGoodsType(2);
|
||||
goodsPageVO.setTemplateCoverUrl(scenicConfig.getString("photo_cover_url"));
|
||||
} else {
|
||||
goodsPageVO.setGoodsName("未知商品");
|
||||
}
|
||||
if (StringUtils.isBlank(goodsPageVO.getTemplateCoverUrl())) {
|
||||
goodsPageVO.setTemplateCoverUrl(goods.getFirst().getUrl());
|
||||
}
|
||||
goodsPageVO.setScenicId(query.getScenicId());
|
||||
return goodsPageVO;
|
||||
|
Reference in New Issue
Block a user