xf hace 1 año
padre
commit
b65d0fab29

+ 10 - 0
src/Hotline.Api/Controllers/OrderController.cs

@@ -2281,6 +2281,16 @@ public class OrderController : BaseController
             HttpContext.RequestAborted);
     }
 
+    /// <summary>
+    /// 工单办理
+    /// </summary>
+    [HttpPost("handle")]
+    public async Task Handle([FromBody] NextWorkflowDto dto)
+    {
+        //todo 验证是否有在审核中的延期
+        await _workflowApplication.NextAsync(dto, HttpContext.RequestAborted);
+    }
+
     /// <summary>
     /// 结束会签
     /// </summary>

+ 66 - 90
src/Hotline.Api/Controllers/WorkflowController.cs

@@ -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
+
 }

+ 3 - 0
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -749,6 +749,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                 Value = stepDefine.Name,
                 StepType = stepDefine.StepType,
                 BusinessType = stepDefine.BusinessType,
+                HandlerType = stepDefine.HandlerType,
                 Items = handlers
             };
         }
@@ -871,6 +872,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
             BackToCountersignEnd = true,
             StepType = prevStep.StepType,
             BusinessType = prevStep.BusinessType,
+            HandlerType = prevStep.HandlerType,
             Items = handlers //new List<Kv> { new(prevStep.HandlerId, prevStep.HandlerName) },
         };
     }
@@ -987,6 +989,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
             FlowDirection = null,
             StepType = stepType,
             BusinessType = businessType,
+            HandlerType = EHandlerType.OrgLevel,//目前所有动态策略均属于部门等级
             Items = items
         };
     }

+ 5 - 0
src/Hotline.Share/Dtos/FlowEngine/NextStepOption.cs

@@ -29,6 +29,11 @@ public class NextStepOption : Kv
     /// </summary>
     public EBusinessType BusinessType { get; set; }
 
+    /// <summary>
+    /// 办理对象类型
+    /// </summary>
+    public EHandlerType HandlerType { get; set; }
+
     /// <summary>
     /// 节点下可选办理对象
     /// </summary>

+ 0 - 25
src/Hotline.Share/Dtos/FlowEngine/NextStepsDto.cs

@@ -43,28 +43,3 @@ public class GetNextStepItemsDto
     public EDynamicPolicy DynamicPolicy { get; set; }
     public NextStepOption Step { get; set; }
 }
-
-// /// <summary>
-// /// 撤回可选节点参数
-// /// </summary>
-// public class RecallStepsDto
-// {
-//     public IReadOnlyList<RecallStepOption> Steps { get; set; }
-//
-//     //public DateTime? ExpiredTime { get; set; }
-//
-//     /// <summary>
-//     /// 是否有否决按钮
-//     /// </summary>
-//     public bool CanReject { get; set; }
-//
-//     /// <summary>
-//     /// 是否支持发起会签
-//     /// </summary>
-//     public bool CanStartCountersign { get; set; }
-//
-//     /// <summary>
-//     /// 办理时限时间类型待选参数
-//     /// </summary>
-//     public IReadOnlyList<KeyValuePair<int, string>> TimeTypeOptions { get; set; }
-// }