Forráskód Böngészése

Merge branch 'test' into test_tj

tangjiang 4 hónapja
szülő
commit
0547d74f67

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

@@ -671,5 +671,44 @@ public class BiCallController : BaseController
                 await _callReportApplication.QueryCallOutDateStatisticsDetail(dto.QueryDto,enterpriseTels)
             , "呼出话务统计明细", "Date");
     }
+
+    /// <summary>
+    /// 坐席月接通率统计
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpGet("query-seat-monthcall")]
+    public async Task<object> QuerySeatMonthCall([FromQuery]QuerySeatMonthCallRequest dto)
+    {
+        var list =  await _callReportApplication.QuerySeatMonthCall(dto);
+        var total = new QuerySeatMonthCallResp()
+        {
+            Name = "合计",
+            InAnswered = list.Sum(x => x.InAnswered),
+            InAvailableAnswer = list.Sum(x => x.InAvailableAnswer),
+            InHangupImmediateWhenAnswered = list.Sum(x => x.InHangupImmediateWhenAnswered),
+            OverTimeImmediate = list.Sum(x => x.OverTimeImmediate),
+            InTimeImmediate = list.Sum(x => x.InTimeImmediate),
+            InHanguped = list.Sum(x => x.InHanguped),
+            InHangupImmediate = list.Sum(x => x.InHangupImmediate),
+            OverTimeInHanguped = list.Sum(x => x.OverTimeInHanguped),
+        };
+
+        return new { List = list, Total = total };
+    }
+
+    /// <summary>
+    /// 坐席月接通率统计导出
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpPost("query-seat-monthcall/export")]
+    public async Task<FileStreamResult> QuerySeatMonthCallExport([FromBody] ExportExcelDto<QuerySeatMonthCallRequest> dto)
+    =>  _exportApplication.GetExcelFile(
+            dto,              
+            await _callReportApplication.QuerySeatMonthCall(dto.QueryDto)
+            , "坐席月接通率统计", "Date");
+
+
     #endregion
 }

+ 1 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -1484,7 +1484,7 @@ public class OrderController : BaseController
     public async Task VisitMigrationBatch([FromBody] DistributionVisitDto dto)
     {
         var visits = await _orderVisitRepository.Queryable()
-            .Where(d => d.VisitState == EVisitState.WaitForVisit && dto.Ids.Contains(d.Id))
+            .Where(d => (d.VisitState == EVisitState.WaitForVisit || d.VisitState == EVisitState.SMSUnsatisfied) && dto.Ids.Contains(d.Id))
             .ToListAsync(HttpContext.RequestAborted);
 
         foreach (var visit in visits)

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

@@ -2693,10 +2693,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 //Subtotal = SqlFunc.AggregateCount(x.AcceptorId),
                 CentreArchive =
                     SqlFunc.AggregateSum(
-                        SqlFunc.IIF(it.Status >= EOrderStatus.Filed && it.ProcessType == EProcessType.Zhiban && it.AcceptType != "无效", 1, 0)), //中心归档件
+                        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.ProcessType == EProcessType.Jiaoban ||
+                    it.AcceptType != "无效" && (it.FileOrgIsCenter ==false ||
                                               (it.ActualHandleStepName == "派单组" && it.Status < EOrderStatus.Filed) ||
                                               (it.ActualHandleStepName == "班长审批" && it.Status < EOrderStatus.Filed)), 1, 0)),
                 NoCentreCareOf =
@@ -2707,8 +2707,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 Invalid = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptType == "无效", 1, 0)),
                 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.ProcessType == EProcessType.Zhiban && it.AcceptType != "无效") ||
