From d0193c5a4fc63e27622f6780887e19525f088ead Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 11 三月 2026 14:31:16 +0800
Subject: [PATCH] fix: 日期区间格式问题

---
 src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
index 31fa45c..1e9f707 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -30,10 +30,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
 import java.util.*;
@@ -337,8 +334,20 @@
                     try {
                         long start = Long.parseLong(dateArr.getString(0));
                         long end = Long.parseLong(dateArr.getString(1));
-                        plan.setStartDate(Instant.ofEpochMilli(start).atZone(ZoneId.systemDefault()).toLocalDateTime());
-                        plan.setEndDate(Instant.ofEpochMilli(end).atZone(ZoneId.systemDefault()).toLocalDateTime());
+
+                        Date startDate = Date.from(Instant.ofEpochMilli(start)
+                                .atZone(ZoneId.systemDefault())
+                                .toLocalDate()
+                                .atStartOfDay(ZoneId.systemDefault())
+                                .toInstant());
+                        Date endDate = Date.from(Instant.ofEpochMilli(end)
+                                .atZone(ZoneId.systemDefault())
+                                .toLocalDate()
+                                .atStartOfDay(ZoneId.systemDefault())
+                                .toInstant());
+
+                        plan.setStartDate(startDate);
+                        plan.setEndDate(endDate);
                     } catch (Exception e) {
                         log.warn("瑙f瀽鏃ユ湡澶辫触: {}", dateArr);
                     }
@@ -454,6 +463,7 @@
         for (ProductionPlanImportDto dto : list) {
             entity = new ProductionPlan();
             BeanUtils.copyProperties(dto, entity);
+            entity.setAssignedQuantity(BigDecimal.ZERO);
             entity.setCreateTime(LocalDateTime.now());
             entity.setUpdateTime(LocalDateTime.now());
             entity.setDataSourceType(2);

--
Gitblit v1.9.3