|
@@ -19,6 +19,7 @@ using Hotline.Share.Tools;
|
|
|
using JiebaNet.Segmenter.Common;
|
|
|
using XingTang.Sdk;
|
|
|
using Mapster;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
namespace Hotline.Application.StatisticalReport.CallReport;
|
|
|
|
|
@@ -149,6 +150,61 @@ public abstract class CallReportApplicationBase : ICallReportApplication
|
|
|
RecordingAbsolutePath = p.AudioFile
|
|
|
}, true);
|
|
|
|
|
|
+ if (isAll)
|
|
|
+ {
|
|
|
+ return (0, await query.ToListAsync());
|
|
|
+ }
|
|
|
+
|
|
|
+ return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 话务日期明细-呼入总量/接通总量
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public virtual async Task<(int, List<CallRecordOutDto>)> QuerySeatCallsListAsync(BiQueryCallsListDto dto, bool isAll)
|
|
|
+ {
|
|
|
+ //超时接通量
|
|
|
+ int CallInOverConnRingTime = _systemSettingCacheManager.CallInOverConnRingTime;
|
|
|
+ //坐席超时挂断时间
|
|
|
+ int SeatChaoTime = _systemSettingCacheManager.SeatChaoTime;
|
|
|
+ //未接秒挂时间
|
|
|
+ int noConnectByeTimes = _systemSettingCacheManager.NoConnectByeTimes;
|
|
|
+ //呼入有效时间
|
|
|
+ int effectiveTimes = _systemSettingCacheManager.EffectiveTimes;
|
|
|
+ //接通秒挂时间
|
|
|
+ int connectByeTimes = _systemSettingCacheManager.ConnectByeTimes;
|
|
|
+
|
|
|
+ var recordPrefix = _systemSettingCacheManager.RecordPrefix;
|
|
|
+ var query = _callNativeRepository.Queryable(includeDeleted: true)
|
|
|
+ .LeftJoin<Order>((p, o) => p.Id == o.CallId)
|
|
|
+ .Where((p, o) => p.BeginIvrTime >= dto.StartTime && p.BeginIvrTime <= dto.EndTime && p.CallState != ECallState.Invalid)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.UserId), (p, o) => p.UserId == dto.UserId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.UserName), (p, o) => p.UserName == dto.UserName)
|
|
|
+ .WhereIF(dto.FieldName == "inTotal", (p, o) => p.Direction == ECallDirection.In) //呼入总量
|
|
|
+ .WhereIF(dto.FieldName == "inAnswered", (p, o) => p.Direction == ECallDirection.In && p.AnsweredTime != null) //接通总量
|
|
|
+ .WhereIF(dto.FieldName == "inHangupImmediate", (p, o) => p.Direction == ECallDirection.In && p.AnsweredTime == null && p.RingDuration < noConnectByeTimes) //呼入秒挂
|
|
|
+ .WhereIF(dto.FieldName == "inHanguped", (p, o) => p.Direction == ECallDirection.In && p.AnsweredTime == null && p.RingDuration >= noConnectByeTimes) //呼入超时未接
|
|
|
+ .WhereIF(dto.FieldName == "inAvailableAnswer", (p, o) => p.Direction == ECallDirection.In && p.AnsweredTime != null && p.Duration >= effectiveTimes) //有效接通量
|
|
|
+ .WhereIF(dto.FieldName == "inHangupImmediateWhenAnswered", (p, o) => p.Direction == ECallDirection.In && p.AnsweredTime != null && p.Duration < connectByeTimes) //接通秒挂
|
|
|
+ .WhereIF(dto.FieldName == "outTotal", (p, o) => p.Direction == ECallDirection.Out) //呼出总量
|
|
|
+ .WhereIF(dto.FieldName == "outAnswered", (p, o) => p.Direction == ECallDirection.Out && p.AnsweredTime != null) //呼出接通量
|
|
|
+ .OrderByDescending((p, o) => p.BeginIvrTime)
|
|
|
+ .Select((p, o) => new CallRecordOutDto
|
|
|
+ {
|
|
|
+ OtherAccept = p.Id,
|
|
|
+ OrderId = o.Id,
|
|
|
+ OrderNo = o.No,
|
|
|
+ OrderTitle = o.Title,
|
|
|
+ Cdpn = p.ToNo,
|
|
|
+ Cpn = p.FromNo,
|
|
|
+ RecordingFileUrl = recordPrefix + p.AudioFile,
|
|
|
+ RecordingFileName = p.AudioFile,
|
|
|
+ RecordingBaseAddress = recordPrefix,
|
|
|
+ RecordingAbsolutePath = p.AudioFile
|
|
|
+ }, true);
|
|
|
+
|
|
|
if (isAll)
|
|
|
{
|
|
|
return (0, await query.ToListAsync());
|