田爽 5 өдөр өмнө
parent
commit
83e3077423

+ 38 - 36
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -4883,46 +4883,46 @@ namespace Hotline.Api.Controllers.Bi
         }
 
 
-		/// <summary>
-		/// 派单量统计明细
-		/// </summary>
-		/// <returns></returns>
-		[HttpPost("send_order_detail_report/_export")]
-		[LogFilterAlpha("导出日志")]
-		public async Task<FileStreamResult> QuerySendOrderDetailExport([FromBody] ExportExcelDto<QuerySendOrderDetailRequest> dto)
-		{
-			var query =  _orderApplication.QuerySendOrderDetail(dto.QueryDto);
-			List<Order> data;
-			if (dto.IsExportAll)
-			{
-				data = await query.ToListAsync(HttpContext.RequestAborted);
-			}
-			else
-			{
-				var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
-				data = items;
-			}
-
-			var secondaryHandlingDtos = _mapper.Map<ICollection<OrderDto>>(data);
-
-			dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass<OrderDto>(dto.ColumnInfos);
-
-			var dtos = secondaryHandlingDtos
-				.Select(stu => _mapper.Map(stu, typeof(OrderDto), dynamicClass))
-				.Cast<object>()
-				.ToList();
-
-			var stream = ExcelHelper.CreateStream(dtos);
+        /// <summary>
+        /// 派单量统计明细
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("send_order_detail_report/_export")]
+        [LogFilterAlpha("导出日志")]
+        public async Task<FileStreamResult> QuerySendOrderDetailExport([FromBody] ExportExcelDto<QuerySendOrderDetailRequest> dto)
+        {
+            var query = _orderApplication.QuerySendOrderDetail(dto.QueryDto);
+            List<Order> data;
+            if (dto.IsExportAll)
+            {
+                data = await query.ToListAsync(HttpContext.RequestAborted);
+            }
+            else
+            {
+                var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
+                data = items;
+            }
+
+            var secondaryHandlingDtos = _mapper.Map<ICollection<OrderDto>>(data);
+
+            dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass<OrderDto>(dto.ColumnInfos);
+
+            var dtos = secondaryHandlingDtos
+                .Select(stu => _mapper.Map(stu, typeof(OrderDto), dynamicClass))
+                .Cast<object>()
+                .ToList();
+
+            var stream = ExcelHelper.CreateStream(dtos);
 
 			return ExcelStreamResult(stream, "派单量明细数据");
 		}
 
-		/// <summary>
-		/// 二次办理统计
-		/// </summary>
-		/// <param name="dto"></param>
-		/// <returns></returns>
-		[HttpGet("secondary_handling_report")]
+        /// <summary>
+        /// 二次办理统计
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpGet("secondary_handling_report")]
         public async Task<List<SecondaryHandlingVo>> SecondaryHandlingReport([FromQuery] QuerySecondaryHandlingRequest dto)
         {
             var query = _orderSecondaryHandlingApplication.SecondaryHandlingReport(dto, HttpContext.RequestAborted);
@@ -5932,6 +5932,8 @@ namespace Hotline.Api.Controllers.Bi
             }
             sumRow["SumCount"] = totalAmount;
             data.Rows.Add(sumRow);
+            data.Columns["AreaName"].ColumnName = "区域名称";
+            data.Columns["SumCount"].ColumnName = "分类统计";
 
             var stream = ExcelHelper.CreateStream(data);
             return ExcelStreamResult(stream, "下级区域统计");

+ 3 - 1
src/Hotline.Api/Controllers/IPPbxController.cs

@@ -821,12 +821,14 @@ namespace Hotline.Api.Controllers
         [HttpGet("calls/basedata")]
         public async Task<object> CallBaseData()
         {
+            var isCallBindOrder = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsCallBindOrder).SettingValue[0]);
             return new
             {
                 OnState = EnumExts.GetDescriptions<EOnState>(),
                 CallDirection = EnumExts.GetDescriptions<ECallDirection>(),
                 EndBy = EnumExts.GetDescriptions<EEndBy>(),
-                PhoneTypes = EnumExts.GetDescriptions<EPhoneTypes>()
+                PhoneTypes = EnumExts.GetDescriptions<EPhoneTypes>(),
+                IsCallBindOrder = isCallBindOrder
             };
         }
 

