|
@@ -1,4 +1,6 @@
|
|
-using CallCenter.Calls;
|
|
|
|
|
|
+using CallCenter.Caches;
|
|
|
|
+using CallCenter.Calls;
|
|
|
|
+using CallCenter.Realtimes;
|
|
using CallCenter.Share.Enums;
|
|
using CallCenter.Share.Enums;
|
|
using CallCenter.Share.Notifications;
|
|
using CallCenter.Share.Notifications;
|
|
using MediatR;
|
|
using MediatR;
|
|
@@ -9,11 +11,15 @@ namespace CallCenter.Application.Handlers
|
|
{
|
|
{
|
|
private readonly ICallRepository _callRepository;
|
|
private readonly ICallRepository _callRepository;
|
|
private readonly ICallDetailRepository _callDetailRepository;
|
|
private readonly ICallDetailRepository _callDetailRepository;
|
|
|
|
+ private readonly IUserCacheManager _userCacheManager;
|
|
|
|
+ private readonly IRealtimeService _realtimeService;
|
|
|
|
|
|
- public AnsweredExtToOuterToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository)
|
|
|
|
|
|
+ public AnsweredExtToOuterToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IUserCacheManager userCacheManager, IRealtimeService realtimeService)
|
|
{
|
|
{
|
|
_callRepository = callRepository;
|
|
_callRepository = callRepository;
|
|
_callDetailRepository = callDetailRepository;
|
|
_callDetailRepository = callDetailRepository;
|
|
|
|
+ _userCacheManager = userCacheManager;
|
|
|
|
+ _realtimeService = realtimeService;
|
|
}
|
|
}
|
|
|
|
|
|
public async Task Handle(AnsweredExtToOuterToExtNotification notification, CancellationToken cancellationToken)
|
|
public async Task Handle(AnsweredExtToOuterToExtNotification notification, CancellationToken cancellationToken)
|
|
@@ -37,6 +43,13 @@ namespace CallCenter.Application.Handlers
|
|
ToNo = notification.Outer.To,
|
|
ToNo = notification.Outer.To,
|
|
};
|
|
};
|
|
await _callDetailRepository.AddAsync(detail, cancellationToken);
|
|
await _callDetailRepository.AddAsync(detail, cancellationToken);
|
|
|
|
+
|
|
|
|
+ //调用业务通知 通知前端
|
|
|
|
+ var workModel = _userCacheManager.GetWorkByTel(notification.Outer.From);
|
|
|
|
+ if (workModel != null)
|
|
|
|
+ {
|
|
|
|
+ await _realtimeService.AnsweredAsync(workModel.UserId, new AnseredDto() { ConversationId = notification.Outer.Id, From = notification.Outer.From, Id = model.Id, To = notification.Outer.To, CallType= ECallType.ExtToOuter }, cancellationToken);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|