|
@@ -1,5 +1,5 @@
|
|
|
using Hotline.FlowEngine.Definitions;
|
|
|
-using Hotline.FlowEngine.Notifies;
|
|
|
+using Hotline.FlowEngine.Notifications;
|
|
|
using Hotline.SeedData;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
@@ -144,30 +144,30 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
/// <summary>
|
|
|
/// 受理(接办)
|
|
|
/// </summary>
|
|
|
- public async Task AcceptAsync(Workflow workflow, CancellationToken cancellationToken)
|
|
|
+ public async Task AcceptAsync(Workflow workflow, string userId, string userName, string orgCode, string orgName, CancellationToken cancellationToken)
|
|
|
{
|
|
|
//工单完成以后查看的场景
|
|
|
if (workflow.Status is not EWorkflowStatus.Runnable) return;
|
|
|
|
|
|
- var (currentStepBox, currentStep) = GetUnCompleteStepOrDefault(workflow.StepBoxes, _sessionContext.RequiredOrgCode, _sessionContext.RequiredUserId);
|
|
|
+ var (currentStepBox, currentStep) = GetUnCompleteStepOrDefault(workflow.StepBoxes, orgCode, userId);
|
|
|
if (currentStep is null) return;
|
|
|
if (currentStep.Status is EWorkflowStepStatus.Accepted) return;
|
|
|
if (currentStep.HandlerType is EHandlerType.AssignUser or EHandlerType.Role)
|
|
|
{
|
|
|
//userId
|
|
|
- if (currentStep.HandlerId != _sessionContext.RequiredUserId) return;
|
|
|
+ if (currentStep.HandlerId != userId) return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//orgId
|
|
|
- if (currentStep.HandlerId != _sessionContext.RequiredOrgCode) return;
|
|
|
+ if (currentStep.HandlerId != orgCode) return;
|
|
|
}
|
|
|
if (currentStep.StepType is EStepType.End)
|
|
|
throw new UserFriendlyException("当前流程已流转到最终步骤");
|
|
|
|
|
|
if (currentStepBox.Status is EWorkflowStepStatus.Assigned)
|
|
|
currentStepBox.Status = EWorkflowStepStatus.Accepted;
|
|
|
- currentStep.Accept(_sessionContext.RequiredUserId, _sessionContext.UserName);
|
|
|
+ currentStep.Accept(userId, userName);
|
|
|
|
|
|
//接办时非会签并且有多个接办部门时需更新接办部门
|
|
|
if (!workflow.IsInCountersign())
|
|
@@ -177,7 +177,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
{
|
|
|
await _workflowAssignRepository.RemoveRangeAsync(assigns, cancellationToken);
|
|
|
|
|
|
- var assign = WorkflowAssign.Create(workflow.Id, _sessionContext.OrgCode, _sessionContext.OrgName);
|
|
|
+ var assign = WorkflowAssign.Create(workflow.Id, orgCode, orgName);
|
|
|
await _workflowAssignRepository.AddAsync(assign, cancellationToken);
|
|
|
}
|
|
|
}
|
|
@@ -198,7 +198,12 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
var (currentStepBox, currentStep) = GetUnCompleteStep(workflow.StepBoxes, _sessionContext.RequiredOrgCode, _sessionContext.RequiredUserId);
|
|
|
if (currentStep.Status is EWorkflowStepStatus.Assigned)
|
|
|
- await AcceptAsync(workflow, cancellationToken);
|
|
|
+ await AcceptAsync(workflow,
|
|
|
+ _sessionContext.RequiredUserId,
|
|
|
+ _sessionContext.UserName,
|
|
|
+ _sessionContext.RequiredOrgCode,
|
|
|
+ _sessionContext.OrgName,
|
|
|
+ cancellationToken);
|
|
|
if (currentStep.StepType is EStepType.End)
|
|
|
throw new UserFriendlyException("当前流程已流转到最终步骤");
|
|
|
|
|
@@ -644,7 +649,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
await _workflowStepRepository.AddAsync(stepBox, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- if (stepBoxDefine.StepType is EStepType.CountersignEnd)
|
|
|
+ if (stepBoxDefine.StepType is EStepType.CountersignEnd && workflow.IsInCountersign())
|
|
|
{
|
|
|
if (prevStep is null)
|
|
|
throw new UserFriendlyException($"汇总节点的上级节点不能为空节点,workflowId: {workflow.Id}", "创建汇总节点异常");
|