You've already forked FrameTour-BE
全免费逻辑
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.ycwl.basic.task;
|
||||
|
||||
import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.device.DeviceFactory;
|
||||
import com.ycwl.basic.device.entity.common.FileObject;
|
||||
import com.ycwl.basic.device.operator.IDeviceStorageOperator;
|
||||
@ -7,6 +8,7 @@ import com.ycwl.basic.device.repository.DeviceRepository;
|
||||
import com.ycwl.basic.mapper.DeviceMapper;
|
||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
import com.ycwl.basic.mapper.SourceMapper;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||
@ -48,6 +50,8 @@ public class VideoPieceGetter {
|
||||
private DeviceRepository deviceRepository;
|
||||
@Autowired
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private OrderBiz orderBiz;
|
||||
|
||||
@Data
|
||||
public static class Task {
|
||||
@ -89,6 +93,7 @@ public class VideoPieceGetter {
|
||||
DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId());
|
||||
|
||||
SourceEntity source = sourceMapper.querySameVideo(faceSample.getId(), device.getId());
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(task.getMemberId(), faceSample.getScenicId(), 1, faceSample.getId());
|
||||
if (source != null) {
|
||||
// 有原视频
|
||||
int count = sourceMapper.hasRelationTo(task.getMemberId(), source.getId(), 1);
|
||||
@ -101,7 +106,13 @@ public class VideoPieceGetter {
|
||||
videoSource.setFaceId(task.getFaceId());
|
||||
videoSource.setMemberId(task.getMemberId());
|
||||
videoSource.setType(1);
|
||||
videoSource.setIsBuy(0);
|
||||
if (isBuy.isBuy()) { // 如果用户买过
|
||||
videoSource.setIsBuy(1);
|
||||
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||
videoSource.setIsBuy(1);
|
||||
} else {
|
||||
videoSource.setIsBuy(0);
|
||||
}
|
||||
videoSource.setSourceId(source.getId());
|
||||
sourceMapper.addRelation(videoSource);
|
||||
return;
|
||||
@ -155,7 +166,6 @@ public class VideoPieceGetter {
|
||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||
videoSource.setMemberId(task.getMemberId());
|
||||
videoSource.setType(1);
|
||||
videoSource.setIsBuy(0);
|
||||
videoSource.setFaceId(task.getFaceId());
|
||||
videoSource.setScenicId(faceSample.getScenicId());
|
||||
videoSource.setSourceId(sourceEntity.getId());
|
||||
@ -168,6 +178,13 @@ public class VideoPieceGetter {
|
||||
sourceEntity.setScenicId(faceSample.getScenicId());
|
||||
sourceEntity.setDeviceId(faceSample.getDeviceId());
|
||||
sourceEntity.setType(1);
|
||||
if (isBuy.isBuy()) { // 如果用户买过
|
||||
videoSource.setIsBuy(1);
|
||||
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||
videoSource.setIsBuy(1);
|
||||
} else {
|
||||
videoSource.setIsBuy(0);
|
||||
}
|
||||
sourceMapper.add(sourceEntity);
|
||||
sourceMapper.addRelation(videoSource);
|
||||
});
|
||||
|
Reference in New Issue
Block a user