mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-16 12:05:07 +08:00
系统操作日志:使用自定义 starter 的方式重新集成 mzt-biz-log
This commit is contained in:
@ -22,32 +22,12 @@
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- TODO @puhui999 & 芋艿:操作日志,要不要这么引入? -->
|
||||
<!-- Springboot-注解-通用操作日志组件 -->
|
||||
<!-- 此组件解决的问题是: 「谁」在「什么时间」对「什么」做了「什么事」 -->
|
||||
<dependency>
|
||||
<groupId>io.github.mouzt</groupId>
|
||||
<artifactId>bizlog-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- TODO @puhui999 & 芋艿:要不要移除掉 -->
|
||||
<!--工具类相关-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,11 +1,12 @@
|
||||
package cn.iocoder.yudao.module.system.api.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogV2CreateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogV2PageReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogV2RespDTO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 API 接口
|
||||
*
|
||||
@ -21,12 +22,18 @@ public interface OperateLogApi {
|
||||
void createOperateLog(@Valid OperateLogCreateReqDTO createReqDTO);
|
||||
|
||||
/**
|
||||
* 获取指定模块的指定数据的操作日志
|
||||
* 创建操作日志
|
||||
*
|
||||
* @param module 操作模块
|
||||
* @param bizId 操作模块编号
|
||||
* @return 操作日志
|
||||
* @param createReqDTO 请求
|
||||
*/
|
||||
List<OperateLogV2RespDTO> getOperateLogByModuleAndBizId(String module, Long bizId);
|
||||
void createOperateLogV2(@Valid OperateLogV2CreateReqDTO createReqDTO);
|
||||
|
||||
/**
|
||||
* 获取指定模块的指定数据的操作日志分页
|
||||
*
|
||||
* @param pageReqVO 请求
|
||||
* @return 操作日志分页
|
||||
*/
|
||||
PageResult<OperateLogV2RespDTO> getOperateLogPage(OperateLogV2PageReqDTO pageReqVO);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
package cn.iocoder.yudao.module.system.api.logger.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 系统操作日志 Create Req BO
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class OperateLogV2CreateReqDTO {
|
||||
|
||||
/**
|
||||
* 链路追踪编号
|
||||
*
|
||||
* 一般来说,通过链路追踪编号,可以将访问日志,错误日志,链路追踪日志,logger 打印日志等,结合在一起,从而进行排错。
|
||||
*/
|
||||
private String traceId;
|
||||
/**
|
||||
* 用户编号
|
||||
*
|
||||
* 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户类型
|
||||
*
|
||||
* 关联 {@link UserTypeEnum}
|
||||
*/
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private Integer userType;
|
||||
/**
|
||||
* 操作模块类型
|
||||
*/
|
||||
@NotEmpty(message = "操作模块类型不能为空")
|
||||
private String type;
|
||||
/**
|
||||
* 操作名
|
||||
*/
|
||||
@NotEmpty(message = "操作名不能为空")
|
||||
private String subType;
|
||||
/**
|
||||
* 操作模块业务编号
|
||||
*/
|
||||
@NotNull(message = "操作模块业务编号不能为空")
|
||||
private Long bizId;
|
||||
/**
|
||||
* 操作内容,记录整个操作的明细
|
||||
* 例如说,修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。
|
||||
*/
|
||||
@NotEmpty(message = "操作内容不能为空")
|
||||
private String content;
|
||||
/**
|
||||
* 拓展字段,有些复杂的业务,需要记录一些字段 ( JSON 格式 )
|
||||
* 例如说,记录订单编号,{ orderId: "1"}
|
||||
*/
|
||||
private String extra;
|
||||
|
||||
/**
|
||||
* 请求方法名
|
||||
*/
|
||||
@NotEmpty(message = "请求方法名不能为空")
|
||||
private String requestMethod;
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@NotEmpty(message = "请求地址不能为空")
|
||||
private String requestUrl;
|
||||
/**
|
||||
* 用户 IP
|
||||
*/
|
||||
@NotEmpty(message = "用户 IP 不能为空")
|
||||
private String userIp;
|
||||
/**
|
||||
* 浏览器 UA
|
||||
*/
|
||||
@NotEmpty(message = "浏览器 UA 不能为空")
|
||||
private String userAgent;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.api.logger.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 操作日志分页 Request DTO
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class OperateLogV2PageReqDTO extends PageParam {
|
||||
|
||||
/**
|
||||
* 模块类型
|
||||
*/
|
||||
private String bizType;
|
||||
/**
|
||||
* 模块数据编号
|
||||
*/
|
||||
private Long bizId;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
}
|
@ -1,14 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.api.logger.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||
|
||||
/**
|
||||
* 系统操作日志 Resp DTO
|
||||
*
|
||||
@ -25,6 +18,10 @@ public class OperateLogV2RespDTO {
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
@ -68,20 +65,8 @@ public class OperateLogV2RespDTO {
|
||||
private String userAgent;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* 创建时间, 直接返回字符串
|
||||
*/
|
||||
// TODO puhui999: 木得效果怎么肥事
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
// TODO @puhui999:下面 2 个字段不用返回;用 userId 哈;返回一个 userName
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String creator;
|
||||
/**
|
||||
* 创建者名称
|
||||
*/
|
||||
private String creatorName;
|
||||
private String createTime;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user