From 52daba0b36bf347cfce84ae9b44328b014f4343c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 4 Sep 2025 15:47:11 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/common/web/config/ResourcesConfig.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/config/ResourcesConfig.java b/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/config/ResourcesConfig.java index 8dbb589d..13ee3759 100644 --- a/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/config/ResourcesConfig.java +++ b/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/config/ResourcesConfig.java @@ -1,6 +1,8 @@ package org.dromara.common.web.config; +import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.web.handler.GlobalExceptionHandler; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -29,10 +31,11 @@ public class ResourcesConfig implements WebMvcConfigurer { public void addFormatters(FormatterRegistry registry) { // 全局日期格式转换配置 registry.addConverter(String.class, Date.class, source -> { - if (StringUtils.isBlank(source)) { + DateTime parse = DateUtil.parse(source); + if (ObjectUtils.isNull(parse)) { return null; } - return DateUtil.parse(source); + return parse.toJdkDate(); }); }