Dun.Jason 10 месяцев назад
Родитель
Сommit
970afcc046

+ 42 - 0
src/Hotline.Application/CallCenter/Calls/ToDayWaitNumService.cs

@@ -0,0 +1,42 @@
+using Hotline.CallCenter.Calls;
+using Hotline.Realtimes;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Repository;
+
+namespace Hotline.Application.CallCenter.Calls
+{
+    public class ToDayWaitNumService : BackgroundService
+    {
+        private readonly IServiceScopeFactory _serviceScopeFactory;
+        public ToDayWaitNumService(IServiceScopeFactory serviceScopeFactory)
+        {
+                _serviceScopeFactory = serviceScopeFactory;
+        }
+
+        protected async override Task ExecuteAsync(CancellationToken stoppingToken)
+        {
+            using var scope = _serviceScopeFactory.CreateScope();
+            var realtimeService = scope.ServiceProvider.GetRequiredService<IRealtimeService>();
+            var _trcallrecordRepoository = scope.ServiceProvider.GetRequiredService<IRepository<TrCallRecord>>();
+            int times = 60000;//五分钟
+            while (!stoppingToken.IsCancellationRequested)
+            {
+                try
+                {
+                    int count = await _trcallrecordRepoository.Queryable()
+                        .Where(x => x.CreatedTime.Date == DateTime.Now.Date)
+                        .Where(x => x.QueueTims > 0 && x.Duration == 0)
+                        .CountAsync();
+                }
+                catch {}
+                await Task.Delay(times);
+            }
+        }
+    }
+}

+ 1 - 1
src/Hotline.Share/Dtos/Order/OrderVisitDto.cs

@@ -479,7 +479,7 @@ namespace Hotline.Share.Dtos.Order
         /// </summary>
         public EJudgeState? JudgeState { get; set; }
 
-        public string? JudgeStateText => JudgeState.GetDescription() ?? string.Empty;
+        public string? JudgeStateText => JudgeState?.GetDescription() ?? string.Empty;
         
         /// <summary>
         /// 评判意见