From 781b42cbdc0ac8b6c6deb75f3e7f01f48ea5407b Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Wed, 21 Oct 2020 19:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A6=96=E9=A1=B5=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/oauth/controller/routes/RouteController.java | 8 +++++++- .../cm/common/config/properties/SystemProperties.java | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java index 805b585..1688c2c 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/routes/RouteController.java @@ -5,6 +5,7 @@ import com.cm.common.config.properties.OauthProperties; import com.cm.common.config.properties.SystemProperties; import com.cm.common.exception.SearchException; import com.cm.common.pojo.bos.UserInfoBO; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @@ -37,7 +38,12 @@ public class RouteController { ModelAndView mv = new ModelAndView("index"); UserInfoBO userInfoBO = securityComponent.getCurrentUser(); mv.addObject("userUsername", userInfoBO.getUserUsername()); - mv.addObject("oauthServer", oauthProperties.getOauthServer()); + // 门户URL不存在,跳转统一用户 + if (StringUtils.isBlank(systemProperties.getPortalUrl())) { + mv.addObject("oauthServer", oauthProperties.getOauthServer()); + } else { + mv.addObject("oauthServer", systemProperties.getPortalUrl()); + } mv.addObject("title", systemProperties.getTitle()); return mv; } diff --git a/cloud-common/src/main/java/com/cm/common/config/properties/SystemProperties.java b/cloud-common/src/main/java/com/cm/common/config/properties/SystemProperties.java index 0a70e7c..3d9b85e 100644 --- a/cloud-common/src/main/java/com/cm/common/config/properties/SystemProperties.java +++ b/cloud-common/src/main/java/com/cm/common/config/properties/SystemProperties.java @@ -20,6 +20,7 @@ public class SystemProperties { private Integer port; private String url; private String title; + private String portalUrl; private String loginPageName; public Integer getPort() { @@ -46,6 +47,14 @@ public class SystemProperties { this.title = title; } + public String getPortalUrl() { + return portalUrl == null ? "" : portalUrl.trim(); + } + + public void setPortalUrl(String portalUrl) { + this.portalUrl = portalUrl; + } + public String getLoginPageName() { return loginPageName == null ? "" : loginPageName.trim(); }