|
@@ -109,9 +109,11 @@ namespace Hotline.FlowEngine.Workflows
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
|
|
|
|
//firstStep是否为end,t: 实际办理节点为startStep, 并且handlerId赋值 f: 实际办理节点为firstStep, handlerId未赋值
|
|
//firstStep是否为end,t: 实际办理节点为startStep, 并且handlerId赋值 f: 实际办理节点为firstStep, handlerId未赋值
|
|
- workflow.UpdateActualStepWhenHandle(startStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
+ workflow.UpdateActualStepWhenHandle(startStep, _sessionContextProvider.SessionContext.OrgAreaCode,
|
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
- workflow.UpdateCurrentStepWhenHandle(startStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(startStep, _sessionContextProvider.SessionContext.OrgAreaCode,
|
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
var endTrace = await EndAsync(workflow, dto, firstStepDefine, startStep, expiredTime, cancellationToken);
|
|
var endTrace = await EndAsync(workflow, dto, firstStepDefine, startStep, expiredTime, cancellationToken);
|
|
return;
|
|
return;
|
|
@@ -235,16 +237,16 @@ namespace Hotline.FlowEngine.Workflows
|
|
_sessionContext.RequiredOrgId,
|
|
_sessionContext.RequiredOrgId,
|
|
_sessionContext.OrgName);
|
|
_sessionContext.OrgName);
|
|
|
|
|
|
- //发起会签时记录顶层会签节点(必须在update currentStep之后)
|
|
|
|
- var counterSignType = GetCounterSignType(dto.IsStartCountersign);
|
|
|
|
- if (dto.IsStartCountersign && !workflow.IsInCountersign)
|
|
|
|
- workflow.StartCountersign(startStep.Id, counterSignType);
|
|
|
|
|
|
+ // //发起会签时记录顶层会签节点(必须在update currentStep之后)
|
|
|
|
+ // var counterSignType = GetCounterSignType(dto.IsStartCountersign);
|
|
|
|
+ // if (dto.IsStartCountersign && !workflow.IsInCountersign)
|
|
|
|
+ // workflow.StartCountersign(startStep.Id, counterSignType);
|
|
|
|
|
|
await _workflowRepository.UpdateAsync(workflow, cancellationToken);
|
|
await _workflowRepository.UpdateAsync(workflow, cancellationToken);
|
|
|
|
|
|
var flowAssignInfo =
|
|
var flowAssignInfo =
|
|
await GetNextStepFlowAssignInfoAsync(workflow, startStep, dto, firstStepDefine, isNextDynamic, cancellationToken);
|
|
await GetNextStepFlowAssignInfoAsync(workflow, startStep, dto, firstStepDefine, isNextDynamic, cancellationToken);
|
|
-
|
|
|
|
|
|
+
|
|
//publish
|
|
//publish
|
|
await _publisher.PublishAsync(new StartWorkflowNotify(workflow, dto, flowAssignInfo.FlowAssignType, startTrace),
|
|
await _publisher.PublishAsync(new StartWorkflowNotify(workflow, dto, flowAssignInfo.FlowAssignType, startTrace),
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
@@ -259,17 +261,16 @@ namespace Hotline.FlowEngine.Workflows
|
|
DateTime? expiredTime = null, CancellationToken cancellationToken = default)
|
|
DateTime? expiredTime = null, CancellationToken cancellationToken = default)
|
|
{
|
|
{
|
|
var workflow = await GetWorkflowAsync(dto.WorkflowId, withDefine: true, withSteps: true,
|
|
var workflow = await GetWorkflowAsync(dto.WorkflowId, withDefine: true, withSteps: true,
|
|
- withTraces: true, withCountersigns: true, cancellationToken: cancellationToken);
|
|
|
|
|
|
+ withTraces: true, withCountersigns: true, cancellationToken: cancellationToken);
|
|
CheckWhetherRunnable(workflow.Status);
|
|
CheckWhetherRunnable(workflow.Status);
|
|
|
|
|
|
- //var currentStep = _workflowDomainService.FindCurrentStepWaitForHandle(workflow,
|
|
|
|
- // current.RequiredUserId, current.RequiredOrgId, current.Roles);
|
|
|
|
var currentStep = workflow.Steps.FirstOrDefault(d => d.Id == dto.StepId);
|
|
var currentStep = workflow.Steps.FirstOrDefault(d => d.Id == dto.StepId);
|
|
if (currentStep == null)
|
|
if (currentStep == null)
|
|
throw new UserFriendlyException(
|
|
throw new UserFriendlyException(
|
|
$"未找到对应节点, workflowId: {dto.WorkflowId}, stepId: {dto.StepId}", "未找到对应节点");
|
|
$"未找到对应节点, workflowId: {dto.WorkflowId}, stepId: {dto.StepId}", "未找到对应节点");
|
|
if (currentStep.Status is EWorkflowStepStatus.Handled)
|
|
if (currentStep.Status is EWorkflowStepStatus.Handled)
|
|
throw new UserFriendlyException("该状态不支持继续办理");
|
|
throw new UserFriendlyException("该状态不支持继续办理");
|
|
|
|
+ //todo 校验currentStep 能否由 current 办理
|
|
|
|
|
|
var currentStepDefine = GetStepDefine(workflow.WorkflowDefinition, currentStep.Code);
|
|
var currentStepDefine = GetStepDefine(workflow.WorkflowDefinition, currentStep.Code);
|
|
|
|
|
|
@@ -291,7 +292,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
nextStepDefine = GetStepDefine(workflow.WorkflowDefinition, dto.NextStepCode);
|
|
nextStepDefine = GetStepDefine(workflow.WorkflowDefinition, dto.NextStepCode);
|
|
}
|
|
}
|
|
|
|
|
|
- //普通节点往汇总节点办理时可以不选,不选的场景主动去查之前的办理对象
|
|
|
|
|
|
+ //普通节点往汇总节点办理时可以不选,不选的场景主动去查之前的办理对象 //todo 按照指派策略生成办理对象
|
|
if (nextStepDefine.StepType is EStepType.Summary && !dto.NextHandlers.Any())
|
|
if (nextStepDefine.StepType is EStepType.Summary && !dto.NextHandlers.Any())
|
|
{
|
|
{
|
|
var handler = GetSummaryTargetFlowStepHandler(workflow, nextStepDefine.SummaryTargetCode);
|
|
var handler = GetSummaryTargetFlowStepHandler(workflow, nextStepDefine.SummaryTargetCode);
|
|
@@ -305,15 +306,13 @@ namespace Hotline.FlowEngine.Workflows
|
|
if (dto.IsStartCountersign)
|
|
if (dto.IsStartCountersign)
|
|
{
|
|
{
|
|
if (!currentStepDefine.CanStartCountersign)
|
|
if (!currentStepDefine.CanStartCountersign)
|
|
- throw new UserFriendlyException("当前节点不支持发起会签");
|
|
|
|
- //if (currentStepDefine.HandlerType is EHandlerType.Role)
|
|
|
|
- // throw new UserFriendlyException("当前节点不支持发起会签");
|
|
|
|
|
|
+ throw UserFriendlyException.SameMessage("当前节点不支持发起会签");
|
|
//即使当前节点支持发起会签,但下一节点为信息汇总节点、结束节点时也不可发起会签
|
|
//即使当前节点支持发起会签,但下一节点为信息汇总节点、结束节点时也不可发起会签
|
|
if (nextStepDefine.StepType is EStepType.Summary or EStepType.End)
|
|
if (nextStepDefine.StepType is EStepType.Summary or EStepType.End)
|
|
- throw new UserFriendlyException("下一节点不允许发起会签");
|
|
|
|
|
|
+ throw UserFriendlyException.SameMessage("下一汇总节点不允许发起会签");
|
|
//下一节点是会签汇总节点也不允许发起会签
|
|
//下一节点是会签汇总节点也不允许发起会签
|
|
if (dto.BackToCountersignEnd)
|
|
if (dto.BackToCountersignEnd)
|
|
- throw new UserFriendlyException("下一节点不允许发起会签");
|
|
|
|
|
|
+ throw UserFriendlyException.SameMessage("下一会签汇总节点不允许发起会签");
|
|
}
|
|
}
|
|
|
|
|
|
var flowAssignInfo =
|
|
var flowAssignInfo =
|
|
@@ -323,8 +322,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
#region 办理当前节点
|
|
#region 办理当前节点
|
|
|
|
|
|
if (dto.Files != null && dto.Files.Any())
|
|
if (dto.Files != null && dto.Files.Any())
|
|
- currentStep.FileJson = await _fileRepository.AddFileAsync(dto.Files, workflow.ExternalId,
|
|
|
|
- currentStep.Id, cancellationToken);
|
|
|
|
|
|
+ currentStep.FileJson = await _fileRepository.AddFileAsync(
|
|
|
|
+ dto.Files, workflow.ExternalId, currentStep.Id, cancellationToken);
|
|
|
|
|
|
//(currentStep.IsInCountersign() && !dto.BackToCountersignEnd) || dto.IsStartCountersign;
|
|
//(currentStep.IsInCountersign() && !dto.BackToCountersignEnd) || dto.IsStartCountersign;
|
|
var isStartCountersign = currentStep.CountersignPosition switch
|
|
var isStartCountersign = currentStep.CountersignPosition switch
|
|
@@ -336,7 +335,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
};
|
|
|
|
|
|
- var counterSignType = GetCounterSignType(dto.IsStartCountersign);
|
|
|
|
|
|
+ var counterSignType = GetCounterSignType(dto.IsStartCountersign, currentStep.BusinessType);
|
|
|
|
|
|
var updateSteps = new List<WorkflowStep> { currentStep };
|
|
var updateSteps = new List<WorkflowStep> { currentStep };
|
|
|
|
|
|
@@ -584,7 +583,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
}
|
|
}
|
|
|
|
|
|
var unhandlePreviousTrace = workflow.Traces.FirstOrDefault(d =>
|
|
var unhandlePreviousTrace = workflow.Traces.FirstOrDefault(d =>
|
|
- d.Status is not EWorkflowStepStatus.Handled
|
|
|
|
|
|
+ d.Status is not EWorkflowStepStatus.Handled
|
|
);
|
|
);
|
|
|
|
|
|
var unCompletedCountersign = workflow.Countersigns
|
|
var unCompletedCountersign = workflow.Countersigns
|
|
@@ -667,7 +666,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
};
|
|
|
|
|
|
- var counterSignType = GetCounterSignType(dto.IsStartCountersign);
|
|
|
|
|
|
+ var counterSignType = GetCounterSignType(dto.IsStartCountersign, currentStep.BusinessType);
|
|
|
|
|
|
var updateSteps = new List<WorkflowStep> { currentStep };
|
|
var updateSteps = new List<WorkflowStep> { currentStep };
|
|
|
|
|
|
@@ -755,7 +754,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
//throw new UserFriendlyException(
|
|
//throw new UserFriendlyException(
|
|
// $"会签数据异常, workflowId: {currentStep.WorkflowId}, countersignId: {currentStep.CountersignId}",
|
|
// $"会签数据异常, workflowId: {currentStep.WorkflowId}, countersignId: {currentStep.CountersignId}",
|
|
// "会签数据异常");
|
|
// "会签数据异常");
|
|
- countersign.MemberHandled(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.RequiredOrgId);
|
|
|
|
|
|
+ countersign.MemberHandled(_sessionContextProvider.SessionContext.RequiredUserId,
|
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId);
|
|
//update cs
|
|
//update cs
|
|
await _workflowCountersignRepository.UpdateNav(countersign)
|
|
await _workflowCountersignRepository.UpdateNav(countersign)
|
|
.Include(d => d.Members)
|
|
.Include(d => d.Members)
|
|
@@ -798,12 +798,14 @@ namespace Hotline.FlowEngine.Workflows
|
|
if (workflow.ActualHandleStepId == currentStep.Id)
|
|
if (workflow.ActualHandleStepId == currentStep.Id)
|
|
{
|
|
{
|
|
//更新实际办理节点信息
|
|
//更新实际办理节点信息
|
|
- workflow.UpdateActualStepWhenHandle(currentStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
+ workflow.UpdateActualStepWhenHandle(currentStep, _sessionContextProvider.SessionContext.OrgAreaCode,
|
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
}
|
|
}
|
|
|
|
|
|
if (workflow.CurrentStepId == currentStep.Id)
|
|
if (workflow.CurrentStepId == currentStep.Id)
|
|
{
|
|
{
|
|
- workflow.UpdateCurrentStepWhenHandle(currentStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(currentStep, _sessionContextProvider.SessionContext.OrgAreaCode,
|
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
}
|
|
}
|
|
|
|
|
|
//检查是否流转到流程终点
|
|
//检查是否流转到流程终点
|
|
@@ -849,7 +851,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//更新会签实际办理对象信息
|
|
//更新会签实际办理对象信息
|
|
if (currentStep.IsActualHandled)
|
|
if (currentStep.IsActualHandled)
|
|
- workflow.AddCsActualHandler(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.RequiredOrgId);
|
|
|
|
|
|
+ workflow.AddCsActualHandler(_sessionContextProvider.SessionContext.RequiredUserId,
|
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId);
|
|
|
|
|
|
await _workflowRepository.UpdateAsync(workflow, cancellationToken);
|
|
await _workflowRepository.UpdateAsync(workflow, cancellationToken);
|
|
|
|
|
|
@@ -1145,7 +1148,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
/// 批量修改工单办理对象
|
|
/// 批量修改工单办理对象
|
|
/// </summary>
|
|
/// </summary>
|
|
public async Task ChangeHandlerBatchAsync(
|
|
public async Task ChangeHandlerBatchAsync(
|
|
- IReadOnlyList<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)> handlers,
|
|
|
|
|
|
+ IReadOnlyList<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep>
|
|
|
|
+ steps)> handlers,
|
|
CancellationToken cancellationToken)
|
|
CancellationToken cancellationToken)
|
|
{
|
|
{
|
|
foreach (var handler in handlers)
|
|
foreach (var handler in handlers)
|
|
@@ -1615,6 +1619,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
cancellationToken);
|
|
cancellationToken);
|
|
isPaiDan = false;
|
|
isPaiDan = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
return isPaiDan;
|
|
return isPaiDan;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1871,7 +1876,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
workflow.Complete(endStep, dto.ReviewResult);
|
|
workflow.Complete(endStep, dto.ReviewResult);
|
|
|
|
|
|
//需求调整:归档时当前节点显示为归档节点
|
|
//需求调整:归档时当前节点显示为归档节点
|
|
- workflow.UpdateCurrentStepWhenHandle(endStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(endStep, _sessionContextProvider.SessionContext.OrgAreaCode,
|
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
workflow.UpdateCurrentStepAcceptTime(endStep.AcceptTime.Value);
|
|
workflow.UpdateCurrentStepAcceptTime(endStep.AcceptTime.Value);
|
|
|
|
|
|
//workflow.UpdateActualStepWhenHandle(endStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
|
|
//workflow.UpdateActualStepWhenHandle(endStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
|
|
@@ -1904,10 +1910,14 @@ namespace Hotline.FlowEngine.Workflows
|
|
// _ => throw new ArgumentOutOfRangeException(nameof(businessType), businessType, null)
|
|
// _ => throw new ArgumentOutOfRangeException(nameof(businessType), businessType, null)
|
|
// };
|
|
// };
|
|
|
|
|
|
- public ECounterSignType? GetCounterSignType(bool isStartCountersign)
|
|
|
|
|
|
+ public ECounterSignType? GetCounterSignType(bool isStartCountersign, EBusinessType currentStepBusinessType)
|
|
{
|
|
{
|
|
if (!isStartCountersign) return null;
|
|
if (!isStartCountersign) return null;
|
|
- return _sessionContextProvider.SessionContext.OrgIsCenter ? ECounterSignType.Center : ECounterSignType.Department;
|
|
|
|
|
|
+ return currentStepBusinessType is EBusinessType.Seat or EBusinessType.Send
|
|
|
|
+ ? ECounterSignType.Center
|
|
|
|
+ : ECounterSignType.Department;
|
|
|
|
+
|
|
|
|
+ // return _sessionContextProvider.SessionContext.OrgIsCenter ? ECounterSignType.Center : ECounterSignType.Department;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1984,7 +1994,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
new FlowStepHandler
|
|
new FlowStepHandler
|
|
{
|
|
{
|
|
Key = OrgSeedData.CenterId,
|
|
Key = OrgSeedData.CenterId,
|
|
- Value = OrgSeedData.CenterName,
|
|
|
|
|
|
+ Value = OrgSeedData.CenterName,
|
|
OrgId = OrgSeedData.CenterId,
|
|
OrgId = OrgSeedData.CenterId,
|
|
OrgName = OrgSeedData.CenterName
|
|
OrgName = OrgSeedData.CenterName
|
|
});
|
|
});
|