Browse Source

fixed: processType

xf 1 năm trước cách đây
mục cha
commit
660ccc40a2

+ 42 - 42
src/Hotline/FlowEngine/Workflows/Workflow.cs

@@ -258,26 +258,26 @@ public partial class Workflow : CreationEntity
 
     #endregion
 
-    /// <summary>
-    /// 处理方式(直办、交办)
-    /// </summary>
-    public EProcessType ProcessType { get; set; } = EProcessType.Zhiban;
-
-    /// <summary>
-    /// 交办时间(中心交部门办理时间)
-    /// </summary>
-    public DateTime? CenterToOrgTime { get; set; }
-
-    /// <summary>
-    /// 办结时长(分钟)
-    /// 办结时间-交办时间
-    /// </summary>
-    public double HandleDuration { get; set; }
-
-    /// <summary>
-    /// 办结工作日时长
-    /// </summary>
-    public double HandleDurationWorkday { get; set; }//todo
+    // /// <summary>
+    // /// 处理方式(直办、交办)
+    // /// </summary>
+    // public EProcessType ProcessType { get; set; } = EProcessType.Zhiban;
+    //
+    // /// <summary>
+    // /// 交办时间(中心交部门办理时间)
+    // /// </summary>
+    // public DateTime? CenterToOrgTime { get; set; }
+
+    // /// <summary>
+    // /// 办结时长(分钟)
+    // /// 办结时间-交办时间
+    // /// </summary>
+    // public double HandleDuration { get; set; }
+    //
+    // /// <summary>
+    // /// 办结工作日时长
+    // /// </summary>
+    // public double HandleDurationWorkday { get; set; }
 
     /// <summary>
     /// 全流程时长(分钟)
@@ -498,7 +498,7 @@ public partial class Workflow
             actualHandleOrgCode, actualHandleOrgName,
             actualHandleOrgAreaCode, actualHandleOrgAreaName);
 
-        SetHandleDuration();
+        //SetHandleDuration();
 
         //实际办理部门为一级部门时记录
         if (currentHandlerOrgLevel == 1)
@@ -761,19 +761,19 @@ public partial class Workflow
         OrgLevelOneName = orgName;
     }
 
-    public void CenterToOrg(DateTime expiredTime)
-    {
-        ProcessType = EProcessType.Jiaoban;
-        ExpiredTime = expiredTime;
-        CenterToOrgTime = DateTime.Now;
-    }
-
-    public void OrgToCenter(DateTime expiredTime)
-    {
-        ProcessType = EProcessType.Zhiban;
-        ExpiredTime = expiredTime;
-        CenterToOrgTime = null;
-    }
+    // public void CenterToOrg(DateTime expiredTime)
+    // {
+    //     ProcessType = EProcessType.Jiaoban;
+    //     ExpiredTime = expiredTime;
+    //     CenterToOrgTime = DateTime.Now;
+    // }
+    //
+    // public void OrgToCenter(DateTime expiredTime)
+    // {
+    //     ProcessType = EProcessType.Zhiban;
+    //     ExpiredTime = expiredTime;
+    //     CenterToOrgTime = null;
+    // }
 
     public void Redo()
     {
@@ -781,14 +781,14 @@ public partial class Workflow
         Status = EWorkflowStatus.Runnable;
     }
 
-    public void SetHandleDuration()
-    {
-        if (!ActualHandleTime.HasValue)
-            throw new ArgumentNullException($"{ActualHandleTime} is null");
-        if (!CenterToOrgTime.HasValue)
-            throw new ArgumentNullException($"{CenterToOrgTime} is null");
-        HandleDuration = Math.Round((ActualHandleTime - CenterToOrgTime).Value.TotalMinutes);
-    }
+    // public void SetHandleDuration()
+    // {
+    //     if (!ActualHandleTime.HasValue)
+    //         throw new ArgumentNullException($"{ActualHandleTime} is null");
+    //     if (!CenterToOrgTime.HasValue)
+    //         throw new ArgumentNullException($"{CenterToOrgTime} is null");
+    //     HandleDuration = Math.Round((ActualHandleTime - CenterToOrgTime).Value.TotalMinutes);
+    // }
 
     public void SetAllDuration()
     {

+ 2 - 2
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -77,7 +77,7 @@ namespace Hotline.FlowEngine.Workflows
                 Steps = new(),
                 Traces = new(),
                 WorkflowDefinition = definition,
-                CenterToOrgTime = DateTime.Now,
+                //CenterToOrgTime = DateTime.Now,
                 ExternalId = externalId ?? string.Empty,
                 FlowedOrgIds = new List<string> { userCode },
                 FlowedUserIds = new List<string> { userId },
@@ -734,7 +734,7 @@ namespace Hotline.FlowEngine.Workflows
             workflow.TimeLimit = timelimit;
             workflow.TimeLimitUnit = timelimitUnit;
             workflow.TimeLimitCount = timelimiteCount;
-            workflow.CenterToOrgTime = centerToOrgTime;
+            //workflow.CenterToOrgTime = centerToOrgTime;
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
         }
 

+ 1 - 9
src/Hotline/Orders/IOrderDomainService.cs

@@ -1,12 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Hotline.FlowEngine;
-using Hotline.Share.Dtos.Order;
-using Hotline.Share.Enums.Order;
-using XF.Domain.Entities;
+using Hotline.Share.Dtos.Order;
 
 namespace Hotline.Orders
 {

+ 10 - 3
src/Hotline/Orders/Order.cs

@@ -285,20 +285,17 @@ namespace Hotline.Orders
         /// 办结时长(分钟)
         /// 办结时间-交办时间
         /// </summary>
-        [SugarColumn(DefaultValue = "0")]
         public double HandleDuration { get; set; }
 
         /// <summary>
         /// 办结工作日时长
         /// </summary>
-        [SugarColumn(DefaultValue = "0")]
         public double HandleDurationWorkday { get; set; }
 
         /// <summary>
         /// 全流程时长(分钟)
         /// 归档时间-创建时间
         /// </summary>
-        [SugarColumn(DefaultValue = "0")]
         public double AllDuration { get; set; }
 
         /// <summary>
@@ -686,6 +683,9 @@ namespace Hotline.Orders
             if (Status is EOrderStatus.Filed) return;
             Status = EOrderStatus.Filed;
             FiledTime = DateTime.Now;
+            
+            //计算实际办结时长
+            SetHandleDuration();
         }
 
         /// <summary>
@@ -727,6 +727,13 @@ namespace Hotline.Orders
             ExpiredTime = expiredTime;
             CenterToOrgTime = null;
         }
+        
+        public void SetHandleDuration()
+        {
+            if (!ActualHandleTime.HasValue) return;
+            if (!CenterToOrgTime.HasValue) return;
+            HandleDuration = Math.Round((ActualHandleTime - CenterToOrgTime).Value.TotalMinutes);
+        }
 
         /// <summary>
         /// 是否已签收