From 67db945bbfd7ae08335652c30537a68e443deb78 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期日, 15 三月 2026 16:22:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/holiday/HolidayUtil.java |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/holiday/HolidayUtil.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/holiday/HolidayUtil.java
index 947c385..3e5f7fe 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/holiday/HolidayUtil.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/holiday/HolidayUtil.java
@@ -10,7 +10,10 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.time.Duration;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.util.concurrent.TimeUnit;
 
 
@@ -64,18 +67,31 @@
         for (int i = 0; i < parse.size(); i++) {
             JSONObject jsonObject1 = parse.getJSONObject(i);
             String daytype = jsonObject1.get("daytype").toString();
+
+            long secondsToExactEndOfDay = getSecondsToExactEndOfDay();
             if (daytype.equals("0")) {
-                redisService.setCacheObject(CacheConstants.IS_DAY + now, "0", 1l, TimeUnit.DAYS);
+                redisService.setCacheObject(CacheConstants.IS_DAY + now, "0", secondsToExactEndOfDay, TimeUnit.SECONDS);
                 return 0;
             } else if (daytype.equals("1")) {
-                redisService.setCacheObject(CacheConstants.IS_DAY + now, "1", 1l, TimeUnit.DAYS);
+                redisService.setCacheObject(CacheConstants.IS_DAY + now, "1", secondsToExactEndOfDay, TimeUnit.SECONDS);
                 return 1;
             } else if (daytype.equals("2")) {
-                redisService.setCacheObject(CacheConstants.IS_DAY + now, "0", 1l, TimeUnit.DAYS);
+                redisService.setCacheObject(CacheConstants.IS_DAY + now, "2", secondsToExactEndOfDay, TimeUnit.SECONDS);
                 return 0;
             }
         }
         return 0;
     }
 
+    public static long getSecondsToExactEndOfDay() {
+        LocalDateTime now = LocalDateTime.now();
+
+        // 精确到23:59:59(不包含毫秒/纳秒)
+        LocalDateTime endOfDay = LocalDateTime.of(
+                LocalDate.now(),
+                LocalTime.of(23, 59, 59)
+        );
+
+        return Duration.between(now, endOfDay).getSeconds();
+    }
 }

--
Gitblit v1.7.1