shinnosuke
2026-08-31 b506adfe902977f5e9626068c30bab6e5157bcbb
fix: preserve hotel free stay subsidy in order detail
1个文件已修改
4 ■■■■■ 已修改文件
talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantWorkService.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantWorkService.java
@@ -290,6 +290,7 @@
        long payAmount = number(order.get("payAmount")) == null ? 0 : number(order.get("payAmount"));
        long basePayAmount = number(order.get("basePayAmount")) == null ? orderAmount : number(order.get("basePayAmount"));
        long couponAmount = number(order.get("couponAmount")) == null ? 0 : number(order.get("couponAmount"));
        long configuredSubsidyAmount = number(order.get("subsidyAmount")) == null ? 0 : number(order.get("subsidyAmount"));
        long totalDiscount = Math.max(0, orderAmount - payAmount);
        long talentDiscountAmount = Math.max(0, orderAmount - basePayAmount);
        if ("GROUP_BUY".equals(orderType)) {
@@ -304,7 +305,8 @@
        }
        result.put("talentDiscountAmount", talentDiscountAmount);
        result.put("couponAmount", couponAmount);
        result.put("subsidyAmount", totalDiscount);
        // 免费入住没有 benefit_order 金额,补贴来自核销记录中的后台配置,不能按原价减实付覆盖为 0。
        result.put("subsidyAmount", "FREE_STAY".equals(orderType) ? configuredSubsidyAmount : totalDiscount);
        boolean canRevoke = "GROUP_BUY".equals(orderType) && verifyTime != null && Duration.between(verifyTime, LocalDateTime.now()).toHours() < REVOCATION_HOURS && verifyStatus != null && verifyStatus == 1;
        result.put("canRevoke", canRevoke);
        result.put("revokeDeadline", verifyTime == null ? null : verifyTime.plusHours(REVOCATION_HOURS).toString());