From 1496a2640408f000f31e01ebe90b5ef97237f5a1 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 19 八月 2025 19:42:46 +0800
Subject: [PATCH] 修改婚姻bug && 管理员修改用户信息时 同步修改用户姓名、性别、婚姻状态

---
 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
index 1950cb7..7ef58a1 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
@@ -36,7 +36,7 @@
     @Override
     public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
     {
-        SysUser user = userService.selectUserByUserName(username);
+        SysUser user = userService.selectUserByNickName(username);
         if (StringUtils.isNull(user))
         {
             log.info("鐧诲綍鐢ㄦ埛锛歿} 涓嶅瓨鍦�.", username);
@@ -52,6 +52,15 @@
             log.info("鐧诲綍鐢ㄦ埛锛歿} 宸茶鍋滅敤.", username);
             throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + username + " 宸插仠鐢�");
         }
+        else if (UserStatus.ABNORMAL.getCode().equals(user.getStatus()))
+        {
+            log.info("鐧诲綍鐢ㄦ埛锛歿} 寮傚父.", username);
+            throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + username + " 鍑虹幇寮傚父锛岃鑱旂郴绠$悊鍛�");
+        }else if(UserStatus.END.getCode().equals(user.getStatus()))
+        {
+            log.info("鐧诲綍鐢ㄦ埛锛歿} 寮傚父.", username);
+            throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + username + " 璇曠敤鏈熷凡缁撴潫锛岃浠樿垂缁х画浣跨敤");
+        }
 
         passwordService.validate(user);
 
@@ -60,6 +69,8 @@
 
     public UserDetails createLoginUser(SysUser user)
     {
+     //   System.out.println(user);
+      //  System.out.println("========--0023233333333333333");
         return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
     }
 }

--
Gitblit v1.9.1