Browse Source

Merge branch 'feature/task_342_unlinkcall' into dev

qinchaoyue 6 tháng trước cách đây
mục cha
commit
abb3566844

+ 2 - 0
src/Hotline.Application/CallCenter/DefaultCallApplication.cs

@@ -217,6 +217,8 @@ public abstract class DefaultCallApplication : ICallApplication
             .WhereIF(dto.Direction != null, d => d.Direction == dto.Direction)
             .WhereIF(dto.WaitDurationStart != null && dto.WaitDurationStart > 0, d => d.WaitDuration >= dto.WaitDurationStart)
             .WhereIF(dto.WaitDurationEnd != null && dto.WaitDurationEnd > 0, d => d.WaitDuration <= dto.WaitDurationEnd)
+            .WhereIF(dto.IsMissOrder != null && dto.IsMissOrder.Value == true, (d, o) => o.Id == null )
+            .WhereIF(dto.IsMissOrder != null && dto.IsMissOrder.Value == false, (d, o) => o.Id != null )
             .OrderByDescending(d => d.Id)
             .Select((d, o) => new CallNativeDto
             {

+ 6 - 0
src/Hotline.Application/StatisticalReport/CallReport/CallReportApplicationBase.cs

@@ -14,6 +14,7 @@ using Hotline.Share.Enums.User;
 using Hotline.Users;
 using XF.Domain.Repository;
 using Hotline.CallCenter.Tels;
+using Hotline.Share.Dtos;
 
 namespace Hotline.Application.StatisticalReport.CallReport;
 
@@ -34,6 +35,11 @@ public abstract class CallReportApplicationBase : ICallReportApplication
         _telRestRepository = telRestRepository;
     }
 
+    //public virtual async Task<PagedDto<TrCallDto>> GetCallDetailListAsync(GetCallListDto dto, CancellationToken cancellationToken)
+    //{
+    //    throw new NotImplementedException();
+    //}
+
     public virtual async Task<List<CallHotLineDto>> GetCallHotLineListAsync(BiQueryGateWayDto dto, CancellationToken requestAborted)
     {
         int noConnectByeTimes = _systemSettingCacheManager.NoConnectByeTimes;

+ 45 - 1
src/Hotline.Application/StatisticalReport/CallReport/YiBinCallReportApplication.cs

@@ -16,6 +16,8 @@ using XF.Domain.Dependency;
 using XF.Domain.Exceptions;
 using XF.Domain.Repository;
 using Microsoft.AspNetCore.Http;
+using Hotline.Share.Dtos;
+using MapsterMapper;
 
 namespace Hotline.Application.StatisticalReport.CallReport;
 
@@ -23,6 +25,7 @@ namespace Hotline.Application.StatisticalReport.CallReport;
 public class YiBinCallReportApplication : CallReportApplicationBase, ICallReportApplication, IScopeDependency
 {
     private readonly IRepository<TrCallRecord> _trCallRecordRepository;
+    private readonly IMapper _mapper;
     private readonly ITrCallRecordRepository _trCallRecordRepositoryEx;
     private readonly ISystemSettingCacheManager _systemSettingCacheManager;
     private readonly IRepository<User> _userRepository;
@@ -37,7 +40,8 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         IRepository<Work> workRepository,
         IRepository<TelRest> telRestRepository,
         ICallNativeRepository callNativeRepository,
-        ITrCallRecordRepository trCallRecordRepositoryEx) : base(systemSettingCacheManager, callNativeRepository, userRepository, workRepository, telRestRepository)
+        ITrCallRecordRepository trCallRecordRepositoryEx,
+        IMapper mapper) : base(systemSettingCacheManager, callNativeRepository, userRepository, workRepository, telRestRepository)
     {
         _trCallRecordRepository = trCallRecordRepository;
         _systemSettingCacheManager = systemSettingCacheManager;
@@ -46,6 +50,7 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         _telRestRepository = telRestRepository;
         _callNativeRepository = callNativeRepository;
         _trCallRecordRepositoryEx = trCallRecordRepositoryEx;
+        _mapper = mapper;
     }
 
     public override async Task<List<BiCallDto>> QueryCallsAsync(BiQueryCallsDto dto, CancellationToken cancellationToken)
@@ -243,4 +248,43 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         var list = await _trCallRecordRepositoryEx.GetCallList(dto, noConnectByeTimes, effectiveTimes, connectByeTimes);
         return list;
     }
