Jelajahi Sumber

超时工单改为用updatetime比较

HD_wangm 4 bulan lalu
induk
melakukan
74d238fbf9

+ 6 - 7
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/mobile/GxtMobileOrderController.java

@@ -91,10 +91,10 @@ public class GxtMobileOrderController extends BaseController
             // 只处理维保工单(orderType == 2)
             if (order.getOrderType() == 2) {
                 // accept_time为空,并且当前时间超过assign_time
-                if (order.getAcceptTime() == null && order.getAssignTime() != null && 
-                    now.after(order.getAssignTime())) {
+                if (order.getAcceptTime() == null && order.getUpdateTime() != null &&
+                    now.after(order.getUpdateTime())) {
                     // 计算超过的时间(按分钟计算)
-                    long diffInMillis = now.getTime() - order.getAssignTime().getTime();
+                    long diffInMillis = now.getTime() - order.getUpdateTime().getTime();
                     long diffInMinutes = TimeUnit.MINUTES.convert(diffInMillis, TimeUnit.MILLISECONDS);
                     
                     // 计算超时时间并格式化为X天X小时X分钟格式
@@ -117,11 +117,10 @@ public class GxtMobileOrderController extends BaseController
             }
             // 维修工单的超时逻辑
             else if (order.getOrderType() == 1) {
-                // 对于维修工单,同样检查accept_time为空且当前时间超过assign_time
-                if (order.getAcceptTime() == null && order.getAssignTime() != null && 
-                    now.after(order.getAssignTime())) {
+                // 对于维修工单,同样当前时间超过update_time
+                if (order.getUpdateTime() != null && now.after(order.getUpdateTime())) {
                     // 计算超过的时间(按分钟计算)
-                    long diffInMillis = now.getTime() - order.getAssignTime().getTime();
+                    long diffInMillis = now.getTime() - order.getUpdateTime().getTime();
                     long diffInMinutes = TimeUnit.MINUTES.convert(diffInMillis, TimeUnit.MILLISECONDS);
                     
                     // 计算超时时间并格式化为X天X小时X分钟格式

+ 1 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtRepairOrderServiceImpl.java

@@ -231,6 +231,7 @@ public class GxtRepairOrderServiceImpl implements IGxtRepairOrderService
         gxtRepairOrder.setOrderType(1L);
         gxtRepairOrder.setCreateBy(SecurityUtils.getUsername());
         gxtRepairOrder.setCreateTime(DateUtils.getNowDate());
+        gxtRepairOrder.setUpdateTime(DateUtils.getNowDate());
         int result = gxtRepairOrderMapper.insertGxtRepairOrder(gxtRepairOrder);
 
         // 记录工单创建流转信息

+ 4 - 4
ygtx-gxt/src/main/resources/mapper/gxt/GxtOrderScoreMapper.xml

@@ -308,8 +308,8 @@
             <!-- 超时工单条件:accept_time为空,并且当前时间超过assign_time并且超过时间大于配置值 -->
             <if test="repairOrder.params.overdueCondition != null and repairOrder.params.overdueCondition == 'overdue'">
                 and work_order_status = 'assigned'
-                and assign_time &lt; NOW()
-                and TIMESTAMPDIFF(MINUTE, assign_time, NOW()) > (
+                and update_time &lt; NOW()
+                and TIMESTAMPDIFF(MINUTE, update_time, NOW()) > (
                 SELECT config_value FROM sys_config WHERE config_key = 'gxt.order.timeout' LIMIT 1
                 )
             </if>
@@ -404,8 +404,8 @@
             <!-- 超时工单条件:accept_time为空,并且当前时间超过assign_time并且超过时间大于配置值 -->
             <if test="workOrder.params.overdueCondition != null and workOrder.params.overdueCondition == 'overdue'">
                 and work_order_status = 'assigned'
-                and assign_time &lt; NOW()
-                and TIMESTAMPDIFF(MINUTE, assign_time, NOW()) > (
+                and update_time &lt; NOW()
+                and TIMESTAMPDIFF(MINUTE, update_time, NOW()) > (
                 SELECT config_value FROM sys_config WHERE config_key = 'gxt.order.timeout' LIMIT 1
                 )
             </if>

+ 1 - 1
ygtx-gxt/src/main/resources/mapper/gxt/GxtRepairOrderMapper.xml

@@ -198,7 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="resetMethod != null  and resetMethod != ''"> and reset_method = #{resetMethod}</if>
             <if test="returnType != null  and returnType != ''"> and return_type = #{returnType}</if>
             <if test="returnReason != null  and returnReason != ''"> and return_reason = #{returnReason}</if>
-            <if test="outTimeParam != null"> and DATE_SUB(NOW(), INTERVAL #{outTimeParam} MINUTE) > assign_time </if>
+            <if test="outTimeParam != null"> and DATE_SUB(NOW(), INTERVAL #{outTimeParam} MINUTE) > t.update_time </if>
             <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
             <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
             <if test="workArea != null  and workArea != ''"> and work_area = #{workArea}</if>