From 66f896bc04d30e021137498250d80499660ca779 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Wed, 31 Jul 2019 21:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7=E5=A7=93=E5=90=8D=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cm/common/converter/UserAuthConverter.java | 2 ++ .../src/main/java/com/cm/common/pojo/bos/UserBO.java | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java b/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java index bbe4f35..68de225 100644 --- a/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java +++ b/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java @@ -57,6 +57,7 @@ public class UserAuthConverter implements UserAuthenticationConverter { UserInfoBO userInfoBO = new UserInfoBO(); userInfoBO.setUserId(userBO.getUserId()); userInfoBO.setUserUsername(userBO.getUsername()); + userInfoBO.setUserName(userBO.getUserName()); principal = userInfoBO; } else { // 包含用户信息,则直接抽取其中的用户信息 @@ -65,6 +66,7 @@ public class UserAuthConverter implements UserAuthenticationConverter { UserInfoBO userInfoBO = new UserInfoBO(); userInfoBO.setUserId(userInfo.get("userId").toString()); userInfoBO.setUserUsername(userInfo.get("username").toString()); + userInfoBO.setUserName(userInfo.get("userName").toString()); principal = userInfoBO; } } diff --git a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java index 2ceeb83..519beb8 100644 --- a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java +++ b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java @@ -16,6 +16,7 @@ import java.util.List; public class UserBO extends User { private String userId; + private String userName; private List roles; private List groups; private List departments; @@ -40,6 +41,14 @@ public class UserBO extends User { this.userId = userId; } + public String getUserName() { + return userName == null ? "" : userName.trim(); + } + + public void setUserName(String userName) { + this.userName = userName; + } + public List getRoles() { return roles; } @@ -69,6 +78,8 @@ public class UserBO extends User { final StringBuilder sb = new StringBuilder("{"); sb.append("\"userId\":") .append("\"").append(userId).append("\""); + sb.append(",\"userName\":") + .append("\"").append(userName).append("\""); sb.append(",\"roles\":") .append(roles); sb.append(",\"groups\":")