日志切面功能整合
This commit is contained in:
@@ -13,6 +13,6 @@ import java.lang.annotation.*;
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface LogOperation {
|
||||
public @interface OperationLog {
|
||||
String value() default "";
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.log.annotation.LogOperation;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.log.enums.LogTypeEnum;
|
||||
import com.czg.log.enums.OperationStatusEnum;
|
||||
import com.czg.log.producer.LogProducer;
|
||||
@@ -38,12 +38,12 @@ import java.util.Map;
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class LogOperationAspect {
|
||||
public class OperationLogAspect {
|
||||
|
||||
@Resource
|
||||
private LogProducer logProducer;
|
||||
|
||||
@Pointcut("@annotation(com.czg.log.annotation.LogOperation)")
|
||||
@Pointcut("@annotation(com.czg.log.annotation.OperationLog)")
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class LogOperationAspect {
|
||||
Method method = signature.getMethod();
|
||||
|
||||
Row log = new Row();
|
||||
LogOperation annotation = method.getAnnotation(LogOperation.class);
|
||||
OperationLog annotation = method.getAnnotation(OperationLog.class);
|
||||
if (annotation != null) {
|
||||
//注解上的描述
|
||||
log.set("operation", annotation.value());
|
||||
@@ -22,6 +22,10 @@ public class OperationLogDTO implements Serializable {
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 日志类型 info-正常日志 error-异常日志
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,10 @@ public class OperationLog implements Serializable {
|
||||
*/
|
||||
@Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 日志类型 info-正常日志 error-异常日志
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user