瀏覽代碼

坐席月接通

Dun.Jason 4 月之前
父節點
當前提交
66f7063ea6

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

@@ -22,6 +22,7 @@ using XF.Domain.Repository;
 using Hotline.Settings;
 using XF.Utility.EnumExtensions;
 using Hotline.Share.Enums.CallCenter;
+using Hotline.Repository.SqlSugar.Extensions;
 
 namespace Hotline.Api.Controllers.Bi;
 
@@ -697,6 +698,19 @@ public class BiCallController : BaseController
         return new { List = list, Total = total };
     }
 
+    /// <summary>
+    /// 坐席月接通率统计基础数据
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet("query-seat-monthcall-basedata")]
+    public async Task<object> QuerySeatMonthCallBaseData()
+    {
+        return new
+        {
+            SeatUser = _userRepository.Queryable().Where(x => x.UserType == Share.Enums.User.EUserType.Seat)            
+        };
+    }
+
     /// <summary>
     /// 坐席月接通率统计导出
     /// </summary>
@@ -710,5 +724,30 @@ public class BiCallController : BaseController
             , "坐席月接通率统计", "Date");
 
 
+    /// <summary>
+    /// 坐席月接通明细
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpGet("query-seat-monthcall-detail")]
+    public async Task<PagedDto<QuerySeatMonthCallDetailResp>> QuerySeatMonthCallDetail([FromQuery] QuerySeatMonthCallDetailRequest dto)
+    {
+        var query = _callReportApplication.QuerySeatMonthCallDetail(dto);
+        var(total, items) =  await query.ToPagedListAsync(dto.PageIndex, dto.PageSize);
+        return new PagedDto<QuerySeatMonthCallDetailResp>(total, items);
+    }
+
+    /// <summary>
+    /// 坐席月接通明细导出
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpPost("query-seat-monthcall-detail/export")]
+    public async Task<FileStreamResult> QuerySeatMonthCallDetailExport([FromBody]ExportExcelDto<QuerySeatMonthCallDetailRequest> dto)
+    {
+
+        return null;
+    }
+
     #endregion
 }

+ 2 - 2
src/Hotline.Application/Orders/OrderApplication.cs

@@ -2703,7 +2703,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                         SqlFunc.IIF(it.Status >= EOrderStatus.Filed && it.FileOrgIsCenter == true && it.AcceptType != "无效", 1, 0)), //中心归档件
                 //CentreCareOf = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed && (it.FileUserRole == EFileUserType.Org || it.FileUserRole == EFileUserType.Dispatch), 1, 0)), //转办信件
                 CentreCareOf = SqlFunc.AggregateSum(SqlFunc.IIF(
-                    it.AcceptType != "无效" && (it.FileOrgIsCenter == false ||
+                    it.AcceptType != "无效" && (it.ProcessType == EProcessType.Jiaoban ||
                                               (it.ActualHandleStepName == "派单组" && it.Status < EOrderStatus.Filed) ||
                                               (it.ActualHandleStepName == "班长审批" && it.Status < EOrderStatus.Filed)), 1, 0)),
                 NoCentreCareOf =
@@ -2715,7 +2715,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 Repeat = SqlFunc.AggregateSum(SqlFunc.IIF(it.DuplicateIds != null && SqlFunc.JsonArrayLength(it.DuplicateIds) > 0, 1, 0)),
                 Subtotal = SqlFunc.AggregateSum(SqlFunc.IIF(
                     (it.Status >= EOrderStatus.Filed && it.FileOrgIsCenter == true && it.AcceptType != "无效") ||
-                    (it.AcceptType != "无效" && (it.FileOrgIsCenter == false ||
+                    (it.AcceptType != "无效" && (it.ProcessType == EProcessType.Jiaoban ||
                                                (it.ActualHandleStepName == "派单组" && it.Status < EOrderStatus.Filed) ||
                                                (it.ActualHandleStepName == "班长审批" && it.Status < EOrderStatus.Filed))) ||
                     (it.Status <= EOrderStatus.HandOverToUnAccept) || it.AcceptType == "无效" ||

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

@@ -344,4 +344,9 @@ public abstract class CallReportApplicationBase : ICallReportApplication
     {
         throw new NotImplementedException();
     }
+
+    public virtual ISugarQueryable<QuerySeatMonthCallDetailResp> QuerySeatMonthCallDetail(QuerySeatMonthCallDetailRequest dto)
+    {
+        throw new NotImplementedException();
+    }
 }

+ 35 - 2
src/Hotline.Application/StatisticalReport/CallReport/YiBinCallReportApplication.cs

@@ -302,13 +302,14 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         var list = await _userRepository.Queryable()
               .LeftJoin<TrCallRecord>((u, c) => u.Id == c.UserId)
               .Where(u => !u.IsDeleted && u.UserType == EUserType.Seat)
-              .Where((u, c) => c.CreatedTime >= dto.StartTime)
-              .Where((u, c) => c.CreatedTime <= dto.EndTime)
+              .Where((u, c) => c.BeginRingTime >= dto.StartTime)
+              .Where((u, c) => c.BeginRingTime <= dto.EndTime)
               .Where((u, c) => c.CallDirection == ECallDirection.In)
               .GroupBy((u, c) => new { c.UserName, c.UserId })
               .Select((u, c) => new QuerySeatMonthCallResp
               {
                   Name = c.UserName,
+                  UserId = c.UserId,
                   InAnswered = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime != null, 1, 0)), //呼入接通量
                   InAvailableAnswer = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime != null && c.Duration >= effectiveTimes, 1, 0)), //有效接通量
                   InHangupImmediateWhenAnswered = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime != null && c.Duration < connectByeTimes, 1, 0)),//接通秒挂
