mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-04 19:38:02 +00:00
update 优化整体代码 适配jdk17
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package org.dromara.common.log.domain.convert;
|
||||
|
||||
import org.dromara.common.log.event.OperLogEvent;
|
||||
import org.dromara.system.api.domain.bo.RemoteOperLogBo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 操作日志转换器
|
||||
* @author zhujie
|
||||
*/
|
||||
@Mapper
|
||||
public interface OperLogEventConvert {
|
||||
|
||||
OperLogEventConvert INSTANCE = Mappers.getMapper(OperLogEventConvert.class);
|
||||
|
||||
/**
|
||||
* OperLogEventToRemoteOperLogBo
|
||||
* @param operLogEvent 待转换对象
|
||||
* @return 转换后对象
|
||||
*/
|
||||
@Mapping(target = "params", ignore = true)
|
||||
RemoteOperLogBo convert(OperLogEvent operLogEvent);
|
||||
}
|
@@ -1,14 +1,15 @@
|
||||
package org.dromara.common.log.event;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.constant.Constants;
|
||||
import org.dromara.common.core.utils.ServletUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.ip.AddressUtils;
|
||||
import org.dromara.common.log.domain.convert.OperLogEventConvert;
|
||||
import org.dromara.system.api.RemoteLogService;
|
||||
import org.dromara.system.api.domain.bo.RemoteLogininforBo;
|
||||
import org.dromara.system.api.domain.bo.RemoteOperLogBo;
|
||||
@@ -16,8 +17,6 @@ import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 异步调用日志服务
|
||||
*
|
||||
@@ -36,7 +35,7 @@ public class LogEventListener {
|
||||
@Async
|
||||
@EventListener
|
||||
public void saveLog(OperLogEvent operLogEvent) {
|
||||
RemoteOperLogBo sysOperLog = OperLogEventConvert.INSTANCE.convert(operLogEvent);
|
||||
RemoteOperLogBo sysOperLog = BeanUtil.toBean(operLogEvent, RemoteOperLogBo.class);
|
||||
remoteLogService.saveLog(sysOperLog);
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,8 @@ package org.dromara.common.log.event;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -14,6 +16,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class LogininforEvent implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@@ -2,6 +2,7 @@ package org.dromara.common.log.event;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -14,6 +15,7 @@ import java.util.Date;
|
||||
@Data
|
||||
public class OperLogEvent implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user