diff --git a/src/main/java/com/aida/lanecarford/common/security/JwtInterceptor.java b/src/main/java/com/aida/lanecarford/common/security/JwtInterceptor.java index 0d74713..74d2847 100644 --- a/src/main/java/com/aida/lanecarford/common/security/JwtInterceptor.java +++ b/src/main/java/com/aida/lanecarford/common/security/JwtInterceptor.java @@ -2,7 +2,6 @@ package com.aida.lanecarford.common.security; import com.aida.lanecarford.common.security.config.JwtProperties; import com.aida.lanecarford.common.security.context.UserContext; -import com.aida.lanecarford.exception.BusinessException; import com.aida.lanecarford.util.CacheUtil; import com.aida.lanecarford.vo.AuthPrincipalVO; import com.alibaba.fastjson.JSONObject; @@ -25,7 +24,7 @@ public class JwtInterceptor implements HandlerInterceptor { private final JwtProperties jwtProperties; @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { if ("OPTIONS".equalsIgnoreCase(request.getMethod())) { return true; } @@ -41,7 +40,8 @@ public class JwtInterceptor implements HandlerInterceptor { String extracted = jwtUtil.extractUserinfo(jwtToken); if (StringUtil.isNullOrEmpty(extracted)) { log.warn("TOKEN已过期,请重新登录!(token without userInfo)"); - throw new BusinessException("Token has expired, please log in again."); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); +// throw new BusinessException("Token has expired, please log in again."); } AuthPrincipalVO authPrincipalVO = JSONObject.parseObject(extracted, AuthPrincipalVO.class); @@ -54,10 +54,12 @@ public class JwtInterceptor implements HandlerInterceptor { if (Objects.isNull(token)) { log.warn("TOKEN已过期,请重新登录!(local cache empty)"); - throw new BusinessException("Token has expired, please log in again."); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); +// throw new BusinessException("Token has expired, please log in again."); } else if (!token.toString().equals(jwtToken)) { log.warn("TOKEN已过期,请重新登录!(token not match local cache)"); - throw new BusinessException("Token has expired, please log in again."); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); +// throw new BusinessException("Token has expired, please log in again."); } return true; } diff --git a/src/main/java/com/aida/lanecarford/service/impl/CustomerServiceImpl.java b/src/main/java/com/aida/lanecarford/service/impl/CustomerServiceImpl.java index 731cbcc..a98f273 100644 --- a/src/main/java/com/aida/lanecarford/service/impl/CustomerServiceImpl.java +++ b/src/main/java/com/aida/lanecarford/service/impl/CustomerServiceImpl.java @@ -108,6 +108,8 @@ public class CustomerServiceImpl extends ServiceImpl i customer.setCreatedTime(LocalDateTime.now()); save(customer); + } else { + throw new BusinessException("VIP ID'" + vipId + "' already exists.Please proceed directly to check-in."); } return customer;