|
@@ -23,6 +23,7 @@ using Hotline.Configurations;
|
|
|
using Hotline.Share.Dtos.File;
|
|
|
using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
+using Hotline.Share.Dtos.Users;
|
|
|
|
|
|
namespace Hotline.FlowEngine.Workflows
|
|
|
{
|
|
@@ -640,6 +641,43 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
return nextSteps;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 开启流程直接归档
|
|
|
+ /// </summary>
|
|
|
+ public async Task StartToEndAsync(StartWorkflowDto dto, string externalId, DateTime? expiredTime = null,
|
|
|
+ CancellationToken cancellationToken = default)
|
|
|
+ {
|
|
|
+ //var wfModule = await GetWorkflowModuleAsync(dto.DefinitionModuleCode, cancellationToken);
|
|
|
+ //var definition = wfModule.Definition;
|
|
|
+ //if (definition == null)
|
|
|
+ // throw new UserFriendlyException("无效模板编码");
|
|
|
+ //if (definition.Status is not EDefinitionStatus.Enable)
|
|
|
+ // throw new UserFriendlyException("该模板不可用");
|
|
|
+
|
|
|
+ //var endStepDefine = definition.FindEndStepDefine();
|
|
|
+ //dto.NextStepCode = endStepDefine.Code;
|
|
|
+ //dto.NextStepName = endStepDefine.Name;
|
|
|
+ //dto.FlowDirection = EFlowDirection.CenterToFile;
|
|
|
+
|
|
|
+ //await StartAsync(dto, externalId, expiredTime, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ var (workflow, startStep) = await StartAsync(dto, externalId, expiredTime, cancellationToken: cancellationToken);
|
|
|
+ var nextDto = _mapper.Map<NextWorkflowDto>(dto);
|
|
|
+ nextDto.WorkflowId = workflow.Id;
|
|
|
+ nextDto.StepId = startStep.Id;
|
|
|
+
|
|
|
+ var endStepDefine = workflow.WorkflowDefinition.FindEndStepDefine();
|
|
|
+ nextDto.NextStepCode = endStepDefine.Code;
|
|
|
+ nextDto.NextStepName = endStepDefine.Name;
|
|
|
+
|
|
|
+ await NextAsync(workflow, nextDto,
|
|
|
+ expiredTime: expiredTime,
|
|
|
+ isAutoFillSummaryOpinion: true,
|
|
|
+ cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public async Task<Workflow> GetWorkflowAsync(string workflowId,
|
|
|
bool withDefine = false, bool withSteps = false,
|
|
|
bool withTraces = false, bool withTracesTree = false,
|
|
@@ -1136,27 +1174,6 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
return (currentStep, prevStep, countersignStartStep);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 开启流程直接归档
|
|
|
- /// </summary>
|
|
|
- public async Task StartToEndAsync(StartWorkflowDto dto, string externalId, DateTime? expiredTime = null,
|
|
|
- CancellationToken cancellationToken = default)
|
|
|
- {
|
|
|
- var wfModule = await GetWorkflowModuleAsync(dto.DefinitionModuleCode, cancellationToken);
|
|
|
- var definition = wfModule.Definition;
|
|
|
- if (definition == null)
|
|
|
- throw new UserFriendlyException("无效模板编码");
|
|
|
- if (definition.Status is not EDefinitionStatus.Enable)
|
|
|
- throw new UserFriendlyException("该模板不可用");
|
|
|
-
|
|
|
- var endStepDefine = definition.FindEndStepDefine();
|
|
|
- dto.NextStepCode = endStepDefine.Code;
|
|
|
- dto.NextStepName = endStepDefine.Name;
|
|
|
- dto.FlowDirection = EFlowDirection.CenterToFile;
|
|
|
-
|
|
|
- await StartAsync(dto, externalId, expiredTime, cancellationToken: cancellationToken);
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 查询派单池中流程节点id
|
|
|
/// </summary>
|