From 01761ebf91b8c2185e0b5f2c811b86f168fbe754 Mon Sep 17 00:00:00 2001 From: Odboy Date: Thu, 8 Jan 2026 19:34:35 +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=9A=84?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/operalog/OperationLogAspect.java | 12 ++++++------ .../framework/operalog/OperationLogAspect.java | 10 +++++----- 2 files changed, 11 insertions(+), 11 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 3b5c5519..2ef520c7 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 @@ -27,8 +27,8 @@ import cn.odboy.util.KitBrowserUtil; import cn.odboy.util.KitIPUtil; import com.alibaba.fastjson2.JSON; import io.swagger.annotations.ApiOperation; -import java.lang.reflect.Method; import jakarta.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -60,7 +60,8 @@ public class OperationLogAspect { TimeInterval timeInterval = new TimeInterval(); try { Object result = joinPoint.proceed(); - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); + long interval = timeInterval.interval(); + SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); ThreadUtil.execAsync(() -> { try { systemOperationLogMapper.insert(record); @@ -70,7 +71,8 @@ public class OperationLogAspect { }); return result; } catch (Throwable exception) { - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); + long interval = timeInterval.interval(); + SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); record.setExceptionDetail(ExceptionUtil.stacktraceToString(exception)); ThreadUtil.execAsync(() -> { try { @@ -83,9 +85,7 @@ public class OperationLogAspect { } } - private SystemOperationLogTb getOperationLogTb(ProceedingJoinPoint joinPoint, OperationLog annotation, - TimeInterval timeInterval) { - long executeTime = timeInterval.intervalMs(); + private SystemOperationLogTb getOperationLogTb(ProceedingJoinPoint joinPoint, OperationLog annotation, long executeTime) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); String bizName = annotation.bizName(); if (StrUtil.isBlank(bizName)) { 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 66245aee..42256389 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 @@ -60,7 +60,8 @@ public class OperationLogAspect { TimeInterval timeInterval = new TimeInterval(); try { Object result = joinPoint.proceed(); - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); + long interval = timeInterval.interval(); + SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); ThreadUtil.execAsync(() -> { try { systemOperationLogMapper.insert(record); @@ -70,7 +71,8 @@ public class OperationLogAspect { }); return result; } catch (Throwable exception) { - SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); + long interval = timeInterval.interval(); + SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, interval); record.setExceptionDetail(ExceptionUtil.stacktraceToString(exception)); ThreadUtil.execAsync(() -> { try { @@ -83,9 +85,7 @@ public class OperationLogAspect { } } - private SystemOperationLogTb getOperationLogTb(ProceedingJoinPoint joinPoint, OperationLog annotation, - TimeInterval timeInterval) { - long executeTime = timeInterval.intervalMs(); + private SystemOperationLogTb getOperationLogTb(ProceedingJoinPoint joinPoint, OperationLog annotation, long executeTime) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); String bizName = annotation.bizName(); if (StrUtil.isBlank(bizName)) {