xf vor 1 Jahr
Ursprung
Commit
08390d12b8
2 geänderte Dateien mit 38 neuen und 8 gelöschten Zeilen
  1. 7 0
      Hotline.sln
  2. 31 8
      src/Hotline.Application/Bigscreen/BigscreenDataShowRefreshService.cs

+ 7 - 0
Hotline.sln

@@ -47,6 +47,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.Api.Sdk", "src\Hotl
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication1", "test\WebApplication1\WebApplication1.csproj", "{D291230A-0CFD-4991-BC1A-B67C58F3857A}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hotline.Ai.Jths", "src\Hotline.Ai.Jths\Hotline.Ai.Jths.csproj", "{EA3451E4-DB54-4E65-B02A-3D2051E8FCEC}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -117,6 +119,10 @@ Global
 		{D291230A-0CFD-4991-BC1A-B67C58F3857A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{D291230A-0CFD-4991-BC1A-B67C58F3857A}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{D291230A-0CFD-4991-BC1A-B67C58F3857A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EA3451E4-DB54-4E65-B02A-3D2051E8FCEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EA3451E4-DB54-4E65-B02A-3D2051E8FCEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EA3451E4-DB54-4E65-B02A-3D2051E8FCEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EA3451E4-DB54-4E65-B02A-3D2051E8FCEC}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -142,6 +148,7 @@ Global
 		{BB901B26-EA97-4D6F-8CAC-14DB321E1733} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 		{EEF30056-A626-43B2-9762-632935C1AF31} = {25C73963-4D5E-4654-804A-D2E2D360134B}
 		{D291230A-0CFD-4991-BC1A-B67C58F3857A} = {08D63205-1445-430F-A4AB-EF1744E3AC11}
+		{EA3451E4-DB54-4E65-B02A-3D2051E8FCEC} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {4B8EA790-BD13-4422-8D63-D6DBB77B823F}

+ 31 - 8
src/Hotline.Application/Bigscreen/BigscreenDataShowRefreshService.cs

@@ -3,17 +3,21 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Hotline.CallCenter.Calls;
+using Hotline.Orders;
 using Hotline.Realtimes;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Logging;
+using SqlSugar;
+using XF.Domain.Repository;
 
 namespace Hotline.Application.Bigscreen
 {
     public class BigscreenDataShowRefreshService : BackgroundService
     {
         private readonly IServiceScopeFactory _serviceScopeFactory;
-        private readonly DateTime _lastModifyTime;
+        private DateTime _lastModifyTime;
 
         public BigscreenDataShowRefreshService(IServiceScopeFactory serviceScopeFactory)
         {
@@ -32,18 +36,37 @@ namespace Hotline.Application.Bigscreen
         {
             using var scope = _serviceScopeFactory.CreateScope();
             var realtimeService = scope.ServiceProvider.GetRequiredService<IRealtimeService>();
+            var orderRepository = scope.ServiceProvider.GetRequiredService<IOrderRepository>();
+            var callRepository = scope.ServiceProvider.GetRequiredService<IRepository<TrCallRecord>>();
 
             while (!stoppingToken.IsCancellationRequested)
             {
-                //todo
-                var data = new {
-                    Name = "John",
-                    Age = 20,
-                };
+                var now = DateTime.Now;
+                var today = now.Date;
+                var secRange = (now - _lastModifyTime).TotalSeconds;
 
-                //await realtimeService.BsDataShowChangedAsync(data, stoppingToken);
+                if (secRange >= 10)
+                {
+                    //area1
+                    var todayTotal = await orderRepository.CountAsync(d => d.CreationTime.Date == today, stoppingToken);
+                    var todayCompleted =
+                        await orderRepository.CountAsync(d => d.FiledTime.HasValue && d.FiledTime.Value.Date == today,
+                            stoppingToken);
+                    await realtimeService.BsDataShowChanged1Async(new { todayTotal, todayCompleted }, stoppingToken);
 
-                await Task.Delay(30000, stoppingToken);
+                    //area3
+                    // var calls = callRepository.Queryable()
+                    //     .OrderByDescending(d=>d.CreationTime)
+                    //     .Take(20)
+                    //     .Select(d=>new {d.})
+
+                    //area8
+
+
+                    _lastModifyTime = DateTime.Now;
+                }
+
+                await Task.Delay(10000, stoppingToken);
             }
         }
     }