xf hai 1 ano
pai
achega
574f32a278

+ 2 - 2
src/Hotline.Api/Controllers/WorkflowController.cs

@@ -330,7 +330,7 @@ public class WorkflowController : BaseController
     /// <returns></returns>
     [Permission(EPermission.FlowRecall)]
     [HttpPost("recall")]
-    public async Task Recall([FromBody] NextWorkflowDto dto)
+    public async Task Recall([FromBody] RecallDto dto)
     {
         await _workflowApplication.RecallAsync(dto, HttpContext.RequestAborted);
     }
@@ -360,7 +360,7 @@ public class WorkflowController : BaseController
     /// <returns></returns>
     [Permission(EPermission.FlowJump)]
     [HttpPost("jump")]
-    public async Task Jump([FromBody] NextWorkflowDto dto)
+    public async Task Jump([FromBody] RecallDto dto)
     {
         await _workflowApplication.JumpAsync(dto, HttpContext.RequestAborted);
     }

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

@@ -22,12 +22,12 @@ namespace Hotline.Application.FlowEngine
         /// <summary>
         /// 撤回至任意节点
         /// </summary>
-        Task RecallAsync(NextWorkflowDto dto, CancellationToken cancellationToken);
+        Task RecallAsync(RecallDto dto, CancellationToken cancellationToken);
 
         /// <summary>
         /// 跳转至任意节点
         /// </summary>
-        Task JumpAsync(NextWorkflowDto dto, CancellationToken cancellationToken);
+        Task JumpAsync(RecallDto dto, CancellationToken cancellationToken);
 
         /// <summary>
         /// 重办

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

@@ -140,7 +140,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
     /// <summary>
     /// 撤回至任意节点
     /// </summary>
-    public async Task RecallAsync(NextWorkflowDto dto, CancellationToken cancellationToken)
+    public async Task RecallAsync(RecallDto dto, CancellationToken cancellationToken)
     {
         var workflow = await _workflowDomainService.GetWorkflowAsync(dto.WorkflowId, true, true, cancellationToken: cancellationToken);
         var targetStepDefine = _workflowDomainService.GetStepBoxDefine(workflow.Definition, dto.NextStepCode);
@@ -152,7 +152,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
     /// <summary>
     /// 跳转至任意节点
     /// </summary>
-    public async Task JumpAsync(NextWorkflowDto dto, CancellationToken cancellationToken)
+    public async Task JumpAsync(RecallDto dto, CancellationToken cancellationToken)
     {
         var workflow = await _workflowDomainService.GetWorkflowAsync(dto.WorkflowId, true, true, cancellationToken: cancellationToken);
         var targetStepDefine = _workflowDomainService.GetStepBoxDefine(workflow.Definition, dto.NextStepCode);

+ 0 - 1
src/Hotline.Application/Handlers/FlowEngine/JumpHandler.cs

@@ -2,7 +2,6 @@
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WfModules;
 using Hotline.Orders;
-using Hotline.Repository.SqlSugar.Orders;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Mq;
 using MapsterMapper;

+ 8 - 11
src/Hotline.Share/Dtos/FlowEngine/RecallDto.cs

@@ -1,12 +1,9 @@
-//namespace Hotline.Share.Dtos.FlowEngine;
+namespace Hotline.Share.Dtos.FlowEngine;
 
-///// <summary>
-///// 撤回
-///// </summary>
-//public class RecallDto : NextWorkflowDto
-//{
-//    /// <summary>
-//    /// 撤回的目标节点code
-//    /// </summary>
-//    public string TargetStepCode { get; set; } = string.Empty;
-//}
+/// <summary>
+/// 撤回
+/// </summary>
+public class RecallDto : BasicWorkflowDto
+{
+    public string WorkflowId { get; set; }
+}

+ 0 - 2
src/Hotline.Share/Dtos/FlowEngine/StepExtension.cs

@@ -11,6 +11,4 @@ public class StepExtension
     /// 是否短信通知
     /// </summary>
     public bool? IsSms { get; set; }
-
-
 }

+ 2 - 2
src/Hotline/FlowEngine/Notifications/WorkflowNotify.cs

@@ -25,9 +25,9 @@ public record CountersignStartAssigned(Workflow Workflow) : INotification;
 
 public record PreviousNotify(Workflow Workflow, PreviousWorkflowDto Dto, bool IsOrgToCenter) : INotification;
 
-public record RecallNotify(Workflow Workflow, NextWorkflowDto Dto, bool IsOrgToCenter) : INotification;
+public record RecallNotify(Workflow Workflow, RecallDto Dto, bool IsOrgToCenter) : INotification;
 
-public record JumpNotify(Workflow Workflow, NextWorkflowDto Dto, FlowAssignInfo FlowAssignInfo, bool IsCenterToOrg, bool IsOrgToCenter) : INotification;
+public record JumpNotify(Workflow Workflow, RecallDto Dto, FlowAssignInfo FlowAssignInfo, bool IsCenterToOrg, bool IsOrgToCenter) : INotification;
 
 public record RedoNotify(Workflow Workflow, NextWorkflowDto Dto, bool IsOrgToCenter) : INotification;
 

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

@@ -51,12 +51,12 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// 撤回(返回到之前任意节点)
         /// </summary>
-        Task RecallAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
+        Task RecallAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
 
         /// <summary>
         /// 跳转(直接将流程跳转至任意节点)
         /// </summary>
-        Task JumpAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine, bool isStartCountersign, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
+        Task JumpAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, bool isStartCountersign, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
 
         /// <summary>
         /// 重办

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

@@ -473,7 +473,7 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// 撤回(返回到之前任意节点)
         /// </summary>
-        public async Task RecallAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken)
+        public async Task RecallAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken)
         {
             if (targetStepDefine.StepType is EStepType.Start or EStepType.End)
                 throw UserFriendlyException.SameMessage("开始/结束节点不支持撤回");
@@ -483,7 +483,7 @@ namespace Hotline.FlowEngine.Workflows
                 throw UserFriendlyException.SameMessage("该流程尚未流转至该节点");
 
             //update uncompleted traces
-            await RecallTraceAsync(workflow.Id, dto, cancellationToken);
+            await RecallTraceAsync(workflow.Id, cancellationToken);
 
             var isOrgToCenter = await RecallAsync(workflow, dto, targetStepDefine, targetStepBox, EWorkflowTraceStatus.Recall, cancellationToken);
 
@@ -497,7 +497,7 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// 跳转(直接将流程跳转至任意节点)
         /// </summary>
-        public async Task JumpAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine,
+        public async Task JumpAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine,
             bool isStartCountersign, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken)
         {
             if (targetStepDefine.StepType is EStepType.Start or EStepType.End)
@@ -942,7 +942,7 @@ namespace Hotline.FlowEngine.Workflows
             await _workflowStepRepository.UpdateRangeAsync(nextSteps, cancellationToken);
         }
 
