|
@@ -161,6 +161,25 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 流程跳转
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="workflowId"></param>
|
|
|
+ /// <param name="assignMode"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task ManageFlowJumpAsync(string workflowId, FlowAssignMode assignMode, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var order = await GetOrderByFlowIdAsync(workflowId, cancellationToken);
|
|
|
+ CheckOrderIfFiled(order);
|
|
|
+
|
|
|
+ order.Assign(assignMode.FlowAssignType, assignMode.GetHandlers());
|
|
|
+
|
|
|
+ order.Jump();
|
|
|
+
|
|
|
+ await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
#region private
|
|
|
|
|
|
private async Task<Order> GetOrderAsync(string? orderId, CancellationToken cancellationToken)
|
|
@@ -173,6 +192,16 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
return order;
|
|
|
}
|
|
|
|
|
|
+ private async Task<Order> GetOrderByFlowIdAsync(string workflowId, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(workflowId))
|
|
|
+ throw UserFriendlyException.SameMessage("无效流程编号");
|
|
|
+ var order = await _orderRepository.GetAsync(d => d.WorkflowId == workflowId, cancellationToken);
|
|
|
+ if (order == null)
|
|
|
+ throw new UserFriendlyException($"无效流程编号, workflowId: {workflowId}", "无效流程编号");
|
|
|
+ return order;
|
|
|
+ }
|
|
|
+
|
|
|
private void CheckOrderIfFiled(Order order)
|
|
|
{
|
|
|
if (order.Status is EOrderStatus.Filed)
|