IWorkflowDomainService.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using Hotline.FlowEngine.Definitions;
  2. using Hotline.FlowEngine.WorkflowModules;
  3. using Hotline.Share.Dtos;
  4. using Hotline.Share.Dtos.FlowEngine;
  5. using Hotline.Share.Dtos.Settings;
  6. using Hotline.Share.Enums.FlowEngine;
  7. using Hotline.Share.Enums.Settings;
  8. using XF.Domain.Entities;
  9. namespace Hotline.FlowEngine.Workflows
  10. {
  11. public interface IWorkflowDomainService
  12. {
  13. /// <summary>
  14. /// 创建流程
  15. /// </summary>
  16. Task<Workflow> CreateWorkflowAsync(WorkflowModule wfModule, string title, string userId, string userCode,
  17. string? externalId = null, string? timelimitText = null, DateTime? expiredTime = null,
  18. CancellationToken cancellationToken = default);
  19. /// <summary>
  20. /// 进行流程的开始节点
  21. /// </summary>
  22. Task StartAsync(Workflow workflow, WorkflowStep startStep, BasicWorkflowDto dto, StepDefine firstStepDefine,
  23. FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
  24. /// <summary>
  25. /// 查询工作流
  26. /// </summary>
  27. Task<Workflow> GetWorkflowAsync(string workflowId, bool withDefine = false, bool withSteps = false, bool withTraces = false,
  28. bool withSupplements = false, bool withCountersigns = false, CancellationToken cancellationToken = default);
  29. /// <summary>
  30. /// 查询工作流包含当前用户办理权限(是否可办理)
  31. /// </summary>
  32. Task<(Workflow, bool)> GetWorkflowHandlePermissionAsync(string workflowId,
  33. string userId, string orgCode, bool withDefine = false, bool withSteps = false, bool withTraces = false,
  34. bool withSupplements = false, bool withCountersigns = false, CancellationToken cancellationToken = default);
  35. /// <summary>
  36. /// 受理,接办
  37. /// </summary>
  38. Task AcceptAsync(Workflow workflow,
  39. string userId, string? userName,
  40. string orgId, string? orgName,
  41. string? orgAreaCode, string? orgAreaName,
  42. CancellationToken cancellationToken);
  43. /// <summary>
  44. /// 办理(流转至下一节点)
  45. /// </summary>
  46. Task NextAsync(Workflow workflow, WorkflowStep currentStep, NextWorkflowDto dto, StepDefine nextStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
  47. /// <summary>
  48. /// 退回(返回前一节点)
  49. /// </summary>
  50. /// <returns></returns>
  51. Task PreviousAsync(Workflow workflow, PreviousWorkflowDto dto, CancellationToken cancellationToken);
  52. /// <summary>
  53. /// 撤回(返回到之前任意节点)
  54. /// </summary>
  55. Task RecallAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
  56. /// <summary>
  57. /// 跳转(直接将流程跳转至任意节点)
  58. /// </summary>
  59. Task JumpAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
  60. /// <summary>
  61. /// 重办
  62. /// </summary>
  63. Task RedoAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo, CancellationToken cancellationToken);
  64. /// <summary>
  65. /// 否决(审批流程不通过)
  66. /// </summary>
  67. /// <returns></returns>
  68. Task RejectAsync(Workflow workflow, BasicWorkflowDto dto, CancellationToken cancellationToken);
  69. /// <summary>
  70. /// 补充
  71. /// </summary>
  72. /// <returns></returns>
  73. Task SupplementAsync(Workflow workflow, EndWorkflowDto dto, CancellationToken cancellationToken);
  74. /// <summary>
  75. /// 终止流程
  76. /// </summary>
  77. Task TerminateAsync(TerminateDto dto, CancellationToken cancellationToken);
  78. StepDefine GetStepDefine(WorkflowDefinition workflowDefinition, string stepCode);
  79. /// <summary>
  80. /// 查询当前待办理节点
  81. /// </summary>
  82. WorkflowStep FindCurrentStepWaitForHandle(Workflow workflow);
  83. /// <summary>
  84. /// 查询待回访部门
  85. /// </summary>
  86. Task<(Kv, IReadOnlyList<Kv>)> GetUnvisitOrgsAsync(string workflowId,
  87. CancellationToken cancellationToken);
  88. /// <summary>
  89. /// 依据配置过滤下一节点
  90. /// </summary>
  91. List<StepDefine> NextStepDefineFilter(EPathPolicy pathPolicy, List<StepDefine> nextStepDefines);
  92. /// <summary>
  93. /// 撤销流程
  94. /// </summary>
  95. Task CancelAsync(CancelDto dto, CancellationToken cancellationToken);
  96. /// <summary>
  97. /// 更新期满时间
  98. /// </summary>
  99. Task UpdateExpiredTimeAsync(DateTime expiredTime, string timelimitText, int? timelimie,
  100. ETimeType? timelimitUnit, CancellationToken cancellationToken);
  101. }
  102. }