mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-04 09:43:23 +08:00
update 优化操作日志
This commit is contained in:
@@ -83,7 +83,7 @@ public class SysUserOnlineController extends BaseController {
|
||||
* @return 操作结果
|
||||
*/
|
||||
@SaCheckPermission("monitor:online:forceLogout")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE_LOGOUT)
|
||||
@RepeatSubmit()
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public R<Void> forceLogout(@PathVariable String tokenId) {
|
||||
@@ -120,7 +120,7 @@ public class SysUserOnlineController extends BaseController {
|
||||
* @param tokenId token值
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Log(title = "在线设备", businessType = BusinessType.FORCE)
|
||||
@Log(title = "在线设备", businessType = BusinessType.FORCE_LOGOUT)
|
||||
@RepeatSubmit()
|
||||
@DeleteMapping("/myself/{tokenId}")
|
||||
public R<Void> remove(@PathVariable("tokenId") String tokenId) {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.time.LocalDateTime;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("sys_oper_log")
|
||||
public class SysOperLog implements Serializable {
|
||||
@@ -28,15 +27,35 @@ public class SysOperLog implements Serializable {
|
||||
private Long operId;
|
||||
|
||||
/**
|
||||
* 操作模块
|
||||
* 业务模块名称
|
||||
*/
|
||||
private String title;
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 业务类型(0其它 1新增 2修改 3删除)
|
||||
* 操作功能名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 操作描述(备注)
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 标签(用于检索/分类)
|
||||
*/
|
||||
private String tags;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 操作渠道
|
||||
*/
|
||||
private Integer channel;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
@@ -53,15 +72,20 @@ public class SysOperLog implements Serializable {
|
||||
private Integer operatorType;
|
||||
|
||||
/**
|
||||
* 操作人员
|
||||
* 用户名
|
||||
*/
|
||||
private String operName;
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
@@ -72,11 +96,26 @@ public class SysOperLog implements Serializable {
|
||||
*/
|
||||
private String operIp;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 操作地点
|
||||
*/
|
||||
private String operLocation;
|
||||
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
|
||||
@@ -35,22 +35,42 @@ public class SysOperLogBo implements Serializable {
|
||||
private Long operId;
|
||||
|
||||
/**
|
||||
* 模块标题
|
||||
* 业务模块名称
|
||||
*/
|
||||
private String title;
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 业务类型(0其它 1新增 2修改 3删除)
|
||||
* 操作功能名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 操作描述(备注)
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 标签(用于检索/分类)
|
||||
*/
|
||||
private String tags;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 操作渠道
|
||||
*/
|
||||
private Integer channel;
|
||||
|
||||
/**
|
||||
* 业务类型数组
|
||||
*/
|
||||
private Integer[] businessTypes;
|
||||
|
||||
/**
|
||||
* 方法名称
|
||||
* 请求方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
@@ -65,9 +85,9 @@ public class SysOperLogBo implements Serializable {
|
||||
private Integer operatorType;
|
||||
|
||||
/**
|
||||
* 操作人员
|
||||
* 用户名
|
||||
*/
|
||||
private String operName;
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
@@ -75,20 +95,40 @@ public class SysOperLogBo implements Serializable {
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 请求URL
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 请求url
|
||||
*/
|
||||
private String operUrl;
|
||||
|
||||
/**
|
||||
* 主机地址
|
||||
* 操作地址
|
||||
*/
|
||||
private String operIp;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 操作地点
|
||||
*/
|
||||
private String operLocation;
|
||||
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.dromara.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -43,10 +44,11 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
||||
@Async
|
||||
@EventListener
|
||||
public void recordOper(OperLogEvent operLogEvent) {
|
||||
SysOperLogBo operLog = MapstructUtils.convert(operLogEvent, SysOperLogBo.class);
|
||||
SysOperLog operLog = BeanUtil.copyProperties(operLogEvent, SysOperLog.class);
|
||||
// 远程查询操作地点
|
||||
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
|
||||
insertOperlog(operLog);
|
||||
operLog.setOperTime(LocalDateTime.now());
|
||||
baseMapper.insert(operLog);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +78,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
||||
Map<String, Object> params = operLog.getParams();
|
||||
return new LambdaQueryWrapper<SysOperLog>()
|
||||
.like(StringUtils.isNotBlank(operLog.getOperIp()), SysOperLog::getOperIp, operLog.getOperIp())
|
||||
.like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
|
||||
.like(StringUtils.isNotBlank(operLog.getModule()), SysOperLog::getModule, operLog.getModule())
|
||||
.eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0,
|
||||
SysOperLog::getBusinessType, operLog.getBusinessType())
|
||||
.func(f -> {
|
||||
@@ -86,7 +88,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
||||
})
|
||||
.eq(operLog.getStatus() != null,
|
||||
SysOperLog::getStatus, operLog.getStatus())
|
||||
.like(StringUtils.isNotBlank(operLog.getOperName()), SysOperLog::getOperName, operLog.getOperName())
|
||||
.like(StringUtils.isNotBlank(operLog.getUsername()), SysOperLog::getUsername, operLog.getUsername())
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysOperLog::getOperTime, params.get("beginTime"), params.get("endTime"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user