+ 69 - 71
src/Hotline.Repository.SqlSugar/CallCenter/TrCallRecordRepository.cs

@@ -6,6 +6,7 @@ using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Dtos.TrCallCenter;
 using Hotline.Share.Enums.CallCenter;
 using SqlSugar;
+using XF.Domain.Authentications;
 using XF.Domain.Dependency;
 using static System.Runtime.InteropServices.JavaScript.JSType;
 
@@ -13,8 +14,15 @@ namespace Hotline.Repository.SqlSugar.CallCenter
 {
     public class TrCallRecordRepository : BaseRepository<TrCallRecord>, ITrCallRecordRepository, IScopeDependency
     {
-        public TrCallRecordRepository(ISugarUnitOfWork<HotlineDbContext> uow, IDataPermissionFilterBuilder dataPermissionFilterBuilder, IServiceProvider serviceProvider) : base(uow, dataPermissionFilterBuilder, serviceProvider)
+        private readonly ISessionContext _sessionContext;
+
+        public TrCallRecordRepository(
+            ISugarUnitOfWork<HotlineDbContext> uow,
+            IDataPermissionFilterBuilder dataPermissionFilterBuilder,
+            IServiceProvider serviceProvider,
+            ISessionContext sessionContext) : base(uow, dataPermissionFilterBuilder, serviceProvider)
         {
+            _sessionContext = sessionContext;
         }
 
         public async Task<List<BiCallDto>> GetQueryCalls(DateTime beginDate, DateTime endDate, string? Line)
@@ -83,7 +91,7 @@ namespace Hotline.Repository.SqlSugar.CallCenter
 
             var list = Db.Queryable<TrCallRecord>()
                   .Where(p => p.CreatedTime >= beginDate && p.CreatedTime <= endDate)
-                 // .Where(p => p.Gateway != "82826886" && SqlFunc.Length(p.Gateway) != 4)
+                  // .Where(p => p.Gateway != "82826886" && SqlFunc.Length(p.Gateway) != 4)
                   .WhereIF(!string.IsNullOrEmpty(Line), p => p.Gateway == Line)
                    .GroupBy(p => p.CreatedTime.Hour)
                    .Select(p => new
@@ -178,13 +186,13 @@ namespace Hotline.Repository.SqlSugar.CallCenter
             return resultList;
         }
 
-		/// <summary>
-		/// 通话时段统计明细
-		/// </summary>
-		/// <returns></returns>
-		public async Task<TotalData<BiSeatSwitchDto>> GetCallList(QueryCallListDto dto, int noConnectByeTimes, int effectiveTimes, int connectByeTimes)
-		{
-			TimeSpan endHourTo = DateTime.Now.TimeOfDay;
+        /// <summary>
+        /// 通话时段统计明细
+        /// </summary>
+        /// <returns></returns>
+        public async Task<TotalData<BiSeatSwitchDto>> GetCallList(QueryCallListDto dto, int noConnectByeTimes, int effectiveTimes, int connectByeTimes)
+        {
+            TimeSpan endHourTo = DateTime.Now.TimeOfDay;
             if (dto.StartHourTo.HasValue)
             {
                 endHourTo = dto.StartHourTo.Value.Add(new TimeSpan(1, 0, 0));
@@ -213,16 +221,16 @@ namespace Hotline.Repository.SqlSugar.CallCenter
                     CDPN = x.CDPN,
                     CreatedTime = x.CreatedTime
                 })
-				.OrderByIF(dto is { SortRule: 0, SortField: "createdTime" }, x => x.CreatedTime, OrderByType.Asc)
-		        .OrderByIF(dto is { SortRule: 1, SortField: "createdTime" }, x => x.CreatedTime, OrderByType.Desc)
-				.ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+                .OrderByIF(dto is { SortRule: 0, SortField: "createdTime" }, x => x.CreatedTime, OrderByType.Asc)
+                .OrderByIF(dto is { SortRule: 1, SortField: "createdTime" }, x => x.CreatedTime, OrderByType.Desc)
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
             return new TotalData<BiSeatSwitchDto>(res, total.Value);
         }
 
         public async Task<List<CallHotLineDto>> GetCallHotLineList(DateTime beginDate, DateTime endDate, string lineNum, int noConnectByeTimes, int effectiveTimes, int connectByeTimes, int ringTims)
         {
             var list = await Db.Queryable<TrCallRecord>()
-                .Where(x => x.CreatedTime >= beginDate && x.CreatedTime <= endDate && SqlFunc.Length(x.Gateway)>4)
+                .Where(x => x.CreatedTime >= beginDate && x.CreatedTime <= endDate && SqlFunc.Length(x.Gateway) > 4)
                 .WhereIF(!string.IsNullOrEmpty(lineNum), x => x.Gateway == lineNum)
                 .GroupBy(x => x.Gateway)
                 .Select(x => new CallHotLineDto()
@@ -243,55 +251,45 @@ namespace Hotline.Repository.SqlSugar.CallCenter
 
         public ISugarQueryable<TrCallRecord> GetCallList(GetCallListDto dto)
         {
-           return  Db.Queryable<TrCallRecord>()
-                .Includes(x => x.Order)
-                .WhereIF(!string.IsNullOrEmpty(dto.CPN), x => x.CPN.Contains(dto.CPN))
-                .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.CDPN.Contains(dto.CDPN))
-                .WhereIF(!string.IsNullOrEmpty(dto.TelNo), x => x.TelNo.Contains(dto.TelNo))
-                .WhereIF(!string.IsNullOrEmpty(dto.UserName), x => x.UserName.Contains(dto.UserName))
-                .WhereIF(dto.CallDirection != null, x => x.CallDirection == dto.CallDirection)
-                .WhereIF(dto.OnState != null, x => x.OnState == dto.OnState)
-                .WhereIF(dto.EndBy != null, x => x.EndBy == dto.EndBy)
-
-                .WhereIF(dto.BeginIvrTimeStart.HasValue, x => x.BeginIvrTime >= dto.BeginIvrTimeStart)
-                .WhereIF(dto.BeginIvrTimeEnd.HasValue, x => x.BeginIvrTime <= dto.BeginIvrTimeEnd)
-
-                .WhereIF(dto.EndIvrTimeStart.HasValue, x => x.EndIvrTime >= dto.EndIvrTimeStart)
-                .WhereIF(dto.EndIvrTimeEnd.HasValue, x => x.EndIvrTime <= dto.EndIvrTimeEnd)
-
-                .WhereIF(dto.BeginQueueTimeStart.HasValue, x => x.BeginQueueTime >= dto.BeginQueueTimeEnd)
-                .WhereIF(dto.BeginQueueTimeEnd.HasValue, x => x.BeginQueueTime <= dto.BeginQueueTimeEnd)
-
-                .WhereIF(dto.EndQueueTimeStart.HasValue, x => x.EndQueueTime >= dto.EndQueueTimeStart)
-                .WhereIF(dto.EndQueueTimeEnd.HasValue, x => x.EndQueueTime <= dto.EndQueueTimeEnd)
-
-                .WhereIF(dto.AnsweredTimeStart.HasValue, x => x.AnsweredTime >= dto.AnsweredTimeStart)
-                .WhereIF(dto.AnsweredTimeEnd.HasValue, x => x.AnsweredTime <= dto.AnsweredTimeEnd)
-
-                .WhereIF(dto.OverTimeStart.HasValue, x => x.OverTime >= dto.OverTimeStart)
-                .WhereIF(dto.OverTimeEnd.HasValue, x => x.OverTime <= dto.OverTimeEnd)
-
-                .WhereIF(dto.BeginRingTimeStart.HasValue, x => x.BeginRingTime >= dto.BeginRingTimeStart)
-                .WhereIF(dto.BeginRingTimeEnd.HasValue, x => x.BeginRingTime <= dto.BeginRingTimeEnd)
-
-                .WhereIF(dto.EndRingTimeStart.HasValue, x => x.EndRingTimg >= dto.EndRingTimeStart)
-                .WhereIF(dto.EndRingTimeEnd.HasValue, x => x.EndRingTimg <= dto.EndRingTimeEnd)
-
-                .WhereIF(dto.CallTimeStart.HasValue, x => x.CreatedTime >= dto.CallTimeStart)
-                .WhereIF(dto.CallTimeEnd.HasValue, x => x.CreatedTime <= dto.CallTimeEnd)
-
-                .WhereIF(!string.IsNullOrEmpty(dto.OrderNo), x => x.Order.No.Contains(dto.OrderNo))
-                .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title))
-                .WhereIF(!string.IsNullOrEmpty(dto.Gateway), x => x.Gateway.Contains(dto.Gateway))
-                .WhereIF(dto.IsSensitiveWord.HasValue && dto.IsSensitiveWord == true, d => d.Sensitive != null && SqlFunc.JsonArrayLength(d.Sensitive) > 0)
-                .WhereIF(!string.IsNullOrEmpty(dto.SensitiveWord), d => SqlFunc.JsonArrayAny(d.Sensitive, dto.SensitiveWord))
-                .WhereIF(dto.IsAiAnswered == true, x => string.IsNullOrEmpty(x.UserId) == true && x.BeginIvrTime.HasValue && x.EndIvrTime.HasValue)
-
-                .WhereIF(dto.PhoneTypes != null, x => x.PhoneTypes == dto.PhoneTypes)
-                .OrderByDescending(x => x.CreatedTime);
+            return Db.Queryable<TrCallRecord>()
+                 .Includes(x => x.Order)
+                 .WhereIF(!string.IsNullOrEmpty(dto.CPN), x => x.CPN.Contains(dto.CPN))
+                 .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.CDPN.Contains(dto.CDPN))
+                 .WhereIF(!string.IsNullOrEmpty(dto.TelNo), x => x.TelNo.Contains(dto.TelNo))
+                 .WhereIF(!string.IsNullOrEmpty(dto.UserName), x => x.UserName.Contains(dto.UserName))
+                 .WhereIF(dto.CallDirection != null, x => x.CallDirection == dto.CallDirection)
+                 .WhereIF(dto.OnState != null, x => x.OnState == dto.OnState)
+                 .WhereIF(dto.EndBy != null, x => x.EndBy == dto.EndBy)
+                 .WhereIF(dto.BeginIvrTimeStart.HasValue, x => x.BeginIvrTime >= dto.BeginIvrTimeStart)
+                 .WhereIF(dto.BeginIvrTimeEnd.HasValue, x => x.BeginIvrTime <= dto.BeginIvrTimeEnd)
+                 .WhereIF(dto.EndIvrTimeStart.HasValue, x => x.EndIvrTime >= dto.EndIvrTimeStart)
+                 .WhereIF(dto.EndIvrTimeEnd.HasValue, x => x.EndIvrTime <= dto.EndIvrTimeEnd)
+                 .WhereIF(dto.BeginQueueTimeStart.HasValue, x => x.BeginQueueTime >= dto.BeginQueueTimeEnd)
+                 .WhereIF(dto.BeginQueueTimeEnd.HasValue, x => x.BeginQueueTime <= dto.BeginQueueTimeEnd)
+                 .WhereIF(dto.EndQueueTimeStart.HasValue, x => x.EndQueueTime >= dto.EndQueueTimeStart)
+                 .WhereIF(dto.EndQueueTimeEnd.HasValue, x => x.EndQueueTime <= dto.EndQueueTimeEnd)
+                 .WhereIF(dto.AnsweredTimeStart.HasValue, x => x.AnsweredTime >= dto.AnsweredTimeStart)
+                 .WhereIF(dto.AnsweredTimeEnd.HasValue, x => x.AnsweredTime <= dto.AnsweredTimeEnd)
+                 .WhereIF(dto.OverTimeStart.HasValue, x => x.OverTime >= dto.OverTimeStart)
+                 .WhereIF(dto.OverTimeEnd.HasValue, x => x.OverTime <= dto.OverTimeEnd)
+                 .WhereIF(dto.BeginRingTimeStart.HasValue, x => x.BeginRingTime >= dto.BeginRingTimeStart)
+                 .WhereIF(dto.BeginRingTimeEnd.HasValue, x => x.BeginRingTime <= dto.BeginRingTimeEnd)
+                 .WhereIF(dto.EndRingTimeStart.HasValue, x => x.EndRingTimg >= dto.EndRingTimeStart)
+                 .WhereIF(dto.EndRingTimeEnd.HasValue, x => x.EndRingTimg <= dto.EndRingTimeEnd)
+                 .WhereIF(dto.CallTimeStart.HasValue, x => x.CreatedTime >= dto.CallTimeStart)
+                 .WhereIF(dto.CallTimeEnd.HasValue, x => x.CreatedTime <= dto.CallTimeEnd)
+                 .WhereIF(!string.IsNullOrEmpty(dto.OrderNo), x => x.Order.No.Contains(dto.OrderNo))
+                 .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title))
+                 .WhereIF(!string.IsNullOrEmpty(dto.Gateway), x => x.Gateway.Contains(dto.Gateway))
+                 .WhereIF(dto.IsSensitiveWord.HasValue && dto.IsSensitiveWord == true, d => d.Sensitive != null && SqlFunc.JsonArrayLength(d.Sensitive) > 0)
+                 .WhereIF(!string.IsNullOrEmpty(dto.SensitiveWord), d => SqlFunc.JsonArrayAny(d.Sensitive, dto.SensitiveWord))
+                 .WhereIF(dto.IsAiAnswered == true, x => string.IsNullOrEmpty(x.UserId) == true && x.BeginIvrTime.HasValue && x.EndIvrTime.HasValue)
+                 .WhereIF(dto.PhoneTypes != null, x => x.PhoneTypes == dto.PhoneTypes)
+                 .WhereIF(dto.QuerySelf.HasValue && dto.QuerySelf == true, x => x.UserId == _sessionContext.UserId)
+                 .OrderByDescending(x => x.CreatedTime);
         }
 
