|
|
|
@@ -69,6 +69,12 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
if(StringUtils.isBlank(token) && StringUtils.isBlank(bid)){ |
|
|
|
throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY); |
|
|
|
} |
|
|
|
|
|
|
|
//集团版中针对某一商场的业务需要传递mallTenantId |
|
|
|
String mallTenantId = request.getHeader("mallTenantId"); |
|
|
|
if(StringUtils.isBlank(mallTenantId)){ |
|
|
|
mallTenantId = request.getParameter("mallTenantId"); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询token信息 |
|
|
|
String tenantId = null; |
|
|
|
@@ -78,9 +84,13 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
if (user == null || user.getExpireTime().getTime() < System.currentTimeMillis()) { |
|
|
|
throw new MallinkException(ErrorCode.NET_TOKEN_INVALID.getCode(), "URL:" + request.getRequestURL() + " token失效,请重新登录"); |
|
|
|
} |
|
|
|
|
|
|
|
tenantId = user.getTenantId(); |
|
|
|
parenTenantId = user.getParentTenantId(); |
|
|
|
if (StringUtils.isBlank(mallTenantId)) { |
|
|
|
tenantId = user.getTenantId(); |
|
|
|
parenTenantId = user.getParentTenantId(); |
|
|
|
}else { |
|
|
|
tenantId = mallTenantId; |
|
|
|
parenTenantId = user.getTenantId(); |
|
|
|
} |
|
|
|
request.setAttribute(Constant.LOGIN_USER_KEY, user.getId()); |
|
|
|
request.setAttribute(Constant.TENANT_ID, tenantId); |
|
|
|
request.setAttribute(Constant.REQUEST_C_USER_KEY, user); |
|
|
|
@@ -94,8 +104,14 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
if (buser == null) { |
|
|
|
throw new MallinkException(ErrorCode.NET_TOKEN_INVALID.getCode(), "URL:" + request.getRequestURL() + " bid失效,请重新登录"); |
|
|
|
} |
|
|
|
tenantId = buser.getTenantId(); |
|
|
|
parenTenantId = buser.getParentTenantId(); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(mallTenantId)) { |
|
|
|
tenantId = buser.getTenantId(); |
|
|
|
parenTenantId = buser.getParentTenantId(); |
|
|
|
}else { |
|
|
|
tenantId = mallTenantId; |
|
|
|
parenTenantId = buser.getTenantId(); |
|
|
|
} |
|
|
|
request.setAttribute(Constant.LOGIN_B_USER_KEY, buser.getId()); |
|
|
|
request.setAttribute(Constant.TENANT_ID, tenantId); |
|
|
|
if (StringUtils.isNotBlank(parenTenantId)) { |
|
|
|
|