You've already forked FrameTour-BE
feat(puzzle): 新增拼图功能模块
- 新增AppPuzzleController控制器,提供拼图相关接口 - 实现根据faceId查询拼图数量和记录列表功能 - 实现根据recordId查询拼图详情和下载拼图资源功能 - 实现拼图价格计算和导入打印列表功能 - 在FaceServiceImpl中集成拼图记录展示逻辑 - 在OrderServiceImpl中新增PHOTO_LOG产品类型处理 - 在PrinterService中实现从拼图添加到打印列表的功能 - 完善拼图记录转换为内容页面VO的逻辑处理
This commit is contained in:
@@ -45,6 +45,13 @@ import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||
import com.ycwl.basic.model.repository.TaskUpdateResult;
|
||||
|
||||
import com.ycwl.basic.model.task.resp.SearchFaceRespVo;
|
||||
import com.ycwl.basic.pricing.dto.PriceCalculationRequest;
|
||||
import com.ycwl.basic.pricing.dto.PriceCalculationResult;
|
||||
import com.ycwl.basic.pricing.dto.ProductItem;
|
||||
import com.ycwl.basic.pricing.enums.ProductType;
|
||||
import com.ycwl.basic.pricing.service.IPriceCalculationService;
|
||||
import com.ycwl.basic.puzzle.entity.PuzzleGenerationRecordEntity;
|
||||
import com.ycwl.basic.puzzle.mapper.PuzzleGenerationRecordMapper;
|
||||
import com.ycwl.basic.repository.DeviceRepository;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||
@@ -173,6 +180,11 @@ public class FaceServiceImpl implements FaceService {
|
||||
private BuyStatusProcessor buyStatusProcessor;
|
||||
@Autowired
|
||||
private VideoRecreationHandler videoRecreationHandler;
|
||||
@Autowired
|
||||
private PuzzleGenerationRecordMapper puzzleGenerationRecordMapper;
|
||||
@Autowired
|
||||
private IPriceCalculationService iPriceCalculationService;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||
PageHelper.startPage(faceReqQuery.getPageNum(),faceReqQuery.getPageSize());
|
||||
@@ -438,6 +450,39 @@ public class FaceServiceImpl implements FaceService {
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
int count = puzzleGenerationRecordMapper.countByFaceId(faceId);
|
||||
if (count > 0) {
|
||||
ContentPageVO sfpContent = new ContentPageVO();
|
||||
List<PuzzleGenerationRecordEntity> records = puzzleGenerationRecordMapper.listByFaceId(faceId);
|
||||
sfpContent.setName("三拼图");
|
||||
sfpContent.setGroup("plog");
|
||||
sfpContent.setScenicId(face.getScenicId());
|
||||
sfpContent.setContentType(3);
|
||||
sfpContent.setSourceType(3);
|
||||
sfpContent.setLockType(-1);
|
||||
sfpContent.setContentId(records.getFirst().getId());
|
||||
sfpContent.setTemplateId(records.getFirst().getTemplateId());
|
||||
sfpContent.setTemplateCoverUrl(records.getFirst().getResultImageUrl());
|
||||
sfpContent.setGoodsType(3);
|
||||
sfpContent.setSort(0);
|
||||
PriceCalculationRequest calculationRequest = new PriceCalculationRequest();
|
||||
ProductItem productItem = new ProductItem();
|
||||
productItem.setProductType(ProductType.PHOTO_LOG);
|
||||
productItem.setProductId(records.getFirst().getTemplateId().toString());
|
||||
productItem.setPurchaseCount(1);
|
||||
productItem.setScenicId(face.getScenicId().toString());
|
||||
calculationRequest.setProducts(Collections.singletonList(productItem));
|
||||
calculationRequest.setUserId(face.getMemberId());
|
||||
calculationRequest.setFaceId(face.getId());
|
||||
calculationRequest.setPreviewOnly(true); // 仅查询价格,不实际使用优惠
|
||||
PriceCalculationResult calculationResult = iPriceCalculationService.calculatePrice(calculationRequest);
|
||||
if (calculationResult.getFinalAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
sfpContent.setFreeCount(0);
|
||||
} else {
|
||||
sfpContent.setFreeCount(1);
|
||||
}
|
||||
contentList.add(1, sfpContent);
|
||||
}
|
||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||
sourceReqQuery.setScenicId(face.getScenicId());
|
||||
sourceReqQuery.setFaceId(faceId);
|
||||
@@ -513,7 +558,6 @@ public class FaceServiceImpl implements FaceService {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return contentList;
|
||||
}
|
||||
|
||||
|
||||
@@ -920,12 +920,14 @@ public class OrderServiceImpl implements OrderService {
|
||||
FaceEntity face = faceRepository.getFace(request.getFaceId());
|
||||
ProductItem productItem = request.getProducts().getFirst();
|
||||
Integer type = switch (productItem.getProductType()) {
|
||||
case PHOTO_LOG -> 5;
|
||||
case PHOTO_SET -> 2;
|
||||
case VLOG_VIDEO -> 0;
|
||||
case RECORDING_SET -> 1;
|
||||
default -> 0;
|
||||
};
|
||||
Long goodsId = switch (productItem.getProductType()) {
|
||||
case PHOTO_LOG -> Long.valueOf(productItem.getProductId());
|
||||
case PHOTO_SET, RECORDING_SET -> face.getId();
|
||||
case VLOG_VIDEO -> {
|
||||
List<MemberVideoEntity> videos = memberRelationRepository.listRelationByFaceAndTemplate(face.getId(), Long.valueOf(productItem.getProductId()));
|
||||
|
||||
Reference in New Issue
Block a user