-        
+
         public async Task<List<QueryCallDateStatisticsDetailResp>> QueryCallDateStatisticsDetail(DateTime startTime, DateTime endTime)
         {
             var query = Db.Queryable<TrCallRecord>()
@@ -315,7 +313,7 @@ namespace Hotline.Repository.SqlSugar.CallCenter
                     IvrRingOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.BeginIvrTime.HasValue && !x.BeginQueueTime.HasValue && !x.BeginRingTime.HasValue && x.OnState == EOnState.NoOn, 1, 0)), //IVR挂断
                 })
                 .OrderBy(x => x.Date);
-                return await query.ToListAsync();
+            return await query.ToListAsync();
         }
 
         public async Task<List<QueryPersonCallDateStatisticsDetailResp>> QueryPersonCallDateStatisticsDetail(DateTime startTime, DateTime endTime)
@@ -330,13 +328,13 @@ namespace Hotline.Repository.SqlSugar.CallCenter
                     PersonCallInPutthroughCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "1" && x.OnState == EOnState.On, 1, 0)),
                     //PersonRingOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "1" && x.OnState == EOnState.NoOn, 1, 0)),//个人服务挂断
                     PersonQueueOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "1" && x.QueueTims > 0 && x.RingTimes == 0 && x.OnState == EOnState.NoOn, 1, 0)),//个人服务队列挂断
