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/pojo/ProductionPlan.java                    |   13 +++++++------
 src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java |   22 ++++++++++++++++------
 doc/宁夏-中盛建材.sql                                                                    |    2 +-
 src/main/java/com/ruoyi/productionPlan/dto/ProductionPlanImportDto.java            |   16 +++++++---------
 4 files changed, 31 insertions(+), 22 deletions(-)

diff --git "a/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql" "b/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql"
index ab5e37f..0ae95a8 100644
--- "a/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql"
+++ "b/doc/\345\256\201\345\244\217-\344\270\255\347\233\233\345\273\272\346\235\220.sql"
@@ -93,4 +93,4 @@
 
 alter table product_order
     add plan_complete_time datetime(0) NULL DEFAULT NULL COMMENT '璁″垝瀹屾垚鏃堕棿',
-    add combine_production_plan_ids varchar(500) default '' not null;
+    add combine_production_plan_ids varchar(500) default '鍚堝苟鐢熶骇璁″垝id' not null;
diff --git a/src/main/java/com/ruoyi/productionPlan/dto/ProductionPlanImportDto.java b/src/main/java/com/ruoyi/productionPlan/dto/ProductionPlanImportDto.java
index d43ab8f..91d7485 100644
--- a/src/main/java/com/ruoyi/productionPlan/dto/ProductionPlanImportDto.java
+++ b/src/main/java/com/ruoyi/productionPlan/dto/ProductionPlanImportDto.java
@@ -1,7 +1,5 @@
 package com.ruoyi.productionPlan.dto;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.framework.aspectj.lang.annotation.Excel;
 import io.swagger.annotations.ApiModel;
@@ -9,7 +7,7 @@
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * <br>
@@ -103,18 +101,18 @@
     /**
      * 寮�濮嬫棩鏈�
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @ApiModelProperty("寮�濮嬫棩鏈�")
-    @Excel(name = "寮�濮嬫棩鏈�", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime startDate;
+    @Excel(name = "寮�濮嬫棩鏈�", width = 20, dateFormat = "yyyy-MM-dd")
+    private Date startDate;
 
     /**
      * 缁撴潫鏃ユ湡
      */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @ApiModelProperty("缁撴潫鏃ユ湡")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @Excel(name = "缁撴潫鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime endDate;
+    @Excel(name = "缁撴潫鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd")
+    private Date endDate;
 
     /**
      * 鎻愪氦浜�
diff --git a/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java b/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
index c06cdfb..8839bd6 100644
--- a/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
+++ b/src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
@@ -10,6 +10,7 @@
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * <br>
@@ -122,18 +123,18 @@
     /**
      * 寮�濮嬫棩鏈�
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @ApiModelProperty("寮�濮嬫棩鏈�")
-    @Excel(name = "寮�濮嬫棩鏈�", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime startDate;
+    @Excel(name = "寮�濮嬫棩鏈�", width = 20, dateFormat = "yyyy-MM-dd")
+    private Date startDate;
 
     /**
      * 缁撴潫鏃ユ湡
      */
     @ApiModelProperty("缁撴潫鏃ユ湡")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @Excel(name = "缁撴潫鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime endDate;
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @Excel(name = "缁撴潫鏃ユ湡", width = 20, dateFormat = "yyyy-MM-dd")
+    private Date endDate;
 
     /**
      * 鎻愪氦浜�
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