From 3eb95d53e1037cc5e10b1da3a62b0ff4d5fc9536 Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期五, 28 八月 2026 15:38:43 +0800
Subject: [PATCH] fix: align merchant consumption benefit matching
---
talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java b/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java
index c69464c..82188d5 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantVerificationService.java
@@ -22,9 +22,11 @@
private static final String FREE_STAY_CODE = "FREE_STAY_CODE";
private final JdbcTemplate jdbc;
+ private final ManualConsumptionService manualConsumptionService;
- public MerchantVerificationService(JdbcTemplate jdbc) {
+ public MerchantVerificationService(JdbcTemplate jdbc, ManualConsumptionService manualConsumptionService) {
this.jdbc = jdbc;
+ this.manualConsumptionService = manualConsumptionService;
}
/**
@@ -85,6 +87,9 @@
Long expectedMerchantId = number(code.get("expectedMerchantId"));
if (expectedMerchantId != null && !expectedMerchantId.equals(principal.merchantId())) {
throw new BusinessException(ErrorCode.CONFLICT, "该人才码不可在当前商户核销");
+ }
+ if (!manualConsumptionService.hasApplicableRule(principal.merchantId(), value(code.get("cardLevel"), ""), value(code.get("sourceAreaType"), ""))) {
+ throw new BusinessException(ErrorCode.CONFLICT, "当前商户未配置适用于该人才卡的到店消费权益");
}
String verificationId = createAttempt(principal, TALENT_CODE, number(code.get("dynamicCodeId")), null, null, code.get("expiresAt"));
return scanResult(verificationId, TALENT_CODE, "人才码有效,请录入消费金额并发送待支付订单", code.get("talentName"),
@@ -241,7 +246,7 @@
List<Map<String, Object>> codes = rows("""
select d.id dynamic_code_id, d.expected_merchant_id, d.expires_at,
c.id card_id, c.card_level, c.status card_status, c.valid_end,
- t.id talent_id, t.name talent_name, t.mobile talent_mobile, t.status talent_status
+ t.id talent_id, t.name talent_name, t.mobile talent_mobile, t.status talent_status, t.source_area_type
from talent_dynamic_code d
join talent_card c on c.id = d.card_id and c.deleted = 0
join talent_user t on t.id = d.talent_id and t.deleted = 0
--
Gitblit v1.7.1