From 44eb64bef08ce231ac95d5ee482b046014dc8afa Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 08 九月 2025 11:29:26 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java |   51 +++++++--------------------------------------------
 1 files changed, 7 insertions(+), 44 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 a0bd00b..614ff75 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
@@ -79,24 +79,12 @@
     @Value("${wechat.irr.plan.planTerminateLimitMinutes:5}")
     private Integer planTerminateLimitMinutes; // 璁″垝缁堟鍚庨檺鍒跺彂甯冩柊璁″垝鐨勬椂闂撮棿闅�(鍒嗛挓)
 
-    /**
-     * 娣诲姞鐏屾簤璁″垝
-     *
-     * @param po
-     * @return
-     */
     @Transactional(rollbackFor = Exception.class)
     public Long addIrrigatePlan(IrIrrigatePlan po) {
         irrigatePlanMapper.insert(po);
         return po.getId();
     }
 
-    /**
-     * 鍒犻櫎鐏屾簤璁″垝
-     *
-     * @param planSimple
-     * @return
-     */
     @Transactional(rollbackFor = Exception.class)
     public Map deletePlan(PlanSimple planSimple) {
         Long planId = planSimple.getPlanId();
@@ -142,12 +130,6 @@
         }
     }
 
-    /**
-     * 鍙戝竷鐏屾簤璁″垝
-     *
-     * @param planSimple
-     * @return
-     */
     public Map publishPlan(PlanSimple planSimple) {
         Long planId = planSimple.getPlanId();
         Long operatorId = planSimple.getOperatorId();
@@ -184,10 +166,6 @@
             }
         }
 
-        /**
-         * 鑾峰彇鐏屾簤璁″垝淇℃伅
-         * 鏇存柊鐏屾簤璁″垝璧锋鏃堕棿鍙婅鍒掔姸鎬�
-         */
         VoPlanSimple plan = irrigatePlanMapper.getPlanSimple(planId);
         if (plan == null) {
             Map map = new HashMap<>();
@@ -217,39 +195,32 @@
         }
         planStartTime = Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant());
         
-        // 鏇存柊姣忎釜鐏屾簤娆″簭鐨勫紑濮嬫椂闂村苟璁$畻鏈�鍚庝竴缁勫叧闃�鏃堕棿
         List<VoIrrigateSchedule> schedules = getSchedulesByPlanId(planId);
         Date scheduleStartTime = null;
         LocalDateTime lastScheduleEndTime = null;
         Integer sort = 0;
         
-        // 绗竴娆¢亶鍘嗭細鏇存柊姣忎釜鐏屾簤娆″簭鐨勫紑濮嬫椂闂�
         for (VoIrrigateSchedule schedule : schedules) {
             if (scheduleStartTime == null) {
                 scheduleStartTime = planStartTime;
             }
             this.updateScheduleStartTime(schedule.getScheduleId(), scheduleStartTime);
             
-            // 璁$畻褰撳墠娆″簭鐨勭粨鏉熸椂闂�
             LocalDateTime currentScheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
             LocalDateTime currentScheduleEndTime = currentScheduleStartTime.plusMinutes(schedule.getDuration());
             
-            // 鏇存柊鏈�鍚庝竴缁勭殑缁撴潫鏃堕棿
             lastScheduleEndTime = currentScheduleEndTime;
             
-            // 璁$畻涓嬩竴缁勭殑寮�濮嬫椂闂�
             LocalDateTime LocalscheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
             LocalscheduleStartTime = LocalscheduleStartTime.plusMinutes(schedule.getDuration());
             LocalscheduleStartTime = LocalscheduleStartTime.minusMinutes(preOpeningTime);
             scheduleStartTime = Date.from(LocalscheduleStartTime.atZone(ZoneId.systemDefault()).toInstant());
 
-            // 纭繚涓嬩竴缁勭殑寮�濮嬫椂闂翠笉鏃╀簬璁″垝寮�濮嬫椂闂�
             if (scheduleStartTime.before(planStartTime)) {
                 scheduleStartTime = planStartTime;
             }
         }
         
-        // 鏍规嵁鏈�鍚庝竴缁勫叧闃�鏃堕棿璁剧疆璁″垝缁撴潫鏃堕棿
         if (lastScheduleEndTime != null) {
             planStopTime = Date.from(lastScheduleEndTime.atZone(ZoneId.systemDefault()).toInstant());
         } else {
@@ -258,7 +229,6 @@
             planStopTime = Date.from(stopTime.atZone(ZoneId.systemDefault()).toInstant());
         }
 
-        // 鏍规嵁璁″垝ID鏇存柊璁″垝淇℃伅锛堣捣姝㈡椂闂淬�佽鍒掔姸鎬侊級
         if (this.updatePlanTimes(planStartTime, planStopTime, planId) == 0) {
             Map map = new HashMap<>();
             map.put("success", false);
@@ -267,7 +237,6 @@
             return map;
         }
 
-        // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
         IrPlanOperate planOperate = new IrPlanOperate();
         planOperate.setPlanId(planId);
         planOperate.setOperator(operatorId);
@@ -285,6 +254,13 @@
         for (VoIrrigateSchedule schedule : schedules) {
             Long groupId = schedule.getGroupId();
             List<Long> intakeIds = getIntakeIdsByGroupId(groupId);
+            if(intakeIds == null || intakeIds.size() <= 0) {
+                Map map = new HashMap<>();
+                map.put("success", false);
+                map.put("msg", "褰撳墠杞亴缁勫唴娌℃湁鏈夋晥鐨勫彇姘村彛");
+                map.put("content", null);
+                return map;
+            }
             for (Long intakeId : intakeIds) {
                 if (schedule.getDuration() > 0) {
                     // 浠婂彂甯冪亴婧夋椂闀垮ぇ浜�0鐨�
@@ -534,12 +510,6 @@
         return irIrrigateUnitMapper.getIntakeIdByUnitId(unitId);
     }
 
-    /**
-     * 鏍规嵁璁″垝ID鑾峰彇璁″垝鍙戝竷缁撴灉
-     *
-     * @param planId
-     * @return
-     */
     public VoPlanDetails getPublishResults(Long planId) {
         VoPlanDetails planDetails = irrigatePlanMapper.getPlanDetails(planId);
         if (planDetails == null) {
@@ -564,15 +534,8 @@
 
         planDetails.setGroups(groupResults);
         return planDetails;
-
     }
 
-    /**
-     * 鏍规嵁璁″垝ID鑾峰彇璁″垝缁堟鎿嶄綔缁撴灉
-     *
-     * @param planId
-     * @return
-     */
     public VoPlanDetails getTerminateResults(Long planId) {
         // 鑾峰彇璁″垝缁堟鏃堕棿
         Date terminateTime = Optional.ofNullable(irPlanOperateMapper.getTerminateTime(planId)).orElse(null);

--
Gitblit v1.8.0