Browse Source

add support elsa activities real-time.

pull/638/head
cKey 3 years ago
parent
commit
c43383e0a7
  1. 21
      aspnet-core/LINGYUN.MicroService.Workflow.sln
  2. 2
      aspnet-core/common.props
  3. 14
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs
  4. 2
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/LastChatMessage.cs
  5. 2
      aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSourceType.cs
  6. 2
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/FodyWeavers.xml
  7. 16
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/BlobActivity.cs
  8. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/BlobExists.cs
  9. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/DeleteBlob.cs
  10. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/ReadBlob.cs
  11. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/WriteBlob.cs
  12. 4
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/ElsaBlobContainer.cs
  13. 3
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/FodyWeavers.xml
  14. 17
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN.Abp.Elsa.Activities.IM.csproj
  15. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN/Abp/Elsa/Activities/IM/AbpElsaActivitiesIMModule.cs
  16. 90
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN/Abp/Elsa/Activities/IM/Activities/SendMessage.cs
  17. 16
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN/Abp/Elsa/Activities/IM/Startup.cs
  18. 15
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/Microsoft/Extensions/DependencyInjection/IMServiceCollectionExtensions.cs
  19. 3
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/FodyWeavers.xml
  20. 30
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/FodyWeavers.xsd
  21. 17
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN.Abp.Elsa.Activities.Notifications.csproj
  22. 11
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN/Abp/Elsa/Activities/Notifications/AbpElsaActivitiesNotificationsModule.cs
  23. 82
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN/Abp/Elsa/Activities/Notifications/Activities/SendNotification.cs
  24. 16
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN/Abp/Elsa/Activities/Notifications/Startup.cs
  25. 15
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/Microsoft/Extensions/DependencyInjection/NotificationServiceCollectionExtensions.cs
  26. 3
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFramework.Core/FodyWeavers.xml
  27. 2
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/FodyWeavers.xml
  28. 17
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/Elsa/Models/WorkflowInstanceExtensions.cs
  29. 12
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/Elsa/Services/Models/ActivityExecutionContextExtensions.cs
  30. 2
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/FodyWeavers.xml
  31. 1
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj
  32. 3
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpElsaModule.cs
  33. 7
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpTenantAccessor.cs
  34. 52
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpWorkflowRunner.cs
  35. 4
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/Message.cs
  36. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserMessage.cs
  37. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Groups/GroupMessage.cs
  38. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs
  39. 2
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj
  40. 2
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs
  41. 2
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.Development.json

21
aspnet-core/LINGYUN.MicroService.Workflow.sln

