diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/ActivityReleaseInput.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/ActivityReleaseInput.cs index f58b3287e..22ab0043d 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/ActivityReleaseInput.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/ActivityReleaseInput.cs @@ -1,7 +1,10 @@ -namespace LINGYUN.Abp.WorkflowManagement.Activitys +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.WorkflowManagement.Activitys { public class ActivityReleaseInput { + [Required] public string Token { get; set; } } } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/GetPendingActivityInput.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/GetPendingActivityInput.cs index b7d8ed790..e2f72e3fd 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/GetPendingActivityInput.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Activitys/Dto/GetPendingActivityInput.cs @@ -1,11 +1,14 @@ using System; +using System.ComponentModel.DataAnnotations; namespace LINGYUN.Abp.WorkflowManagement.Activitys { public class GetPendingActivityInput { + [Required] public string ActivityName { get; set; } + [Required] public string WorkflowId { get; set; } public TimeSpan? Timeout { get; set; } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Events/Dto/EventPublishInput.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Events/Dto/EventPublishInput.cs index 14f5c791d..0b0dbd562 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Events/Dto/EventPublishInput.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Events/Dto/EventPublishInput.cs @@ -6,9 +6,11 @@ namespace LINGYUN.Abp.WorkflowManagement.Events public class EventPublishInput { [Required] + [StringLength(200)] public string EventName { get; set; } [Required] + [StringLength(200)] public string EventKey { get; set; } [Required] diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepDto.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepDto.cs index a79cab6c6..a9347ec8c 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepDto.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/StepDto.cs @@ -1,13 +1,22 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using Volo.Abp.Data; +using Volo.Abp.Validation; namespace LINGYUN.Abp.WorkflowManagement.Workflows { public class StepDto { + [Required] + [DynamicStringLength(typeof(WorkflowConsts), nameof(WorkflowConsts.MaxNameLength))] public string Name { get; set; } + + [Required] + [DynamicStringLength(typeof(WorkflowConsts), nameof(WorkflowConsts.MaxStepTypeLength))] public string StepType { get; set; } + + [DynamicStringLength(typeof(WorkflowConsts), nameof(WorkflowConsts.MaxCancelConditionLength))] public string CancelCondition { get; set; } public TimeSpan? RetryInterval { get; set; } public bool Saga { get; set; } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs index d8a4bc6ec..307ae0b09 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Application.Contracts/LINGYUN/Abp/WorkflowManagement/Workflows/Dto/WorkflowDefinitionCreateDto.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; namespace LINGYUN.Abp.WorkflowManagement.Workflows { @@ -11,20 +13,29 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows /// /// 名称 /// + [Required] + [DynamicStringLength(typeof(WorkflowConsts), nameof(WorkflowConsts.MaxNameLength))] public string Name { get; set; } /// /// 显示名称 /// + [Required] + [DynamicStringLength(typeof(WorkflowConsts), nameof(WorkflowConsts.MaxDisplayNameLength))] public string DisplayName { get; set; } /// /// 描述 /// + [DynamicStringLength(typeof(WorkflowConsts), nameof(WorkflowConsts.MaxDescriptionLength))] public string Description { get; set; } /// /// 版本号 /// + [Required] + [Range(1, 100)] public int Version { get; set; } + [Required] + [MinLength(1)] public List Steps { get; set; } = new List(); } } 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 0bae04835..d23e68124 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 @@ -35,7 +35,9 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows var result = await _controller.ResumeWorkflow(id); if (!result) { - throw new BusinessException(); + throw new BusinessException( + WorkflowManagementErrorCodes.SuspendError, + "The workflow cannot be resumed at this time. Please check the log"); } } @@ -65,7 +67,9 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows var result = await _controller.SuspendWorkflow(id); if (!result) { - throw new BusinessException(); + throw new BusinessException( + WorkflowManagementErrorCodes.SuspendError, + "The workflow cannot be suspend at this time. Please check the log"); } } @@ -74,7 +78,9 @@ namespace LINGYUN.Abp.WorkflowManagement.Workflows var result = await _controller.TerminateWorkflow(id); if (!result) { - throw new BusinessException(); + throw new BusinessException( + WorkflowManagementErrorCodes.TerminateError, + "The workflow cannot be terminated at this time. Please check the log"); } } } 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 8d6307935..f986379a3 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 @@ -7,6 +7,30 @@ "Permission:WorkflowDef": "Definition", "Permission:Create": "Create", "Permission:Delete": "Delete", - "Permission:ManageSettings": "Manage Settings" + "Permission:ManageSettings": "Manage Settings", + "Workflow:10100": "Unable to restart workflow temporarily, please check log.", + "Workflow:10101": "Unable to suspend workflow, please check log.", + "Workflow:10102": "Unable to terminate workflow temporarily, please check log.", + "DisplayName:IsEnabled": "Is Enabled", + "DisplayName:Name": "Name", + "DisplayName:DisplayName": "DisplayName", + "DisplayName:Description": "Description", + "DisplayName:Version": "Version", + "DisplayName:Steps": "Steps", + "DisplayName:StepType": "Step Type", + "DisplayName:CancelCondition": "Cancel Condition", + "DisplayName:RetryInterval": "Retry Interval", + "DisplayName:NextStep": "Next Step", + "DisplayName:CompensateWith": "Compensates", + "DisplayName:Inputs": "Inputs", + "DisplayName:Outputs": "Outputs", + "DisplayName:SelectNextStep": "Select Next Step", + "DisplayName:EventName": "Event Name", + "DisplayName:EventKey": "Event Key", + "DisplayName:EventData": "Event Data", + "DisplayName:Token": "Token", + "DisplayName:Result": "Result", + "DisplayName:ActivityName": "Activity Name", + "DisplayName:WorkflowId": "Workflow Id" } } \ 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 7579b8456..4744c7e59 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 @@ -7,6 +7,30 @@ "Permission:WorkflowDef": "流程定义", "Permission:Create": "创建", "Permission:Delete": "删除", - "Permission:ManageSettings": "管理设置" + "Permission:ManageSettings": "管理设置", + "Workflow:10100": "暂时无法重启工作流,请检查日志.", + "Workflow:10101": "暂时无法暂停工作流,请检查日志.", + "Workflow:10102": "暂时无法终止工作流,请检查日志.", + "DisplayName:IsEnabled": "是否启用", + "DisplayName:Name": "名称", + "DisplayName:DisplayName": "显示名称", + "DisplayName:Description": "描述", + "DisplayName:Version": "版本", + "DisplayName:Steps": "节点列表", + "DisplayName:StepType": "步骤类型", + "DisplayName:CancelCondition": "终止条件", + "DisplayName:RetryInterval": "重试间隔", + "DisplayName:NextStep": "下一个节点", + "DisplayName:CompensateWith": "补偿节点", + "DisplayName:Inputs": "数据输入", + "DisplayName:Outputs": "数据输出", + "DisplayName:SelectNextStep": "选择下一步", + "DisplayName:EventName": "事件名称", + "DisplayName:EventKey": "事件标识", + "DisplayName:EventData": "事件数据", + "DisplayName:Token": "令牌", + "DisplayName:Result": "返回数据", + "DisplayName:ActivityName": "活动名称", + "DisplayName:WorkflowId": "工作流标识" } } \ No newline at end of file diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementDomainSharedModule.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementDomainSharedModule.cs index e580439ba..fc6a953ab 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementDomainSharedModule.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementDomainSharedModule.cs @@ -21,7 +21,7 @@ namespace LINGYUN.Abp.WorkflowManagement { options.Resources .Add() - .AddVirtualJson("/Abp/WorkflowManagement/Localization/Resources"); + .AddVirtualJson("/LINGYUN/Abp/WorkflowManagement/Localization/Resources"); }); Configure(options => diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementErrorCodes.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementErrorCodes.cs index 9d611e14e..c0d826271 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementErrorCodes.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowManagement.Domain.Shared/LINGYUN/Abp/WorkflowManagement/WorkflowManagementErrorCodes.cs @@ -2,6 +2,10 @@ { public static class WorkflowManagementErrorCodes { - public const string Namespace = "WorkflowManagement"; + public const string Namespace = "Workflow"; + + public const string ResumeError = Namespace + ":10100"; + public const string SuspendError = Namespace + ":10101"; + public const string TerminateError = Namespace + ":10102"; } }