You've already forked FrameTour-BE
全免费、0元购模式
This commit is contained in:
@ -5,6 +5,7 @@ import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
@ -14,6 +15,8 @@ import com.ycwl.basic.repository.TemplateRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Component
|
||||
public class OrderBiz {
|
||||
|
||||
@ -28,10 +31,20 @@ public class OrderBiz {
|
||||
@Autowired
|
||||
private OrderRepository orderRepository;
|
||||
|
||||
public PriceObj queryPrice(int goodsType, Long goodsId) {
|
||||
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||
PriceObj priceObj = new PriceObj();
|
||||
priceObj.setGoodsType(goodsType);
|
||||
priceObj.setGoodsId(goodsId);
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null) {
|
||||
if (0 != scenicConfig.getAllFree()) {
|
||||
// 景区全免
|
||||
priceObj.setFree(true);
|
||||
priceObj.setPrice(BigDecimal.ZERO);
|
||||
priceObj.setSlashPrice(BigDecimal.ZERO);
|
||||
return priceObj;
|
||||
}
|
||||
}
|
||||
switch (goodsType) {
|
||||
case 0: // video
|
||||
VideoRespVO video = videoMapper.getById(goodsId);
|
||||
@ -76,12 +89,12 @@ public class OrderBiz {
|
||||
return priceObj;
|
||||
}
|
||||
|
||||
public IsBuyRespVO isBuy(Long userId, int goodsType, Long goodsId) {
|
||||
public IsBuyRespVO isBuy(Long userId, Long scenicId, int goodsType, Long goodsId) {
|
||||
IsBuyRespVO respVO = new IsBuyRespVO();
|
||||
boolean isBuy = orderRepository.checkUserBuyItem(userId, goodsType, goodsId);
|
||||
respVO.setBuy(isBuy);
|
||||
if (!isBuy) {
|
||||
PriceObj priceObj = queryPrice(goodsType, goodsId);
|
||||
PriceObj priceObj = queryPrice(scenicId, goodsType, goodsId);
|
||||
if (priceObj == null) {
|
||||
return respVO;
|
||||
}
|
||||
|
Reference in New Issue
Block a user