Commit 0b420f5a by WeiCong

修复由于redis用户信息丢失导致的资源访问失败问题

parent 854fc17d
......@@ -43,33 +43,32 @@ public class OpenTransInterceptor implements HandlerInterceptor {
String terminalType = noUiRequest.getTerminalType(); // APP WEB
RedisLoginInfo redisLoginInfo = null;
if( !StringUtils.isEmpty(noUiRequest.getUserId())) //开放模式下
if (!StringUtils.isEmpty(noUiRequest.getUserId())) //开放模式下
redisLoginInfo = (RedisLoginInfo) RedisUtil.get(StringUtil.userUniqueId(noUiRequest));
//如果是已登录状态,要刷新超时时间
if (redisLoginInfo != null && System.currentTimeMillis() <= redisLoginInfo.getExpiredTime()) {
// 重新刷入登陆时间
RedisLoginInfo nweRedisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), redisLoginInfo.getSysmod(),noUiRequest.getTerminalType());
RedisLoginInfo nweRedisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), redisLoginInfo.getSysmod(), noUiRequest.getTerminalType());
RedisUtil.set(Constants.SESSION + "." + userId + "." + terminalType, nweRedisLoginInfo);
RedisUtil.set(StringUtil.getCacheSessionId(userId),request.getSession().getId());
}
String url = request.getRequestURI();
String trnnam = null;
int idx1 = url.indexOf(NoUiContextManager.openSourcePrefix);
int begpos = idx1 + NoUiContextManager.openSourcePrefix.length()+1;
int begpos = idx1 + NoUiContextManager.openSourcePrefix.length() + 1;
int idx2 = url.indexOf("/", begpos);
if(idx2 > 0)
if (idx2 > 0)
trnnam = url.substring(begpos, idx2);
if(trnnam==null)
{
if (trnnam == null) {
Result rt = new Result(ErrorCodes.UNKNOEW_TRANS, "未知的交易", null, noUiVersion.getVersion());
responseMessage(response, response.getWriter(), rt);
return false;
}
//交易必须是配置允许开放的交易
log.debug("开放访问交易名:"+trnnam);
if(!NoUiContextManager.openTransactions.contains(trnnam))
{
log.debug("开放访问交易名:" + trnnam);
if (!NoUiContextManager.openTransactions.contains(trnnam)) {
Result rt = new Result(ErrorCodes.FORBIDDEN_TRANS, "非法访问", null, noUiVersion.getVersion());
responseMessage(response, response.getWriter(), rt);
return false;
......
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