From 667df91e9e8029c4ad3ea14d7706293c34b2cc03 Mon Sep 17 00:00:00 2001
From: clay <20932067@zju.edu.cn>
Date: Fri, 15 Mar 2024 10:28:58 +0800
Subject: [PATCH 1/3] =?UTF-8?q?build:=20dubbo=20=E5=8D=87=E7=BA=A7?=
=?UTF-8?q?=E5=88=B03.2.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/common-dubbo/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/common-dubbo/pom.xml b/common/common-dubbo/pom.xml
index e6537a9..640de4e 100644
--- a/common/common-dubbo/pom.xml
+++ b/common/common-dubbo/pom.xml
@@ -12,7 +12,7 @@
common-dubbo
- 3.0.3
+ 3.2.0
UTF-8
From 87a27968397f6b0b49570347529bbc35c119fedd Mon Sep 17 00:00:00 2001
From: clay <20932067@zju.edu.cn>
Date: Fri, 15 Mar 2024 10:51:21 +0800
Subject: [PATCH 2/3] =?UTF-8?q?build:=20=E6=8E=92=E9=99=A4fastjson1=20?=
=?UTF-8?q?=E7=9A=84=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/common-dubbo/pom.xml | 10 ++++++++++
common/common-seata/pom.xml | 6 ++++++
common/common-security/pom.xml | 6 ++++++
gateway/pom.xml | 6 ++++++
4 files changed, 28 insertions(+)
diff --git a/common/common-dubbo/pom.xml b/common/common-dubbo/pom.xml
index 640de4e..16bfced 100644
--- a/common/common-dubbo/pom.xml
+++ b/common/common-dubbo/pom.xml
@@ -17,6 +17,10 @@
+
+ cn.fateverse
+ common-core
+
org.apache.dubbo
dubbo-registry-nacos
@@ -45,6 +49,12 @@
org.apache.dubbo
dubbo-spring-boot-starter
${dubbo.version}
+
+
+ com.alibaba.fastjson2
+ fastjson2
+
+
diff --git a/common/common-seata/pom.xml b/common/common-seata/pom.xml
index 2fdabbd..782ba98 100644
--- a/common/common-seata/pom.xml
+++ b/common/common-seata/pom.xml
@@ -23,6 +23,12 @@
com.alibaba.cloud
spring-cloud-starter-alibaba-seata
+
+
+ com.alibaba
+ fastjson
+
+
io.seata
diff --git a/common/common-security/pom.xml b/common/common-security/pom.xml
index a1b3f92..d6159a0 100644
--- a/common/common-security/pom.xml
+++ b/common/common-security/pom.xml
@@ -27,6 +27,12 @@
com.alibaba.cloud
spring-cloud-starter-alibaba-sentinel
+
+
+ com.alibaba
+ fastjson
+
+
diff --git a/gateway/pom.xml b/gateway/pom.xml
index 79ffb34..ee7b72e 100644
--- a/gateway/pom.xml
+++ b/gateway/pom.xml
@@ -27,6 +27,12 @@
com.alibaba.cloud
spring-cloud-starter-alibaba-sentinel
+
+
+ com.alibaba
+ fastjson
+
+
From 81fe78332f6939765dd57e29540af0d6c4035db3 Mon Sep 17 00:00:00 2001
From: clay <20932067@zju.edu.cn>
Date: Mon, 25 Mar 2024 17:38:18 +0800
Subject: [PATCH 3/3] =?UTF-8?q?feat=20:=20log-biz=20=E6=93=8D=E4=BD=9C?=
=?UTF-8?q?=E6=97=A5=E5=BF=97=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/log/LogAutoConfiguration.java | 7 +--
.../common/log/service/OperationService.java | 14 +++++-
.../cn/fateverse/log/entity/OperationLog.java | 5 ++
.../log/query/OperationLogQuery.java | 4 +-
.../cn/fateverse/log/vo/OperationLogVo.java | 3 ++
.../controller/OperationLogController.java | 12 -----
.../main/resources/mapper/OperationMapper.xml | 48 +++++++++++++++----
.../entity/dto/ProcessListenerDto.java | 2 +-
8 files changed, 67 insertions(+), 28 deletions(-)
diff --git a/common/common-log/src/main/java/cn/fateverse/common/log/LogAutoConfiguration.java b/common/common-log/src/main/java/cn/fateverse/common/log/LogAutoConfiguration.java
index 005a4e8..26b0e44 100644
--- a/common/common-log/src/main/java/cn/fateverse/common/log/LogAutoConfiguration.java
+++ b/common/common-log/src/main/java/cn/fateverse/common/log/LogAutoConfiguration.java
@@ -6,6 +6,7 @@ import cn.fateverse.common.log.service.OperationService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
/**
@@ -17,13 +18,13 @@ import org.springframework.context.annotation.Bean;
public class LogAutoConfiguration {
@Bean
- public LogAspect logAspect(){
+ public LogAspect logAspect() {
return new LogAspect();
}
@Bean
- public OperationService operationService(OperationProperties properties) {
- return new OperationService(properties);
+ public OperationService operationService(OperationProperties properties, Environment environment) {
+ return new OperationService(properties, environment);
}
}
diff --git a/common/common-log/src/main/java/cn/fateverse/common/log/service/OperationService.java b/common/common-log/src/main/java/cn/fateverse/common/log/service/OperationService.java
index 3348e02..09cc235 100644
--- a/common/common-log/src/main/java/cn/fateverse/common/log/service/OperationService.java
+++ b/common/common-log/src/main/java/cn/fateverse/common/log/service/OperationService.java
@@ -11,10 +11,12 @@ import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -35,14 +37,23 @@ public class OperationService {
@DubboReference
private DubboLogService logService;
+
+ private final String applicationName;
+
private final OperationProperties properties;
private final List operationLogListCache;
- public OperationService(OperationProperties properties) {
+ public OperationService(OperationProperties properties, Environment environment) {
this.properties = properties;
this.operationLogListCache = new ArrayList<>(properties.getCacheSize());
+ String applicationName = environment.getProperty("spring.application.name");
+ if (ObjectUtils.isEmpty(applicationName)) {
+ log.error("applicationName can not be null");
+ throw new RuntimeException("applicationName can not be null");
+ }
+ this.applicationName = applicationName;
}
@@ -62,6 +73,7 @@ public class OperationService {
@Async
public void asyncExecute(OperationLog operationLog, Object jsonResult, Throwable e, Long time) {
operationLog.setState(BusinessState.SUCCESS.ordinal());
+ operationLog.setApplicationName(applicationName);
// 返回参数
if (jsonResult instanceof Result) {
Result