Commit 69049793 by gechengyang

'完善sysmod模块'

parent 4ff1ccdf
......@@ -14,7 +14,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.sss.common.model.EventType;
import org.sss.common.model.IBaseObject;
import org.sss.common.model.IDatafield;
import org.sss.common.model.IModule;
import org.sss.presentation.noui.api.exception.NoUiException;
import org.sss.presentation.noui.api.model.Alias;
import org.sss.presentation.noui.api.request.NoUiRequest;
......@@ -22,7 +24,10 @@ import org.sss.presentation.noui.api.response.ErrorCodes;
import org.sss.presentation.noui.api.response.ResultUtil;
import org.sss.presentation.noui.context.NoUiContext;
import org.sss.presentation.noui.context.NoUiContextManager;
import org.sss.presentation.noui.jwt.RedisLoginInfo;
import org.sss.presentation.noui.util.NoUiPresentationUtil;
import org.sss.presentation.noui.util.RedisUtil;
import org.sss.presentation.noui.util.StringUtil;
@Controller
public class CpdOpnController {
......@@ -41,6 +46,10 @@ public class CpdOpnController {
for (String key : paramsMap.keySet()) {
context.getSession().storeData(key, paramsMap.get(key));
}
// 设置old sysmod
RedisLoginInfo redisLoginInfo = (RedisLoginInfo) RedisUtil.get(StringUtil.userUniqueId(noUiRequest));
NoUiPresentationUtil.setSysmod(context, (IModule) redisLoginInfo.getSysmod());
// 交易跳转
context.getSession().chain(true, trnName);
try {
......@@ -55,6 +64,12 @@ public class CpdOpnController {
if (dataField instanceof IDatafield)
((IDatafield<?>) dataField).invokeEventRules(context, EventType.ON_CLICK, null);
}
// 保存新的RedisLoginInfo
IBaseObject sysmod = context.getSession().getBaseObject(context.getRoot(), "sysmod");
redisLoginInfo.setSysmod(sysmod);
RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo);
return ResultUtil.result(ErrorCodes.SUCCESS, ErrorCodes.SUCCESS_INFO,
NoUiPresentationUtil.handleEventReturnData(context, noUiRequest, alias),
NoUiPresentationUtil.handleErrorReturnData(context, alias), NoUiPresentationUtil.handleCodeTableReturnData(context, alias));
......
......@@ -28,6 +28,7 @@ import org.sss.presentation.noui.jwt.JwtLogin;
import org.sss.presentation.noui.jwt.RedisLoginInfo;
import org.sss.presentation.noui.util.NumericUtil;
import org.sss.presentation.noui.util.RedisUtil;
import org.sss.presentation.noui.util.StringUtil;
@Controller
public class LoginController {
......@@ -63,7 +64,7 @@ public class LoginController {
IBaseObject sysmod = context.getSession().getBaseObject(context.getRoot(), "sysmod");
// redis中存储用户相关信息
RedisLoginInfo redisLoginInfo = new RedisLoginInfo(userId, token, NumericUtil.sessionTimeOut(), sysmod);
RedisUtil.set(userId + "." + noUiRequest.getTerminalType(), redisLoginInfo);
RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo);
return ResultUtil.result(ErrorCodes.SUCCESS, ErrorCodes.SUCCESS_INFO, retDatamap);
}
......
package org.sss.presentation.noui.util;
import org.sss.presentation.noui.api.request.NoUiRequest;
public class StringUtil {
public static boolean isEmpty(String str) {
......@@ -8,4 +10,8 @@ public class StringUtil {
return false;
}
public static String userUniqueId(NoUiRequest request) {
return request.getUserId() + "." + request.getTerminalType();
}
}
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