|
@@ -31,8 +31,9 @@ namespace Hotline.NewRock
|
|
|
private readonly ITelGroupRepository _telGroupRepository;
|
|
|
private readonly IUserCacheManager _userCacheManager;
|
|
|
private readonly ITelRestRepository _telRestRepository;
|
|
|
+ private readonly ITelCacheManager _telCacheManager;
|
|
|
|
|
|
- public DeviceManager(INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options, IMapper mapper, ICallRepository callRepository, ITelGroupRepository telGroupRepository,IUserCacheManager userCacheManager, ITelRestRepository telRestRepository)
|
|
|
+ public DeviceManager(INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options, IMapper mapper, ICallRepository callRepository, ITelGroupRepository telGroupRepository,IUserCacheManager userCacheManager, ITelRestRepository telRestRepository, ITelCacheManager telCacheManager)
|
|
|
{
|
|
|
_newRockClient = newRockClient;
|
|
|
_options = options;
|
|
@@ -41,6 +42,7 @@ namespace Hotline.NewRock
|
|
|
_telGroupRepository = telGroupRepository;
|
|
|
_userCacheManager = userCacheManager;
|
|
|
_telRestRepository = telRestRepository;
|
|
|
+ _telCacheManager = telCacheManager;
|
|
|
}
|
|
|
|
|
|
#region 查询
|
|
@@ -330,7 +332,7 @@ namespace Hotline.NewRock
|
|
|
/// <param name="ext"></param>
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task AssginConfigGroupAsync(string groupId, string distribution, List<string> ext, string? voiceFile = "",CancellationToken cancellationToken=default)
|
|
|
+ public async Task AssginConfigGroupAsync(string groupId, EDistribution distribution, List<string> ext, string? voiceFile = "",CancellationToken cancellationToken=default)
|
|
|
{
|
|
|
if (!int.TryParse(groupId, out int mId))
|
|
|
throw new UserFriendlyException("请输入数字");
|
|
@@ -341,9 +343,23 @@ namespace Hotline.NewRock
|
|
|
var groupModel = new Group()
|
|
|
{
|
|
|
Id = groupId,
|
|
|
- Distribution = distribution,
|
|
|
Ext = ext,
|
|
|
};
|
|
|
+ switch (distribution)
|
|
|
+ {
|
|
|
+ case EDistribution.Sequential:
|
|
|
+ groupModel.Distribution = "sequential";
|
|
|
+ break;
|
|
|
+ case EDistribution.Group:
|
|
|
+ groupModel.Distribution = "group";
|
|
|
+ break;
|
|
|
+ case EDistribution.Circular:
|
|
|
+ groupModel.Distribution = "circular";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
if (!string.IsNullOrEmpty(voiceFile))
|
|
|
groupModel.Voicefile = voiceFile;
|
|
|
|
|
@@ -380,12 +396,19 @@ namespace Hotline.NewRock
|
|
|
#endregion
|
|
|
|
|
|
var list = await _telGroupRepository.QueryExtAsync(d => d.No == groupId, d => d.Includes(x => x.Tels));
|
|
|
+ //检查是否上班
|
|
|
List<string> exts = new List<string>();
|
|
|
foreach (var ext in list[0].Tels)
|
|
|
{
|
|
|
var iswork = await _userCacheManager.IsWorkingByTelAsync(ext.No, cancellationToken);
|
|
|
if (iswork)
|
|
|
- exts.Add(ext.No);
|
|
|
+ {
|
|
|
+ var tel = _telCacheManager.GetTel(ext.No);
|
|
|
+ if (tel.TelStatus == ETelStatus.Ready)
|
|
|
+ {
|
|
|
+ exts.Add(ext.No);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//查询所有正在休息的分机
|