Ruth.JYC.ELSA.Services
2026.6.6
dotnet add package Ruth.JYC.ELSA.Services --version 2026.6.6
NuGet\Install-Package Ruth.JYC.ELSA.Services -Version 2026.6.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ruth.JYC.ELSA.Services" Version="2026.6.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ruth.JYC.ELSA.Services" Version="2026.6.6" />
<PackageReference Include="Ruth.JYC.ELSA.Services" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ruth.JYC.ELSA.Services --version 2026.6.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ruth.JYC.ELSA.Services, 2026.6.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ruth.JYC.ELSA.Services@2026.6.6
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ruth.JYC.ELSA.Services&version=2026.6.6
#tool nuget:?package=Ruth.JYC.ELSA.Services&version=2026.6.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ELSA 工作流扩展库 — 概览与使用说明
概述
- 本类库基于 Elsa 工作流引擎,提供企业级审批/签字工作流基础构件,适用于审批、会签、并行签字、动态指派等场景。
- 目标是把工作流控制与业务数据持久化、签字记录、审批历史等有机结合,支持前端指定审批人并能在审批恢复时携带业务数据与“下一节点”信息。
核心概念
- WF_ApplicationDto:业务申请 DTO,包含编号、类型、状态、业务数据(ApplicationData)、签字记录等,是活动间传递的核心对象。
- PayloadStimulus:Bookmark 载荷,包含 CorrelationId、RequiredUserId、RequiredRole、NodeType 等,用于恢复时定位与传递节点元数据。
- SignNodeConfig:签字节点的配置(角色编码、节点名称、显示文本等),由配置集合读取并传入活动。
- ResumerApprovalTasksRequest:外部恢复请求模型,包含 AssigneeUserId、WF_ApplicationDto(可选用于更新业务数据)、NextPayload(可选指定下一个节点)与 SignStatus 等。
主要活动与职责
WaitSignForSelectedUsers
- 功能:等待指定处理人(前端可指定)或从角色成员服务获取候选人,为每位候选人创建 Bookmark;恢复时追加签字记录、更新申请状态,并可将 NextPayload 与更新后的 WF_ApplicationDto 输出到工作流变量。
- 输入:Config、Application、Payload
- 输出:IsApproved、NextPayload(可选)、ApplicationOut(更新后的申请)
WaitSign(保持兼容)
- 功能:保留原有 Office 签字行为,按角色成员自动创建 Bookmark,兼容历史流程。
InitActivity(如 RepairWorkflowInitActivity / TaskOrderInitActivity)
- 功能:从 WorkflowExecutionContext.Input 或 CorrelationId 加载申请、初始化 Payload、更新状态并写历史。
CompleteActivity(如 RepairWorkflowCompleteActivity)
- 功能:将申请标记为 COMPLETED,并执行业务侧保存(如保存工单记录等)。
工作流设计要点
- 使用工作流变量(application、payload、isApproved)在活动间传递状态。
- 建议在工作流定义中显式绑定 WaitSignForSelectedUsers 的 ApplicationOut 与 NextPayload 到工作流变量,确保后续节点读取到最新数据与下一个节点信息。
- 在恢复 Bookmark 时,必须把 ResumerApprovalTasksRequest 放入 WorkflowInput,Key 为 "request"(与活动内读取逻辑一致)。
Blazor 前端示例(伪代码)
- 构造 ResumerApprovalTasksRequest 并提交到后端恢复接口:
- 包含 SignStatus、WF_ApplicationDto(如修改了 ApplicationData)、NextPayload(如需指定下一节点)、BookmarksId。
后端恢复要点(伪代码)
- 将请求对象放入 Dictionary<string, object> workflowInput = { ["request"] = request }。
- 调用 Elsa 提供的恢复 Bookmark 的服务或项目中封装的 resume 接口,定位 bookmarkId 或 activityInstanceId 并传入 workflowInput。
扩展与最佳实践
- 保持 Application 的一致性:活动对 WF_ApplicationDto 的变更,应通过 ApplicationOut 输出或通过数据库重新加载并写回,避免数据不同步。
- NextPayload 模式:当需要动态指定下一处理人或节点时,使用 ResumerApprovalTasksRequest.NextPayload 写回工作流变量。
- 并行会签:可结合 CustomFork 等并行构造与 WaitAll/WaitAny 策略实现多角色会签。
- 日志与审计:每次签字应写历史记录(IWF_Act_LogService)以便审计和回溯。
- 保持向后兼容:保留原有 WaitSign 行为以兼容历史流程,新增前端指定用户场景使用 WaitSignForSelectedUsers。
可交付项(建议)
- Blazor 示例页面(任务列表、恢复操作、填写签字意见与 NextPayload)。
- 后端恢复服务样例(ResumeBookmark 封装)。
- 单元/集成测试用例,验证 Application 在节点间的正确传递与 NextPayload 行为。
许可证与贡献
- 请依据项目根目录中的许可证文件(如 LICENSE)管理代码使用与贡献规则。
联系与支持
- 如需把本说明作为 README.md 放到项目根或其它位置,或希望生成示例代码文件(前端/后端),可在工作区指定目标路径后请求生成。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- AutoMapper (>= 14.0.0)
- Elsa (>= 3.6.2)
- Elsa.Api.Common (>= 3.6.2)
- Elsa.Expressions.CSharp (>= 3.6.2)
- Elsa.Expressions.JavaScript (>= 3.6.2)
- Elsa.Http (>= 3.6.2)
- Elsa.Persistence.EFCore.Sqlite (>= 3.6.2)
- Elsa.Persistence.EFCore.SqlServer (>= 3.6.2)
- Elsa.SasTokens (>= 3.6.2)
- Elsa.Scheduling (>= 3.6.2)
- Elsa.Tenants (>= 3.6.2)
- Elsa.Workflows.Api (>= 3.6.2)
- Elsa.Workflows.Runtime.Distributed (>= 3.6.2)
- Ruth.JYC.ELSA.Controllers (>= 2026.6.6)
- Ruth.JYC.ELSA.Data (>= 2026.6.6)
- Ruth.JYC.ELSA.Interfaces (>= 2026.6.6)
- Ruth.JYC.ELSA.Models (>= 2026.6.6)
- Ruth.JYC.ELSA.SqliteMigrations (>= 2026.6.6)
- Ruth.JYC.ELSA.SqlServerMigrations (>= 2026.6.6)
- Ruth.JYC.Net6.CustomCLS (>= 2026.5.22)
- Ruth.Net8.Core.Interfaces (>= 2026.6.6)
-
net9.0
- AutoMapper (>= 14.0.0)
- Elsa (>= 3.6.2)
- Elsa.Api.Common (>= 3.6.2)
- Elsa.Expressions.CSharp (>= 3.6.2)
- Elsa.Expressions.JavaScript (>= 3.6.2)
- Elsa.Http (>= 3.6.2)
- Elsa.Persistence.EFCore.Sqlite (>= 3.6.2)
- Elsa.Persistence.EFCore.SqlServer (>= 3.6.2)
- Elsa.SasTokens (>= 3.6.2)
- Elsa.Scheduling (>= 3.6.2)
- Elsa.Tenants (>= 3.6.2)
- Elsa.Workflows.Api (>= 3.6.2)
- Elsa.Workflows.Runtime.Distributed (>= 3.6.2)
- Ruth.JYC.ELSA.Controllers (>= 2026.6.6)
- Ruth.JYC.ELSA.Data (>= 2026.6.6)
- Ruth.JYC.ELSA.Interfaces (>= 2026.6.6)
- Ruth.JYC.ELSA.Models (>= 2026.6.6)
- Ruth.JYC.ELSA.SqliteMigrations (>= 2026.6.6)
- Ruth.JYC.ELSA.SqlServerMigrations (>= 2026.6.6)
- Ruth.JYC.Net6.CustomCLS (>= 2026.5.22)
- Ruth.Net8.Core.Interfaces (>= 2026.6.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.6.6 | 43 | 6/5/2026 |