Browse Source

userdetail增加deptName

baiying 2 weeks ago
parent
commit
d878e6bc99

+ 5 - 0
yyc-common-core/src/main/java/net/yyc/common/core/constant/SecurityConstants.java

@@ -185,6 +185,11 @@ public interface SecurityConstants {
 	 */
 	String DETAILS_DEPT_ID = "deptId";
 
+	/**
+	 * 用户部门名称
+	 */
+	String DETAILS_DEPT_NAME = "deptName";
+
 	/**
 	 * 租户ID 字段
 	 */

+ 9 - 1
yyc-common-security/src/main/java/com/qunzhixinxi/hnqz/common/security/service/HnqzUser.java

@@ -29,6 +29,12 @@ public class HnqzUser extends User {
     @Getter
     private Integer deptId;
 
+    /**
+     * 部门名称
+     */
+    @Getter
+    private String deptName;
+
     /**
      * 手机号
      */
@@ -97,10 +103,12 @@ public class HnqzUser extends User {
     public HnqzUser(Integer id, Integer deptId, String phone, String avatar, Integer tenantId, String username,
                     String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired,
                     boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities, String platId,
-					String drugEntId, Integer[] roles, LocalDateTime latestChangePwdTime, String realname) {
+					String drugEntId, Integer[] roles, LocalDateTime latestChangePwdTime, String realname,
+					String deptName) {
         super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
         this.id = id;
         this.deptId = deptId;
+        this.deptName = deptName;
         this.phone = phone;
         this.avatar = avatar;
         this.tenantId = tenantId;

+ 2 - 1
yyc-common-security/src/main/java/net/yyc/common/security/component/HnqzUserAuthenticationConverter.java

@@ -87,6 +87,7 @@ public class HnqzUserAuthenticationConverter implements UserAuthenticationConver
             String username = MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME);
             Integer id = MapUtil.getInt(map, SecurityConstants.DETAILS_USER_ID);
             Integer deptId = MapUtil.getInt(map, SecurityConstants.DETAILS_DEPT_ID);
+            String deptName = MapUtil.getStr(map, SecurityConstants.DETAILS_DEPT_NAME);
             Integer tenantId = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
             String phone = MapUtil.getStr(map, SecurityConstants.DETAILS_PHONE);
             String avatar = MapUtil.getStr(map, SecurityConstants.DETAILS_AVATAR);
@@ -102,7 +103,7 @@ public class HnqzUserAuthenticationConverter implements UserAuthenticationConver
             }
 
             HnqzUser user = new HnqzUser(id, deptId, phone, avatar, tenantId, username, N_A, true, true, true, true,
-                    authorities, platId, drugEntId, null, latestChangePwdTime, realname);
+                    authorities, platId, drugEntId, null, latestChangePwdTime, realname, deptName);
             return new UsernamePasswordAuthenticationToken(user, N_A, authorities);
         }
         return null;