diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN.Abp.WorkflowCore.Components.csproj b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN.Abp.WorkflowCore.Components.csproj
index 76233328a..41f84616c 100644
--- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN.Abp.WorkflowCore.Components.csproj
+++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN.Abp.WorkflowCore.Components.csproj
@@ -11,6 +11,7 @@
+
diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/AbpWorkflowCoreComponentsModule.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/AbpWorkflowCoreComponentsModule.cs
index cac71425a..fc0630583 100644
--- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/AbpWorkflowCoreComponentsModule.cs
+++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/AbpWorkflowCoreComponentsModule.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Emailing;
+using LINGYUN.Abp.WorkflowCore.Components.Authentication;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Emailing;
using Volo.Abp.Modularity;
using Volo.Abp.Sms;
@@ -10,5 +12,9 @@ namespace LINGYUN.Abp.WorkflowCore.Components
typeof(AbpWorkflowCoreModule))]
public class AbpWorkflowCoreComponentsModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ context.Services.AddSingleton(AsyncLocalCurrentAssigner.Instance);
+ }
}
}
diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/Primitives/RemoteService.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/Primitives/RemoteService.cs
new file mode 100644
index 000000000..e648318a5
--- /dev/null
+++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Components/LINGYUN/Abp/WorkflowCore/Components/Primitives/RemoteService.cs
@@ -0,0 +1,81 @@
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using Volo.Abp.Localization;
+using Volo.Abp.MultiTenancy;
+using WorkflowCore.Interface;
+using WorkflowCore.Models;
+
+namespace LINGYUN.Abp.WorkflowCore.Components.Primitives
+{
+ public class RemoteService : StepBodyAsyncBase
+ {
+ private readonly ICurrentTenant _currentTenant;
+ private readonly IServiceProvider _serviceProvider;
+ public RemoteService(
+ ICurrentTenant currentTenant,
+ IServiceProvider serviceProvider)
+ {
+ _currentTenant = currentTenant;
+ _serviceProvider = serviceProvider;
+
+ Data = new Dictionary();
+ }
+ ///
+ /// 远程服务接口类型
+ ///
+ public string Interface { get; set; }
+ ///
+ /// 远程服务方法名称
+ ///
+ public string Method { get; set; }
+ ///
+ /// 请求参数
+ ///
+ public Dictionary Data { get; set; }
+ ///
+ /// 调用结果
+ ///
+ public object Result { get; set; }
+
+ public Guid? TenantId { get; set; }
+ public string CurrentCulture { get; set; }
+
+ public override async Task RunAsync(IStepExecutionContext context)
+ {
+ var serviceType = Type.GetType(Interface, true, true);
+ var method = serviceType.GetMethod(Method);
+
+ var serviceFactory = _serviceProvider.GetRequiredService(serviceType);
+
+ using (_currentTenant.Change(TenantId))
+ {
+ using (CultureHelper.Use(CurrentCulture ?? CultureInfo.CurrentCulture.Name))
+ {
+ // TODO: 身份令牌?
+ // 工作流中是否需要调用API, 还是用户调用API之后传递事件激活下一个步骤
+
+ // Abp Api动态代理
+ var result = (Task)method.Invoke(serviceFactory, Data.Select(x => x.Value).ToArray());
+ await result;
+
+ if (!method.ReturnType.GenericTypeArguments.IsNullOrEmpty())
+ {
+ var resultType = method.ReturnType.GenericTypeArguments[0];
+ var resultProperty = typeof(Task<>)
+ .MakeGenericType(resultType)
+ .GetProperty(nameof(Task