@ -57,7 +57,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.Server", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.EntityFramework.Core", "modules\elsa\LINGYUN.Abp.Elsa.EntityFramework.Core\LINGYUN.Abp.Elsa.EntityFramework.Core.csproj", "{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.Activities.BlobStoring", "modules\elsa\LINGYUN.Abp.Elsa.Activities.BlobStoring\LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj", "{81CB5141-4FC5-413A-A516-CD65F40465C0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.Activities.BlobStoring", "modules\elsa\LINGYUN.Abp.Elsa.Activities.BlobStoring\LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj", "{81CB5141-4FC5-413A-A516-CD65F40465C0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Elsa.Activities.Notifications", "modules\elsa\LINGYUN.Abp.Elsa.Activities.Notifications\LINGYUN.Abp.Elsa.Activities.Notifications.csproj", "{F5023AD3-D9C5-40C9-B76A-58D95E441997}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Elsa.Activities.IM", "modules\elsa\LINGYUN.Abp.Elsa.Activities.IM\LINGYUN.Abp.Elsa.Activities.IM.csproj", "{4FD7B21B-3689-4D4A-BDD2-A07E2DC2E80C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -149,10 +153,14 @@ Global
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81CB5141-4FC5-413A-A516-CD65F40465C0}.Release|Any CPU.Build.0 = Release|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00CB6328-83F0-4C50-9561-2C61AFC03CA1}.Release|Any CPU.Build.0 = Release|Any CPU
{F5023AD3-D9C5-40C9-B76A-58D95E441997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5023AD3-D9C5-40C9-B76A-58D95E441997}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5023AD3-D9C5-40C9-B76A-58D95E441997}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5023AD3-D9C5-40C9-B76A-58D95E441997}.Release|Any CPU.Build.0 = Release|Any CPU
{4FD7B21B-3689-4D4A-BDD2-A07E2DC2E80C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FD7B21B-3689-4D4A-BDD2-A07E2DC2E80C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FD7B21B-3689-4D4A-BDD2-A07E2DC2E80C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FD7B21B-3689-4D4A-BDD2-A07E2DC2E80C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -182,7 +190,8 @@ Global
{88AA0D46-597E-4969-8382-A3F8054B9409} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{CAC0D3A2-8BFA-4A84-A7FA-550A3BB16288} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{81CB5141-4FC5-413A-A516-CD65F40465C0} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{00CB6328-83F0-4C50-9561-2C61AFC03CA1} = {2F51B296-58EB-4D54-9921-5A07E6E4B7BF}
{F5023AD3-D9C5-40C9-B76A-58D95E441997} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
{4FD7B21B-3689-4D4A-BDD2-A07E2DC2E80C} = {F1CCBEC7-ACAB-4DC5-909E-D8CC2E1B7EEC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BB7A5DE-DA12-44DC-BC9B-0F6CA524346F}

2
aspnet-core/common.props

@ -3,7 +3,7 @@
<LangVersion>latest</LangVersion>
<Version>5.3.2</Version>
<Authors>colin</Authors>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<NoWarn>$(NoWarn);CS1591;CS0436;CS8618</NoWarn>
<PackageProjectUrl>https://github.com/colinin/abp-next-admin</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>

14
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/ChatMessage.cs

@ -59,7 +59,7 @@ namespace LINGYUN.Abp.IM.Messages
/// </summary>
public MessageType MessageType { get; set; } = MessageType.Text;
public MessageSourceTye Source { get; set; } = MessageSourceTye.User;
public MessageSourceType Source { get; set; } = MessageSourceType.User;
public ExtraPropertyDictionary ExtraProperties { get; set; }
@ -77,7 +77,7 @@ namespace LINGYUN.Abp.IM.Messages
IClock clock,
bool isAnonymous = false,
MessageType type = MessageType.Text,
MessageSourceTye souce = MessageSourceTye.User,
MessageSourceType souce = MessageSourceType.User,
Guid? tenantId = null)
{
return new ChatMessage
@ -111,7 +111,7 @@ namespace LINGYUN.Abp.IM.Messages
IsAnonymous = false,
MessageType = type,
TenantId = tenantId,
Source = MessageSourceTye.System,
Source = MessageSourceType.System,
}
.SetProperty("L", false);
}
@ -145,7 +145,7 @@ namespace LINGYUN.Abp.IM.Messages
IsAnonymous = false,
MessageType = type,
TenantId = tenantId,
Source = MessageSourceTye.System,
Source = MessageSourceType.System,
}
.SetProperty("L", true)
.SetProperty(nameof(ChatMessage.Content).ToPascalCase(), content);
@ -169,7 +169,7 @@ namespace LINGYUN.Abp.IM.Messages
IsAnonymous = false,
MessageType = type,
TenantId = tenantId,
Source = MessageSourceTye.System,
Source = MessageSourceType.System,
}
.SetProperty("L", false);
}
@ -202,7 +202,7 @@ namespace LINGYUN.Abp.IM.Messages
IsAnonymous = false,
MessageType = type,
TenantId = tenantId,
Source = MessageSourceTye.System,
Source = MessageSourceType.System,
}
.SetProperty("L", true)
.SetProperty(nameof(ChatMessage.Content).ToPascalCase(), content);
@ -216,7 +216,7 @@ namespace LINGYUN.Abp.IM.Messages
IClock clock,
bool isAnonymous = false,
MessageType type = MessageType.Text,
MessageSourceTye souce = MessageSourceTye.User,
MessageSourceType souce = MessageSourceType.User,
Guid? tenantId = null)
{
return new ChatMessage

2
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/LastChatMessage.cs

@ -59,7 +59,7 @@ namespace LINGYUN.Abp.IM.Messages
/// </summary>
public MessageType MessageType { get; set; }
public MessageSourceTye Source { get; set; }
public MessageSourceType Source { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; }
public LastChatMessage()
{

2
aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSourceTye.cs → aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSourceType.cs

@ -1,6 +1,6 @@
namespace LINGYUN.Abp.IM.Messages
{
public enum MessageSourceTye
public enum MessageSourceType
{
User = 0,
System = 10,

2
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/FodyWeavers.xml

@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

16
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/BlobActivity.cs

@ -0,0 +1,16 @@
using Elsa.Services;
using Volo.Abp.BlobStoring;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
public abstract class BlobActivity : Activity
{
protected ICurrentTenant CurrentTenant;
protected IBlobContainer<ElsaBlobContainer> BlobContainer;
protected BlobActivity(IBlobContainer<ElsaBlobContainer> blobContainer)
{
BlobContainer = blobContainer;
}
}

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/BlobExists.cs

@ -1,7 +1,6 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
@ -12,21 +11,19 @@ namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Check if a blob exists.",
Outcomes = new[] { OutcomeNames.True, OutcomeNames.False })]
public class BlobExists : Activity
public class BlobExists : BlobActivity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the oss.")]
public string? Path { get; set; }
public BlobExists(IBlobContainer<AbpElsaBlobContainer> container)
public BlobExists(IBlobContainer<ElsaBlobContainer> blobContainer)
: base(blobContainer)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
var exists = await _container.ExistsAsync(Path, context.CancellationToken);
var exists = await BlobContainer.ExistsAsync(Path, context.CancellationToken);
if (exists)
{
return Outcome(OutcomeNames.True);

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/DeleteBlob.cs

@ -1,7 +1,6 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
@ -12,21 +11,19 @@ namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Deletes blob at specified location",
Outcomes = new[] { OutcomeNames.Done })]
public class DeleteBlob : Activity
public class DeleteBlob : BlobActivity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the blob to be deleted.")]
public string? Path { get; set; }
public DeleteBlob(IBlobContainer<AbpElsaBlobContainer> container)
public DeleteBlob(IBlobContainer<ElsaBlobContainer> blobContainer)
: base(blobContainer)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
await _container.DeleteAsync(Path, context.CancellationToken);
await BlobContainer.DeleteAsync(Path, context.CancellationToken);
return Done();
}

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/ReadBlob.cs

