Browse Source

bye realtime

dss 2 years ago
parent
commit
5245ef3ef0

+ 10 - 10
src/CallCenter.Api/appsettings.Development.json

@@ -66,11 +66,11 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "08dae7d5-4332-40e8-85dd-ad210e40270b",
         "RestCategory": "",
-        "WorkToGroup": "600",
-        "RestToGroup": "600"
+        "WorkToGroup": "1",
+        "RestToGroup": "1"
       },
       {
-        "NumNo": "12333",
+        "NumNo": "3490",
         "MorningBegin": "07:00",
         "MorningEnd": "12:00",
         "AfterBegin": "12:00",
@@ -78,8 +78,8 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "",
         "RestCategory": "",
-        "WorkToGroup": "604",
-        "RestToGroup": "600"
+        "WorkToGroup": "2",
+        "RestToGroup": "1"
       },
       {
         "NumNo": "12319",
@@ -90,11 +90,11 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "",
         "RestCategory": "",
-        "WorkToGroup": "600",
-        "RestToGroup": "600"
+        "WorkToGroup": "1",
+        "RestToGroup": "1"
       },
       {
-        "NumNo": "12315",
+        "NumNo": "3497",
         "MorningBegin": "00:00",
         "MorningEnd": "12:00",
         "AfterBegin": "12:00",
@@ -102,8 +102,8 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "",
         "RestCategory": "",
-        "WorkToGroup": "",
-        "RestToGroup": ""
+        "WorkToGroup": "1",
+        "RestToGroup": "1"
       }
     ]
   },

+ 10 - 10
src/CallCenter.Api/appsettings.json

@@ -63,11 +63,11 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "08dae7d5-4332-40e8-85dd-ad210e40270b",
         "RestCategory": "",
-        "WorkToGroup": "600",
-        "RestToGroup": "600"
+        "WorkToGroup": "1",
+        "RestToGroup": "1"
       },
       {
-        "NumNo": "12333",
+        "NumNo": "3490",
         "MorningBegin": "07:00",
         "MorningEnd": "12:00",
         "AfterBegin": "12:00",
@@ -75,8 +75,8 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "",
         "RestCategory": "",
-        "WorkToGroup": "604",
-        "RestToGroup": "600"
+        "WorkToGroup": "2",
+        "RestToGroup": "1"
       },
       {
         "NumNo": "12319",
@@ -87,11 +87,11 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "",
         "RestCategory": "",
-        "WorkToGroup": "600",
-        "RestToGroup": "600"
+        "WorkToGroup": "1",
+        "RestToGroup": "1"
       },
       {
-        "NumNo": "12315",
+        "NumNo": "3497",
         "MorningBegin": "00:00",
         "MorningEnd": "12:00",
         "AfterBegin": "12:00",
@@ -99,8 +99,8 @@
         "WorkDay": [ 1, 2, 3, 4, 5, 6, 0 ],
         "WorkCategory": "",
         "RestCategory": "",
-        "WorkToGroup": "",
-        "RestToGroup": ""
+        "WorkToGroup": "1",
+        "RestToGroup": "1"
       }
     ]
   },

+ 18 - 1
src/CallCenter.Application/Handlers/FlowControl/ByeVisitorOffNotificationHandler.cs

@@ -1,5 +1,6 @@
 using CallCenter.Caches;
 using CallCenter.Calls;
+using CallCenter.Realtimes;
 using CallCenter.Share.Enums;
 using CallCenter.Share.Notifications;
 using MediatR;
@@ -11,12 +12,16 @@ namespace CallCenter.Application.Handlers
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly ICallCacheManager _callCacheManager;
+        private readonly IUserCacheManager _userCacheManager;
+        private readonly IRealtimeService _realtimeService;
 
-        public ByeVisitorOffNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,ICallCacheManager callCacheManager)
+        public ByeVisitorOffNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,ICallCacheManager callCacheManager, IUserCacheManager userCacheManager, IRealtimeService realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
             _callCacheManager = callCacheManager;
+            _userCacheManager = userCacheManager;
+            _realtimeService = realtimeService;
         }
 
         public async Task Handle(ByeVisitorOffNotification notification, CancellationToken cancellationToken)
@@ -45,6 +50,18 @@ namespace CallCenter.Application.Handlers
 
                 //处理队列记录
                 _callCacheManager.RemoveCallCache(model.Id);
+
+                //查询应答分机分机号
+                var callDetailAnswer = await _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER", true, d => d.CreationTime);
+                if (callDetailAnswer != null)
+                {
+                    //调用业务通知 通知前端
+                    var workModel = _userCacheManager.GetWorkByTel(callDetailAnswer.AnswerNo);
+                    if (workModel != null)
+                    {
+                        await _realtimeService.ByeAsync(workModel.UserId, new ByeDto() { Id = model.Id }, cancellationToken);
+                    }
+                }
             }
         }
     }