From fee67ca8a0760315047a52fc4101a8f4f80b7a7f Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 11 十一月 2024 15:02:54 +0800 Subject: [PATCH] 1 --- src/main/java/com/moon/server/aspect/LogAspect.java | 19 ++----------------- 1 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/moon/server/aspect/LogAspect.java b/src/main/java/com/moon/server/aspect/LogAspect.java index ac014cb..5d5393e 100644 --- a/src/main/java/com/moon/server/aspect/LogAspect.java +++ b/src/main/java/com/moon/server/aspect/LogAspect.java @@ -23,12 +23,9 @@ import java.lang.reflect.Method; import java.util.TimerTask; -/** - * 鏃ュ織鍒囬潰绫� - * @author WWW - */ @Aspect @Component +@SuppressWarnings("ALL") public class LogAspect { @Autowired private TokenService tokenService; @@ -58,27 +55,21 @@ } /** - * 鐜粫閫氱煡 @Around锛屼篃鍙互浣跨敤 @Before (鍓嶇疆閫氱煡) 鎴� @After (鍚庣疆閫氱煡) + * @Around,@Before,@After */ @Around("logPointCut()") public Object around(ProceedingJoinPoint point) throws Throwable { long beginTime = System.currentTimeMillis(); - // 鎵ц鏂规硶 Object result = point.proceed(); - // 鎵ц鏃堕暱(姣) long time = System.currentTimeMillis() - beginTime; - // 淇濆瓨鏃ュ織 saveLog(point, time); return result; } - /** - * 淇濆瓨鏃ュ織 - */ private void saveLog(ProceedingJoinPoint joinPoint, long time) { try { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); @@ -93,7 +84,6 @@ oe.setUrl(url); oe.setExec(time); - // 璁剧疆妯″潡 Api api = clazz.getAnnotation(Api.class); if (api != null) { String[] strs = api.tags()[0].split(StaticData.BACKSLASH); @@ -101,11 +91,9 @@ oe.setModular2(strs[1]); } - // 璁剧疆绫诲悕\鏂规硶鍚嶃�佺被鍒� oe.setClazz(clazz.getName() + "." + method.getName()); oe.setType(getType(method.getName())); - // 璁剧疆澶囨敞 SysLog sysLog = method.getAnnotation(SysLog.class); if (sysLog != null) { oe.setBak(sysLog.value()); @@ -129,9 +117,6 @@ } } - /** - * 鑾峰彇鎿嶄綔绫诲瀷 - */ private static int getType(String methodName) { if (methodName.contains(SELECT)) { return 1; -- Gitblit v1.9.3