Selaa lähdekoodia

Merge branch 'fix/bug_241023' into release

qinchaoyue 6 kuukautta sitten
vanhempi
commit
a1f666c857

+ 6 - 6
src/Hotline.Api/Controllers/Bigscreen/SeatController.cs

@@ -1,26 +1,26 @@
 using Hotline.Application.Bigscreen;
 using Hotline.Caching.Interfaces;
+using Hotline.CallCenter.Tels;
+using Hotline.CallCenter.Tels.CallTelDomain;
 using Hotline.Settings;
 using Hotline.Share.Dtos.TrCallCenter;
 using Mapster;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
-using Tr.Sdk;
-using Tr.Sdk.Tels;
 
 namespace Hotline.Api.Controllers.Bigscreen
 {
     public class SeatController : BaseController
     {
         private readonly ISeatStateDataService _seatStateDataService;
-        private readonly ITrClient _trClient;
+        private readonly ICallTelClient _callTelClient;
         private readonly ISystemSettingCacheManager _systemSettingCacheManager;
 
-        public SeatController(ISeatStateDataService seatStateDataService, ISystemSettingCacheManager systemSettingCacheManager, ITrClient trClient)
+        public SeatController(ISeatStateDataService seatStateDataService, ISystemSettingCacheManager systemSettingCacheManager, ICallTelClient callTelClient)
         {
             _seatStateDataService = seatStateDataService;
             _systemSettingCacheManager = systemSettingCacheManager;
-            _trClient = trClient;
+            _callTelClient = callTelClient;
         }
 
         /// <summary>
@@ -51,7 +51,7 @@ namespace Hotline.Api.Controllers.Bigscreen
         {
             var listenTels = _systemSettingCacheManager.GetSetting(SettingConstants.ListenTels)?.SettingValue;
             var callOuttQueueId = _systemSettingCacheManager.GetSetting(SettingConstants.CallOutQueueId)?.SettingValue;
-            var list = (await _trClient.QueryTelsAsync(new QueryTelRequest(), HttpContext.RequestAborted))
+            var list = (await _callTelClient.QueryTelsAsync(new QueryTelRequest(), HttpContext.RequestAborted))
                 .Where(m => listenTels.Contains(m.TelNo))
                 .ToList()
                 .Adapt<List<TelOutDto>>();

+ 2 - 0
src/Hotline.Api/StartupExtensions.cs

@@ -32,6 +32,7 @@ using Hotline.Share.Tools;
 using Hotline.Settings.TimeLimitDomain.ExpireTimeSupplier;
 using Hotline.Api.Middleware;
 using XF.Domain.Authentications;
+using Hotline.XingTang;
 
 namespace Hotline.Api;
 
@@ -165,6 +166,7 @@ internal static class StartupExtensions
                 break;
             case AppDefaults.CallCenterType.XingTang:
                 services.AddXingTangDb(callCenterConfiguration.XingTang)
+                    .AddXingTangSDK()
                     .AddScoped<ICallApplication, XingTangCallApplication>()
                     .AddScoped<CallIdManager>()
                     ;

+ 9 - 116
src/Hotline.Application/Bigscreen/SeatStateDataService.cs

@@ -1,121 +1,14 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Hotline.CallCenter.Calls;
-using SqlSugar;
+using Hotline.CallCenter.Calls;
+using Hotline.DI;
 using XF.Domain.Dependency;
 using XF.Domain.Repository;
 
-namespace Hotline.Application.Bigscreen
-{
-	public  class SeatStateDataService: ISeatStateDataService , IScopeDependency
-	{
-		private readonly IRepository<TrCallRecord> _callRepository;
-		public SeatStateDataService(IRepository<TrCallRecord> callRepository) {
-			_callRepository= callRepository;
-		}
-
-		public async Task<object> GetCall24(CancellationToken stoppingToken) {
-			List<string> timeList = new List<string>();
-			for (int i = 0; i < 24; i++)
-			{
-				var time = i < 10 ? $"0{i}" : i.ToString();
-				timeList.Add(time);
-			}
-			var call24 = await _callRepository.Queryable()
-				.Where(x => x.CreatedTime.Date == DateTime.Now.Date
-					&& x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
-				)
-				.Select(x => new { time = x.CreatedTime.ToString("hh"), x.CallDirection }).MergeTable()
-				.GroupBy(x => x.time)
-				.Select(x => new
-				{
-					Time = x.time.ToString(),
-					In = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0)),
-					Out = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)),
-				}).MergeTable().ToListAsync(stoppingToken);
-
-			var call24List = (from t1 in timeList
-				join t2 in call24 on t1 equals t2.Time into t1_t2
-				from item in t1_t2.DefaultIfEmpty()
-				select new { 
-					Time = t1 + ":00",
-					In = t1_t2.Select(x => x.In).FirstOrDefault() ,
-					Out = t1_t2.Select(x => x.Out).FirstOrDefault() 
-				}).ToList();
-			return call24List;
-		}
-
-		public async Task<object> GetCallTop10(CancellationToken stoppingToken)
-		{
-
-			var callTop10 = await _callRepository.Queryable()
-				.Where(x => x.CreatedTime.Date == DateTime.Now.Date
-					&& x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
-				)
-				.GroupBy(x => x.UserName)
-				.Select(x => new
-				{
-					UserName = x.UserName,
-					In = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0))
-				}).MergeTable().OrderByDescending(x => x.In).Take(10).ToListAsync(stoppingToken);
-			return callTop10;
-		}
+namespace Hotline.Application.Bigscreen;
 
