From dae44e71f055776501ebbb1d3524833a50ad439a Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 24 二月 2025 15:34:29 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java                                          |   10 +
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java                                                |   22 +
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml                                                         |   11 +
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateSv.java      |    5 
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java                            |    6 
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/PlanSimple.java                              |   28 +++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/enums/OperateTypeENUM.java                       |   25 ++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanOperateMapper.xml                                                              |  102 +++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java                              |   54 +++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java                                              |    7 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanOperate.java                                                    |   61 ++++++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java                                           |    5 
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateQueryVo.java |   15 +
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml                                                             |    5 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanOperateMapper.java                                               |   27 +++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java                                                 |   45 +++++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java                            |   87 +++++++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml                                                          |   21 +
 18 files changed, 509 insertions(+), 27 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java
index 1b36d36..dacdfb0 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigatePlanMapper.java
@@ -24,4 +24,11 @@
     int updateByPrimaryKeySelective(IrIrrigatePlan record);
 
     int updateByPrimaryKey(IrIrrigatePlan record);
+
+    /**
+     * 鍙戝竷鎸囧畾鐨勭亴婧夎鍒�
+     * @param planId
+     * @return
+     */
+    int publishIrrigatePlan(Long planId);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java
index 7d2b824..08cf63d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIrrigateScheduleMapper.java
@@ -2,7 +2,10 @@
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule;
+import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule;
 import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
 
 /**
  * @author ZhuBaoMin
@@ -23,4 +26,11 @@
     int updateByPrimaryKeySelective(IrIrrigateSchedule record);
 
     int updateByPrimaryKey(IrIrrigateSchedule record);
+
+    /**
+     * 鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭
+     * @param planId
+     * @return
+     */
+    List<VoIrrigateSchedule> getIrrigateSchedules(Long planId);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java
index 7e13c82..c097651 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrOpeningScheduleMapper.java
@@ -6,10 +6,11 @@
 
 /**
  * @author ZhuBaoMin
- * @date 2025-02-20 15:35
- * @LastEditTime 2025-02-20 15:35
+ * @date 2025-02-21 11:08
+ * @LastEditTime 2025-02-21 11:08
  * @Description
  */
