xf 8 月之前
父節點
當前提交
da5b447af9
共有 46 個文件被更改,包括 207 次插入108 次删除
  1. 1 1
      src/Hotline.Api/StartupExtensions.cs
  2. 11 5
      src/Hotline.Api/StartupHelper.cs
  3. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/AlertExtToExtNotificationHandler.cs
  4. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/AlertExtToOuterNotificationHandler.cs
  5. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/AlertMenuToOuterNotificationHandler.cs
  6. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/AlertVisitorToExtNotificationHandler.cs
  7. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/DtmfNotificationHandler.cs
  8. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/FailedNotificationHandler.cs
  9. 2 0
      src/Hotline.Application/Handlers/CallCenter/CallState/RingExtToExtNotificationHandler.cs
  10. 9 7
      src/Hotline.Application/Handlers/CallCenter/CallState/RingExtToOuterNotificationHandler.cs
  11. 3 1
      src/Hotline.Application/Handlers/CallCenter/CallState/RingMenuToExtNotificationHandler.cs
  12. 8 6
      src/Hotline.Application/Handlers/CallCenter/CallState/RingVisitorToExtNotificationHandler.cs
  13. 2 0
      src/Hotline.Application/Handlers/CallCenter/ExtState/BusyNotificationHandler.cs
  14. 2 0
      src/Hotline.Application/Handlers/CallCenter/ExtState/IdleNotificationHandler.cs
  15. 2 0
      src/Hotline.Application/Handlers/CallCenter/ExtState/OfflineNotificationHandler.cs
  16. 2 0
      src/Hotline.Application/Handlers/CallCenter/ExtState/OnlineNotificationHandler.cs
  17. 3 1
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnswerExtToExtNoificationHandler.cs
  18. 8 6
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnswerExtToOuterNotificationHandler.cs
  19. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnswerViisitorToExtNotificationHandler.cs
  20. 2 0
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredExtToExtNotificationHandler.cs
  21. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredExtToOuterNotificationHandler.cs
  22. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredExtToOuterToExtNotificationHandler.cs
  23. 6 4
      src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredVisitorToExtNotificationHandler.cs
  24. 4 2
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeExtAndExtNotificationHandler.cs
  25. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeExtAndOuterOneNotificationHandler.cs
  26. 4 2
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeExtAndOuterTwoNotificationHandler.cs
  27. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeOuterAndOuterNotificationHandler.cs
  28. 9 7
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorAndExtNotificationHandler.cs
  29. 3 1
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorAndMenuNotificationHandler.cs
  30. 3 1
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorAndOuterNotificationHandler.cs
  31. 8 6
      src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorOffNotificationHandler.cs
  32. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/CdrNotificationHandler.cs
  33. 6 4
      src/Hotline.Application/Handlers/CallCenter/FlowControl/DivertVisitorToExtNotificationHandler.cs
  34. 9 7
      src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnOuterToMenuNotificationHandler.cs
  35. 8 7
      src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnVisitorToMenuNotificationHandler.cs
  36. 2 0
      src/Hotline.Application/Handlers/CallCenter/FlowControl/IncomingNotificationHandler.cs
  37. 2 0
      src/Hotline.Application/Handlers/CallCenter/FlowControl/InviteNotificationHandler.cs
  38. 5 3
      src/Hotline.Application/Handlers/CallCenter/FlowControl/QueueVisitorToGroupBusyNotificationHandler.cs
  39. 3 4
      src/Hotline.Application/Handlers/CallCenter/NewRockBaseHandler.cs
  40. 2 0
      src/Hotline.Application/Handlers/CallCenter/System/BootupNotificationHandler.cs
  41. 4 2
      src/Hotline.Application/Handlers/CallCenter/Transient/TransientOuterNotificationHandler.cs
  42. 3 1
      src/Hotline.Application/Handlers/CallCenter/Transient/TransinetVisitorNotificationHandler.cs
  43. 1 1
      src/Hotline.NewRock/NewRockDeviceManager.cs
  44. 2 3
      src/Hotline.NewRock/NewRockStartupExtensions.cs
  45. 15 6
      src/Hotline/CallCenter/Manage/VoiceFileDomainService.cs
  46. 11 2
      src/Hotline/EventBus/HandlerInjectAttribute.cs

+ 1 - 1
src/Hotline.Api/StartupExtensions.cs

@@ -101,7 +101,7 @@ internal static class StartupExtensions
 
         //mediatr
         //todo 
-        services.RegisterMediatR(appConfiguration.AppScope);
+        services.RegisterMediatR(appConfiguration);
 
         //app scope
         switch (appConfiguration.AppScope)

+ 11 - 5
src/Hotline.Api/StartupHelper.cs

@@ -305,7 +305,7 @@ namespace Hotline.Api
             return services;
         }
 
