admin il y a 2 ans
Parent
commit
c7a412f2a9

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

@@ -3,6 +3,7 @@ using CallCenter.Calls;
 using CallCenter.Devices;
 using CallCenter.Ivrs;
 using CallCenter.Notifications;
+using CallCenter.Realtimes;
 using CallCenter.Settings;
 using CallCenter.Share.Enums;
 using MediatR;
@@ -21,7 +22,7 @@ namespace CallCenter.Application.Handlers
         private readonly ICallDetailRepository _callDetailRepository;
 
 
-        public DtmfNotificationHandler(IIvrDomainService ivrDomainService, ICallDetailRepository callDetailRepository, ICallRepository callRepository, INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,ICallCacheManager callCacheManager) :base(newRockClient, options,callCacheManager, callRepository)
+        public DtmfNotificationHandler(IIvrDomainService ivrDomainService, ICallDetailRepository callDetailRepository, ICallRepository callRepository, INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,ICallCacheManager callCacheManager,IRealtimeService realtimeService) :base(newRockClient, options,callCacheManager, callRepository,realtimeService)
         {
             _ivrDomainService = ivrDomainService;
             _callDetailRepository = callDetailRepository;

+ 2 - 2
src/CallCenter.Application/Handlers/FlowControl/EndOfAnnOuterToMenuNotificationHandler.cs

@@ -3,6 +3,7 @@ using CallCenter.Calls;
 using CallCenter.Devices;
 using CallCenter.Ivrs;
 using CallCenter.Notifications;
+using CallCenter.Realtimes;
 using CallCenter.Share.Enums;
 using MediatR;
 using Microsoft.Extensions.Options;
@@ -15,8 +16,7 @@ namespace CallCenter.Application.Handlers
         private readonly ICallRepository _callRepository;
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IIvrDomainService _ivrDomainService;
-        private readonly ICallCacheManager _callCacheManager;
-        public EndOfAnnOuterToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService, INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,ICallCacheManager callCacheManager) : base(newRockClient, options,callCacheManager, callRepository)
+        public EndOfAnnOuterToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService, INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,ICallCacheManager callCacheManager,IRealtimeService realtimeService) : base(newRockClient, options,callCacheManager, callRepository,realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;

+ 2 - 1
src/CallCenter.Application/Handlers/FlowControl/EndOfAnnVisitorToMenuNotificationHandler.cs

@@ -3,6 +3,7 @@ using CallCenter.Calls;
 using CallCenter.Devices;
 using CallCenter.Ivrs;
 using CallCenter.Notifications;
+using CallCenter.Realtimes;
 using CallCenter.Share.Enums;
 using MediatR;
 using Microsoft.Extensions.Options;
@@ -18,7 +19,7 @@ namespace CallCenter.Application.Handlers.FlowControl
         private readonly IIvrDomainService _ivrDomainService;
         private readonly ICallCacheManager _callCacheManager;
 
-        public EndOfAnnVisitorToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService,INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,ICallCacheManager callCacheManager):base(newRockClient,options,callCacheManager, callRepository)
+        public EndOfAnnVisitorToMenuNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository, IIvrDomainService ivrDomainService,INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,ICallCacheManager callCacheManager,IRealtimeService realtimeService):base(newRockClient,options,callCacheManager, callRepository, realtimeService)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;

+ 7 - 5
src/CallCenter/Caches/UserCacheManager.cs

@@ -65,11 +65,13 @@ public class UserCacheManager : IUserCacheManager, IScopeDependency
     /// <returns></returns>
     public List<Work>? GetWorks()
     {
-        var works = _cacheWorks.GetOrSet(WorkKey, k =>
-        {
-            var works = _workRepository.QueryAsync(x => x.EndTime == null).GetAwaiter().GetResult();
-            return works;
-        });
+        //var works = _cacheWorks.GetOrSet(WorkKey, k =>
+        //{
+        //    var works = _workRepository.QueryAsync(x => x.EndTime == null).GetAwaiter().GetResult();
+        //    return works;
+        //});
+
+        var works = _cacheWork.GetListByPrefix().ToList();
         return works;
     }
 

+ 2 - 2
src/CallCenter/Users/UserDomainService.cs

@@ -64,7 +64,7 @@ namespace CallCenter.Users
             await _workRepository.AddAsync(work, cancellationToken);
 
             //更新work缓存
-            _userCacheManager.AddWorksCache(work);
+            //_userCacheManager.AddWorksCache(work);
             //_userCacheManager.RemoveCallCache(work.Id);
             if (!string.IsNullOrEmpty(user.StaffNo))
                 await _deviceManager.UpdateStaffNoAsync(tel.No, user.StaffNo, tel.LineId, cancellationToken);
@@ -97,7 +97,7 @@ namespace CallCenter.Users
             _cacheWork.Remove(work.GetKey(KeyMode.TelNo));
 
             //更新work缓存
-            _userCacheManager.RemoveWorksCache(work.Id);
+            //_userCacheManager.RemoveWorksCache(work.Id);
 
             foreach (var group in tel.Groups)
             {