xf hai 1 ano
pai
achega
c26e7339d8

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

@@ -382,24 +382,24 @@ public class Workflow : CreationEntity
         }
     }
 
-    //public void Assign(EFlowAssignType type, IEnumerable<string> handlers)
-    //{
-    //    handlers = handlers.Select(d => d.ToLower());
-    //    switch (type)
-    //    {
-    //        case EFlowAssignType.Org:
-    //            var orgCodes = handlers.SelectMany(d => d.GetHigherOrgCodes(true)).ToList();
-    //            AssignOrgCodes.AddRange(orgCodes);
-    //            AssignOrgCodes = AssignOrgCodes.Distinct().ToList();
-    //            break;
-    //        case EFlowAssignType.User:
-    //            AssignUserIds.AddRange(handlers);
-    //            AssignUserIds = AssignUserIds.Distinct().ToList();
-    //            break;
-    //        default:
-    //            throw new ArgumentOutOfRangeException(nameof(type), type, null);
-    //    }
-    //}
+    public void Assign(EFlowAssignType type, IEnumerable<string> handlers)
+    {
+        handlers = handlers.Select(d => d.ToLower());
+        switch (type)
+        {
+            case EFlowAssignType.Org:
+                var orgCodes = handlers.SelectMany(d => d.GetHigherOrgCodes(true)).ToList();
+                AssignOrgCodes.AddRange(orgCodes);
+                AssignOrgCodes = AssignOrgCodes.Distinct().ToList();
+                break;
+            case EFlowAssignType.User:
+                AssignUserIds.AddRange(handlers);
+                AssignUserIds = AssignUserIds.Distinct().ToList();
+                break;
+            default:
+                throw new ArgumentOutOfRangeException(nameof(type), type, null);
+        }
+    }
 
     #endregion
 }

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

@@ -147,6 +147,9 @@ namespace Hotline.FlowEngine.Workflows
             workflow.UpdateHandlers(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgCode,
             flowAssignMode.FlowAssignType, flowAssignMode.HandlerObjects);
 
+            //更新指派信息
+            workflow.Assign(flowAssignMode.FlowAssignType, flowAssignMode.GetHandlers());
+
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
         }
 
@@ -450,8 +453,8 @@ namespace Hotline.FlowEngine.Workflows
             if (isStartCountersign && !workflow.IsInCountersign())
                 workflow.StartCountersign(currentStepBox.Code, counterSignType);
 
-            ////更新指派信息
-            //workflow.Assign(flowAssignMode.FlowAssignType, flowAssignMode.GetHandlers());
+            //更新指派信息
+            workflow.Assign(flowAssignMode.FlowAssignType, flowAssignMode.GetHandlers());
 
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);