Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  |     int updateByPrimaryKeySelective(IrIrrigatePlan record); | 
 |  |  |  | 
 |  |  |     int updateByPrimaryKey(IrIrrigatePlan record); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 发布指定的灌溉计划 | 
 |  |  |      * @param planId | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     int publishIrrigatePlan(Long planId); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  | 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 | 
 |  |  | 
 |  |  |     int updateByPrimaryKeySelective(IrIrrigateSchedule record); | 
 |  |  |  | 
 |  |  |     int updateByPrimaryKey(IrIrrigateSchedule record); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据计划ID获取灌溉次序 | 
 |  |  |      * @param planId | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     List<VoIrrigateSchedule> getIrrigateSchedules(Long planId); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @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); | 
 
| New file | 
 |  |  | 
 |  |  | 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); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     private Long scheduleId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 取水口ID | 
 |  |  |      */ | 
 |  |  |     @NotNull(message = "取水口ID不能为空") | 
 |  |  |     private Long intakeId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |     * 开阀时间 | 
 |  |  |     */ | 
 |  |  |     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 
 
| New file | 
 |  |  | 
 |  |  | 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; | 
 |  |  |  | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | 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; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 取水口ID,多个用逗号隔开 | 
 |  |  |      */ | 
 |  |  |     private String intakeIds; | 
 |  |  | } | 
 
 |  |  | 
 |  |  |       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> | 
 
 |  |  | 
 |  |  |       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> | 
 
 |  |  | 
 |  |  |     <!--@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--> | 
 |  |  | 
 |  |  |   </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--> | 
 |  |  | 
 |  |  |       </if> | 
 |  |  |       <if test="scheduleId != null"> | 
 |  |  |         schedule_id, | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeId != null"> | 
 |  |  |         intake_id, | 
 |  |  |       </if> | 
 |  |  |       <if test="startTime != null"> | 
 |  |  |         start_time, | 
 |  |  | 
 |  |  |       </if> | 
 |  |  |       <if test="scheduleId != null"> | 
 |  |  |         #{scheduleId,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="intakeId != null"> | 
 |  |  |         #{intakeId,jdbcType=BIGINT}, | 
 |  |  |       </if> | 
 |  |  |       <if test="startTime != null"> | 
 |  |  |         #{startTime,jdbcType=TIMESTAMP}, | 
 |  |  | 
 |  |  |       <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> | 
 |  |  | 
 |  |  |     <!--@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} | 
 
| New file | 
 |  |  | 
 |  |  | <?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> | 
 
 |  |  | 
 |  |  | import lombok.*; | 
 |  |  | import org.springframework.format.annotation.DateTimeFormat; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author :WuZeYu | 
 |  |  |  * @Date :2024/7/22  20:01 | 
 |  |  | 
 |  |  |     @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正常、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"; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |      * @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); | 
 |  |  | 
 |  |  |      * @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); | 
 |  |  | 
 |  |  |      * @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); | 
 
 |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  | 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; | 
 |  |  |  | 
 |  |  | 
 |  |  | 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){ | 
 |  |  | 
 |  |  |             return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Long operatorId = planAndSchedule.getOperatorId(); | 
 |  |  |  | 
 |  |  |         // 添加灌溉计划 | 
 |  |  |         IrIrrigatePlan plan = new IrIrrigatePlan(); | 
 |  |  |         plan.setProjectId(planAndSchedule.getProjectId()); | 
 |  |  |         plan.setPlanName(planAndSchedule.getPlanName()); | 
 |  |  | 
 |  |  |         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(); | 
 |  |  | 
 |  |  |  | 
 |  |  |                 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(); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  |     private IrIrrigatePlanMapper irrigatePlanMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IrPlanOperateMapper irPlanOperateMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IrIrrigateScheduleMapper irIrrigateScheduleMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IrOpeningScheduleMapper irOpeningScheduleMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IrIrrigateGroupMapper irIrrigateGroupMapper; | 
 |  |  | 
 |  |  |     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(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据计划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(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据轮灌组ID获取取水口ID列表 | 
 |  |  |      * @param groupId | 
 |  |  |      * @return | 
 
 |  |  | 
 |  |  |      */ | 
 |  |  |     @NotEmpty(message = "巡检轨迹不能为空") | 
 |  |  |     private List<IrrigateSchedule> schedules; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 操作人ID | 
 |  |  |      */ | 
 |  |  |     @NotNull(message = "操作人ID不能为空") | 
 |  |  |     private Long operatorId; | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | 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; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 操作人ID | 
 |  |  |      */ | 
 |  |  |     @NotNull(message = "操作人ID不能为空") | 
 |  |  |     private Long operatorId; | 
 |  |  | } | 
 
| New file | 
 |  |  | 
 |  |  | 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; | 
 |  |  | } |