|
@@ -99,7 +99,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//firststeps
|
|
//firststeps
|
|
var firstSteps = await CreateNextStepsAsync(workflow, firstStepDefine, startStep, dto, flowAssignInfo,
|
|
var firstSteps = await CreateNextStepsAsync(workflow, firstStepDefine, startStep, dto, flowAssignInfo,
|
|
- workflow.ExpiredTime, cancellationToken);
|
|
|
|
|
|
+ cancellationToken);
|
|
if (firstSteps.Any())
|
|
if (firstSteps.Any())
|
|
workflow.Steps.AddRange(firstSteps);
|
|
workflow.Steps.AddRange(firstSteps);
|
|
|
|
|
|
@@ -369,7 +369,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//创建下一/N个节点(会签汇总节点:会签未全部办理时不创建,最后一个会签办理节点创建会签汇总节点)
|
|
//创建下一/N个节点(会签汇总节点:会签未全部办理时不创建,最后一个会签办理节点创建会签汇总节点)
|
|
var nextSteps = await CreateNextStepsAsync(workflow, nextStepDefine, currentStep, dto, flowAssignInfo,
|
|
var nextSteps = await CreateNextStepsAsync(workflow, nextStepDefine, currentStep, dto, flowAssignInfo,
|
|
- dto.StepExpiredTime, cancellationToken);
|
|
|
|
|
|
+ cancellationToken);
|
|
|
|
|
|
//赋值当前节点的下级办理节点
|
|
//赋值当前节点的下级办理节点
|
|
if (dto.IsStartCountersign
|
|
if (dto.IsStartCountersign
|
|
@@ -512,7 +512,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
if (lastStep is null || lastStep.StepType is EStepType.End)
|
|
if (lastStep is null || lastStep.StepType is EStepType.End)
|
|
throw new UserFriendlyException($"流程流转数据异常,未结束流程出现endStep, flowId: {workflow.Id}", "流程流转数据异常");
|
|
throw new UserFriendlyException($"流程流转数据异常,未结束流程出现endStep, flowId: {workflow.Id}", "流程流转数据异常");
|
|
|
|
|
|
- var targetSteps = await CreateConfigStepsAsync(workflow, targetStepDefine, lastStep, dto, flowAssignInfo, workflow.ExpiredTime, cancellationToken);
|
|
|
|
|
|
+ var targetSteps = await CreateConfigStepsAsync(workflow, targetStepDefine, lastStep, dto,
|
|
|
|
+ flowAssignInfo, cancellationToken);
|
|
targetStep = targetSteps.First();
|
|
targetStep = targetSteps.First();
|
|
|
|
|
|
workflow.EndCountersign();
|
|
workflow.EndCountersign();
|
|
@@ -757,7 +758,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
/// 创建下1/N个节点
|
|
/// 创建下1/N个节点
|
|
/// </summary>
|
|
/// </summary>
|
|
private async Task<List<WorkflowStep>> CreateNextStepsAsync(Workflow workflow, StepDefine nextStepDefine,
|
|
private async Task<List<WorkflowStep>> CreateNextStepsAsync(Workflow workflow, StepDefine nextStepDefine,
|
|
- WorkflowStep currentStep, BasicWorkflowDto dto, FlowAssignInfo flowAssignInfo, DateTime expiredTime,
|
|
|
|
|
|
+ WorkflowStep currentStep, BasicWorkflowDto dto, FlowAssignInfo flowAssignInfo,
|
|
CancellationToken cancellationToken)
|
|
CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
List<WorkflowStep> nextSteps = new();
|
|
List<WorkflowStep> nextSteps = new();
|
|
@@ -773,13 +774,13 @@ namespace Hotline.FlowEngine.Workflows
|
|
{
|
|
{
|
|
//todo 依据会签策略创建会签下一级节点
|
|
//todo 依据会签策略创建会签下一级节点
|
|
nextSteps = await CreateCountersignStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
nextSteps = await CreateCountersignStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
- flowAssignInfo.FlowAssignType, expiredTime, cancellationToken);
|
|
|
|
|
|
+ flowAssignInfo.FlowAssignType, cancellationToken);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
//todo 创建普通节点(根据配置)
|
|
//todo 创建普通节点(根据配置)
|
|
nextSteps = await CreateConfigStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
nextSteps = await CreateConfigStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
- flowAssignInfo, expiredTime, cancellationToken);
|
|
|
|
|
|
+ flowAssignInfo, cancellationToken);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -790,7 +791,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
if (csStartStep is null)
|
|
if (csStartStep is null)
|
|
throw new UserFriendlyException("未查询到会签节点");
|
|
throw new UserFriendlyException("未查询到会签节点");
|
|
|
|
|
|
- nextSteps = await CreateCsEndStepsByPrevStepAsync(workflow, csStartStep, dto, expiredTime,
|
|
|
|
|
|
+ nextSteps = await CreateCsEndStepsByPrevStepAsync(workflow, csStartStep, dto,
|
|
cancellationToken);
|
|
cancellationToken);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -799,14 +800,14 @@ namespace Hotline.FlowEngine.Workflows
|
|
if (dto.BackToCountersignEnd)
|
|
if (dto.BackToCountersignEnd)
|
|
{
|
|
{
|
|
//todo check if cs all complete, create next
|
|
//todo check if cs all complete, create next
|
|
- nextSteps = await CreateCsEndStepsByPrevStepAsync(workflow, currentStep, dto, expiredTime,
|
|
|
|
|
|
+ nextSteps = await CreateCsEndStepsByPrevStepAsync(workflow, currentStep, dto,
|
|
cancellationToken);
|
|
cancellationToken);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
//todo 依据会签策略创建会签下一级节点
|
|
//todo 依据会签策略创建会签下一级节点
|
|
nextSteps = await CreateCountersignStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
nextSteps = await CreateCountersignStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
- flowAssignInfo.FlowAssignType, expiredTime, cancellationToken);
|
|
|
|
|
|
+ flowAssignInfo.FlowAssignType, cancellationToken);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -814,20 +815,19 @@ namespace Hotline.FlowEngine.Workflows
|
|
{
|
|
{
|
|
//todo 依据会签策略创建会签下一级节点
|
|
//todo 依据会签策略创建会签下一级节点
|
|
nextSteps = await CreateCountersignStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
nextSteps = await CreateCountersignStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
- flowAssignInfo.FlowAssignType, expiredTime, cancellationToken);
|
|
|
|
|
|
+ flowAssignInfo.FlowAssignType, cancellationToken);
|
|
}
|
|
}
|
|
else if (currentStep.InstanceMode is EInstanceMode.Dynamic && !currentStep.DynamicShouldTerminal())
|
|
else if (currentStep.InstanceMode is EInstanceMode.Dynamic && !currentStep.DynamicShouldTerminal())
|
|
{
|
|
{
|
|
//todo 创建动态下一级节点
|
|
//todo 创建动态下一级节点
|
|
nextSteps = await CreateStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
nextSteps = await CreateStepsAsync(workflow, nextStepDefine, currentStep, dto,
|
|
flowAssignInfo.FlowAssignType, dto.NextHandlers, null, EWorkflowStepStatus.WaitForAccept,
|
|
flowAssignInfo.FlowAssignType, dto.NextHandlers, null, EWorkflowStepStatus.WaitForAccept,
|
|
- ECountersignPosition.None, expiredTime, false, cancellationToken);
|
|
|
|
|
|
+ ECountersignPosition.None, false, cancellationToken);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
//todo 创建普通节点(根据配置)
|
|
//todo 创建普通节点(根据配置)
|
|
- nextSteps = await CreateConfigStepsAsync(workflow, nextStepDefine, currentStep, dto, flowAssignInfo,
|
|
|
|
- expiredTime, cancellationToken);
|
|
|
|
|
|
+ nextSteps = await CreateConfigStepsAsync(workflow, nextStepDefine, currentStep, dto, flowAssignInfo, cancellationToken);
|
|
}
|
|
}
|
|
|
|
|
|
return nextSteps;
|
|
return nextSteps;
|
|
@@ -839,7 +839,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
WorkflowStep prevStep,
|
|
WorkflowStep prevStep,
|
|
BasicWorkflowDto dto,
|
|
BasicWorkflowDto dto,
|
|
EFlowAssignType flowAssignType,
|
|
EFlowAssignType flowAssignType,
|
|
- DateTime expiredTime,
|
|
|
|
|
|
+ //DateTime expiredTime,
|
|
CancellationToken cancellationToken
|
|
CancellationToken cancellationToken
|
|
)
|
|
)
|
|
{
|
|
{
|
|
@@ -847,14 +847,14 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
return CreateStepsAsync(workflow, stepDefine, prevStep, dto, flowAssignType, dto.NextHandlers, countersignId,
|
|
return CreateStepsAsync(workflow, stepDefine, prevStep, dto, flowAssignType, dto.NextHandlers, countersignId,
|
|
EWorkflowStepStatus.WaitForAccept, prevStep.GetNextStepCountersignPosition(),
|
|
EWorkflowStepStatus.WaitForAccept, prevStep.GetNextStepCountersignPosition(),
|
|
- expiredTime, false, cancellationToken);
|
|
|
|
|
|
+ false, cancellationToken);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 根据传入节点的上一节点创建会签汇总节点(汇总传入节点的前一节点)
|
|
/// 根据传入节点的上一节点创建会签汇总节点(汇总传入节点的前一节点)
|
|
/// </summary>
|
|
/// </summary>
|
|
private async Task<List<WorkflowStep>> CreateCsEndStepsByPrevStepAsync(Workflow workflow, WorkflowStep step,
|
|
private async Task<List<WorkflowStep>> CreateCsEndStepsByPrevStepAsync(Workflow workflow, WorkflowStep step,
|
|
- BasicWorkflowDto dto, DateTime expiredTime, CancellationToken cancellationToken)
|
|
|
|
|
|
+ BasicWorkflowDto dto, CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
var prevStep = workflow.Steps.FirstOrDefault(d => d.Id == step.PrevStepId);
|
|
var prevStep = workflow.Steps.FirstOrDefault(d => d.Id == step.PrevStepId);
|
|
if (prevStep is null)
|
|
if (prevStep is null)
|
|
@@ -864,7 +864,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
if (prevStep.StartedCountersignHasAllHandled())
|
|
if (prevStep.StartedCountersignHasAllHandled())
|
|
{
|
|
{
|
|
//todo 创建会签汇总节点
|
|
//todo 创建会签汇总节点
|
|
- var countersignEndStep = await CreateCountersignEndStepAsync(prevStep, dto, expiredTime, cancellationToken);
|
|
|
|
|
|
+ var countersignEndStep = await CreateCountersignEndStepAsync(prevStep, dto, workflow.ExpiredTime, cancellationToken);
|
|
nextSteps = new List<WorkflowStep> { countersignEndStep };
|
|
nextSteps = new List<WorkflowStep> { countersignEndStep };
|
|
|
|
|
|
//create trace
|
|
//create trace
|
|
@@ -1241,7 +1241,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
// targetPrevStepBox, targetPrevStep, traceStatus, workflow.ExpiredTime, cancellationToken);
|
|
// targetPrevStepBox, targetPrevStep, traceStatus, workflow.ExpiredTime, cancellationToken);
|
|
|
|
|
|
var targetStepsNew = await CreateConfigStepsAsync(workflow, targetStepDefine, targetPrevStep, dto,
|
|
var targetStepsNew = await CreateConfigStepsAsync(workflow, targetStepDefine, targetPrevStep, dto,
|
|
- flowAssignInfo, workflow.ExpiredTime, cancellationToken);
|
|
|
|
|
|
+ flowAssignInfo, cancellationToken);
|
|
|
|
|
|
//更新当前办理节点信息
|
|
//更新当前办理节点信息
|
|
workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign,
|
|
workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign,
|
|
@@ -1318,7 +1318,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
WorkflowStep prevStep,
|
|
WorkflowStep prevStep,
|
|
BasicWorkflowDto dto,
|
|
BasicWorkflowDto dto,
|
|
FlowAssignInfo flowAssignInfo,
|
|
FlowAssignInfo flowAssignInfo,
|
|
- DateTime expiredTime,
|
|
|
|
|
|
+ //DateTime expiredTime,
|
|
CancellationToken cancellationToken)
|
|
CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
List<Kv> handlers;
|
|
List<Kv> handlers;
|
|
@@ -1334,8 +1334,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
}
|
|
}
|
|
|
|
|
|
return await CreateStepsAsync(workflow, stepDefine, prevStep, dto, flowAssignInfo.FlowAssignType, handlers,
|
|
return await CreateStepsAsync(workflow, stepDefine, prevStep, dto, flowAssignInfo.FlowAssignType, handlers,
|
|
- null, EWorkflowStepStatus.WaitForAccept, ECountersignPosition.None, expiredTime, true,
|
|
|
|
- cancellationToken);
|
|
|
|
|
|
+ null, EWorkflowStepStatus.WaitForAccept, ECountersignPosition.None, true, cancellationToken);
|
|
}
|
|
}
|
|
|
|
|
|
private async Task<List<WorkflowStep>> CreateStepsAsync(
|
|
private async Task<List<WorkflowStep>> CreateStepsAsync(
|
|
@@ -1348,7 +1347,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
string? countersignId,
|
|
string? countersignId,
|
|
EWorkflowStepStatus stepStatus,
|
|
EWorkflowStepStatus stepStatus,
|
|
ECountersignPosition csPosition,
|
|
ECountersignPosition csPosition,
|
|
- DateTime expiredTime,
|
|
|
|
|
|
+ //DateTime expiredTime,
|
|
bool isOrigin,
|
|
bool isOrigin,
|
|
CancellationToken cancellationToken
|
|
CancellationToken cancellationToken
|
|
)
|
|
)
|
|
@@ -1364,7 +1363,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
{
|
|
{
|
|
var step = CreateStep(stepDefine, prevStep, workflow.Id, flowAssignType, new List<Kv> { handler },
|
|
var step = CreateStep(stepDefine, prevStep, workflow.Id, flowAssignType, new List<Kv> { handler },
|
|
dto.NextStepCode, dto.NextMainHandler, countersignId,
|
|
dto.NextStepCode, dto.NextMainHandler, countersignId,
|
|
- stepStatus, csPosition, expiredTime, dto.NextStepName, isOrigin);
|
|
|
|
|
|
+ stepStatus, csPosition, workflow.ExpiredTime, dto.NextStepName, isOrigin);
|
|
|
|
|
|
steps.Add(step);
|
|
steps.Add(step);
|
|
}
|
|
}
|
|
@@ -1373,7 +1372,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
{
|
|
{
|
|
var step = CreateStep(stepDefine, prevStep, workflow.Id, flowAssignType, handlers,
|
|
var step = CreateStep(stepDefine, prevStep, workflow.Id, flowAssignType, handlers,
|
|
dto.NextStepCode, dto.NextMainHandler, countersignId,
|
|
dto.NextStepCode, dto.NextMainHandler, countersignId,
|
|
- stepStatus, csPosition, expiredTime, dto.NextStepName, isOrigin);
|
|
|
|
|
|
+ stepStatus, csPosition, workflow.ExpiredTime, dto.NextStepName, isOrigin);
|
|
|
|
|
|
steps.Add(step);
|
|
steps.Add(step);
|
|
}
|
|
}
|