@ -1,7 +1,6 @@
using Elsa;
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
@ -12,24 +11,22 @@ namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Reads a blob.",
Outcomes = new[] { OutcomeNames.Done })]
public class ReadBlob : Activity
public class ReadBlob : BlobActivity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the blob.")]
public string? Path { get; set; }
[ActivityOutput]
public byte[]? Output { get; set; }
public ReadBlob(IBlobContainer<AbpElsaBlobContainer> container)
public ReadBlob(IBlobContainer<ElsaBlobContainer> blobContainer)
: base(blobContainer)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
Output = await _container.GetAllBytesAsync(Path, context.CancellationToken);
Output = await BlobContainer.GetAllBytesAsync(Path, context.CancellationToken);
return Done();
}

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/Activities/WriteBlob.cs

@ -2,7 +2,6 @@
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Expressions;
using Elsa.Services;
using Elsa.Services.Models;
using System;
using System.Threading.Tasks;
@ -13,10 +12,8 @@ namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[Action(Category = "Blob",
Description = "Save a blob.",
Outcomes = new[] { OutcomeNames.Done })]
public class WriteBlob : Activity
public class WriteBlob : BlobActivity
{
private readonly IBlobContainer<AbpElsaBlobContainer> _container;
[ActivityInput(Hint = "Path of the blob.")]
public string? Path { get; set; }
@ -26,14 +23,14 @@ public class WriteBlob : Activity
[ActivityInput(Hint = "The bytes to write.", SupportedSyntaxes = new[] { SyntaxNames.JavaScript }, DefaultSyntax = SyntaxNames.JavaScript)]
public byte[]? Bytes { get; set; }
public WriteBlob(IBlobContainer<AbpElsaBlobContainer> container)
public WriteBlob(IBlobContainer<ElsaBlobContainer> blobContainer)
: base(blobContainer)
{
_container = container;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
await _container.SaveAsync(Path, Bytes, Overwrite, context.CancellationToken);
await BlobContainer.SaveAsync(Path, Bytes, Overwrite, context.CancellationToken);
return Done();
}

4
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/AbpElsaBlobContainer.cs → aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.BlobStoring/LINGYUN/Abp/Elsa/Activities/BlobStoring/ElsaBlobContainer.cs

@ -2,7 +2,7 @@
namespace LINGYUN.Abp.Elsa.Activities.BlobStoring;
[BlobContainerName("elsa-container")]
public class AbpElsaBlobContainer
[BlobContainerName("elsa")]
public class ElsaBlobContainer
{
}

3
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

17
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN.Abp.Elsa.Activities.IM.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\LINGYUN.Abp.IM\LINGYUN.Abp.IM.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN/Abp/Elsa/Activities/IM/AbpElsaActivitiesIMModule.cs

@ -0,0 +1,11 @@
using LINGYUN.Abp.IM;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Elsa.Activities.IM;
[DependsOn(
typeof(AbpElsaModule),
typeof(AbpIMModule))]
public class AbpElsaActivitiesIMModule : AbpModule
{
}

90
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN/Abp/Elsa/Activities/IM/Activities/SendMessage.cs

@ -0,0 +1,90 @@
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Services;
using Elsa.Services.Models;
using LINGYUN.Abp.IM.Messages;
using System;
using System.Threading.Tasks;
using Volo.Abp.Timing;
namespace LINGYUN.Abp.Elsa.Activities.IM;
[Action(Category = "Message", Description = "Send an message.")]
public class SendMessage : Activity
{
private readonly IClock _clock;
private readonly IMessageSender _messageSender;
[ActivityInput(Hint = "The message content.")]
public string Content { get; set; } //TODO: Other message type
[ActivityInput(Hint = "Source user identity.")]
public Guid FormUser { get; set; }
[ActivityInput(Hint = "Source user name.")]
public string? FormUserName { get; set; }
[ActivityInput(
Hint = "Receiving user identity.",
UIHint = "If the value is not empty, it is a user message")]
public Guid? To { get; set; }
[ActivityInput(
Hint = "Receiving group identity.",
UIHint = "If the value is not empty, it is a group message")]
public string? GroupId { get; set; }
[ActivityOutput]
public string? MessageId { get; set; }
public SendMessage(
IClock clock,
IMessageSender messageSender)
{
_clock = clock;
_messageSender = messageSender;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
ChatMessage? chatMessage = null;
var tenantId = context.GetTenantId();
if (!GroupId.IsNullOrWhiteSpace())
{
chatMessage = ChatMessage.Group(
FormUser,
FormUserName,
GroupId,
Content,
_clock,
false,
MessageType.Text,
MessageSourceTye.User,
tenantId);
}
else if (To.HasValue)
{
chatMessage = ChatMessage.User(
FormUser,
FormUserName,
To.Value,
Content,
_clock,
false,
MessageType.Text,
MessageSourceTye.User,
tenantId);
}
if (chatMessage != null)
{
MessageId = await _messageSender.SendMessageAsync(chatMessage);
return Done();
}
return Suspend();
}
}

16
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/LINGYUN/Abp/Elsa/Activities/IM/Startup.cs

@ -0,0 +1,16 @@
using Elsa.Attributes;
using Elsa.Options;
using Elsa.Services.Startup;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace LINGYUN.Abp.Elsa.Activities.IM;
[Feature("IM")]
public class Startup : StartupBase
{
public override void ConfigureElsa(ElsaOptionsBuilder elsa, IConfiguration configuration)
{
elsa.AddIMActivities();
}
}

15
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.IM/Microsoft/Extensions/DependencyInjection/IMServiceCollectionExtensions.cs

@ -0,0 +1,15 @@
using Elsa.Options;
using LINGYUN.Abp.Elsa.Activities.IM;
namespace Microsoft.Extensions.DependencyInjection;
public static class IMServiceCollectionExtensions
{
public static ElsaOptionsBuilder AddIMActivities(this ElsaOptionsBuilder options)
{
options
.AddActivity<SendMessage>();
return options;
}
}

3
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

17
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN.Abp.Elsa.Activities.Notifications.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\LINGYUN.Abp.Notifications\LINGYUN.Abp.Notifications.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN/Abp/Elsa/Activities/Notifications/AbpElsaActivitiesNotificationsModule.cs

@ -0,0 +1,11 @@
using LINGYUN.Abp.Notifications;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Elsa.Activities.Notifications;
[DependsOn(
typeof(AbpElsaModule),
typeof(AbpNotificationModule))]
public class AbpElsaActivitiesNotificationsModule : AbpModule
{
}

82
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN/Abp/Elsa/Activities/Notifications/Activities/SendNotification.cs

@ -0,0 +1,82 @@
using Elsa.ActivityResults;
using Elsa.Attributes;
using Elsa.Design;
using Elsa.Expressions;
using Elsa.Providers.WorkflowStorage;
using Elsa.Services;
using Elsa.Services.Models;
using LINGYUN.Abp.Notifications;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LINGYUN.Abp.Elsa.Activities.Notifications;
[Action(Category = "Notification", Description = "Send an notification.")]
public class SendNotification : Activity
{
private readonly INotificationSender _notificationSender;
[ActivityInput(Hint = "The name of the registered notification.", SupportedSyntaxes = new[] { SyntaxNames.JavaScript, SyntaxNames.Liquid })]
public string NotificationName { get; set; }
[ActivityInput(
Hint = "Notifications pass data or template content.",
UIHint = ActivityInputUIHints.MultiLine,
SupportedSyntaxes = new[] { SyntaxNames.JavaScript, SyntaxNames.Liquid },
DefaultWorkflowStorageProvider = TransientWorkflowStorageProvider.ProviderName
)]
public object NotificationData { get; set; }
[ActivityInput(
Hint = "The recipients user id list.",
UIHint = ActivityInputUIHints.MultiText,
DefaultSyntax = SyntaxNames.Json,
SupportedSyntaxes = new[] { SyntaxNames.Json, SyntaxNames.JavaScript })]
public ICollection<Guid> To { get; set; } = new List<Guid>();
[ActivityInput(Hint = "Notifications severity.", SupportedSyntaxes = new[] { SyntaxNames.JavaScript, SyntaxNames.Liquid })]
public NotificationSeverity Severity { get; set; } = NotificationSeverity.Info;
[ActivityOutput]
public string? NotificationId { get; set; }
public SendNotification(
INotificationSender notificationSender)
{
_notificationSender = notificationSender;
}
protected async override ValueTask<IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
{
var tenantId = context.GetTenantId();
switch (NotificationData)
{
case NotificationData data:
NotificationId = await _notificationSender.SendNofiterAsync(
NotificationName,
data,
GetUserIdentifiers(),
tenantId,
Severity);
return Done();
case NotificationTemplate template:
NotificationId = await _notificationSender.SendNofiterAsync(
NotificationName,
template,
GetUserIdentifiers(),
tenantId,
Severity);
return Done();
}
return Suspend();
}
private IEnumerable<UserIdentifier> GetUserIdentifiers()
{
return To.Select(to => new UserIdentifier(to, to.ToString()));
}
}

16
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/LINGYUN/Abp/Elsa/Activities/Notifications/Startup.cs

@ -0,0 +1,16 @@
using Elsa.Attributes;
using Elsa.Options;
using Elsa.Services.Startup;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace LINGYUN.Abp.Elsa.Activities.Notifications;
[Feature("Notification")]
public class Startup : StartupBase
{
public override void ConfigureElsa(ElsaOptionsBuilder elsa, IConfiguration configuration)
{
elsa.AddNotificationActivities();
}
}

15
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Activities.Notifications/Microsoft/Extensions/DependencyInjection/NotificationServiceCollectionExtensions.cs

@ -0,0 +1,15 @@
using Elsa.Options;
using LINGYUN.Abp.Elsa.Activities.Notifications;
namespace Microsoft.Extensions.DependencyInjection;
public static class NotificationServiceCollectionExtensions
{
public static ElsaOptionsBuilder AddNotificationActivities(this ElsaOptionsBuilder options)
{
options
.AddActivity<SendNotification>();
return options;
}
}

3
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFramework.Core/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

2
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/FodyWeavers.xml

@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

17
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/Elsa/Models/WorkflowInstanceExtensions.cs

@ -0,0 +1,17 @@
using System;
namespace Elsa.Models;
public static class WorkflowInstanceExtensions
{
public static Guid? GetTenantId(this WorkflowInstance instance)
{
var tenantId = instance.TenantId;
if (!tenantId.IsNullOrWhiteSpace() &&
Guid.TryParse(tenantId, out var id))
{
return id;
}
return null;
}
}

12
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/Elsa/Services/Models/ActivityExecutionContextExtensions.cs

@ -0,0 +1,12 @@
using Elsa.Models;
using System;
namespace Elsa.Services.Models;
public static class ActivityExecutionContextExtensions
{
public static Guid? GetTenantId(this ActivityExecutionContext context)
{
return context.WorkflowInstance.GetTenantId();
}
}

2
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/FodyWeavers.xml

@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

1
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj

@ -6,6 +6,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
<Nullable>Enable</Nullable>
</PropertyGroup>
<ItemGroup>

3
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpElsaModule.cs

@ -46,7 +46,8 @@ public class AbpElsaModule : AbpModule
builder.Configure(options);
});
context.Services.AddSingleton<IIdGenerator, AbpElsaIdGenerator>();
context.Services.Replace<IIdGenerator, AbpElsaIdGenerator>(ServiceLifetime.Singleton);
context.Services.Replace<IWorkflowRunner, AbpWorkflowRunner>(ServiceLifetime.Scoped);
Configure<AbpLocalizationOptions>(options =>
{

7
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpTenantAccessor.cs

@ -15,12 +15,13 @@ public class AbpTenantAccessor : ITenantAccessor
_currentTenant = currentTenant;
}
public Task<string> GetTenantIdAsync(CancellationToken cancellationToken = default)
public Task<string?> GetTenantIdAsync(CancellationToken cancellationToken = default)
{
string? tenantId = null;
if (_currentTenant.IsAvailable)
{
return Task.FromResult(_currentTenant.GetId().ToString());
tenantId = _currentTenant.GetId().ToString();
}
return Task.FromResult("");
return Task.FromResult(tenantId);
}
}

