From c8d12c37b3f78e41aafef1ccb3e380573308c34a Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期二, 04 八月 2026 17:41:46 +0800
Subject: [PATCH] feat(admin): 添加商户登录密码修改功能并完善优惠券金额验证

---
 talent-card-server/src/main/java/com/talentcard/server/business/merchant/HuifuMerchantWithdrawalService.java |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/merchant/HuifuMerchantWithdrawalService.java b/talent-card-server/src/main/java/com/talentcard/server/business/merchant/HuifuMerchantWithdrawalService.java
index a95b015..411d0b7 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/merchant/HuifuMerchantWithdrawalService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/merchant/HuifuMerchantWithdrawalService.java
@@ -1,6 +1,7 @@
 package com.talentcard.server.business.merchant;
 
 import com.talentcard.server.business.DatabaseRows;
+import com.alibaba.fastjson.JSON;
 import com.talentcard.server.business.payment.huifu.HuifuPaymentGatewayException;
 import com.talentcard.server.business.payment.huifu.HuifuWithdrawalCommand;
 import com.talentcard.server.business.payment.huifu.HuifuWithdrawalGateway;
@@ -68,7 +69,19 @@
     private long number(Object v) { return v instanceof Number n ? n.longValue() : 0; }
     private record PreparedWithdrawal(String withdrawalNo, long amountCents, String huifuId, String tokenNo) {}
     @SuppressWarnings("unchecked") private record ProviderResult(boolean success, boolean failed, String code, String message, String providerNo) {
-        static ProviderResult from(Map<String, Object> response) { Map<String,Object> d=response.get("data") instanceof Map<?,?> map?(Map<String,Object>)map:response; String code=value(d,"sub_resp_code","resp_code","code"), status=value(d,"trans_status","trans_stat"), message=value(d,"sub_resp_desc","resp_desc","message"), no=value(d,"hf_seq_id"); boolean accepted="00000000".equals(code)||"10000".equals(code)||"0".equals(code); boolean ok=accepted&&("S".equalsIgnoreCase(status)||"SUCCESS".equalsIgnoreCase(status)); boolean pending="P".equalsIgnoreCase(status)||"PROCESSING".equalsIgnoreCase(status)||status.isBlank(); return new ProviderResult(ok,!ok&&!pending,code,message,no); }
+        static ProviderResult from(Map<String, Object> response) {
+            Object raw = response.get("data");
+            Map<String, Object> d = raw instanceof Map<?, ?> map ? (Map<String, Object>) map
+                    : raw instanceof String json && !json.isBlank() ? JSON.parseObject(json, Map.class) : response;
+            String code = value(d, "sub_resp_code", "resp_code", "code");
+            String status = value(d, "trans_stat", "trans_status");
+            String message = value(d, "sub_resp_desc", "resp_desc", "message");
+            String no = value(d, "hf_seq_id", "bank_order_no");
+            boolean accepted = "00000000".equals(code) || "10000".equals(code) || "0".equals(code) || "SUCCESS".equalsIgnoreCase(code);
+            boolean ok = accepted && ("S".equalsIgnoreCase(status) || "SUCCESS".equalsIgnoreCase(status) || "PAID".equalsIgnoreCase(status));
+            boolean pending = "P".equalsIgnoreCase(status) || "PROCESSING".equalsIgnoreCase(status) || "PENDING".equalsIgnoreCase(status) || status.isBlank();
+            return new ProviderResult(ok, !ok && !pending, code, message, no);
+        }
         static String value(Map<String,Object> data,String...keys){for(String key:keys)if(data.get(key)!=null)return String.valueOf(data.get(key)).trim();return "";}
     }
 }

--
Gitblit v1.7.1