From a78b1d9e0815bb617395bd944dfc7a79f742cf9e Mon Sep 17 00:00:00 2001 From: Odboy Date: Sat, 21 Feb 2026 21:53:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor(operalog):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E5=88=87=E9=9D=A2=E7=B1=BB?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在方法调用前添加this关键字明确对象引用 --- .../framework/operalog/OperationLogAspect.java | 12 +++++------- .../framework/operalog/OperationLogAspect.java | 15 ++++++--------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java index 6e36dfed..4732829c 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java @@ -52,18 +52,16 @@ public class OperationLogAspect { private SystemOperationLogMapper systemOperationLogMapper; @Around("@annotation(operationLog)") - public Object operationLogCatch(ProceedingJoinPoint joinPoint, OperationLog operationLog) - throws Throwable { - return handleLog(joinPoint, operationLog); + public Object operationLogCatch(ProceedingJoinPoint joinPoint, OperationLog operationLog) throws Throwable { + return this.handleLog(joinPoint, operationLog); } - private Object handleLog(ProceedingJoinPoint joinPoint, OperationLog annotation) - throws Throwable { + private Object handleLog(ProceedingJoinPoint joinPoint, OperationLog annotation) throws Throwable { TimeInterval timeInterval = new TimeInterval(); try { Object result = joinPoint.proceed(); long interval = timeInterval.interval(); - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); + SystemOperationLogTb record = this.getOperationLogTb(joinPoint, annotation, interval); ThreadUtil.execAsync( () -> { try { @@ -75,7 +73,7 @@ public class OperationLogAspect { return result; } catch (Throwable exception) { long interval = timeInterval.interval(); - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); + SystemOperationLogTb record = this.getOperationLogTb(joinPoint, annotation, interval); record.setExceptionDetail(ExceptionUtil.stacktraceToString(exception)); ThreadUtil.execAsync( () -> { diff --git a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java index 3da5fd45..93f443fd 100644 --- a/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java +++ b/cutejava/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java @@ -52,18 +52,16 @@ public class OperationLogAspect { private SystemOperationLogMapper systemOperationLogMapper; @Around("@annotation(operationLog)") - public Object operationLogCatch(ProceedingJoinPoint joinPoint, OperationLog operationLog) - throws Throwable { - return handleLog(joinPoint, operationLog); + public Object operationLogCatch(ProceedingJoinPoint joinPoint, OperationLog operationLog) throws Throwable { + return this.handleLog(joinPoint, operationLog); } - private Object handleLog(ProceedingJoinPoint joinPoint, OperationLog annotation) - throws Throwable { + private Object handleLog(ProceedingJoinPoint joinPoint, OperationLog annotation) throws Throwable { TimeInterval timeInterval = new TimeInterval(); try { Object result = joinPoint.proceed(); long interval = timeInterval.interval(); - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); + SystemOperationLogTb record = this.getOperationLogTb(joinPoint, annotation, interval); ThreadUtil.execAsync( () -> { try { @@ -75,7 +73,7 @@ public class OperationLogAspect { return result; } catch (Throwable exception) { long interval = timeInterval.interval(); - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); + SystemOperationLogTb record = this.getOperationLogTb(joinPoint, annotation, interval); record.setExceptionDetail(ExceptionUtil.stacktraceToString(exception)); ThreadUtil.execAsync( () -> { @@ -89,8 +87,7 @@ public class OperationLogAspect { } } - private SystemOperationLogTb getOperationLogTb( - ProceedingJoinPoint joinPoint, OperationLog annotation, long executeTime) { + private SystemOperationLogTb getOperationLogTb(ProceedingJoinPoint joinPoint, OperationLog annotation, long executeTime) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); String bizName = annotation.bizName(); if (StrUtil.isBlank(bizName)) {