-                    PersonWaitOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length -1,1) =="1" && x.RingTimes>0 && x.OnState == EOnState.NoOn,1,0)) //个人服务等待挂断
+                    PersonWaitOffCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.IvrDtmf.Substring(x.IvrDtmf.Length - 1, 1) == "1" && x.RingTimes > 0 && x.OnState == EOnState.NoOn, 1, 0)) //个人服务等待挂断
                 })
                 .OrderBy(x => x.Date);
             return await query.ToListAsync();
         }
 
-        public async Task<List<QueryEnterpriseCallDateStatisticsDetailResp>> QueryEnterpriseCallDateStatisticsDetail(DateTime startTime,DateTime endTime)
+        public async Task<List<QueryEnterpriseCallDateStatisticsDetailResp>> QueryEnterpriseCallDateStatisticsDetail(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)
@@ -354,28 +352,28 @@ namespace Hotline.Repository.SqlSugar.CallCenter
             return await query.ToListAsync();
         }
 
-        public async Task<List<QueryCallOutDateStatisticsDetailResp>> QueryCallOutDateStatisticsDetail(DateTime startTime,DateTime endTime,List<string> enterpriseTels)
+        public async Task<List<QueryCallOutDateStatisticsDetailResp>> QueryCallOutDateStatisticsDetail(DateTime startTime, DateTime endTime, List<string> enterpriseTels)
         {
             var callTable = Db.Queryable<TrCallRecord>()
-                .Where(x => x.CreatedTime >= startTime && x.CreatedTime <= endTime && SqlFunc.Length(x.Gateway) > 4 && x.CallDirection == ECallDirection.Out && SqlFunc.Length(x.TelNo)==4)
+                .Where(x => x.CreatedTime >= startTime && x.CreatedTime <= endTime && SqlFunc.Length(x.Gateway) > 4 && x.CallDirection == ECallDirection.Out && SqlFunc.Length(x.TelNo) == 4)
                 .GroupBy(x => x.CreatedTime.ToString("yyyy-MM-dd"))
                 .Select(x => new QueryCallOutDateStatisticsDetailResp()
                 {
                     Date = x.CreatedTime.ToString("yyyy-MM-dd"),
-                    PersonCallOutCount = SqlFunc.AggregateSum(SqlFunc.IIF(1 == 1 && !enterpriseTels.Contains(x.TelNo),1,0)),
-                    EnterpriseCallOutCount = SqlFunc.AggregateSum(SqlFunc.IIF(1== 1 && enterpriseTels.Contains(x.TelNo),1,0)),
+                    PersonCallOutCount = SqlFunc.AggregateSum(SqlFunc.IIF(1 == 1 && !enterpriseTels.Contains(x.TelNo), 1, 0)),
+                    EnterpriseCallOutCount = SqlFunc.AggregateSum(SqlFunc.IIF(1 == 1 && enterpriseTels.Contains(x.TelNo), 1, 0)),
                     PersonCallOutPutthroughCount = SqlFunc.AggregateSum(SqlFunc.IIF(!enterpriseTels.Contains(x.TelNo) && x.OnState == EOnState.On, 1, 0)),
                     EnterpriseCallOutPutthroughCount = SqlFunc.AggregateSum(SqlFunc.IIF(enterpriseTels.Contains(x.TelNo) && x.OnState == EOnState.On, 1, 0)),
                 }).MergeTable();
 
-            var aiVisitCallTable =  Db.Queryable<AiOrderVisitDetail>()
+            var aiVisitCallTable = Db.Queryable<AiOrderVisitDetail>()
                 .Where(x => x.CallTime >= startTime && x.CallTime <= endTime)
                 .GroupBy(x => x.CallTime.Value.ToString("yyyy-MM-dd"))
                 .Select(x => new QueryCallOutDateStatisticsDetailResp()
                 {
                     Date = x.CallTime.Value.ToString("yyyy-MM-dd"),
                     AiVisitCallOutCount = SqlFunc.AggregateCount(x.Id),
-                    AiVisitCallOutPutthroughCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.AiIsContact!=null || x.AiVolved!=null || x.AiOrgProcessingResults != null ,1,0))
+                    AiVisitCallOutPutthroughCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.AiIsContact != null || x.AiVolved != null || x.AiOrgProcessingResults != null, 1, 0))
                 }).MergeTable();
 
             var list = await callTable.LeftJoin(aiVisitCallTable, (a, b) => a.Date == b.Date)
