init
This commit is contained in:
25
log/log-api/pom.xml
Normal file
25
log/log-api/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>log</artifactId>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>log-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.fateverse.log.dubbo;
|
||||
|
||||
|
||||
import cn.fateverse.log.entity.LoginInfo;
|
||||
import cn.fateverse.log.entity.OperationLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2023-02-20
|
||||
*/
|
||||
public interface DubboLogService {
|
||||
|
||||
/**
|
||||
* 批量保存日志
|
||||
*
|
||||
* @param list 需要保存的日志
|
||||
*/
|
||||
void batchSaveLog(List<OperationLog> list);
|
||||
|
||||
/**
|
||||
* 保存登录信息
|
||||
*
|
||||
* @param info 登录日志信息
|
||||
*/
|
||||
void saveLoginInfo(LoginInfo info);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.fateverse.log.entity;
|
||||
|
||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||
import cn.fateverse.common.core.annotaion.GenerateId;
|
||||
import cn.fateverse.common.core.enums.GenIdEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户登录信息
|
||||
*
|
||||
* @author Clay
|
||||
* @date 2022/11/2
|
||||
*/
|
||||
@Data
|
||||
@EnableAutoField
|
||||
public class LoginInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 访问Id
|
||||
*/
|
||||
@GenerateId(idType = GenIdEnum.SNOWFLAKE)
|
||||
private Long infoId;
|
||||
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 登录ip
|
||||
*/
|
||||
private String ipddr;
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String loginLocation;
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
/**
|
||||
* 登录状态
|
||||
*/
|
||||
private Integer state;
|
||||
/**
|
||||
* 登录信息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Date loginTime;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package cn.fateverse.log.entity;
|
||||
|
||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||
import cn.fateverse.common.core.annotaion.GenerateId;
|
||||
import cn.fateverse.common.core.enums.GenIdEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2022/11/1
|
||||
*/
|
||||
@Data
|
||||
@EnableAutoField
|
||||
public class OperationLog implements Serializable {
|
||||
|
||||
/**
|
||||
* 日志主键
|
||||
*/
|
||||
@GenerateId(idType = GenIdEnum.SNOWFLAKE)
|
||||
private Long operId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 操作模块
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 业务类型(0其它 1新增 2修改 3删除)
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
private String requestMethod;
|
||||
|
||||
/**
|
||||
* 操作类别(0其它 1后台用户 2手机端用户)
|
||||
*/
|
||||
private Integer operatorType;
|
||||
|
||||
/**
|
||||
* 操作人员
|
||||
*/
|
||||
private String operName;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String operUrl;
|
||||
|
||||
/**
|
||||
* 操作地址
|
||||
*/
|
||||
private String operIp;
|
||||
|
||||
/**
|
||||
* 操作地点
|
||||
*/
|
||||
private String operLocation;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String operParam;
|
||||
|
||||
/**
|
||||
* 返回参数
|
||||
*/
|
||||
private String jsonResult;
|
||||
|
||||
/**
|
||||
* 操作状态(0正常 1异常)
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 异常栈信息
|
||||
*/
|
||||
private String errorStackTrace;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date operTime;
|
||||
|
||||
/**
|
||||
* 消耗时间
|
||||
*/
|
||||
private Long consumeTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.fateverse.log.query;
|
||||
|
||||
import cn.fateverse.common.core.entity.QueryTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 日志管理->登录日志查询实体类
|
||||
* @Author: Gary
|
||||
* @DateTime:2022/11/15 20:24
|
||||
* @Version: V2.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("登录日志查询实体")
|
||||
public class LoginLogQuery extends QueryTime {
|
||||
|
||||
/**
|
||||
* 登录地址
|
||||
*/
|
||||
private String ipAddr;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 登录状态
|
||||
*/
|
||||
private String state;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.fateverse.log.query;
|
||||
|
||||
import cn.fateverse.common.core.entity.QueryTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 日志管理->操作日志查询实体类
|
||||
* @Author: Gary
|
||||
* @DateTime:2022/11/14 20:24
|
||||
* @Version: V2.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("日志查询实体")
|
||||
public class OperationLogQuery extends QueryTime {
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 操作人员
|
||||
*/
|
||||
private String operName;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*/
|
||||
private String state;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.fateverse.log.vo;
|
||||
|
||||
import cn.fateverse.log.entity.LoginInfo;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户登录信息
|
||||
*
|
||||
* @author Clay
|
||||
* @date 2022/11/2
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoginInfoVo implements Serializable {
|
||||
|
||||
/**
|
||||
* 访问Id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long infoId;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 登录ip
|
||||
*/
|
||||
private String ipddr;
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String loginLocation;
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
/**
|
||||
* 登录状态
|
||||
*/
|
||||
private Integer state;
|
||||
/**
|
||||
* 登录信息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Date loginTime;
|
||||
|
||||
|
||||
public static LoginInfoVo toLoginInfoVo(LoginInfo info) {
|
||||
LoginInfoVo vo = new LoginInfoVo();
|
||||
BeanUtils.copyProperties(info, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package cn.fateverse.log.vo;
|
||||
|
||||
import cn.fateverse.log.entity.OperationLog;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2022/11/1
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OperationLogVo implements Serializable {
|
||||
|
||||
/**
|
||||
* 日志主键
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long operId;
|
||||
|
||||
/**
|
||||
* 操作模块
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 业务类型(0其它 1新增 2修改 3删除)
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
private String requestMethod;
|
||||
|
||||
/**
|
||||
* 操作类别(0其它 1后台用户 2手机端用户)
|
||||
*/
|
||||
private Integer operatorType;
|
||||
|
||||
/**
|
||||
* 操作人员
|
||||
*/
|
||||
private String operName;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String operUrl;
|
||||
|
||||
/**
|
||||
* 操作地址
|
||||
*/
|
||||
private String operIp;
|
||||
|
||||
/**
|
||||
* 操作地点
|
||||
*/
|
||||
private String operLocation;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String operParam;
|
||||
|
||||
/**
|
||||
* 返回参数
|
||||
*/
|
||||
private String jsonResult;
|
||||
|
||||
/**
|
||||
* 操作状态(0正常 1异常)
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 异常栈信息
|
||||
*/
|
||||
private String errorStackTrace;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date operTime;
|
||||
|
||||
/**
|
||||
* 消耗时间
|
||||
*/
|
||||
private Long consumeTime;
|
||||
|
||||
|
||||
public static OperationLogVo toOperationLogVo(OperationLog operationLog) {
|
||||
return OperationLogVo.builder()
|
||||
.operId(operationLog.getOperId())
|
||||
.title(operationLog.getTitle())
|
||||
.businessType(operationLog.getBusinessType())
|
||||
.method(operationLog.getMethod())
|
||||
.requestMethod(operationLog.getRequestMethod())
|
||||
.operatorType(operationLog.getOperatorType())
|
||||
.operName(operationLog.getOperName())
|
||||
.operUrl(operationLog.getOperUrl())
|
||||
.operIp(operationLog.getOperIp())
|
||||
.operLocation(operationLog.getOperLocation())
|
||||
.operParam(operationLog.getOperParam())
|
||||
.jsonResult(operationLog.getJsonResult())
|
||||
.state(operationLog.getState())
|
||||
.errorMsg(operationLog.getErrorMsg())
|
||||
.operTime(operationLog.getOperTime())
|
||||
.consumeTime(operationLog.getConsumeTime())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user