-		public async Task<object> GetCallList(CancellationToken stoppingToken)
-		{
-			var callList = await _callRepository.Queryable()
-				.Where(x => x.CreatedTime.Date == DateTime.Now.Date
-                    && x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
-				)
-				.Select(x => new
-				{
-					InOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.On, 1, 0)),
-					ValidOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.On && x.Duration > 5, 1, 0)),
-					InNoOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.NoOn, 1, 0)),
-					OutOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out && x.OnState == Share.Enums.CallCenter.EOnState.On, 1, 0)),
-					InQueueNoOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.NoOn && x.QueueTims > 0, 1, 0)),
-				}).MergeTable().ToListAsync(stoppingToken);
-			return callList;
-		}
-
-		public async Task<object> GetCallAverage(CancellationToken stoppingToken)
-		{
-			List<string> timeList = new List<string>();
-			for (int i = 0; i < 24; i++)
-			{
-				var time = i < 10 ? $"0{i}" : i.ToString();
-				timeList.Add(time);
-			}
-			var callAverage = await _callRepository.Queryable()
-				.Where(x => x.CreatedTime.Date == DateTime.Now.Date
-                    && x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
-				)
-				.Select(x => new { time = x.CreatedTime.ToString("hh"), x.CallDirection }).MergeTable()
-				.GroupBy(x => x.time)
-				.Select(x => new
-				{
-					Time = x.time.ToString(),
-					In = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0)),
-					InAverag = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0)) / 60,
-					Out = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)),
-					OutAverag = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)) / 60,
-				}).MergeTable().ToListAsync(stoppingToken);
-			var callAverageList = (from t1 in timeList
-				join t2 in callAverage on t1 equals t2.Time into t1_t2
-				from item in t1_t2.DefaultIfEmpty()
-				select new {
-					Time = t1 + ":00",
-					In = t1_t2.Select(x => x.In).FirstOrDefault(),
-					InAverag = t1_t2.Select(x => x.InAverag).FirstOrDefault(),
-					Out = t1_t2.Select(x => x.Out).FirstOrDefault(),
-					OutAverag = t1_t2.Select(x => x.OutAverag).FirstOrDefault() 
-				}).ToList();
-			return callAverageList;
-		}
-
-
-	}
+[Injection(AppScopes = EAppScope.ZiGong | EAppScope.LuZhou)]
+public class SeatStateDataService : SeatStateDataServiceBase, ISeatStateDataService, IScopeDependency
+{
+    public SeatStateDataService(IRepository<CallNative> repository) : base(repository)
+    {
+    }
 }

