|
@@ -8,6 +8,7 @@ using XF.Domain.Dependency;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
|
|
|
namespace Hotline.CallCenter.Tels;
|
|
|
|
|
@@ -19,6 +20,7 @@ public class TelDomainService : ITelDomainService, IScopeDependency
|
|
|
private readonly ITelHoldRepository _telHoldRepository;
|
|
|
private readonly IRealtimeService _realtimeService;
|
|
|
private readonly ITelCacheManager _telCacheManager;
|
|
|
+ private readonly IOptionsSnapshot<CallCenterConfiguration> _options;
|
|
|
|
|
|
public TelDomainService(
|
|
|
IDeviceManager deviceManager,
|
|
@@ -26,7 +28,8 @@ public class TelDomainService : ITelDomainService, IScopeDependency
|
|
|
ITelRestRepository telRestRepository,
|
|
|
ITelHoldRepository telHoldRepository,
|
|
|
IRealtimeService realtimeService,
|
|
|
- ITelCacheManager telCacheManager)
|
|
|
+ ITelCacheManager telCacheManager,
|
|
|
+ IOptionsSnapshot<CallCenterConfiguration> options)
|
|
|
{
|
|
|
_deviceManager = deviceManager;
|
|
|
_telRepository = telRepository;
|
|
@@ -34,6 +37,7 @@ public class TelDomainService : ITelDomainService, IScopeDependency
|
|
|
_telHoldRepository = telHoldRepository;
|
|
|
_realtimeService = realtimeService;
|
|
|
_telCacheManager = telCacheManager;
|
|
|
+ _options = options;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -108,13 +112,17 @@ public class TelDomainService : ITelDomainService, IScopeDependency
|
|
|
telRest.StartTime = DateTime.Now;
|
|
|
await _telRestRepository.UpdateAsync(telRest, cancellationToken);
|
|
|
|
|
|
- #region 处理设备
|
|
|
- var tel = _telCacheManager.GetTel(telRest.TelNo);
|
|
|
- foreach (var group in tel.Groups)
|
|
|
+ if (_options.Value.CallCenterType!= "WeiErXin")
|
|
|
{
|
|
|
- await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, tel.No, true, cancellationToken);
|
|
|
+ #region 处理设备
|
|
|
+ var tel = _telCacheManager.GetTel(telRest.TelNo);
|
|
|
+ foreach (var group in tel.Groups)
|
|
|
+ {
|
|
|
+ await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, tel.No, true, cancellationToken);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|
|
|
- #endregion
|
|
|
+
|
|
|
//通知前端休息通过
|
|
|
await _realtimeService.RestApplyPassAsync(telRest.UserId, cancellationToken);
|
|
|
|
|
@@ -137,17 +145,18 @@ public class TelDomainService : ITelDomainService, IScopeDependency
|
|
|
throw new UserFriendlyException("未查询到分机休息信息");
|
|
|
restingTel.EndRest();
|
|
|
await _telRestRepository.UpdateAsync(restingTel, cancellationToken);
|
|
|
-
|
|
|
- #region 处理设备
|
|
|
- var telCache = _telCacheManager.GetTel(tel.No);
|
|
|
- //更新分机组
|
|
|
- foreach (var group in telCache.Groups)
|
|
|
+ if (_options.Value.CallCenterType != "WeiErXin")
|
|
|
{
|
|
|
- await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, "", true, cancellationToken);
|
|
|
+ #region 处理设备
|
|
|
+ var telCache = _telCacheManager.GetTel(tel.No);
|
|
|
+ //更新分机组
|
|
|
+ foreach (var group in telCache.Groups)
|
|
|
+ {
|
|
|
+ await _deviceManager.ModifyGroupExtAsync(group.No, group.Distribution, group.Voice, "", true, cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
return restingTel;
|
|
|
}
|
|
|
|