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 | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 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 a93d311..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.*;
@@ -126,7 +123,7 @@
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 鍒ゆ柇涓嬪彂鏁伴噺鏄惁澶т簬绛変簬鏂规暟
if (productionPlanDto.getTotalAssignedQuantity().compareTo(totalVolume) > 0) {
- log.warn("鍚堝苟澶辫触锛屼笅鍙戞暟閲忎笉鑳藉ぇ浜庢柟鏁�");
+ log.warn("鎿嶄綔澶辫触锛屼笅鍙戞暟閲忎笉鑳藉ぇ浜庢柟鏁�");
return false;
}
@@ -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