Эх сурвалжийг харах

actualStepInfo改为与currentStepInfo保持一致

xf 7 сар өмнө
parent
commit
2b1d5d588e

+ 31 - 26
src/Hotline/FlowEngine/Workflows/Workflow.cs

@@ -106,6 +106,11 @@ public partial class Workflow : CreationEntity
     /// </summary>
     public string? ActualHandleOrgCode { get; set; }
 
+    /// <summary>
+    /// 实际办理部门等级
+    /// </summary>
+    public int? ActualHandleOrgLevel { get; set; }
+    
     /// <summary>
     /// 实际办理部门行政区划编码
     /// </summary>
@@ -484,19 +489,23 @@ public partial class Workflow
     /// <summary>
     /// 指派、未办理时调用
     /// </summary>
-    public void UpdateActualStepWhenAssign(
-        WorkflowStep nextStep,
-        string? actualHandleOrgCode = null,
-        string? actualHandleOrgName = null
-        )
+    public void UpdateActualStepWhenAssign(WorkflowStep nextStep, FlowStepHandler nextStepHandler)
     {
         ResetActualStep();
         ActualHandleStepId = nextStep.Id;
         ActualHandleStepCode = nextStep.Code;
         ActualHandleStepName = nextStep.Name;
         ActualHandleStepCreateTime = nextStep.CreationTime;
-        ActualHandleOrgCode = actualHandleOrgCode;
-        ActualHandleOrgName = actualHandleOrgName;
+        ActualHandlerId = nextStepHandler.UserId;
+        ActualHandlerName = nextStepHandler.Username;
+        ActualHandleOrgCode = nextStepHandler.OrgId;
+        ActualHandleOrgName = nextStepHandler.OrgName;
+        if (!string.IsNullOrEmpty(ActualHandleOrgCode))
+            ActualHandleOrgLevel = ActualHandleOrgCode.CalcOrgLevel();
+
+        //实际办理部门为一级部门时记录
+        if (ActualHandleOrgLevel.HasValue && ActualHandleOrgLevel == 1)
+            UpdateLevelOneOrg(ActualHandleOrgCode, ActualHandleOrgName);
     }
 
     /// <summary>
@@ -504,30 +513,25 @@ public partial class Workflow
     /// </summary>
     public void UpdateActualStepWhenHandle(
         WorkflowStep step,
-        string handlerId,
-        string? handlerName,
-        string handleOrgId,
-        string? handleOrgName,
         string? handleOrgAreaCode,
         string? handleOrgAreaName,
         int handlerOrgLevel)
     {
-        ActualHandleStepCode = step.Code;
-        ActualHandleStepName = step.Name;
-        ActualHandleStepId = step.Id;
-        ActualHandleStepCreateTime = step.CreationTime;
         ActualHandleStepAcceptTime = step.AcceptTime;
         ActualHandleTime = step.HandleTime;
-        ActualHandlerId = handlerId;
-        ActualHandlerName = handlerName;
-        ActualHandleOrgCode = handleOrgId;
-        ActualHandleOrgName = handleOrgName;
         ActualHandleOrgAreaCode = handleOrgAreaCode;
         ActualHandleOrgAreaName = handleOrgAreaName;
-
-        ////实际办理部门为一级部门时记录
-        //if (handlerOrgLevel == 1)
-        //    UpdateLevelOneOrg(handleOrgId, handleOrgName);
+        ActualHandleOrgLevel = handlerOrgLevel;
+        
+        //坐席->派单存在不选办理对象的场景,所以要补赋值
+        ActualHandlerId = step.Id;
+        ActualHandleStepCode = step.Code;
+        ActualHandleStepName = step.Name;
+        ActualHandleStepCreateTime = step.CreationTime;
+        ActualHandlerId = step.HandlerId;
+        ActualHandlerName = step.HandlerName;
+        ActualHandleOrgCode = step.HandlerOrgId;
+        ActualHandleOrgName = step.HandlerOrgName;
     }
 
     /// <summary>