+ 128 - 0
src/Hotline.Application/Bigscreen/SeatStateDataServiceBase.cs

@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Hotline.CallCenter.Calls;
+using Hotline.Orders;
+using SqlSugar;
+using XF.Domain.Dependency;
+using XF.Domain.Repository;
+
+namespace Hotline.Application.Bigscreen
+{
+    public abstract class SeatStateDataServiceBase
+    {
+        private readonly IRepository<CallNative> _callRepository;
+
+        public SeatStateDataServiceBase(IRepository<CallNative> callRepository)
+        {
+            _callRepository = callRepository;
+        }
+
+        public virtual async Task<object> GetCall24(CancellationToken stoppingToken)
+        {
+            List<string> timeList = new List<string>();
+            for (int i = 0;i < 24;i++)
+            {
+                var time = i < 10 ? $"0{i}" : i.ToString();
+                timeList.Add(time);
+            }
+            var call24 = await _callRepository.Queryable()
+                .LeftJoin<Order>((x, o) => x.Id == o.CallId)
+                .Where((x, o) => x.CreationTime.Date == DateTime.Now.Date
+                    && string.IsNullOrEmpty(o.Id) == false
+                )
+                .Select(x => new { time = x.CreationTime.ToString("hh"), x.Direction }).MergeTable()
+                .GroupBy(x => x.time)
+                .Select(x => new
+                {
+                    Time = x.time.ToString(),
+                    In = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In, 1, 0)),
+                    Out = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)),
+                }).MergeTable().ToListAsync(stoppingToken);
+
+            var call24List = (from t1 in timeList
+                              join t2 in call24 on t1 equals t2.Time into t1_t2
+                              from item in t1_t2.DefaultIfEmpty()
+                              select new
+                              {
+                                  Time = t1 + ":00",
+                                  In = t1_t2.Select(x => x.In).FirstOrDefault(),
+                                  Out = t1_t2.Select(x => x.Out).FirstOrDefault()
+                              }).ToList();
+            return call24List;
+        }
+
+        public virtual async Task<object> GetCallTop10(CancellationToken stoppingToken)
+        {
+            var callTop10 = await _callRepository.Queryable()
+                .LeftJoin<Order>((x, o) => x.Id == o.CallId)
+                .Where((x, o) => x.CreationTime.Date == DateTime.Now.Date
+                    && string.IsNullOrEmpty(o.Id) == false
+                )
+                .GroupBy(x => x.UserName)
+                .Select(x => new
+                {
+                    UserName = x.UserName,
+                    In = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In, 1, 0))
+                }).MergeTable().OrderByDescending(x => x.In).Take(10).ToListAsync(stoppingToken);
+            return callTop10;
+        }
+
+        public virtual async Task<object> GetCallList(CancellationToken stoppingToken)
+        {
+            var callList = await _callRepository.Queryable()
+                .LeftJoin<Order>((x, o) => x.Id == o.CallId)
+                .Where((x, o) => x.CreationTime.Date == DateTime.Now.Date
+                    && string.IsNullOrEmpty(o.Id) == false
+                )
+                .Select(x => new
+                {
+                    InOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In && x.AnsweredTime != null, 1, 0)),
+                    ValidOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In && x.AnsweredTime != null && x.Duration > 5, 1, 0)),
+                    InNoOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In && x.AnsweredTime == null, 1, 0)),
+                    OutOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.Out && x.AnsweredTime != null, 1, 0)),
+                    InQueueNoOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In && x.AnsweredTime == null && x.WaitDuration > 0, 1, 0)),
+                }).MergeTable().ToListAsync(stoppingToken);
+            return callList;
+        }
+
+        public virtual async Task<object> GetCallAverage(CancellationToken stoppingToken)
+        {
+            List<string> timeList = new List<string>();
+            for (int i = 0;i < 24;i++)
+            {
+                var time = i < 10 ? $"0{i}" : i.ToString();
+                timeList.Add(time);
+            }
+            var callAverage = await _callRepository.Queryable()
+                .LeftJoin<Order>((x, o) => x.Id == o.CallId)
+                .Where((x, o) => x.CreationTime.Date == DateTime.Now.Date
+                    && string.IsNullOrEmpty(o.Id) == false
+                )
+                .Select(x => new { time = x.CreationTime.ToString("hh"), x.Direction }).MergeTable()
+                .GroupBy(x => x.time)
+                .Select(x => new
+                {
+                    Time = x.time.ToString(),
+                    In = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In, 1, 0)),
+                    InAverag = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.In, 1, 0)) / 60,
+                    Out = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)),
+                    OutAverag = SqlFunc.AggregateSum(SqlFunc.IIF(x.Direction == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)) / 60,
+                }).MergeTable().ToListAsync(stoppingToken);
+            var callAverageList = (from t1 in timeList
+                                   join t2 in callAverage on t1 equals t2.Time into t1_t2
+                                   from item in t1_t2.DefaultIfEmpty()
+                                   select new
+                                   {
+                                       Time = t1 + ":00",
+                                       In = t1_t2.Select(x => x.In).FirstOrDefault(),
+                                       InAverag = t1_t2.Select(x => x.InAverag).FirstOrDefault(),
+                                       Out = t1_t2.Select(x => x.Out).FirstOrDefault(),
+                                       OutAverag = t1_t2.Select(x => x.OutAverag).FirstOrDefault()
+                                   }).ToList();
+            return callAverageList;
+        }
+    }
+}