@@ -321,6 +322,38 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         return list;
     }
 
+    /// <summary>
+    /// 坐席月接通明细
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    public override ISugarQueryable<QuerySeatMonthCallDetailResp> QuerySeatMonthCallDetail(QuerySeatMonthCallDetailRequest dto)
+    {
+        return  _trCallRecordRepository.Queryable()
+            .WhereIF(dto.RingStartTime.HasValue, x => x.BeginRingTime >= dto.RingStartTime)
+            .WhereIF(dto.RingEndTime.HasValue, x => x.BeginRingTime <= dto.RingEndTime)
+            .WhereIF(!string.IsNullOrEmpty(dto.EmpId), x => x.UserId == dto.EmpId)
+            .WhereIF(dto.AnsweredStartTime.HasValue, x => x.AnsweredTime >= dto.AnsweredStartTime)
+            .WhereIF(dto.AnsweredEndTime.HasValue, x => x.AnsweredTime <= dto.AnsweredEndTime)
+            .WhereIF(!string.IsNullOrEmpty(dto.TelNo), x => x.TelNo.Contains(dto.TelNo!))
+            .WhereIF(!string.IsNullOrEmpty(dto.Cpn),x=>x.CPN.Contains(dto.Cpn!))
+            .WhereIF(!string.IsNullOrEmpty(dto.Cdpn), x => x.CDPN.Contains(dto.Cdpn!))
+            .Where(x => x.CallDirection == ECallDirection.In)
+            .OrderBy(x => x.BeginRingTime)
+            .MergeTable()
+            .Select(x => new QuerySeatMonthCallDetailResp
+            { 
+                Cpn = x.CPN,
+                Cdpn = x.CDPN,
+                TelNo = x.TelNo,
+                AnsweredTime = x.AnsweredTime,
+                RingTimeBegin  = x.BeginRingTime,
+                SeatName = x.UserName
+            });
+    }
+
+
+
     //public override async Task<PagedDto<TrCallDto>> GetCallDetailListAsync(GetCallListDto dto, CancellationToken cancellationToken)
     //{
     //    var (total, items) = await _trCallRecordRepository.Queryable()

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

@@ -84,5 +84,12 @@ namespace Hotline.Application.StatisticalReport
         /// <param name="dto"></param>
         /// <returns></returns>
         Task<List<QuerySeatMonthCallResp>> QuerySeatMonthCall(QuerySeatMonthCallRequest dto);
+
+        /// <summary>
+        /// 坐席月接通明细
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        ISugarQueryable<QuerySeatMonthCallDetailResp> QuerySeatMonthCallDetail(QuerySeatMonthCallDetailRequest dto);
     }
 }

+ 90 - 1
src/Hotline.Share/Dtos/CallCenter/BiQueryCallsDto.cs

@@ -497,6 +497,11 @@ public class QuerySeatMonthCallResp
     /// </summary>
     public string Name { get; set; }
 
+    /// <summary>
+    /// 用户ID
+    /// </summary>
+    public string UserId { get; set; }
+
     /// <summary>
     /// 呼入总量
     /// </summary>
@@ -556,13 +561,97 @@ public class QuerySeatMonthCallResp
 
 public class QuerySeatMonthCallRequest
 {
+    /// <summary>
+    /// 振铃开始时间开始
+    /// </summary>
     public DateTime? StartTime { get; set; }
 
+    /// <summary>
+    /// 振铃开始时间结束
+    /// </summary>
     public DateTime? EndTime { get; set; }
 
     /// <summary>
     /// 员工ID
     /// </summary>
-    public string EmpId { get; set; }
+    public string? EmpId { get; set; }
+}
+
+
+public record QuerySeatMonthCallDetailRequest:PagedRequest
+{
+    /// <summary>
+    /// 坐席ID
+    /// </summary>
+    public string? EmpId { get; set; }
+
+    /// <summary>
+    /// 主叫
+    /// </summary>
+    public string? Cpn { get; set; }
+
+    /// <summary>
+    /// 被叫
+    /// </summary>
+    public string? Cdpn { get; set; }
+
+    /// <summary>
+    /// 分机号
+    /// </summary>
+    public string? TelNo { get; set; }
+
+    /// <summary>
+    /// 接通时间开始
+    /// </summary>
+    public DateTime? AnsweredStartTime { get; set; }
+
+    /// <summary>
+    /// 接通时间结束
+    /// </summary>
+    public DateTime? AnsweredEndTime { get; set; }
+
+    /// <summary>
+    /// 振铃时间开始
+    /// </summary>
+    public DateTime? RingStartTime { get; set; }
+
+    /// <summary>
+    /// 振铃时间结束
+    /// </summary>
+    public DateTime? RingEndTime { get;set; }
+
+}
+
+public class QuerySeatMonthCallDetailResp
+{
+    /// <summary>
+    /// 主叫
+    /// </summary>
+    public string Cpn { get; set; }
+
+    /// <summary>
+    /// 被叫
+    /// </summary>
+    public string Cdpn { get; set; }
+
+    /// <summary>
+    /// 振铃开始时间
+    /// </summary>
+    public DateTime? RingTimeBegin { get; set; }
+
+    /// <summary>
+    /// 接通时间
+    /// </summary>
+    public DateTime? AnsweredTime { get; set; }
+
+    /// <summary>
+    /// 响应分机
+    /// </summary>
+    public string? TelNo { get; set; }
+
+    /// <summary>
+    /// 坐席名称
+    /// </summary>
+    public string? SeatName { get; set; }
 }
 #endregion