-        public static IServiceCollection RegisterMediatR(this IServiceCollection services, string appScope)
+        public static IServiceCollection RegisterMediatR(this IServiceCollection services, AppConfiguration appConfiguration)
         {
             services.AddScoped<Publisher>();
             services.AddMediatR(cfg =>
@@ -314,10 +314,16 @@ namespace Hotline.Api
                 {
                     var attr = d.GetCustomAttribute(typeof(HandlerInjectAttribute)) as HandlerInjectAttribute;
                     if (attr is null) return true;
-                    return attr.Enable &&
-                           attr.AppScopes.ToString()
-                               .Split(',', StringSplitOptions.RemoveEmptyEntries)
-                               .Any(x => string.Compare(x, appScope, StringComparison.Ordinal) == 0);
+                    if (!attr.Enable) return false;
+                    switch (attr.EventHandlerType)
+                    {
+                        case EEventHandlerType.CallCenter:
+                            return attr.Label == appConfiguration.GetDefaultAppScopeConfiguration().CallCenterType;
+                        default:
+                            return attr.AppScopes.ToString()
+                                .Split(',', StringSplitOptions.RemoveEmptyEntries)
+                                .Any(x => string.Compare(x, appConfiguration.AppScope, StringComparison.Ordinal) == 0);
+                    }
                 };
                 //cfg.RegisterServicesFromAssemblyContaining<Program>();
                 cfg.RegisterServicesFromAssembly(typeof(ApplicationStartupExtensions).Assembly);

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/AlertExtToExtNotificationHandler.cs

@@ -1,4 +1,5 @@
 using Hotline.Caching.Interfaces;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -8,6 +9,7 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class AlertExtToExtNotificationHandler : INotificationHandler<AlertExtToExtNotification>
     {
         private readonly IRealtimeService _realtimeService;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/AlertExtToOuterNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -9,6 +10,7 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class AlertExtToOuterNotificationHandler:INotificationHandler<AlertExtToOuterNotification>
     {
         private readonly ICallRepository _callRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/AlertMenuToOuterNotificationHandler.cs

@@ -1,10 +1,12 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class AlertMenuToOuterNotificationHandler:INotificationHandler<AlertMenuToOuterNotification>
     {
         private readonly ICallRepository _callRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/AlertVisitorToExtNotificationHandler.cs

@@ -1,10 +1,12 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class AlertVisitorToExtNotificationHandler: INotificationHandler<AlertVisitorToExtNotification>
     {
         private readonly ICallRepository _callRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/DtmfNotificationHandler.cs

@@ -2,6 +2,7 @@
 using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Ivrs;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -11,6 +12,7 @@ using NewRock.Sdk;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class DtmfNotificationHandler : NewRockBaseHandler, INotificationHandler<DtmfNotification>
     {
         private readonly IIvrDomainService _ivrDomainService;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/FailedNotificationHandler.cs

@@ -1,9 +1,11 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class FailedNotificationHandler:INotificationHandler<FailedNotification>
     {
         private readonly ICallRepository _callRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/RingExtToExtNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -13,6 +14,7 @@ using System.Threading.Tasks;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class RingExtToExtNotificationHandler : INotificationHandler<RingExtToExtNotification>
     {
         private readonly IRealtimeService _realtimeService;

+ 9 - 7
src/Hotline.Application/Handlers/CallCenter/CallState/RingExtToOuterNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using Hotline.Tools;
@@ -7,13 +8,14 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
-    public class RingExtToOuterNotificationHandler:INotificationHandler<RingExtToOuterNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class RingExtToOuterNotificationHandler : INotificationHandler<RingExtToOuterNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IUserCacheManager _userCacheManager;
 
-        public RingExtToOuterNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager)
+        public RingExtToOuterNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IUserCacheManager userCacheManager)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -23,15 +25,15 @@ namespace Hotline.Application.Handlers.CallCenter.CallState
         public async Task Handle(RingExtToOuterNotification notification, CancellationToken cancellationToken)
         {
             var model = await _callRepository.GetAsync(x =>
-                x.FromNo == notification.TelNo && x.ToNo == notification.Outer.To && x.CreationTime >=DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
-            if (model==null)
+                x.FromNo == notification.TelNo && x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
+            if (model == null)
             {
                 model = await _callRepository.GetAsync(
                     x => x.ConversationId == notification.Outer.Id && x.ToNo == notification.Outer.To &&
-                         x.Trunk == notification.Outer.Trunk,true,x=>x.CreationTime, cancellationToken);
+                         x.Trunk == notification.Outer.Trunk, true, x => x.CreationTime, cancellationToken);
             }
-                       
-            if (model!=null)
+
+            if (model != null)
             {
                 var workModel = _userCacheManager.GetWorkByTel(notification.TelNo);
                 model.UserId = workModel.UserId;

+ 3 - 1
src/Hotline.Application/Handlers/CallCenter/CallState/RingMenuToExtNotificationHandler.cs

@@ -1,8 +1,10 @@
-using Hotline.Share.Notifications.NewRockCallCenter;
+using Hotline.EventBus;
+using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class RingMenuToExtNotificationHandler:INotificationHandler<RingMenuToExtNotification>
     {
         //TODO 无法定位数据暂无操作

+ 8 - 6
src/Hotline.Application/Handlers/CallCenter/CallState/RingVisitorToExtNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -7,14 +8,15 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.CallState
 {
-    public class RingVisitorToExtNotificationHandler:INotificationHandler<RingVisitorToExtNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class RingVisitorToExtNotificationHandler : INotificationHandler<RingVisitorToExtNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IRealtimeService _realtimeService;
         private readonly IUserCacheManager _userCacheManager;
 
-        public RingVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService, IUserCacheManager userCacheManager)
+        public RingVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IRealtimeService realtimeService, IUserCacheManager userCacheManager)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -27,9 +29,9 @@ namespace Hotline.Application.Handlers.CallCenter.CallState
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id &&
-                     x.FromNo == notification.Visitor.From && x.CreationTime>=DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
-            
-            if (model!=null)
+                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
+
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.Ring;
                 model.RingTime = DateTime.Now;
@@ -48,7 +50,7 @@ namespace Hotline.Application.Handlers.CallCenter.CallState
 
                 //调用业务弹屏 通知前端
                 var workModel = _userCacheManager.GetWorkByTel(notification.TelNo);
-                if (workModel!=null)
+                if (workModel != null)
                 {
                     await _realtimeService.RingAsync(workModel.UserId, new Share.Dtos.Realtime.RingDto() { From = notification.Visitor.From, Id = model.Id, To = notification.TelNo, CallType = ECallType.VisitorCallIn }, cancellationToken);
                 }

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/ExtState/BusyNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Tels;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
@@ -7,6 +8,7 @@ using XF.Domain.Cache;
 
 namespace Hotline.Application.Handlers.CallCenter.ExtState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class BusyNotificationHandler : INotificationHandler<BusyNotification>
     {
         private readonly ITelRepository _telRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/ExtState/IdleNotificationHandler.cs

@@ -3,6 +3,7 @@ using Hotline.Caching.Services;
 using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Tels;
+using Hotline.EventBus;
 using Hotline.NewRock;
 using Hotline.Realtimes;
 using Hotline.Repository.SqlSugar.CallCenter;
@@ -16,6 +17,7 @@ using XF.Domain.Exceptions;
 
 namespace Hotline.Application.Handlers.CallCenter.ExtState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class IdleNotificationHandler : INotificationHandler<IdleNotification>
     {
         private readonly ITelRepository _telRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/ExtState/OfflineNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Tels;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
@@ -7,6 +8,7 @@ using XF.Domain.Cache;
 
 namespace Hotline.Application.Handlers.CallCenter.ExtState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class OfflineNotificationHandler: INotificationHandler<OfflineNotification>
     {
         private readonly ITelRepository _telRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/ExtState/OnlineNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Tels;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
@@ -7,6 +8,7 @@ using XF.Domain.Cache;
 
 namespace Hotline.Application.Handlers.CallCenter.ExtState
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class OnlineNotificationHandler : INotificationHandler<OnlineNotification>
     {
         private readonly ITelRepository _telRepository;

+ 3 - 1
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnswerExtToExtNoificationHandler.cs

@@ -1,4 +1,5 @@
 using Hotline.Caching.Interfaces;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -7,13 +8,14 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class AnswerExtToExtNoificationHandler : INotificationHandler<AnswerExtToExtNotification>
     {
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
 
-        public AnswerExtToExtNoificationHandler(IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public AnswerExtToExtNoificationHandler(IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _userCacheManager = userCacheManager;
             _realtimeService = realtimeService;

+ 8 - 6
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnswerExtToOuterNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -8,14 +9,15 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class AnswerExtToOuterNotificationHandler:INotificationHandler<AnswerExtToOuterNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class AnswerExtToOuterNotificationHandler : INotificationHandler<AnswerExtToOuterNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public AnswerExtToOuterNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public AnswerExtToOuterNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -25,11 +27,11 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
 
         public async Task Handle(AnswerExtToOuterNotification notification, CancellationToken cancellationToken)
         {
-            var model =await _callRepository.GetAsync(
+            var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Outer.Id && x.ToNo == notification.Outer.To &&
-                     x.Trunk == notification.Outer.Trunk && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime,
+                     x.Trunk == notification.Outer.Trunk && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime,
                 cancellationToken);
-            if (model!=null)
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.Answer;
                 await _callRepository.UpdateAsync(model, cancellationToken);
@@ -38,7 +40,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                     CallId = model.Id,
                     CallStatus = ECallStatus.Answer,
                     OMCallId = notification.Outer.CallId,
-                    ConversationId =notification.Outer.Id,
+                    ConversationId = notification.Outer.Id,
                     EventName = notification.Attribute,
                     FromNo = notification.Outer.From,
                     ToNo = notification.Outer.To,

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnswerViisitorToExtNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -8,7 +9,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class AnswerViisitorToExtNotificationHandler:INotificationHandler<AnswerViisitorToExtNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class AnswerViisitorToExtNotificationHandler : INotificationHandler<AnswerViisitorToExtNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -17,7 +19,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IRealtimeService _realtimeService;
 
 
-        public AnswerViisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,ICallCacheManager callCacheManager,IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public AnswerViisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, ICallCacheManager callCacheManager, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -30,7 +32,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id &&
-                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             if (model != null)
             {
                 model.CallStatus = ECallStatus.Answer;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredExtToExtNotificationHandler.cs

@@ -1,4 +1,5 @@
 using Hotline.Caching.Interfaces;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -7,6 +8,7 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class AnsweredExtToExtNotificationHandler : INotificationHandler<AnsweredExtToExtNotification>
     {
         private readonly IUserCacheManager _userCacheManager;

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredExtToOuterNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -8,14 +9,15 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class AnsweredExtToOuterNotificationHandler:INotificationHandler<AnsweredExtToOuterNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class AnsweredExtToOuterNotificationHandler : INotificationHandler<AnsweredExtToOuterNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public AnsweredExtToOuterNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public AnsweredExtToOuterNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -27,7 +29,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Outer.Id &&
-                     x.FromNo == notification.Outer.From && x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                     x.FromNo == notification.Outer.From && x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             if (model != null)
             {
                 model.CallStatus = ECallStatus.Answered;

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredExtToOuterToExtNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -8,7 +9,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class AnsweredExtToOuterToExtNotificationHandler:INotificationHandler<AnsweredExtToOuterToExtNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class AnsweredExtToOuterToExtNotificationHandler : INotificationHandler<AnsweredExtToOuterToExtNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -23,8 +25,8 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(x =>
                 x.ConversationId == notification.Outer.Id && x.ToNo == notification.Outer.To &&
-                x.Trunk == notification.Outer.Trunk && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime,cancellationToken);
-            if (model!=null)
+                x.Trunk == notification.Outer.Trunk && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.Answered;
                 model.AnsweredTime = DateTime.Now;

+ 6 - 4
src/Hotline.Application/Handlers/CallCenter/FlowControl/AnsweredVisitorToExtNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -7,7 +8,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class AnsweredVisitorToExtNotificationHandler:INotificationHandler<AnsweredVisitorToExtNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class AnsweredVisitorToExtNotificationHandler : INotificationHandler<AnsweredVisitorToExtNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -15,7 +17,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IRealtimeService _realtimeService;
         private readonly ICallCacheManager _callCacheManager;
 
-        public AnsweredVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager, IRealtimeService realtimeService, ICallCacheManager callCacheManager)
+        public AnsweredVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IUserCacheManager userCacheManager, IRealtimeService realtimeService, ICallCacheManager callCacheManager)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -28,7 +30,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id &&
-                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             var workModel = _userCacheManager.GetWorkByTel(notification.TelNo);
             if (model != null)
             {
@@ -56,7 +58,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                 await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
 
                 var callDetail = _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER");
-                if (callDetail==null)
+                if (callDetail == null)
                 {
                     //调用业务通知 通知前端
                     await _realtimeService.AnsweredAsync(workModel.UserId, new Share.Dtos.Realtime.AnsweredDto() { Id = model.Id, From = notification.Visitor.From, To = notification.TelNo }, cancellationToken);

+ 4 - 2
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeExtAndExtNotificationHandler.cs

@@ -1,4 +1,5 @@
 using Hotline.Caching.Interfaces;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -7,14 +8,15 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class ByeExtAndExtNotificationHandler : INotificationHandler<ByeExtAndExtNotification>
     {
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public ByeExtAndExtNotificationHandler(IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public ByeExtAndExtNotificationHandler(IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
-           _userCacheManager = userCacheManager;
+            _userCacheManager = userCacheManager;
             _realtimeService = realtimeService;
         }
 

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeExtAndOuterOneNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -8,7 +9,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class ByeExtAndOuterOneNotificationHandler:INotificationHandler<ByeExtAndOuterOneNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class ByeExtAndOuterOneNotificationHandler : INotificationHandler<ByeExtAndOuterOneNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -27,8 +29,8 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         public async Task Handle(ByeExtAndOuterOneNotification notification, CancellationToken cancellationToken)
         {
             var model = await _callRepository.GetAsync(
-                x => x.ConversationId == notification.Outer.Id && 
-                     x.Trunk==notification.Outer.Trunk && x.ToNo == notification.Outer.To && x.CreationTime>=DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                x => x.ConversationId == notification.Outer.Id &&
+                     x.Trunk == notification.Outer.Trunk && x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             if (model != null)
             {
                 model.CallStatus = ECallStatus.Bye;

+ 4 - 2
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeExtAndOuterTwoNotificationHandler.cs

@@ -1,6 +1,7 @@
 using Hotline.Caching.Interfaces;
 using Hotline.Caching.Services;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -9,6 +10,7 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class ByeExtAndOuterTwoNotificationHandler : INotificationHandler<ByeExtAndOuterTwoNotification>
     {
         private readonly ICallRepository _callRepository;
@@ -16,7 +18,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public ByeExtAndOuterTwoNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public ByeExtAndOuterTwoNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -27,7 +29,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         public async Task Handle(ByeExtAndOuterTwoNotification notification, CancellationToken cancellationToken)
         {
             var model = await _callRepository.GetAsync(
-                x => x.ConversationId == notification.Outer.Id  && x.ToNo == notification.Outer.To && x.Trunk==notification.Outer.Trunk && x.CreationTime>=DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                x => x.ConversationId == notification.Outer.Id && x.ToNo == notification.Outer.To && x.Trunk == notification.Outer.Trunk && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             if (model != null)
             {
                 model.CallStatus = ECallStatus.Bye;

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeOuterAndOuterNotificationHandler.cs

@@ -1,11 +1,13 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class ByeOuterAndOuterNotificationHandler:INotificationHandler<ByeOuterAndOuterNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class ByeOuterAndOuterNotificationHandler : INotificationHandler<ByeOuterAndOuterNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -20,8 +22,8 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(x =>
                 x.ConversationId == notification.Outer.Id && x.FromNo == notification.Outer.From &&
-                x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime,cancellationToken);
-            if (model!=null)
+                x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.Bye;
                 model.RingOffType = ERingOffType.Normal;

+ 9 - 7
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorAndExtNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -7,7 +8,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class ByeVisitorAndExtNotificationHandler:INotificationHandler<ByeVisitorAndExtNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class ByeVisitorAndExtNotificationHandler : INotificationHandler<ByeVisitorAndExtNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -15,7 +17,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IRealtimeService _realtimeService;
         private readonly ICallCacheManager _callCacheManager;
 
-        public ByeVisitorAndExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager, IRealtimeService realtimeService, ICallCacheManager callCacheManager)
+        public ByeVisitorAndExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IUserCacheManager userCacheManager, IRealtimeService realtimeService, ICallCacheManager callCacheManager)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -27,8 +29,8 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         public async Task Handle(ByeVisitorAndExtNotification notification, CancellationToken cancellationToken)
         {
             var model = await _callRepository.GetAsync(
-                x => x.ConversationId == notification.Visitor.Id && 
-                     x.FromNo == notification.Visitor.From && x.CreationTime>=DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                x => x.ConversationId == notification.Visitor.Id &&
+                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             if (model != null)
             {
                 model.CallStatus = ECallStatus.Bye;
@@ -54,11 +56,11 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                 await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
 
                 //查询应答分机分机号
-                var callDetailAnswer = await _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER", true, d => d.CreationTime,cancellationToken);
-                if (callDetailAnswer!=null)
+                var callDetailAnswer = await _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER", true, d => d.CreationTime, cancellationToken);
+                if (callDetailAnswer != null)
                 {
                     var workModel = _userCacheManager.GetWorkByTel(callDetailAnswer.AnswerNo);
-                    if (workModel!=null)
+                    if (workModel != null)
                     {
                         //调用业务通知 通知前端
                         await _realtimeService.ByeAsync(workModel.UserId, new Share.Dtos.Realtime.ByeDto() { Id = model.Id }, cancellationToken);

+ 3 - 1
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorAndMenuNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -13,6 +14,7 @@ using System.Threading.Tasks;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class ByeVisitorAndMenuNotificationHandler : INotificationHandler<ByeVisitorAndMenuNotification>
     {
         private readonly ICallRepository _callRepository;
@@ -20,7 +22,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IRealtimeService _realtimeService;
         private readonly IUserCacheManager _userCacheManager;
 
-        public ByeVisitorAndMenuNotificationHandler(ICallRepository callRepository,ICallDetailRepository callDetailRepository,IRealtimeService realtimeService,IUserCacheManager userCacheManager)
+        public ByeVisitorAndMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IRealtimeService realtimeService, IUserCacheManager userCacheManager)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;

+ 3 - 1
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorAndOuterNotificationHandler.cs

@@ -1,10 +1,12 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class ByeVisitorAndOuterNotificationHandler:INotificationHandler<ByeVisitorAndOuterNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class ByeVisitorAndOuterNotificationHandler : INotificationHandler<ByeVisitorAndOuterNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;

+ 8 - 6
src/Hotline.Application/Handlers/CallCenter/FlowControl/ByeVisitorOffNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -8,7 +9,8 @@ using Serilog.Enrichers.Span;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class ByeVisitorOffNotificationHandler:INotificationHandler<ByeVisitorOffNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class ByeVisitorOffNotificationHandler : INotificationHandler<ByeVisitorOffNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -16,7 +18,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public ByeVisitorOffNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, ICallCacheManager callCacheManager, IUserCacheManager userCacheManager,IRealtimeService realtimeService)
+        public ByeVisitorOffNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, ICallCacheManager callCacheManager, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -29,7 +31,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id &&
-                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
+                     x.FromNo == notification.Visitor.From && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
             if (model != null)
             {
                 model.CallStatus = ECallStatus.Bye;
@@ -55,12 +57,12 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                 await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
 
                 //查询应答分机号
-                var callDetailAnswer = await _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER", true, x => x.CreationTime,cancellationToken);
-                if (callDetailAnswer!=null)
+                var callDetailAnswer = await _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER", true, x => x.CreationTime, cancellationToken);
+                if (callDetailAnswer != null)
                 {
                     //调用业务通知 通知前端
                     var workModel = _userCacheManager.GetWorkByTel(callDetailAnswer.AnswerNo);
-                    if (workModel!=null)
+                    if (workModel != null)
                     {
                         await _realtimeService.ByeAsync(workModel.UserId, new Share.Dtos.Realtime.ByeDto() { Id = model.Id }, cancellationToken);
                     }

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/CdrNotificationHandler.cs

@@ -1,6 +1,7 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Tels;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Enums.CallCenter;
@@ -9,7 +10,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class CdrNotificationHandler:INotificationHandler<CdrNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class CdrNotificationHandler : INotificationHandler<CdrNotification>
     {
         private readonly ICallRecordRepository _callRecordRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -18,7 +20,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         private readonly IUserCacheManager _userCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public CdrNotificationHandler(ICallRecordRepository callRecordRepository, ICallDetailRepository callDetailRepository, ICallRepository callRepository,ITelHoldRepository telHoldRepository,IUserCacheManager userCacheManager, IRealtimeService realtimeService)
+        public CdrNotificationHandler(ICallRecordRepository callRecordRepository, ICallDetailRepository callDetailRepository, ICallRepository callRepository, ITelHoldRepository telHoldRepository, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRecordRepository = callRecordRepository;
             _callDetailRepository = callDetailRepository;
@@ -51,7 +53,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
             else
             {
                 var callDetail = await
-                _callDetailRepository.GetAsync(x => x.OMCallId == notification.CallId,true,x=>x.CreationTime, cancellationToken);
+                _callDetailRepository.GetAsync(x => x.OMCallId == notification.CallId, true, x => x.CreationTime, cancellationToken);
 
                 if (callDetail != null)
                 {

+ 6 - 4
src/Hotline.Application/Handlers/CallCenter/FlowControl/DivertVisitorToExtNotificationHandler.cs

@@ -1,11 +1,13 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class DivertVisitorToExtNotificationHandler:INotificationHandler<DivertVisitorToExtNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class DivertVisitorToExtNotificationHandler : INotificationHandler<DivertVisitorToExtNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -20,9 +22,9 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id && x.FromNo == notification.Visitor.From &&
-                     x.ToNo == notification.Visitor.To && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime,
+                     x.ToNo == notification.Visitor.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime,
                 cancellationToken);
-            if (model!=null)
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.Divert;
                 await _callRepository.UpdateAsync(model, cancellationToken);
@@ -36,7 +38,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                     FromNo = notification.Visitor.From,
                     ToNo = notification.Visitor.To
                 };
-                await _callDetailRepository.AddAsync(detail,cancellationToken);
+                await _callDetailRepository.AddAsync(detail, cancellationToken);
             }
         }
     }

+ 9 - 7
src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnOuterToMenuNotificationHandler.cs

@@ -2,6 +2,7 @@
 using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Ivrs;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -11,12 +12,13 @@ using NewRock.Sdk;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class EndOfAnnOuterToMenuNotificationHandler:NewRockBaseHandler,INotificationHandler<EndOfAnnOuterToMenuNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class EndOfAnnOuterToMenuNotificationHandler : NewRockBaseHandler, INotificationHandler<EndOfAnnOuterToMenuNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IIvrDomainService _ivrDomainService;
-        public EndOfAnnOuterToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService, INewRockClient newRockClient, IOptionsSnapshot<CallCenterConfiguration> callcenterOptions,ICallCacheManager callCacheManager,IRealtimeService realtimeService) : base(newRockClient, callcenterOptions,callRepository,callCacheManager, realtimeService)
+        public EndOfAnnOuterToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService, INewRockClient newRockClient, IOptionsSnapshot<CallCenterConfiguration> callcenterOptions, ICallCacheManager callCacheManager, IRealtimeService realtimeService) : base(newRockClient, callcenterOptions, callRepository, callCacheManager, realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -25,13 +27,13 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
 
         public async Task Handle(EndOfAnnOuterToMenuNotification notification, CancellationToken cancellationToken)
         {
-            var model =await _callRepository.GetAsync(
+            var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Outer.Id && x.FromNo == notification.Outer.From &&
-                     x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime, cancellationToken);
-            if (model!=null)
+                     x.ToNo == notification.Outer.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.EndOfAnn;
-                await _callRepository.UpdateAsync(model,cancellationToken);
+                await _callRepository.UpdateAsync(model, cancellationToken);
                 var detail = new CallDetail()
                 {
                     CallId = model.Id,
@@ -44,7 +46,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                 };
                 await _callDetailRepository.AddAsync(detail, cancellationToken);
 
-                var runModel = await _ivrDomainService.GetVoiceEndAnswerAsync(notification.MenuId,cancellationToken);
+                var runModel = await _ivrDomainService.GetVoiceEndAnswerAsync(notification.MenuId, cancellationToken);
 
                 await HandlerIvr(runModel, model, cancellationToken);
             }

+ 8 - 7
src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnVisitorToMenuNotificationHandler.cs

@@ -2,6 +2,7 @@
 using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Ivrs;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -11,14 +12,14 @@ using NewRock.Sdk;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-
-    public class EndOfAnnVisitorToMenuNotificationHandler:NewRockBaseHandler,INotificationHandler<EndOfAnnVisitorToMenuNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class EndOfAnnVisitorToMenuNotificationHandler : NewRockBaseHandler, INotificationHandler<EndOfAnnVisitorToMenuNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IIvrDomainService _ivrDomainService;
 
-        public EndOfAnnVisitorToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService,INewRockClient newRockClient, IOptionsSnapshot<CallCenterConfiguration> callcenterOptions,ICallCacheManager callCacheManager,IRealtimeService realtimeService):base(newRockClient,callcenterOptions,callRepository,callCacheManager, realtimeService)
+        public EndOfAnnVisitorToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService, INewRockClient newRockClient, IOptionsSnapshot<CallCenterConfiguration> callcenterOptions, ICallCacheManager callCacheManager, IRealtimeService realtimeService) : base(newRockClient, callcenterOptions, callRepository, callCacheManager, realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
@@ -29,10 +30,10 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
         {
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id && x.FromNo == notification.Visitor.From &&
-                     x.ToNo == notification.Visitor.To && x.CreationTime >= DateTime.Now.AddHours(-2),true,x=>x.CreationTime,
+                     x.ToNo == notification.Visitor.To && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime,
                 cancellationToken);
 
-            if (model!=null)
+            if (model != null)
             {
                 model.CallStatus = ECallStatus.EndOfAnn;
                 await _callRepository.UpdateAsync(model, cancellationToken);
@@ -48,12 +49,12 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                 };
                 await _callDetailRepository.AddAsync(detail, cancellationToken);
 
-                var runModel = await _ivrDomainService.GetVoiceEndAnswerAsync(notification.MenuId,cancellationToken);
+                var runModel = await _ivrDomainService.GetVoiceEndAnswerAsync(notification.MenuId, cancellationToken);
 
                 await HandlerIvr(runModel, model, cancellationToken);
             }
 
-           
+
         }
     }
 }

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/FlowControl/IncomingNotificationHandler.cs

@@ -1,6 +1,7 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Configs;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Settings;
 using Hotline.Share.Enums.CallCenter;
@@ -18,6 +19,7 @@ using XF.Domain.Repository;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class IncomingNotificationHandler : INotificationHandler<IncomingNotification>
     {
         private readonly ICallRepository _callRepository;

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/FlowControl/InviteNotificationHandler.cs

@@ -2,6 +2,7 @@
 using Hotline.CallCenter.BlackLists;
 using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Configs;
+using Hotline.EventBus;
 using Hotline.Settings;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
@@ -14,6 +15,7 @@ using NewRock.Sdk.Control.Request;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class InviteNotificationHandler : INotificationHandler<InviteNotification>
     {
         private readonly ICallRepository _callRepository;

+ 5 - 3
src/Hotline.Application/Handlers/CallCenter/FlowControl/QueueVisitorToGroupBusyNotificationHandler.cs

@@ -1,19 +1,21 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Realtimes;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.FlowControl
 {
-    public class QueueVisitorToGroupBusyNotificationHandler:INotificationHandler<QueueVisitorToGroupBusyNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class QueueVisitorToGroupBusyNotificationHandler : INotificationHandler<QueueVisitorToGroupBusyNotification>
     {
         private readonly ICallCacheManager _callCacheManager;
         private readonly IRealtimeService _realtimeService;
 
-        public QueueVisitorToGroupBusyNotificationHandler(ICallCacheManager callCacheManager,IRealtimeService realtimeService)
+        public QueueVisitorToGroupBusyNotificationHandler(ICallCacheManager callCacheManager, IRealtimeService realtimeService)
         {
-            _callCacheManager= callCacheManager;
+            _callCacheManager = callCacheManager;
             _realtimeService = realtimeService;
         }
 

+ 3 - 4
src/Hotline.Application/Handlers/CallCenter/NewRockBaseHandler.cs

@@ -13,7 +13,6 @@ using NewRock.Sdk.Transfer.Queue.Request;
 
 namespace Hotline.Application.Handlers.CallCenter
 {
-    [HandlerInject(Labels = "callcenter=XunShi")]
     public class NewRockBaseHandler
     {
         private readonly INewRockClient _newRockClient;
@@ -22,7 +21,7 @@ namespace Hotline.Application.Handlers.CallCenter
         private readonly ICallCacheManager _callCacheManager;
         private readonly IRealtimeService _realtimeService;
         public NewRockBaseHandler(
-            INewRockClient newRockClient, 
+            INewRockClient newRockClient,
             IOptionsSnapshot<CallCenterConfiguration> options,
             ICallRepository callRepository,
             ICallCacheManager callCacheManager,
@@ -103,7 +102,7 @@ namespace Hotline.Application.Handlers.CallCenter
                         break;
                     case EIvrAnswerType.TelGroup:
                         var groupId = ivrAnswer.Content;
-                        model.InQueueTime= DateTime.Now;
+                        model.InQueueTime = DateTime.Now;
                         await _callRepository.UpdateAsync(model);
                         await _newRockClient.VisitorToGroupQueue(new VisitorToGroupQueueRequest()
                         {
@@ -116,7 +115,7 @@ namespace Hotline.Application.Handlers.CallCenter
                         _callCacheManager.AddCallCache(model);
                         await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
                         break;
-                        
+
                     case EIvrAnswerType.Out:
                         var phoneNo = ivrAnswer.Content;
                         switch (model.CallType)

+ 2 - 0
src/Hotline.Application/Handlers/CallCenter/System/BootupNotificationHandler.cs

@@ -3,6 +3,7 @@ using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;
 using Hotline.CallCenter.Tels;
+using Hotline.EventBus;
 using Hotline.NewRock;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
@@ -11,6 +12,7 @@ using Microsoft.Extensions.Options;
 
 namespace Hotline.Application.Handlers.CallCenter.System
 {
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
     public class BootupNotificationHandler : INotificationHandler<BootupNotification>
     {
         private readonly ITelGroupRepository _telGroupRepository;

+ 4 - 2
src/Hotline.Application/Handlers/CallCenter/Transient/TransientOuterNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using Hotline.Tools;
@@ -7,7 +8,8 @@ using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.Transient
 {
-    public class TransientOuterNotificationHandler:INotificationHandler<TransientOuterNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class TransientOuterNotificationHandler : INotificationHandler<TransientOuterNotification>
     {
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
@@ -46,7 +48,7 @@ namespace Hotline.Application.Handlers.CallCenter.Transient
                     CallStatus = ECallStatus.ExtOuterReady,
                     ConversationId = notification.Outer.Id,
                     OMCallId = notification.Outer.CallId,
-                    EventName =  "ExtOuterReady", //去电
+                    EventName = "ExtOuterReady", //去电
                     FromNo = notification.Outer.From,
                     ToNo = notification.Outer.To,
                 };

+ 3 - 1
src/Hotline.Application/Handlers/CallCenter/Transient/TransinetVisitorNotificationHandler.cs

@@ -1,10 +1,12 @@
 using Hotline.CallCenter.Calls;
+using Hotline.EventBus;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MediatR;
 
 namespace Hotline.Application.Handlers.CallCenter.Transient
 {
-    public class TransinetVisitorNotificationHandler:INotificationHandler<TransientVisitorNotification>
+    [HandlerInject(EventHandlerType = EEventHandlerType.CallCenter, Label = AppDefaults.CallCenterType.XunShi)]
+    public class TransinetVisitorNotificationHandler : INotificationHandler<TransientVisitorNotification>
     {
         private readonly ICallRepository _callRepository;
 

+ 1 - 1
src/Hotline.NewRock/NewRockDeviceManager.cs

@@ -23,7 +23,7 @@ using Group = NewRock.Sdk.Control.Request.Group;
 
 namespace Hotline.NewRock
 {
-    public class NewRockDeviceManager : INewRockDeviceManager, IScopeDependency
+    public class NewRockDeviceManager : INewRockDeviceManager
     {
         private readonly INewRockClient _newRockClient;
         private readonly ICallRepository _callRepository;

+ 2 - 3
src/Hotline.NewRock/NewRockStartupExtensions.cs

@@ -1,10 +1,9 @@
 using Hotline.CallCenter.Configs;
+using Hotline.CallCenter.Devices;
 using Hotline.NewRock.Mappers;
 using Mapster;
-using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using NewRock.Sdk;
-using XF.Domain.Options;
 
 namespace Hotline.NewRock
 {
@@ -14,7 +13,7 @@ namespace Hotline.NewRock
         {
             services
                 .AddNewRockSdk(newrockConfig.Address)
-                //.AddScoped<INewRockDeviceManager, NewRockDeviceManager>()
+                .AddScoped<INewRockDeviceManager, NewRockDeviceManager>()
                 ;
 
             TypeAdapterConfig.GlobalSettings.Scan(typeof(EventConfigs).Assembly);

+ 15 - 6
src/Hotline/CallCenter/Manage/VoiceFileDomainService.cs

@@ -1,6 +1,7 @@
 using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.Share.Requests;
+using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Options;
 using XF.Domain.Dependency;
 
@@ -9,12 +10,20 @@ namespace Hotline.CallCenter.Manage
     public class VoiceFileDomainService:IVoiceFileDomainService, IScopeDependency
     {
         private readonly INewRockDeviceManager _newRockDeviceManager;
-        private readonly IOptionsSnapshot<CallCenterConfiguration> _options;
+        private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
+        private readonly IOptionsSnapshot<CallCenterConfiguration> _callcenterOptions;
 
-        public VoiceFileDomainService(INewRockDeviceManager newRockDeviceManager, IOptionsSnapshot<CallCenterConfiguration> options)
+        public VoiceFileDomainService(
+            IServiceProvider serviceProvider,
+            IOptionsSnapshot<AppConfiguration> appOptions,
+            IOptionsSnapshot<CallCenterConfiguration> callcenterOptions)
         {
-            _newRockDeviceManager = newRockDeviceManager;
-            _options = options;
+            _appOptions = appOptions;
+            _callcenterOptions = callcenterOptions;
+            if (appOptions.Value.GetDefaultAppScopeConfiguration().CallCenterType == AppDefaults.CallCenterType.XunShi)
+            {
+                _newRockDeviceManager = serviceProvider.GetRequiredService<INewRockDeviceManager>();
+            }
         }
 
         /// <summary>
@@ -24,7 +33,7 @@ namespace Hotline.CallCenter.Manage
         /// <returns></returns>
         public async Task<List<string>> VoiceQueryListAsync(CancellationToken cancellationToken)
         {
-            var result = await _newRockDeviceManager.VoiceQueryListAsync(_options.Value.NewRock, cancellationToken);
+            var result = await _newRockDeviceManager.VoiceQueryListAsync(_callcenterOptions.Value.NewRock, cancellationToken);
             var list =  result.Replace(".dat","").Replace(".pcm","").Split("|").ToList();
 
             return list.Distinct().ToList();
@@ -38,7 +47,7 @@ namespace Hotline.CallCenter.Manage
         /// <returns></returns>
         public async Task RemoveVoiceFileAsync(RemoveVoiceFileRequest request, CancellationToken cancellationToken)
         {
-            await _newRockDeviceManager.RemoveVoiceFileAsync(_options.Value.NewRock, request.VoiceFileNames, cancellationToken);
+            await _newRockDeviceManager.RemoveVoiceFileAsync(_callcenterOptions.Value.NewRock, request.VoiceFileNames, cancellationToken);
         }
 
 

+ 11 - 2
src/Hotline/EventBus/HandlerInjectAttribute.cs

@@ -19,10 +19,19 @@ namespace Hotline.EventBus
         /// </summary>
         public bool Enable { get; set; } = true;
 
+        /// <summary>
+        /// handler的业务类型
+        /// </summary>
+        public EEventHandlerType EventHandlerType { get; set; }
 
         /// <summary>
-        /// key=value,key=value
+        /// value,value
         /// </summary>
-        public string Labels { get; set; }
+        public string Label { get; set; }
+    }
+
+    public enum EEventHandlerType
+    {
+        CallCenter = 1
     }
 }