|
@@ -31,7 +31,7 @@ namespace Hotline.Users
|
|
|
IDeviceManager deviceManager,
|
|
|
ITypedCache<Work> cacheWork,
|
|
|
IUserCacheManager userCacheManager,
|
|
|
- IMapper mapper,
|
|
|
+ IMapper mapper,
|
|
|
ITelCacheManager telCacheManager,
|
|
|
ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
ITrClient trClient)
|
|
@@ -77,7 +77,7 @@ namespace Hotline.Users
|
|
|
//更新分机组
|
|
|
foreach (var group in tel.Groups)
|
|
|
{
|
|
|
- await _deviceManager.AssginConfigGroupAsync(group.No,group.Distribution,new List<string>() {tel.No }, group.Voice, cancellationToken);
|
|
|
+ await _deviceManager.AssginConfigGroupAsync(group.No, group.Distribution, new List<string>() { tel.No }, group.Voice, cancellationToken);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -123,7 +123,7 @@ namespace Hotline.Users
|
|
|
/// <param name="TelNo"></param>
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<TrOnDutyResponseDto> TrOnDutyAsync(string userId, string? TelId, string? TelNo, string? TelPwd, string? Description,CancellationToken cancellationToken)
|
|
|
+ public async Task<TrOnDutyResponseDto> TrOnDutyAsync(string userId, string? TelId, string? TelNo, string? TelPwd, string? Description, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var workingTel = await _workRepository.GetCurrentWorkByUserAsync(userId, cancellationToken);
|
|
|
if (workingTel is not null)
|
|
@@ -139,7 +139,7 @@ namespace Hotline.Users
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var user = await _userRepository.GetAsync(userId, cancellationToken);
|
|
|
if (user is null)
|
|
@@ -155,16 +155,16 @@ namespace Hotline.Users
|
|
|
rsp.TelPwd = telModel[0].Password;
|
|
|
rsp.Description = telModel[0].Description;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
rsp.TelNo = TelNo;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
var telIsWorking = await _workRepository.AnyAsync(d => d.TelId == TelId && !d.EndTime.HasValue, cancellationToken);
|
|
|
if (telIsWorking)
|
|
|
throw UserFriendlyException.SameMessage("当前分机已被占用");
|
|
|
|
|
|
- var work = new Work(userId, user.Name, TelId, TelNo,rsp.TelPwd,rsp.Description);
|
|
|
+ var work = new Work(userId, user.Name, TelId, TelNo, rsp.TelPwd, rsp.Description);
|
|
|
await _workRepository.AddAsync(work, cancellationToken);
|
|
|
|
|
|
if (IsTelNeedVerify)
|
|
@@ -174,13 +174,35 @@ namespace Hotline.Users
|
|
|
return rsp;
|
|
|
}
|
|
|
|
|
|
+ public async Task<TrOnDutyResponseDto> TrOnDutyAsync(string userId, string telNo, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ *var work = 缓存.get(userId);
|
|
|
+ * if(work.TelNo == telNo)
|
|
|
+ * t: return work f: throw
|
|
|
+ *
|
|
|
+ * 获取配置
|
|
|
+ *IsNeedTelNo
|
|
|
+ * IsTelNeedVerify
|
|
|
+ *
|
|
|
+ * user
|
|
|
+ * tel = trClient.get(telNo);
|
|
|
+ * work
|
|
|
+ *
|
|
|
+ * 根据配置 return new();
|
|
|
+ *
|
|
|
+ */
|
|
|
+ throw new NotImplementedException();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 下班
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task TrOffDutyAsync(string userId,CancellationToken cancellationToken)
|
|
|
+ public async Task TrOffDutyAsync(string userId, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var work = _userCacheManager.GetWorkByUser(userId);
|
|
|
work.OffDuty();
|