tangjiang 9 months ago
parent
commit
585e0d52a0

+ 3 - 2
src/Hotline.Repository.SqlSugar/CallCenter/TrCallRecordRepository.cs

@@ -21,7 +21,7 @@ namespace Hotline.Repository.SqlSugar.CallCenter
         {
         {
         }
         }
 
 
-        public async Task<List<BiCallDto>?> GetQueryCalls(DateTime beginDate, DateTime endDate)
+        public async Task<List<BiCallDto>?> GetQueryCalls(DateTime beginDate, DateTime endDate, string? Line)
         {
         {
             List<int> dts = new List<int>();
             List<int> dts = new List<int>();
             for (int i = 0; i < 24; i++)
             for (int i = 0; i < 24; i++)
@@ -33,6 +33,7 @@ namespace Hotline.Repository.SqlSugar.CallCenter
 
 
             var list = Db.Queryable<TrCallRecord>()
             var list = Db.Queryable<TrCallRecord>()
                  .Where(p => p.CreatedTime >= beginDate && p.CreatedTime <= endDate && p.CallDirection == ECallDirection.In)
                  .Where(p => p.CreatedTime >= beginDate && p.CreatedTime <= endDate && p.CallDirection == ECallDirection.In)
+                 .WhereIF(!string.IsNullOrEmpty(Line), p => p.Gateway == Line)
                .GroupBy(p => p.CreatedTime.Hour)
                .GroupBy(p => p.CreatedTime.Hour)
                .Select(p => new
                .Select(p => new
                {
                {
@@ -41,7 +42,7 @@ namespace Hotline.Repository.SqlSugar.CallCenter
                    Answered = SqlFunc.AggregateSum(SqlFunc.IIF(p.AnsweredTime != null, 1, 0)), //应答数
                    Answered = SqlFunc.AggregateSum(SqlFunc.IIF(p.AnsweredTime != null, 1, 0)), //应答数
                    Hanguped = SqlFunc.AggregateSum(SqlFunc.IIF(p.AnsweredTime == null && p.EndBy != null && p.EndBy.Value == EEndBy.To, 1, 0)),//挂断数
                    Hanguped = SqlFunc.AggregateSum(SqlFunc.IIF(p.AnsweredTime == null && p.EndBy != null && p.EndBy.Value == EEndBy.To, 1, 0)),//挂断数
                })
                })
-              // .GroupBy(p => p.Hour)
+               // .GroupBy(p => p.Hour)
                .MergeTable();
                .MergeTable();
 
 
             var listCall = await listHour.LeftJoin(list, (x, p) => x.ColumnName == p.Hour)
             var listCall = await listHour.LeftJoin(list, (x, p) => x.ColumnName == p.Hour)