From 9772667bf6666f3db67d9e1c7d50b5a65646950e Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Tue, 30 Dec 2025 20:36:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20[=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E5=AF=86=E7=A0=81=E5=BE=97=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hxhq/system/service/ISysUserService.java | 7 +++++-- .../hxhq/system/service/impl/SysUserServiceImpl.java | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java index cafeca6..09f30e8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java @@ -238,15 +238,18 @@ public interface ISysUserService * 检查密码是否正确 * @param userId * @param password + * @param needName * @return */ - Boolean checkPassword(Long userId,String password); + Boolean checkPassword(Long userId,String password,Boolean needName); /** * 检查密码是否正确 * @param user * @param password + * @param needName * @return */ - Boolean checkPassword(SysUser user,String password); + Boolean checkPassword(SysUser user,String password,Boolean needName); + } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysUserServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysUserServiceImpl.java index 4f61e8a..fb06e81 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysUserServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysUserServiceImpl.java @@ -581,13 +581,20 @@ public class SysUserServiceImpl implements ISysUserService } @Override - public Boolean checkPassword(Long userId, String password) { - SysUser user = selectUserById(userId); - return checkPassword(user,password); + public Boolean checkPassword(Long userId, String password, Boolean needName) { + SysUser sysUser = selectUserById(userId); + if(sysUser==null){ + throw new ServiceException("用户不存在"); + } + return checkPassword(sysUser,password,needName); } @Override - public Boolean checkPassword(SysUser user, String password) { - return SecurityUtils.matchesPassword(password,user.getPassword()); + public Boolean checkPassword(SysUser user, String password, Boolean needName) { + if(SecurityUtils.matchesPassword(password,user.getPassword())){ + return true; + } + throw new ServiceException((needName?user.getNickName():"")+"密码错误"); } + }