+ 124 - 0
src/Hotline.Application/Bigscreen/YiBinSeatStateDataService.cs

@@ -0,0 +1,124 @@
+using Hotline.CallCenter.Calls;
+using Hotline.DI;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Dependency;
+using XF.Domain.Repository;
+
+namespace Hotline.Application.Bigscreen;
+
+[Injection(AppScopes = EAppScope.YiBin)]
+public class YiBinSeatStateDataService : SeatStateDataServiceBase, ISeatStateDataService, IScopeDependency
+{
+    private readonly IRepository<TrCallRecord> _callRepository;
+    public YiBinSeatStateDataService(IRepository<TrCallRecord> callRepository, IRepository<CallNative> repository) : base(repository)
+    {
+        _callRepository = callRepository;
+    }
+
+    public override async Task<object> GetCall24(CancellationToken stoppingToken)
+    {
+        List<string> timeList = new List<string>();
+        for (int i = 0;i < 24;i++)
+        {
+            var time = i < 10 ? $"0{i}" : i.ToString();
+            timeList.Add(time);
+        }
+        var call24 = await _callRepository.Queryable()
+            .Where(x => x.CreatedTime.Date == DateTime.Now.Date
+                && x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
+            )
+            .Select(x => new { time = x.CreatedTime.ToString("hh"), x.CallDirection }).MergeTable()
+            .GroupBy(x => x.time)
+            .Select(x => new
+            {
+                Time = x.time.ToString(),
+                In = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0)),
+                Out = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)),
+            }).MergeTable().ToListAsync(stoppingToken);
+
+        var call24List = (from t1 in timeList
+                          join t2 in call24 on t1 equals t2.Time into t1_t2
+                          from item in t1_t2.DefaultIfEmpty()
+                          select new
+                          {
+                              Time = t1 + ":00",
+                              In = t1_t2.Select(x => x.In).FirstOrDefault(),
+                              Out = t1_t2.Select(x => x.Out).FirstOrDefault()
+                          }).ToList();
+        return call24List;
+    }
+
+    public override async Task<object> GetCallTop10(CancellationToken stoppingToken)
+    {
+
+        var callTop10 = await _callRepository.Queryable()
+            .Where(x => x.CreatedTime.Date == DateTime.Now.Date
+                && x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
+            )
+            .GroupBy(x => x.UserName)
+            .Select(x => new
+            {
+                UserName = x.UserName,
+                In = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0))
+            }).MergeTable().OrderByDescending(x => x.In).Take(10).ToListAsync(stoppingToken);
+        return callTop10;
+    }
+
+    public override async Task<object> GetCallList(CancellationToken stoppingToken)
+    {
+        var callList = await _callRepository.Queryable()
+            .Where(x => x.CreatedTime.Date == DateTime.Now.Date
+                && x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
+            )
+            .Select(x => new
+            {
+                InOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.On, 1, 0)),
+                ValidOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.On && x.Duration > 5, 1, 0)),
+                InNoOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.NoOn, 1, 0)),
+                OutOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out && x.OnState == Share.Enums.CallCenter.EOnState.On, 1, 0)),
+                InQueueNoOn = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In && x.OnState == Share.Enums.CallCenter.EOnState.NoOn && x.QueueTims > 0, 1, 0)),
+            }).MergeTable().ToListAsync(stoppingToken);
+        return callList;
+    }
+
+    public override async Task<object> GetCallAverage(CancellationToken stoppingToken)
+    {
+        List<string> timeList = new List<string>();
+        for (int i = 0;i < 24;i++)
+        {
+            var time = i < 10 ? $"0{i}" : i.ToString();
+            timeList.Add(time);
+        }
+        var callAverage = await _callRepository.Queryable()
+            .Where(x => x.CreatedTime.Date == DateTime.Now.Date
+                && x.CallOrderType == Share.Enums.CallCenter.ECallOrderType.Order
+            )
+            .Select(x => new { time = x.CreatedTime.ToString("hh"), x.CallDirection }).MergeTable()
+            .GroupBy(x => x.time)
+            .Select(x => new
+            {
+                Time = x.time.ToString(),
+                In = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0)),
+                InAverag = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.In, 1, 0)) / 60,
+                Out = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)),
+                OutAverag = SqlFunc.AggregateSum(SqlFunc.IIF(x.CallDirection == Share.Enums.CallCenter.ECallDirection.Out, 1, 0)) / 60,
+            }).MergeTable().ToListAsync(stoppingToken);
+        var callAverageList = (from t1 in timeList
+                               join t2 in callAverage on t1 equals t2.Time into t1_t2
+                               from item in t1_t2.DefaultIfEmpty()
+                               select new
+                               {
+                                   Time = t1 + ":00",
+                                   In = t1_t2.Select(x => x.In).FirstOrDefault(),
+                                   InAverag = t1_t2.Select(x => x.InAverag).FirstOrDefault(),
+                                   Out = t1_t2.Select(x => x.Out).FirstOrDefault(),
+                                   OutAverag = t1_t2.Select(x => x.OutAverag).FirstOrDefault()
+                               }).ToList();
+        return callAverageList;
+    }
+}

