From ce77a02ec7d817b3e2778c294138c89c12f5092e Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Wed, 29 Sep 2021 14:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.1.3=E3=80=91LoginUser=E6=9B=B4?= =?UTF-8?q?=E6=96=B0C=E7=AB=AF=E7=94=A8=E6=88=B7=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roses/kernel/auth/api/pojo/login/LoginUser.java | 6 ++++++ .../kernel/customer/modular/factory/CustomerFactory.java | 3 +++ .../modular/user/service/impl/SysUserServiceImpl.java | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/kernel-d-auth/auth-api/src/main/java/cn/stylefeng/roses/kernel/auth/api/pojo/login/LoginUser.java b/kernel-d-auth/auth-api/src/main/java/cn/stylefeng/roses/kernel/auth/api/pojo/login/LoginUser.java index ba18d2fdf..8ea055393 100644 --- a/kernel-d-auth/auth-api/src/main/java/cn/stylefeng/roses/kernel/auth/api/pojo/login/LoginUser.java +++ b/kernel-d-auth/auth-api/src/main/java/cn/stylefeng/roses/kernel/auth/api/pojo/login/LoginUser.java @@ -168,6 +168,12 @@ public class LoginUser implements Serializable { @ChineseDescription("租户的编码") private String tenantCode; + /** + * 当前登录用户是否是C端用户(默认不是C端用户) + */ + @ChineseDescription("是否是C端用户") + private Boolean customerFlag = false; + public String getWsUrl() { if (ObjectUtil.isEmpty(this.wsUrl)) { return ""; diff --git a/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/factory/CustomerFactory.java b/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/factory/CustomerFactory.java index 02aeb5403..491377c29 100644 --- a/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/factory/CustomerFactory.java +++ b/kernel-s-customer/customer-business/src/main/java/cn/stylefeng/roses/kernel/customer/modular/factory/CustomerFactory.java @@ -108,6 +108,9 @@ public class CustomerFactory { String fileAuthUrl = fileOperatorApi.getFileUnAuthUrl(CustomerConfigExpander.getCustomerBucket(), customer.getAvatarObjectName()); loginUser.setAvatarUrl(fileAuthUrl); + // 设置用户是C端用户 + loginUser.setCustomerFlag(true); + return loginUser; } diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java index 7c57f6c05..2db6b7991 100644 --- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java +++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java @@ -620,6 +620,11 @@ public class SysUserServiceImpl extends ServiceImpl impl @Override public LoginUser getEffectiveLoginUser(LoginUser loginUser) { + // 如果是C端用户,直接返回缓存中的登录用户 + if (loginUser.getCustomerFlag()) { + return loginUser; + } + UserLoginInfoDTO userLoginInfoDTO = this.getUserLoginInfo(loginUser.getAccount()); LoginUser newLoginUser = userLoginInfoDTO.getLoginUser();