|
@@ -4,6 +4,8 @@ using CallCenter.Notifications;
|
|
|
using CallCenter.Realtimes;
|
|
|
using CallCenter.Share.Enums;
|
|
|
using MediatR;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using System.Text.Json;
|
|
|
|
|
|
namespace CallCenter.Application.Handlers
|
|
|
{
|
|
@@ -13,14 +15,17 @@ namespace CallCenter.Application.Handlers
|
|
|
private readonly ICallDetailRepository _callDetailRepository;
|
|
|
private readonly IRealtimeService _realtimeService;
|
|
|
private readonly IUserCacheManager _userCacheManager;
|
|
|
-
|
|
|
- public RingVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService, IUserCacheManager userCacheManager)
|
|
|
+ private readonly ICallCacheManager _callCacheManager;
|
|
|
+ private readonly ILogger<RingVisitorToExtNotificationHandler> _logger;
|
|
|
+
|
|
|
+ public RingVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService, IUserCacheManager userCacheManager, ICallCacheManager callCacheManager, ILogger<RingVisitorToExtNotificationHandler> logger)
|
|
|
{
|
|
|
_callRepository = callRepository;
|
|
|
_callDetailRepository = callDetailRepository;
|
|
|
_realtimeService = realtimeService;
|
|
|
_userCacheManager = userCacheManager;
|
|
|
-
|
|
|
+ _callCacheManager = callCacheManager;
|
|
|
+ _logger = logger;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -48,7 +53,11 @@ namespace CallCenter.Application.Handlers
|
|
|
};
|
|
|
await _callDetailRepository.AddAsync(detail, cancellationToken);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ //处理排队缓存数据
|
|
|
+ _callCacheManager.RemoveCallCache(model.Id);
|
|
|
+ _logger.LogInformation(JsonSerializer.Serialize(_callCacheManager.GetCallQueueList()));
|
|
|
+ await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
|
|
|
|
|
|
//调用业务弹屏 通知前端
|
|
|
var workModel = _userCacheManager.GetWorkByTel(notification.TelNo);
|