+
+    //public override async Task<PagedDto<TrCallDto>> GetCallDetailListAsync(GetCallListDto dto, CancellationToken cancellationToken)
+    //{
+    //    var (total, items) = await _trCallRecordRepository.Queryable()
+    //        .Includes(x => x.Order)
+    //        .WhereIF(!string.IsNullOrEmpty(dto.CPN), x => x.CPN.Contains(dto.CPN))
+    //        .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.CDPN.Contains(dto.CDPN))
+    //        .WhereIF(!string.IsNullOrEmpty(dto.TelNo), x => x.TelNo.Contains(dto.TelNo))
+    //        .WhereIF(!string.IsNullOrEmpty(dto.UserName), x => x.UserName.Contains(dto.UserName))
+    //        .WhereIF(dto.CallDirection != null, x => x.CallDirection == dto.CallDirection)
+    //        .WhereIF(dto.OnState != null, x => x.OnState == dto.OnState)
+    //        .WhereIF(dto.EndBy != null, x => x.EndBy == dto.EndBy)
+    //        .WhereIF(dto.BeginIvrTimeStart.HasValue, x => x.BeginIvrTime >= dto.BeginIvrTimeStart)
+    //        .WhereIF(dto.BeginIvrTimeEnd.HasValue, x => x.BeginIvrTime <= dto.BeginIvrTimeEnd)
+    //        .WhereIF(dto.EndIvrTimeStart.HasValue, x => x.EndIvrTime >= dto.EndIvrTimeStart)
+    //        .WhereIF(dto.EndIvrTimeEnd.HasValue, x => x.EndIvrTime <= dto.EndIvrTimeEnd)
+    //        .WhereIF(dto.BeginQueueTimeStart.HasValue, x => x.BeginQueueTime >= dto.BeginQueueTimeEnd)
+    //        .WhereIF(dto.BeginQueueTimeEnd.HasValue, x => x.BeginQueueTime <= dto.BeginQueueTimeEnd)
+    //        .WhereIF(dto.EndQueueTimeStart.HasValue, x => x.EndQueueTime >= dto.EndQueueTimeStart)
+    //        .WhereIF(dto.EndQueueTimeEnd.HasValue, x => x.EndQueueTime <= dto.EndQueueTimeEnd)
+    //        .WhereIF(dto.AnsweredTimeStart.HasValue, x => x.AnsweredTime >= dto.AnsweredTimeStart)
+    //        .WhereIF(dto.AnsweredTimeEnd.HasValue, x => x.AnsweredTime <= dto.AnsweredTimeEnd)
+    //        .WhereIF(dto.OverTimeStart.HasValue, x => x.OverTime >= dto.OverTimeStart)
+    //        .WhereIF(dto.OverTimeEnd.HasValue, x => x.OverTime <= dto.OverTimeEnd)
+    //        .WhereIF(dto.BeginRingTimeStart.HasValue, x => x.BeginRingTime >= dto.BeginRingTimeStart)
+    //        .WhereIF(dto.BeginRingTimeEnd.HasValue, x => x.BeginRingTime <= dto.BeginRingTimeEnd)
+    //        .WhereIF(dto.EndRingTimeStart.HasValue, x => x.EndRingTimg >= dto.EndRingTimeStart)
+    //        .WhereIF(dto.EndRingTimeEnd.HasValue, x => x.EndRingTimg <= dto.EndRingTimeEnd)
+    //        .WhereIF(dto.CallTimeStart.HasValue, x => x.CreatedTime >= dto.CallTimeStart)
+    //        .WhereIF(dto.CallTimeEnd.HasValue, x => x.CreatedTime <= dto.CallTimeEnd)
+    //        .WhereIF(!string.IsNullOrEmpty(dto.OrderNo), x => x.Order.No.Contains(dto.OrderNo))
+    //        .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title))
+    //        .WhereIF(!string.IsNullOrEmpty(dto.Gateway), x => x.Gateway.Contains(dto.Gateway))
+    //        .WhereIF(dto.IsAiAnswered == true, x => string.IsNullOrEmpty(x.UserId) == true && x.BeginIvrTime.HasValue && x.EndIvrTime.HasValue)
+    //        .WhereIF(dto.PhoneTypes != null, x => x.PhoneTypes == dto.PhoneTypes)
+    //        .OrderByDescending(x => x.CreatedTime)
+    //        .ToPagedListAsync(dto.PageIndex, dto.PageSize);
+    //    return new PagedDto<TrCallDto>(total, _mapper.Map<IReadOnlyList<TrCallDto>>(items));
+    //}
 }

+ 6 - 4
src/Hotline.Application/StatisticalReport/ICallReportApplication.cs

@@ -1,4 +1,5 @@
 using Hotline.CallCenter.Calls;
+using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Dtos.TrCallCenter;
 using Hotline.Share.Requests;
@@ -32,9 +33,10 @@ namespace Hotline.Application.StatisticalReport
         Task<List<BiSeatCallsDto>> QuerySeatCallAsync(ReportRequiredPagedRequest dto, CancellationToken cancellationToken);
 
         Task<List<QueryCallsDetailDto>> QueryCallsHourDetailAsync(BiQueryCallsDto dto, CancellationToken cancellationToken);
-        Task<(int, List<BiSeatSwitchDto>)> QuerySeatSwitchAsync(QuerySeatSwitchRequest dto, CancellationToken requestAborted);
-        Task<List<TrCallHourDto>> GetCallHourListAsync(BiQueryHourCallDto dto, CancellationToken requestAborted);
-        Task<TotalData<BiSeatSwitchDto>> GetCallListAsync(QueryCallListDto dto, CancellationToken requestAborted);
-        Task<List<CallHotLineDto>> GetCallHotLineListAsync(BiQueryGateWayDto dto, CancellationToken requestAborted);
+        Task<(int, List<BiSeatSwitchDto>)> QuerySeatSwitchAsync(QuerySeatSwitchRequest dto, CancellationToken cancellationToken);
+        Task<List<TrCallHourDto>> GetCallHourListAsync(BiQueryHourCallDto dto, CancellationToken cancellationToken);
+        Task<TotalData<BiSeatSwitchDto>> GetCallListAsync(QueryCallListDto dto, CancellationToken cancellationToken);
+        Task<List<CallHotLineDto>> GetCallHotLineListAsync(BiQueryGateWayDto dto, CancellationToken cancellationToken);
+        // Task<PagedDto<TrCallDto>> GetCallDetailListAsync(GetCallListDto dto, CancellationToken cancellationToken);
     }
 }

+ 6 - 0
src/Hotline.Share/Dtos/CallCenter/QueryCallsFixedDto.cs

@@ -50,5 +50,11 @@ namespace Hotline.Share.Dtos.CallCenter
         /// 等待时长
         /// </summary>
         public int? WaitDurationEnd { get; set; }
+
+        /// <summary>
+        /// 是否失联工单
+        /// true: 无订单; false: 有订单
+        /// </summary>
+        public bool? IsMissOrder { get; set; }
     }
 }