mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	fix 修复 及其特殊场景下获取 StopWatch 为null问题
This commit is contained in:
		@@ -2,6 +2,7 @@ package org.dromara.common.web.interceptor;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.io.IoUtil;
 | 
			
		||||
import cn.hutool.core.map.MapUtil;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import jakarta.servlet.http.HttpServletRequest;
 | 
			
		||||
import jakarta.servlet.http.HttpServletResponse;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
@@ -64,10 +65,12 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
 | 
			
		||||
        StopWatch stopWatch = KEY_CACHE.get();
 | 
			
		||||
        if (ObjectUtil.isNotNull(stopWatch)) {
 | 
			
		||||
            stopWatch.stop();
 | 
			
		||||
            log.info("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
 | 
			
		||||
            KEY_CACHE.remove();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 判断本次请求的数据类型是否为json
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user