From 4513ef24bf9b188c2a77d6ce94f1a6b7e9ebf0e6 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期日, 27 四月 2025 20:40:19 +0800
Subject: [PATCH] fix(irrigatePlan): 修正灌溉计划开始时间逻辑

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
index cdc76d5..4be4c5f 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
@@ -74,6 +74,9 @@
 
     private static final Integer irrPlanDelayDefault = 5 ;//杞亴涓鍒掑紑闃�鐨勯粯璁ゅ欢杩熸椂闀�
 
+    @Value("${rotation.preOpeningTime}")
+    private Long preOpeningTime;
+
     /**
      * 娣诲姞鐏屾簤璁″垝
      * @param po
@@ -218,8 +221,13 @@
             // 璁$畻涓嬩竴缁勭殑寮�濮嬫椂闂�
             LocalDateTime LocalscheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime();
             LocalscheduleStartTime = LocalscheduleStartTime.plusMinutes(schedule.getDuration());
-            LocalscheduleStartTime = LocalscheduleStartTime.minusMinutes(2);
+            LocalscheduleStartTime = LocalscheduleStartTime.minusMinutes(preOpeningTime);
             scheduleStartTime = Date.from(LocalscheduleStartTime.atZone(ZoneId.systemDefault()).toInstant());
+            
+            // 纭繚涓嬩竴缁勭殑寮�濮嬫椂闂翠笉鏃╀簬璁″垝寮�濮嬫椂闂�
+            if(scheduleStartTime.before(planStartTime)) {
+                scheduleStartTime = planStartTime;
+            }
         }
 
         // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍

--
Gitblit v1.8.0