feat(workflow): 添加工作项ID字段并完善流程处理逻辑

- 在FlowQuerySingleResultDto中添加workitemId字段
- 移除未使用的命名空间引用
- 更新处理工作项注释,增加驳回功能说明
- 添加开始节点无ToDo的注释说明
- 完善工作项处理逻辑,支持通过和驳回两种审核结果
- 修复汇总节点名称从"汇总"改为"汇总判断"
- 在查询单个流程结果时设置workitemId值
- 添加关于流程及个人处理状态处置的TODO注释
main
陈伟 2026-02-05 16:25:17 +08:00
parent 11e4190d85
commit 097dac13af
3 changed files with 42 additions and 35 deletions

View File

@ -82,6 +82,7 @@ public class PageQueryRequestDto : PageReq
/// </summary>
public class FlowQuerySingleResultDto
{
public long workitemId;
/// <summary>
/// 流程实例ID唯一标识该流程实例用于后续操作
/// </summary>

View File

@ -91,6 +91,7 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
};
instanceId = _sqlSugar.Insertable(flowInstance).ExecuteReturnIdentity();
// 步骤4插入开始节点工作项直接标记为已完成
// 开始节点无ToDo
var startWorkitem = new ZyFlowWorkitem
{
InstanceId = instanceId,
@ -198,12 +199,15 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
if (flowInstance == null || currentNode == null)
throw new Exception("流程实例或流程节点不存在");
if (requestDto.AuditResult is "Pass")
{
// 步骤3更新当前工作项为已完成
workitem.Status = "Done";
workitem.HandleTime = DateTime.Now;
workitem.Comment = string.IsNullOrEmpty(requestDto.Comment) ? "处理完成" : requestDto.Comment;
_sqlSugar.Updateable(workitem).ExecuteCommand();
// 生成下一节点数据
// 步骤4按节点类型分支处理核心逻辑
switch (currentNode.NodeType)
{
@ -212,13 +216,13 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
FlowToNextNode(flowInstance.InstanceId, currentNode, userId, userName, workitem.Comment);
break;
// 并行节点5个审核科会签
// 并行节点5个审核科会签 // todo
case "Parallel" when _auditDeptRoleIds.Contains(currentNode.RoleId):
ProcessParallelAudit(flowInstance.InstanceId, currentNode.NodeId, userId, userName, requestDto);
break;
// 分支节点:汇总(归档/退回区县)
case "Branch" when currentNode.NodeName == "汇总":
case "Branch" when currentNode.NodeName == "汇总判断":
ProcessSummaryNode(flowInstance, currentNode, userId, userName);
break;
@ -232,6 +236,11 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
UnitWork.Db.Ado.CommitTran();
return true;
}
else // Reject todo 考虑驳回之后,怎么回到上一个节点
{
return true;
}
}
catch (Exception ex)
{
// 回滚事务
@ -356,6 +365,7 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
var type = zyflowVarList.Where(v => v.VarKey == "Type").First()?.VarValue;
dataList.Add(new FlowQuerySingleResultDto
{
workitemId = workitem.WorkitemId,
InstanceId = flowInstance.InstanceId,
BusinessNo = flowInstance.BusinessNo,
Title = flowTitle,

View File

@ -1,14 +1,10 @@
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.Interface;
using OpenAuth.App.workflow;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Domain.workflow;
namespace OpenAuth.WebApi.Controllers.ServerController;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.Interface;
// todo 关于针对流程及个人的处理状态处置
/// <summary>
/// 工作流核心API接口流程发起/处理 + 拟办/待办/已办/未办结/已完成/全部事项查询)
/// </summary>
@ -58,7 +54,7 @@ public class WorkflowController : ControllerBase
}
/// <summary>
/// 处理工作项(执法监督科转发/审核科会签/汇总处理
/// 处理工作项(执法监督科转发/审核科会签/汇总处理 todo 驳回
/// </summary>
/// <param name="requestDto">处理工作项请求参数</param>
/// <returns>处理结果</returns>