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

- 将ZyFlowVariable实例化语法简化为对象初始化器
- 修正附件路径组合逻辑,从当前目录切换到基础目录
- 移除不必要的wwwroot前缀并改进路径构建方式
main
陈伟 2026-02-05 09:55:29 +08:00
parent cbe0e794db
commit 21f676155d
1 changed files with 5 additions and 4 deletions

View File

@ -129,9 +129,9 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
var attachmentPaths = SaveAttachments(requestDto.Attachments);
var flowVariables = new List<ZyFlowVariable>
{
new ZyFlowVariable { InstanceId = instanceId, VarKey = "Title", VarValue = requestDto.Title },
new ZyFlowVariable { InstanceId = instanceId, VarKey = "AttachmentPaths", VarValue = attachmentPaths },
new ZyFlowVariable
new() { InstanceId = instanceId, VarKey = "Title", VarValue = requestDto.Title },
new() { InstanceId = instanceId, VarKey = "AttachmentPaths", VarValue = attachmentPaths },
new()
{
InstanceId = instanceId, VarKey = "SubmitTime",
VarValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
@ -862,7 +862,8 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
return string.Empty;
// 定义附件存储目录
var uploadDir = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/Attachments/FlowAttachments");
var uploadDir = Path
.Combine(AppContext.BaseDirectory, "Attachments/FlowAttachments");
if (!Directory.Exists(uploadDir))
Directory.CreateDirectory(uploadDir);