Kaynağa Gözat

mod: IWorkflowApplication PreviousAsync 新增返回值 EFlowDirection

xf 11 ay önce
ebeveyn
işleme
9471e4c2d1

+ 2 - 2
src/Hotline.Application/FlowEngine/IWorkflowApplication.cs

@@ -30,12 +30,12 @@ namespace Hotline.Application.FlowEngine
         /// <summary>
         /// 退回(返回前一节点)
         /// </summary>
-        Task PreviousAsync(PreviousWorkflowDto dto, CancellationToken cancellationToken);
+        Task<EFlowDirection> PreviousAsync(PreviousWorkflowDto dto, CancellationToken cancellationToken);
 
         /// <summary>
         /// 工单退回(返回前一节点)
         /// </summary>
-        Task PreviousAsync(PreviousWorkflowDto dto, string userId, CancellationToken cancellationToken);
+        Task<EFlowDirection> PreviousAsync(PreviousWorkflowDto dto, string userId, CancellationToken cancellationToken);
 
         /// <summary>
         /// 撤回至任意节点

+ 7 - 7
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -266,27 +266,27 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
     /// <summary>
     /// 退回(返回前一节点)
     /// </summary>
-    public async Task PreviousAsync(PreviousWorkflowDto dto, CancellationToken cancellationToken)
+    public async Task<EFlowDirection> PreviousAsync(PreviousWorkflowDto dto, CancellationToken cancellationToken)
     {
         var workflow = await _workflowDomainService.GetWorkflowAsync(dto.WorkflowId, withSteps: true,
             withTraces: true, withCountersigns: true, cancellationToken: cancellationToken);
         var user = await _userRepository.Queryable()
             .Includes(x => x.Organization)
             .FirstAsync(x => x.Id == _sessionContext.RequiredUserId, cancellationToken);
-        await _workflowDomainService.PreviousAsync(workflow, dto, user, _sessionContext, cancellationToken);
+        return await _workflowDomainService.PreviousAsync(workflow, dto, user, _sessionContext, cancellationToken);
     }
 
     /// <summary>
     /// 工单退回(返回前一节点)
     /// </summary>
-    public async Task PreviousAsync(PreviousWorkflowDto dto, string userId, CancellationToken cancellationToken)
+    public async Task<EFlowDirection> PreviousAsync(PreviousWorkflowDto dto, string userId, CancellationToken cancellationToken)
     {
         var workflow = await _workflowDomainService.GetWorkflowAsync(dto.WorkflowId, withSteps: true,
             withTraces: true, withCountersigns: true, cancellationToken: cancellationToken);
         var user = await _userRepository.Queryable()
             .Includes(x => x.Organization)
             .FirstAsync(x => x.Id == userId, cancellationToken);
-        await _workflowDomainService.PreviousAsync(workflow, dto, user, _sessionContext, cancellationToken);
+        return await _workflowDomainService.PreviousAsync(workflow, dto, user, _sessionContext, cancellationToken);
     }
 
     /// <summary>
@@ -597,8 +597,8 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
         nextDto.ReviewResult = EReviewResult.Failed;
         nextDto.NextStepCode = endStepDefine.Code;
         nextDto.NextStepName = endStepDefine.Name;
-        nextDto.FlowDirection = _sessionContext.OrgIsCenter 
-            ? EFlowDirection.CenterToFile 
+        nextDto.FlowDirection = _sessionContext.OrgIsCenter
+            ? EFlowDirection.CenterToFile
             : EFlowDirection.OrgToFile;
 
         await NextAsync(nextDto, _sessionContext, cancellationToken: cancellationToken);
@@ -651,7 +651,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                 //根据汇总对象id找到被汇总节点
                 var summaryTargetStep = workflow.Steps.FirstOrDefault(d =>
                     d.Status == EWorkflowStepStatus.Handled &&
-                    d.StepType == EStepType.Normal && 
+                    d.StepType == EStepType.Normal &&
                     d.Code == stepDefine.SummaryTargetCode &&
                     d.IsOrigin);
                 if (summaryTargetStep is null)