From 7188f28998d47c286e34cbd525986603cfc19ba9 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 31 七月 2026 17:58:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_business' into dev_business

---
 yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java
index 6dfecb7..2dad8f1 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java
@@ -2,12 +2,15 @@
 
 import tools.jackson.core.JacksonException;
 import tools.jackson.core.JsonParser;
+import tools.jackson.core.JsonToken;
 import tools.jackson.databind.DeserializationContext;
 import tools.jackson.databind.ValueDeserializer;
 
 import java.time.Instant;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 
 /**
  * 鍩轰簬鏃堕棿鎴崇殑 LocalDateTime 鍙嶅簭鍒楀寲鍣�
@@ -18,10 +21,28 @@
 
     public static final TimestampLocalDateTimeDeserializer INSTANCE = new TimestampLocalDateTimeDeserializer();
 
+    private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
     @Override
     public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException {
-        // 灏� Long 鏃堕棿鎴筹紝杞崲涓� LocalDateTime 瀵硅薄
-        return LocalDateTime.ofInstant(Instant.ofEpochMilli(p.getValueAsLong()), ZoneId.systemDefault());
+        // 鏁板瓧绫诲瀷锛氫綔涓烘椂闂存埑澶勭悊
+        if (p.currentToken() == JsonToken.VALUE_NUMBER_INT) {
+            return LocalDateTime.ofInstant(Instant.ofEpochMilli(p.getValueAsLong()), ZoneId.systemDefault());
+        }
+        // 瀛楃涓茬被鍨嬶細鍏堝皾璇曚綔涓烘椂闂存埑瑙f瀽锛屽啀鎸夋棩鏈熸牸寮忚В鏋�
+        String text = p.getValueAsString();
+        try {
+            long millis = Long.parseLong(text);
+            return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault());
+        } catch (NumberFormatException e) {
+            // 涓嶆槸绾暟瀛楋紝鎸夋棩鏈熸牸寮忚В鏋�
+        }
+        // 绾棩鏈熸牸寮忥紙濡� "2026-07-29"锛夛紝琛ュ叏涓哄綋澶� 00:00:00
+        if (text.length() == 10) {
+            return LocalDate.parse(text, DATE_FORMATTER).atStartOfDay();
+        }
+        return LocalDateTime.parse(text, DATE_TIME_FORMATTER);
     }
 
 }

--
Gitblit v1.9.3