|
@@ -1,9 +1,12 @@
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
using Hotline.CallCenter.Tels;
|
|
|
+using Hotline.Share.Dtos.TrCallCenter;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Users;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
+using Tr.Sdk;
|
|
|
+using Tr.Sdk.Tels;
|
|
|
using XF.Domain.Cache;
|
|
|
using XF.Domain.Dependency;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -14,6 +17,7 @@ namespace Hotline.Application.Tels;
|
|
|
public class TelApplication : ITelApplication, IScopeDependency
|
|
|
{
|
|
|
private readonly IUserCacheManager _userCacheManager;
|
|
|
+ private readonly ITrClient _trClient;
|
|
|
private readonly ITelRestRepository _telRestRepository;
|
|
|
private readonly ITypedCache<Work> _cacheWork;
|
|
|
private readonly IWorkRepository _workRepository;
|
|
@@ -24,13 +28,15 @@ public class TelApplication : ITelApplication, IScopeDependency
|
|
|
ITelRestRepository telRestRepository,
|
|
|
ITypedCache<Work> cacheWork,
|
|
|
IWorkRepository workRepository,
|
|
|
- IRepository<TelActionRecord> telActionRecordRepository)
|
|
|
+ IRepository<TelActionRecord> telActionRecordRepository,
|
|
|
+ ITrClient trClient)
|
|
|
{
|
|
|
_userCacheManager = userCacheManager;
|
|
|
_telRestRepository = telRestRepository;
|
|
|
_cacheWork = cacheWork;
|
|
|
_workRepository = workRepository;
|
|
|
_telActionRecordRepository = telActionRecordRepository;
|
|
|
+ _trClient = trClient;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -52,7 +58,7 @@ public class TelApplication : ITelApplication, IScopeDependency
|
|
|
await _workRepository.UpdateAsync(work, cancellationToken);
|
|
|
_cacheWork.Remove(work.GetKey(KeyMode.UserId));
|
|
|
_cacheWork.Remove(work.GetKey(KeyMode.TelNo));
|
|
|
-
|
|
|
+
|
|
|
var list = await _telActionRecordRepository.Queryable().Where(x => x.TelNo == work.TelNo && !x.EndTime.HasValue).ToListAsync();
|
|
|
foreach (var item in list)
|
|
|
{
|
|
@@ -75,7 +81,7 @@ public class TelApplication : ITelApplication, IScopeDependency
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
- public async Task SignOutByTelNoAsync(string telNo,CancellationToken cancellationToken)
|
|
|
+ public async Task SignOutByTelNoAsync(string telNo, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var work = _userCacheManager.GetWorkByTelNoExp(telNo);
|
|
|
if (work is null) return;
|
|
@@ -95,7 +101,7 @@ public class TelApplication : ITelApplication, IScopeDependency
|
|
|
|
|
|
|
|
|
var list = await _telActionRecordRepository.Queryable().Where(x => x.TelNo == work.TelNo && !x.EndTime.HasValue).ToListAsync();
|
|
|
- foreach ( var item in list )
|
|
|
+ foreach (var item in list)
|
|
|
{
|
|
|
item.EndAction();
|
|
|
await _telActionRecordRepository.UpdateAsync(item);
|
|
@@ -115,4 +121,4 @@ public class TelApplication : ITelApplication, IScopeDependency
|
|
|
// await _telActionRecordRepository.UpdateAsync(telarrangeAction);
|
|
|
//}
|
|
|
}
|
|
|
-}
|
|
|
+ }
|