diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignModels.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignModels.cs
deleted file mode 100644
index 8f7b253dc..000000000
--- a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignModels.cs
+++ /dev/null
@@ -1,465 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign;
-
-///
-/// AntFlow node type identifiers (see the designer's constant.js).
-///
-public static class AntFlowNodeKinds
-{
- public const string Approval = "approval";
-
- public const string Condition = "condition";
-}
-
-public static class AntFlowNodeTypes
-{
- public const int StartNode = 1;
-
- public const int GatewayNode = 2;
-
- public const int ConditionNode = 3;
-
- public const int ApproveNode = 4;
-
- public const int ParallelApproveWayNode = 5;
-
- public const int CopyNode = 6;
-
- public const int ParallelApproveNode = 7;
-}
-
-///
-/// Wrapper used by AntFlow designs that are stored as { nodes: [ ... ] }.
-/// The array may either contain complete node trees (recursive childNode) or the
-/// flattened list produced by the designer (nodeFrom/nodeTo).
-///
-public sealed class AntFlowDesignDocument
-{
- private List _nodes = [];
-
- public List Nodes
- {
- get => _nodes;
- set => _nodes = value ?? [];
- }
-}
-
-///
-/// One AntFlow designer node. The designer keeps the tree in and the
-/// gateway branches in .
-///
-public sealed class AntFlowDesignNode
-{
- private List _nodeTo = [];
-
- public string? NodeId { get; set; }
-
- public string? NodeName { get; set; }
-
- public string? NodeDisplayName { get; set; }
-
- public int? NodeType { get; set; }
-
- public string? NodeFrom { get; set; }
-
- public List NodeTo
- {
- get => _nodeTo;
- set => _nodeTo = value ?? [];
- }
-
- public int? NodeWeight { get; set; }
-
- [JsonConverter(typeof(AntFlowNodePropertyConverter))]
- public AntFlowNodeProperty? NodeProperty { get; set; }
-
- public AntFlowDesignNode? ChildNode { get; set; }
-
- public bool? Error { get; set; }
-
- ///
- /// Some AntFlow versions keep a pre-built expression on the node instead of a condition group.
- /// It is honoured verbatim by the compiler.
- ///
- public string? ConditionExpression { get; set; }
-
- public string? Expression { get; set; }
-}
-
-///
-/// The AntFlow nodeProperty payload. The designer sometimes serialises it as a JSON string,
-/// which is handled by .
-///
-public sealed class AntFlowNodeProperty
-{
- private List _conditionNodes = [];
- private List _parallelNodes = [];
- private List _assigneeList = [];
- private List _groupConditions = [];
- private List _conditionList = [];
-
- public List ConditionNodes
- {
- get => _conditionNodes;
- set => _conditionNodes = value ?? [];
- }
-
- public List ParallelNodes
- {
- get => _parallelNodes;
- set => _parallelNodes = value ?? [];
- }
-
- public List AssigneeList
- {
- get => _assigneeList;
- set => _assigneeList = value ?? [];
- }
-
- /// 1:指定成员, 2:指定角色, 3:直属领导, 5:发起人自己, 6:指定层级, 7:层层审批, 8:发起人自选.
- public int? AssigneeType { get; set; }
-
- /// 1:或签, 2:会签, 3:顺序会签.
- public int? SignType { get; set; }
-
- /// AntFlow button permissions, e.g. { "approvalPage": [3,4,18] }.
- public Dictionary>? Buttons { get; set; }
-
- /// 0:不允许发起, 1:跳过, 2:转交给审核管理员.
- public int? NoHeaderAction { get; set; }
-
- public int? DirectorLevel { get; set; }
-
- /// 1 marks the default (else) condition branch.
- public int? IsDefault { get; set; }
-
- /// true: 且 (AND) across groups; false: 或 (OR).
- public bool GroupRelation { get; set; }
-
- /// true: 且 (AND) inside a group; false: 或 (OR).
- public bool CondRelation { get; set; } = true;
-
- public List GroupConditions
- {
- get => _groupConditions;
- set => _groupConditions = value ?? [];
- }
-
- /// A flat condition list used by older AntFlow payloads instead of .
- public List ConditionList
- {
- get => _conditionList;
- set => _conditionList = value ?? [];
- }
-
- public string? ConditionExpression { get; set; }
-
- public string? Expression { get; set; }
-}
-
-///
-/// One entry of nodeProperty.assigneeList. The designer writes { type, targetId, name };
-/// other AntFlow versions use id/userId/displayName.
-///
-public sealed class AntFlowAssignee
-{
- public string? Id { get; set; }
-
- public string? UserId { get; set; }
-
- public string? TargetId { get; set; }
-
- public string? Name { get; set; }
-
- public string? DisplayName { get; set; }
-
- /// 1: user, 3: role (AntFlow designer convention).
- public int? Type { get; set; }
-}
-
-public sealed class AntFlowConditionGroup
-{
- private List _conditionList = [];
-
- public string? GroupId { get; set; }
-
- public string? GroupName { get; set; }
-
- public bool CondRelation { get; set; } = true;
-
- public int? Sort { get; set; }
-
- public List ConditionList
- {
- get => _conditionList;
- set => _conditionList = value ?? [];
- }
-}
-
-public sealed class AntFlowConditionItem
-{
- private JsonElement? _zdy1;
- private JsonElement? _zdy2;
-
- public string? Key { get; set; }
-
- public string? Label { get; set; }
-
- public string? Type { get; set; }
-
- /// Either the numeric designer operator (1..6) or a symbolic operator (=, >, ...).
- public string? OptType { get; set; }
-
- public string? Opt1 { get; set; }
-
- public string? Opt2 { get; set; }
-
- public JsonElement? Zdy1
- {
- get => _zdy1;
- set => _zdy1 = value;
- }
-
- public JsonElement? Zdy2
- {
- get => _zdy2;
- set => _zdy2 = value;
- }
-
- public string? ColumnDbName { get; set; }
-
- public string? ColumnType { get; set; }
-
- public string? ColumnDbType { get; set; }
-
- public string? FixedDownBoxValue { get; set; }
-}
-
-///
-/// Reads nodeProperty whether the designer wrote it as an object or as a serialised JSON string.
-///
-public sealed class AntFlowNodePropertyConverter : JsonConverter
-{
- public override AntFlowNodeProperty? Read(
- ref Utf8JsonReader reader,
- Type typeToConvert,
- JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case JsonTokenType.Null:
- return null;
- case JsonTokenType.String:
- var raw = reader.GetString();
- if (string.IsNullOrWhiteSpace(raw))
- {
- return new AntFlowNodeProperty();
- }
-
- try
- {
- using var stringDocument = JsonDocument.Parse(raw);
- return stringDocument.RootElement.ValueKind == JsonValueKind.Object
- ? stringDocument.RootElement.Deserialize(options) ?? new AntFlowNodeProperty()
- : new AntFlowNodeProperty();
- }
- catch (JsonException)
- {
- // An unparsable nodeProperty is treated as an empty node property so the rest of
- // the design can still be compiled.
- return new AntFlowNodeProperty();
- }
- case JsonTokenType.StartObject:
- using (var document = JsonDocument.ParseValue(ref reader))
- {
- return document.RootElement.Deserialize(options) ?? new AntFlowNodeProperty();
- }
- default:
- reader.Skip();
- return new AntFlowNodeProperty();
- }
- }
-
- public override void Write(
- Utf8JsonWriter writer,
- AntFlowNodeProperty value,
- JsonSerializerOptions options)
- {
- JsonSerializer.Serialize(writer, value, options);
- }
-}
-
-internal sealed class AntFlowFlexibleStringConverter : JsonConverter
-{
- public override string? Read(
- ref Utf8JsonReader reader,
- Type typeToConvert,
- JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case JsonTokenType.Null:
- return null;
- case JsonTokenType.String:
- return reader.GetString();
- case JsonTokenType.Number:
- return reader.TryGetInt64(out var integer)
- ? integer.ToString(CultureInfo.InvariantCulture)
- : reader.GetDouble().ToString(CultureInfo.InvariantCulture);
- case JsonTokenType.True:
- return "true";
- case JsonTokenType.False:
- return "false";
- default:
- using (var document = JsonDocument.ParseValue(ref reader))
- {
- return document.RootElement.GetRawText();
- }
- }
- }
-
- public override void Write(Utf8JsonWriter writer, string? value, JsonSerializerOptions options)
- {
- if (value == null)
- {
- writer.WriteNullValue();
- }
- else
- {
- writer.WriteStringValue(value);
- }
- }
-}
-
-internal sealed class AntFlowFlexibleInt32Converter : JsonConverter
-{
- public override int Read(
- ref Utf8JsonReader reader,
- Type typeToConvert,
- JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case JsonTokenType.Number:
- if (reader.TryGetInt32(out var number))
- {
- return number;
- }
- if (reader.TryGetDouble(out var real))
- {
- return (int)real;
- }
- break;
- case JsonTokenType.String:
- var text = reader.GetString();
- if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsed))
- {
- return parsed;
- }
- if (double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var parsedReal))
- {
- return (int)parsedReal;
- }
- break;
- case JsonTokenType.True:
- return 1;
- case JsonTokenType.False:
- return 0;
- case JsonTokenType.Null:
- return 0;
- }
-
- reader.Skip();
- return 0;
- }
-
- public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options)
- {
- writer.WriteNumberValue(value);
- }
-}
-
-internal sealed class AntFlowFlexibleBooleanConverter : JsonConverter
-{
- public override bool Read(
- ref Utf8JsonReader reader,
- Type typeToConvert,
- JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case JsonTokenType.True:
- return true;
- case JsonTokenType.False:
- return false;
- case JsonTokenType.Number:
- return !reader.TryGetInt32(out var number) || number != 0;
- case JsonTokenType.String:
- var text = reader.GetString();
- if (bool.TryParse(text, out var boolean))
- {
- return boolean;
- }
- if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out var numeric))
- {
- return numeric != 0;
- }
- return string.Equals(text, "且", StringComparison.Ordinal) ||
- string.Equals(text, "and", StringComparison.OrdinalIgnoreCase);
- case JsonTokenType.Null:
- return false;
- }
-
- reader.Skip();
- return false;
- }
-
- public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
- {
- writer.WriteBooleanValue(value);
- }
-}
-
-///
-/// Serializer options for the AntFlow contract. AntFlow payloads are loosely typed in the
-/// designer (numbers stored as strings and booleans stored as 0/1), so the options are lenient.
-///
-public static class AntFlowJson
-{
- public static readonly JsonSerializerOptions Options = CreateOptions();
-
- private static JsonSerializerOptions CreateOptions()
- {
- var options = new JsonSerializerOptions
- {
- PropertyNameCaseInsensitive = true,
- ReadCommentHandling = JsonCommentHandling.Skip,
- AllowTrailingCommas = true,
- NumberHandling = JsonNumberHandling.AllowReadingFromString,
- };
-
- options.Converters.Add(new AntFlowFlexibleStringConverter());
- options.Converters.Add(new AntFlowFlexibleInt32Converter());
- options.Converters.Add(new AntFlowFlexibleBooleanConverter());
-
- return options;
- }
-}
-
-///
-/// Reference equality comparer used while walking the designer tree, which is a DAG when the
-/// designer reuses the merge node after a gateway.
-///
-internal sealed class AntFlowNodeReferenceComparer : IEqualityComparer
-{
- public static readonly AntFlowNodeReferenceComparer Instance = new();
-
- public bool Equals(AntFlowDesignNode? x, AntFlowDesignNode? y) => ReferenceEquals(x, y);
-
- public int GetHashCode(AntFlowDesignNode obj) => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj);
-}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignWorkflowTemplateCompiler.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignWorkflowTemplateCompiler.cs
index 89bf4ea11..32d7a8f8f 100644
--- a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignWorkflowTemplateCompiler.cs
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/AntFlowDesignWorkflowTemplateCompiler.cs
@@ -5,6 +5,7 @@ using Elsa.UserTasks.Models;
using Elsa.Workflows;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Models;
+using LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
using LINGYUN.Abp.ElsaNext.ApprovalFlow.Participants;
using LINGYUN.Abp.ElsaNext.ApprovalFlow.Templates;
using LINGYUN.Abp.ElsaNext.ApprovalFlow.Workflows;
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowAssignee.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowAssignee.cs
new file mode 100644
index 000000000..c1b9c58b3
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowAssignee.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// One entry of nodeProperty.assigneeList. The designer writes { type, targetId, name };
+/// other AntFlow versions use id/userId/displayName.
+///
+public sealed class AntFlowAssignee
+{
+ public string? Id { get; set; }
+
+ public string? UserId { get; set; }
+
+ public string? TargetId { get; set; }
+
+ public string? Name { get; set; }
+
+ public string? DisplayName { get; set; }
+
+ /// 1: user, 3: role (AntFlow designer convention).
+ public int? Type { get; set; }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowConditionGroup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowConditionGroup.cs
new file mode 100644
index 000000000..8c90254d9
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowConditionGroup.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+public sealed class AntFlowConditionGroup
+{
+ private List _conditionList = [];
+
+ public string? GroupId { get; set; }
+
+ public string? GroupName { get; set; }
+
+ public bool CondRelation { get; set; } = true;
+
+ public int? Sort { get; set; }
+
+ public List ConditionList
+ {
+ get => _conditionList;
+ set => _conditionList = value ?? [];
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowConditionItem.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowConditionItem.cs
new file mode 100644
index 000000000..f356e3cea
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowConditionItem.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+public sealed class AntFlowConditionItem
+{
+ private JsonElement? _zdy1;
+ private JsonElement? _zdy2;
+
+ public string? Key { get; set; }
+
+ public string? Label { get; set; }
+
+ public string? Type { get; set; }
+
+ /// Either the numeric designer operator (1..6) or a symbolic operator (=, >, ...).
+ public string? OptType { get; set; }
+
+ public string? Opt1 { get; set; }
+
+ public string? Opt2 { get; set; }
+
+ public JsonElement? Zdy1
+ {
+ get => _zdy1;
+ set => _zdy1 = value;
+ }
+
+ public JsonElement? Zdy2
+ {
+ get => _zdy2;
+ set => _zdy2 = value;
+ }
+
+ public string? ColumnDbName { get; set; }
+
+ public string? ColumnType { get; set; }
+
+ public string? ColumnDbType { get; set; }
+
+ public string? FixedDownBoxValue { get; set; }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowDesignDocument.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowDesignDocument.cs
new file mode 100644
index 000000000..375956807
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowDesignDocument.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// Wrapper used by AntFlow designs that are stored as { nodes: [ ... ] }.
+/// The array may either contain complete node trees (recursive childNode) or the
+/// flattened list produced by the designer (nodeFrom/nodeTo).
+///
+public sealed class AntFlowDesignDocument
+{
+ private List _nodes = [];
+
+ public List Nodes
+ {
+ get => _nodes;
+ set => _nodes = value ?? [];
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowDesignNode.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowDesignNode.cs
new file mode 100644
index 000000000..06491d8cc
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowDesignNode.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// One AntFlow designer node. The designer keeps the tree in and the
+/// gateway branches in .
+///
+public sealed class AntFlowDesignNode
+{
+ private List _nodeTo = [];
+
+ public string? NodeId { get; set; }
+
+ public string? NodeName { get; set; }
+
+ public string? NodeDisplayName { get; set; }
+
+ public int? NodeType { get; set; }
+
+ public string? NodeFrom { get; set; }
+
+ public List NodeTo
+ {
+ get => _nodeTo;
+ set => _nodeTo = value ?? [];
+ }
+
+ public int? NodeWeight { get; set; }
+
+ [JsonConverter(typeof(AntFlowNodePropertyConverter))]
+ public AntFlowNodeProperty? NodeProperty { get; set; }
+
+ public AntFlowDesignNode? ChildNode { get; set; }
+
+ public bool? Error { get; set; }
+
+ ///
+ /// Some AntFlow versions keep a pre-built expression on the node instead of a condition group.
+ /// It is honoured verbatim by the compiler.
+ ///
+ public string? ConditionExpression { get; set; }
+
+ public string? Expression { get; set; }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleBooleanConverter.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleBooleanConverter.cs
new file mode 100644
index 000000000..84d5b8ede
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleBooleanConverter.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+internal sealed class AntFlowFlexibleBooleanConverter : JsonConverter
+{
+ public override bool Read(
+ ref Utf8JsonReader reader,
+ Type typeToConvert,
+ JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case JsonTokenType.True:
+ return true;
+ case JsonTokenType.False:
+ return false;
+ case JsonTokenType.Number:
+ return !reader.TryGetInt32(out var number) || number != 0;
+ case JsonTokenType.String:
+ var text = reader.GetString();
+ if (bool.TryParse(text, out var boolean))
+ {
+ return boolean;
+ }
+ if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out var numeric))
+ {
+ return numeric != 0;
+ }
+ return string.Equals(text, "且", StringComparison.Ordinal) ||
+ string.Equals(text, "and", StringComparison.OrdinalIgnoreCase);
+ case JsonTokenType.Null:
+ return false;
+ }
+
+ reader.Skip();
+ return false;
+ }
+
+ public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
+ {
+ writer.WriteBooleanValue(value);
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleInt32Converter.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleInt32Converter.cs
new file mode 100644
index 000000000..82b2eee14
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleInt32Converter.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+internal sealed class AntFlowFlexibleInt32Converter : JsonConverter
+{
+ public override int Read(
+ ref Utf8JsonReader reader,
+ Type typeToConvert,
+ JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case JsonTokenType.Number:
+ if (reader.TryGetInt32(out var number))
+ {
+ return number;
+ }
+ if (reader.TryGetDouble(out var real))
+ {
+ return (int)real;
+ }
+ break;
+ case JsonTokenType.String:
+ var text = reader.GetString();
+ if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsed))
+ {
+ return parsed;
+ }
+ if (double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var parsedReal))
+ {
+ return (int)parsedReal;
+ }
+ break;
+ case JsonTokenType.True:
+ return 1;
+ case JsonTokenType.False:
+ return 0;
+ case JsonTokenType.Null:
+ return 0;
+ }
+
+ reader.Skip();
+ return 0;
+ }
+
+ public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options)
+ {
+ writer.WriteNumberValue(value);
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleStringConverter.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleStringConverter.cs
new file mode 100644
index 000000000..12d31537c
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowFlexibleStringConverter.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+internal sealed class AntFlowFlexibleStringConverter : JsonConverter
+{
+ public override string? Read(
+ ref Utf8JsonReader reader,
+ Type typeToConvert,
+ JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case JsonTokenType.Null:
+ return null;
+ case JsonTokenType.String:
+ return reader.GetString();
+ case JsonTokenType.Number:
+ return reader.TryGetInt64(out var integer)
+ ? integer.ToString(CultureInfo.InvariantCulture)
+ : reader.GetDouble().ToString(CultureInfo.InvariantCulture);
+ case JsonTokenType.True:
+ return "true";
+ case JsonTokenType.False:
+ return "false";
+ default:
+ using (var document = JsonDocument.ParseValue(ref reader))
+ {
+ return document.RootElement.GetRawText();
+ }
+ }
+ }
+
+ public override void Write(Utf8JsonWriter writer, string? value, JsonSerializerOptions options)
+ {
+ if (value == null)
+ {
+ writer.WriteNullValue();
+ }
+ else
+ {
+ writer.WriteStringValue(value);
+ }
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowJson.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowJson.cs
new file mode 100644
index 000000000..d314c4d4e
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowJson.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// Serializer options for the AntFlow contract. AntFlow payloads are loosely typed in the
+/// designer (numbers stored as strings and booleans stored as 0/1), so the options are lenient.
+///
+public static class AntFlowJson
+{
+ public static readonly JsonSerializerOptions Options = CreateOptions();
+
+ private static JsonSerializerOptions CreateOptions()
+ {
+ var options = new JsonSerializerOptions
+ {
+ PropertyNameCaseInsensitive = true,
+ ReadCommentHandling = JsonCommentHandling.Skip,
+ AllowTrailingCommas = true,
+ NumberHandling = JsonNumberHandling.AllowReadingFromString,
+ };
+
+ options.Converters.Add(new AntFlowFlexibleStringConverter());
+ options.Converters.Add(new AntFlowFlexibleInt32Converter());
+ options.Converters.Add(new AntFlowFlexibleBooleanConverter());
+
+ return options;
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeKinds.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeKinds.cs
new file mode 100644
index 000000000..e987e5bbd
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeKinds.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// AntFlow node type identifiers (see the designer's constant.js).
+///
+public static class AntFlowNodeKinds
+{
+ public const string Approval = "approval";
+
+ public const string Condition = "condition";
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeProperty.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeProperty.cs
new file mode 100644
index 000000000..d6c7905bd
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeProperty.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// The AntFlow nodeProperty payload. The designer sometimes serialises it as a JSON string,
+/// which is handled by .
+///
+public sealed class AntFlowNodeProperty
+{
+ private List _conditionNodes = [];
+ private List _parallelNodes = [];
+ private List _assigneeList = [];
+ private List _groupConditions = [];
+ private List _conditionList = [];
+
+ public List ConditionNodes
+ {
+ get => _conditionNodes;
+ set => _conditionNodes = value ?? [];
+ }
+
+ public List ParallelNodes
+ {
+ get => _parallelNodes;
+ set => _parallelNodes = value ?? [];
+ }
+
+ public List AssigneeList
+ {
+ get => _assigneeList;
+ set => _assigneeList = value ?? [];
+ }
+
+ /// 1:指定成员, 2:指定角色, 3:直属领导, 5:发起人自己, 6:指定层级, 7:层层审批, 8:发起人自选.
+ public int? AssigneeType { get; set; }
+
+ /// 1:或签, 2:会签, 3:顺序会签.
+ public int? SignType { get; set; }
+
+ /// AntFlow button permissions, e.g. { "approvalPage": [3,4,18] }.
+ public Dictionary>? Buttons { get; set; }
+
+ /// 0:不允许发起, 1:跳过, 2:转交给审核管理员.
+ public int? NoHeaderAction { get; set; }
+
+ public int? DirectorLevel { get; set; }
+
+ /// 1 marks the default (else) condition branch.
+ public int? IsDefault { get; set; }
+
+ /// true: 且 (AND) across groups; false: 或 (OR).
+ public bool GroupRelation { get; set; }
+
+ /// true: 且 (AND) inside a group; false: 或 (OR).
+ public bool CondRelation { get; set; } = true;
+
+ public List GroupConditions
+ {
+ get => _groupConditions;
+ set => _groupConditions = value ?? [];
+ }
+
+ /// A flat condition list used by older AntFlow payloads instead of .
+ public List ConditionList
+ {
+ get => _conditionList;
+ set => _conditionList = value ?? [];
+ }
+
+ public string? ConditionExpression { get; set; }
+
+ public string? Expression { get; set; }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodePropertyConverter.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodePropertyConverter.cs
new file mode 100644
index 000000000..4b7e39658
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodePropertyConverter.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// Reads nodeProperty whether the designer wrote it as an object or as a serialised JSON string.
+///
+public sealed class AntFlowNodePropertyConverter : JsonConverter
+{
+ public override AntFlowNodeProperty? Read(
+ ref Utf8JsonReader reader,
+ Type typeToConvert,
+ JsonSerializerOptions options)
+ {
+ switch (reader.TokenType)
+ {
+ case JsonTokenType.Null:
+ return null;
+ case JsonTokenType.String:
+ var raw = reader.GetString();
+ if (string.IsNullOrWhiteSpace(raw))
+ {
+ return new AntFlowNodeProperty();
+ }
+
+ try
+ {
+ using var stringDocument = JsonDocument.Parse(raw);
+ return stringDocument.RootElement.ValueKind == JsonValueKind.Object
+ ? stringDocument.RootElement.Deserialize(options) ?? new AntFlowNodeProperty()
+ : new AntFlowNodeProperty();
+ }
+ catch (JsonException)
+ {
+ // An unparsable nodeProperty is treated as an empty node property so the rest of
+ // the design can still be compiled.
+ return new AntFlowNodeProperty();
+ }
+ case JsonTokenType.StartObject:
+ using (var document = JsonDocument.ParseValue(ref reader))
+ {
+ return document.RootElement.Deserialize(options) ?? new AntFlowNodeProperty();
+ }
+ default:
+ reader.Skip();
+ return new AntFlowNodeProperty();
+ }
+ }
+
+ public override void Write(
+ Utf8JsonWriter writer,
+ AntFlowNodeProperty value,
+ JsonSerializerOptions options)
+ {
+ JsonSerializer.Serialize(writer, value, options);
+ }
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeReferenceComparer.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeReferenceComparer.cs
new file mode 100644
index 000000000..f8234ff93
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeReferenceComparer.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+///
+/// Reference equality comparer used while walking the designer tree, which is a DAG when the
+/// designer reuses the merge node after a gateway.
+///
+internal sealed class AntFlowNodeReferenceComparer : IEqualityComparer
+{
+ public static readonly AntFlowNodeReferenceComparer Instance = new();
+
+ public bool Equals(AntFlowDesignNode? x, AntFlowDesignNode? y) => ReferenceEquals(x, y);
+
+ public int GetHashCode(AntFlowDesignNode obj) => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj);
+}
diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeTypes.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeTypes.cs
new file mode 100644
index 000000000..232cd0e5c
--- /dev/null
+++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.ApprovalFlow.Domain.AntFlowDesign/LINGYUN/Abp/ElsaNext/ApprovalFlow/AntFlowDesign/Models/AntFlowNodeTypes.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace LINGYUN.Abp.ElsaNext.ApprovalFlow.AntFlowDesign.Models;
+
+public static class AntFlowNodeTypes
+{
+ public const int StartNode = 1;
+
+ public const int GatewayNode = 2;
+
+ public const int ConditionNode = 3;
+
+ public const int ApproveNode = 4;
+
+ public const int ParallelApproveWayNode = 5;
+
+ public const int CopyNode = 6;
+
+ public const int ParallelApproveNode = 7;
+}