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(); }