245 lines
9.9 KiB
C#
245 lines
9.9 KiB
C#
using Microsoft.AspNetCore.Http;
|
||
using SqlSugar;
|
||
|
||
namespace workflow;
|
||
|
||
#region 流程核心实体(映射 zy_ 前缀表)
|
||
|
||
[SugarTable("zy_flow_template", TableDescription = "流程模板表")]
|
||
public class FlowTemplate
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, ColumnName = "template_id", IsIdentity = true, ColumnDescription = "模板主键ID")]
|
||
public long TemplateId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "flow_name", ColumnDescription = "流程名称")]
|
||
public string FlowName { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "flow_code", ColumnDescription = "流程编码")]
|
||
public string FlowCode { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "true", ColumnName = "is_enabled", ColumnDescription = "是否启用")]
|
||
public bool IsEnabled { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "CURRENT_TIMESTAMP", ColumnName = "create_time", ColumnDescription = "创建时间")]
|
||
public DateTime CreateTime { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "remark", ColumnDescription = "备注信息")]
|
||
public string Remark { get; set; }
|
||
}
|
||
|
||
[SugarTable("zy_flow_node", TableDescription = "流程节点表")]
|
||
public class FlowNode
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "node_id", ColumnDescription = "节点主键ID")]
|
||
public long NodeId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "template_id", ColumnDescription = "关联模板ID")]
|
||
public long TemplateId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "node_name", ColumnDescription = "节点名称")]
|
||
public string NodeName { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "node_type",
|
||
ColumnDescription = "节点类型:Start/Common/Parallel/Branch/End")]
|
||
public string NodeType { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "role_id", ColumnDescription = "关联角色ID")]
|
||
public long RoleId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "next_node_ids", ColumnDescription = "下一步节点ID列表(逗号分隔)")]
|
||
public string NextNodeIds { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "true", ColumnName = "is_backable", ColumnDescription = "是否可退回")]
|
||
public bool IsBackable { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "0", ColumnName = "sort_no", ColumnDescription = "节点排序号")]
|
||
public int SortNo { get; set; }
|
||
|
||
[SugarColumn(IsIgnore = true)]
|
||
public List<long> NextNodeIdList => string.IsNullOrEmpty(NextNodeIds)
|
||
? new List<long>()
|
||
: NextNodeIds.Split(',').Select(long.Parse).ToList();
|
||
}
|
||
|
||
[SugarTable("zy_flow_instance", TableDescription = "流程实例表")]
|
||
public class FlowInstance
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "instance_id", ColumnDescription = "实例主键ID")]
|
||
public long InstanceId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "template_id", ColumnDescription = "关联模板ID")]
|
||
public long TemplateId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "flow_code", ColumnDescription = "流程编码")]
|
||
public string FlowCode { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "business_no", ColumnDescription = "业务编号")]
|
||
public string BusinessNo { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "status",
|
||
ColumnDescription = "流程状态:Submitted/Forwarded/Auditing/Summarized/Completed/Rejected")]
|
||
public string Status { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "current_node_id", ColumnDescription = "当前节点ID")]
|
||
public long CurrentNodeId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "initiator_id", ColumnDescription = "发起人用户ID")]
|
||
public long InitiatorId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "initiator_name", ColumnDescription = "发起人名称")]
|
||
public string InitiatorName { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "CURRENT_TIMESTAMP", ColumnName = "create_time", ColumnDescription = "发起时间")]
|
||
public DateTime CreateTime { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "finish_time", ColumnDescription = "流程结束时间")]
|
||
public DateTime? FinishTime { get; set; }
|
||
}
|
||
|
||
[SugarTable("zy_flow_workitem", TableDescription = "流程工作项表")]
|
||
public class FlowWorkitem
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "workitem_id", ColumnDescription = "工作项主键ID")]
|
||
public long WorkitemId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "instance_id", ColumnDescription = "关联实例ID")]
|
||
public long InstanceId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "node_id", ColumnDescription = "关联节点ID")]
|
||
public long NodeId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "node_name", ColumnDescription = "节点名称(冗余)")]
|
||
public string NodeName { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "handler_id", ColumnDescription = "处理人用户ID")]
|
||
public long? HandlerId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "handler_name", ColumnDescription = "处理人名称")]
|
||
public string HandlerName { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "status", ColumnDescription = "工作项状态:ToDo/Done/Rejected")]
|
||
public string Status { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "CURRENT_TIMESTAMP", ColumnName = "receive_time", ColumnDescription = "接收时间")]
|
||
public DateTime ReceiveTime { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "handle_time", ColumnDescription = "处理时间")]
|
||
public DateTime? HandleTime { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "comment", ColumnDescription = "处理意见/备注")]
|
||
public string Comment { get; set; }
|
||
}
|
||
|
||
[SugarTable("zy_flow_variable", TableDescription = "流程变量表")]
|
||
public class FlowVariable
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, ColumnName = "var_id", IsIdentity = true, ColumnDescription = "变量主键ID")]
|
||
public long VarId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "instance_id", ColumnDescription = "关联实例ID")]
|
||
public long InstanceId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "var_key", ColumnDescription = "变量键")]
|
||
public string VarKey { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "var_value", ColumnDataType = "text", ColumnDescription = "变量值")]
|
||
public string VarValue { get; set; }
|
||
}
|
||
|
||
[SugarTable("zy_flow_parallel_audit", TableDescription = "并行审核结果表")]
|
||
public class FlowParallelAudit
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "audit_id", ColumnDescription = "审核结果主键ID")]
|
||
public long AuditId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "instance_id", ColumnDescription = "关联实例ID")]
|
||
public long InstanceId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "node_id", ColumnDescription = "关联节点ID")]
|
||
public long NodeId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "dept_name", ColumnDescription = "审核科室名称")]
|
||
public string DeptName { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "audit_result", ColumnDescription = "审核结果:Pass/Reject")]
|
||
public string AuditResult { get; set; }
|
||
|
||
[SugarColumn(IsNullable = true, ColumnName = "audit_comment", ColumnDescription = "审核意见")]
|
||
public string AuditComment { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "auditor_id", ColumnDescription = "审核人用户ID")]
|
||
public long AuditorId { get; set; }
|
||
|
||
[SugarColumn(IsNullable = false, ColumnName = "auditor_name", ColumnDescription = "审核人名称")]
|
||
public string AuditorName { get; set; }
|
||
|
||
[SugarColumn(DefaultValue = "CURRENT_TIMESTAMP", ColumnName = "audit_time", ColumnDescription = "审核时间")]
|
||
public DateTime AuditTime { get; set; }
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 前后端交互模型(无数据库映射)
|
||
|
||
public class InitiateFlowRequest
|
||
{
|
||
public string FlowCode { get; set; }
|
||
public string BusinessNo { get; set; }
|
||
public string Title { get; set; }
|
||
public string BusinessType { get; set; }
|
||
public List<IFormFile> Attachments { get; set; }
|
||
}
|
||
|
||
public class HandleWorkitemRequest
|
||
{
|
||
public long WorkitemId { get; set; }
|
||
public string Comment { get; set; }
|
||
public string AuditResult { get; set; }
|
||
public string DeptName { get; set; }
|
||
}
|
||
|
||
public class FlowQueryResult
|
||
{
|
||
public long InstanceId { get; set; }
|
||
public string BusinessNo { get; set; }
|
||
public string Title { get; set; }
|
||
public string NodeName { get; set; }
|
||
public string Status { get; set; }
|
||
public DateTime CreateTime { get; set; }
|
||
public string InitiatorName { get; set; }
|
||
}
|
||
|
||
public class FlowInstanceQueryResult
|
||
{
|
||
public long InstanceId { get; set; }
|
||
public string BusinessNo { get; set; }
|
||
public string Title { get; set; }
|
||
public string FlowName { get; set; }
|
||
public string CurrentNodeName { get; set; }
|
||
public string Status { get; set; }
|
||
public string InitiatorName { get; set; }
|
||
public DateTime CreateTime { get; set; }
|
||
public DateTime? FinishTime { get; set; }
|
||
}
|
||
|
||
public class AssessmentFlowUnionResult
|
||
{
|
||
// 表单字段
|
||
public string FormId { get; set; }
|
||
public string Title { get; set; }
|
||
public string BusinessNumber { get; set; }
|
||
public string Type { get; set; }
|
||
public string Attachments { get; set; }
|
||
public DateTime? AcceptanceTime { get; set; }
|
||
|
||
// 流程字段
|
||
public long FlowInstanceId { get; set; }
|
||
public string FlowName { get; set; }
|
||
public string CurrentNodeName { get; set; }
|
||
public string FlowStatus { get; set; }
|
||
public string InitiatorName { get; set; }
|
||
public DateTime FlowCreateTime { get; set; }
|
||
public DateTime? FlowFinishTime { get; set; }
|
||
}
|
||
|
||
#endregion |