Explorar o código

添加“高效服务话务明细”页面

libin hai 4 días
pai
achega
ae509e5a0e

+ 32 - 0
src/Hotline.Api/Controllers/Bi/BiCallController.cs

@@ -738,6 +738,38 @@ public class BiCallController : BaseController
                 await _callReportApplication.QueryEnterpriseCallDateStatisticsDetail(dto.QueryDto)
             , "企业服务话务明细", "Date");
 
+    /// <summary>
+    /// 高效服务话务明细
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpGet("query-gaoxiao-calldate-statistics")]
+    public async Task<object> QueryGaoXiaoCallDateStatisticsDetail([FromQuery] QueryCallDateStatisticsDetailDto dto)
+    {
+        var list = await _callReportApplication.QueryGaoXiaoCallDateStatisticsDetail(dto);
+        var total = new QueryGaoXiaoCallDateStatisticsDetailResp()
+        {
+            Date = "合计",
+            GaoXiaoCallInCount = list.Sum(x => x.GaoXiaoCallInCount),
+            GaoXiaoCallInPutthroughCount = list.Sum(x => x.GaoXiaoCallInPutthroughCount),
+            GaoXiaoQueueOffCount = list.Sum(x => x.GaoXiaoQueueOffCount),//企业服务队列挂断
+            GaoXiaoWaitOffCount = list.Sum(x => x.GaoXiaoWaitOffCount) //企业服务等待挂断
+        };
+        return new { List = list, Total = total };
+    }
+
+    /// <summary>
+    /// 高效服务话务明细导出
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpPost("query-gaoxiao-calldate-statistics/export")]
+    [LogFilterAlpha("导出日志")]
+    public async Task<FileStreamResult> QueryGaoXiaoCallDateStatisticsDetailExport([FromBody] ExportExcelDto<QueryCallDateStatisticsDetailDto> dto)
+    => _exportApplication.GetExcelFile(
+                dto,
+                await _callReportApplication.QueryGaoXiaoCallDateStatisticsDetail(dto.QueryDto)
+            , "高效服务话务明细", "Date");
 
     /// <summary>
     /// 呼出话务统计明细

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

@@ -1,7 +1,7 @@
 {
   "AllowedHosts": "*",
   "AppConfiguration": {
-    "AppScope": "LuZhou",
+    "AppScope": "YiBin",
     "YiBin": {
       "AreaCode": "511500",
       "CallCenterType": "TianRun", //XunShi、WeiErXin、TianRun、XingTang

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

@@ -257,6 +257,11 @@ public abstract class CallReportApplicationBase : ICallReportApplication
         throw new NotImplementedException();
     }
 
+    public virtual Task<List<QueryGaoXiaoCallDateStatisticsDetailResp>> QueryGaoXiaoCallDateStatisticsDetail(QueryCallDateStatisticsDetailDto dto)
+    {
+        throw new NotImplementedException();
+    }
+
     /// <summary>
     /// 呼出话务统计明细
     /// </summary>

+ 10 - 0
src/Hotline.Application/StatisticalReport/CallReport/YiBinCallReportApplication.cs

@@ -290,6 +290,16 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         return await _trCallRecordRepositoryEx.QueryEnterpriseCallDateStatisticsDetail(dto.StartTime.Value, dto.EndTime.Value);
     }
 
+    /// <summary>
+    /// 高效服务话务明细
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    public override async Task<List<QueryGaoXiaoCallDateStatisticsDetailResp>> QueryGaoXiaoCallDateStatisticsDetail(QueryCallDateStatisticsDetailDto dto)
+    {
+        return await _trCallRecordRepositoryEx.QueryGaoXiaoCallDateStatisticsDetail(dto.StartTime.Value, dto.EndTime.Value);
+    }
+
     /// <summary>
     /// 呼出话务统计明细
     /// </summary>

+ 7 - 0
src/Hotline.Application/StatisticalReport/ICallReportApplication.cs

@@ -71,6 +71,13 @@ namespace Hotline.Application.StatisticalReport
         /// <returns></returns>
         Task<List<QueryEnterpriseCallDateStatisticsDetailResp>> QueryEnterpriseCallDateStatisticsDetail(QueryCallDateStatisticsDetailDto dto);
 
+        /// <summary>
+        /// 高效服务话务明细
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        Task<List<QueryGaoXiaoCallDateStatisticsDetailResp>> QueryGaoXiaoCallDateStatisticsDetail(QueryCallDateStatisticsDetailDto dto);
+
         /// <summary>
         /// 呼出话务统计明细
         /// </summary>

+ 18 - 0
src/Hotline.Repository.SqlSugar/CallCenter/TrCallRecordRepository.cs

@@ -352,6 +352,24 @@ namespace Hotline.Repository.SqlSugar.CallCenter
             return await query.ToListAsync();
         }
 
