feat(PriceBiz): 新增商品类型字段并完善商品列表逻辑
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good

新增 GoodsListRespVO 中的 goodsType 字段,用于区分不同商品类型。补充商品列表中“录像集”与“照片集”的类型标识。
在 PriceBiz 中注入 FaceService 并延迟加载,优化依赖关系。
根据内容购买状态判断是否整体购买,增强一口价商品的处理逻辑。
This commit is contained in:
2025-09-20 04:51:51 +08:00
parent f10ede0d2c
commit 7ca59a1b0b
3 changed files with 21 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
package com.ycwl.basic.biz;
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
import com.ycwl.basic.model.pc.coupon.entity.CouponEntity;
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
@@ -15,14 +17,17 @@ import com.ycwl.basic.repository.FaceRepository;
import com.ycwl.basic.repository.PriceRepository;
import com.ycwl.basic.repository.ScenicRepository;
import com.ycwl.basic.repository.TemplateRepository;
import com.ycwl.basic.service.pc.FaceService;
import org.apache.commons.lang3.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Component
@@ -38,6 +43,9 @@ public class PriceBiz {
@Autowired
private FaceRepository faceRepository;
@Autowired
@Lazy
private FaceService faceService;
@Autowired
private CouponBiz couponBiz;
public List<GoodsListRespVO> listGoodsByScenic(Long scenicId) {
@@ -48,15 +56,16 @@ public class PriceBiz {
GoodsListRespVO goods = new GoodsListRespVO();
goods.setGoodsId(template.getId());
goods.setGoodsName(template.getName());
goods.setGoodsType(0);
return goods;
}).forEach(goodsList::add);
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
if (scenicConfig != null) {
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
goodsList.add(new GoodsListRespVO(1L, "录像集"));
goodsList.add(new GoodsListRespVO(1L, "录像集", 1));
}
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
goodsList.add(new GoodsListRespVO(2L, "照片集"));
goodsList.add(new GoodsListRespVO(2L, "照片集", 2));
}
}
return goodsList;
@@ -140,6 +149,14 @@ public class PriceBiz {
respVO.setBuy(Integer.valueOf(1).equals(orderEntity.getStatus()));
}
}
if (type == -1 && !respVO.isBuy()) {
// 查找所有内容是否购买。
List<ContentPageVO> list = faceService.faceContentList(faceId);
boolean notBuy = list.stream().anyMatch(item -> Integer.valueOf(0).equals(item.getIsBuy()));
if (!notBuy) {
respVO.setBuy(true);
}
}
respVO.setShare(false);
if (face == null || !face.getMemberId().equals(userId)) {
respVO.setShare(true);