Commit cd48e8d3 by cjh

重写nouicontext的logout方法

parent d98d9df9
...@@ -2,13 +2,14 @@ package org.sss.presentation.noui.context; ...@@ -2,13 +2,14 @@ package org.sss.presentation.noui.context;
import org.sss.common.impl.AbstractContext; import org.sss.common.impl.AbstractContext;
import org.sss.presentation.noui.jwt.RedisLoginInfo; import org.sss.presentation.noui.jwt.RedisLoginInfo;
import org.sss.presentation.noui.util.NoUiUtils;
import org.sss.presentation.noui.util.RedisUtil;
public class NoUiContext extends AbstractContext { public class NoUiContext extends AbstractContext {
@Override @Override
public void logout() { public void logout() {
// TODO Auto-generated method stub NoUiUtils.logout(redisLoginInfo.getUserId(),redisLoginInfo.getTerminalType());
} }
@Override @Override
......
...@@ -79,7 +79,7 @@ public class LoginController { ...@@ -79,7 +79,7 @@ public class LoginController {
context.getSession().chain(true, "office"); context.getSession().chain(true, "office");
byte[] sysmodBytes = NoUiPresentationUtil.sysmodToBytes(context); byte[] sysmodBytes = NoUiPresentationUtil.sysmodToBytes(context);
// redis中存储用户相关信息 // redis中存储用户相关信息
RedisLoginInfo redisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), sysmodBytes); RedisLoginInfo redisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), sysmodBytes,noUiRequest.getTerminalType());
RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo); RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo);
return ResultUtil.result(ErrorCodes.SUCCESS, ErrorCodes.SUCCESS_INFO, retDatamap); return ResultUtil.result(ErrorCodes.SUCCESS, ErrorCodes.SUCCESS_INFO, retDatamap);
......
...@@ -49,7 +49,7 @@ public class OpenTransInterceptor implements HandlerInterceptor { ...@@ -49,7 +49,7 @@ public class OpenTransInterceptor implements HandlerInterceptor {
//如果是已登录状态,要刷新超时时间 //如果是已登录状态,要刷新超时时间
if (redisLoginInfo != null && System.currentTimeMillis() <= redisLoginInfo.getExpiredTime()) { if (redisLoginInfo != null && System.currentTimeMillis() <= redisLoginInfo.getExpiredTime()) {
// 重新刷入登陆时间 // 重新刷入登陆时间
RedisLoginInfo nweRedisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), redisLoginInfo.getSysmod()); RedisLoginInfo nweRedisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), redisLoginInfo.getSysmod(),noUiRequest.getTerminalType());
RedisUtil.set(Constants.SESSION + "." + userId + "." + terminalType, nweRedisLoginInfo); RedisUtil.set(Constants.SESSION + "." + userId + "." + terminalType, nweRedisLoginInfo);
} }
......
...@@ -25,6 +25,9 @@ public class RedisLoginInfo implements Serializable { ...@@ -25,6 +25,9 @@ public class RedisLoginInfo implements Serializable {
*/ */
private long expiredTime; private long expiredTime;
//终端类型
private String terminalType;
private Object sysmod; private Object sysmod;
private Map<String,Object> contextMap = new HashMap<String,Object>(); private Map<String,Object> contextMap = new HashMap<String,Object>();
...@@ -41,11 +44,12 @@ public class RedisLoginInfo implements Serializable { ...@@ -41,11 +44,12 @@ public class RedisLoginInfo implements Serializable {
} }
public RedisLoginInfo(String userId, String token, long expiredTime, Object sysmod) { public RedisLoginInfo(String userId, String token, long expiredTime, Object sysmod,String terminalType) {
this.userId = userId; this.userId = userId;
this.token = token; this.token = token;
this.expiredTime = expiredTime; this.expiredTime = expiredTime;
this.sysmod = sysmod; this.sysmod = sysmod;
this.terminalType = terminalType;
} }
public String getToken() { public String getToken() {
...@@ -80,4 +84,11 @@ public class RedisLoginInfo implements Serializable { ...@@ -80,4 +84,11 @@ public class RedisLoginInfo implements Serializable {
this.sysmod = sysmod; this.sysmod = sysmod;
} }
public String getTerminalType() {
return terminalType;
}
public void setTerminalType(String terminalType) {
this.terminalType = terminalType;
}
} }
\ No newline at end of file
...@@ -76,7 +76,7 @@ public class TokenInterceptor implements HandlerInterceptor { ...@@ -76,7 +76,7 @@ public class TokenInterceptor implements HandlerInterceptor {
} }
// 重新刷入登陆时间 // 重新刷入登陆时间
RedisLoginInfo nweRedisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), redisLoginInfo.getSysmod()); RedisLoginInfo nweRedisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), redisLoginInfo.getSysmod(),terminalType);
RedisUtil.set(Constants.SESSION + "." + userId + "." + terminalType, nweRedisLoginInfo); RedisUtil.set(Constants.SESSION + "." + userId + "." + terminalType, nweRedisLoginInfo);
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment