You've already forked FrameTour-BE
fix(face): 修复人脸购买逻辑判断问题
- 修改AppPuzzleController中的人脸购买判断逻辑 - 增加对景区是否购买的前置判断 - 优化FaceServiceImpl中的人脸购买状态设置逻辑 - 确保模板购买状态的准确判断 - 避免重复查询价格计算服务
This commit is contained in:
@@ -205,26 +205,31 @@ public class AppPuzzleController {
|
|||||||
|
|
||||||
// 设置模板ID
|
// 设置模板ID
|
||||||
vo.setTemplateId(record.getTemplateId());
|
vo.setTemplateId(record.getTemplateId());
|
||||||
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(face.getScenicId(), face.getMemberId(), face.getId(), 5, record.getTemplateId());
|
IsBuyRespVO isBuyScenic = orderBiz.isBuy(face.getScenicId(), face.getMemberId(), face.getId(), 5, face.getScenicId());
|
||||||
if (isBuyRespVO.isBuy()) {
|
if (isBuyScenic.isBuy()) {
|
||||||
vo.setIsBuy(1);
|
vo.setIsBuy(1);
|
||||||
} else {
|
} else {
|
||||||
vo.setIsBuy(0);
|
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(face.getScenicId(), face.getMemberId(), face.getId(), 5, record.getTemplateId());
|
||||||
PriceCalculationRequest calculationRequest = new PriceCalculationRequest();
|
if (isBuyRespVO.isBuy()) {
|
||||||
ProductItem productItem = new ProductItem();
|
vo.setIsBuy(1);
|
||||||
productItem.setProductType(ProductType.PHOTO_LOG);
|
|
||||||
productItem.setProductId(record.getTemplateId().toString());
|
|
||||||
productItem.setPurchaseCount(1);
|
|
||||||
productItem.setScenicId(face.getScenicId().toString());
|
|
||||||
calculationRequest.setProducts(Collections.singletonList(productItem));
|
|
||||||
calculationRequest.setUserId(face.getMemberId());
|
|
||||||
calculationRequest.setFaceId(record.getFaceId());
|
|
||||||
calculationRequest.setPreviewOnly(true); // 仅查询价格,不实际使用优惠
|
|
||||||
PriceCalculationResult calculationResult = iPriceCalculationService.calculatePrice(calculationRequest);
|
|
||||||
if (calculationResult.getFinalAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
vo.setFreeCount(0);
|
|
||||||
} else {
|
} else {
|
||||||
vo.setFreeCount(1);
|
vo.setIsBuy(0);
|
||||||
|
PriceCalculationRequest calculationRequest = new PriceCalculationRequest();
|
||||||
|
ProductItem productItem = new ProductItem();
|
||||||
|
productItem.setProductType(ProductType.PHOTO_LOG);
|
||||||
|
productItem.setProductId(record.getTemplateId().toString());
|
||||||
|
productItem.setPurchaseCount(1);
|
||||||
|
productItem.setScenicId(face.getScenicId().toString());
|
||||||
|
calculationRequest.setProducts(Collections.singletonList(productItem));
|
||||||
|
calculationRequest.setUserId(face.getMemberId());
|
||||||
|
calculationRequest.setFaceId(record.getFaceId());
|
||||||
|
calculationRequest.setPreviewOnly(true); // 仅查询价格,不实际使用优惠
|
||||||
|
PriceCalculationResult calculationResult = iPriceCalculationService.calculatePrice(calculationRequest);
|
||||||
|
if (calculationResult.getFinalAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
vo.setFreeCount(0);
|
||||||
|
} else {
|
||||||
|
vo.setFreeCount(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return vo;
|
return vo;
|
||||||
|
|||||||
@@ -502,11 +502,16 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
sfpContent.setGoodsType(3);
|
sfpContent.setGoodsType(3);
|
||||||
sfpContent.setSort(0);
|
sfpContent.setSort(0);
|
||||||
if (optionalRecord.isPresent()) {
|
if (optionalRecord.isPresent()) {
|
||||||
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(face.getScenicId(), face.getMemberId(), faceId, 5, optionalRecord.get().getTemplateId());
|
IsBuyRespVO isBuyScenic = orderBiz.isBuy(face.getScenicId(), face.getMemberId(), faceId, 5, face.getScenicId());
|
||||||
if (isBuyRespVO.isBuy()) {
|
if (isBuyScenic.isBuy()) {
|
||||||
sfpContent.setIsBuy(1);
|
sfpContent.setIsBuy(1);
|
||||||
} else {
|
} else {
|
||||||
sfpContent.setIsBuy(0);
|
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(face.getScenicId(), face.getMemberId(), faceId, 5, optionalRecord.get().getTemplateId());
|
||||||
|
if (isBuyRespVO.isBuy()) {
|
||||||
|
sfpContent.setIsBuy(1);
|
||||||
|
} else {
|
||||||
|
sfpContent.setIsBuy(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PriceCalculationRequest calculationRequest = new PriceCalculationRequest();
|
PriceCalculationRequest calculationRequest = new PriceCalculationRequest();
|
||||||
|
|||||||
Reference in New Issue
Block a user