Ver Fonte

登录会话和日志查询优化,增加IP地址归属地显示,删除loginUrl字段

shimingxy há 6 meses atrás
pai
commit
430da59963

+ 0 - 12
maxkey-core/src/main/java/org/dromara/maxkey/entity/history/HistoryLogin.java

@@ -79,8 +79,6 @@ public class HistoryLogin  extends JpaEntity  implements Serializable{
 	@Column
 	String application;
 	@Column
-	String loginUrl;
-	@Column
 	Date loginTime;
 	@Column
 	Date logoutTime;
@@ -234,14 +232,6 @@ public class HistoryLogin  extends JpaEntity  implements Serializable{
 		this.application = application;
 	}
 
-	public String getLoginUrl() {
-		return loginUrl;
-	}
-
-	public void setLoginUrl(String loginUrl) {
-		this.loginUrl = loginUrl;
-	}
-
 	public Date getLoginTime() {
 		return loginTime;
 	}
@@ -335,8 +325,6 @@ public class HistoryLogin  extends JpaEntity  implements Serializable{
 		builder.append(platform);
 		builder.append(", application=");
 		builder.append(application);
-		builder.append(", loginUrl=");
-		builder.append(loginUrl);
 		builder.append(", loginTime=");
 		builder.append(loginTime);
 		builder.append(", logoutTime=");

+ 1 - 5
maxkey-persistence/src/main/java/org/dromara/maxkey/persistence/repository/LoginHistoryRepository.java

@@ -47,10 +47,9 @@ public class LoginHistoryRepository {
                     browser , 
                     platform , 
                     application , 
-                    loginurl , 
                     sessionstatus ,
                     instid)
-                values( ? , ? , ? , ? , ? , ? , ? , ? , ?, ? , ? , ? , ?, ?, ? , ? , ?, ? , ? , ?)
+                values( ? , ? , ? , ? , ? , ? , ? , ?, ? , ? , ? , ?, ?, ? , ? , ?, ? , ? , ?)
     		""";
 
     protected JdbcTemplate jdbcTemplate;
@@ -61,7 +60,6 @@ public class LoginHistoryRepository {
         
     public void login(HistoryLogin historyLogin) {
         historyLogin.setId(WebContext.genId());
-        historyLogin.setLoginUrl(WebContext.getRequest().getRequestURI());
         //Thread insert 
         new Thread(new HistoryLoginRunnable(jdbcTemplate,historyLogin)).start();
     }
@@ -101,7 +99,6 @@ public class LoginHistoryRepository {
 	                        historyLogin.getBrowser(),
 	                        historyLogin.getPlatform(),
 	                        "Browser",
-	                        historyLogin.getLoginUrl(),
 	                        historyLogin.getSessionStatus(),
 	                        historyLogin.getInstId()
 	                        },
@@ -123,7 +120,6 @@ public class LoginHistoryRepository {
 	                        Types.VARCHAR,
 	                        Types.VARCHAR,
 	                        Types.VARCHAR,
-	                        Types.VARCHAR,
 	                        Types.INTEGER,
 	                        Types.VARCHAR
 	                        });

+ 2 - 2
maxkey-persistence/src/main/resources/org/dromara/maxkey/persistence/mapper/xml/mysql/HistoryLoginMapper.xml

@@ -50,10 +50,10 @@
 			code,
 			provider,
 			sourceip,
+			location,
 			browser,
 			platform,
 			application,
-			loginurl,
 			logintime,
 			logouttime
     	from mxk_history_login
@@ -76,10 +76,10 @@
             code,
             provider,
             sourceip,
+            location,
             browser,
             platform,
             application,
-            loginurl,
             logintime,
             logouttime
         from mxk_history_login

+ 2 - 0
maxkey-web-frontend/maxkey-web-app/src/app/routes/access/sessions/sessions.component.html

@@ -73,6 +73,7 @@
           <th nzAlign="center">{{ 'mxk.history.login.username' | i18n }}</th>
           <th nzAlign="center">{{ 'mxk.history.login.displayName' | i18n }}</th>
           <th nzAlign="center">{{ 'mxk.history.login.sourceIp' | i18n }}</th>
+          <th nzAlign="center">{{ 'mxk.history.login.location' | i18n }}</th>
           <th nzAlign="center">{{ 'mxk.history.login.browser' | i18n }}</th>
           <th nzAlign="center">{{ 'mxk.history.login.platform' | i18n }}</th>
           <th nzAlign="center">{{ 'mxk.history.login.loginTime' | i18n }}</th>
@@ -91,6 +92,7 @@
           <td nzAlign="left">{{ data.username }}</td>
           <td nzAlign="left">{{ data.displayName }}</td>
           <td nzAlign="left">{{ data.sourceIp }}</td>
+          <td nzAlign="left">{{ data.location }}</td>
           <td nzAlign="left">{{ data.browser }}</td>
           <td nzAlign="left">{{ data.platform }}</td>
           <td nzAlign="left">{{ data.loginTime }}</td>

+ 3 - 1
maxkey-web-frontend/maxkey-web-app/src/app/routes/audit/audit-logins/audit-logins.component.html

@@ -67,6 +67,7 @@
         <th nzAlign="center">{{ 'mxk.history.login.message' | i18n }}</th>
         <th nzAlign="center">{{ 'mxk.history.login.loginType' | i18n }}</th>
         <th nzAlign="center">{{ 'mxk.history.login.sourceIp' | i18n }}</th>
+        <th nzAlign="center">{{ 'mxk.history.login.location' | i18n }}</th>
         <th nzAlign="center">{{ 'mxk.history.login.browser' | i18n }}</th>
         <th nzAlign="center">{{ 'mxk.history.login.platform' | i18n }}</th>
         <th nzAlign="center">{{ 'mxk.history.login.loginTime' | i18n }}</th>
@@ -80,9 +81,10 @@
         </td>
         <td nzAlign="left">{{ data.username }}</td>
         <td nzAlign="left">{{ data.displayName }}</td>
-        <td nzAlign="left">{{ data.provider }}</td>
+        <td nzAlign="left">{{ data.message }}</td>
         <td nzAlign="left">{{ data.loginType }}</td>
         <td nzAlign="left">{{ data.sourceIp }}</td>
+        <td nzAlign="left">{{ data.location }}</td>
         <td nzAlign="left">{{ data.browser }}</td>
         <td nzAlign="left">{{ data.platform }}</td>
         <td nzAlign="left">{{ data.loginTime }}</td>

+ 1 - 0
maxkey-web-frontend/maxkey-web-app/src/assets/i18n/en-US.json

@@ -599,6 +599,7 @@
 			"login.message": "message",
 			"login.loginType": "loginType",
 			"login.sourceIp": "sourceIp",
+			"login.location": "location",
 			"login.browser": "browser",
 			"login.loginTime": "loginTime",
 			"login.logoutTime": "logoutTime",

+ 1 - 0
maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-CN.json

@@ -603,6 +603,7 @@
 			"login.message": "状态",
 			"login.loginType": "登录方式",
 			"login.sourceIp": "访问地址",
+			"login.location": "归属地",
 			"login.browser": "浏览器",
 			"login.loginTime": "登录时间",
 			"login.logoutTime": "退出时间",

+ 1 - 0
maxkey-web-frontend/maxkey-web-app/src/assets/i18n/zh-TW.json

@@ -603,6 +603,7 @@
 			"login.message": "狀態",
 			"login.loginType": "登錄方式",
 			"login.sourceIp": "訪問地址",
+			"login.location": "归属地",
 			"login.browser": "瀏覽器",
 			"login.loginTime": "登錄時間",
 			"login.logoutTime": "退出時間",