@@ -547,12 +551,13 @@ public partial class Workflow
         if (!string.IsNullOrEmpty(CurrentHandleOrgId))
             CurrentHandleOrgLevel = CurrentHandleOrgId.CalcOrgLevel();
 
-        //实际办理部门为一级部门时记录
-        if (CurrentHandleOrgLevel.HasValue && CurrentHandleOrgLevel == 1)
-            UpdateLevelOneOrg(CurrentHandleOrgId, CurrentHandleOrgName);
+        // //实际办理部门为一级部门时记录
+        // if (CurrentHandleOrgLevel.HasValue && CurrentHandleOrgLevel == 1)
+        //     UpdateLevelOneOrg(CurrentHandleOrgId, CurrentHandleOrgName);
     }
 
     public void UpdateCurrentStepAcceptTime(DateTime acceptTime) => CurrentStepAcceptTime = acceptTime;
+    public void UpdateActualStepAcceptTime(DateTime acceptTime) => ActualHandleStepAcceptTime = acceptTime;
 
     /// <summary>
     /// 办理时调用

+ 41 - 25
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -110,14 +110,9 @@ namespace Hotline.FlowEngine.Workflows
                     PublishStrategy.ParallelWhenAll, cancellationToken);
 
                 //firstStep是否为end,t: 实际办理节点为startStep, 并且handlerId赋值 f: 实际办理节点为firstStep, handlerId未赋值
