You've already forked FrameTour-BE
isBuy
This commit is contained in:
@@ -152,6 +152,9 @@ public class OrderBiz {
|
|||||||
if (!isBuy) {
|
if (!isBuy) {
|
||||||
if (goodsType == 0) {
|
if (goodsType == 0) {
|
||||||
VideoEntity video = videoRepository.getVideo(goodsId);
|
VideoEntity video = videoRepository.getVideo(goodsId);
|
||||||
|
if (video == null) {
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
TaskEntity task = videoTaskRepository.getTaskById(video.getTaskId());
|
TaskEntity task = videoTaskRepository.getTaskById(video.getTaskId());
|
||||||
Long templateId = video.getTemplateId();
|
Long templateId = video.getTemplateId();
|
||||||
// -1为整个模板购买
|
// -1为整个模板购买
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
package com.ycwl.basic.repository;
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
|
import com.ycwl.basic.biz.PriceBiz;
|
||||||
|
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
|
||||||
|
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||||
import com.ycwl.basic.utils.JacksonUtil;
|
import com.ycwl.basic.utils.JacksonUtil;
|
||||||
import com.ycwl.basic.mapper.VideoMapper;
|
import com.ycwl.basic.mapper.VideoMapper;
|
||||||
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||||
@@ -7,6 +10,7 @@ import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
|||||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||||
import com.ycwl.basic.model.task.req.VideoInfoReq;
|
import com.ycwl.basic.model.task.req.VideoInfoReq;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -22,6 +26,9 @@ public class VideoRepository {
|
|||||||
|
|
||||||
public static final String VIDEO_CACHE_KEY = "video:%s";
|
public static final String VIDEO_CACHE_KEY = "video:%s";
|
||||||
public static final String VIDEO_BY_TASK_ID_CACHE_KEY = "video:task:%s";
|
public static final String VIDEO_BY_TASK_ID_CACHE_KEY = "video:task:%s";
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private PriceBiz priceBiz;
|
||||||
|
|
||||||
public VideoEntity getVideo(Long videoId) {
|
public VideoEntity getVideo(Long videoId) {
|
||||||
if (redisTemplate.hasKey(String.format(VIDEO_CACHE_KEY, videoId))) {
|
if (redisTemplate.hasKey(String.format(VIDEO_CACHE_KEY, videoId))) {
|
||||||
@@ -86,7 +93,20 @@ public class VideoRepository {
|
|||||||
if (memberVideo == null) {
|
if (memberVideo == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Integer.valueOf(1).equals(memberVideo.getIsBuy());
|
boolean isBuy = Integer.valueOf(1).equals(memberVideo.getIsBuy());
|
||||||
|
if (isBuy) {
|
||||||
|
return isBuy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一口价
|
||||||
|
IsBuyBatchRespVO buy = priceBiz.isBuy(userId, memberVideo.getFaceId(), memberVideo.getScenicId(), -1, null);
|
||||||
|
if (buy == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (buy.isBuy()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return isBuy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearVideoCache(Long videoId) {
|
public boolean clearVideoCache(Long videoId) {
|
||||||
|
@@ -269,14 +269,19 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
goodsDetailVO.setFaceId(entity.getFaceId());
|
goodsDetailVO.setFaceId(entity.getFaceId());
|
||||||
goodsDetailVO.setIsBuy(entity.getIsBuy());
|
goodsDetailVO.setIsBuy(entity.getIsBuy());
|
||||||
if (Integer.valueOf(0).equals(entity.getIsBuy())) {
|
if (Integer.valueOf(0).equals(entity.getIsBuy())) {
|
||||||
PriceObj priceObj = orderBiz.queryPrice(videoRespVO.getScenicId(), 0, videoId);
|
IsBuyRespVO buy = orderBiz.isBuy(userId, videoRespVO.getScenicId(), 0, videoId);
|
||||||
if (priceObj.isFree()) {
|
if (!buy.isBuy()) {
|
||||||
goodsDetailVO.setIsBuy(1);
|
PriceObj priceObj = orderBiz.queryPrice(videoRespVO.getScenicId(), 0, videoId);
|
||||||
|
if (priceObj.isFree()) {
|
||||||
|
goodsDetailVO.setIsBuy(1);
|
||||||
|
} else {
|
||||||
|
goodsDetailVO.setIsBuy(0);
|
||||||
|
goodsDetailVO.setPrice(priceObj.getPrice().toString());
|
||||||
|
goodsDetailVO.setOrigPrice(priceObj.getPrice());
|
||||||
|
goodsDetailVO.setSlashPrice(priceObj.getSlashPrice());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
goodsDetailVO.setIsBuy(0);
|
goodsDetailVO.setIsBuy(1);
|
||||||
goodsDetailVO.setPrice(priceObj.getPrice().toString());
|
|
||||||
goodsDetailVO.setOrigPrice(priceObj.getPrice());
|
|
||||||
goodsDetailVO.setSlashPrice(priceObj.getSlashPrice());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -413,6 +413,10 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
contentPageVO.setLockType(1);
|
contentPageVO.setLockType(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IsBuyRespVO buy = orderBiz.isBuy(userId, contentPageVO.getScenicId(), contentPageVO.getGoodsType(), contentPageVO.getContentId());
|
||||||
|
if (buy.isBuy()) {
|
||||||
|
contentPageVO.setIsBuy(1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||||
|
Reference in New Issue
Block a user