|
@@ -20,7 +20,6 @@ package org.maxkey.persistence.db;
|
|
|
import java.sql.Types;
|
|
|
|
|
|
import org.maxkey.entity.HistoryLogin;
|
|
|
-import org.maxkey.entity.UserInfo;
|
|
|
import org.maxkey.web.WebContext;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -29,7 +28,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
public class LoginHistoryService {
|
|
|
private static Logger _logger = LoggerFactory.getLogger(LoginHistoryService.class);
|
|
|
|
|
|
- private static final String HISTORY_LOGIN_INSERT_STATEMENT = "insert into mxk_history_login (id , sessionid , userid , username , displayname , logintype , message , code , provider , sourceip , browser , platform , application , loginurl , sessionstatus)values( ? , ? , ? , ? , ? , ?, ? , ? , ?, ? , ? , ?, ? , ? , ?)";
|
|
|
+ private static final String HISTORY_LOGIN_INSERT_STATEMENT = "insert into mxk_history_login (id , sessionid , userid , username , displayname , logintype , message , code , provider , sourceip , browser , platform , application , loginurl , sessionstatus ,instid)values( ? , ? , ? , ? , ? , ? , ?, ? , ? , ?, ? , ? , ?, ? , ? , ?)";
|
|
|
|
|
|
private static final String HISTORY_LOGOUT_UPDATE_STATEMENT = "update mxk_history_login set logouttime = ? ,sessionstatus = 7 where sessionid = ?";
|
|
|
|
|
@@ -38,24 +37,7 @@ public class LoginHistoryService {
|
|
|
public LoginHistoryService(JdbcTemplate jdbcTemplate) {
|
|
|
this.jdbcTemplate = jdbcTemplate;
|
|
|
}
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public void login(UserInfo userInfo,String sessionId,
|
|
|
- String type, String message, String code, String provider,String browser, String platform,int sessionStatus) {
|
|
|
- jdbcTemplate.update(HISTORY_LOGIN_INSERT_STATEMENT,
|
|
|
- new Object[] { WebContext.genId(), sessionId, userInfo.getId(), userInfo.getUsername(),
|
|
|
- userInfo.getDisplayName(), type, message, code, provider, userInfo.getLastLoginIp(), browser, platform,
|
|
|
- "Browser", WebContext.getRequest().getRequestURI() , sessionStatus},
|
|
|
- new int[] {
|
|
|
- Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
- Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
- Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR ,Types.INTEGER
|
|
|
- });
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public void login(HistoryLogin historyLogin) {
|
|
|
historyLogin.setId(WebContext.genId());
|
|
|
historyLogin.setLoginUrl(WebContext.getRequest().getRequestURI());
|
|
@@ -65,12 +47,13 @@ public class LoginHistoryService {
|
|
|
historyLogin.getId(), historyLogin.getSessionId(), historyLogin.getUserId(), historyLogin.getUsername(),
|
|
|
historyLogin.getDisplayName(), historyLogin.getLoginType(), historyLogin.getMessage(), historyLogin.getCode(),
|
|
|
historyLogin.getProvider(), historyLogin.getSourceIp(), historyLogin.getBrowser(), historyLogin.getPlatform(),
|
|
|
- "Browser", historyLogin.getLoginUrl() , historyLogin.getSessionStatus()
|
|
|
+ "Browser", historyLogin.getLoginUrl() , historyLogin.getSessionStatus(),historyLogin.getInstId()
|
|
|
},
|
|
|
new int[] {
|
|
|
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
- Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR ,Types.INTEGER
|
|
|
+ Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR ,Types.INTEGER,
|
|
|
+ Types.VARCHAR
|
|
|
});
|
|
|
}
|
|
|
|