From 07136a6679e8972dfe18432450f6b2178015b027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Tue, 28 Feb 2023 11:32:45 +0800 Subject: [PATCH] publish 0.7.4 --- pom.xml | 20 +++++++------- springboot-ademo/pom.xml | 2 +- .../demo/config/DemoWebConfigurer.java | 5 +++- springboot-annotation/pom.xml | 2 +- springboot-database/pom.xml | 2 +- springboot-encrypt/pom.xml | 2 +- springboot-login/pom.xml | 2 +- springboot-message/pom.xml | 2 +- springboot-platform/pom.xml | 2 +- springboot-poi/pom.xml | 2 +- springboot-util/pom.xml | 2 +- springboot-web/pom.xml | 2 +- .../config/operation/OperationAspect.java | 27 +++++++++++++++---- .../tiesheng/core/service/CoreLogService.java | 8 +++++- 14 files changed, 53 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 76bd637..e1dcf6e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 pom springboot-parent 杭州铁晟科技有限公司基础依赖 @@ -57,55 +57,55 @@ com.tiesheng.springboot-parent springboot-database - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-login - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-web - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-util - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-platform - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-message - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-encrypt - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-annotation - 0.7.3 + 0.7.4 com.tiesheng.springboot-parent springboot-poi - 0.7.3 + 0.7.4 diff --git a/springboot-ademo/pom.xml b/springboot-ademo/pom.xml index f10a73f..dc12a20 100644 --- a/springboot-ademo/pom.xml +++ b/springboot-ademo/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-ademo diff --git a/springboot-ademo/src/main/java/com/tiesheng/demo/config/DemoWebConfigurer.java b/springboot-ademo/src/main/java/com/tiesheng/demo/config/DemoWebConfigurer.java index 92954b6..e043cf4 100644 --- a/springboot-ademo/src/main/java/com/tiesheng/demo/config/DemoWebConfigurer.java +++ b/springboot-ademo/src/main/java/com/tiesheng/demo/config/DemoWebConfigurer.java @@ -20,7 +20,10 @@ public class DemoWebConfigurer implements TieshengWebConfigurer { @Override public RequestUserInfo getCurrentUserName(TokenBean tokenBean) { - return null; + RequestUserInfo info = new RequestUserInfo(); + info.setId("1"); + info.setName("test"); + return info; } @Override diff --git a/springboot-annotation/pom.xml b/springboot-annotation/pom.xml index d77ccdf..0b201fa 100644 --- a/springboot-annotation/pom.xml +++ b/springboot-annotation/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-annotation diff --git a/springboot-database/pom.xml b/springboot-database/pom.xml index ca5a7e3..00342a0 100644 --- a/springboot-database/pom.xml +++ b/springboot-database/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-database diff --git a/springboot-encrypt/pom.xml b/springboot-encrypt/pom.xml index 80b6ac7..dcc85f9 100644 --- a/springboot-encrypt/pom.xml +++ b/springboot-encrypt/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-encrypt diff --git a/springboot-login/pom.xml b/springboot-login/pom.xml index faa48ec..1cd91aa 100644 --- a/springboot-login/pom.xml +++ b/springboot-login/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-login diff --git a/springboot-message/pom.xml b/springboot-message/pom.xml index 72db160..4ed9949 100644 --- a/springboot-message/pom.xml +++ b/springboot-message/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-message diff --git a/springboot-platform/pom.xml b/springboot-platform/pom.xml index 09cb77e..c9fa230 100644 --- a/springboot-platform/pom.xml +++ b/springboot-platform/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-platform diff --git a/springboot-poi/pom.xml b/springboot-poi/pom.xml index bd6b0e2..675c1d3 100644 --- a/springboot-poi/pom.xml +++ b/springboot-poi/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-poi diff --git a/springboot-util/pom.xml b/springboot-util/pom.xml index c743160..1aeedd9 100644 --- a/springboot-util/pom.xml +++ b/springboot-util/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-util diff --git a/springboot-web/pom.xml b/springboot-web/pom.xml index 4674563..0cbdca6 100644 --- a/springboot-web/pom.xml +++ b/springboot-web/pom.xml @@ -6,7 +6,7 @@ com.tiesheng.springboot-parent springboot-parent - 0.7.3 + 0.7.4 springboot-web diff --git a/springboot-web/src/main/java/com/tiesheng/core/config/operation/OperationAspect.java b/springboot-web/src/main/java/com/tiesheng/core/config/operation/OperationAspect.java index 6eaca63..825319e 100644 --- a/springboot-web/src/main/java/com/tiesheng/core/config/operation/OperationAspect.java +++ b/springboot-web/src/main/java/com/tiesheng/core/config/operation/OperationAspect.java @@ -5,6 +5,7 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.StrUtil; import com.tiesheng.annotation.operation.OperationLog; import com.tiesheng.core.service.CoreLogService; +import com.tiesheng.util.ServletKit; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @@ -13,6 +14,7 @@ import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @@ -35,7 +37,7 @@ public class OperationAspect { CoreLogService coreLogService; - @Pointcut("@annotation(com.tiesheng.annotation.operation.OperationLog)") + @Pointcut("execution(* com..controller..*.*(..))") public void methodArgs() { } @@ -48,11 +50,24 @@ public class OperationAspect { */ @Around("methodArgs()") public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + + // GET请求不处理 + HttpServletRequest request = ServletKit.getRequest(); + if (StrUtil.equalsIgnoreCase(request.getMethod(), "GET")) { + return joinPoint.proceed(joinPoint.getArgs()); + } + + String title = "", subject = ""; + String insertKey = ""; + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); OperationLog operationLog = method.getAnnotation(OperationLog.class); - String subject = operationLog.subject(); - String insertKey = operationLog.insertKey(); + if (operationLog != null) { + title = operationLog.title(); + subject = operationLog.subject(); + insertKey = operationLog.insertKey(); + } Object reqObj = null; Map allParams = new HashMap<>(16); @@ -65,7 +80,6 @@ public class OperationAspect { allParams.putAll(BeanUtil.beanToMap(response)); if (!StrUtil.isEmpty(subject)) { - // 添加、编辑关键字处理 if (!StrUtil.isEmpty(insertKey)) { String insertVal = MapUtil.getStr(allParams, insertKey); @@ -74,9 +88,12 @@ public class OperationAspect { // 占位符处理 subject = StrUtil.format(subject, allParams); + } else { + title = method.getName(); + subject = ServletKit.getRequest().getRequestURI(); } - coreLogService.addOperationLog(operationLog.title(), subject, reqObj); + coreLogService.addOperationLog(title, subject, reqObj); return response; } diff --git a/springboot-web/src/main/java/com/tiesheng/core/service/CoreLogService.java b/springboot-web/src/main/java/com/tiesheng/core/service/CoreLogService.java index 7052282..02e6dce 100644 --- a/springboot-web/src/main/java/com/tiesheng/core/service/CoreLogService.java +++ b/springboot-web/src/main/java/com/tiesheng/core/service/CoreLogService.java @@ -1,6 +1,7 @@ package com.tiesheng.core.service; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.json.JSONUtil; import com.tiesheng.core.mapper.CoreLogLoginMapper; @@ -54,8 +55,13 @@ public class CoreLogService extends TsServiceBase