|
|
|
@@ -1,6 +1,7 @@ |
|
|
|
package com.iformall.interceptor; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.druid.support.logging.Log; |
|
|
|
import com.iformall.annotation.AuthIgnore; |
|
|
|
import com.iformall.annotation.TenantIgnore; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
@@ -14,6 +15,8 @@ import com.iformall.service.WxMallService; |
|
|
|
import com.iformall.service.WxMerchantBUserService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.web.method.HandlerMethod; |
|
|
|
@@ -31,6 +34,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
@Component |
|
|
|
public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CUserTokenService cUserTokenService; |
|
|
|
@@ -83,6 +87,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
String tenantId = null; |
|
|
|
String parenTenantId = null; |
|
|
|
if (StringUtils.isNotBlank(token)) { |
|
|
|
logger.debug("token >>>>> "+token); |
|
|
|
BaseCUserEntity user = cUserTokenService.getBByToken(token); |
|
|
|
if (user == null || user.getExpireTime().getTime() < System.currentTimeMillis()) { |
|
|
|
throw new MallinkException(ErrorCode.NET_TOKEN_INVALID.getCode(), "URL:" + request.getRequestURL() + " token失效,请重新登录"); |
|
|
|
@@ -93,6 +98,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
buser = wxMerchantBUserService.getById(user.getUserId()); |
|
|
|
} |
|
|
|
}else if (StringUtils.isNotBlank(bid)) { |
|
|
|
logger.debug("bid >>>>> "+bid); |
|
|
|
buser = wxMerchantBUserService.getById(Long.parseLong(bid)); |
|
|
|
} |
|
|
|
|
|
|
|
|