|
|
@@ -105,6 +105,9 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
vo.setCardSet(dto.getCardSet());
|
|
|
vo.setFrontImageUrl(dto.getFrontImageUrl());
|
|
|
vo.setBackImageUrl(dto.getBackImageUrl());
|
|
|
+ // 透传套餐ID与套餐价格(入参字段名 id/price,响应改业务命名 packageId/packagePrice)
|
|
|
+ vo.setPackageId(dto.getId());
|
|
|
+ vo.setPackagePrice(dto.getPrice());
|
|
|
|
|
|
RatingRecommendRulePO rule = ratingRecommendRuleManager.selectByExact(
|
|
|
dto.getPlayer(), dto.getYear(), dto.getSeries(), dto.getCardSet(), activeBatchNo);
|
|
|
@@ -136,26 +139,26 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
vo.setMatchLevel(level.getCode());
|
|
|
vo.setCardId(rule.getCardId());
|
|
|
vo.setCardNo(rule.getCardNo());
|
|
|
- vo.setCurrentValue(rule.getCurrentValue());
|
|
|
- vo.setValueChangePct(rule.getValueChangePct());
|
|
|
- vo.setValueMin(rule.getValueMin());
|
|
|
- vo.setValueMax(rule.getValueMax());
|
|
|
+// vo.setCurrentValue(rule.getCurrentValue());
|
|
|
+// vo.setValueChangePct(rule.getValueChangePct());
|
|
|
+// vo.setValueMin(rule.getValueMin());
|
|
|
+// vo.setValueMax(rule.getValueMax());
|
|
|
// 补查 POP(三机构)
|
|
|
- if (rule.getCardId() != null && activeBatchNo != null) {
|
|
|
- List<CardPopPO> pops = cardPopManager.selectByCardId(rule.getCardId(), activeBatchNo);
|
|
|
- List<CardPopVO> popVOs = new ArrayList<>();
|
|
|
- for (CardPopPO p : pops) {
|
|
|
- CardPopVO pv = new CardPopVO();
|
|
|
- pv.setAgency(p.getAgency());
|
|
|
- pv.setAll(p.getGradeAll());
|
|
|
- pv.setG10(p.getGrade10());
|
|
|
- pv.setG9(p.getGrade9());
|
|
|
- pv.setG8(p.getGrade8());
|
|
|
- pv.setG7(p.getGrade7());
|
|
|
- popVOs.add(pv);
|
|
|
- }
|
|
|
- vo.setPops(popVOs);
|
|
|
- }
|
|
|
+// if (rule.getCardId() != null && activeBatchNo != null) {
|
|
|
+// List<CardPopPO> pops = cardPopManager.selectByCardId(rule.getCardId(), activeBatchNo);
|
|
|
+// List<CardPopVO> popVOs = new ArrayList<>();
|
|
|
+// for (CardPopPO p : pops) {
|
|
|
+// CardPopVO pv = new CardPopVO();
|
|
|
+// pv.setAgency(p.getAgency());
|
|
|
+// pv.setAll(p.getGradeAll());
|
|
|
+// pv.setG10(p.getGrade10());
|
|
|
+// pv.setG9(p.getGrade9());
|
|
|
+// pv.setG8(p.getGrade8());
|
|
|
+// pv.setG7(p.getGrade7());
|
|
|
+// popVOs.add(pv);
|
|
|
+// }
|
|
|
+// vo.setPops(popVOs);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
private boolean isLegalRule(RatingRecommendRulePO rule) {
|
|
|
@@ -165,7 +168,12 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 回填单价/总计并返回合计;某档无价 → 该订单 null("待计算"),合计置 null
|
|
|
+ * 回填单价/总计并返回合计。
|
|
|
+ * 算价口径(大侠口径 2026-06-30):
|
|
|
+ * 订单 packageTotal = Σ(各卡 packagePrice),null 当 0
|
|
|
+ * 订单 totalAmount = packageTotal × 卡数 + 时效单价
|
|
|
+ * 时效价某档无价 → 订单 unitPrice/totalAmount = null("待计算"),grandTotal 也为 null
|
|
|
+ * 套餐价 packagePrice 始终透传到卡级,无需降级
|
|
|
*/
|
|
|
private BigDecimal applyPricing(List<OrderSuggestionVO> orders, Map<Integer, BigDecimal> priceMap) {
|
|
|
if (orders == null || orders.isEmpty()) {
|
|
|
@@ -174,6 +182,11 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
BigDecimal grand = BigDecimal.ZERO;
|
|
|
boolean grandNull = false;
|
|
|
for (OrderSuggestionVO order : orders) {
|
|
|
+ // 1) 先汇总套餐价(与时效价是否取到无关,packageTotal 始终能算出)
|
|
|
+ BigDecimal packageTotal = sumPackagePrice(order.getCards());
|
|
|
+ order.setPackageTotal(packageTotal);
|
|
|
+
|
|
|
+ // 2) 再算时效价;缺失则降级"待计算"
|
|
|
BigDecimal unit = (priceMap == null) ? null : priceMap.get(order.getEfficiency());
|
|
|
if (unit == null) {
|
|
|
order.setUnitPrice(null);
|
|
|
@@ -186,7 +199,9 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
- BigDecimal total = unit.multiply(BigDecimal.valueOf(order.getCardCount()));
|
|
|
+ // 3) 订单总计 = 套餐价合计 × 卡数 + 时效单价
|
|
|
+ BigDecimal packageSubtotal = packageTotal.multiply(BigDecimal.valueOf(order.getCardCount()));
|
|
|
+ BigDecimal total = packageSubtotal.add(unit);
|
|
|
order.setUnitPrice(unit);
|
|
|
order.setTotalAmount(total);
|
|
|
if (order.getCards() != null) {
|
|
|
@@ -198,4 +213,20 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
}
|
|
|
return grandNull ? null : grand;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 汇总订单内各卡的套餐价(packagePrice 为 null 当 0 处理)
|
|
|
+ */
|
|
|
+ private BigDecimal sumPackagePrice(List<RecommendCardVO> cards) {
|
|
|
+ BigDecimal sum = BigDecimal.ZERO;
|
|
|
+ if (cards == null) {
|
|
|
+ return sum;
|
|
|
+ }
|
|
|
+ for (RecommendCardVO c : cards) {
|
|
|
+ if (c != null && c.getPackagePrice() != null) {
|
|
|
+ sum = sum.add(c.getPackagePrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }
|
|
|
}
|