+
 @Mapper
 public interface IrOpeningScheduleMapper extends BaseMapper<IrOpeningSchedule> {
     int deleteByPrimaryKey(Long id);
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanOperateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanOperateMapper.java
new file mode 100644
index 0000000..e945a18
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrPlanOperateMapper.java
@@ -0,0 +1,27 @@
+package com.dy.pipIrrGlobal.daoIr;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dy.pipIrrGlobal.pojoIr.IrPlanOperate;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2025-02-21 11:11
+ * @LastEditTime 2025-02-21 11:11
+ * @Description
+ */
+
+@Mapper
+public interface IrPlanOperateMapper extends BaseMapper<IrPlanOperate> {
+    int deleteByPrimaryKey(Long id);
+
+    int insert(IrPlanOperate record);
+
+    int insertSelective(IrPlanOperate record);
+
+    IrPlanOperate selectByPrimaryKey(Long id);
+
+    int updateByPrimaryKeySelective(IrPlanOperate record);
+
+    int updateByPrimaryKey(IrPlanOperate record);
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java
index e5bb0b1..a2bd808 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrOpeningSchedule.java
@@ -29,28 +29,34 @@
     public static final long serialVersionUID = 202502201600001L;
 
     /**
-    * 涓婚敭
-    */
+     * 涓婚敭
+     */
     @JSONField(serializeUsing= ObjectWriterImplToString.class)
     @TableId(type = IdType.INPUT)
     private Long id;
 
     /**
-    * 鐏屾簤娆″簭ID
-    */
+     * 鐏屾簤娆″簭ID
+     */
     @NotNull(message = "鐏屾簤娆″簭ID涓嶈兘涓虹┖")
     private Long scheduleId;
 
     /**
-    * 寮�闃�鏃堕棿
-    */
+     * 鍙栨按鍙D
+     */
+    @NotNull(message = "鍙栨按鍙D涓嶈兘涓虹┖")
+    private Long intakeId;
+
+    /**
+     * 寮�闃�鏃堕棿
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @NotNull(message = "寮�闃�鏃堕棿涓嶈兘涓虹┖")
     private Date startTime;
 
     /**
-    * 鐏屾簤鏃堕暱;鍒嗛挓
-    */
+     * 鐏屾簤鏃堕暱;鍒嗛挓
+     */
     @NotNull(message = "鐏屾簤鏃堕暱涓嶈兘涓虹┖")
     private Integer duration;
 
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanOperate.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanOperate.java
new file mode 100644
index 0000000..8f3ec3a
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrPlanOperate.java
@@ -0,0 +1,61 @@
+package com.dy.pipIrrGlobal.pojoIr;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dy.common.po.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import jakarta.validation.constraints.NotNull;
+import lombok.*;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2025-02-21 11:11
+ * @LastEditTime 2025-02-21 11:11
+ * @Description 鐏屾簤璁″垝鎿嶅疄浣撶被
+ */
+
+@TableName(value="ir_plan_operate", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class IrPlanOperate implements BaseEntity {
+    public static final long serialVersionUID = 202502201600001L;
+
+    /**
+    * 涓婚敭
+    */
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    @TableId(type = IdType.INPUT)
+    private Long id;
+
+    /**
+    * 鐏屾簤璁″垝ID
+    */
+    @NotNull(message = "鐏屾簤璁″垝ID涓嶈兘涓虹┖")
+    private Long planId;
+
+    /**
+    * 鎿嶄綔浜虹紪鍙�
+    */
+    @NotNull(message = "鎿嶄綔浜虹紪鍙蜂笉鑳戒负绌�")
+    private Long operator;
+
+    /**
+    * 鎿嶄綔绫诲瀷;1-鍒涘缓锛�2-鍙戝竷锛�3-鎵ц锛�4-鏆傚仠锛�5-缁堟锛�6-瀹屾垚
+    */
+    private Byte operateType;
+
+    /**
+    * 鎿嶄綔鏃堕棿
+    */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date operateTime;
+
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java
new file mode 100644
index 0000000..9cd54f5
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoIrrigateSchedule.java
@@ -0,0 +1,45 @@
+package com.dy.pipIrrGlobal.voIr;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
+import com.dy.common.po.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2025-02-21 14:21
+ * @LastEditTime 2025-02-21 14:21
+ * @Description 鐏屾簤娆″簭瑙嗗浘瀵硅薄
+ */
+
+@Data
+@JsonPropertyOrder({ "id", "vcNum", "money", "inUse", "isAlarmValue"})
+public class VoIrrigateSchedule implements BaseEntity {
+    private static final long serialVersionUID = 202502211423001L;
+
+    /**
+     * 鐏屾簤娆″簭ID
+     */
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    private Long scheduleId;
+
+    /**
+     * 鐏屾簤寮�濮嬫椂闂�
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date startTime;
+
+    /**
+     * 鐏屾簤鏃堕暱锛屽垎閽�
+     */
+    private Integer duration;
+
+    /**
+     * 鍙栨按鍙D锛屽涓敤閫楀彿闅斿紑
+     */
+    private String intakeIds;
+}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml
index 9dbad15..d0dcde5 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigatePlanMapper.xml
@@ -148,4 +148,9 @@
       deleted = #{deleted,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <!--鍙戝竷鎸囧畾鐨勭亴婧夎鍒�-->
+  <update id="publishIrrigatePlan">
+    UPDATE ir_irrigate_plan SET plan_state = 2 WHERE id = #{planId}
+  </update>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml
index 38799f3..1c90e2a 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIrrigateScheduleMapper.xml
@@ -134,4 +134,15 @@
       current_state = #{currentState,jdbcType=TINYINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <!--鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭-->
+  <select id="getIrrigateSchedules" resultType="com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule">
+    SELECT
+        id AS scheduleId,
+        start_time AS startTime,
+        TIMESTAMPDIFF(MINUTE, start_time, stop_time) AS duration,
+        intake_ids AS intakeIds
+    FROM ir_irrigate_schedule
+    WHERE plan_id = #{planId}
+  </select>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml
index 8ff2b08..1acd788 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrOpeningScheduleMapper.xml
@@ -6,12 +6,13 @@
     <!--@Table ir_opening_schedule-->
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="schedule_id" jdbcType="BIGINT" property="scheduleId" />
+    <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
     <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
     <result column="duration" jdbcType="INTEGER" property="duration" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, schedule_id, start_time, duration
+    id, schedule_id, intake_id, start_time, duration
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -27,10 +28,10 @@
   </delete>
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule">
     <!--@mbg.generated-->
-    insert into ir_opening_schedule (id, schedule_id, start_time, 
-      duration)
-    values (#{id,jdbcType=BIGINT}, #{scheduleId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, 
-      #{duration,jdbcType=INTEGER})
+    insert into ir_opening_schedule (id, schedule_id, intake_id, 
+      start_time, duration)
+    values (#{id,jdbcType=BIGINT}, #{scheduleId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, 
+      #{startTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule">
     <!--@mbg.generated-->
@@ -41,6 +42,9 @@
       </if>
       <if test="scheduleId != null">
         schedule_id,
+      </if>
+      <if test="intakeId != null">
+        intake_id,
       </if>
       <if test="startTime != null">
         start_time,
@@ -55,6 +59,9 @@
       </if>
       <if test="scheduleId != null">
         #{scheduleId,jdbcType=BIGINT},
+      </if>
+      <if test="intakeId != null">
+        #{intakeId,jdbcType=BIGINT},
       </if>
       <if test="startTime != null">
         #{startTime,jdbcType=TIMESTAMP},
@@ -71,6 +78,9 @@
       <if test="scheduleId != null">
         schedule_id = #{scheduleId,jdbcType=BIGINT},
       </if>
+      <if test="intakeId != null">
+        intake_id = #{intakeId,jdbcType=BIGINT},
+      </if>
       <if test="startTime != null">
         start_time = #{startTime,jdbcType=TIMESTAMP},
       </if>
@@ -84,6 +94,7 @@
     <!--@mbg.generated-->
     update ir_opening_schedule
     set schedule_id = #{scheduleId,jdbcType=BIGINT},
+      intake_id = #{intakeId,jdbcType=BIGINT},
       start_time = #{startTime,jdbcType=TIMESTAMP},
       duration = #{duration,jdbcType=INTEGER}
     where id = #{id,jdbcType=BIGINT}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanOperateMapper.xml
new file mode 100644
index 0000000..f7d1670
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrPlanOperateMapper.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dy.pipIrrGlobal.daoIr.IrPlanOperateMapper">
+  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrPlanOperate">
+    <!--@mbg.generated-->
+    <!--@Table ir_plan_operate-->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="plan_id" jdbcType="BIGINT" property="planId" />
+    <result column="operator" jdbcType="BIGINT" property="operator" />
+    <result column="operate_type" jdbcType="TINYINT" property="operateType" />
+    <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id, plan_id, `operator`, operate_type, operate_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <!--@mbg.generated-->
+    select 
+    <include refid="Base_Column_List" />
+    from ir_plan_operate
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--@mbg.generated-->
+    delete from ir_plan_operate
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanOperate">
+    <!--@mbg.generated-->
+    insert into ir_plan_operate (id, plan_id, `operator`, 
+      operate_type, operate_time)
+    values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{operator,jdbcType=BIGINT}, 
+      #{operateType,jdbcType=TINYINT}, #{operateTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanOperate">
+    <!--@mbg.generated-->
+    insert into ir_plan_operate
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="planId != null">
+        plan_id,
+      </if>
+      <if test="operator != null">
+        `operator`,
+      </if>
+      <if test="operateType != null">
+        operate_type,
+      </if>
+      <if test="operateTime != null">
+        operate_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="planId != null">
+        #{planId,jdbcType=BIGINT},
+      </if>
+      <if test="operator != null">
+        #{operator,jdbcType=BIGINT},
+      </if>
+      <if test="operateType != null">
+        #{operateType,jdbcType=TINYINT},
+      </if>
+      <if test="operateTime != null">
+        #{operateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanOperate">
+    <!--@mbg.generated-->
+    update ir_plan_operate
+    <set>
+      <if test="planId != null">
+        plan_id = #{planId,jdbcType=BIGINT},
+      </if>
+      <if test="operator != null">
+        `operator` = #{operator,jdbcType=BIGINT},
+      </if>
+      <if test="operateType != null">
+        operate_type = #{operateType,jdbcType=TINYINT},
+      </if>
+      <if test="operateTime != null">
+        operate_time = #{operateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrPlanOperate">
+    <!--@mbg.generated-->
+    update ir_plan_operate
+    set plan_id = #{planId,jdbcType=BIGINT},
+      `operator` = #{operator,jdbcType=BIGINT},
+      operate_type = #{operateType,jdbcType=TINYINT},
+      operate_time = #{operateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateQueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateQueryVo.java
index 3609963..4a405f4 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateQueryVo.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateQueryVo.java
@@ -6,8 +6,6 @@
 import lombok.*;
 import org.springframework.format.annotation.DateTimeFormat;
 
-import java.util.Date;
-
 /**
  * @author :WuZeYu
  * @Date :2024/7/22  20:01
@@ -35,13 +33,22 @@
     @Schema(description = "寮�濮嬫椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date startDt;
+    private String startDt;
 
     @Schema(description = "缁撴潫鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date endDt;
+    private String endDt;
 
     @Schema(description = "鎶ヨ鐘舵��", requiredMode = Schema.RequiredMode.NOT_REQUIRED)//锛�0姝e父銆�1鎶ヨ锛�
     private Byte alarmState;
+
+    public void completionTime(){
+        if(this.startDt != null && !this.startDt.trim().equals("")) {
+            this.startDt = startDt + " 00:00:00";
+        }
+        if(this.endDt != null && !this.endDt.trim().equals("")) {
+            this.endDt = endDt + " 23:59:59";
+        }
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateSv.java
index 8f44dfe..7f5862a 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/records/controllerAlarmState/ControllerAlarmStateSv.java
@@ -35,7 +35,7 @@
      * @return
      */
     public QueryResultVo<List<VoControllerAlarmState>> getControllerAlarmStateHistory(ControllerAlarmStateQueryVo vo) {
-
+        vo.completionTime();
         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo);
 
         Long itemTotal = rmAlarmStateHistoryMapper.getRecordCount(params);
@@ -54,6 +54,7 @@
      * @return
      */
     public QueryResultVo<List<VoControllerAlarmState>> getOneControllerAlarmStateHistory(ControllerAlarmStateQueryVo vo) {
+        vo.completionTime();
         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo);
 
         Long itemTotal = rmAlarmStateHistoryMapper.getRecordCount(params);
@@ -74,7 +75,7 @@
      * @return
      */
     public QueryResultVo<List<VoControllerAlarmState>> getControllerAlarmStateLast(ControllerAlarmStateQueryVo vo) {
-
+        vo.completionTime();
         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo);
 
         Long itemTotal = rmAlarmStateLastMapper.getRecordCount(params);
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java
index ed15346..246fb29 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java
@@ -4,8 +4,13 @@
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan;
 import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule;
+import com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule;
+import com.dy.pipIrrGlobal.pojoIr.IrPlanOperate;
+import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule;
 import com.dy.pipIrrWechat.irrigatePlan.dto.IrrigatePlan;
 import com.dy.pipIrrWechat.irrigatePlan.dto.IrrigateSchedule;
+import com.dy.pipIrrWechat.irrigatePlan.dto.PlanSimple;
+import com.dy.pipIrrWechat.irrigatePlan.enums.OperateTypeENUM;
 import jakarta.validation.Valid;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -17,6 +22,7 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -34,6 +40,15 @@
 public class IrrigatePlanCtrl {
     private final IrrigatePlanSv irrigatePlanSv;
 
+    /**
+     * 鍒涘缓鐏屾簤璁″垝
+     * 1. 娣诲姞鐏屾簤璁″垝
+     * 2. 娣诲姞鐏屾簤娆″簭
+     * 3. 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
+     * @param planAndSchedule
+     * @param bindingResult
+     * @return
+     */
     @PostMapping(path = "createPlan", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     public BaseResponse<Boolean> createPlan(@RequestBody @Valid IrrigatePlan planAndSchedule, BindingResult bindingResult){
@@ -41,6 +56,9 @@
             return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
+        Long operatorId = planAndSchedule.getOperatorId();
+
+        // 娣诲姞鐏屾簤璁″垝
         IrIrrigatePlan plan = new IrIrrigatePlan();
         plan.setProjectId(planAndSchedule.getProjectId());
         plan.setPlanName(planAndSchedule.getPlanName());
@@ -52,6 +70,11 @@
         plan.setDeleted(0L);
 
         Long planId = irrigatePlanSv.addIrrigatePlan(plan);
+        if(planId == null) {
+            return BaseResponseUtils.buildErrorMsg("鍒涘缓鐏屾簤璁″垝澶辫触");
+        }
+
+        // 娣诲姞鐏屾簤娆″簭
         if(planId != null){
             for(IrrigateSchedule schedule : planAndSchedule.getSchedules()){
                 IrIrrigateSchedule po = new IrIrrigateSchedule();
@@ -77,13 +100,75 @@
 
                 po.setStartTime(schedule.getStartTime());
                 po.setStopTime(schedule.getStopTime());
-                //po.setIntakeIds(schedule.getIntakeIds());
                 po.setCurrentState((byte)1);
                 Long scheduleId = irrigatePlanSv.addIrrigateSchedule(po);
             }
         }
 
+        // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
+        IrPlanOperate planOperate  = new IrPlanOperate();
+        planOperate.setPlanId(planId);
+        planOperate.setOperator(operatorId);
+        planOperate.setOperateType(OperateTypeENUM.CREATE.getCode());
+        planOperate.setOperateTime(new Date());
+        if(irrigatePlanSv.addPlanOperate(planOperate) == 0){
+            return BaseResponseUtils.buildErrorMsg("娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍澶辫触");
+        }
 
         return BaseResponseUtils.buildSuccess();
     }
+
+    /**
+     * 鍙戝竷鐏屾簤璁″垝
+     * 1. 淇敼鐏屾簤璁″垝鐘舵�佷负鍙戝竷鐘舵��
+     * 2. 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
+     * 3. 鐢熸垚寮�闃�璁″垝
+     * @param planSimple
+     * @param bindingResult
+     * @return
+     */
+    @PostMapping(path = "publishPlan", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    public BaseResponse<Boolean> publishPlan(@RequestBody @Valid PlanSimple planSimple, BindingResult bindingResult){
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        Long planId = planSimple.getPlanId();
+        Long operatorId = planSimple.getOperatorId();
+
+        // 淇敼鐏屾簤璁″垝鐘舵�佷负鍙戝竷鐘舵��
+        if(irrigatePlanSv.publishIrrigatePlan(planId) == 0){
+            return BaseResponseUtils.buildErrorMsg("淇敼鐏屾簤璁″垝鐘舵�佸け璐�");
+        }
+
+        // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
+        IrPlanOperate planOperate  = new IrPlanOperate();
+        planOperate.setPlanId(planId);
+        planOperate.setOperator(operatorId);
+        planOperate.setOperateType(OperateTypeENUM.PUBLISH.getCode());
+        planOperate.setOperateTime(new Date());
+        if(irrigatePlanSv.addPlanOperate(planOperate) == 0){
+            return BaseResponseUtils.buildErrorMsg("娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍澶辫触");
+        }
+
+        // 鐢熸垚寮�闃�璁″垝
+        List<VoIrrigateSchedule> schedules = irrigatePlanSv.getIrrigateSchedules(planId);
+        if(schedules == null || schedules.size() == 0) {
+            return BaseResponseUtils.buildErrorMsg("鏃犲彇姘村彛锛岀敓鎴愬紑闃�璁″垝澶辫触");
+        }
+        for (VoIrrigateSchedule schedule : schedules) {
+            for(String intakeId : schedule.getIntakeIds().split(",")){
+                // 娣诲姞鐏屾簤璁″垝寮�鍚褰�
+                IrOpeningSchedule openingSchedule = new IrOpeningSchedule();
+                openingSchedule.setScheduleId(schedule.getScheduleId());
+                openingSchedule.setIntakeId(Long.parseLong(intakeId));
+                openingSchedule.setStartTime(schedule.getStartTime());
+                openingSchedule.setDuration(schedule.getDuration());
+                if(irrigatePlanSv.addOpeningSchedule(openingSchedule) == 0){
+                    return BaseResponseUtils.buildErrorMsg("娣诲姞寮�闃�璁″垝澶辫触");
+                }
+            }
+        }
+        return BaseResponseUtils.buildSuccess();
+    }
 }
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 e123311..c0875cf 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
@@ -1,11 +1,11 @@
 package com.dy.pipIrrWechat.irrigatePlan;
 
-import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper;
-import com.dy.pipIrrGlobal.daoIr.IrIrrigatePlanMapper;
-import com.dy.pipIrrGlobal.daoIr.IrIrrigateScheduleMapper;
-import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper;
+import com.dy.pipIrrGlobal.daoIr.*;
 import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan;
 import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule;
+import com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule;
+import com.dy.pipIrrGlobal.pojoIr.IrPlanOperate;
+import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -26,7 +26,13 @@
     private IrIrrigatePlanMapper irrigatePlanMapper;
 
     @Autowired
+    private IrPlanOperateMapper irPlanOperateMapper;
+
+    @Autowired
     private IrIrrigateScheduleMapper irIrrigateScheduleMapper;
+
+    @Autowired
+    private IrOpeningScheduleMapper irOpeningScheduleMapper;
 
     @Autowired
     private IrIrrigateGroupMapper irIrrigateGroupMapper;
@@ -35,12 +41,31 @@
     private IrIrrigateUnitMapper irIrrigateUnitMapper;
 
     /**
-     * 娣诲姞鐏屾簤璁″垝璁板綍
+     * 娣诲姞鐏屾簤璁″垝
      * @param po
      * @return
      */
     public Long addIrrigatePlan(IrIrrigatePlan po) {
         irrigatePlanMapper.insert(po);
+        return po.getId();
+    }
+
+    /**
+     * 鍙戝竷鎸囧畾鐨勭亴婧夎鍒�
+     * @param planId
+     * @return
+     */
+    public Integer publishIrrigatePlan(Long planId) {
+        return irrigatePlanMapper.publishIrrigatePlan(planId);
+    }
+
+    /**
+     * 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
+     * @param po
+     * @return
+     */
+    public Long addPlanOperate(IrPlanOperate po) {
+        irPlanOperateMapper.insert(po);
         return po.getId();
     }
 
@@ -55,6 +80,25 @@
     }
 
     /**
+     * 鏍规嵁璁″垝ID鑾峰彇鐏屾簤娆″簭
+     * @param planId
+     * @return
+     */
+    public List<VoIrrigateSchedule> getIrrigateSchedules(Long planId) {
+        return irIrrigateScheduleMapper.getIrrigateSchedules(planId);
+    }
+
+    /**
+     * 娣诲姞寮�闃�璁″垝
+     * @param po
+     * @return
+     */
+    public Long addOpeningSchedule(IrOpeningSchedule po) {
+        irOpeningScheduleMapper.insert(po);
+        return po.getId();
+    }
+
+    /**
      * 鏍规嵁杞亴缁処D鑾峰彇鍙栨按鍙D鍒楄〃
      * @param groupId
      * @return
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java
index 55c7d07..e5d5c79 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/IrrigatePlan.java
@@ -57,4 +57,10 @@
      */
     @NotEmpty(message = "宸℃杞ㄨ抗涓嶈兘涓虹┖")
     private List<IrrigateSchedule> schedules;
+
+    /**
+     * 鎿嶄綔浜篒D
+     */
+    @NotNull(message = "鎿嶄綔浜篒D涓嶈兘涓虹┖")
+    private Long operatorId;
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/PlanSimple.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/PlanSimple.java
new file mode 100644
index 0000000..f46389f
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/dto/PlanSimple.java
@@ -0,0 +1,28 @@
+package com.dy.pipIrrWechat.irrigatePlan.dto;
+
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2025-02-21 13:59
+ * @LastEditTime 2025-02-21 13:59
+ * @Description 鐏屾簤璁″垝绠�鍗曞璞�
+ */
+
+@Data
+public class PlanSimple {
+    public static final long serialVersionUID = 202502211400001L;
+
+    /**
+     * 鐏屾簤璁″垝
+     */
+    @NotNull(message = "璁″垝ID涓嶈兘涓虹┖")
+    private Long planId;
+
+    /**
+     * 鎿嶄綔浜篒D
+     */
+    @NotNull(message = "鎿嶄綔浜篒D涓嶈兘涓虹┖")
+    private Long operatorId;
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/enums/OperateTypeENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/enums/OperateTypeENUM.java
new file mode 100644
index 0000000..c3b8965
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/enums/OperateTypeENUM.java
@@ -0,0 +1,25 @@
+package com.dy.pipIrrWechat.irrigatePlan.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2025-02-21 15:32
+ * @LastEditTime 2025-02-21 15:32
+ * @Description 鐏屾簤璁″垝鎿嶄綔绫诲瀷鏋氫妇
+ * @Version 1.0
+ */
+
+@Getter
+@AllArgsConstructor
+public enum OperateTypeENUM {
+    CREATE((byte)1, "鍒涘缓"),
+    PUBLISH((byte)2, "鍙戝竷"),
+    EXECUTE((byte)3, "鎵ц"),
+    SUSPEND((byte)4, "鏆傚仠"),
+    TERMINATE((byte)5, "缁堟");
+
+    private final Byte code;
+    private final String message;
+}

--
Gitblit v1.8.0