From e56e937f0b78152cc607ade75b3a0e1b2c1c2c4c Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期六, 07 十一月 2026 14:40:10 +0800
Subject: [PATCH] fix: 完成时状态与超时判断区分任务组

---
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskPreachformMapper.xml |   81 +++++++++++++++++++++++++++++-----------
 1 files changed, 58 insertions(+), 23 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskPreachformMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskPreachformMapper.xml
index be414c3..e63538f 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskPreachformMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskPreachformMapper.xml
@@ -19,6 +19,7 @@
         <result property="updateBy" column="update_by"/>
         <result property="sort" column="sort"/>
         <result property="compensateTime" column="compensate_time"/>
+        <result property="currentSendTime" column="current_send_time"/>
     </resultMap>
 
     <sql id="selectServiceSubtaskPreachformVo">
@@ -27,6 +28,7 @@
                taskid,
                preachform,
                sendstate,
+               current_send_time,
                remark,
                orgid,
                del_flag,
@@ -43,28 +45,31 @@
             resultMap="ServiceSubtaskPreachformResult">
         <include refid="selectServiceSubtaskPreachformVo"/>
         where 1=1
-            and del_flag = 0
-            <if test="subid != null ">
-                and subid = #{subid}
-            </if>
-            <if test="taskid != null ">
-                and taskid = #{taskid}
-            </if>
-            <if test="preachform != null  and preachform != ''">
-                and preachform = #{preachform}
-            </if>
-            <if test="sendstate != null  and sendstate != ''">
-                and sendstate = #{sendstate}
-            </if>
-            <if test="orgid != null  and orgid != ''">
-                and orgid = #{orgid}
-            </if>
-            <if test="sort != null ">
-                and sort = #{sort}
-            </if>
-            <if test="compensateTime != null ">
-                and compensate_time = #{compensateTime}
-            </if>
+        and del_flag = 0
+        <if test="subid != null ">
+            and subid = #{subid}
+        </if>
+        <if test="taskid != null ">
+            and taskid = #{taskid}
+        </if>
+        <if test="currentSendTime != null ">
+            and current_send_time = #{currentSendTime}
+        </if>
+        <if test="preachform != null  and preachform != ''">
+            and preachform = #{preachform}
+        </if>
+        <if test="sendstate != null  and sendstate != ''">
+            and sendstate = #{sendstate}
+        </if>
+        <if test="orgid != null  and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        <if test="sort != null ">
+            and sort = #{sort}
+        </if>
+        <if test="compensateTime != null ">
+            and compensate_time = #{compensateTime}
+        </if>
     </select>
 
     <select id="selectServiceSubtaskPreachformById" parameterType="Long"
@@ -106,6 +111,9 @@
             </if>
             <if test="compensateTime != null">compensate_time,
             </if>
+            <if test="currentSendTime != null ">
+                current_send_time,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},
@@ -135,6 +143,9 @@
             <if test="sort != null">#{sort},
             </if>
             <if test="compensateTime != null">#{compensateTime},
+            </if>
+            <if test="currentSendTime != null ">
+                #{currentSendTime},
             </if>
         </trim>
     </insert>
@@ -180,6 +191,9 @@
             </if>
             <if test="compensateTime != null">compensate_time =
                 #{compensateTime},
+            </if>
+            <if test="currentSendTime != null ">
+                current_send_time = #{currentSendTime},
             </if>
         </trim>
         where id = #{id}
@@ -227,6 +241,9 @@
             <if test="compensateTime != null">compensate_time =
                 #{compensateTime},
             </if>
+            <if test="currentSendTime != null ">
+                current_send_time = #{currentSendTime},
+            </if>
         </trim>
         where 1=1
             <if test="subid != null">and subid =
@@ -244,6 +261,23 @@
             <if test="orgid != null">and orgid =
                 #{orgid}
             </if>
+    </update>
+
+    <!-- 寰俊鍏紬鍙峰凡棰嗗彇鏈~鍐欐寜榛樿閫夐」瀹屾垚锛氫粎鏇存柊褰撳墠瀛愪换鍔$殑褰撳墠鍏紬鍙疯銆�
+         鍙厑璁镐粠宸插彂閫�(2)/宸查鍙�(3)杩佺Щ鍒板畬鎴�(9)锛岄伩鍏嶅苟鍙戞垨閲嶅琛ュ伩瑕嗙洊鍏朵粬鐘舵�併�� -->
+    <update id="updateWechatPreachformComplete" parameterType="com.smartor.domain.ServiceSubtaskPreachform">
+        update service_subtask_preachform
+        set sendstate = '9',
+            remark = case
+                         when remark is null or remark = '' then #{remark}
+                         else concat(remark, ',', #{remark})
+                     end,
+            update_time = now()
+        where id = #{id}
+          and subid = #{subid}
+          and orgid = #{orgid}
+          and preachform = #{preachform}
+          and sendstate in ('2', '3')
     </update>
 
 
@@ -274,7 +308,8 @@
         </foreach>
     </update>
 
-    <select id="selectBySubtask" parameterType="com.smartor.domain.ServiceSubtask" resultMap="ServiceSubtaskPreachformResult">
+    <select id="selectBySubtask" parameterType="com.smartor.domain.ServiceSubtask"
+            resultMap="ServiceSubtaskPreachformResult">
         <include refid="selectServiceSubtaskPreachformVo"/>
         WHERE del_flag = 0
         <!-- 鍏朵粬鏉′欢 -->

--
Gitblit v1.9.3