52
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpWorkflowRunner.cs

@ -0,0 +1,52 @@
using Elsa.Models;
using Elsa.Services;
using Elsa.Services.Models;
using Elsa.Services.Workflows;
using Elsa.Services.WorkflowStorage;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.Elsa;
public class AbpWorkflowRunner : WorkflowRunner
{
private readonly ICurrentTenant _currentTenant;
public AbpWorkflowRunner(
ICurrentTenant currentTenant,
IWorkflowContextManager workflowContextManager,
IMediator mediator,
IServiceScopeFactory serviceScopeFactory,
IGetsStartActivities startingActivitiesProvider,
IWorkflowStorageService workflowStorageService,
ILogger<WorkflowRunner> logger)
: base(
workflowContextManager,
mediator,
serviceScopeFactory,
startingActivitiesProvider,
workflowStorageService,
logger)
{
_currentTenant = currentTenant;
}
protected async override Task<RunWorkflowResult> RunWorkflowInternalAsync(
WorkflowExecutionContext workflowExecutionContext,
string? activityId = null,
CancellationToken cancellationToken = default)
{
var tenantId = workflowExecutionContext.WorkflowInstance.GetTenantId();
using (_currentTenant.Change(tenantId))
{
return await base.RunWorkflowInternalAsync(
workflowExecutionContext,
activityId,
cancellationToken);
}
}
}

