Browse Source

BigScreen-SeatState

xf 1 year ago
parent
commit
286380a07e

+ 8 - 6
src/Hotline.Api/Controllers/TestController.cs

@@ -1,12 +1,10 @@
-using Hotline.Api.Filter;
+using DotNetCore.CAP;
 using Hotline.CallCenter.BlackLists;
 using Hotline.CallCenter.BlackLists;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;
 using Hotline.CallCenter.Ivrs;
-using Hotline.DataSharing.Province.Notifications;
 using Hotline.FlowEngine.WorkflowModules;
 using Hotline.FlowEngine.WorkflowModules;
 using Hotline.Identity.Roles;
 using Hotline.Identity.Roles;
 using Hotline.Orders;
 using Hotline.Orders;
-using Hotline.Orders.Notifications;
 using Hotline.Realtimes;
 using Hotline.Realtimes;
 using Hotline.Repository.SqlSugar;
 using Hotline.Repository.SqlSugar;
 using Hotline.Repository.SqlSugar.Ts;
 using Hotline.Repository.SqlSugar.Ts;
@@ -21,7 +19,6 @@ using NewRock.Sdk;
 using NewRock.Sdk.Security;
 using NewRock.Sdk.Security;
 using SqlSugar;
 using SqlSugar;
 using Tr.Sdk;
 using Tr.Sdk;
-using Wex.Sdk;
 using XC.RSAUtil;
 using XC.RSAUtil;
 using XF.Domain.Authentications;
 using XF.Domain.Authentications;
 using XF.Domain.Cache;
 using XF.Domain.Cache;
@@ -60,6 +57,7 @@ public class TestController : BaseController
     private readonly IWfModuleDomainService _wfModuleDomainService;
     private readonly IWfModuleDomainService _wfModuleDomainService;
     private readonly IDaySettingRepository _daySettingRepository;
     private readonly IDaySettingRepository _daySettingRepository;
     private readonly ITrClient _trClient;
     private readonly ITrClient _trClient;
+    private readonly ICapPublisher _capPublisher;
 
 
 
 
     //private readonly ITypedCache<List<User>> _cache;
     //private readonly ITypedCache<List<User>> _cache;
@@ -88,7 +86,8 @@ public class TestController : BaseController
         ITimeLimitDomainService timeLimitDomainService,
         ITimeLimitDomainService timeLimitDomainService,
         IWfModuleDomainService wfModuleDomainService,
         IWfModuleDomainService wfModuleDomainService,
         IDaySettingRepository daySettingRepository,
         IDaySettingRepository daySettingRepository,
-        ITrClient trClient
+        ITrClient trClient,
+        ICapPublisher capPublisher
     )
     )
     {
     {
         _logger = logger;
         _logger = logger;
@@ -110,12 +109,15 @@ public class TestController : BaseController
         _wfModuleDomainService = wfModuleDomainService;
         _wfModuleDomainService = wfModuleDomainService;
         _daySettingRepository = daySettingRepository;
         _daySettingRepository = daySettingRepository;
         _trClient = trClient;
         _trClient = trClient;
+        _capPublisher = capPublisher;
     }
     }
 
 
     [HttpGet("testo")]
     [HttpGet("testo")]
     public async Task<OpenResponse> TestOrigin()
     public async Task<OpenResponse> TestOrigin()
     {
     {
-        return OpenResponse.Ok(DateTime.Today.ToString());
+        var today = DateTime.Today.ToString();
+        await _capPublisher.PublishAsync("test.today", today, cancellationToken: HttpContext.RequestAborted);
+        return OpenResponse.Ok(today);
     }
     }
 
 
     [HttpGet("time")]
     [HttpGet("time")]

+ 12 - 1
src/Hotline.Api/Realtimes/HotlineHub.cs

@@ -1,8 +1,10 @@
-using Hotline.Caching.Interfaces;
+using Google.Protobuf.WellKnownTypes;
+using Hotline.Caching.Interfaces;
 using Hotline.Realtimes;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Share.Dtos.Realtime;
 using Hotline.Users;
 using Hotline.Users;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.AspNetCore.SignalR;
+using System.Threading;
 using XF.Domain.Authentications;
 using XF.Domain.Authentications;
 using XF.Domain.Cache;
 using XF.Domain.Cache;
 using XF.Domain.Exceptions;
 using XF.Domain.Exceptions;
@@ -140,6 +142,15 @@ namespace Hotline.Api.Realtimes
             await Clients.Group(dto.GroupName).SendAsync("Send", $"{Context.ConnectionId} has left the group {dto.GroupName}.");
             await Clients.Group(dto.GroupName).SendAsync("Send", $"{Context.ConnectionId} has left the group {dto.GroupName}.");
         }
         }
 
 
+        /// <summary>
+        /// 通知大屏坐席状态
+        /// </summary>
+        /// <returns></returns>
+        public async Task SendSeatState(SeatStateDto dto)
+        {
+            await Clients.Group(RealtimeGroupNames.BigScreenSeatState).SendAsync("SeatState", dto, Context.ConnectionAborted);
+        }
+
         #region private
         #region private
 
 
         private void CheckIfConnected()
         private void CheckIfConnected()

+ 1 - 0
src/Hotline.Api/Realtimes/RealtimeGroupNames.cs

@@ -4,5 +4,6 @@
     {
     {
         public const string CallCenter = "CallCenter";
         public const string CallCenter = "CallCenter";
         public const string BigScreenDataShow = "BigScreen-DataShow";
         public const string BigScreenDataShow = "BigScreen-DataShow";
+        public const string BigScreenSeatState = "BigScreen-SeatState";
     }
     }
 }
 }

+ 0 - 1
src/Hotline.Repository.SqlSugar/BaseRepository.cs

@@ -1,5 +1,4 @@
 using System.Linq.Expressions;
 using System.Linq.Expressions;
-using System.Reflection.Metadata.Ecma335;
 using Hotline.Repository.SqlSugar.DataPermissions;
 using Hotline.Repository.SqlSugar.DataPermissions;
 using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Repository.SqlSugar.Extensions;
 using SqlSugar;
 using SqlSugar;

+ 7 - 0
src/Hotline.Share/Dtos/Realtime/SeatStateDto.cs

@@ -0,0 +1,7 @@
+namespace Hotline.Share.Dtos.Realtime;
+
+public class SeatStateDto
+{
+    public string TelNo { get; set; }
+    public string State { get; set; }
+}