From 467fe3b3ec6aa9d449b094bdd9df4611323d88d1 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 24 四月 2026 21:43:50 +0800
Subject: [PATCH] 代码生成
---
server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
index 14b7636..9f7a9b3 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
@@ -1351,4 +1351,31 @@
}
}
+ @Override
+ public void changePassword(Integer shopId, String newPassword, String token) {
+ if (StringUtils.isBlank(newPassword)) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵嗙爜涓嶈兘涓虹┖");
+ }
+ // 鏍¢獙瀵嗙爜蹇呴』鍚屾椂鍖呭惈瀛楁瘝鍜屾暟瀛�
+ boolean hasLetter = newPassword.chars().anyMatch(Character::isLetter);
+ boolean hasDigit = newPassword.chars().anyMatch(Character::isDigit);
+ if (!hasLetter || !hasDigit) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵嗙爜蹇呴』鍚屾椂鍖呭惈瀛楁瘝鍜屾暟瀛�");
+ }
+ // 鏌ヨ闂ㄥ簵
+ ShopInfo shopInfo = shopInfoMapper.selectById(shopId);
+ if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ // 閲嶆柊鐢熸垚salt锛屽姞瀵嗘柊瀵嗙爜骞舵洿鏂�
+ String salt = RandomStringUtils.randomAlphabetic(6);
+ shopInfo.setPassword(Utils.Secure.encryptPassword(newPassword, salt));
+ shopInfo.setSalt(salt);
+ shopInfoMapper.updateById(shopInfo);
+ // 娓呴櫎token锛屽己鍒堕噸鏂扮櫥褰�
+ if (StringUtils.isNotBlank(token)) {
+ redisTemplate.delete(token);
+ }
+ }
+
}
--
Gitblit v1.9.3