123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- using Hotline.FlowEngine.Definitions;
- using Hotline.FlowEngine.WorkflowModules;
- using Hotline.Settings;
- using Hotline.Share.Dtos;
- using Hotline.Share.Dtos.FlowEngine;
- using Hotline.Share.Enums.FlowEngine;
- using Hotline.Share.Enums.Settings;
- using Hotline.Users;
- using XF.Domain.Entities;
- namespace Hotline.FlowEngine.Workflows
- {
- public interface IWorkflowDomainService
- {
- /// <summary>
- /// 创建流程
- /// </summary>
- Task<Workflow> CreateWorkflowAsync(WorkflowModule wfModule, string title, string userId, string orgId,
- string? externalId = null, CancellationToken cancellationToken = default);
- /// <summary>
- /// 进行流程的开始节点
- /// </summary>
- Task StartAsync(Workflow workflow, WorkflowStep startStep, BasicWorkflowDto dto, StepDefine firstStepDefine,
- bool isNextDynamic, FlowAssignInfo flowAssignInfo, ECounterSignType counterSignType, DateTime? expiredTime,
- CancellationToken cancellationToken);
- /// <summary>
- /// 查询工作流
- /// </summary>
- Task<Workflow> GetWorkflowAsync(string workflowId, bool withDefine = false, bool withSteps = false,
- bool withTraces = false, bool withTracesTree = false, bool withSupplements = false,
- bool withCountersigns = false, CancellationToken cancellationToken = default);
- /// <summary>
- /// 查询工作流包含当前用户办理权限(是否可办理)
- /// </summary>
- Task<(Workflow workflow, string? countersignId, bool canPrevious)> GetWorkflowHandlePermissionAsync(
- string workflowId, string userId, string orgId, CancellationToken cancellationToken = default);
- /// <summary>
- /// 受理,接办
- /// </summary>
- Task AcceptAsync(Workflow workflow, string userId, string? userName, string orgId, string? orgName,
- string? orgAreaCode, string? orgAreaName, CancellationToken cancellationToken);
- /// <summary>
- /// 办理(流转至下一节点)
- /// </summary>
- Task NextAsync(Workflow workflow, WorkflowStep currentStep, NextWorkflowDto dto, StepDefine nextStepDefine,
- bool isNextDynamic, FlowAssignInfo flowAssignInfo, DateTime? expiredTime,
- CancellationToken cancellationToken);
- /// <summary>
- /// 退回(返回前一节点)
- /// </summary>
- /// <returns></returns>
- Task PreviousAsync(Workflow workflow, PreviousWorkflowDto dto, User operater,
- CancellationToken cancellationToken);
- /// <summary>
- /// 撤回(返回到之前任意节点)
- /// </summary>
- Task RecallAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo,
- DateTime? expiredTime, CancellationToken cancellationToken);
- /// <summary>
- /// 撤回至开始节点
- /// </summary>
- Task RecallToStartStepAsync(string workflowId, string opinion, CancellationToken cancellationToken);
- ///// <summary>
- ///// 跳转(直接将流程跳转至任意节点)
- ///// </summary>
- //Task JumpAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo,
- // CancellationToken cancellationToken);
- ///// <summary>
- ///// 重办
- ///// </summary>
- //Task RedoAsync(Workflow workflow, RecallDto dto, StepDefine targetStepDefine, FlowAssignInfo flowAssignInfo,
- // CancellationToken cancellationToken);
- /// <summary>
- /// 否决(审批流程不通过)
- /// </summary>
- /// <returns></returns>
- Task RejectAsync(Workflow workflow, BasicWorkflowDto dto, CancellationToken cancellationToken);
- /// <summary>
- /// 补充
- /// </summary>
- /// <returns></returns>
- Task SupplementAsync(Workflow workflow, EndWorkflowDto dto, CancellationToken cancellationToken);
- /// <summary>
- /// 终止流程
- /// </summary>
- Task TerminateAsync(TerminateDto dto, CancellationToken cancellationToken);
- /// <summary>
- /// 结束流程(流程直接流转至结束节点)
- /// </summary>
- Task<WorkflowTrace> EndAsync(Workflow workflow, BasicWorkflowDto dto, StepDefine endStepDefine,
- WorkflowStep currentStep, EReviewResult? reviewResult = EReviewResult.Unknown,
- CancellationToken cancellationToken = default);
- StepDefine GetStepDefine(WorkflowDefinition workflowDefinition, string stepCode);
- /// <summary>
- /// 查询当前待办理节点
- /// </summary>
- WorkflowStep FindCurrentStepWaitForHandle(Workflow workflow, string userId, string orgId);
- /// <summary>
- /// 查询当前节点中最后一个节点
- /// </summary>
- Task<WorkflowStep?> FindLastStepAsync(string workflowId, CancellationToken cancellationToken);
- /// <summary>
- /// 查询待回访部门
- /// </summary>
- Task<(Kv, IReadOnlyList<Kv>)> GetUnvisitOrgsAsync(string workflowId, CancellationToken cancellationToken);
- /// <summary>
- /// 依据配置过滤下一节点
- /// </summary>
- List<StepDefine> NextStepDefineFilter(EPathPolicy pathPolicy, List<StepDefine> nextStepDefines);
- /// <summary>
- /// 撤销流程
- /// </summary>
- Task CancelAsync(CancelDto dto, CancellationToken cancellationToken);
- ///// <summary>
- ///// 更新期满时间
- ///// </summary>
- //Task UpdateExpiredTimeAsync(Workflow workflow, DateTime expiredTime, string timelimit, int? timelimiteCount,
- // ETimeType? timelimitUnit, DateTime nearlyExpiredTime, CancellationToken cancellationToken);
- /// <summary>
- /// 新增流程流转记录
- /// </summary>
- Task AddTracesAsync(string workflowId, List<WorkflowTrace> traces, CancellationToken cancellationToken);
- /// <summary>
- /// 创建开始节点
- /// </summary>
- WorkflowStep CreateStartStep(Workflow workflow, StepDefine startStepDefine, BasicWorkflowDto dto,
- List<Kv> handlers, DateTime? expiredTime);
- /// <summary>
- /// 查询未完成节点
- /// </summary>
- /// <param name="steps"></param>
- /// <param name="orgCode"></param>
- /// <param name="userId"></param>
- /// <returns></returns>
- WorkflowStep GetUnHandleStep(List<WorkflowStep> steps, string orgCode, string userId);
- /// <summary>
- /// 检查当前办理节点是否为开始节点
- /// </summary>
- /// <param name="workflowId"></param>
- /// <param name="userId">当前办理人Id</param>
- /// <param name="orgId">当前办理人orgId</param>
- /// <param name="cancellationToken"></param>
- /// <returns></returns>
- Task<bool> CheckCurrentIsStartStepAsync(string workflowId, string userId, string orgId,
- CancellationToken cancellationToken);
- /// <summary>
- /// 检查动态节点是否该终止
- /// </summary>
- bool DynamicShouldTerminal(StepDefine currentStepDefine, int currentOrgLevel);
- /// <summary>
- /// 终止会签
- /// </summary>
- /// <param name="countersignId"></param>
- /// <param name="cancellationToken"></param>
- /// <returns></returns>
- Task<Workflow> TerminalCountersignAsync(string countersignId, CancellationToken cancellationToken);
- /// <summary>
- /// 查询实际办理对象信息
- /// </summary>
- /// <param name="workflowId"></param>
- /// <param name="cancellationToken"></param>
- /// <returns></returns>
- Task<Kv> FindActualHandlerAsync(string workflowId, CancellationToken cancellationToken);
- /// <summary>
- /// 办理节点
- /// </summary>
- Task HandleStepAsync(WorkflowStep step, Workflow workflow, BasicWorkflowDto dto,
- EFlowAssignType? flowAssignType, ECounterSignType? counterSignType, DateTime? expiredTime,
- CancellationToken cancellationToken);
- /// <summary>
- /// 获取会签类型
- /// </summary>
- ECounterSignType GetCounterSignType(EBusinessType businessType);
- /// <summary>
- /// 查询退回节点信息
- /// </summary>
- (WorkflowStep currentStep, WorkflowStep prevStep, WorkflowStep? countersignStartStep) GetPreviousStep(
- Workflow workflow, string operaterId, string operaterOrgId);
- /// <summary>
- /// 查询派单池中流程节点id
- /// </summary>
- Task<IReadOnlyList<string>> GetUnhandleStepIdsFromSendPoolAsync(string sendPoolId, CancellationToken cancellationToken);
- /// <summary>
- /// 批量改派工单至指定用户
- /// </summary>
- Task ChangeHandlerRangeAsync(string sendPoolId,
- IReadOnlyList<(string userId, string username, IReadOnlyList<string> stepIds)> handlers,
- CancellationToken cancellationToken);
- }
- }
|