You've already forked FrameTour-BE
全免费逻辑
This commit is contained in:
@ -37,7 +37,7 @@ public class OrderBiz {
|
|||||||
priceObj.setGoodsId(goodsId);
|
priceObj.setGoodsId(goodsId);
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||||
if (scenicConfig != null) {
|
if (scenicConfig != null) {
|
||||||
if (0 != scenicConfig.getAllFree()) {
|
if (Integer.valueOf(1).equals(scenicConfig.getAllFree())) {
|
||||||
// 景区全免
|
// 景区全免
|
||||||
priceObj.setFree(true);
|
priceObj.setFree(true);
|
||||||
priceObj.setPrice(BigDecimal.ZERO);
|
priceObj.setPrice(BigDecimal.ZERO);
|
||||||
@ -98,6 +98,7 @@ public class OrderBiz {
|
|||||||
if (priceObj == null) {
|
if (priceObj == null) {
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
respVO.setFree(priceObj.isFree());
|
||||||
respVO.setGoodsType(goodsType);
|
respVO.setGoodsType(goodsType);
|
||||||
respVO.setGoodsId(goodsId);
|
respVO.setGoodsId(goodsId);
|
||||||
respVO.setPrice(priceObj.getPrice());
|
respVO.setPrice(priceObj.getPrice());
|
||||||
|
@ -6,7 +6,8 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IsBuyRespVO {
|
public class IsBuyRespVO {
|
||||||
private boolean isBuy;
|
private boolean buy;
|
||||||
|
private boolean free;
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
private int goodsType;
|
private int goodsType;
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
@ -33,7 +33,6 @@ public class ScenicConfigEntity {
|
|||||||
* 是否为默认
|
* 是否为默认
|
||||||
*/
|
*/
|
||||||
private Integer isDefault;
|
private Integer isDefault;
|
||||||
private Integer allFree;
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@ -56,4 +55,7 @@ public class ScenicConfigEntity {
|
|||||||
* 最大行程时长
|
* 最大行程时长
|
||||||
*/
|
*/
|
||||||
private Integer maxJourneyHour;
|
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.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
import com.ycwl.basic.enums.StatisticEnum;
|
import com.ycwl.basic.enums.StatisticEnum;
|
||||||
import com.ycwl.basic.exception.BaseException;
|
import com.ycwl.basic.exception.BaseException;
|
||||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
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.mapper.FaceMapper;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
|
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.mobile.statistic.req.StatisticsRecordAddReq;
|
||||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||||
@ -62,6 +64,8 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
private SourceMapper sourceMapper;
|
private SourceMapper sourceMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaceSampleMapper faceSampleMapper;
|
private FaceSampleMapper faceSampleMapper;
|
||||||
|
@Autowired
|
||||||
|
private OrderBiz orderBiz;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||||
@ -200,7 +204,14 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
memberSourceEntity.setMemberId(userId);
|
memberSourceEntity.setMemberId(userId);
|
||||||
memberSourceEntity.setSourceId(sourceEntity.getId());
|
memberSourceEntity.setSourceId(sourceEntity.getId());
|
||||||
memberSourceEntity.setType(sourceEntity.getType());
|
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;
|
return memberSourceEntity;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
sourceMapper.addRelations(memberSourceEntityList);
|
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.member.resp.MemberRespVO;
|
||||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
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.scenic.entity.ScenicEntity;
|
||||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||||
@ -223,11 +224,18 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
if (faceSampleList.isEmpty()) {
|
if (faceSampleList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
||||||
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(faceRespVO.getScenicId());
|
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(faceRespVO.getScenicId());
|
||||||
if (templateList == null || templateList.isEmpty()) {
|
if (templateList == null || templateList.isEmpty()) {
|
||||||
return;
|
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
|
@Override
|
||||||
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId) {
|
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId) {
|
||||||
@ -237,6 +245,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
@Override
|
@Override
|
||||||
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId, int automatic) {
|
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId, int automatic) {
|
||||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
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()));
|
List<FaceSampleRespVO> faceSampleList = faceSampleMapper.listByIds(Arrays.stream(faceRespVO.getMatchSampleIds().split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||||
if (faceSampleList.isEmpty()) {
|
if (faceSampleList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@ -260,7 +269,11 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
memberVideo.setScenicId(task.getScenicId());
|
memberVideo.setScenicId(task.getScenicId());
|
||||||
memberVideo.setFaceId(faceId);
|
memberVideo.setFaceId(faceId);
|
||||||
memberVideo.setTemplateId(task.getTemplateId());
|
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());
|
memberVideo.setTaskId(task.getId());
|
||||||
VideoEntity video = videoMapper.findByTaskId(task.getId());
|
VideoEntity video = videoMapper.findByTaskId(task.getId());
|
||||||
if (video != null) {
|
if (video != null) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ycwl.basic.task;
|
package com.ycwl.basic.task;
|
||||||
|
|
||||||
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
import com.ycwl.basic.device.DeviceFactory;
|
import com.ycwl.basic.device.DeviceFactory;
|
||||||
import com.ycwl.basic.device.entity.common.FileObject;
|
import com.ycwl.basic.device.entity.common.FileObject;
|
||||||
import com.ycwl.basic.device.operator.IDeviceStorageOperator;
|
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.DeviceMapper;
|
||||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||||
import com.ycwl.basic.mapper.SourceMapper;
|
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.DeviceConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||||
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||||
@ -48,6 +50,8 @@ public class VideoPieceGetter {
|
|||||||
private DeviceRepository deviceRepository;
|
private DeviceRepository deviceRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SourceMapper sourceMapper;
|
private SourceMapper sourceMapper;
|
||||||
|
@Autowired
|
||||||
|
private OrderBiz orderBiz;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Task {
|
public static class Task {
|
||||||
@ -89,6 +93,7 @@ public class VideoPieceGetter {
|
|||||||
DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId());
|
DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId());
|
||||||
|
|
||||||
SourceEntity source = sourceMapper.querySameVideo(faceSample.getId(), device.getId());
|
SourceEntity source = sourceMapper.querySameVideo(faceSample.getId(), device.getId());
|
||||||
|
IsBuyRespVO isBuy = orderBiz.isBuy(task.getMemberId(), faceSample.getScenicId(), 1, faceSample.getId());
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
// 有原视频
|
// 有原视频
|
||||||
int count = sourceMapper.hasRelationTo(task.getMemberId(), source.getId(), 1);
|
int count = sourceMapper.hasRelationTo(task.getMemberId(), source.getId(), 1);
|
||||||
@ -101,7 +106,13 @@ public class VideoPieceGetter {
|
|||||||
videoSource.setFaceId(task.getFaceId());
|
videoSource.setFaceId(task.getFaceId());
|
||||||
videoSource.setMemberId(task.getMemberId());
|
videoSource.setMemberId(task.getMemberId());
|
||||||
videoSource.setType(1);
|
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());
|
videoSource.setSourceId(source.getId());
|
||||||
sourceMapper.addRelation(videoSource);
|
sourceMapper.addRelation(videoSource);
|
||||||
return;
|
return;
|
||||||
@ -155,7 +166,6 @@ public class VideoPieceGetter {
|
|||||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||||
videoSource.setMemberId(task.getMemberId());
|
videoSource.setMemberId(task.getMemberId());
|
||||||
videoSource.setType(1);
|
videoSource.setType(1);
|
||||||
videoSource.setIsBuy(0);
|
|
||||||
videoSource.setFaceId(task.getFaceId());
|
videoSource.setFaceId(task.getFaceId());
|
||||||
videoSource.setScenicId(faceSample.getScenicId());
|
videoSource.setScenicId(faceSample.getScenicId());
|
||||||
videoSource.setSourceId(sourceEntity.getId());
|
videoSource.setSourceId(sourceEntity.getId());
|
||||||
@ -168,6 +178,13 @@ public class VideoPieceGetter {
|
|||||||
sourceEntity.setScenicId(faceSample.getScenicId());
|
sourceEntity.setScenicId(faceSample.getScenicId());
|
||||||
sourceEntity.setDeviceId(faceSample.getDeviceId());
|
sourceEntity.setDeviceId(faceSample.getDeviceId());
|
||||||
sourceEntity.setType(1);
|
sourceEntity.setType(1);
|
||||||
|
if (isBuy.isBuy()) { // 如果用户买过
|
||||||
|
videoSource.setIsBuy(1);
|
||||||
|
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||||
|
videoSource.setIsBuy(1);
|
||||||
|
} else {
|
||||||
|
videoSource.setIsBuy(0);
|
||||||
|
}
|
||||||
sourceMapper.add(sourceEntity);
|
sourceMapper.add(sourceEntity);
|
||||||
sourceMapper.addRelation(videoSource);
|
sourceMapper.addRelation(videoSource);
|
||||||
});
|
});
|
||||||
|
@ -84,6 +84,8 @@
|
|||||||
sample_store_day=#{sampleStoreDay},
|
sample_store_day=#{sampleStoreDay},
|
||||||
video_store_day=#{videoStoreDay},
|
video_store_day=#{videoStoreDay},
|
||||||
max_journey_hour=#{maxJourneyHour},
|
max_journey_hour=#{maxJourneyHour},
|
||||||
|
disable_source_video=#{disableSourceVideo},
|
||||||
|
disable_source_image=#{disableSourceImage}
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
Reference in New Issue
Block a user