|
@@ -37,6 +37,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
private readonly IRepository<User> _userRepository;
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
private readonly IWfModuleCacheManager _wfModuleCacheManager;
|
|
|
+ private readonly ISessionContextProvider _sessionContextProvider;
|
|
|
|
|
|
public WorkflowDomainService(
|
|
|
IWorkflowRepository workflowRepository,
|
|
@@ -64,6 +65,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
_fileRepository = fileRepository;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
_wfModuleCacheManager = wfModuleCacheManager;
|
|
|
+ _sessionContextProvider = sessionContextProvider;
|
|
|
}
|
|
|
|
|
|
public async Task<Workflow> CreateWorkflowAsync(WorkflowModule wfModule, string title, string userId,
|
|
@@ -109,9 +111,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
|
|
|
|
//firstStep是否为end,t: 实际办理节点为startStep, 并且handlerId赋值 f: 实际办理节点为firstStep, handlerId未赋值
|
|
|
- workflow.UpdateActualStepWhenHandle(startStep, _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName, _sessionContext.OrgLevel);
|
|
|
+ workflow.UpdateActualStepWhenHandle(startStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
- workflow.UpdateCurrentStepWhenHandle(startStep, _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName, _sessionContext.OrgLevel);
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(startStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
|
|
|
var endTrace = await EndAsync(workflow, dto, firstStepDefine, startStep, expiredTime, cancellationToken);
|
|
|
return;
|
|
@@ -196,6 +198,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
_sessionContext.RequiredUserId, _sessionContext.RequiredOrgId,
|
|
|
externalId, cancellationToken);
|
|
|
|
|
|
+ //todo 重构为流程开放策略参数,业务决定
|
|
|
+ var defineHandler = startStepDefine.HandlerTypeItems.First();
|
|
|
var startStep = CreateStartStep(workflow, startStepDefine, dto,
|
|
|
new FlowStepHandler
|
|
|
{
|
|
@@ -205,8 +209,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
Username = _sessionContext.UserName,
|
|
|
OrgId = _sessionContext.RequiredOrgId,
|
|
|
OrgName = _sessionContext.OrgName,
|
|
|
- // RoleId = defineHandler.Key,
|
|
|
- // RoleName = defineHandler.Value,
|
|
|
+ RoleId = defineHandler.Key,
|
|
|
+ RoleName = defineHandler.Value,
|
|
|
}, expiredTime);
|
|
|
|
|
|
if (dto.Files.Any())
|
|
@@ -343,23 +347,23 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
if (countersignStartStep.IsStartCountersign)
|
|
|
{
|
|
|
- //var currentCountersign =
|
|
|
- // workflow.Countersigns.FirstOrDefault(d => d.Id == countersignStartStep.StartCountersignId);
|
|
|
- //if (currentCountersign is null)
|
|
|
- // throw new UserFriendlyException(
|
|
|
- // $"未查询到对应会签信息,workflowId:{workflow.Id}, countersignId:{currentStep.CountersignId}",
|
|
|
- // "无效会签编号");
|
|
|
+ var currentCountersign =
|
|
|
+ workflow.Countersigns.FirstOrDefault(d => d.Id == countersignStartStep.StartCountersignId);
|
|
|
+ if (currentCountersign is null)
|
|
|
+ throw new UserFriendlyException(
|
|
|
+ $"未查询到对应会签信息,workflowId:{workflow.Id}, countersignId:{currentStep.CountersignId}",
|
|
|
+ "无效会签编号");
|
|
|
|
|
|
//结束step会签信息
|
|
|
countersignStartStep.CountersignEnd();
|
|
|
updateSteps.Add(countersignStartStep);
|
|
|
|
|
|
- ////结束会签
|
|
|
- //currentCountersign.End(currentStep.Id, currentStep.Code, currentStep.BusinessType,
|
|
|
- // current.UserId, current.UserName,
|
|
|
- // current.OrgId, current.OrgName,
|
|
|
- // current.OrgAreaCode, current.OrgAreaName);
|
|
|
- //await _workflowCountersignRepository.UpdateAsync(currentCountersign, cancellationToken);
|
|
|
+ //结束会签
|
|
|
+ currentCountersign.End(currentStep.Id, currentStep.Code, currentStep.BusinessType,
|
|
|
+ current.UserId, current.UserName,
|
|
|
+ current.OrgId, current.OrgName,
|
|
|
+ current.OrgAreaCode, current.OrgAreaName);
|
|
|
+ await _workflowCountersignRepository.UpdateAsync(currentCountersign, cancellationToken);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -368,12 +372,12 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
//创建会签数据
|
|
|
if (isStartCountersign)
|
|
|
{
|
|
|
- //var exists = workflow.Countersigns.Any(d =>
|
|
|
- // !d.IsCompleted() && d.StarterId == current.UserId);
|
|
|
- //if (exists)
|
|
|
- // throw new UserFriendlyException("该用户在当前流程存在未结束会签");
|
|
|
- //await StartCountersignAsync(current, workflow, currentStep, dto, flowAssignInfo.FlowAssignType,
|
|
|
- // counterSignType, expiredTime, cancellationToken);
|
|
|
+ var exists = workflow.Countersigns.Any(d =>
|
|
|
+ !d.IsCompleted() && !string.IsNullOrEmpty(current.UserId) && d.StarterId == current.UserId);
|
|
|
+ if (exists)
|
|
|
+ throw new UserFriendlyException("该用户在当前流程存在未结束会签");
|
|
|
+ await StartCountersignAsync(current, workflow, currentStep, dto, flowAssignInfo.FlowAssignType,
|
|
|
+ counterSignType, expiredTime, cancellationToken);
|
|
|
}
|
|
|
|
|
|
currentStep.IsActualHandled = CheckIsActualHandle(workflow, currentStep, nextStepDefine, dto);
|
|
@@ -454,16 +458,6 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
nextStepDefine, isNextDynamic, flowAssignInfo.FlowAssignType, expiredTime, isStartCountersign,
|
|
|
cancellationToken);
|
|
|
|
|
|
- ////赋值当前节点的下级办理节点
|
|
|
- //if (dto.IsStartCountersign
|
|
|
- // //|| (currentStep.IsInCountersign() &&
|
|
|
- // // !currentStep.IsTopCountersignEndStep(workflow.TopCountersignStepId))
|
|
|
- // )
|
|
|
- //{
|
|
|
- // currentStep.CreateCountersignSteps(nextSteps);
|
|
|
- // await _workflowStepRepository.UpdateAsync(currentStep, cancellationToken);
|
|
|
- //}
|
|
|
-
|
|
|
// //更新办理对象(nextSteps无元素表示当前节点为会签办理节点且当前会签没有全部办理完成)
|
|
|
// workflow.UpdateHandlers(current.RequiredUserId, current.RequiredOrgId,
|
|
|
// flowAssignInfo.FlowAssignType, flowAssignInfo.HandlerObjects, nextSteps.Any());
|
|
@@ -586,9 +580,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
var unhandlePreviousTrace = workflow.Traces.FirstOrDefault(d =>
|
|
|
d.Status is not EWorkflowStepStatus.Handled
|
|
|
- //&& d.TraceType is EWorkflowTraceType.Previous
|
|
|
);
|
|
|
- //var previousOpinion = unhandlePreviousTrace?.Opinion ?? null;
|
|
|
|
|
|
var unCompletedCountersign = workflow.Countersigns
|
|
|
.FirstOrDefault(d => !d.IsCompleted() && d.StarterOrgId == orgId);
|
|
@@ -611,13 +603,13 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
string? orgAreaCode, string? orgAreaName,
|
|
|
CancellationToken cancellationToken)
|
|
|
{
|
|
|
- if (!workflow.IsCanHandle(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgId,
|
|
|
- _sessionContext.Roles)) return;
|
|
|
+ if (!workflow.IsCanHandle(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.RequiredOrgId,
|
|
|
+ _sessionContextProvider.SessionContext.Roles)) return;
|
|
|
//工单完成以后查看的场景
|
|
|
if (workflow.Status != EWorkflowStatus.Runnable) return;
|
|
|
|
|
|
- var currentStep = GetUnHandleStep(workflow.Steps, _sessionContext.RequiredOrgId,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.Roles);
|
|
|
+ var currentStep = GetUnHandleStep(workflow.Steps, _sessionContextProvider.SessionContext.RequiredOrgId,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.Roles);
|
|
|
if (currentStep.Status is not EWorkflowStepStatus.WaitForAccept) return;
|
|
|
|
|
|
if (currentStep.Handlers.All(d => d.Key != orgId && d.Key != userId)) return;
|
|
@@ -699,9 +691,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//结束会签
|
|
|
currentCountersign.End(currentStep.Id, currentStep.Code, currentStep.BusinessType,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName);
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName);
|
|
|
await _workflowCountersignRepository.UpdateAsync(currentCountersign, cancellationToken);
|
|
|
}
|
|
|
}
|
|
@@ -712,10 +704,10 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
if (isStartCountersign)
|
|
|
{
|
|
|
var exists = workflow.Countersigns.Any(d =>
|
|
|
- !d.IsCompleted() && d.StarterId == _sessionContext.RequiredUserId);
|
|
|
+ !d.IsCompleted() && d.StarterId == _sessionContextProvider.SessionContext.RequiredUserId);
|
|
|
if (exists)
|
|
|
throw new UserFriendlyException("该用户在当前流程存在未结束会签");
|
|
|
- await StartCountersignAsync(_sessionContext, workflow, currentStep, dto, flowAssignInfo.FlowAssignType,
|
|
|
+ await StartCountersignAsync(_sessionContextProvider.SessionContext, workflow, currentStep, dto, flowAssignInfo.FlowAssignType,
|
|
|
counterSignType, expiredTime, cancellationToken);
|
|
|
}
|
|
|
|
|
@@ -758,7 +750,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
//throw new UserFriendlyException(
|
|
|
// $"会签数据异常, workflowId: {currentStep.WorkflowId}, countersignId: {currentStep.CountersignId}",
|
|
|
// "会签数据异常");
|
|
|
- countersign.MemberHandled(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgId);
|
|
|
+ countersign.MemberHandled(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.RequiredOrgId);
|
|
|
//update cs
|
|
|
await _workflowCountersignRepository.UpdateNav(countersign)
|
|
|
.Include(d => d.Members)
|
|
@@ -801,12 +793,12 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
if (workflow.ActualHandleStepId == currentStep.Id)
|
|
|
{
|
|
|
//更新实际办理节点信息
|
|
|
- workflow.UpdateActualStepWhenHandle(currentStep, _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName, _sessionContext.OrgLevel);
|
|
|
+ workflow.UpdateActualStepWhenHandle(currentStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
}
|
|
|
|
|
|
if (workflow.CurrentStepId == currentStep.Id)
|
|
|
{
|
|
|
- workflow.UpdateCurrentStepWhenHandle(currentStep, _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName, _sessionContext.OrgLevel);
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(currentStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
}
|
|
|
|
|
|
//检查是否流转到流程终点
|
|
@@ -852,7 +844,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//更新会签实际办理对象信息
|
|
|
if (currentStep.IsActualHandled)
|
|
|
- workflow.AddCsActualHandler(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgId);
|
|
|
+ workflow.AddCsActualHandler(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.RequiredOrgId);
|
|
|
|
|
|
await _workflowRepository.UpdateAsync(workflow, cancellationToken);
|
|
|
|
|
@@ -867,7 +859,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
var currentTrace = workflow.Traces.First(d => d.Id == currentStep.Id);
|
|
|
await _publisher.PublishAsync(
|
|
|
new NextStepNotify(workflow, dto, flowAssignInfo, currentTrace, nextStepDefine,
|
|
|
- _sessionContext.RequiredOrgId, expiredTime.HasValue), PublishStrategy.ParallelWhenAll,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, expiredTime.HasValue), PublishStrategy.ParallelWhenAll,
|
|
|
cancellationToken);
|
|
|
}
|
|
|
|
|
@@ -1148,9 +1140,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
/// 批量修改工单办理对象
|
|
|
/// </summary>
|
|
|
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)
|
|
|
{
|
|
|
foreach (var handler in handlers)
|
|
@@ -1318,7 +1308,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
{
|
|
|
var workflow = await GetWorkflowAsync(workflowId, withSteps: true, withTraces: true,
|
|
|
cancellationToken: cancellationToken);
|
|
|
- // workflow.Assign(EFlowAssignType.User, _sessionContext.RequiredUserId);
|
|
|
+ // workflow.Assign(EFlowAssignType.User, _sessionContextProvider.SessionContext.RequiredUserId);
|
|
|
//
|
|
|
// workflow.HandlerOrgs = new();
|
|
|
// workflow.HandlerUsers = new List<HandlerGroupItem>
|
|
@@ -1542,10 +1532,11 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
/// <summary>
|
|
|
/// 特提至中心(优先派单组其次坐席)
|
|
|
/// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task RecallToCenterFirstToSendAsync(string workflowId, string opinion, bool isOrderFiled,
|
|
|
+ /// <returns>true 派单组 false 话务部</returns>
|
|
|
+ public async Task<bool> RecallToCenterFirstToSendAsync(string workflowId, string opinion, bool isOrderFiled,
|
|
|
DateTime? expiredTime, CancellationToken cancellationToken)
|
|
|
{
|
|
|
+ bool isPaiDan = true;
|
|
|
var workflow = await GetWorkflowAsync(workflowId, withDefine: true, withSteps: true, withTraces: true, withCountersigns: true,
|
|
|
cancellationToken: cancellationToken);
|
|
|
var sendStep = workflow.Steps.FirstOrDefault(d => d.BusinessType == EBusinessType.Send);
|
|
@@ -1617,7 +1608,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
//flowAssignInfo.FlowAssignType = EFlowAssignType.Role;
|
|
|
await RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, EWorkflowTraceType.Recall, expiredTime, isOrderFiled,
|
|
|
cancellationToken);
|
|
|
+ isPaiDan = false;
|
|
|
}
|
|
|
+ return isPaiDan;
|
|
|
}
|
|
|
|
|
|
//private async Task RecallToTargetStepAsync(Workflow workflow, WorkflowStep targetStep, string opinion, ISessionContext current,
|
|
@@ -1753,7 +1746,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
case EPathPolicy.DirectUpper:
|
|
|
break;
|
|
|
case EPathPolicy.DirectUpperCenterIsTop:
|
|
|
- var currentOrgLevel = _sessionContext.RequiredOrgId.CalcOrgLevel();
|
|
|
+ var currentOrgLevel = _sessionContextProvider.SessionContext.RequiredOrgId.CalcOrgLevel();
|
|
|
if (currentOrgLevel == 1)
|
|
|
{
|
|
|
nextStepDefines = nextStepDefines.Where(d => d.IsCenter()).ToList();
|
|
@@ -1784,9 +1777,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
var workflow = await GetWorkflowAsync(dto.WorkflowId, withDefine: true, withSteps: true,
|
|
|
cancellationToken: cancellationToken);
|
|
|
|
|
|
- var currentStep = GetUnHandleStep(workflow.Steps, _sessionContext.RequiredOrgId,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.Roles);
|
|
|
- //var (currentStepBox, currentStep) = GetUnCompleteStep(workflow.Steps, _sessionContext.RequiredOrgId, _sessionContext.RequiredUserId);
|
|
|
+ var currentStep = GetUnHandleStep(workflow.Steps, _sessionContextProvider.SessionContext.RequiredOrgId,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.Roles);
|
|
|
+ //var (currentStepBox, currentStep) = GetUnCompleteStep(workflow.Steps, _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.RequiredUserId);
|
|
|
|
|
|
var endStepDefine = workflow.WorkflowDefinition.FindEndStepDefine();
|
|
|
|
|
@@ -1835,6 +1828,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
startStep.IsMain = true;
|
|
|
startStep.IsOrigin = true;
|
|
|
startStep.Status = EWorkflowStepStatus.WaitForAccept;
|
|
|
+ startStep.FlowDirection = dto.FlowDirection;
|
|
|
startStep.PrevChosenStepCode = null;
|
|
|
if (expiredTime.HasValue)
|
|
|
startStep.StepExpiredTime = expiredTime;
|
|
@@ -1861,7 +1855,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
//};
|
|
|
|
|
|
//create endStep
|
|
|
- var endStep = await CreateEndStepAsync(workflow, endStepDefine, currentStep, expiredTime,
|
|
|
+ var endStep = await CreateEndStepAsync(workflow, endStepDefine, currentStep, dto, expiredTime,
|
|
|
cancellationToken);
|
|
|
//workflow.Steps.Add(endStep);
|
|
|
|
|
@@ -1871,7 +1865,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
workflow.Complete(endStep, dto.ReviewResult);
|
|
|
|
|
|
//需求调整:归档时当前节点显示为归档节点
|
|
|
- workflow.UpdateCurrentStepWhenHandle(endStep, _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName, _sessionContext.OrgLevel);
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(endStep, _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName, _sessionContextProvider.SessionContext.OrgLevel);
|
|
|
workflow.UpdateCurrentStepAcceptTime(endStep.AcceptTime.Value);
|
|
|
|
|
|
//workflow.UpdateActualStepWhenHandle(endStep, current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
|
|
@@ -1907,7 +1901,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
public ECounterSignType? GetCounterSignType(bool isStartCountersign)
|
|
|
{
|
|
|
if (!isStartCountersign) return null;
|
|
|
- return _sessionContext.OrgIsCenter ? ECounterSignType.Center : ECounterSignType.Department;
|
|
|
+ return _sessionContextProvider.SessionContext.OrgIsCenter ? ECounterSignType.Center : ECounterSignType.Department;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1948,20 +1942,23 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
if (dto.IsStartCountersign) return;
|
|
|
if (workflow.IsInCountersign) return;
|
|
|
|
|
|
- if (nextStepDefine.BusinessType is EBusinessType.Seat or EBusinessType.Send)
|
|
|
+ if (workflow.FlowType is EFlowType.Handle)
|
|
|
{
|
|
|
- //坐席->派单不选办理对象时
|
|
|
- workflow.UpdateCurrentStepWhenAssign(nextSteps.First(),
|
|
|
- new FlowStepHandler
|
|
|
- {
|
|
|
- OrgId = OrgSeedData.CenterId,
|
|
|
- OrgName = OrgSeedData.CenterName
|
|
|
- });
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var nextHandler = dto.NextHandlers.First();
|
|
|
- workflow.UpdateCurrentStepWhenAssign(nextSteps.First(), nextHandler);
|
|
|
+ if (nextStepDefine.BusinessType is EBusinessType.Seat or EBusinessType.Send)
|
|
|
+ {
|
|
|
+ //坐席->派单不选办理对象时
|
|
|
+ workflow.UpdateCurrentStepWhenAssign(nextSteps.First(),
|
|
|
+ new FlowStepHandler
|
|
|
+ {
|
|
|
+ OrgId = OrgSeedData.CenterId,
|
|
|
+ OrgName = OrgSeedData.CenterName
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var nextHandler = dto.NextHandlers.First();
|
|
|
+ workflow.UpdateCurrentStepWhenAssign(nextSteps.First(), nextHandler);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1972,20 +1969,23 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
if (workflow.IsInCountersign) return;
|
|
|
if (nextStepDefine.StepType is EStepType.Summary or EStepType.End) return;
|
|
|
|
|
|
- if (nextStepDefine.BusinessType is EBusinessType.Seat or EBusinessType.Send)
|
|
|
- {
|
|
|
- //坐席->派单不选办理对象时
|
|
|
- workflow.UpdateActualStepWhenAssign(nextSteps.First(),
|
|
|
- new FlowStepHandler
|
|
|
- {
|
|
|
- OrgId = OrgSeedData.CenterId,
|
|
|
- OrgName = OrgSeedData.CenterName
|
|
|
- });
|
|
|
- }
|
|
|
- else
|
|
|
+ if (workflow.FlowType is EFlowType.Handle)
|
|
|
{
|
|
|
- var nextHandler = dto.NextHandlers.First();
|
|
|
- workflow.UpdateActualStepWhenAssign(nextSteps.First(), nextHandler);
|
|
|
+ if (nextStepDefine.BusinessType is EBusinessType.Seat or EBusinessType.Send)
|
|
|
+ {
|
|
|
+ //坐席->派单不选办理对象时
|
|
|
+ workflow.UpdateActualStepWhenAssign(nextSteps.First(),
|
|
|
+ new FlowStepHandler
|
|
|
+ {
|
|
|
+ OrgId = OrgSeedData.CenterId,
|
|
|
+ OrgName = OrgSeedData.CenterName
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var nextHandler = dto.NextHandlers.First();
|
|
|
+ workflow.UpdateActualStepWhenAssign(nextSteps.First(), nextHandler);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//if ( /*workflow.FlowType is EFlowType.Handle &&*/
|
|
@@ -2284,10 +2284,10 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
/// </summary>
|
|
|
private void HandleStep(WorkflowStep step, string opinion, string nextStepCode)
|
|
|
{
|
|
|
- step.Handle(_sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
|
|
|
- _sessionContext.OrgIsCenter, opinion, nextStepCode);
|
|
|
+ step.Handle(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgIsCenter, opinion, nextStepCode);
|
|
|
|
|
|
//var handler = step.FindActualHandler(current.Roles, current.RequiredUserId, current.RequiredOrgId);
|
|
|
//if (handler is not null)
|
|
@@ -2393,7 +2393,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
{
|
|
|
//newStep.FlowAssignType = EFlowAssignType.User;
|
|
|
// 是否中心 临时紧急修改 后续在流程模版定义是否原办理人退回类型 来实现流程 禅道200
|
|
|
- newStep.FlowAssignType = step.HandlerOrgIsCenter!.Value
|
|
|
+ newStep.FlowAssignType = step.BusinessType is EBusinessType.Seat or EBusinessType.Send
|
|
|
? step.BusinessType is EBusinessType.Send ? EFlowAssignType.User : EFlowAssignType.Role
|
|
|
: EFlowAssignType.Org;
|
|
|
//if (newStep is { FlowAssignType: EFlowAssignType.Role, BusinessType: EBusinessType.Send })
|
|
@@ -2614,10 +2614,10 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
foreach (var trace in uncompleteTraces)
|
|
|
{
|
|
|
trace.Handle(
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
|
|
|
- _sessionContext.OrgIsCenter, dto.Opinion);
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgIsCenter, dto.Opinion);
|
|
|
}
|
|
|
|
|
|
//await _workflowTraceRepository.UpdateRangeAsync(uncompleteTraces, cancellationToken);
|
|
@@ -2672,9 +2672,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
foreach (var unCompleteCountersign in unCompleteCountersigns)
|
|
|
{
|
|
|
unCompleteCountersign.End(null, null, EBusinessType.File,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName);
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName);
|
|
|
}
|
|
|
|
|
|
await _workflowCountersignRepository.UpdateRangeAsync(unCompleteCountersigns, cancellationToken);
|
|
@@ -2757,6 +2757,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
Workflow workflow,
|
|
|
StepDefine endStepDefine,
|
|
|
WorkflowStep prevStep,
|
|
|
+ BasicWorkflowDto dto,
|
|
|
DateTime? expiredTime,
|
|
|
CancellationToken cancellationToken)
|
|
|
{
|
|
@@ -2765,21 +2766,21 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
var handler = new FlowStepHandler
|
|
|
{
|
|
|
- Key = _sessionContext.UserId,
|
|
|
- Value = _sessionContext.UserName,
|
|
|
- UserId = _sessionContext.RequiredUserId,
|
|
|
- Username = _sessionContext.UserName,
|
|
|
- OrgId = _sessionContext.OrgId,
|
|
|
- OrgName = _sessionContext.OrgName,
|
|
|
+ Key = _sessionContextProvider.SessionContext.UserId,
|
|
|
+ Value = _sessionContextProvider.SessionContext.UserName,
|
|
|
+ UserId = _sessionContextProvider.SessionContext.RequiredUserId,
|
|
|
+ Username = _sessionContextProvider.SessionContext.UserName,
|
|
|
+ OrgId = _sessionContextProvider.SessionContext.OrgId,
|
|
|
+ OrgName = _sessionContextProvider.SessionContext.OrgName,
|
|
|
};
|
|
|
|
|
|
var step = CreateStep(workflow, endStepDefine, prevStep, EFlowAssignType.User, handler,
|
|
|
null, null, EWorkflowStepStatus.WaitForAccept,
|
|
|
- ECountersignPosition.None, expiredTime, endStepDefine.Name, true, businessType: EBusinessType.File);
|
|
|
+ ECountersignPosition.None, expiredTime, endStepDefine.Name, true, businessType: EBusinessType.File, flowDirection: dto.FlowDirection);
|
|
|
|
|
|
- //step.Accept(_sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- // _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- // _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName);
|
|
|
+ //step.Accept(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ // _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ // _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName);
|
|
|
|
|
|
HandleStep(step, "流程归档", string.Empty);
|
|
|
|
|
@@ -2848,7 +2849,11 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
var isMain = handlers.Count == 1 || (handlers.Count > 1 && handler.Key == dto.NextMainHandler);
|
|
|
var step = CreateStep(workflow, stepDefine, prevStep, flowAssignType,
|
|
|
handler, dto.NextStepCode, countersignId, stepStatus, csPosition, expiredTime,
|
|
|
- dto.NextStepName, isOrigin, isMain, handlerType, dto.BusinessType);
|
|
|
+ dto.NextStepName, isOrigin, isMain, handlerType, dto.BusinessType, dto.FlowDirection);
|
|
|
+
|
|
|
+ //var stepHandler = stepHandlers.First(d => d.GetHandler().Key == handler.Key);
|
|
|
+ //step.StepHandlers = new List<WorkflowStepHandler> { stepHandler };
|
|
|
+
|
|
|
steps.Add(step);
|
|
|
}
|
|
|
|
|
@@ -2920,8 +2925,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
throw new UserFriendlyException(
|
|
|
$"TerminalDynamicMark parse to int failed, tMark: {currentStepDefine.TerminalDynamicMark}");
|
|
|
var leadRoleCode = _systemSettingCacheManager.GetSetting(SettingConstants.RoleLingDao)?.SettingValue[0];
|
|
|
- var isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
|
|
|
- return (currentOrgLevel <= tMark2) && isLead;
|
|
|
+ var isLead = _sessionContextProvider.SessionContext.Roles.Any(x => x == leadRoleCode);
|
|
|
+ return (currentOrgLevel <= tMark2) && (isLead || _sessionContextProvider.SessionContext.OrgIsCenter);
|
|
|
case EDynamicPolicy.OrgDownCenterTop:
|
|
|
case EDynamicPolicy.OrgDown:
|
|
|
if (!int.TryParse(currentStepDefine.TerminalDynamicMark, out var tMark1))
|
|
@@ -3055,16 +3060,16 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
ref List<WorkflowStep> updateSteps, ref List<WorkflowTrace> updateTraces)
|
|
|
{
|
|
|
var isHandled = step.Status is EWorkflowStepStatus.Handled;
|
|
|
- var opinion = $"会签未办理完成,由 {_sessionContext.OrgName} 的 {_sessionContext.UserName} 终止办理";
|
|
|
+ var opinion = $"会签未办理完成,由 {_sessionContextProvider.SessionContext.OrgName} 的 {_sessionContextProvider.SessionContext.UserName} 终止办理";
|
|
|
if (step.IsStartCountersign)
|
|
|
step.CountersignEnd();
|
|
|
|
|
|
if (step.Status is not EWorkflowStepStatus.Handled)
|
|
|
{
|
|
|
- step.Handle(_sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
|
|
|
- _sessionContext.OrgIsCenter, opinion);
|
|
|
+ step.Handle(_sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgIsCenter, opinion);
|
|
|
}
|
|
|
|
|
|
updateSteps.Add(step);
|
|
@@ -3107,9 +3112,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
//todo 1. trace? 先确定展现形式 2. end cs
|
|
|
|
|
|
countersign.End(null, null, businessType,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName);
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName);
|
|
|
|
|
|
/*
|
|
|
* //结束step会签信息
|
|
@@ -3118,9 +3123,9 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//结束会签
|
|
|
currentCountersign.End(currentStep.Id, currentStep.Code, currentStep.BusinessType,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
- _sessionContext.RequiredOrgId, _sessionContext.OrgName,
|
|
|
- _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName);
|
|
|
+ _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContextProvider.SessionContext.RequiredOrgId, _sessionContextProvider.SessionContext.OrgName,
|
|
|
+ _sessionContextProvider.SessionContext.OrgAreaCode, _sessionContextProvider.SessionContext.OrgAreaName);
|
|
|
await _workflowCountersignRepository.UpdateAsync(currentCountersign, cancellationToken);
|
|
|
*/
|
|
|
|
|
@@ -3147,7 +3152,8 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
bool isOrigin,
|
|
|
bool isMainHandler = false,
|
|
|
EHandlerType? handlerType = null, //动态节点依据动态策略判断
|
|
|
- EBusinessType? businessType = null
|
|
|
+ EBusinessType? businessType = null,
|
|
|
+ EFlowDirection? flowDirection = null
|
|
|
)
|
|
|
{
|
|
|
//if (!handlers.Any())
|
|
@@ -3164,6 +3170,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
step.CountersignId = countersignId;
|
|
|
step.Status = stepStatus;
|
|
|
step.CountersignPosition = countersignPosition;
|
|
|
+ step.FlowDirection = flowDirection;
|
|
|
if (expiredTime.HasValue)
|
|
|
step.StepExpiredTime = expiredTime;
|
|
|
//step.TimeLimit = GetTimeLimit("");
|