|
@@ -3634,43 +3634,25 @@ public class OrderController : BaseController
|
|
|
.ToListAsync(HttpContext.RequestAborted);
|
|
|
var maxLevel = orgs.MaxBy(d => d.Level).Level;
|
|
|
|
|
|
- var unhandleSteps = new List<WorkflowStep> { startStep };
|
|
|
+ //办理开始节点或派单节点至一级部门
|
|
|
+ var levelOneOrgs = orgs.Where(d => d.Level == 1).ToList();
|
|
|
+ var unhandleSteps = await HandleWorkflowStepAsync(startStep, levelOneOrgs, order.ExpiredTime, cancellationToken);
|
|
|
|
|
|
+ //依次办理路过节点
|
|
|
for (int i = 1; i < maxLevel; i++)
|
|
|
{
|
|
|
var tempSteps = new List<WorkflowStep>();
|
|
|
foreach (var unhandleStep in unhandleSteps)
|
|
|
{
|
|
|
- var hasDownLevel = orgs.Any(d => d.Id.StartsWith(unhandleStep.HandlerOrgId));
|
|
|
- if(!hasDownLevel) continue;
|
|
|
+ var hasLowerLevel = orgs.Any(d => d.Id.StartsWith(unhandleStep.HandlerOrgId));
|
|
|
+ if (!hasLowerLevel) continue;
|
|
|
|
|
|
- var handleOrgs = orgs.Where(d => d.Level == i).ToList();
|
|
|
+ var currentLevel = unhandleStep.HandlerOrgId.CalcOrgLevel();
|
|
|
+ var lowerLevel = currentLevel++;
|
|
|
+ var handleOrgs = orgs.Where(d => d.Level == lowerLevel).ToList();
|
|
|
if (i != 1)
|
|
|
handleOrgs = handleOrgs.Where(d => d.Id.StartsWith(unhandleStep.HandlerOrgId)).ToList();
|
|
|
- var isStartCountersign = handleOrgs.Count > 1;
|
|
|
- var handlers = handleOrgs.Select(d => new FlowStepHandler
|
|
|
- {
|
|
|
- OrgId = d.Id,
|
|
|
- OrgName = d.Name,
|
|
|
- Key = d.Id,
|
|
|
- Value = d.Name
|
|
|
- }).ToList();
|
|
|
- var nextflowDto = new NextWorkflowDto
|
|
|
- {
|
|
|
- WorkflowId = unhandleStep.WorkflowId,
|
|
|
- StepId = unhandleStep.Id,
|
|
|
- NextStepCode = unhandleStep.Code,
|
|
|
- NextStepName = unhandleStep.Name,
|
|
|
- FlowDirection = EFlowDirection.CenterToOrg,
|
|
|
- HandlerType = unhandleStep.HandlerType,
|
|
|
- StepType = unhandleStep.StepType,
|
|
|
- NextHandlers = handlers,
|
|
|
- IsStartCountersign = isStartCountersign,
|
|
|
- BusinessType = unhandleStep.BusinessType,
|
|
|
- Opinion = "跨级派单,自动办理"
|
|
|
- };
|
|
|
-
|
|
|
- var nextSteps = await _workflowDomainService.NextAsync(nextflowDto, order.ExpiredTime, cancellationToken);
|
|
|
+ var nextSteps = await HandleWorkflowStepAsync(unhandleStep, handleOrgs, order.ExpiredTime, cancellationToken);
|
|
|
tempSteps.AddRange(nextSteps);
|
|
|
}
|
|
|
|
|
@@ -3685,6 +3667,34 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private async Task<List<WorkflowStep>> HandleWorkflowStepAsync(WorkflowStep unhandleStep, List<SystemOrganize> handleOrgs, DateTime? expiredTime, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var isStartCountersign = handleOrgs.Count > 1;
|
|
|
+ var handlers = handleOrgs.Select(d => new FlowStepHandler
|
|
|
+ {
|
|
|
+ OrgId = d.Id,
|
|
|
+ OrgName = d.Name,
|
|
|
+ Key = d.Id,
|
|
|
+ Value = d.Name
|
|
|
+ }).ToList();
|
|
|
+ var nextflowDto = new NextWorkflowDto
|
|
|
+ {
|
|
|
+ WorkflowId = unhandleStep.WorkflowId,
|
|
|
+ StepId = unhandleStep.Id,
|
|
|
+ NextStepCode = unhandleStep.Code,
|
|
|
+ NextStepName = unhandleStep.Name,
|
|
|
+ FlowDirection = EFlowDirection.CenterToOrg,
|
|
|
+ HandlerType = unhandleStep.HandlerType,
|
|
|
+ StepType = unhandleStep.StepType,
|
|
|
+ NextHandlers = handlers,
|
|
|
+ IsStartCountersign = isStartCountersign,
|
|
|
+ BusinessType = unhandleStep.BusinessType,
|
|
|
+ Opinion = "跨级派单,自动办理"
|
|
|
+ };
|
|
|
+
|
|
|
+ return await _workflowDomainService.NextAsync(nextflowDto, expiredTime, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 查询工单办理下一步可选节点(带推荐部门)
|
|
|
/// </summary>
|