离线定位fix

This commit is contained in:
admin
2024-07-25 15:52:01 +08:00
parent e775faa738
commit 9ae9963ea4
7 changed files with 154 additions and 20 deletions

View File

@@ -33,7 +33,11 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(ServiceException.class)
public R handleServiceException(ServiceException e, HttpServletRequest request) {
log.error(e.getMessage(), e);
if ("token异常".equals(e.getMessage())) {
log.error("用户token异常");
} else {
log.error(e.getMessage(), e);
}
Integer code = e.getCode();
return StringUtils.isNotNull(code) ? R.error(code, e.getMessage()) : R.error(e.getMessage());
}
@@ -105,7 +109,12 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(CustomException.class)
public R customException(CustomException e) {
log.error(e.getMessage(), e);
if ("token异常".equals(e.getMessage())) {
log.error("用户token异常");
} else {
log.error(e.getMessage(), e);
}
return R.error(e.getMessage());
}
}

View File

@@ -81,8 +81,16 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse, @NotNull FilterChain filterChain) throws ServletException, IOException {
log.info("url = {}", httpServletRequest.getRequestURI());
// //微信支付回调接口,不需要验证
if ("/wx/pay/jsCallback".equals(httpServletRequest.getServletPath())) {
filterChain.doFilter(httpServletRequest, httpServletResponse);
return;
}
// 微信公众号的请求必须存在tenantkey否则抛出异常
if (httpServletRequest.getServletPath().startsWith("/wx/")) {
String tenantKey = httpServletRequest.getHeader("tenantkey");
if (StrUtil.isBlank(tenantKey)) {
resolver.resolveException(httpServletRequest, httpServletResponse, null, new CustomException("tenantkey不能为空"));