shinnosuke
2026-09-18 c2f0ec3b3891bc177bdc58c2a111ab9c4fea911d
talent-card-server/src/main/java/com/talentcard/server/business/merchant/ManualConsumptionService.java
@@ -162,6 +162,20 @@
        }).toList();
    }
    /**
     * 免费入住券要显示「超过免费天数按门市价X折」:X 就是这家店给该人才卡配的到店消费折扣
     * (走和到店消费页同一套解析,结构化配置和旧的门店规则表都能取到)。
     *
     * <p>没配折扣、或配的是立减时返回空串,调用方据此不显示这段说明。
     */
    String freeStayExceedDiscountText(Long merchantId, String cardLevel, String sourceAreaType) {
        for (Map<String, Object> rule : rules(merchantId, cardLevel, sourceAreaType)) {
            BigDecimal rate = decimal(rule.get("discountRate"));
            if (rate.signum() > 0) return "门市价" + rate.movePointRight(1).stripTrailingZeros().toPlainString() + "折";
        }
        return "";
    }
    boolean hasApplicableRule(Long merchantId, String cardLevel, String sourceAreaType) {
        return !rules(merchantId, cardLevel, sourceAreaType).isEmpty();
    }