|
@@ -92,6 +92,8 @@ public class WorkflowController : BaseController
|
|
|
_fileRepository = fileRepository;
|
|
|
}
|
|
|
|
|
|
+ #region definition
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 分页查询最新版本号的模板
|
|
|
/// </summary>
|
|
@@ -248,6 +250,60 @@ public class WorkflowController : BaseController
|
|
|
await _definitionDomainService.PublishAsync(dto, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region WorkflowModule
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 持久化新增工作流业务
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("wfmodule/persistence")]
|
|
|
+ public async Task PersistenceWfModule()
|
|
|
+ {
|
|
|
+ await _wfModuleDomainService.PersistenceModulesAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查询所有工作流模块
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("wfmodules")]
|
|
|
+ public async Task<IReadOnlyList<WorkflowModule>> QueryWfModules()
|
|
|
+ {
|
|
|
+ return await _wfModuleRepository.Queryable()
|
|
|
+ .Includes(d => d.Definition)
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 为工作流业务匹配或取消流程模板
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPut("wfmodule/match")]
|
|
|
+ public async Task MatchDefinition([FromBody] MatchDefinitionDto dto)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.DefinitionId))
|
|
|
+ {
|
|
|
+ //取消当前已配置模板
|
|
|
+ await _wfModuleDomainService.MatchDefinitionAsync(dto, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var definition = await _definitionRepository.GetAsync(dto.DefinitionId);
|
|
|
+ if (definition == null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效模板编号");
|
|
|
+ if (definition.Status != EDefinitionStatus.Enable)
|
|
|
+ throw UserFriendlyException.SameMessage("该模板未发布");
|
|
|
+ await _wfModuleDomainService.MatchDefinitionAsync(dto, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region workflow
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 分页查询流程
|
|
|
/// </summary>
|
|
@@ -272,45 +328,12 @@ public class WorkflowController : BaseController
|
|
|
[HttpGet("{workflowId}/nextsteps")]
|
|
|
public async Task<NextStepsDto> GetNextStepDefine(string workflowId)
|
|
|
{
|
|
|
- //var workflow = await _workflowDomainService.GetWorkflowAsync(workflowId, true, true,
|
|
|
- // cancellationToken: HttpContext.RequestAborted);
|
|
|
- //var current = _workflowDomainService.FindCurrentStep(workflow);
|
|
|
- //var nextStepDefines = workflow.WorkflowDefinition.FindStepDefines(current.StepBox.NextSteps.Select(d => d.Code));
|
|
|
-
|
|
|
- //if (current.StepBox.PathPolicy is not EPathPolicy.None && current.StepBox.NextSteps.Count > 1)
|
|
|
- // _workflowDomainService.NextStepDefineFilter(current.StepBox.PathPolicy, nextStepDefines);
|
|
|
-
|
|
|
- //return new DefinedStepDto
|
|
|
- //{
|
|
|
- // DefinitionId = workflow.DefinitionId,
|
|
|
- // Steps = _mapper.Map<IReadOnlyList<StepBasicDto>>(nextStepDefines),//nextStepDefines.Select(d => new KeyValuePair<string, string>(d.Code, d.Name)).ToList(),
|
|
|
- // ExpiredTime = workflow.ExpiredTime,
|
|
|
- // Components = current.StepBox.Components,
|
|
|
- //};
|
|
|
-
|
|
|
return await _workflowApplication.GetNextStepsAsync(workflowId, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
- ///// <summary>
|
|
|
- ///// 查询流程下一节点待选配置
|
|
|
- ///// </summary>
|
|
|
- //[HttpGet("step-options")]
|
|
|
- //public async Task<NextStepOptionDto> GetNextStepOptions([FromQuery] QueryNextStepOptionDto dto)
|
|
|
- //{
|
|
|
- // var definition = await _definitionRepository.GetAsync(dto.DefineId, HttpContext.RequestAborted);
|
|
|
- // if (definition == null)
|
|
|
- // throw new UserFriendlyException("无效DefineId");
|
|
|
-
|
|
|
- // var defineStep = definition.FindStepDefine(dto.Code);
|
|
|
- // if (defineStep is null)
|
|
|
- // throw UserFriendlyException.SameMessage("未查询到对应节点配置");
|
|
|
- // return await _workflowApplication.GetNextStepOptionsAsync(defineStep, HttpContext.RequestAborted);
|
|
|
- //}
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 办理节点
|
|
|
/// </summary>
|
|
|
- //[Permission(EPermission.FlowNext)]
|
|
|
[HttpPost("next")]
|
|
|
public async Task Next([FromBody] NextWorkflowDto dto)
|
|
|
{
|
|
@@ -320,7 +343,6 @@ public class WorkflowController : BaseController
|
|
|
/// <summary>
|
|
|
/// 退回(返回前一节点)
|
|
|
/// </summary>
|
|
|
- //[Permission(EPermission.FlowPrevious)]
|
|
|
[HttpPost("previous")]
|
|
|
public async Task Previous([FromBody] PreviousWorkflowDto dto)
|
|
|
{
|
|
@@ -466,20 +488,17 @@ public class WorkflowController : BaseController
|
|
|
var workflowDto = _mapper.Map<WorkflowDto>(workflow);
|
|
|
if (workflowDto.Traces.Any())
|
|
|
{
|
|
|
- workflowDto.Traces = await _fileRepository.WorkflowTraceRecursion(workflowDto.Traces, HttpContext.RequestAborted);
|
|
|
+ workflowDto.Traces = await _fileRepository.WorkflowTraceRecursion(workflowDto.Traces, HttpContext.RequestAborted);
|
|
|
}
|
|
|
return workflowDto;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 查询被督办/催办部门
|
|
|
- /// </summary>
|
|
|
- /// <param name="workflowId"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("{workflowId}/urge")]
|
|
|
+ /// <summary>
|
|
|
+ /// 查询被督办/催办部门
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="workflowId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("{workflowId}/urge")]
|
|
|
public async Task<IReadOnlyList<Kv>> GetUrgeOrgs(string workflowId)
|
|
|
{
|
|
|
/*
|
|
@@ -535,52 +554,6 @@ public class WorkflowController : BaseController
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 持久化新增工作流业务
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("wfmodule/persistence")]
|
|
|
- public async Task PersistenceWfModule()
|
|
|
- {
|
|
|
- await _wfModuleDomainService.PersistenceModulesAsync(HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 查询所有工作流模块
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("wfmodules")]
|
|
|
- public async Task<IReadOnlyList<WorkflowModule>> QueryWfModules()
|
|
|
- {
|
|
|
- return await _wfModuleRepository.Queryable()
|
|
|
- .Includes(d => d.Definition)
|
|
|
- .ToListAsync();
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 为工作流业务匹配或取消流程模板
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPut("wfmodule/match")]
|
|
|
- public async Task MatchDefinition([FromBody] MatchDefinitionDto dto)
|
|
|
- {
|
|
|
- if (string.IsNullOrEmpty(dto.DefinitionId))
|
|
|
- {
|
|
|
- //取消当前已配置模板
|
|
|
- await _wfModuleDomainService.MatchDefinitionAsync(dto, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var definition = await _definitionRepository.GetAsync(dto.DefinitionId);
|
|
|
- if (definition == null)
|
|
|
- throw UserFriendlyException.SameMessage("无效模板编号");
|
|
|
- if (definition.Status != EDefinitionStatus.Enable)
|
|
|
- throw UserFriendlyException.SameMessage("该模板未发布");
|
|
|
- await _wfModuleDomainService.MatchDefinitionAsync(dto, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 查询会签信息
|
|
|
/// </summary>
|
|
@@ -614,4 +587,7 @@ public class WorkflowController : BaseController
|
|
|
|
|
|
return new PagedDto<WorkflowCountersignDto>(total, dtos);
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
}
|