publish 0.7.4

This commit is contained in:
曾文豪
2023-02-28 11:32:45 +08:00
parent c3edb50e80
commit 07136a6679
14 changed files with 53 additions and 27 deletions

20
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -57,55 +57,55 @@
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-login</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-web</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-platform</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-message</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-encrypt</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-poi</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</dependency>
<dependency>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-ademo</artifactId>

View File

@@ -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

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-database</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-encrypt</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-message</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-platform</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-poi</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-util</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.7.3</version>
<version>0.7.4</version>
</parent>
<artifactId>springboot-web</artifactId>

View File

@@ -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<String, Object> 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;
}

View File

@@ -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<CoreLogOperationMapper, CoreLo
* 添加操作日志
*/
public void addOperationLog(String title, String subject, Object params) {
TokenBean tokenBean = TsTokenConfig.getWithoutThr();
if (tokenBean == null || StrUtil.isEmpty(tokenBean.getId())) {
return;
}
RequestUserInfo requestUserInfo = tieshengWebConfigurer.getCurrentUserName(tokenBean);
CoreLogOperation operation = new CoreLogOperation();
RequestUserInfo requestUserInfo = tieshengWebConfigurer.getCurrentUserName(TsTokenConfig.get());
operation.setUserId(requestUserInfo.getId());
operation.setUserName(requestUserInfo.getName());
operation.setTitle(title);