huangxz
2026-03-04 6c588ce15bc8d7457d0109404a6aa61eba07ce4d
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/config/log/FeignLoggingAspect.java
@@ -14,7 +14,7 @@
/**
 * Feign 调用日志切面
 *
 * <p>拦截 com.ros.feign 包下所有 Feign 接口方法,记录:
 * <p>拦截所有带 @FeignClient 注解的接口方法,记录:
 * <ul>
 *   <li>调用的接口类名 + 方法名</li>
 *   <li>入参(JSON 序列化)</li>
@@ -22,9 +22,6 @@
 *   <li>耗时(ms)</li>
 *   <li>异常信息(含完整堆栈)</li>
 * </ul>
 *
 * <p>同时覆盖任何实现了 Feign 接口的 bean(包括 SecureGatewayFeignService 等外部引入的客户端),
 * 通过第二个切点 {@code feignBeanMethods()} 拦截。
 */
@Slf4j
@Aspect
@@ -32,27 +29,18 @@
public class FeignLoggingAspect {
    /**
     * 切点1:com.ros.feign 包下所有类的所有方法
     * 覆盖 UserCenterFeign、RobotFeign、MappingServiceFeign、VmpRobotFeign 等
     */
    @Around("execution(* com.ros.feign..*(..))")
    public Object logRosFeignCall(ProceedingJoinPoint pjp) throws Throwable {
        return doLog(pjp);
    }
    /**
     * 切点2:所有带 @FeignClient 注解的接口的实现 bean 的所有方法
     * 覆盖 SecureGatewayFeignService 等外部包引入的 Feign 客户端
     * 拦截所有带 @FeignClient 注解的接口的所有方法
     */
    @Around("within(@org.springframework.cloud.openfeign.FeignClient *)")
    public Object logExternalFeignCall(ProceedingJoinPoint pjp) throws Throwable {
    public Object logFeignCall(ProceedingJoinPoint pjp) throws Throwable {
        return doLog(pjp);
    }
    private Object doLog(ProceedingJoinPoint pjp) throws Throwable {
        MethodSignature signature = (MethodSignature) pjp.getSignature();
        Method method = signature.getMethod();
        String className = pjp.getTarget().getClass().getSimpleName();
        // 使用接口声明类名,避免打印动态代理类名(如 $Proxy270)
        String className = signature.getDeclaringType().getSimpleName();
        String methodName = method.getName();
        String fullMethod = className + "#" + methodName;