-                    (it.AcceptType != "无效" && (it.ProcessType == EProcessType.Jiaoban ||
+                    (it.Status >= EOrderStatus.Filed && it.FileOrgIsCenter==true && it.AcceptType != "无效") ||
+                    (it.AcceptType != "无效" && (it.FileOrgIsCenter ==false ||
                                                (it.ActualHandleStepName == "派单组" && it.Status < EOrderStatus.Filed) ||
                                                (it.ActualHandleStepName == "班长审批" && it.Status < EOrderStatus.Filed))) ||
                     (it.Status <= EOrderStatus.HandOverToUnAccept) || it.AcceptType == "无效" ||
@@ -3588,8 +3588,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
             .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)
             .Where((x, w, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send && x.Status == EWorkflowStepStatus.Handled)
-            .Where((x, w, su) => x.CreationTime >= dto.StartTime.Value)
-            .Where((x, w, su) => x.CreationTime <= dto.EndTime.Value)
+            .Where((x, w, su) => x.HandleTime >= dto.StartTime.Value)
+            .Where((x, w, su) => x.HandleTime <= dto.EndTime.Value)
             .WhereIF(!string.IsNullOrEmpty(dto.UserName), (x, w, su) => su.UserName == dto.UserName)
             .GroupBy((x, w, su) => new { su.UserId, su.UserName })
             .Select((x, w, su) => new BiOrderSendVo

+ 1 - 1
src/Hotline.Application/Orders/OrderScreenHandler/OrderScreenNextWorkflowHandler.cs

@@ -75,7 +75,7 @@ public class OrderScreenNextWorkflowHandler : INotificationHandler<NextStepNotif
 								//省件甄别--以省审批前一个节点整理的甄别意见为准推送省上 宜宾
 								if (_appOptions.Value.IsYiBin)
 								{
-									
+									screenDto.Content = notification.Dto.Opinion;
 									screenDto.Files = new List<Share.Dtos.File.FileDto>();
 								}
 								if (_appOptions.Value.IsLuZhou)

+ 1 - 0
src/Hotline.Application/Orders/OrderSecondaryHandlingApplication.cs

@@ -248,6 +248,7 @@ namespace Hotline.Application.Orders
 				.Includes(x => x.SecondaryHandling)
 				.Where(x => x.OrderVisit.Order.IsProvince == false)
 				.LeftJoin<OrderScreen>((x, s) => x.Id == s.VisitDetailId && s.Status < EScreenStatus.End && s.IsDeleted == false)
+				//.Where(x => SqlFunc.Subqueryable<OrderScreen>().Where(os => x.Id == os.VisitDetailId && os.Status < EScreenStatus.End && os.IsDeleted == false).Any() || SqlFunc.Subqueryable<OrderScreen>().Where(os => x.Id == os.VisitDetailId && os.IsDeleted == false).NotAny())
 				//.Where((x, s) => s.Id == null && (x.SecondaryHandling.State == ESecondaryHandlingState.NotApply || x.SecondaryHandling.Id == null))
 				.Where(x => SqlFunc.Subqueryable<OrderSecondaryHandling>().Where(osh => osh.VisitDetailId == x.Id && osh.State == ESecondaryHandlingState.NotApply).NotAny())
 				//.Where(x => x.OrderVisit.VisitTime < dto.CreationTimeEnd && x.OrderVisit.VisitTime > dto.CreationTimeStart)

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

@@ -339,4 +339,9 @@ public abstract class CallReportApplicationBase : ICallReportApplication
             .OrderByDescending(x => x.CreatedTime)
             .ToPagedListAsync(dto.PageIndex, dto.PageSize, cancellationToken);
     }
+
+    public virtual Task<List<QuerySeatMonthCallResp>> QuerySeatMonthCall(QuerySeatMonthCallRequest dto)
+    {
+        throw new NotImplementedException();
+    }
 }

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

@@ -18,6 +18,7 @@ using XF.Domain.Repository;
 using Microsoft.AspNetCore.Http;
 using Hotline.Share.Dtos;
 using MapsterMapper;
+using System.Threading;
 
 namespace Hotline.Application.StatisticalReport.CallReport;
 
@@ -290,6 +291,35 @@ public class YiBinCallReportApplication : CallReportApplicationBase, ICallReport
         return await _trCallRecordRepositoryEx.QueryCallOutDateStatisticsDetail(dto.StartTime.Value, dto.EndTime.Value,enterpriseTels);
     }
 
+    public override async Task<List<QuerySeatMonthCallResp>> QuerySeatMonthCall(QuerySeatMonthCallRequest dto)
+    {
+        //获取配置
+        int noConnectByeTimes = _systemSettingCacheManager.NoConnectByeTimes;
+        int effectiveTimes = _systemSettingCacheManager.EffectiveTimes;
+        int connectByeTimes = _systemSettingCacheManager.ConnectByeTimes;
+        int ringTimes = _systemSettingCacheManager.RingTimes;
+
+        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.CallDirection == ECallDirection.In)
+              .GroupBy((u, c) => new { c.UserName, c.UserId })
+              .Select((u, c) => new QuerySeatMonthCallResp
+              {
+                  Name = c.UserName,
+                  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)),//接通秒挂
+                  OverTimeImmediate = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime != null && c.RingTimes > ringTimes, 1, 0)),//超时接通量
+                  InTimeImmediate = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime != null && c.RingTimes <= ringTimes, 1, 0)),//按时接通量
+                  InHanguped = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime == null, 1, 0)),
+                  InHangupImmediate = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime == null && c.RingTimes <= noConnectByeTimes, 1, 0)),
+                  OverTimeInHanguped = SqlFunc.AggregateSum(SqlFunc.IIF(c.AnsweredTime == null && c.RingTimes > noConnectByeTimes, 1, 0)),
+              }).ToListAsync();
+        return list;
+    }
 
     //public override async Task<PagedDto<TrCallDto>> GetCallDetailListAsync(GetCallListDto dto, CancellationToken cancellationToken)
     //{

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

