|
|
@@ -112,22 +112,12 @@ public class RequestCheckFilter implements Filter {
|
|
|
String key = Global.getFullUserLoginKey(NumberUtils.parseInt(systemType), userId);
|
|
|
String userInfoStr = RedissonUtils.getString(key);
|
|
|
LoginUserInfo loginUserInfo = StringUtils.isNotBlank(userInfoStr) ? JSON.parseObject(userInfoStr, LoginUserInfo.class) : null;
|
|
|
- if (StringUtils.isBlank(userInfoStr) || loginUserInfo == null) {
|
|
|
+ if (Objects.isNull(loginUserInfo)) {
|
|
|
ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, HttpStatus.TOKEN_INVALID_MESSAGE));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (loginUserInfo.getIsMain() == Global.YES && Integer.parseInt(systemType) == SystemTypeEnum.MANAGE.getCode()) {
|
|
|
- LoginUserHolder.set(loginUserInfo);
|
|
|
- RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
|
|
|
- RedissonUtils.putString(Global.getFullUserLoginKey(NumberUtils.parseInt(systemType), loginUserInfo.getId()), JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
- RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
|
|
|
- filterChain.doFilter(servletRequest, servletResponse);
|
|
|
- LoginUserHolder.remove();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
//校验用户账号是否冻结
|
|
|
if (loginUserInfo.getStatus() == Global.YES) {
|
|
|
ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, "您的账号已被冻结,请联系系统管理员!"));
|
|
|
@@ -137,6 +127,18 @@ public class RequestCheckFilter implements Filter {
|
|
|
/*4、登录中的企业信息*/
|
|
|
String loginEntStr = RedissonUtils.getString(Global.getFullUserEntKey(loginUserInfo.getEntId()));
|
|
|
LoginEntInfo loginEntInfo = StringUtils.isNotBlank(loginEntStr) ? JSON.parseObject(loginEntStr, LoginEntInfo.class) : null;
|
|
|
+
|
|
|
+ if (loginUserInfo.getIsMain() == Global.YES && SystemTypeEnum.MANAGE.getCode().equals(Integer.parseInt(systemType))) {
|
|
|
+ LoginUserHolder.set(loginUserInfo);
|
|
|
+ LoginEntHolder.set(loginEntInfo);
|
|
|
+ RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
|
|
|
+ RedissonUtils.putString(Global.getFullUserLoginKey(NumberUtils.parseInt(systemType), loginUserInfo.getId()), JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
+ RedissonUtils.putString(Global.getFullUserEntKey(loginEntInfo.getId()), JSON.toJSONString(loginEntInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
+ filterChain.doFilter(servletRequest, servletResponse);
|
|
|
+ LoginUserHolder.remove();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if ((StringUtils.isBlank(loginEntStr) || loginEntInfo == null) && NumberUtils.parseInt(systemType) != SystemTypeEnum.MANAGE.getCode()) {
|
|
|
ResponseUtil.writer(response, HttpResult.error(HttpStatus.TOKEN_INVALID_CODE, HttpStatus.UN_LOGIN_MESSAGE));
|
|
|
return;
|
|
|
@@ -175,7 +177,6 @@ public class RequestCheckFilter implements Filter {
|
|
|
|
|
|
LoginUserHolder.set(loginUserInfo);
|
|
|
LoginEntHolder.set(loginEntInfo);
|
|
|
- RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
|
|
|
RedissonUtils.putString(Global.getFullUserLoginKey(NumberUtils.parseInt(systemType), loginUserInfo.getId()), JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
RedissonUtils.putString(Global.getFullUserEntKey(loginEntInfo.getId()), JSON.toJSONString(loginEntInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
RedissonUtils.putString(Global.getFullUserTokenKey(clientType, userId), token, ClientTypeEnum.expireTime(clientType));
|
|
|
@@ -197,7 +198,7 @@ public class RequestCheckFilter implements Filter {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, "dade5058e78847ca5672263c5b821fc09d06083611ab0f6d076af88f082f05384838b3714729e48088c6fc1d1c09763e85e35675a20ac9df50e443b92e1c18e06f9951c7d6a2905a79b889f8617ab143fc97350b5c68f0512f7c18dbf2e49eaf");
|
|
|
+ Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, "dade5058e78847ca5672263c5b821fc09d06083611ab0f6d076af88f082f0538569486c2369c2aae99f2a8fc7a7de07b57aa7ffadb3c958ef83cb50a10819703d3cb745c501326d65d50ed5aba830326eb64a75b0479f896763a9810e847f430");
|
|
|
System.out.println(tokenMap);
|
|
|
}
|
|
|
}
|