From e95e2dc2d24390bd1a3de15f9233546851ee0863 Mon Sep 17 00:00:00 2001
From: Coast <591616450@qq.com>
Date: Wed, 19 Mar 2025 12:54:01 +0800
Subject: [PATCH 1/3] =?UTF-8?q?docs:=20=E9=A1=B9=E7=9B=AE=E6=BA=90?=
=?UTF-8?q?=E7=A0=81=E5=9C=B0=E5=9D=80=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 32038fd3..71e431f3 100644
--- a/README.md
+++ b/README.md
@@ -40,8 +40,8 @@
| 项目类型 | GitCode | Gitee | Github |
|--------|----------------------------------|-----------------------------------------------------------------------|------------------------------------------------------------------------|
| 后端 | [youlai-boot](https://gitcode.com/youlai/youlai-boot) | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | [youlai-boot](https://gitee.com/haoxianrui/youlai-boot) |
-| 前端 | [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) | [vue3-element-admin](https://gitee.com/youlai/vue3-element-admin) | [vue3-element-admin](https://github.com/youlaitech/vue3-element-admin) |
-| 移动端 | [vue-uniapp-template](https://gitcode.com/youlai/vue-uniapp-template) | [vue-uniapp-template](https://gitcode.com/youlai/vue-uniapp-template) | [vue-uniapp-template](https://gitcode.com/youlaitech/vue-uniapp-template) |
+| 前端 | [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) | [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | [vue3-element-admin](https://github.com/youlaitech/vue3-element-admin) |
+| 移动端 | [vue-uniapp-template](https://gitcode.com/youlai/vue-uniapp-template) | [vue-uniapp-template](https://gitee.com/youlaiorg/vue-uniapp-template) | [vue-uniapp-template](https://gitcode.com/youlaitech/vue-uniapp-template) |
## 📚 文档地址
From 4390db3251c0035c822eb6b6edfb137f85a8fe78 Mon Sep 17 00:00:00 2001
From: "Ray.Hao" <1490493387@qq.com>
Date: Thu, 20 Mar 2025 23:58:34 +0800
Subject: [PATCH 2/3] =?UTF-8?q?fix(LogAspect):=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E6=97=A5=E5=BF=97=E5=88=87=E9=9D=A2=E6=96=B9=E6=B3=95=E6=89=A7?=
=?UTF-8?q?=E8=A1=8C=E8=80=97=E6=97=B6=E7=BB=9F=E8=AE=A1=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../youlai/boot/core/aspect/LogAspect.java | 46 +++++++++----------
1 file changed, 21 insertions(+), 25 deletions(-)
diff --git a/src/main/java/com/youlai/boot/core/aspect/LogAspect.java b/src/main/java/com/youlai/boot/core/aspect/LogAspect.java
index 6094bb56..d8f4bffe 100644
--- a/src/main/java/com/youlai/boot/core/aspect/LogAspect.java
+++ b/src/main/java/com/youlai/boot/core/aspect/LogAspect.java
@@ -19,10 +19,8 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.AfterReturning;
-import org.aspectj.lang.annotation.AfterThrowing;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
@@ -61,23 +59,25 @@ public class LogAspect {
*
* @param joinPoint 切点
*/
- @AfterReturning(pointcut = "logPointcut() && @annotation(logAnnotation)", returning = "jsonResult")
- public void doAfterReturning(JoinPoint joinPoint, com.youlai.boot.common.annotation.Log logAnnotation, Object jsonResult) {
- this.saveLog(joinPoint, null, jsonResult, logAnnotation);
+ @Around("logPointcut() && @annotation(logAnnotation)")
+ public Object doAround(ProceedingJoinPoint joinPoint, com.youlai.boot.common.annotation.Log logAnnotation) throws Throwable {
+ TimeInterval timer = DateUtil.timer();
+ Object result = null;
+ Exception exception = null;
+
+ try {
+ result = joinPoint.proceed();
+ } catch (Exception e) {
+ exception = e;
+ throw e;
+ } finally {
+ long executionTime = timer.interval(); // 执行时长
+ this.saveLog(joinPoint, exception, result, logAnnotation, executionTime);
+ }
+ return result;
}
- /**
- * 拦截异常操作
- *
- * @param joinPoint 切点
- * @param e 异常
- */
- @AfterThrowing(value = "logPointcut()", throwing = "e")
- public void doAfterThrowing(JoinPoint joinPoint, Exception e) {
- this.saveLog(joinPoint, e, null, null);
- }
-
/**
* 保存日志
*
@@ -86,15 +86,11 @@ public class LogAspect {
* @param jsonResult 响应结果
* @param logAnnotation 日志注解
*/
- private void saveLog(final JoinPoint joinPoint, final Exception e, Object jsonResult, com.youlai.boot.common.annotation.Log logAnnotation) {
+ private void saveLog(final JoinPoint joinPoint, final Exception e, Object jsonResult, com.youlai.boot.common.annotation.Log logAnnotation, long executionTime) {
String requestURI = request.getRequestURI();
-
- TimeInterval timer = DateUtil.timer();
- // 执行方法
- long executionTime = timer.interval();
-
// 创建日志记录
Log log = new Log();
+ log.setExecutionTime(executionTime);
if (logAnnotation == null && e != null) {
log.setModule(LogModuleEnum.EXCEPTION);
log.setContent("系统发生异常");
@@ -129,7 +125,7 @@ public class LogAspect {
}
}
- log.setExecutionTime(executionTime);
+
// 获取浏览器和终端系统信息
String userAgentString = request.getHeader("User-Agent");
UserAgent userAgent = resolveUserAgent(userAgentString);
From 65d06987634a420a652695d21262ac7bf68622be Mon Sep 17 00:00:00 2001
From: "Ray.Hao" <1490493387@qq.com>
Date: Thu, 20 Mar 2025 23:59:01 +0800
Subject: [PATCH 3/3] chore: bump version to 2.21.1
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8f2f43ee..69c2907f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.youlai
youlai-boot
- 2.21.0
+ 2.21.1
基于 Java 17 + SpringBoot 3 + Spring Security 构建的权限管理系统。