-        private async Task JumpTraceAsync(string workflowId, NextWorkflowDto dto, CancellationToken cancellationToken)
+        private async Task JumpTraceAsync(string workflowId, RecallDto dto, CancellationToken cancellationToken)
         {
             //未办理的traces
             var uncompleteTraces =
@@ -961,7 +961,7 @@ namespace Hotline.FlowEngine.Workflows
             await _workflowTraceRepository.UpdateRangeAsync(uncompleteTraces, cancellationToken);
         }
 
-        private async Task RecallTraceAsync(string workflowId, NextWorkflowDto dto, CancellationToken cancellationToken)
+        private async Task RecallTraceAsync(string workflowId, CancellationToken cancellationToken)
         {
             //未办理的traces
             var uncompleteTraces =
@@ -1075,7 +1075,7 @@ namespace Hotline.FlowEngine.Workflows
             return parentTrace;
         }
 
-        private async Task<bool> RecallAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine, WorkflowStep targetStepBox, EWorkflowTraceStatus traceStatus, CancellationToken cancellationToken)
+        private async Task<bool> RecallAsync(Workflow workflow, BasicWorkflowDto dto, StepDefine targetStepDefine, WorkflowStep targetStepBox, EWorkflowTraceStatus traceStatus, CancellationToken cancellationToken)
         {
             //get targetStep's previous
             var targetPrevStepBox = workflow.StepBoxes.FirstOrDefault(d => d.Id == targetStepBox.PreviousId);
@@ -1094,12 +1094,12 @@ namespace Hotline.FlowEngine.Workflows
                 workflow.StepBoxes.RemoveAll(d => removeSteps.Contains(d));
             }
 
+            workflow.EndCountersign();
+
             //recreate targetStep
-            var targetStepBoxNew = await CreateStepAsync(dto.IsStartCountersign, workflow, targetStepDefine, dto, EWorkflowStepStatus.Assigned,
+            var targetStepBoxNew = await CreateStepAsync(false, workflow, targetStepDefine, dto, EWorkflowStepStatus.Assigned,
                  targetPrevStepBox, targetPrevStep, traceStatus, workflow.ExpiredTime, cancellationToken);
 
-            workflow.EndCountersign();
-
             //更新当前办理节点信息
             workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign, nextStep: targetStepBoxNew.Steps.First());