4
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/Message.cs

@ -31,7 +31,7 @@ namespace LINGYUN.Abp.MessageService.Chat
/// <summary>
/// 消息来源
/// </summary>
public virtual MessageSourceTye Source { get; protected set; }
public virtual MessageSourceType Source { get; protected set; }
/// <summary>
/// 发送状态
/// </summary>
@ -43,7 +43,7 @@ namespace LINGYUN.Abp.MessageService.Chat
string sendUserName,
string content,
MessageType type = MessageType.Text,
MessageSourceTye source = MessageSourceTye.User,
MessageSourceType source = MessageSourceType.User,
Guid? tenantId = null)
{
MessageId = id;

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Chat/UserMessage.cs

@ -18,7 +18,7 @@ namespace LINGYUN.Abp.MessageService.Chat
Guid receiveUserId,
string content,
MessageType type = MessageType.Text,
MessageSourceTye source = MessageSourceTye.User,
MessageSourceType source = MessageSourceType.User,
Guid? tenantId = null)
: base(id, sendUserId, sendUserName, content, type, source, tenantId)
{

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Groups/GroupMessage.cs

@ -19,7 +19,7 @@ namespace LINGYUN.Abp.MessageService.Groups
long groupId,
string content,
MessageType type = MessageType.Text,
MessageSourceTye source = MessageSourceTye.User,
MessageSourceType source = MessageSourceType.User,
Guid? tenantId = null)
: base(id, sendUserId, sendUserName, content, type, source, tenantId)
{

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Chat/EfCoreMessageRepository.cs

@ -341,7 +341,7 @@ namespace LINGYUN.Abp.MessageService.Chat
FormUserName = GetValue<string>(reader, 3),
Object = GetValue<string>(reader, 4),
AvatarUrl = GetValue<string>(reader, 5),
Source = (MessageSourceTye)GetValue<int>(reader, 6),
Source = (MessageSourceType)GetValue<int>(reader, 6),
MessageId = GetValue<string>(reader, 7),
MessageType = (MessageType)GetValue<int>(reader, 8),
TenantId = GetValue<Guid?>(reader, 9),

2
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj

@ -47,6 +47,8 @@
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.BlobStoring\LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.IM\LINGYUN.Abp.Elsa.Activities.IM.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Notifications\LINGYUN.Abp.Elsa.Activities.Notifications.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" />

2
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs

@ -74,6 +74,8 @@ public partial class WorkflowManagementHttpApiHostModule
typeof(Elsa.Webhooks.Persistence.EntityFramework.MySql.Startup),
typeof(Elsa.WorkflowSettings.Persistence.EntityFramework.MySql.Startup),
typeof(LINGYUN.Abp.Elsa.Activities.BlobStoring.Startup),
typeof(LINGYUN.Abp.Elsa.Activities.Notifications.Startup),
typeof(LINGYUN.Abp.Elsa.Activities.IM.Startup),
};
PreConfigure<ElsaOptionsBuilder>(elsa =>

2
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.Development.json

@ -41,6 +41,8 @@
"Conductor": true,
"Telnyx": true,
"BlobStoring": true,
"Notification": true,
"IM": true,
"Webhooks": {
"Enabled": true,
"ConnectionStringIdentifier": "Workflow",

Loading…
Cancel
Save