@@ -1,6 +1,7 @@
 using Hotline.CallCenter.Calls;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.CallCenter;
+using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.TrCallCenter;
 using Hotline.Share.Requests;
 using SqlSugar;
@@ -76,5 +77,12 @@ namespace Hotline.Application.StatisticalReport
         /// <param name="dto"></param>
         /// <returns></returns>
         Task<List<QueryCallOutDateStatisticsDetailResp>> QueryCallOutDateStatisticsDetail(QueryCallDateStatisticsDetailDto dto,List<string> enterpriseTels);
+
+        /// <summary>
+        /// 坐席月接通率统计
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        Task<List<QuerySeatMonthCallResp>> QuerySeatMonthCall(QuerySeatMonthCallRequest dto);
     }
 }

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

@@ -388,5 +388,6 @@ namespace Hotline.Repository.SqlSugar.CallCenter
                 }).ToListAsync();
             return list;
         }
+
     }
 }

+ 77 - 0
src/Hotline.Share/Dtos/CallCenter/BiQueryCallsDto.cs

@@ -1,5 +1,6 @@
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Requests;
+using Hotline.Share.Tools;
 using System.ComponentModel.DataAnnotations;
 using XF.Utility.EnumExtensions;
 
@@ -488,4 +489,80 @@ public class QueryCallOutDateStatisticsDetailResp
     public string AiCallOutPutthroughRateText => AiCallOutPutthroughRate + "%";
 }
 
+
+public class QuerySeatMonthCallResp
+{
+    /// <summary>
+    /// 坐席姓名
+    /// </summary>
+    public string Name { get; set; }
+
+    /// <summary>
+    /// 呼入总量
+    /// </summary>
+    public int InTotal => InAnswered + InHanguped;
+
+    /// <summary>
+    /// 呼入接通量
+    /// </summary>
+    public int InAnswered { get; set; }
+
+    /// <summary>
+    /// 有效接通量
+    /// </summary>
+    public int InAvailableAnswer { get; set; }
+
+    /// <summary>
+    /// 呼入接通秒挂
+    /// </summary>
+    public int InHangupImmediateWhenAnswered { get; set; }
+
+    /// <summary>
+    /// 超时接通量
+    /// </summary>
+    public int OverTimeImmediate { get; set; }
+
+    /// <summary>
+    /// 按时接通量
+    /// </summary>
+    public int InTimeImmediate { get; set; }
+
+    /// <summary>
+    /// 呼入未接通总量
+    /// </summary>
+    public int InHanguped { get; set; }
+
+    /// <summary>
+    /// 未接通秒挂量
+    /// </summary>
+    public int InHangupImmediate { get; set; }
+
+    /// <summary>
+    /// 超时未接通量
+    /// </summary>
+    public int OverTimeInHanguped { get; set; }
+
+    /// <summary>
+    /// 呼入接通率
+    /// </summary>
+    public double InAnsweredRate => InTotal > 0 ? Math.Round(((double)InAnswered / (double)InTotal) * 100, digits: 2) : 0;
+
+    /// <summary>
+    /// 呼入接通率(显示)
+    /// </summary>
+    public string InAnsweredRateString => this.InAnsweredRate + "%";
+
+}
+
+public class QuerySeatMonthCallRequest
+{
+    public DateTime? StartTime { get; set; }
+
+    public DateTime? EndTime { get; set; }
+
+    /// <summary>
+    /// 员工ID
+    /// </summary>
+    public string EmpId { get; set; }
+}
 #endregion

+ 2 - 0
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -1213,6 +1213,8 @@ namespace Hotline.FlowEngine.Workflows
                     step.WorkflowTrace.FlowAssignType = EFlowAssignType.User;
                     step.WorkflowTrace.Assign(handler.userId, handler.username,
                         handler.orgId, handler.orgName, handler.roleId, handler.roleName);
+					//更新节点CreationTime  派单量统计  待派单数据使用
+					step.CreationTime = DateTime.Now;
                 }
             }