|
|
@ -32,9 +32,10 @@ import java.util.Objects;
|
|
|
|
import static com.xjs.consts.ApiWarnHandleConst.NO;
|
|
|
|
import static com.xjs.consts.ApiWarnHandleConst.NO;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|
|
|
|
* api日志切面类
|
|
|
|
|
|
|
|
*
|
|
|
|
* @author xiejs
|
|
|
|
* @author xiejs
|
|
|
|
* @desc api日志切面类
|
|
|
|
* @since 2021-12-26
|
|
|
|
* @create 2021-12-26
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
@Aspect
|
|
|
|
@Aspect
|
|
|
@ -44,7 +45,9 @@ public class ApiLogAspect {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RemoteLogFeign remoteLogFeign;
|
|
|
|
private RemoteLogFeign remoteLogFeign;
|
|
|
|
|
|
|
|
|
|
|
|
//用来调用预警,记录预警信息
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 用来调用预警,记录预警信息
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RemoteWarningCRUDFeign remoteWarningCRUDFeign;
|
|
|
|
private RemoteWarningCRUDFeign remoteWarningCRUDFeign;
|
|
|
|
|
|
|
|
|
|
|
@ -77,6 +80,7 @@ public class ApiLogAspect {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 处理完请求后执行
|
|
|
|
* 处理完请求后执行
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param joinPoint 切点
|
|
|
|
* @param joinPoint 切点
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@AfterReturning(pointcut = "@annotation(apiLog)", returning = "jsonResult")
|
|
|
|
@AfterReturning(pointcut = "@annotation(apiLog)", returning = "jsonResult")
|
|
|
@ -87,6 +91,7 @@ public class ApiLogAspect {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 异常切点
|
|
|
|
* 异常切点
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param joinPoint 连接点
|
|
|
|
* @param joinPoint 连接点
|
|
|
|
* @param apiLog 自定义注解
|
|
|
|
* @param apiLog 自定义注解
|
|
|
|
* @param e 抛出的异常
|
|
|
|
* @param e 抛出的异常
|
|
|
@ -130,6 +135,7 @@ public class ApiLogAspect {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 预警切入
|
|
|
|
* 预警切入
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param between api接口调用时间
|
|
|
|
* @param between api接口调用时间
|
|
|
|
* @param joinPoint aop连接对象
|
|
|
|
* @param joinPoint aop连接对象
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -202,8 +208,6 @@ public class ApiLogAspect {
|
|
|
|
haveApiRecord.getDayCount());
|
|
|
|
haveApiRecord.getDayCount());
|
|
|
|
apiWarning.setWarningMessage(message);
|
|
|
|
apiWarning.setWarningMessage(message);
|
|
|
|
remoteWarningCRUDFeign.saveApiWarningForRPC(apiWarning);
|
|
|
|
remoteWarningCRUDFeign.saveApiWarningForRPC(apiWarning);
|
|
|
|
|
|
|
|
|
|
|
|
// todo websocket实现即时推送到客户端
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|