@Slf4j
public class TokenParamInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String companyName = request.getParameter(CommonConstant.COMPANY_NAME);
companyName = Base64.getFromBase64(companyName);
LocalContext.addArgument(CommonConstant.COMPANY_NAME,companyName);
String companyId = request.getParameter(CommonConstant.COMPANY_ID);
if (StringUtils.isNotBlank(companyId)){
LocalContext.addArgument(CommonConstant.COMPANY_ID,Long.valueOf(companyId));
}
String userId = request.getParameter(CommonConstant._USER_ID_);<br /> if (StringUtils._isNotBlank_(userId)){<br /> LocalContext._addArgument_(CommonConstant._USER_ID_,Long._valueOf_(userId));<br /> }
String employeeId = request.getParameter(CommonConstant._EMPLOYEE_ID_);<br /> if (StringUtils._isNotBlank_(employeeId)){<br /> LocalContext._addArgument_(CommonConstant._EMPLOYEE_ID_,Long._valueOf_(employeeId));<br /> }
String accountType = request.getParameter(CommonConstant._ACCOUNT_TYPE_);<br /> if (StringUtils._isNotBlank_(accountType)){<br /> LocalContext._addArgument_(CommonConstant._ACCOUNT_TYPE_,Integer._valueOf_(accountType));<br /> }
LocalContext._addArgument_(CommonConstant._REQUEST_ID_,UUIDUtils._getUUID_());<br /> //_todo 考虑将原先的aop移过来统计接口响应耗时&链路跟踪_<br />_ _return true;<br /> }
@Override<br /> public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {<br /> LocalContext._remove_();<br /> }<br />}