zhourui 5 лет назад
Родитель
Сommit
6fec466f71

+ 68 - 2
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Portal.java

@@ -1,13 +1,14 @@
 package com.x.base.core.project.config;
 
 import java.io.File;
-
-import org.apache.commons.io.FileUtils;
+import java.util.LinkedHashMap;
 
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.gson.XGsonBuilder;
 import com.x.base.core.project.tools.DefaultCharset;
 
+import org.apache.commons.io.FileUtils;
+
 public class Portal extends ConfigObject {
 
 	public static Portal defaultInstance() {
@@ -16,8 +17,13 @@ public class Portal extends ConfigObject {
 
 	public Portal() {
 		this.indexPage = new IndexPage();
+		this.loginPage = new LoginPage();
+		this.urlMapping = null;
 	}
 
+	@FieldDescribe("url转换配置.")
+	private LinkedHashMap<String, String> urlMapping;
+
 	@FieldDescribe("定制首页面设置.")
 	private IndexPage indexPage;
 
@@ -28,10 +34,65 @@ public class Portal extends ConfigObject {
 		return this.indexPage;
 	}
 
+	@FieldDescribe("定制登录页面设置.")
+	private LoginPage loginPage;
+
+	public LoginPage getLoginPage() {
+		if (null == loginPage) {
+			this.loginPage = new LoginPage();
+		}
+		return this.loginPage;
+	}
+
 	public void setIndexPage(IndexPage indexPage) {
 		this.indexPage = indexPage;
 	}
 
+	public static class LoginPage extends ConfigObject {
+
+		public static LoginPage defaultInstance() {
+			return new LoginPage();
+		}
+
+		public LoginPage() {
+			this.enable = false;
+			this.portal = "";
+			this.page = "";
+		}
+
+		@FieldDescribe("是否启用定制登录页面.")
+		private Boolean enable;
+		@FieldDescribe("指定登录页面所属的portal,可以用id,name,alias.")
+		private String portal;
+		@FieldDescribe("指定的登录页面,可以使用name,alias,id")
+		private String page;
+
+		public Boolean getEnable() {
+			return enable;
+		}
+
+		public void setEnable(Boolean enable) {
+			this.enable = enable;
+		}
+
+		public String getPortal() {
+			return portal;
+		}
+
+		public void setPortal(String portal) {
+			this.portal = portal;
+		}
+
+		public String getPage() {
+			return page;
+		}
+
+		public void setPage(String page) {
+			this.page = page;
+		}
+
+	}
+
 	public static class IndexPage extends ConfigObject {
 
 		public static IndexPage defaultInstance() {
@@ -81,4 +142,9 @@ public class Portal extends ConfigObject {
 		File file = new File(Config.base(), Config.PATH_CONFIG_PORTAL);
 		FileUtils.write(file, XGsonBuilder.toJson(this), DefaultCharset.charset);
 	}
+
+	public LinkedHashMap<String, String> getUrlMapping() {
+		return urlMapping;
+	}
+
 }

+ 12 - 1
o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java

@@ -42,6 +42,8 @@ public class WebServerTools extends JettySeverTools {
 	private static int WEBSERVER_THREAD_POOL_SIZE_MIN = 50;
 	private static int WEBSERVER_THREAD_POOL_SIZE_MAX = 500;
 
+	private static final String MAP_LOGINPAGE = "loginPage";
+
 	public static Server start(WebServer webServer) throws Exception {
 
 		/**
@@ -175,9 +177,18 @@ public class WebServerTools extends JettySeverTools {
 			}
 			/* 上面的无效 */
 			map.put("app_protocol", "auto");
-			map.put("loginPage", Config.person().getLoginPage());
+			if ((null != Config.portal().getLoginPage())
+					&& (BooleanUtils.isTrue(Config.portal().getLoginPage().getEnable()))) {
+				map.put(MAP_LOGINPAGE, Config.portal().getLoginPage());
+			} else if ((null != Config.person().getLoginPage())
+					&& (BooleanUtils.isTrue(Config.person().getLoginPage().getEnable()))) {
+				map.put(MAP_LOGINPAGE, Config.person().getLoginPage());
+			} else {
+				map.put(MAP_LOGINPAGE, Config.portal().getLoginPage());
+			}
 			map.put("indexPage", Config.portal().getIndexPage());
 			map.put("webSocketEnable", Config.communicate().wsEnable());
+			map.put("urlMapping", Config.portal().getUrlMapping());
 			FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset);
 		}
 	}