全免费逻辑
This commit is contained in:
parent
92b8283443
commit
7b0930afc4
@ -37,7 +37,7 @@ public class OrderBiz {
|
||||
priceObj.setGoodsId(goodsId);
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||
if (scenicConfig != null) {
|
||||
if (0 != scenicConfig.getAllFree()) {
|
||||
if (Integer.valueOf(1).equals(scenicConfig.getAllFree())) {
|
||||
// 景区全免
|
||||
priceObj.setFree(true);
|
||||
priceObj.setPrice(BigDecimal.ZERO);
|
||||
@ -98,6 +98,7 @@ public class OrderBiz {
|
||||
if (priceObj == null) {
|
||||
return respVO;
|
||||
}
|
||||
respVO.setFree(priceObj.isFree());
|
||||
respVO.setGoodsType(goodsType);
|
||||
respVO.setGoodsId(goodsId);
|
||||
respVO.setPrice(priceObj.getPrice());
|
||||
|
@ -6,7 +6,8 @@ import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class IsBuyRespVO {
|
||||
private boolean isBuy;
|
||||
private boolean buy;
|
||||
private boolean free;
|
||||
private Long orderId;
|
||||
private int goodsType;
|
||||
private Long goodsId;
|
||||
|
@ -33,7 +33,6 @@ public class ScenicConfigEntity {
|
||||
* 是否为默认
|
||||
*/
|
||||
private Integer isDefault;
|
||||
private Integer allFree;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ -56,4 +55,7 @@ public class ScenicConfigEntity {
|
||||
* 最大行程时长
|
||||
*/
|
||||
private Integer maxJourneyHour;
|
||||
private Integer allFree;
|
||||
private Integer disableSourceVideo;
|
||||
private Integer disableSourceImage;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.ycwl.basic.service.impl.pc;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.enums.StatisticEnum;
|
||||
import com.ycwl.basic.exception.BaseException;
|
||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
@ -10,6 +11,7 @@ import com.ycwl.basic.mapper.StatisticsMapper;
|
||||
import com.ycwl.basic.mapper.FaceMapper;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
@ -62,6 +64,8 @@ public class FaceServiceImpl implements FaceService {
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private FaceSampleMapper faceSampleMapper;
|
||||
@Autowired
|
||||
private OrderBiz orderBiz;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||
@ -200,7 +204,14 @@ public class FaceServiceImpl implements FaceService {
|
||||
memberSourceEntity.setMemberId(userId);
|
||||
memberSourceEntity.setSourceId(sourceEntity.getId());
|
||||
memberSourceEntity.setType(sourceEntity.getType());
|
||||
memberSourceEntity.setIsBuy(0);
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(userId, scenicId, sourceEntity.getType(), sourceEntity.getId());
|
||||
if (isBuy.isBuy()) { // 如果用户买过
|
||||
memberSourceEntity.setIsBuy(1);
|
||||
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||
memberSourceEntity.setIsBuy(1);
|
||||
} else {
|
||||
memberSourceEntity.setIsBuy(0);
|
||||
}
|
||||
return memberSourceEntity;
|
||||
}).collect(Collectors.toList());
|
||||
sourceMapper.addRelations(memberSourceEntityList);
|
||||
|
@ -20,6 +20,7 @@ import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||
@ -223,11 +224,18 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (faceSampleList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
||||
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(faceRespVO.getScenicId());
|
||||
if (templateList == null || templateList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
createTaskByFaceIdAndTempalteId(faceId, templateList.get(0).getId(), 1);
|
||||
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
||||
templateList.forEach(template -> {
|
||||
createTaskByFaceIdAndTempalteId(faceId, template.getId(), 1);
|
||||
});
|
||||
} else {
|
||||
createTaskByFaceIdAndTempalteId(faceId, templateList.get(0).getId(), 1);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId) {
|
||||
@ -237,6 +245,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
@Override
|
||||
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId, int automatic) {
|
||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
||||
List<FaceSampleRespVO> faceSampleList = faceSampleMapper.listByIds(Arrays.stream(faceRespVO.getMatchSampleIds().split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
if (faceSampleList.isEmpty()) {
|
||||
return;
|
||||
@ -260,7 +269,11 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
memberVideo.setScenicId(task.getScenicId());
|
||||
memberVideo.setFaceId(faceId);
|
||||
memberVideo.setTemplateId(task.getTemplateId());
|
||||
memberVideo.setIsBuy(0);
|
||||
if (Integer.valueOf(1).equals(scenicConfig.getAllFree())) {
|
||||
memberVideo.setIsBuy(1);
|
||||
} else {
|
||||
memberVideo.setIsBuy(0);
|
||||
}
|
||||
memberVideo.setTaskId(task.getId());
|
||||
VideoEntity video = videoMapper.findByTaskId(task.getId());
|
||||
if (video != null) {
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -84,6 +84,8 @@
|
||||
sample_store_day=#{sampleStoreDay},
|
||||
video_store_day=#{videoStoreDay},
|
||||
max_journey_hour=#{maxJourneyHour},
|
||||
disable_source_video=#{disableSourceVideo},
|
||||
disable_source_image=#{disableSourceImage}
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
Loading…
x
Reference in New Issue
Block a user