|
@@ -4,6 +4,7 @@ using Hotline.Share.Enums.FlowEngine;
|
|
|
using SqlSugar;
|
|
|
using XF.Domain.Entities;
|
|
|
using XF.Domain.Exceptions;
|
|
|
+using XF.Domain.Extensions;
|
|
|
using XF.Domain.Repository;
|
|
|
|
|
|
namespace Hotline.FlowEngine.Workflows;
|
|
@@ -89,6 +90,18 @@ public class Workflow : CreationEntity
|
|
|
[SugarColumn(ColumnDataType = "json", IsJson = true)]
|
|
|
public List<HandlerGroupItem> HandlerOrgs { get; set; } = new();
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 指派部门code(所有流经部门留痕)
|
|
|
+ /// </summary>
|
|
|
+ [SugarColumn(ColumnDataType = "json", IsJson = true)]
|
|
|
+ public List<string> AssignOrgCodes { get; set; } = new();
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 指派办理人Id(所有流经办理人留痕)
|
|
|
+ /// </summary>
|
|
|
+ [SugarColumn(ColumnDataType = "json", IsJson = true)]
|
|
|
+ public List<string> AssignUserIds { get; set; } = new();
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 外部业务唯一标识
|
|
|
/// </summary>
|
|
@@ -286,6 +299,44 @@ public class Workflow : CreationEntity
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void Assign(EFlowAssignType type, string handler)
|
|
|
+ {
|
|
|
+ handler = handler.ToLower();
|
|
|
+ switch (type)
|
|
|
+ {
|
|
|
+ case EFlowAssignType.Org:
|
|
|
+ var orgCodes = handler.GetHigherOrgCodes(true).ToList();
|
|
|
+ AssignOrgCodes.AddRange(orgCodes);
|
|
|
+ AssignOrgCodes = AssignOrgCodes.Distinct().ToList();
|
|
|
+ break;
|
|
|
+ case EFlowAssignType.User:
|
|
|
+ if (!AssignUserIds.Exists(d => d == handler))
|
|
|
+ AssignUserIds.Add(handler);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Assign(EFlowAssignType type, IEnumerable<string> handlers)
|
|
|
+ {
|
|
|
+ handlers = handlers.Select(d => d.ToLower());
|
|
|
+ switch (type)
|
|
|
+ {
|
|
|
+ case EFlowAssignType.Org:
|
|
|
+ var orgCodes = handlers.SelectMany(d => d.GetHigherOrgCodes(true)).ToList();
|
|
|
+ AssignOrgCodes.AddRange(orgCodes);
|
|
|
+ AssignOrgCodes = AssignOrgCodes.Distinct().ToList();
|
|
|
+ break;
|
|
|
+ case EFlowAssignType.User:
|
|
|
+ AssignUserIds.AddRange(handlers);
|
|
|
+ AssignUserIds = AssignUserIds.Distinct().ToList();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
}
|
|
|
|