You've already forked FrameTour-BE
feat(PriceBiz): 新增商品类型字段并完善商品列表逻辑
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
新增 GoodsListRespVO 中的 goodsType 字段,用于区分不同商品类型。补充商品列表中“录像集”与“照片集”的类型标识。 在 PriceBiz 中注入 FaceService 并延迟加载,优化依赖关系。 根据内容购买状态判断是否整体购买,增强一口价商品的处理逻辑。
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package com.ycwl.basic.biz;
|
package com.ycwl.basic.biz;
|
||||||
|
|
||||||
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
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.coupon.entity.CouponEntity;
|
||||||
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
import com.ycwl.basic.model.pc.couponRecord.resp.CouponRecordQueryResp;
|
||||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
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.PriceRepository;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
|
import com.ycwl.basic.service.pc.FaceService;
|
||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -38,6 +43,9 @@ public class PriceBiz {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FaceRepository faceRepository;
|
private FaceRepository faceRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private FaceService faceService;
|
||||||
|
@Autowired
|
||||||
private CouponBiz couponBiz;
|
private CouponBiz couponBiz;
|
||||||
|
|
||||||
public List<GoodsListRespVO> listGoodsByScenic(Long scenicId) {
|
public List<GoodsListRespVO> listGoodsByScenic(Long scenicId) {
|
||||||
@@ -48,15 +56,16 @@ public class PriceBiz {
|
|||||||
GoodsListRespVO goods = new GoodsListRespVO();
|
GoodsListRespVO goods = new GoodsListRespVO();
|
||||||
goods.setGoodsId(template.getId());
|
goods.setGoodsId(template.getId());
|
||||||
goods.setGoodsName(template.getName());
|
goods.setGoodsName(template.getName());
|
||||||
|
goods.setGoodsType(0);
|
||||||
return goods;
|
return goods;
|
||||||
}).forEach(goodsList::add);
|
}).forEach(goodsList::add);
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||||
if (scenicConfig != null) {
|
if (scenicConfig != null) {
|
||||||
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
goodsList.add(new GoodsListRespVO(1L, "录像集"));
|
goodsList.add(new GoodsListRespVO(1L, "录像集", 1));
|
||||||
}
|
}
|
||||||
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
||||||
goodsList.add(new GoodsListRespVO(2L, "照片集"));
|
goodsList.add(new GoodsListRespVO(2L, "照片集", 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return goodsList;
|
return goodsList;
|
||||||
@@ -140,6 +149,14 @@ public class PriceBiz {
|
|||||||
respVO.setBuy(Integer.valueOf(1).equals(orderEntity.getStatus()));
|
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);
|
respVO.setShare(false);
|
||||||
if (face == null || !face.getMemberId().equals(userId)) {
|
if (face == null || !face.getMemberId().equals(userId)) {
|
||||||
respVO.setShare(true);
|
respVO.setShare(true);
|
||||||
|
@@ -25,7 +25,7 @@ public class CouponController {
|
|||||||
@GetMapping("/{scenicId}/goodsList")
|
@GetMapping("/{scenicId}/goodsList")
|
||||||
public ApiResponse<List<GoodsListRespVO>> scenicGoodsList(@PathVariable Long scenicId) {
|
public ApiResponse<List<GoodsListRespVO>> scenicGoodsList(@PathVariable Long scenicId) {
|
||||||
List<GoodsListRespVO> data = priceBiz.listGoodsByScenic(scenicId);
|
List<GoodsListRespVO> data = priceBiz.listGoodsByScenic(scenicId);
|
||||||
data.add(new GoodsListRespVO(-1L, "一口价"));
|
data.add(new GoodsListRespVO(-1L, "一口价", -1));
|
||||||
return ApiResponse.success(data);
|
return ApiResponse.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,4 +10,5 @@ import lombok.NoArgsConstructor;
|
|||||||
public class GoodsListRespVO {
|
public class GoodsListRespVO {
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
private Integer goodsType;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user