diff --git a/aspnet-core/Lion.AbpPro.SignalR/GlobalUsings.cs b/aspnet-core/Lion.AbpPro.SignalR/GlobalUsings.cs
new file mode 100644
index 00000000..04f0e2b6
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/GlobalUsings.cs
@@ -0,0 +1,11 @@
+// Global using directives
+
+global using Lion.AbpPro.SignalR.Enums;
+global using Microsoft.AspNetCore.SignalR;
+global using Microsoft.Extensions.Logging;
+global using Volo.Abp.DependencyInjection;
+global using Volo.Abp.EventBus.Local;
+global using Volo.Abp.Guids;
+global using Volo.Abp.Json;
+global using Volo.Abp.MultiTenancy;
+global using Volo.Abp.Users;
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion.AbpPro.SignalR.csproj b/aspnet-core/Lion.AbpPro.SignalR/Lion.AbpPro.SignalR.csproj
new file mode 100644
index 00000000..74eb0528
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion.AbpPro.SignalR.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net9.0
+
+ Lion.AbpPro.SignalR
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/AbpProNotificationModule.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/AbpProNotificationModule.cs
new file mode 100644
index 00000000..328d3e25
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/AbpProNotificationModule.cs
@@ -0,0 +1,12 @@
+using Volo.Abp.AspNetCore.SignalR;
+using Volo.Abp.Autofac;
+using Volo.Abp.Modularity;
+
+namespace Lion.AbpPro.SignalR;
+
+[DependsOn(
+ typeof(AbpAutofacModule),
+ typeof(AbpAspNetCoreSignalRModule))]
+public class AbpProNotificationModule : AbpModule
+{
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Enums/MessageLevel.cs
similarity index 85%
rename from aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs
rename to aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Enums/MessageLevel.cs
index 7bf0283d..c7d17d23 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Enums/MessageLevel.cs
@@ -1,6 +1,6 @@
using System.ComponentModel;
-namespace Lion.AbpPro.NotificationManagement.Notifications.Enums;
+namespace Lion.AbpPro.SignalR.Enums;
///
/// 消息等级
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Enums/MessageType.cs
similarity index 85%
rename from aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs
rename to aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Enums/MessageType.cs
index 0e458e47..8ec85e44 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Enums/MessageType.cs
@@ -1,6 +1,6 @@
using System.ComponentModel;
-namespace Lion.AbpPro.NotificationManagement.Notifications.Enums
+namespace Lion.AbpPro.SignalR.Enums
{
///
/// 消息类型
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Hubs/INotificationHub.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Hubs/INotificationHub.cs
new file mode 100644
index 00000000..745c4682
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Hubs/INotificationHub.cs
@@ -0,0 +1,15 @@
+namespace Lion.AbpPro.SignalR.Hubs
+{
+ public interface INotificationHub
+ {
+ ///
+ /// 接受普通消息
+ ///
+ Task ReceiveTextMessageAsync(SendNotificationDto message);
+
+ ///
+ /// 接受广播消息
+ ///
+ Task ReceiveBroadCastMessageAsync(SendNotificationDto message);
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHub.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Hubs/NotificationHub.cs
similarity index 52%
rename from aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHub.cs
rename to aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Hubs/NotificationHub.cs
index e25ee702..4bbd21b7 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHub.cs
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/Hubs/NotificationHub.cs
@@ -1,10 +1,13 @@
-namespace Lion.AbpPro.NotificationManagement.Hubs
+using Microsoft.AspNetCore.Authorization;
+using Volo.Abp.AspNetCore.SignalR;
+using Volo.Abp.Auditing;
+
+namespace Lion.AbpPro.SignalR.Hubs
{
[HubRoute("SignalR/Notification")]
[Authorize]
[DisableAuditing]
public class NotificationHub : AbpHub
{
-
}
}
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/IMessageManager.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/IMessageManager.cs
new file mode 100644
index 00000000..a935bccc
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/IMessageManager.cs
@@ -0,0 +1,17 @@
+namespace Lion.AbpPro.SignalR;
+
+public interface IMessageManager
+{
+ ///
+ /// 发送消息
+ ///
+ /// 消息标题
+ /// 消息内容
+ /// 消息类型
+ /// 消息级别
+ /// 消息接受人,如果是广播消息,不需要传递
+ /// 消息接受人userName,如果是广播消息,不需要传递
+ /// 是否持久化,如果ture会在消息管理中出现,并且右上角也会存在
+ ///
+ Task SendMessageAsync(string title, string content, MessageType messageType, MessageLevel messageLevel, Guid? receiverUserId = null, string receiverUserName = "", bool isPersistent = true);
+}
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/LocalEvent/Notification/CreatedNotificationLocalEvent.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/LocalEvent/Notification/CreatedNotificationLocalEvent.cs
new file mode 100644
index 00000000..3c1d58cf
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/LocalEvent/Notification/CreatedNotificationLocalEvent.cs
@@ -0,0 +1,79 @@
+namespace Lion.AbpPro.SignalR.LocalEvent.Notification;
+
+///
+/// 创建消息本地事件
+///
+public class CreatedNotificationLocalEvent
+{
+ public CreatedNotificationLocalEvent(Guid id, Guid? tenantId, string title, string content, MessageType messageType, MessageLevel messageLevel, Guid senderUserId, string senderUserName, Guid? receiveUserId, string receiveUserName, bool isPersistent)
+ {
+ Id = id;
+ TenantId = tenantId;
+ Title = title;
+ Content = content;
+ MessageType = messageType;
+ MessageLevel = messageLevel;
+ SenderUserId = senderUserId;
+ SenderUserName = senderUserName;
+ ReceiveUserId = receiveUserId;
+ ReceiveUserName = receiveUserName;
+ IsPersistent = isPersistent;
+ }
+
+ ///
+ /// 消息id
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 租户id
+ ///
+ public Guid? TenantId { get; set; }
+
+ ///
+ /// 消息标题
+ ///
+ public string Title { get; set; }
+
+ ///
+ /// 消息内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 消息类型
+ ///
+ public MessageType MessageType { get; set; }
+
+ ///
+ /// 消息等级
+ ///
+ public MessageLevel MessageLevel { get; set; }
+
+ ///
+ /// 发送人
+ ///
+ public Guid SenderUserId { get; set; }
+
+ ///
+ /// 发送人用户名
+ ///
+ public string SenderUserName { get; set; }
+
+ ///
+ /// 订阅人
+ /// 消息类型是广播消息时,订阅人为空
+ ///
+ public Guid? ReceiveUserId { get; set; }
+
+ ///
+ /// 接收人用户名
+ /// 消息类型是广播消息时,订接收人用户名为空
+ ///
+ public string ReceiveUserName { get; set; }
+
+ ///
+ /// 消息是否持久化
+ ///
+ public bool IsPersistent { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/MessageManager.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/MessageManager.cs
new file mode 100644
index 00000000..b14af0c6
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/MessageManager.cs
@@ -0,0 +1,62 @@
+using Lion.AbpPro.SignalR.Hubs;
+using Lion.AbpPro.SignalR.LocalEvent.Notification;
+
+namespace Lion.AbpPro.SignalR;
+
+public class MessageManager : IMessageManager, ITransientDependency
+{
+ private readonly IHubContext _hubContext;
+ private readonly ILogger _logger;
+ private readonly ILocalEventBus _localEventBus;
+ private readonly ICurrentUser _currentUser;
+ private readonly ICurrentTenant _currentTenant;
+ private readonly IGuidGenerator _guidGenerator;
+
+ public MessageManager(IHubContext hubContext, ILogger logger, ILocalEventBus localEventBus, ICurrentUser currentUser, ICurrentTenant currentTenant, IGuidGenerator guidGenerator)
+ {
+ _hubContext = hubContext;
+ _logger = logger;
+ _localEventBus = localEventBus;
+ _currentUser = currentUser;
+ _currentTenant = currentTenant;
+ _guidGenerator = guidGenerator;
+ }
+
+ ///
+ /// 发送消息
+ ///
+ /// 消息标题
+ /// 消息内容
+ /// 消息类型
+ /// 消息级别
+ /// 消息接受人,如果是广播消息,不需要传递
+ /// 消息接受人userName,如果是广播消息,不需要传递
+ /// 是否持久化,如果ture会在消息管理中出现,并且右上角也会存在
+ ///
+ public virtual async Task SendMessageAsync(string title, string content, MessageType messageType, MessageLevel messageLevel, Guid? receiverUserId = null, string receiverUserName = "", bool isPersistent = true)
+ {
+ var messageId = _guidGenerator.Create();
+ if (messageType == MessageType.Common)
+ {
+ if (string.IsNullOrWhiteSpace(receiverUserId.ToString()))
+ {
+ _logger.LogError($"发送消息失败:接收用户ID为空,消息Id:{messageId}");
+ return;
+ }
+
+ await _hubContext.Clients
+ .Users([receiverUserId.ToString()])
+ .ReceiveTextMessageAsync(new SendNotificationDto(messageId, title, content, messageType, messageLevel));
+ }
+
+ if (messageType == MessageType.BroadCast)
+ {
+ await _hubContext.Clients.All.ReceiveBroadCastMessageAsync(new SendNotificationDto(messageId, title, content, messageType, messageLevel));
+ }
+
+ if (isPersistent)
+ {
+ await _localEventBus.PublishAsync(new CreatedNotificationLocalEvent(messageId, _currentTenant.Id, title, content, messageType, messageLevel, _currentUser.GetId(), _currentUser.UserName, receiverUserId, receiverUserName, true));
+ }
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/SendNotificationDto.cs b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/SendNotificationDto.cs
new file mode 100644
index 00000000..c0fa95c2
--- /dev/null
+++ b/aspnet-core/Lion.AbpPro.SignalR/Lion/AbpPro/SignalR/SendNotificationDto.cs
@@ -0,0 +1,40 @@
+namespace Lion.AbpPro.SignalR
+{
+ public class SendNotificationDto
+ {
+ public Guid Id { get; set; }
+
+ ///
+ /// 消息标题
+ ///
+ public string Title { get; set; }
+
+ ///
+ /// 消息内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 消息类型
+ ///
+ public MessageType MessageType { get; set; }
+
+ ///
+ /// 消息等级
+ ///
+ public MessageLevel MessageLevel { get; set; }
+
+ private SendNotificationDto()
+ {
+ }
+
+ public SendNotificationDto(Guid id, string title, string content, MessageType messageType, MessageLevel messageLevel)
+ {
+ Id = id;
+ Title = title;
+ Content = content;
+ MessageType = messageType;
+ MessageLevel = messageLevel;
+ }
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.sln b/aspnet-core/Lion.AbpPro.sln
index 2919025b..0682fb75 100644
--- a/aspnet-core/Lion.AbpPro.sln
+++ b/aspnet-core/Lion.AbpPro.sln
@@ -253,6 +253,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.AspNetCore", "f
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.Hangfire", "frameworks\src\Lion.AbpPro.Hangfire\Lion.AbpPro.Hangfire.csproj", "{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.SignalR", "Lion.AbpPro.SignalR\Lion.AbpPro.SignalR.csproj", "{66B3D9E0-CB3F-464A-9813-F2DC1426A37A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -623,6 +625,10 @@ Global
{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {66B3D9E0-CB3F-464A-9813-F2DC1426A37A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {66B3D9E0-CB3F-464A-9813-F2DC1426A37A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {66B3D9E0-CB3F-464A-9813-F2DC1426A37A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {66B3D9E0-CB3F-464A-9813-F2DC1426A37A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -744,6 +750,7 @@ Global
{9C88C5AE-21A1-4A62-9FA3-173806CD9EE3} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{89CCAEA6-8176-4E4B-8D84-A2ACE2715F88} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
+ {66B3D9E0-CB3F-464A-9813-F2DC1426A37A} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/GlobalUsings.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/GlobalUsings.cs
index 7c8757ae..b62090d0 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/GlobalUsings.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/GlobalUsings.cs
@@ -8,7 +8,6 @@ global using System.Threading.Tasks;
global using Lion.AbpPro.Core;
global using Lion.AbpPro.NotificationManagement.Localization;
global using Lion.AbpPro.NotificationManagement.Notifications.Dtos;
-global using Lion.AbpPro.NotificationManagement.Notifications.Enums;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Localization;
global using Volo.Abp.Application;
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHub.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHub.cs
deleted file mode 100644
index bac198c8..00000000
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHub.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-namespace Lion.AbpPro.NotificationManagement.Hubs
-{
- public interface INotificationHub
- {
- ///
- /// 发送普通消息
- ///
- ///
- ///
- Task ReceiveTextMessageAsync(SendNotificationDto input);
-
- ///
- /// 发送广播消息
- ///
- ///
- ///
- Task ReceiveBroadCastMessageAsync(SendNotificationDto input);
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs
deleted file mode 100644
index a46adda3..00000000
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Lion.AbpPro.NotificationManagement.Hubs;
-
-public interface INotificationHubAppService : IApplicationService
-{
- Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, string receiverUserId);
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs
index b79b427b..442bef3d 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.SignalR.Enums;
+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationInput : PagingBase
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs
index f908d897..628a1dd5 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.SignalR.Enums;
+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationOutput
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs
index ee6d7ae5..3ed0b78d 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.SignalR.Enums;
+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationSubscriptionOutput
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendNotificationDto.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendNotificationDto.cs
index 91ed903d..cc8461bc 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendNotificationDto.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendNotificationDto.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.SignalR.Enums;
+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class SendNotificationDto
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/GlobalUsings.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/GlobalUsings.cs
index ea216b77..9351ae64 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/GlobalUsings.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/GlobalUsings.cs
@@ -5,13 +5,9 @@ global using System.Collections.Generic;
global using System.Linq;
global using System.Threading.Tasks;
global using AutoMapper;
-global using Lion.AbpPro.NotificationManagement.Hubs;
global using Lion.AbpPro.NotificationManagement.Localization;
global using Lion.AbpPro.NotificationManagement.Notifications;
-global using Lion.AbpPro.NotificationManagement.Notifications.Aggregates;
-global using Lion.AbpPro.NotificationManagement.Notifications.LocalEvents;
global using Lion.AbpPro.NotificationManagement.Notifications.Dtos;
-global using Lion.AbpPro.NotificationManagement.Notifications.Enums;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.AspNetCore.SignalR;
global using Microsoft.Extensions.DependencyInjection;
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs
deleted file mode 100644
index 349df398..00000000
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using Volo.Abp.Json;
-
-namespace Lion.AbpPro.NotificationManagement.Hubs;
-
-public class NotificationHubAppService : NotificationManagementAppService, INotificationHubAppService
-{
- private readonly IHubContext _hubContext;
- private readonly ILogger _logger;
- private readonly IJsonSerializer _jsonSerializer;
- public NotificationHubAppService(
- IHubContext hubContext,
- ILogger logger,
- IJsonSerializer jsonSerializer)
- {
- _hubContext = hubContext;
- _logger = logger;
- _jsonSerializer = jsonSerializer;
- }
-
- ///
- /// 发送消息
- ///
- public virtual async Task SendMessageAsync(Guid id, string title, string content, MessageType messageType, MessageLevel messageLevel, string receiverUserId)
- {
- switch (messageType)
- {
- case MessageType.Common:
- await SendMessageToClientByUserIdAsync(new SendNotificationDto(id, title, content, messageType, messageLevel), receiverUserId);
- break;
- case MessageType.BroadCast:
- await SendMessageToAllClientAsync(new SendNotificationDto(id, title, content, messageType, messageLevel));
- break;
- default:
- throw new BusinessException(NotificationManagementErrorCodes.MessageTypeUnknown);
- }
- }
-
- ///
- /// 发送消息指定客户端用户
- ///
- private async Task SendMessageToClientByUserIdAsync(SendNotificationDto sendNotificationDto, string receiverUserId)
- {
- if (receiverUserId.IsNotNullOrWhiteSpace())
- {
- await _hubContext.Clients
- .Users(new string[] { receiverUserId })
- .ReceiveTextMessageAsync(sendNotificationDto);
- _logger.LogInformation($"通知模块收到消息:{_jsonSerializer.Serialize(sendNotificationDto)},发送给:{receiverUserId}");
- }
- else
- {
- _logger.LogWarning($"消息未指定发送人:{_jsonSerializer.Serialize(sendNotificationDto)}");
- }
- }
-
- ///
- /// 发送消息到所有客户端
- /// 广播消息
- ///
- private async Task SendMessageToAllClientAsync(SendNotificationDto sendNotificationDto)
- {
- await _hubContext.Clients.All.ReceiveBroadCastMessageAsync(sendNotificationDto);
- _logger.LogInformation($"通知模块收到消息:{_jsonSerializer.Serialize(sendNotificationDto)}");
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs
index 51eb9485..f319662a 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs
@@ -1,29 +1,31 @@
+using Lion.AbpPro.SignalR.LocalEvent.Notification;
+
namespace Lion.AbpPro.NotificationManagement.Notifications.LocalEventHandlers
{
///
/// 创建消息事件处理
///
- public class NotificationCreatedLocalEventHandler :
- ILocalEventHandler,
- ITransientDependency
+ public class NotificationCreatedLocalEventHandler :
+ ILocalEventHandler,
+ ITransientDependency
{
- private readonly INotificationHubAppService _hubAppService;
+ private readonly INotificationManager _notificationManager;
- public NotificationCreatedLocalEventHandler(INotificationHubAppService hubAppService)
+ public NotificationCreatedLocalEventHandler( INotificationManager notificationManager)
{
- _hubAppService = hubAppService;
+ _notificationManager = notificationManager;
}
- public virtual Task HandleEventAsync(CreatedNotificationLocalEvent eventData)
+ public virtual async Task HandleEventAsync(CreatedNotificationLocalEvent eventData)
{
- return _hubAppService.SendMessageAsync(
- eventData.NotificationEto.Id,
- eventData.NotificationEto.Title,
- eventData.NotificationEto.Content,
- eventData.NotificationEto.MessageType,
- eventData.NotificationEto.MessageLevel,
- eventData.NotificationEto.ReceiveUserId.ToString());
+ await _notificationManager.CreateAsync(
+ eventData.Id,
+ eventData.Title,
+ eventData.Content,
+ eventData.MessageType,
+ eventData.MessageLevel,
+ eventData.ReceiveUserId,
+ eventData.ReceiveUserName);
}
-
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
index 30327250..bde88b39 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
@@ -1,4 +1,6 @@
using System.Security.Authentication;
+using Lion.AbpPro.SignalR;
+using Lion.AbpPro.SignalR.Enums;
namespace Lion.AbpPro.NotificationManagement.Notifications
{
@@ -7,12 +9,14 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
{
private readonly INotificationManager _notificationManager;
private readonly INotificationSubscriptionManager _notificationSubscriptionManager;
+ private readonly IMessageManager _messageManager;
- public NotificationAppService(INotificationManager notificationManager, INotificationSubscriptionManager notificationSubscriptionManager)
+ public NotificationAppService(INotificationManager notificationManager, INotificationSubscriptionManager notificationSubscriptionManager, IMessageManager messageManager)
{
_notificationManager = notificationManager;
_notificationSubscriptionManager = notificationSubscriptionManager;
+ _messageManager = messageManager;
}
@@ -21,7 +25,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
///
public virtual async Task SendCommonWarningMessageAsync(SendCommonMessageInput input)
{
- await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, MessageLevel.Warning, input.ReceiveUserId, input.ReceiveUserName);
+ await _messageManager.SendMessageAsync(input.Title, input.Content, MessageType.Common, MessageLevel.Warning, input.ReceiveUserId, input.ReceiveUserName);
}
///
@@ -29,7 +33,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
///
public virtual async Task SendCommonInformationMessageAsync(SendCommonMessageInput input)
{
- await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, MessageLevel.Information, input.ReceiveUserId, input.ReceiveUserName);
+ await _messageManager.SendMessageAsync(input.Title, input.Content, MessageType.Common, MessageLevel.Information, input.ReceiveUserId, input.ReceiveUserName);
}
///
@@ -37,7 +41,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
///
public virtual async Task SendCommonErrorMessageAsync(SendCommonMessageInput input)
{
- await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, MessageLevel.Error, input.ReceiveUserId, input.ReceiveUserName);
+ await _messageManager.SendMessageAsync(input.Title, input.Content, MessageType.Common, MessageLevel.Error, input.ReceiveUserId, input.ReceiveUserName);
}
///
@@ -45,7 +49,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
///
public virtual async Task SendBroadCastWarningMessageAsync(SendBroadCastMessageInput input)
{
- await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content, MessageLevel.Warning);
+ await _messageManager.SendMessageAsync(input.Title, input.Content, MessageType.BroadCast, MessageLevel.Warning);
}
///
@@ -53,7 +57,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
///
public virtual async Task SendBroadCastInformationMessageAsync(SendBroadCastMessageInput input)
{
- await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content, MessageLevel.Information);
+ await _messageManager.SendMessageAsync(input.Title, input.Content, MessageType.BroadCast, MessageLevel.Information);
}
///
@@ -61,7 +65,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
///
public virtual async Task SendBroadCastErrorMessageAsync(SendBroadCastMessageInput input)
{
- await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content, MessageLevel.Error);
+ await _messageManager.SendMessageAsync(input.Title, input.Content, MessageType.BroadCast, MessageLevel.Error);
}
public virtual async Task SetReadAsync(SetReadInput input)
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/GlobalUsings.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/GlobalUsings.cs
index 0d2a6774..49b96a2e 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/GlobalUsings.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/GlobalUsings.cs
@@ -1,7 +1,6 @@
// Global using directives
global using Lion.AbpPro.NotificationManagement.Localization;
-global using Lion.AbpPro.NotificationManagement.Notifications.Etos;
global using Volo.Abp.Localization;
global using Volo.Abp.Localization.ExceptionHandling;
global using Volo.Abp.Modularity;
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Lion.AbpPro.NotificationManagement.Domain.Shared.csproj b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Lion.AbpPro.NotificationManagement.Domain.Shared.csproj
index 84212f47..5138429f 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Lion.AbpPro.NotificationManagement.Domain.Shared.csproj
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Lion.AbpPro.NotificationManagement.Domain.Shared.csproj
@@ -24,6 +24,7 @@
+
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs
index d67208cf..681c2391 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs
@@ -1,4 +1,4 @@
-using Lion.AbpPro.NotificationManagement.Notifications.Enums;
+using Lion.AbpPro.SignalR.Enums;
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs
deleted file mode 100644
index b44319ae..00000000
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Lion.AbpPro.NotificationManagement.Notifications.Enums;
-
-
-namespace Lion.AbpPro.NotificationManagement.Notifications.Etos
-{
- public class NotificationEto
- {
- public Guid Id { get; set; }
-
- ///
- /// 租户id
- ///
- public Guid? TenantId { get; set; }
-
- ///
- /// 消息标题
- ///
- public string Title { get; set; }
-
- ///
- /// 消息内容
- ///
- public string Content { get; set; }
-
- ///
- /// 消息类型
- ///
- public MessageType MessageType { get; set; }
-
- ///
- /// 消息等级
- ///
- public MessageLevel MessageLevel { get; set; }
-
- ///
- /// 发送人
- ///
- public Guid SenderUserId { get; set; }
-
- ///
- /// 发送人用户名
- ///
- public string SenderUserName { get; set; }
-
- ///
- /// 订阅人
- /// 消息类型是广播消息时,订阅人为空
- ///
- public Guid? ReceiveUserId { get; set; }
-
-
- ///
- /// 接收人用户名
- /// 消息类型是广播消息时,订接收人用户名为空
- ///
- public string ReceiveUserName { get; set; }
-
- ///
- /// 是否已读
- ///
- public bool Read { get; set; }
-
- ///
- /// 已读时间
- ///
- public DateTime? ReadTime { get; set; }
- }
-
-
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/LocalEvents/CreatedNotificationLocalEvent.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/LocalEvents/CreatedNotificationLocalEvent.cs
deleted file mode 100644
index a39011af..00000000
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/LocalEvents/CreatedNotificationLocalEvent.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace Lion.AbpPro.NotificationManagement.Notifications.LocalEvents
-{
- public class CreatedNotificationLocalEvent
- {
- public NotificationEto NotificationEto { get; set; }
-
- private CreatedNotificationLocalEvent()
- {
-
- }
-
- public CreatedNotificationLocalEvent(NotificationEto notificationEto)
- {
- NotificationEto = notificationEto;
- }
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/GlobalUsings.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/GlobalUsings.cs
index 6edcd3c1..cfd2cb43 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/GlobalUsings.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/GlobalUsings.cs
@@ -11,9 +11,6 @@ global using AutoMapper;
global using Lion.AbpPro.Core;
global using Lion.AbpPro.NotificationManagement.Notifications;
global using Lion.AbpPro.NotificationManagement.Notifications.Aggregates;
-global using Lion.AbpPro.NotificationManagement.Notifications.LocalEvents;
-global using Lion.AbpPro.NotificationManagement.Notifications.Enums;
-global using Lion.AbpPro.NotificationManagement.Notifications.Etos;
global using Lion.AbpPro.NotificationManagement.Notifications.MaxLengths;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Logging;
@@ -26,6 +23,7 @@ global using Volo.Abp.Domain.Repositories;
global using Volo.Abp.Domain.Services;
global using Volo.Abp.EventBus.Distributed;
global using Volo.Abp.Modularity;
+global using Volo.Abp.MultiTenancy;
global using Volo.Abp.ObjectMapping;
global using Volo.Abp.Settings;
global using Volo.Abp.Uow;
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs
index 10c58569..f8f10054 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs
@@ -6,8 +6,6 @@ namespace Lion.AbpPro.NotificationManagement
{
public NotificationDomainAutoMapperProfile()
{
- CreateMap();
- CreateMap();
CreateMap();
}
}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs
index 016ff770..935d8276 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.MultiTenancy;
+using Lion.AbpPro.SignalR.Enums;
+using Lion.AbpPro.SignalR.LocalEvent.Notification;
namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates
{
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs
index c3ce600a..82f9a61a 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs
@@ -1,5 +1,3 @@
-using Volo.Abp.MultiTenancy;
-
namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates
{
///
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs
index 8027bf4c..1ce2830f 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs
@@ -1,5 +1,5 @@
using Lion.AbpPro.NotificationManagement.Notifications.Dtos;
-using Volo.Abp.DependencyInjection;
+using Lion.AbpPro.SignalR.Enums;
namespace Lion.AbpPro.NotificationManagement.Notifications;
@@ -40,22 +40,16 @@ public interface INotificationManager
MessageLevel? messageLevel);
///
- /// 发送警告文本消息
+ /// 发送文本消息
///
+ /// id
/// 标题
/// 消息内容
+ /// 消息类型
/// 消息等级
/// 接受人,发送给谁。
/// 接受人用户名
- Task SendCommonWarningMessageAsync(string title, string content, MessageLevel level, Guid receiveUserId,string receiveUserName);
-
- ///
- /// 发送警告广播消息
- ///
- /// 标题
- /// 消息内容
- /// 消息等级
- Task SendBroadCastWarningMessageAsync(string title, string content, MessageLevel level);
+ Task CreateAsync(Guid id, string title, string content,MessageType messageType, MessageLevel level, Guid? receiveUserId,string receiveUserName);
///
/// 消息设置为已读
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs
index ca602663..c2d1dc77 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.SignalR.Enums;
+
namespace Lion.AbpPro.NotificationManagement.Notifications
{
///
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
index 038feb30..420f9ddb 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
@@ -1,5 +1,5 @@
using Lion.AbpPro.NotificationManagement.Notifications.Dtos;
-using Lion.AbpPro.NotificationManagement.Notifications.LocalEvents;
+using Lion.AbpPro.SignalR.Enums;
namespace Lion.AbpPro.NotificationManagement.Notifications
{
@@ -33,7 +33,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
int maxResultCount = 10,
int skipCount = 0)
{
- var list = await _notificationRepository.GetPagingListAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType,messageLevel, maxResultCount, skipCount);
+ var list = await _notificationRepository.GetPagingListAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType, messageLevel, maxResultCount, skipCount);
return ObjectMapper.Map, List>(list);
}
@@ -56,31 +56,15 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
return await _notificationRepository.GetPagingCountAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType, messageLevel);
}
- public async Task SendCommonWarningMessageAsync(string title, string content, MessageLevel level, Guid receiveUserId, string receiveUserName)
+ public async Task CreateAsync(Guid id, string title, string content, MessageType messageType, MessageLevel level, Guid? receiveUserId, string receiveUserName)
{
if (!_currentUser.Id.HasValue)
{
throw new AbpAuthorizationException();
}
- var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.Common, level, _currentUser.Id.Value, _currentUser.UserName, receiveUserId, receiveUserName, tenantId: CurrentTenant?.Id);
- // 发送集成事件
- var notificationEto = ObjectMapper.Map(entity);
- entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto));
- await _notificationRepository.InsertAsync(entity);
- }
-
- public async Task SendBroadCastWarningMessageAsync(string title, string content, MessageLevel level)
- {
- if (!_currentUser.Id.HasValue)
- {
- throw new AbpAuthorizationException();
- }
+ var entity = new Notification(id, title, content, messageType, level, _currentUser.Id.Value, _currentUser.UserName, receiveUserId, receiveUserName, tenantId: CurrentTenant?.Id);
- var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.BroadCast, level, _currentUser.Id.Value, _currentUser.UserName, tenantId: CurrentTenant?.Id);
- // 发送集成事件
- var notificationEto = ObjectMapper.Map(entity);
- entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto));
await _notificationRepository.InsertAsync(entity);
}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs
index 84e9e550..6fab3e46 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.SignalR.Enums;
+
namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications
{
///
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/GlobalUsings.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/GlobalUsings.cs
index 8400fbec..9c8b2f11 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/GlobalUsings.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/GlobalUsings.cs
@@ -8,7 +8,6 @@ global using System.Threading.Tasks;
global using JetBrains.Annotations;
global using Lion.AbpPro.NotificationManagement.Notifications;
global using Lion.AbpPro.NotificationManagement.Notifications.Aggregates;
-global using Lion.AbpPro.NotificationManagement.Notifications.Enums;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.DependencyInjection;
global using Volo.Abp;