From 0b045339caee6118258b66407a0c4d76790a9f57 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:31:35 +0800 Subject: [PATCH] split workflow definition and workflow instance management --- aspnet-core/LINGYUN.MicroService.All.sln | 2 +- .../DbMigrator/DefaultDbSchemaMigrator.cs | 6 +- ...wManagementPermissionDefinitionProvider.cs | 17 +++ .../WorkflowManagementPermissions.cs | 16 ++ .../Engine/IEngineAppService.cs | 10 ++ .../Workflows/Dto/StepNodeDto.cs | 25 +++ ...eDto.cs => WorkflowDefinitionCreateDto.cs} | 2 +- .../Workflows/Dto/WorkflowDto.cs | 25 ++- .../Workflows/Dto/WorkflowInstanceDto.cs | 16 ++ .../Workflows/IWorkflowAppService.cs | 6 +- .../IWorkflowDefinitionAppService.cs | 14 ++ .../Engine/EngineAppService.cs | 23 +++ ...kflowManagementApplicationMapperProfile.cs | 9 +- .../Workflows/WorkflowAppService.cs | 100 +----------- .../Workflows/WorkflowDefinitionAppService.cs | 142 ++++++++++++++++++ .../Localization/Resources/en.json | 5 + .../Localization/Resources/zh-Hans.json | 7 +- .../IWorkflowEngineManager.cs | 14 ++ .../Abp/WorkflowManagement/Workflow.cs | 2 +- .../Abp/WorkflowManagement/WorkflowManager.cs | 8 + .../WorkflowRegisterService.cs | 2 +- .../Engine/EngineController.cs | 27 ++++ .../Workflows/WorkflowController.cs | 10 +- .../Workflows/WorkflowDefinitionController.cs | 42 ++++++ .../WorkflowEngineManager.cs | 61 ++++++++ ...owManagementHttpApiHostModule.Configure.cs | 5 - .../WorkflowManagementHttpApiHostModule.cs | 5 + 27 files changed, 476 insertions(+), 125 deletions(-) create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Engine/IEngineAppService.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepNodeDto.cs rename aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/{WorkflowCreateDto.cs => WorkflowDefinitionCreateDto.cs} (90%) create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowInstanceDto.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowDefinitionAppService.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Engine/EngineAppService.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionAppService.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/IWorkflowEngineManager.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Engine/EngineController.cs create mode 100644 aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionController.cs create mode 100644 aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowEngineManager.cs diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln index 593746f77..4e40d23ed 100644 --- a/aspnet-core/LINGYUN.MicroService.All.sln +++ b/aspnet-core/LINGYUN.MicroService.All.sln @@ -353,7 +353,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OpenApi.Authori EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Wrapper", "modules\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj", "{65311EC9-7A86-4E73-A587-F06A99474EDD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.BlobStoring.OssManagement", "modules\oss-management\LINGYUN.Abp.BlobStoring.OssManagement\LINGYUN.Abp.BlobStoring.OssManagement.csproj", "{CD9081C6-7CA0-4A93-9318-33E54F3ED275}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BlobStoring.OssManagement", "modules\oss-management\LINGYUN.Abp.BlobStoring.OssManagement\LINGYUN.Abp.BlobStoring.OssManagement.csproj", "{CD9081C6-7CA0-4A93-9318-33E54F3ED275}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.HttpApi.Client", "modules\oss-management\LINGYUN.Abp.OssManagement.HttpApi.Client\LINGYUN.Abp.OssManagement.HttpApi.Client.csproj", "{D262405E-1C72-4F14-A799-40471BAD48DC}" EndProject diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN/Abp/Data/DbMigrator/DefaultDbSchemaMigrator.cs b/aspnet-core/modules/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN/Abp/Data/DbMigrator/DefaultDbSchemaMigrator.cs index 18c1fbf8f..879953f2a 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN/Abp/Data/DbMigrator/DefaultDbSchemaMigrator.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN/Abp/Data/DbMigrator/DefaultDbSchemaMigrator.cs @@ -27,14 +27,16 @@ namespace LINGYUN.Abp.Data.DbMigrator [NotNull] Func, TDbContext> configureDbContext) where TDbContext : AbpDbContext { + var connectionStringName = ConnectionStringNameAttribute.GetConnStringName(); var connectionStringResolver = _serviceProvider .GetRequiredService(); - var connectionString = await connectionStringResolver.ResolveAsync(); + var connectionString = await connectionStringResolver.ResolveAsync(connectionStringName); + var defaultConnectionString = _dbConnectionOptions.GetConnectionStringOrNull(connectionStringName); // 租户连接字符串与默认连接字符串相同,则不执行迁移脚本 if (string.Equals( connectionString, - _dbConnectionOptions.ConnectionStrings.Default, + defaultConnectionString, StringComparison.InvariantCultureIgnoreCase)) { return; diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissionDefinitionProvider.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissionDefinitionProvider.cs index b50e751e7..b763b1a32 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissionDefinitionProvider.cs @@ -10,6 +10,23 @@ namespace LINGYUN.Abp.WorkflowManagement.Authorization { var group = context.AddGroup(WorkflowManagementPermissions.GroupName, L("Permission:WorkflowManagement")); + var engine = group.AddPermission( + WorkflowManagementPermissions.Engine.Default, + L("Permission:Engine")); + engine.AddChild( + WorkflowManagementPermissions.Engine.Initialize, + L("Permission:Initialize")); + + var workflow = group.AddPermission( + WorkflowManagementPermissions.WorkflowDef.Default, + L("Permission:WorkflowDef")); + workflow.AddChild( + WorkflowManagementPermissions.WorkflowDef.Create, + L("Permission:Create")); + workflow.AddChild( + WorkflowManagementPermissions.WorkflowDef.Delete, + L("Permission:Delete")); + group.AddPermission( WorkflowManagementPermissions.ManageSettings, L("Permission:ManageSettings")); diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissions.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissions.cs index 3e7a64511..44c090cde 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissions.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Authorization/WorkflowManagementPermissions.cs @@ -5,5 +5,21 @@ public const string GroupName = "WorkflowManagement"; public const string ManageSettings = GroupName + ".ManageSettings"; + + public static class Engine + { + public const string Default = GroupName + ".Engine"; + + public const string Initialize = Default + ".Initialize"; + } + + public static class WorkflowDef + { + public const string Default = GroupName + ".WorkflowDef"; + + public const string Create = Default + ".Create"; + + public const string Delete = Default + ".Delete"; + } } } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Engine/IEngineAppService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Engine/IEngineAppService.cs new file mode 100644 index 000000000..93e901fc1 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Engine/IEngineAppService.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.WorkflowManagement.Engine +{ + public interface IEngineAppService : IApplicationService + { + Task InitializeAsync(); + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepNodeDto.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepNodeDto.cs new file mode 100644 index 000000000..d583aeff6 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepNodeDto.cs @@ -0,0 +1,25 @@ +using System; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Data; + +namespace LINGYUN.Abp.WorkflowManagement.Workflows +{ + public class StepNodeDto : EntityDto + { + public string Name { get; set; } + public string StepType { get; set; } + public string CancelCondition { get; set; } + public TimeSpan? RetryInterval { get; set; } + public bool Saga { get; set; } + public Guid? ParentId { get; set; } + public ExtraPropertyDictionary Inputs { get; set; } + public ExtraPropertyDictionary Outputs { get; set; } + public ExtraPropertyDictionary SelectNextStep { get; set; } + public StepNodeDto() + { + Inputs = new ExtraPropertyDictionary(); + Outputs = new ExtraPropertyDictionary(); + SelectNextStep = new ExtraPropertyDictionary(); + } + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowCreateDto.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs similarity index 90% rename from aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowCreateDto.cs rename to aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs index 97e93e3b7..d8a4bc6ec 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowCreateDto.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs @@ -2,7 +2,7 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows { - public class WorkflowCreateDto + public class WorkflowDefinitionCreateDto { /// /// 是否启用 diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDto.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDto.cs index 180bf462a..780848b26 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDto.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDto.cs @@ -1,16 +1,25 @@ using System; +using System.Collections.Generic; +using Volo.Abp.Application.Dtos; namespace LINGYUN.Abp.WorkflowManagement.Workflows { - public class WorkflowDto + public class WorkflowDto : AuditedEntityDto { - public string WorkflowId { get; set; } - public object Data { get; set; } - public string DefinitionId { get; set; } + public bool IsEnabled { get; set; } + + public string Name { get; set; } + + public string DisplayName { get; set; } + + public string Description { get; set; } + public int Version { get; set; } - public string Status { get; set; } - public string Reference { get; set; } - public DateTime StartTime { get; set; } - public DateTime? EndTime { get; set; } + + public TimeSpan? ErrorRetryInterval { get; set; } + + public List Steps { get; set; } = new List(); + + public List CompensateNodes { get; set; } = new List(); } } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowInstanceDto.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowInstanceDto.cs new file mode 100644 index 000000000..82b280e76 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowInstanceDto.cs @@ -0,0 +1,16 @@ +using System; + +namespace LINGYUN.Abp.WorkflowManagement.Workflows +{ + public class WorkflowInstanceDto + { + public string WorkflowId { get; set; } + public object Data { get; set; } + public string DefinitionId { get; set; } + public int Version { get; set; } + public string Status { get; set; } + public string Reference { get; set; } + public DateTime StartTime { get; set; } + public DateTime? EndTime { get; set; } + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowAppService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowAppService.cs index 0d878cfe0..e5b81a542 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowAppService.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowAppService.cs @@ -5,11 +5,9 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows { public interface IWorkflowAppService : IApplicationService { - Task GetAsync(string id); + Task GetAsync(string id); - Task CreateAsync(WorkflowCreateDto input); - - Task StartAsync(string id, WorkflowStartInput input); + Task StartAsync(string id, WorkflowStartInput input); Task SuspendAsync(string id); diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowDefinitionAppService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowDefinitionAppService.cs new file mode 100644 index 000000000..e1d2e0ad6 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/IWorkflowDefinitionAppService.cs @@ -0,0 +1,14 @@ +using System; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.WorkflowManagement.Workflows +{ + public interface IWorkflowDefinitionAppService + { + Task CreateAsync(WorkflowDefinitionCreateDto input); + + Task GetAsync(Guid id); + + Task DeleteAsync(Guid id); + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Engine/EngineAppService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Engine/EngineAppService.cs new file mode 100644 index 000000000..eef5b83a7 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Engine/EngineAppService.cs @@ -0,0 +1,23 @@ +using LINGYUN.Abp.WorkflowManagement.Authorization; +using Microsoft.AspNetCore.Authorization; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.WorkflowManagement.Engine +{ + [Authorize(WorkflowManagementPermissions.Engine.Default)] + public class EngineAppService : WorkflowManagementAppServiceBase, IEngineAppService + { + private readonly IWorkflowEngineManager _engineManager; + + public EngineAppService(IWorkflowEngineManager engineManager) + { + _engineManager = engineManager; + } + + [Authorize(WorkflowManagementPermissions.Engine.Initialize)] + public virtual async Task InitializeAsync() + { + await _engineManager.InitializeAsync(); + } + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/WorkflowManagementApplicationMapperProfile.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/WorkflowManagementApplicationMapperProfile.cs index 6312d2f5a..5e8aa2ddc 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/WorkflowManagementApplicationMapperProfile.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/WorkflowManagementApplicationMapperProfile.cs @@ -10,12 +10,19 @@ namespace LINGYUN.Abp.WorkflowManagement { public WorkflowManagementApplicationMapperProfile() { - CreateMap() + CreateMap() .ForMember(dto => dto.WorkflowId, map => map.MapFrom(src => src.Id.ToString())) .ForMember(dto => dto.DefinitionId, map => map.MapFrom(src => src.Id.ToString())) .ForMember(dto => dto.StartTime, map => map.MapFrom(src => src.CreateTime)) .ForMember(dto => dto.EndTime, map => map.MapFrom(src => src.CompleteTime)); CreateMap(); + + + CreateMap(); + CreateMap(); + CreateMap() + .ForMember(dto => dto.Steps, map => map.Ignore()) + .ForMember(dto => dto.CompensateNodes, map => map.Ignore()); } } } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowAppService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowAppService.cs index fc34c6c64..0bae04835 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowAppService.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowAppService.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using Microsoft.AspNetCore.Authorization; +using Newtonsoft.Json; using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; @@ -8,37 +9,25 @@ using WorkflowCore.Models; namespace LINGYUN.Abp.WorkflowManagement.Workflows { - //[Authorize] + [Authorize] public class WorkflowAppService : WorkflowManagementAppServiceBase, IWorkflowAppService { - private readonly WorkflowManager _workflowManager; private readonly IWorkflowController _controller; private readonly IPersistenceProvider _persistence; - private readonly IWorkflowRepository _workflowRepository; - private readonly IStepNodeRepository _stepNodeRepository; - private readonly ICompensateNodeRepository _compensateNodeRepository; public WorkflowAppService( IWorkflowController controller, - IPersistenceProvider persistence, - WorkflowManager workflowManager, - IWorkflowRepository workflowRepository, - IStepNodeRepository stepNodeRepository, - ICompensateNodeRepository compensateNodeRepository) + IPersistenceProvider persistence) { _controller = controller; _persistence = persistence; - _workflowManager = workflowManager; - _workflowRepository = workflowRepository; - _stepNodeRepository = stepNodeRepository; - _compensateNodeRepository = compensateNodeRepository; } - public virtual async Task GetAsync(string id) + public virtual async Task GetAsync(string id) { var workflow = await _persistence.GetWorkflowInstance(id); - return ObjectMapper.Map(workflow); + return ObjectMapper.Map(workflow); } public virtual async Task ResumeAsync(string id) @@ -50,86 +39,13 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows } } - public virtual async Task CreateAsync(WorkflowCreateDto input) - { - if (await _workflowRepository.CheckVersionAsync(input.Name, input.Version)) - { - throw new BusinessException(); - } - - var workflow = new Workflow( - GuidGenerator.Create(), - input.Name, - input.Description, - input.Description, - input.Version, - tenantId: CurrentTenant.Id); - - var stepNodes = new List(); - var stepCompensateNodes = new List(); - - ICollection CreateCompensateNodes(StepNode node, ICollection steps) - { - var stepNodes = new List(); - foreach (var step in steps) - { - var stepNode = new CompensateNode( - GuidGenerator.Create(), - workflow.Id, - step.Name, - step.StepType, - step.CancelCondition, - saga: step.Saga, - parentId: node.Id, - tenantId: CurrentTenant.Id); - stepNode.Inputs.AddIfNotContains(step.Inputs); - stepNode.Outputs.AddIfNotContains(step.Outputs); - stepNode.SelectNextStep.AddIfNotContains(step.SelectNextStep); - - stepNodes.Add(stepNode); - } - return stepNodes; - } - - foreach (var stepInput in input.Steps) - { - var stepNode = new StepNode( - GuidGenerator.Create(), - workflow.Id, - stepInput.Name, - stepInput.StepType, - stepInput.CancelCondition, - saga: stepInput.Saga, - tenantId: CurrentTenant.Id); - stepNode.Inputs.AddIfNotContains(stepInput.Inputs); - stepNode.Outputs.AddIfNotContains(stepInput.Outputs); - stepNode.SelectNextStep.AddIfNotContains(stepInput.SelectNextStep); - - stepNodes.Add(stepNode); - stepCompensateNodes.AddRange(CreateCompensateNodes(stepNode, stepInput.CompensateWith)); - } - - await _workflowRepository.InsertAsync(workflow); - await _stepNodeRepository.InsertManyAsync(stepNodes); - await _compensateNodeRepository.InsertManyAsync(stepCompensateNodes); - - _workflowManager.Register(workflow, stepNodes, stepCompensateNodes); - } - - public virtual async Task StartAsync(string id, WorkflowStartInput input) + public virtual async Task StartAsync(string id, WorkflowStartInput input) { var workflowData = new Dictionary(); foreach (var data in input.Data) { if (data.Value is JsonElement element) { - //var dataDic = new Dictionary(); - //var children = element.EnumerateObject(); - //while (children.MoveNext()) - //{ - // dataDic.TryAdd(children.Current.Name, children.Current.Value.ToString()); - //} - //JsonConvert.DeserializeObject(element.ToString()) workflowData.TryAdd(data.Key, JsonConvert.DeserializeObject(element.ToString())); } else @@ -141,7 +57,7 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows var instanceId = await _controller.StartWorkflow(id, workflowData); var result = await _persistence.GetWorkflowInstance(instanceId); - return ObjectMapper.Map(result); + return ObjectMapper.Map(result); } public virtual async Task SuspendAsync(string id) diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionAppService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionAppService.cs new file mode 100644 index 000000000..ee48cb78f --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionAppService.cs @@ -0,0 +1,142 @@ +using LINGYUN.Abp.WorkflowManagement.Authorization; +using Microsoft.AspNetCore.Authorization; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; + +namespace LINGYUN.Abp.WorkflowManagement.Workflows +{ + [Authorize(WorkflowManagementPermissions.WorkflowDef.Default)] + public class WorkflowDefinitionAppService : WorkflowManagementAppServiceBase, IWorkflowDefinitionAppService + { + private readonly WorkflowManager _workflowManager; + + private readonly IWorkflowRepository _workflowRepository; + private readonly IStepNodeRepository _stepNodeRepository; + private readonly ICompensateNodeRepository _compensateNodeRepository; + + public WorkflowDefinitionAppService( + WorkflowManager workflowManager, + IWorkflowRepository workflowRepository, + IStepNodeRepository stepNodeRepository, + ICompensateNodeRepository compensateNodeRepository) + { + _workflowManager = workflowManager; + _workflowRepository = workflowRepository; + _stepNodeRepository = stepNodeRepository; + _compensateNodeRepository = compensateNodeRepository; + } + + [Authorize(WorkflowManagementPermissions.WorkflowDef.Create)] + public virtual async Task CreateAsync(WorkflowDefinitionCreateDto input) + { + if (await _workflowRepository.CheckVersionAsync(input.Name, input.Version)) + { + throw new BusinessException(); + } + + var workflowDef = new Workflow( + GuidGenerator.Create(), + input.Name, + input.DisplayName, + input.Description, + input.Version, + tenantId: CurrentTenant.Id) + { + IsEnabled = input.IsEnabled, + }; + + var stepDefNodes = new List(); + var stepCompensateDefNodes = new List(); + + ICollection CreateCompensateNodes(StepNode node, ICollection steps) + { + var stepNodes = new List(); + foreach (var step in steps) + { + var stepNode = new CompensateNode( + GuidGenerator.Create(), + workflowDef.Id, + step.Name, + step.StepType, + step.CancelCondition, + saga: step.Saga, + parentId: node.Id, + tenantId: CurrentTenant.Id); + stepNode.Inputs.AddIfNotContains(step.Inputs); + stepNode.Outputs.AddIfNotContains(step.Outputs); + stepNode.SelectNextStep.AddIfNotContains(step.SelectNextStep); + + stepNodes.Add(stepNode); + } + return stepNodes; + } + + foreach (var stepInput in input.Steps) + { + var stepNode = new StepNode( + GuidGenerator.Create(), + workflowDef.Id, + stepInput.Name, + stepInput.StepType, + stepInput.CancelCondition, + saga: stepInput.Saga, + tenantId: CurrentTenant.Id); + stepNode.Inputs.AddIfNotContains(stepInput.Inputs); + stepNode.Outputs.AddIfNotContains(stepInput.Outputs); + stepNode.SelectNextStep.AddIfNotContains(stepInput.SelectNextStep); + + stepDefNodes.Add(stepNode); + stepCompensateDefNodes.AddRange(CreateCompensateNodes(stepNode, stepInput.CompensateWith)); + } + + await _workflowRepository.InsertAsync(workflowDef); + await _stepNodeRepository.InsertManyAsync(stepDefNodes); + await _compensateNodeRepository.InsertManyAsync(stepCompensateDefNodes); + + _workflowManager.Register(workflowDef, stepDefNodes, stepCompensateDefNodes); + + var workflowDto = ObjectMapper.Map(workflowDef); + + workflowDto.Steps.AddRange( + ObjectMapper.Map, List>(stepDefNodes)); + + workflowDto.CompensateNodes.AddRange( + ObjectMapper.Map, List>(stepCompensateDefNodes)); + + return workflowDto; + } + + [Authorize(WorkflowManagementPermissions.WorkflowDef.Delete)] + public virtual async Task DeleteAsync(Guid id) + { + var workflowDef = await _workflowRepository.GetAsync(id); + var stepDefNodes = await _stepNodeRepository.GetAllChildrenWithWorkflowAsync(workflowDef.Id); + var compensateDefNodes = await _compensateNodeRepository.GetAllChildrenWithWorkflowAsync(workflowDef.Id); + + await _workflowRepository.DeleteAsync(workflowDef); + await _stepNodeRepository.DeleteManyAsync(stepDefNodes); + await _compensateNodeRepository.DeleteManyAsync(compensateDefNodes); + + _workflowManager.UnRegister(workflowDef); + } + + public virtual async Task GetAsync(Guid id) + { + var workflowDef = await _workflowRepository.GetAsync(id); + var stepDefNodes = await _stepNodeRepository.GetAllChildrenWithWorkflowAsync(workflowDef.Id); + var compensateDefNodes = await _compensateNodeRepository.GetAllChildrenWithWorkflowAsync(workflowDef.Id); + + var workflowDto = ObjectMapper.Map(workflowDef); + + workflowDto.Steps.AddRange( + ObjectMapper.Map, List>(stepDefNodes)); + + workflowDto.CompensateNodes.AddRange( + ObjectMapper.Map, List>(compensateDefNodes)); + + return workflowDto; + } + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/en.json b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/en.json index d656102c6..8d6307935 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/en.json @@ -2,6 +2,11 @@ "culture": "en", "texts": { "Permission:WorkflowManagement": "WorkflowManagement", + "Permission:Engine": "Engine", + "Permission:Initialize": "Initialize", + "Permission:WorkflowDef": "Definition", + "Permission:Create": "Create", + "Permission:Delete": "Delete", "Permission:ManageSettings": "Manage Settings" } } \ No newline at end of file diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/zh-Hans.json index c18804bb8..7579b8456 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/Localization/Resources/zh-Hans.json @@ -1,7 +1,12 @@ { "culture": "zh-Hans", "texts": { - "Permission:WorkflowManagement": "WorkflowManagement", + "Permission:WorkflowManagement": "工作流管理", + "Permission:Engine": "流程引擎", + "Permission:Initialize": "初始化", + "Permission:WorkflowDef": "流程定义", + "Permission:Create": "创建", + "Permission:Delete": "删除", "Permission:ManageSettings": "管理设置" } } \ No newline at end of file diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/IWorkflowEngineManager.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/IWorkflowEngineManager.cs new file mode 100644 index 000000000..22779459d --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/IWorkflowEngineManager.cs @@ -0,0 +1,14 @@ +using System.Threading; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.WorkflowManagement +{ + public interface IWorkflowEngineManager + { + Task InitializeAsync(CancellationToken cancellationToken = default); + + Task StopAsync(CancellationToken cancellationToken = default); + + Task StartAsync(CancellationToken cancellationToken = default); + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/Workflow.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/Workflow.cs index 098c42a82..18e082d47 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/Workflow.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/Workflow.cs @@ -17,7 +17,7 @@ namespace LINGYUN.Abp.WorkflowManagement /// /// 是否启用 /// - public virtual bool IsEnabled { get; protected set; } + public virtual bool IsEnabled { get; set; } /// /// 名称 /// diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowManager.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowManager.cs index 953bd52cc..65b60a6b4 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowManager.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowManager.cs @@ -29,6 +29,14 @@ namespace LINGYUN.Abp.WorkflowManagement _persistenceProvider = persistenceProvider; } + public virtual void UnRegister(Workflow workflow) + { + if (_registry.IsRegistered(workflow.Id.ToString(), workflow.Version)) + { + _registry.DeregisterWorkflow(workflow.Id.ToString(), workflow.Version); + } + } + public virtual WorkflowDefinition Register( Workflow workflow, ICollection steps, diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowRegisterService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowRegisterService.cs index cdeb7b52f..85e34d799 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowRegisterService.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain/LINGYUN/Abp/WorkflowManagement/WorkflowRegisterService.cs @@ -26,7 +26,7 @@ namespace LINGYUN.Abp.WorkflowManagement protected override async Task ExecuteAsync(CancellationToken stoppingToken) { - var workflows = await _workflowRepository.GetListAsync(cancellationToken: stoppingToken); + var workflows = await _workflowRepository.GetListAsync(x => x.IsEnabled, cancellationToken: stoppingToken); foreach (var workflow in workflows) { diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Engine/EngineController.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Engine/EngineController.cs new file mode 100644 index 000000000..0bc7d4b62 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Engine/EngineController.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.WorkflowManagement.Engine +{ + [RemoteService(Name = WorkflowManagementRemoteServiceConsts.RemoteServiceName)] + [Area("WorkflowManagement")] + [Route("api/workflow-management/engine")] + public class EngineController : AbpControllerBase, IEngineAppService + { + private readonly IEngineAppService _service; + + public EngineController(IEngineAppService service) + { + _service = service; + } + + [HttpPost] + [Route("initialize")] + public virtual async Task InitializeAsync() + { + await _service.InitializeAsync(); + } + } +} diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowController.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowController.cs index d7c984c77..ed89507ae 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowController.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowController.cs @@ -19,7 +19,7 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows [HttpGet] [Route("{id}")] - public virtual async Task GetAsync(string id) + public virtual async Task GetAsync(string id) { return await _service.GetAsync(id); } @@ -31,15 +31,9 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows await _service.ResumeAsync(id); } - [HttpPost] - public virtual async Task CreateAsync(WorkflowCreateDto input) - { - await _service.CreateAsync(input); - } - [HttpPost] [Route("{id}/start")] - public virtual async Task StartAsync(string id, WorkflowStartInput input) + public virtual async Task StartAsync(string id, WorkflowStartInput input) { return await _service.StartAsync(id, input); } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionController.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionController.cs new file mode 100644 index 000000000..fd467ab09 --- /dev/null +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.HttpApi/LINGYUN/Abp/WorkflowManagement/Workflows/WorkflowDefinitionController.cs @@ -0,0 +1,42 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.WorkflowManagement.Workflows +{ + [RemoteService(Name = WorkflowManagementRemoteServiceConsts.RemoteServiceName)] + [Area("WorkflowManagement")] + [Route("api/workflow-management/workflows/definition")] + public class WorkflowDefinitionController : AbpControllerBase, IWorkflowDefinitionAppService + { + private readonly IWorkflowDefinitionAppService _service; + + public WorkflowDefinitionController( + IWorkflowDefinitionAppService service) + { + _service = service; + } + + [HttpPost] + public virtual async Task CreateAsync(WorkflowDefinitionCreateDto input) + { + return await _service.CreateAsync(input); + } + + [HttpDelete] + [Route("{id}")] + public virtual async Task DeleteAsync(Guid id) + { + await _service.DeleteAsync(id); + } + + [HttpGet] + [Route("{id}")] + public virtual async Task GetAsync(Guid id) + { + return await _service.GetAsync(id); + } + } +} diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowEngineManager.cs b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowEngineManager.cs new file mode 100644 index 000000000..c64cc7f08 --- /dev/null +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowEngineManager.cs @@ -0,0 +1,61 @@ +using LINGYUN.Abp.Data.DbMigrator; +using LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore; +using LINGYUN.Abp.WorkflowManagement; +using LINGYUN.Abp.WorkflowManagement.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using WorkflowCore.Interface; + +namespace LY.MicroService.WorkflowManagement; + +public class WorkflowEngineManager : IWorkflowEngineManager, ISingletonDependency +{ + private readonly IWorkflowHost _workflowHost; + private readonly IDbSchemaMigrator _dbSchemaMigrator; + private readonly ILogger _logger; + public WorkflowEngineManager( + IWorkflowHost workflowHost, + IDbSchemaMigrator dbSchemaMigrator, + ILogger logger) + { + _logger = logger; + _workflowHost = workflowHost; + _dbSchemaMigrator = dbSchemaMigrator; + } + + public async Task InitializeAsync(CancellationToken cancellationToken = default) + { + _logger.LogInformation("Migrating workflow core context..."); + await _dbSchemaMigrator.MigrateAsync( + (connectionString, builder) => + { + builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); + + return new WorkflowDbContext(builder.Options); + }); + _logger.LogInformation("Migrated workflow core context."); + + _logger.LogInformation("Migrating workflow management context..."); + await _dbSchemaMigrator.MigrateAsync( + (connectionString, builder) => + { + builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); + + return new WorkflowManagementDbContext(builder.Options); + }); + _logger.LogInformation("Migrated workflow management context."); + } + + public async Task StartAsync(CancellationToken cancellationToken = default) + { + await _workflowHost.StartAsync(cancellationToken); + } + + public async Task StopAsync(CancellationToken cancellationToken = default) + { + await _workflowHost.StopAsync(cancellationToken); + } +} diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs index 560230193..05ba245fb 100644 --- a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs @@ -64,11 +64,6 @@ namespace LY.MicroService.WorkflowManagement { options.UseMySQL(); }); - - Configure(options => - { - - }); } private void ConfigureJsonSerializer() diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs index 35ca7ab1b..044149d28 100644 --- a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs @@ -1,5 +1,6 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch; using LINGYUN.Abp.BlobStoring.OssManagement; +using LINGYUN.Abp.Data.DbMigrator; using LINGYUN.Abp.ExceptionHandling.Emailing; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.MultiTenancy.DbFinder; @@ -60,6 +61,7 @@ namespace LY.MicroService.WorkflowManagement typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpDataDbMigratorModule), typeof(AbpCachingStackExchangeRedisModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpSwashbuckleModule), @@ -89,6 +91,9 @@ namespace LY.MicroService.WorkflowManagement ConfigureBlobStoring(context.Services, configuration); ConfigureDistributedLock(context.Services, configuration); ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); + + // 开发取消权限检查 + // context.Services.AddAlwaysAllowAuthorization(); } public override void OnApplicationInitialization(ApplicationInitializationContext context)