@@ -386,11 +384,11 @@ namespace Hotline.Repository.SqlSugar.CallCenter
                     EnterpriseCallOutCount = a.EnterpriseCallOutCount,
                     AiVisitCallOutCount = b.AiVisitCallOutCount,
                     AiCallOutCount = 0,
-                    PersonCallOutPutthroughCount= a.PersonCallOutPutthroughCount,
+                    PersonCallOutPutthroughCount = a.PersonCallOutPutthroughCount,
                     EnterpriseCallOutPutthroughCount = a.EnterpriseCallOutPutthroughCount,
                     AiVisitCallOutPutthroughCount = b.AiVisitCallOutPutthroughCount,
                     AiCallOutPutthroughCount = 0,
-                }).OrderBy(a=>a.Date).ToListAsync();
+                }).OrderBy(a => a.Date).ToListAsync();
             return list;
         }
 

+ 10 - 0
src/Hotline.Share/Dtos/TrCallCenter/TrTelDao.cs

@@ -577,6 +577,11 @@ namespace Hotline.Share.Dtos.TrCallCenter
         /// 敏感词
         /// </summary>
         public string? SensitiveWord { get; set; }
+
+        /// <summary>
+        /// 是否自己的通话记录
+        /// </summary>
+        public bool? QuerySelf { get; set; }
     }
 
 