+ 1 - 0
src/Hotline.Application/Hotline.Application.csproj

@@ -22,6 +22,7 @@
     <ProjectReference Include="..\Hotline.NewRock\Hotline.NewRock.csproj" />
     <ProjectReference Include="..\Hotline.Repository.SqlSugar\Hotline.Repository.SqlSugar.csproj" />
     <ProjectReference Include="..\Hotline.Wex\Hotline.Wex.csproj" />
+    <ProjectReference Include="..\Hotline.XingTang\Hotline.XingTang.csproj" />
     <ProjectReference Include="..\Hotline.YbEnterprise.Sdk\Hotline.YbEnterprise.Sdk.csproj" />
     <ProjectReference Include="..\Hotline\Hotline.csproj" />
     <ProjectReference Include="..\Tr.Sdk\Tr.Sdk.csproj" />

+ 5 - 0
src/Hotline.Application/Mappers/MapperConfigs.cs

@@ -1,4 +1,5 @@
 using Hotline.CallCenter.BlackLists;
+using Hotline.CallCenter.Tels.CallTelDomain;
 using Hotline.Import;
 using Hotline.JudicialManagement;
 using Hotline.Orders;
@@ -44,6 +45,10 @@ namespace Hotline.Application.Mappers
                 .Map(m => m.TelPwd, x => x.Password)
                 .Map(m =>m.Queue, x => x.QueueId);
 
