From c383c8ca7053005ffa3ee58efd89956fbf52c9ea Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 07 五月 2026 11:34:19 +0800
Subject: [PATCH] 重构客户档案

---
 src/main/java/com/ruoyi/framework/security/LoginUser.java |   96 ++++++++++++++++++++++++++++++------------------
 1 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/src/main/java/com/ruoyi/framework/security/LoginUser.java b/src/main/java/com/ruoyi/framework/security/LoginUser.java
index 168202f..330ae43 100644
--- a/src/main/java/com/ruoyi/framework/security/LoginUser.java
+++ b/src/main/java/com/ruoyi/framework/security/LoginUser.java
@@ -76,10 +76,15 @@
      */
     private Long tenantId;
 
-    /**
-     * 褰撳墠閮ㄩ棬id
-     */
+    /**
+     * 褰撳墠閮ㄩ棬id
+     */
     private Long currentDeptId;
+
+    /**
+     * 鏄惁寮�閫欰I鍔熻兘锛�0鍚� 1鏄級
+     */
+    private Integer aiEnabled;
 
     private String dataScope;
 
@@ -87,38 +92,42 @@
     {
     }
 
-    public LoginUser(SysUser user, Set<String> permissions)
-    {
-        this.user = user;
-        this.permissions = permissions;
-    }
+    public LoginUser(SysUser user, Set<String> permissions)
+    {
+        this.user = user;
+        this.permissions = permissions;
+        this.aiEnabled = user == null ? null : user.getAiEnabled();
+    }
 
-    public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions)
-    {
-        this.userId = userId;
-        this.deptIds = deptId;
-        this.user = user;
-        this.permissions = permissions;
-    }
+    public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions)
+    {
+        this.userId = userId;
+        this.deptIds = deptId;
+        this.user = user;
+        this.permissions = permissions;
+        this.aiEnabled = user == null ? null : user.getAiEnabled();
+    }
 
-    public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions)
-    {
-        this.userId = userId;
-        this.deptIds = deptIds;
-        this.user = user;
-        this.permissions = permissions;
-        this.tenantId = tenantId;
-    }
+    public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions)
+    {
+        this.userId = userId;
+        this.deptIds = deptIds;
+        this.user = user;
+        this.permissions = permissions;
+        this.tenantId = tenantId;
+        this.aiEnabled = user == null ? null : user.getAiEnabled();
+    }
 
-    public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions)
-    {
-        this.userId = userId;
-        this.deptIds = deptIds;
-        this.user = user;
-        this.permissions = permissions;
-        this.tenantId = tenantId;
-        this.currentDeptId = currentDeptId;
-    }
+    public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions)
+    {
+        this.userId = userId;
+        this.deptIds = deptIds;
+        this.user = user;
+        this.permissions = permissions;
+        this.tenantId = tenantId;
+        this.currentDeptId = currentDeptId;
+        this.aiEnabled = user == null ? null : user.getAiEnabled();
+    }
 
     public Long getUserId()
     {
@@ -289,10 +298,11 @@
         return user;
     }
 
-    public void setUser(SysUser user)
-    {
-        this.user = user;
-    }
+    public void setUser(SysUser user)
+    {
+        this.user = user;
+        this.aiEnabled = user == null ? null : user.getAiEnabled();
+    }
 
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities()
@@ -320,6 +330,20 @@
         this.currentDeptId = currentDeptId;
     }
 
+    public Integer getAiEnabled() {
+        if (aiEnabled != null) {
+            return aiEnabled;
+        }
+        if (user != null && user.getAiEnabled() != null) {
+            return user.getAiEnabled();
+        }
+        return 0;
+    }
+
+    public void setAiEnabled(Integer aiEnabled) {
+        this.aiEnabled = aiEnabled;
+    }
+
     public String getDataScope() {
         return dataScope;
     }

--
Gitblit v1.9.3