pull/1/head
siontion 9 months ago
commit b265286370

@ -38,6 +38,14 @@ public @interface OperateLog {
* null * null
*/ */
OperateTypeEnum[] type() default {}; OperateTypeEnum[] type() default {};
/**
*
*/
String businessType() default "";
/**
* id
*/
long businessId() default 0L;
// ========== 开关字段 ========== // ========== 开关字段 ==========

@ -88,11 +88,11 @@ public class OperateLogAspect {
private Object around0(ProceedingJoinPoint joinPoint, private Object around0(ProceedingJoinPoint joinPoint,
com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog operateLog, com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog operateLog,
Operation operation) throws Throwable { Operation operation) throws Throwable {
// 目前,只有管理员,才记录操作日志!所以非管理员,直接调用,不进行记录 /*// 目前,只有管理员,才记录操作日志!所以非管理员,直接调用,不进行记录
Integer userType = WebFrameworkUtils.getLoginUserType(); Integer userType = WebFrameworkUtils.getLoginUserType();
if (!Objects.equals(userType, UserTypeEnum.ADMIN.getValue())) { if (!Objects.equals(userType, UserTypeEnum.ADMIN.getValue())) {
return joinPoint.proceed(); return joinPoint.proceed();
} }*/
// 记录开始时间 // 记录开始时间
LocalDateTime startTime = LocalDateTime.now(); LocalDateTime startTime = LocalDateTime.now();
@ -159,11 +159,20 @@ public class OperateLogAspect {
fillRequestFields(operateLogObj); fillRequestFields(operateLogObj);
// 补全方法信息 // 补全方法信息
fillMethodFields(operateLogObj, joinPoint, operateLog, startTime, result, exception); fillMethodFields(operateLogObj, joinPoint, operateLog, startTime, result, exception);
// 补全业务信息
fillBusinessFields(operateLogObj, operateLog);
// 异步记录日志 // 异步记录日志
operateLogFrameworkService.createOperateLog(operateLogObj); operateLogFrameworkService.createOperateLog(operateLogObj);
} }
private static void fillBusinessFields(OperateLog operateLogObj, com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog operateLog) {
if(operateLog != null){
operateLogObj.setBusinessType(operateLog.businessType())
.setBusinessId(operateLog.businessId());
}
}
private static void fillUserFields(OperateLog operateLogObj) { private static void fillUserFields(OperateLog operateLogObj) {
operateLogObj.setUserId(WebFrameworkUtils.getLoginUserId()); operateLogObj.setUserId(WebFrameworkUtils.getLoginUserId());
operateLogObj.setUserType(WebFrameworkUtils.getLoginUserType()); operateLogObj.setUserType(WebFrameworkUtils.getLoginUserType());

@ -40,6 +40,34 @@ public enum OperateTypeEnum {
* *
*/ */
IMPORT(6), IMPORT(6),
/*
*
* */
SAVE(7),
/*
*
* */
SUBMIT_AUDIT(8),
/*
*
* */
AUDIT(9),
/*
*
* */
APPROVE(10),
/*
*
* */
REPULSE(11),
/*
*
* */
ALTER(12),
/*
*
* */
TERMINATE(13),
/** /**
* *
* *

@ -17,7 +17,14 @@ public class OperateLog {
* *
*/ */
private String traceId; private String traceId;
/**
*
*/
private String businessType;
/**
* id
*/
private Long businessId;
/** /**
* *
*/ */

@ -17,7 +17,14 @@ public class OperateLogCreateReqDTO {
* *
*/ */
private String traceId; private String traceId;
/**
*
*/
private String businessType;
/**
* id
*/
private Long businessId;
/** /**
* *
*/ */

Loading…
Cancel
Save