|
|
@@ -3,8 +3,13 @@ using Abp.Domain.Repositories;
|
|
|
using Abp.Domain.Uow;
|
|
|
using Abp.Linq;
|
|
|
|
|
|
+using Newtonsoft.Json;
|
|
|
+
|
|
|
+using System.Dynamic;
|
|
|
+
|
|
|
using VberZero.Authorization;
|
|
|
using VberZero.Session;
|
|
|
+using VberZero.Tools.StringModel;
|
|
|
using VberZero.Workflow;
|
|
|
using VberZero.Workflow.DesignInfo;
|
|
|
using VberZero.Workflow.Persistence;
|
|
|
@@ -25,6 +30,14 @@ public class VbWorkflowPersistenceProvider : VberPersistenceProvider
|
|
|
public override async Task<string> CreateNewWorkflow(WorkflowInstance workflow, CancellationToken cancellationToken = new())
|
|
|
{
|
|
|
var entity = GenerateWorkflow(workflow);
|
|
|
+ if (workflow.Reference.NotEmpty())
|
|
|
+ {
|
|
|
+ var customId = GetWorkflowIdFromReference(workflow.Reference);
|
|
|
+ if (customId.NotEmpty())
|
|
|
+ {
|
|
|
+ entity.Id = customId;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (AbpSession.UserId.HasValue)
|
|
|
{
|
|
|
var name = AbpSession.GetClaimValue(VzClaimTypes.RealName);
|
|
|
@@ -34,4 +47,18 @@ public class VbWorkflowPersistenceProvider : VberPersistenceProvider
|
|
|
await CurrentUnitOfWork.SaveChangesAsync();
|
|
|
return workflow.Id;
|
|
|
}
|
|
|
+
|
|
|
+ protected virtual string GetWorkflowIdFromReference(string reference)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ dynamic dyObj = JsonConvert.DeserializeObject<ExpandoObject>(reference);
|
|
|
+ return dyObj.WorkflowId.ToString();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Console.WriteLine(e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|