@@ -712,6 +717,11 @@ namespace Hotline.Share.Dtos.TrCallCenter
         /// </summary>
         public string? DtmfType { get; set; }
 
+        /// <summary>
+        /// 允许关联工单
+        /// </summary>
+        public bool? IsBindOrder => !string.IsNullOrEmpty(UserId) && Order == null ? true : false;
+
         #region 自定义字段
         /// <summary>
         /// 通话时长(挂机时间-接通时间)

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

@@ -22,18 +22,18 @@ namespace Hotline.CallCenter.Calls
         Task<List<QueryCallsDetailDto>> QueryCallsHourDetail(DateTime beginDate, DateTime endDate, int noConnectByeTimes, int effectiveTimes, int connectByeTimes, int CallInOverConnRingTime, int SeatChaoTime, string? Line);
 
         Task<List<BiCallDto>> GetQueryCalls(DateTime beginDate, DateTime endDate, string? Line);
-        Task<List<TrCallHourDto>?> GetCallHourList(DateTime beginDate, DateTime? endDate, int noConnectByeTimes, int effectiveTimes,int connectByeTimes, string source);
+        Task<List<TrCallHourDto>?> GetCallHourList(DateTime beginDate, DateTime? endDate, int noConnectByeTimes, int effectiveTimes, int connectByeTimes, string source);
 
 
-        Task<List<CallHotLineDto>> GetCallHotLineList(DateTime beginDate, DateTime endDate, string lineNum, int noConnectByeTimes, int effectiveTimes, int connectByeTimes,int ringTims);
+        Task<List<CallHotLineDto>> GetCallHotLineList(DateTime beginDate, DateTime endDate, string lineNum, int noConnectByeTimes, int effectiveTimes, int connectByeTimes, int ringTims);
         Task<TotalData<BiSeatSwitchDto>> GetCallList(QueryCallListDto dto, int noConnectByeTimes, int effectiveTimes, int connectByeTimes);
 
-		/// <summary>
-		/// 获取通话记录
-		/// </summary>
-		/// <param name="dto"></param>
-		/// <returns></returns>
-		ISugarQueryable<TrCallRecord> GetCallList(GetCallListDto dto);
+        /// <summary>
+        /// 获取通话记录
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        ISugarQueryable<TrCallRecord> GetCallList(GetCallListDto dto);
 
         /// <summary>
         /// 话务日期统计明细

+ 5 - 0
src/Hotline/Settings/SettingConstants.cs

@@ -805,5 +805,10 @@ namespace Hotline.Settings
         /// 临时保存天数
         /// </summary>
         public const string TempOpinionDays = "TempOpinionDays";
+
+        /// <summary>
+        /// 话务管理未接允许关联工单
+        /// </summary>
+        public const string IsCallBindOrder = "IsCallBindOrder";
     }
 }