-                workflow.UpdateActualStepWhenHandle(startStep,
-                    current.RequiredUserId, current.UserName,
-                    current.RequiredOrgId, current.OrgName,
-                    current.OrgAreaCode, current.OrgAreaName,
-                    current.OrgLevel);
+                workflow.UpdateActualStepWhenHandle(startStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
 
-                workflow.UpdateCurrentStepWhenHandle(startStep,
-                    current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
+                workflow.UpdateCurrentStepWhenHandle(startStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
 
                 var endTrace = await EndAsync(workflow, dto, firstStepDefine, startStep, current, expiredTime, cancellationToken);
                 return;
@@ -480,17 +475,12 @@ namespace Hotline.FlowEngine.Workflows
             if (workflow.ActualHandleStepId == currentStep.Id)
             {
                 //更新实际办理节点信息
-                workflow.UpdateActualStepWhenHandle(currentStep,
-                    current.RequiredUserId, current.UserName,
-                    current.RequiredOrgId, current.OrgName,
-                    current.OrgAreaCode, current.OrgAreaName,
-                    current.OrgLevel);
+                workflow.UpdateActualStepWhenHandle(currentStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
             }
 
             if (workflow.CurrentStepId == currentStep.Id)
             {
-                workflow.UpdateCurrentStepWhenHandle(currentStep,
-                    current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
+                workflow.UpdateCurrentStepWhenHandle(currentStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
             }
 
             //检查是否流转到流程终点
@@ -661,7 +651,13 @@ namespace Hotline.FlowEngine.Workflows
                 workflow.SetStatusRunnable();
 
             //更新实际办理节点信息
-            workflow.UpdateActualStepWhenAssign(newPrevStep, prevStep.HandlerOrgId, prevStep.HandlerOrgName);
+            workflow.UpdateActualStepWhenAssign(newPrevStep,new FlowStepHandler
+            {
+                UserId = prevStep.HandlerId,
+                Username = prevStep.HandlerName,
+                OrgId = prevStep.HandlerOrgId,
+                OrgName = prevStep.HandlerOrgName,
+            });
 
             workflow.UpdateCurrentStepWhenAssign(newPrevStep, new FlowStepHandler
             {
@@ -1134,7 +1130,13 @@ namespace Hotline.FlowEngine.Workflows
             var newStartStep =
                 await DuplicateStepWithTraceAsync(workflow, targetStep, EWorkflowTraceType.Recall, cancellationToken);
 
-            workflow.UpdateActualStepWhenAssign(targetStep, targetStep.HandlerOrgId, targetStep.HandlerOrgName);
+            workflow.UpdateActualStepWhenAssign(targetStep,new FlowStepHandler
+            {
+                UserId = targetStep.HandlerId,
+                Username = targetStep.HandlerName,
+                OrgId = targetStep.HandlerOrgId,
+                OrgName = targetStep.HandlerOrgName,
+            });
 
             workflow.UpdateCurrentStepWhenAssign(targetStep, new FlowStepHandler
             {
@@ -1498,6 +1500,9 @@ namespace Hotline.FlowEngine.Workflows
             workflow.UpdateCurrentStepWhenHandle(endStep,
                 current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
             workflow.UpdateCurrentStepAcceptTime(endStep.AcceptTime.Value);
+            
+            workflow.UpdateActualStepWhenHandle(endStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
+            workflow.UpdateActualStepAcceptTime(endStep.AcceptTime.Value);
 
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
 
@@ -1566,7 +1571,6 @@ namespace Hotline.FlowEngine.Workflows
         {
             if (dto.IsStartCountersign) return;
             if (workflow.IsInCountersign) return;
-            if (nextStepDefine.StepType is EStepType.Summary or EStepType.End) return;
 
             if (nextStepDefine.BusinessType is EBusinessType.Seat or EBusinessType.Send)
             {
@@ -1596,15 +1600,16 @@ namespace Hotline.FlowEngine.Workflows
             {
                 //坐席->派单不选办理对象时
                 workflow.UpdateActualStepWhenAssign(nextSteps.First(),
-                    actualHandleOrgCode: OrgSeedData.CenterId,
-                    actualHandleOrgName: OrgSeedData.CenterName);
+                    new FlowStepHandler
+                    {
+                        OrgId = OrgSeedData.CenterId,
+                        OrgName = OrgSeedData.CenterName
+                    });
             }
             else
             {
                 var nextHandler = dto.NextHandlers.First();
-                workflow.UpdateActualStepWhenAssign(nextSteps.First(),
-                    actualHandleOrgCode: nextHandler.OrgId,
-                    actualHandleOrgName: nextHandler.OrgName);
+                workflow.UpdateActualStepWhenAssign(nextSteps.First(),nextHandler);
             }
 
             //if ( /*workflow.FlowType is EFlowType.Handle &&*/
@@ -2301,7 +2306,13 @@ namespace Hotline.FlowEngine.Workflows
                     null, expiredTime, cancellationToken: cancellationToken)).First();
 
             //更新实际办理节点信息
-            workflow.UpdateActualStepWhenAssign(targetStepNew, targetStep.HandlerOrgId, targetStep.HandlerOrgName);
+            workflow.UpdateActualStepWhenAssign(targetStepNew,new FlowStepHandler
+            {
+                UserId = targetStep.HandlerId,
+                Username = targetStep.HandlerName,
+                OrgId = targetStep.HandlerOrgId,
+                OrgName = targetStep.HandlerOrgName
+            });
 
             workflow.UpdateCurrentStepWhenAssign(targetStepNew, new FlowStepHandler
             {
@@ -2588,8 +2599,13 @@ namespace Hotline.FlowEngine.Workflows
                 if (startCountersignStep.Id == workflow.TopCountersignStepId)
                 {
                     workflow.UpdateActualStepWhenAssign(newStep,
-                        startCountersignStep.HandlerOrgId,
-                        startCountersignStep.HandlerOrgName);
+                        new FlowStepHandler
+                        {
+                            UserId = startCountersignStep.HandlerId,
+                            Username = startCountersignStep.HandlerName,
+                            OrgId = startCountersignStep.HandlerOrgId,
+                            OrgName = startCountersignStep.HandlerOrgName
+                        });
 
                     workflow.UpdateCurrentStepWhenAssign(newStep,
                         new FlowStepHandler