소스 검색

修复通话时段统计和通话时段统计详细对不上

qinchaoyue 6 달 전
부모
커밋
bbacf2084c
1개의 변경된 파일10개의 추가작업 그리고 10개의 파일을 삭제
  1. 10 10
      src/Hotline.Repository.SqlSugar/CallCenter/CallNativeRepository.cs

+ 10 - 10
src/Hotline.Repository.SqlSugar/CallCenter/CallNativeRepository.cs

@@ -45,7 +45,7 @@ public class CallNativeRepository : BaseRepository<CallNative>, ICallNativeRepos
             {
                 DateTimeTo = it.ColumnName,
                 Hour = it.ColumnName.Hour, //小时段
-                EffectiveCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.AnsweredTime != null, 1, 0)),//有效接通
+                EffectiveCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.AnsweredTime != null && o.Duration >= effectiveTimes, 1, 0)),//有效接通
                 ConnectByeCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.AnsweredTime != null && o.Duration < connectByeTimes, 1, 0)), //接通秒挂
                 NoConnectByeCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.RingDuration <= noConnectByeTimes && o.RingDuration > 0, 1, 0)), //未接通秒挂
                 QueueByeCount = SqlFunc.AggregateSum(SqlFunc.IIF(o.CallState == ECallState.NotAcceptedHang, 1, 0)), //队列挂断
@@ -204,16 +204,16 @@ public class CallNativeRepository : BaseRepository<CallNative>, ICallNativeRepos
             .WhereIF(!string.IsNullOrEmpty(dto.Source), x => x.ToNo == dto.Source)
             .WhereIF(!string.IsNullOrEmpty(dto.Type) && ("QueueBye".Equals(dto.Type) || "queueByeCount".Equals(dto.Type)), x => x.CallState == ECallState.NotAcceptedHang) //队列挂断
             .WhereIF(!string.IsNullOrEmpty(dto.Type) && ("IvrBye".Equals(dto.Type) || "ivrByeCount".Equals(dto.Type)), x => x.CallState == ECallState.IVRNoAccept)//IVR挂断
-            .WhereIF(!string.IsNullOrEmpty(dto.Type) && ("Effective".Equals(dto.Type) || "effectiveCount".Equals(dto.Type)), x => x.Duration >= effectiveTimes) //有效接通
-            .WhereIF(!string.IsNullOrEmpty(dto.Type) && "Invalid".Equals(dto.Type), x => x.Duration > 0 && x.Duration < effectiveTimes)//无效接通
-            .WhereIF(!string.IsNullOrEmpty(dto.Type) && "connectByeCount".Equals(dto.Type), x => x.Duration > 0 && x.Duration <= connectByeTimes)  //接通秒挂
-            .WhereIF(!string.IsNullOrEmpty(dto.Type) && "noConnectByeCount".Equals(dto.Type), x => x.Duration == 0 && x.RingDuration <= noConnectByeTimes && x.RingDuration > 0)  //未接通秒挂
+            .WhereIF(!string.IsNullOrEmpty(dto.Type) && ("Effective".Equals(dto.Type) || "effectiveCount".Equals(dto.Type)), x => x.AnsweredTime != null && x.Duration >= effectiveTimes) //有效接通
+            .WhereIF(!string.IsNullOrEmpty(dto.Type) && "Invalid".Equals(dto.Type), x => x.AnsweredTime != null && x.Duration < effectiveTimes)//无效接通
+            .WhereIF(!string.IsNullOrEmpty(dto.Type) && "connectByeCount".Equals(dto.Type),x => x.AnsweredTime != null && x.Duration <= connectByeTimes)  //接通秒挂
+            .WhereIF(!string.IsNullOrEmpty(dto.Type) && "noConnectByeCount".Equals(dto.Type), x => x.RingDuration <= noConnectByeTimes && x.RingDuration > 0)  //未接通秒挂
             .WhereIF(!string.IsNullOrEmpty(dto.Type) && "count".Equals(dto.Type), x =>
-            (x.Duration == 0 && x.RingDuration <= noConnectByeTimes && x.RingDuration > 0)  //未接通秒挂
-            || (x.Duration > 0 && x.Duration <= connectByeTimes)  //接通秒挂
-            || (x.Duration >= effectiveTimes)//有效接通
-            || (x.BeginIvrTime.HasValue && !x.BeginQueueTime.HasValue && !x.BeginRingTime.HasValue && x.AnsweredTime == null) //IVR挂断
-            || (x.WaitDuration > 0 && x.RingDuration == 0))//队列挂断
+            (x.RingDuration <= noConnectByeTimes && x.RingDuration > 0)  //未接通秒挂
+            || (x.AnsweredTime != null && x.Duration <= connectByeTimes)  //接通秒挂
+            || (x.AnsweredTime != null && x.Duration >= effectiveTimes)//有效接通
+            || (x.CallState == ECallState.IVRNoAccept) //IVR挂断
+            || (x.CallState == ECallState.NotAcceptedHang))//队列挂断
             .WhereIF(dto.StartHourTo.HasValue, x => SqlFunc.ToTime(x.BeginIvrTime.Value.ToString("HH:mm:ss")) >= dto.StartHourTo.Value && SqlFunc.ToTime(x.BeginIvrTime.Value.ToString("HH:mm:ss")) < endHourTo)
             .Select(x => new BiSeatSwitchDto
             {