fix:日志模块

上级 f6fa2d8d
......@@ -4,9 +4,24 @@ import com.study.design.auditlog.pojo.AuditLog;
import java.util.Date;
/**
* 抽象审计日志处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/30 13:10
*/
public abstract class AbstractAuditLogProcessor {
// 创建我们的 AuditLog (基础部分)
public final AuditLog buildAuditLog(String account, String action, String orderId){
/**
* 创建我们的 AuditLog (基础部分)
*
* @param account
* @param action
* @param orderId
* @return
*/
public final AuditLog buildAuditLog(String account, String action, String orderId) {
AuditLog auditLog = new AuditLog();
auditLog.setAccount(account);
auditLog.setAction(action);
......@@ -15,6 +30,12 @@ public abstract class AbstractAuditLogProcessor {
return auditLog;
}
/**
* 不同的子类复写
*
* @param auditLog
* @return
*/
protected abstract AuditLog buildDetails(AuditLog auditLog);
public final void sendToQueue(AuditLog auditLog) {
......
......@@ -3,8 +3,16 @@ package com.study.design.auditlog;
import com.study.design.auditlog.pojo.AuditLog;
import org.springframework.stereotype.Component;
/**
* 登录日志处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/30 13:11
*/
@Component
public class LoginLogProcessor extends AbstractAuditLogProcessor{
public class LoginLogProcessor extends AbstractAuditLogProcessor {
@Override
protected AuditLog buildDetails(AuditLog auditLog) {
return auditLog;
......
......@@ -3,8 +3,16 @@ package com.study.design.auditlog;
import com.study.design.auditlog.pojo.AuditLog;
import org.springframework.stereotype.Component;
/**
* 订单日志处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/30 13:11
*/
@Component
public class OrderLogProcessor extends AbstractAuditLogProcessor{
public class OrderLogProcessor extends AbstractAuditLogProcessor {
@Override
protected AuditLog buildDetails(AuditLog auditLog) {
String orderId = auditLog.getOrderId();
......
......@@ -3,8 +3,16 @@ package com.study.design.auditlog;
import com.study.design.auditlog.pojo.AuditLog;
import org.springframework.stereotype.Component;
/**
* 支付日志处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/30 13:12
*/
@Component
public class PayLogProcessor extends AbstractAuditLogProcessor{
public class PayLogProcessor extends AbstractAuditLogProcessor {
@Override
protected AuditLog buildDetails(AuditLog auditLog) {
String orderId = auditLog.getOrderId();
......
......@@ -2,13 +2,37 @@ package com.study.design.auditlog.pojo;
import java.util.Date;
/**
* 日志通用类
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/7/30 13:10
*/
public class AuditLog {
/**
* 账户
*/
private String account;
/**
* 动作
*/
private String action;
/**
* 日期
*/
private Date date;
/**
* 订单id
*/
private String orderId;
private Object details; //订单创建需要有相关产品信息;
// 订单支付需要有相关产品信息以及支付方式和支付金额。
/**
* 订单创建需要有相关产品信息;
* 订单支付需要有相关产品信息以及支付方式和支付金额。
*/
private Object details;
public String getAccount() {
return account;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册