|
@@ -715,12 +715,41 @@ namespace Hotline.FlowEngine.Workflows
|
|
trace.ExpiredTime = workflow.ExpiredTime;
|
|
trace.ExpiredTime = workflow.ExpiredTime;
|
|
trace.TimeLimit = workflow.TimeLimit;
|
|
trace.TimeLimit = workflow.TimeLimit;
|
|
|
|
|
|
- //处于会签中的节点,其对应的trace.parentId赋值上级trace.Id
|
|
|
|
- if (currentStep.StepCountersignStatus is EStepCountersignStatus.InCountersign)
|
|
|
|
|
|
+ //todo 1.如果是汇总节点,trace.parentId=会签开始节点对应的trace.parentId(即与会签开始节点trace同级)
|
|
|
|
+ //todo 2.普通节点:2.1: in 判断上级节点是否发起会签,有则赋值parentId为上级trace.Id, 2.2: outer 与上级节点trace保持同级,取值上级节点对应trace.parentId
|
|
|
|
+
|
|
|
|
+ if (currentStep.StepType is EStepType.CountersignEnd)
|
|
{
|
|
{
|
|
- var parentTrace = await GetWorkflowTraceAsync(workflow.Id, currentStep.PreviousId, cancellationToken);
|
|
|
|
- trace.ParentId = parentTrace.Id;
|
|
|
|
|
|
+ if (currentStep.IsInCountersign)
|
|
|
|
+ {
|
|
|
|
+ var countersign =
|
|
|
|
+ await _workflowCountersignRepository.GetAsync(currentStep.CountersignId!, cancellationToken);
|
|
|
|
+ if (countersign == null)
|
|
|
|
+ throw new UserFriendlyException(
|
|
|
|
+ $"汇总节点处于会签中,未查询到对应会签,countersignId: {currentStep.CountersignId}");
|
|
|
|
+ var startTrace = await GetWorkflowTraceAsync(workflow.Id, countersign.StartStepId, cancellationToken);
|
|
|
|
+ trace.ParentId = startTrace.ParentId;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (currentStep.StepType is EStepType.Normal)
|
|
|
|
+ {
|
|
|
|
+ if (currentStep.StepCountersignStatus is EStepCountersignStatus.InCountersign)
|
|
|
|
+ {
|
|
|
|
+ var prevTrace = await GetWorkflowTraceAsync(workflow.Id, currentStep.PreviousId, cancellationToken);
|
|
|
|
+ trace.ParentId = prevTrace.Id;
|
|
|
|
+ }
|
|
|
|
+ else if (currentStep.StepCountersignStatus is EStepCountersignStatus.OuterCountersign)
|
|
|
|
+ {
|
|
|
|
+ var prevTrace = await GetWorkflowTraceAsync(workflow.Id, currentStep.PreviousId, cancellationToken);
|
|
|
|
+ trace.ParentId = prevTrace.ParentId;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ ////处于会签中的节点,其对应的trace.parentId赋值上级trace.Id
|
|
|
|
+ //if (currentStep.StepCountersignStatus is EStepCountersignStatus.InCountersign)
|
|
|
|
+ //{
|
|
|
|
+ // var parentTrace = await GetWorkflowTraceAsync(workflow.Id, currentStep.PreviousId, cancellationToken);
|
|
|
|
+ // trace.ParentId = parentTrace.Id;
|
|
|
|
+ //}
|
|
|
|
|
|
await _workflowTraceRepository.AddAsync(trace, cancellationToken);
|
|
await _workflowTraceRepository.AddAsync(trace, cancellationToken);
|
|
}
|
|
}
|