🐛 兼容 token 失效情景

This commit is contained in:
ronger 2021-07-10 09:47:23 +08:00
parent ab15640099
commit 837cdec2e6

View File

@ -22,13 +22,11 @@ import org.springframework.web.servlet.HandlerMapping;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Date; import java.util.*;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/** /**
* 浏览 * 浏览
*
* @author ronger * @author ronger
*/ */
@Aspect @Aspect
@ -43,7 +41,8 @@ public class VisitAspect {
private VisitService visitService; private VisitService visitService;
@Pointcut("@annotation(com.rymcu.forest.core.service.log.annotation.VisitLogger)") @Pointcut("@annotation(com.rymcu.forest.core.service.log.annotation.VisitLogger)")
public void pointCut() {} public void pointCut() {
}
/** /**
* 保存系统操作日志 * 保存系统操作日志
@ -71,8 +70,10 @@ public class VisitAspect {
String authHeader = request.getHeader(JwtConstants.AUTHORIZATION); String authHeader = request.getHeader(JwtConstants.AUTHORIZATION);
if (StringUtils.isNotBlank(authHeader)) { if (StringUtils.isNotBlank(authHeader)) {
TokenUser tokenUser = UserUtils.getTokenUser(authHeader); TokenUser tokenUser = UserUtils.getTokenUser(authHeader);
if (Objects.nonNull(tokenUser)) {
visit.setVisitUserId(tokenUser.getIdUser()); visit.setVisitUserId(tokenUser.getIdUser());
} }
}
visitService.save(visit); visitService.save(visit);
String methodName = joinPoint.getSignature().getName(); String methodName = joinPoint.getSignature().getName();