+        public async Task<List<QueryGaoXiaoCallDateStatisticsDetailResp>> QueryGaoXiaoCallDateStatisticsDetail(DateTime startTime, DateTime endTime)
+        {
+            var query = Db.Queryable<TrCallRecord>()
+                .Where(x => x.CreatedTime >= startTime && x.CreatedTime <= endTime && SqlFunc.Length(x.Gateway) > 4 && x.CallDirection == ECallDirection.In)
+                .GroupBy(x => x.CreatedTime.ToString("yyyy-MM-dd"))
+                .Select(x => new QueryGaoXiaoCallDateStatisticsDetailResp()
+                {
+                    Date = x.CreatedTime.ToString("yyyy-MM-dd"),
+                    GaoXiaoCallInCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "3", 1, 0)),
+                    GaoXiaoCallInPutthroughCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "3" && x.OnState == EOnState.On, 1, 0)),
+                    //EnterpriseRingOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "3" && x.QueueTims > 0 && x.RingTimes == 0 && x.OnState == EOnState.NoOn, 1, 0)), //企业挂断
+                    GaoXiaoQueueOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "3" && x.QueueTims > 0 && x.RingTimes == 0 && x.OnState == EOnState.NoOn, 1, 0)),//企业服务队列挂断
+                    GaoXiaoWaitOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "3" && x.RingTimes > 0 && x.OnState == EOnState.NoOn, 1, 0)) //企业服务等待挂断
+                })
+                .OrderBy(x => x.Date);
+            return await query.ToListAsync();
+        }
+
         public async Task<List<QueryCallOutDateStatisticsDetailResp>> QueryCallOutDateStatisticsDetail(DateTime startTime, DateTime endTime, List<string> enterpriseTels)
         {
             var callTable = Db.Queryable<TrCallRecord>()

+ 61 - 18
src/Hotline.Share/Dtos/CallCenter/BiQueryCallsDto.cs

@@ -27,15 +27,15 @@ public record QueryCallListDto : PagedRequest
     public string Source { get; set; }
     public TimeSpan? StartHourTo { get; set; }
 
-	/// <summary>
-	/// 排序字段 
-	/// </summary>
-	public string? SortField { get; set; }
-
-	/// <summary>
-	/// 排序规则  0 升序  1 降序
-	/// </summary>
-	public int? SortRule { get; set; }
+    /// <summary>
+    /// 排序字段 
+    /// </summary>
+    public string? SortField { get; set; }
+
+    /// <summary>
+    /// 排序规则  0 升序  1 降序
+    /// </summary>
+    public int? SortRule { get; set; }
 }
 
 public class BiQueryHourCallDto : StartEndTimeDto
@@ -58,7 +58,7 @@ public class StartEndTimeDto
     public DateTime EndTime { get; set; }
 }
 
-public record PagedStartEndTimeDto : PagedRequest 
+public record PagedStartEndTimeDto : PagedRequest
 {
     [Required]
     public DateTime StartTime { get; set; }
@@ -254,7 +254,7 @@ public class QueryCallDateStatisticsDetailResp
     /// <summary>
     /// 接通总量(计算所得)
     /// </summary>
-    public int PutthroughCount => PersonCallInPutthroughCount+ EnterpriseCallInPutthroughCount + GaoXiaoCallInPutthroughCount + AiCallInPutthroughCount;
+    public int PutthroughCount => PersonCallInPutthroughCount + EnterpriseCallInPutthroughCount + GaoXiaoCallInPutthroughCount + AiCallInPutthroughCount;
 
     /// <summary>
     /// 个人服务接通量
@@ -304,7 +304,7 @@ public class QueryCallDateStatisticsDetailResp
     /// <summary>
     /// 总体接通率
     /// </summary>
-    public double TotalPutthroughRate => PutthroughCount == 0 ? 0 : Math.Round(((double)PutthroughCount / CallInTotal)*100,2);
+    public double TotalPutthroughRate => PutthroughCount == 0 ? 0 : Math.Round(((double)PutthroughCount / CallInTotal) * 100, 2);
 
     /// <summary>
     /// 总体接通率(文本)
@@ -314,7 +314,7 @@ public class QueryCallDateStatisticsDetailResp
     /// <summary>
     /// 服务接通率
     /// </summary>
-    public double ServicePutthorughRate => (PersonCallInCount + EnterpriseCallInCount  + GaoXiaoCallInCount + AiCallInCount) == 0 ? 0 : Math.Round(((double)PutthroughCount / (PersonCallInCount + EnterpriseCallInCount + GaoXiaoCallInCount + AiCallInCount)) * 100, 2);
+    public double ServicePutthorughRate => (PersonCallInCount + EnterpriseCallInCount + GaoXiaoCallInCount + AiCallInCount) == 0 ? 0 : Math.Round(((double)PutthroughCount / (PersonCallInCount + EnterpriseCallInCount + GaoXiaoCallInCount + AiCallInCount)) * 100, 2);
 
     /// <summary>
     /// 服务接通率(文本)
@@ -324,7 +324,7 @@ public class QueryCallDateStatisticsDetailResp
     /// <summary>
     /// 话务接通率
     /// </summary>
-    public double CallPutthorughRate => (PersonCallInPutthroughCount + EnterpriseCallInPutthroughCount + GaoXiaoCallInPutthroughCount) == 0 ? 0 : Math.Round(((double)(PersonCallInPutthroughCount + EnterpriseCallInPutthroughCount+ GaoXiaoCallInPutthroughCount)) / (PersonCallInCount + EnterpriseCallInCount + GaoXiaoCallInCount) * 100, 2);
+    public double CallPutthorughRate => (PersonCallInPutthroughCount + EnterpriseCallInPutthroughCount + GaoXiaoCallInPutthroughCount) == 0 ? 0 : Math.Round(((double)(PersonCallInPutthroughCount + EnterpriseCallInPutthroughCount + GaoXiaoCallInPutthroughCount)) / (PersonCallInCount + EnterpriseCallInCount + GaoXiaoCallInCount) * 100, 2);
 
     /// <summary>
     /// 话务接通率(文本)
@@ -359,7 +359,7 @@ public class QueryPersonCallDateStatisticsDetailResp
     /// 个人服务队列挂断
     /// </summary>
     public int PersonQueueOffCount { get; set; }
-   
+
     /// <summary>
     /// 个人服务等待挂断
     /// </summary>
@@ -383,7 +383,7 @@ public class QueryEnterpriseCallDateStatisticsDetailResp
     /// 日期
     /// </summary>
     public string Date { get; set; }
-   
+
     /// <summary>
     /// 企业服务呼入总量
     /// </summary>
@@ -420,6 +420,49 @@ public class QueryEnterpriseCallDateStatisticsDetailResp
     public string EnterpriseCallPutthorughRateText => EnterpriseCallPutthorughRate + "%";
 }
 
