From 85831da2a56cfb304df5eaee7021e491d39ee55d Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期一, 14 九月 2026 12:29:36 +0800
Subject: [PATCH] fix(merchant): 提现失败后可重试,且不再丢掉通道流水号

---
 talent-card-server/src/main/java/com/talentcard/server/business/portal/AppOrderPortalService.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/portal/AppOrderPortalService.java b/talent-card-server/src/main/java/com/talentcard/server/business/portal/AppOrderPortalService.java
index 66fdd4a..c1b57c3 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/portal/AppOrderPortalService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/portal/AppOrderPortalService.java
@@ -65,7 +65,7 @@
 
 		try {
 			jdbc.update("""
-					insert into benefit_order(order_no, talent_id, card_id, card_level_snapshot, merchant_id, order_type,
+					insert into benefit_order(order_no, talent_id, card_id, card_level_snapshot, merchant_id, store_id, order_type,
 					                          order_amount, subsidy_amount, base_pay_amount, pay_amount,
 					                          coupon_id, coupon_amount, expires_at, price_version,
 					                          merchant_name_snapshot, merchant_address_snapshot, merchant_mobile_snapshot,
@@ -73,13 +73,16 @@
 					                          product_id, product_name_snapshot, product_cover_url_snapshot,
 					                          collect_onboarding_id, collect_store_id, collect_huifu_id,
 					                          order_status, verify_status)
-					values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+					values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
 					""",
 					orderNo,
 					talentId,
 					talentCard.get("id"),
 					talentCard.get("cardLevel"),
 					request.merchantId(),
+					// 订单的门店必须落库:日汇总按「商户 + 门店」出账(benefit_order.store_id),
+					// 这里为空的话这笔已核销订单永远汇总不到,也就永远不会生成提现记录。
+					MerchantPaymentReadinessService.CollectingMerchant.storeIdOf(collectingMerchant),
 					normalizeOrderType(product.get("productType")),
 					originalAmount,
 					subsidyAmount,

--
Gitblit v1.7.1