|
@@ -2,7 +2,6 @@ package com.xy.annotation.aspet;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.TimeInterval;
|
|
|
-import com.xy.annotation.LogEvents;
|
|
|
import com.xy.annotation.LogOperate;
|
|
|
import com.xy.collections.list.JArrayList;
|
|
|
import com.xy.collections.list.JList;
|
|
@@ -86,42 +85,6 @@ public class LogAspet {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 系统事件
|
|
|
- *
|
|
|
- * @param joinPoint
|
|
|
- * @param logEvents
|
|
|
- * @return
|
|
|
- * @throws Throwable
|
|
|
- */
|
|
|
- @Around("@annotation(logEvents)")
|
|
|
- public Object logEvents(ProceedingJoinPoint joinPoint, LogEvents logEvents) throws Throwable {
|
|
|
- //参数
|
|
|
- Object[] args = joinPoint.getArgs();
|
|
|
- Object result;
|
|
|
- try {
|
|
|
- result = joinPoint.proceed(args);
|
|
|
- } catch (Exception e) {
|
|
|
- String eventName = logEvents.eventName();
|
|
|
- String eventDescript = logEvents.eventDescript();
|
|
|
- LogEnum.EventLevel eventLevel = logEvents.eventLevel();
|
|
|
- if (!Emptys.check(eventDescript)) {
|
|
|
- String api = getApi(joinPoint);
|
|
|
- Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
|
|
|
- ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
|
|
|
- if (apiOperation != null) {
|
|
|
- String value = apiOperation.value();
|
|
|
- eventDescript = api + "-" + value + "------" + e.getMessage();
|
|
|
- }
|
|
|
- }
|
|
|
- if (Emptys.check(eventDescript)) {
|
|
|
- LogUtils.events(eventName, eventLevel, eventDescript);
|
|
|
- }
|
|
|
- throw e;
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
private String getApi(ProceedingJoinPoint joinPoint) {
|
|
|
Class<?> classz = joinPoint.getTarget().getClass();
|
|
|
Api api = classz.getAnnotation(Api.class);
|