+public class QueryGaoXiaoCallDateStatisticsDetailResp
+{
+    /// <summary>
+    /// 日期
+    /// </summary>
+    public string Date { get; set; }
+
+    /// <summary>
+    /// 高效服务呼入总量
+    /// </summary>
+    public int GaoXiaoCallInCount { get; set; }
+
+    /// <summary>
+    /// 高效服务接通量
+    /// </summary>
+    public int GaoXiaoCallInPutthroughCount { get; set; }
+
+    /// <summary>
+    /// 高效服务挂断总量
+    /// </summary>
+    public int GaoXiaoRingOffCount => GaoXiaoQueueOffCount + GaoXiaoWaitOffCount;
+
+    /// <summary>
+    /// 高效服务队列挂断
+    /// </summary>
+    public int GaoXiaoQueueOffCount { get; set; }
+
+    /// <summary>
+    /// 高效服务等待挂断
+    /// </summary>
+    public int GaoXiaoWaitOffCount { get; set; }
+
+    /// <summary>
+    /// 高效服务接通率
+    /// </summary>
+    public double GaoXiaoCallPutthorughRate => GaoXiaoCallInPutthroughCount == 0 ? 0 : Math.Round(((double)(GaoXiaoCallInPutthroughCount)) / (GaoXiaoCallInCount) * 100, 2);
+
+    /// <summary>
+    ///  高效服务接通率
+    /// </summary>
+    public string GaoXiaoCallPutthorughRateText => GaoXiaoCallPutthorughRate + "%";
+}
+
 public class QueryCallOutDateStatisticsDetailResp
 {
     /// <summary>
@@ -603,7 +646,7 @@ public class QuerySeatMonthCallRequest
 }
 
 
-public record QuerySeatMonthCallDetailRequest:PagedRequest
+public record QuerySeatMonthCallDetailRequest : PagedRequest
 {
     /// <summary>
     /// 坐席ID
@@ -643,7 +686,7 @@ public record QuerySeatMonthCallDetailRequest:PagedRequest
     /// <summary>
     /// 振铃时间结束
     /// </summary>
-    public DateTime? RingEndTime { get;set; }
+    public DateTime? RingEndTime { get; set; }
 
     /// <summary>
     /// 振铃结束时间开始

+ 8 - 0
src/Hotline/CallCenter/Calls/ITrCallRecordRepository.cs

@@ -60,6 +60,14 @@ namespace Hotline.CallCenter.Calls
         /// <returns></returns>
         Task<List<QueryEnterpriseCallDateStatisticsDetailResp>> QueryEnterpriseCallDateStatisticsDetail(DateTime startTime, DateTime endTime);
 
+        /// <summary>
+        /// 高效服务话务明细
+        /// </summary>
+        /// <param name="startTime"></param>
+        /// <param name="endTime"></param>
+        /// <returns></returns>
+        Task<List<QueryGaoXiaoCallDateStatisticsDetailResp>> QueryGaoXiaoCallDateStatisticsDetail(DateTime startTime, DateTime endTime);
+
 
         /// <summary>
         /// 呼出话务统计明细