refactor(workflow): 优化工作流引擎代码结构

- 将业务编号前缀定义为类级别常量,提高代码可维护性
- 统一使用类级别的prefix常量替换硬编码字符串
- 修复左连接查询中的参数命名格式,提升代码一致性
- 清理重复的前缀变量声明,减少代码冗余
main
陈伟 2026-02-08 10:36:08 +08:00
parent c99ac186d0
commit ef2ffc146b
1 changed files with 5 additions and 4 deletions

View File

@ -19,6 +19,8 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
private readonly BusinessNoGenerator _businessNoGenerator;
private readonly string prefix = "wfjszl";
public WorkflowEngineApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<SysCategoryType> repository,
IAuth auth, BusinessNoGenerator businessNoGenerator) : base(unitWork, repository, auth)
@ -131,7 +133,6 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
else
{
// 取号
var prefix = "wfjszl";
var businessNo = _businessNoGenerator.GenerateBusinessNo(prefix);
requestDto.BusinessNo = businessNo;
@ -1051,7 +1052,7 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
{
if (string.IsNullOrEmpty(requestDto.BusinessNo))
{
var businessNo = _businessNoGenerator.GenerateBusinessNo("wf");
var businessNo = _businessNoGenerator.GenerateBusinessNo(prefix);
UnitWork.Db.Ado.BeginTran();
var user = _auth.GetCurrentUser().User;
var illegalConstructionAssessment = new IllegalConstructionAssessment
@ -1173,10 +1174,10 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
.Queryable<ZyFlowWorkitem>()
.LeftJoin<ZyFlowParallelAudit>((w, a)
=> w.InstanceId == a.InstanceId && w.HandlerId == a.AuditorId)
.LeftJoin<ZyFlowNode>((w,a,n)=>w.NodeId == n.NodeId)
.LeftJoin<ZyFlowNode>((w, a, n) => w.NodeId == n.NodeId)
.Where(w => w.InstanceId == instance.InstanceId)
.OrderByDescending(w => w.WorkitemId)
.Select((w, a,n) => new
.Select((w, a, n) => new
ZyFlowWorkitem
{
WorkitemId = w.WorkitemId,