From 7a9272343fa934b50a64ddc6727b24ce45c92bf8 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期五, 11 七月 2025 14:09:23 +0800
Subject: [PATCH] 优化处理特殊推送
---
src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
index cae6761..31a1bf9 100644
--- a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
@@ -2,6 +2,7 @@
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.exception.BusinessException;
+import com.ruoyi.common.utils.RegexUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.common.utils.text.Convert;
@@ -220,6 +221,12 @@
@Override
@Transactional
public int insertUser(User user) {
+ if(StringUtils.isEmpty(user.getPassword())){
+ throw new BusinessException("密码不能为空");
+ }
+ if(!RegexUtil.isPassword(user.getPassword())){
+ throw new BusinessException("密码无效。密码必须包含至少一个大写字母、一个小写字母和一个数字,并且至少10个字符长。");
+ }
user.randomSalt();
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
user.setCreateBy(ShiroUtils.getLoginName());
@@ -299,6 +306,12 @@
*/
@Override
public int resetUserPwd(User user) {
+ if(StringUtils.isEmpty(user.getPassword())){
+ throw new BusinessException("密码不能为空");
+ }
+ if(!RegexUtil.isPassword(user.getPassword())){
+ throw new BusinessException("密码无效。密码必须包含至少一个大写字母、一个小写字母和一个数字,并且至少10个字符长。");
+ }
user.randomSalt();
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
return updateUserInfo(user);
@@ -581,4 +594,14 @@
public List<User> getAllUser() {
return userMapper.getAllUser();
}
+
+ @Override
+ public List<User> selectForUpdatePwd() {
+ return userMapper.selectForUpdatePwd();
+ }
+
+ @Override
+ public int updateUserForUpdatePwd(User user) {
+ return userMapper.updateUserForUpdatePwd(user);
+ }
}
--
Gitblit v1.9.2