mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-21 18:57:12 +08:00
修复:解决 Jackson2ObjectMapperBuilderCustomizer 配置不生效的问题,同时优化所有 Date 类型为对应 Java 8 日期、时间类型
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.interceptor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -37,6 +37,7 @@ import org.springframework.web.util.ContentCachingResponseWrapper;
|
||||
import org.springframework.web.util.WebUtils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
@@ -104,7 +105,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
private void logCreateTime() {
|
||||
OperationLog operationLog = new OperationLog();
|
||||
operationLog.setCreateUser(LoginHelper.getUserId());
|
||||
operationLog.setCreateTime(new Date());
|
||||
operationLog.setCreateTime(LocalDateTime.now());
|
||||
LogContextHolder.set(operationLog);
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
LogContextHolder.remove();
|
||||
SysLog sysLog = new SysLog();
|
||||
sysLog.setCreateTime(operationLog.getCreateTime());
|
||||
sysLog.setElapsedTime(System.currentTimeMillis() - sysLog.getCreateTime().getTime());
|
||||
sysLog.setElapsedTime(System.currentTimeMillis() - LocalDateTimeUtil.toEpochMilli(sysLog.getCreateTime()));
|
||||
sysLog.setLogLevel(LogLevelEnum.INFO);
|
||||
|
||||
// 记录异常信息
|
||||
|
@@ -17,7 +17,7 @@
|
||||
package top.charles7c.cnadmin.monitor.model.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -122,5 +122,5 @@ public class SysLog implements Serializable {
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date createTime;
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
Reference in New Issue
Block a user