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/admin/AdminBusinessService.java |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/admin/AdminBusinessService.java b/talent-card-server/src/main/java/com/talentcard/server/business/admin/AdminBusinessService.java
index 43bdb0c..186a531 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/admin/AdminBusinessService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/admin/AdminBusinessService.java
@@ -459,6 +459,17 @@
 		ensureUpdated(updated);
 		Long storeId = findOrCreateDefaultStore(id, request.merchantName(), request.address());
 		syncMerchantBusinessHours(id, storeId, request.businessHours());
+		if (request.loginPassword() != null && !request.loginPassword().isBlank()) {
+			if (request.loginPassword().length() < 6 || request.loginPassword().length() > 64) {
+				throw new BusinessException(ErrorCode.BAD_REQUEST, "商户登录密码长度须为6至64位");
+			}
+			int passwordUpdated = jdbcTemplate.update("""
+					update merchant_operator
+					set password_hash = ?
+					where merchant_id = ? and role_code = 'owner' and deleted = 0
+					""", MerchantPasswordHasher.encode(request.loginPassword()), id);
+			if (passwordUpdated == 0) throw new BusinessException(ErrorCode.CONFLICT, "该商家未配置商户端登录账号");
+		}
 		return merchant(id);
 	}
 

--
Gitblit v1.7.1