+            config.ForType<QueryTelResponse, TelOutDto>()
+                .Map(m => m.TelPwd, x => x.Password)
+                .Map(m => m.Queue, x => x.QueueId);
+
             config.ForType<ExcelContent, Order>()
                 .Map(d => d.FirstVisitResult, x => x.VisitResult)
                 .IgnoreNullValues(true);

+ 12 - 0
src/Hotline.XingTang/CallTelClient.cs

@@ -0,0 +1,12 @@
+using Hotline.CallCenter.Tels;
+using Hotline.CallCenter.Tels.CallTelDomain;
+
+namespace Hotline.XingTang;
+
+internal class CallTelClient : ICallTelClient
+{
+    public async Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken)
+    {
+        return new List<QueryTelResponse>();
+    }
+}

+ 17 - 0
src/Hotline.XingTang/ServiceCollectionExtensions.cs

@@ -0,0 +1,17 @@
+using Hotline.CallCenter.Tels;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.XingTang;
+public static class ServiceCollectionExtensions
+{
+    public static IServiceCollection AddXingTangSDK(this IServiceCollection services)
+    {
+        services.AddScoped<ICallTelClient, CallTelClient>();
+        return services;
+    }
+}

+ 17 - 0
src/Hotline/CallCenter/Tels/CallTelDomain/QueryTelRequest.cs

@@ -0,0 +1,17 @@
+using RestSharp;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.CallCenter.Tels.CallTelDomain;
+public class QueryTelRequest
+{
+    /// <summary>
+    /// 分机号
+    /// </summary>
+    [RequestProperty(Name = "extn")]
+    public string? TelNo { get; set; }
+
+}

+ 23 - 0
src/Hotline/CallCenter/Tels/CallTelDomain/QueryTelResponse.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json.Serialization;
+using System.Threading.Tasks;
+
+namespace Hotline.CallCenter.Tels.CallTelDomain;
+public class QueryTelResponse
+{
+    [JsonPropertyName("uuid")]
+    public string Id { get; set; }
+    public string Name { get; set; }
+    [JsonPropertyName("nbr")]
+    public string TelNo { get; set; }
+    public string Description { get; set; }
+
+    public string Password { get; set; }
+
+    [JsonPropertyName("queue_id")]
+    public string QueueId { get; set; }
+
+}

+ 12 - 0
src/Hotline/CallCenter/Tels/ICallTelClient.cs

@@ -0,0 +1,12 @@
+using Hotline.CallCenter.Tels.CallTelDomain;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.CallCenter.Tels;
+public interface ICallTelClient
+{
+    Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken);
+}

+ 25 - 0
src/Tr.Sdk/CallTelClient.cs

@@ -0,0 +1,25 @@
+using Hotline.CallCenter.Tels;
+using Hotline.CallCenter.Tels.CallTelDomain;
+using Mapster;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tr.Sdk;
+public class CallTelClient : ICallTelClient
+{
+    private readonly ITrClient _trClient;
+
+    public CallTelClient(ITrClient trClient)
+    {
+        _trClient = trClient;
+    }
+
+    public async Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken)
+    {
+        var result = await _trClient.QueryTelsAsync(request.Adapt<Tels.QueryTelRequest>(), cancellationToken);
+        return result.Adapt<List<QueryTelResponse>>();
+    }
+}

+ 5 - 1
src/Tr.Sdk/Tr.Sdk.csproj

@@ -8,8 +8,12 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
-    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
     <PackageReference Include="RestSharp" Version="110.2.0" />
   </ItemGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\Hotline\Hotline.csproj" />
+  </ItemGroup>
+
 </Project>

+ 3 - 1
src/Tr.Sdk/TrSdkStartupExtensions.cs

@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using Hotline.CallCenter.Tels;
+using Microsoft.Extensions.DependencyInjection;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -12,6 +13,7 @@ namespace Tr.Sdk
         public static IServiceCollection AddTrSdk(this IServiceCollection services, string baseUrl, string apiKey, string apiSecret)
         {
             services.AddSingleton<ITrClient, TrClient>(_ => new TrClient(baseUrl, apiKey, apiSecret));
+            services.AddScoped<ICallTelClient, CallTelClient>();
             return services;
         }
     }