From fc689e363c86d16eb35ae87830612ce35ab3239e Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 02 四月 2025 11:37:56 +0800
Subject: [PATCH] 解决小程序立即开阀的bug

---
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java                  |    4 +-
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java                           |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java             |    4 +
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java                       |   10 +++++
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java             |    2 
 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java |    2 
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml                                 |   41 ++++++++++++++++----
 7 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
index d73733d..e9e1581 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
@@ -369,7 +369,7 @@
                 rmCommandHistory.setResult((byte) 0);
                 rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory);
 
-                if(openType == 1 ) {
+                if(openType != null && openType == 1 ) {
                     irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "寮�闃�澶辫触");
                 }
 
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java
index 2241e34..f0b4201 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrIntakeOperateMapper.java
@@ -7,8 +7,8 @@
 
 /**
  * @author ZhuBaoMin
- * @date 2025-03-25 20:41
- * @LastEditTime 2025-03-25 20:41
+ * @date 2025-04-02 10:54
+ * @LastEditTime 2025-04-02 10:54
  * @Description
  */
 
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java
index d3d39a0..3c63490 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrIntakeOperate.java
@@ -35,6 +35,16 @@
     private Long id;
 
     /**
+     * 璁″垝ID
+     */
+    private Long planId;
+
+    /**
+     * 鎿嶄綔绫诲瀷;1-鍙戝竷锛堣鍒掑紑闃�锛夛紝2-缁堟锛堣繙绋嬪叧闃�锛�
+     */
+    private Byte operateType;
+
+    /**
      * 鍛戒护ID
      */
     @NotNull(message = "鍛戒护ID涓嶈兘涓虹┖")
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml
index a578e97..ab8bc1a 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrIntakeOperateMapper.xml
@@ -5,6 +5,8 @@
     <!--@mbg.generated-->
     <!--@Table ir_intake_operate-->
     <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="plan_id" jdbcType="BIGINT" property="planId" />
+    <result column="operate_type" jdbcType="TINYINT" property="operateType" />
     <result column="command_id" jdbcType="BIGINT" property="commandId" />
     <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
     <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
@@ -14,7 +16,8 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, command_id, intake_id, start_time, duration, command_result, failure_factors
+    id, plan_id, operate_type, command_id, intake_id, start_time, duration, command_result, 
+    failure_factors
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -30,12 +33,14 @@
   </delete>
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate">
     <!--@mbg.generated-->
-    insert into ir_intake_operate (id, command_id, intake_id, 
-      start_time, duration, command_result, 
-      failure_factors)
-    values (#{id,jdbcType=BIGINT}, #{commandId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, 
-      #{startTime,jdbcType=TIMESTAMP}, #{duration,jdbcType=INTEGER}, #{commandResult,jdbcType=TINYINT}, 
-      #{failureFactors,jdbcType=VARCHAR})
+    insert into ir_intake_operate (id, plan_id, operate_type, 
+      command_id, intake_id, start_time, 
+      duration, command_result, failure_factors
+      )
+    values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{operateType,jdbcType=TINYINT}, 
+      #{commandId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, 
+      #{duration,jdbcType=INTEGER}, #{commandResult,jdbcType=TINYINT}, #{failureFactors,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate">
     <!--@mbg.generated-->
@@ -43,6 +48,12 @@
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="id != null">
         id,
+      </if>
+      <if test="planId != null">
+        plan_id,
+      </if>
+      <if test="operateType != null">
+        operate_type,
       </if>
       <if test="commandId != null">
         command_id,
@@ -66,6 +77,12 @@
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
         #{id,jdbcType=BIGINT},
+      </if>
+      <if test="planId != null">
+        #{planId,jdbcType=BIGINT},
+      </if>
+      <if test="operateType != null">
+        #{operateType,jdbcType=TINYINT},
       </if>
       <if test="commandId != null">
         #{commandId,jdbcType=BIGINT},
@@ -91,6 +108,12 @@
     <!--@mbg.generated-->
     update ir_intake_operate
     <set>
+      <if test="planId != null">
+        plan_id = #{planId,jdbcType=BIGINT},
+      </if>
+      <if test="operateType != null">
+        operate_type = #{operateType,jdbcType=TINYINT},
+      </if>
       <if test="commandId != null">
         command_id = #{commandId,jdbcType=BIGINT},
       </if>
@@ -115,7 +138,9 @@
   <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate">
     <!--@mbg.generated-->
     update ir_intake_operate
-    set command_id = #{commandId,jdbcType=BIGINT},
+    set plan_id = #{planId,jdbcType=BIGINT},
+      operate_type = #{operateType,jdbcType=TINYINT},
+      command_id = #{commandId,jdbcType=BIGINT},
       intake_id = #{intakeId,jdbcType=BIGINT},
       start_time = #{startTime,jdbcType=TIMESTAMP},
       duration = #{duration,jdbcType=INTEGER},
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
index 38b60b2..eb887a1 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java
@@ -250,7 +250,7 @@
      * @param automaticClose
      * @return
      */
-    public Map planedOpenTimedClose(AutomaticClose automaticClose, Date startTime, Integer duration) {
+    public Map planedOpenTimedClose(AutomaticClose automaticClose, Long planId, Date startTime, Integer duration) {
         Long intakeId = automaticClose.getIntakeId();
         Long vcId = automaticClose.getVcId();
         Date plannedOpenTime = automaticClose.getPlannedOpenTime();
@@ -261,6 +261,8 @@
 
         if(openType == 1) {
             IrIntakeOperate irIntakeOperate = new IrIntakeOperate();
+            irIntakeOperate.setPlanId(planId);
+            irIntakeOperate.setOperateType((byte)1);
             irIntakeOperate.setCommandId(comId);
             irIntakeOperate.setIntakeId(intakeId);
             irIntakeOperate.setStartTime(startTime);
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
index 2dc85c6..74f1502 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
@@ -538,7 +538,7 @@
             return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
-        Map map_result = commandSv.planedOpenTimedClose(automaticClose, null,null);
+        Map map_result = commandSv.planedOpenTimedClose(automaticClose, null, null,null);
         if(map_result.get("success").equals(false)) {
             return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
         }
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 e60cbae..2d11845 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
@@ -273,7 +273,7 @@
                 automaticClose.setOperator(operatorId);
                 automaticClose.setOpenType(Byte.valueOf("1"));
 
-                commandSv.planedOpenTimedClose(automaticClose, schedule.getStartTime(), schedule.getDuration());
+                commandSv.planedOpenTimedClose(automaticClose, planId, schedule.getStartTime(), schedule.getDuration());
             }
         }
 

--
Gitblit v1.8.0