浏览代码

Merge branch 'dev' of http://git.12345lm.cn/Fengwo/hotline into dev

Dun.Jason 9 月之前
父节点
当前提交
0771f3fcef

+ 13 - 1
src/Hotline.Api/Controllers/CallController.cs

@@ -84,7 +84,7 @@ namespace Hotline.Api.Controllers
         /// </summary>
         /// <returns></returns>
         [HttpGet("base-data")]
-        public async Task<object> BaseData()
+        public object BaseData()
         {
             return new
             {
@@ -101,5 +101,17 @@ namespace Hotline.Api.Controllers
         [HttpGet("tel-operations-fixed")]
         public Task<IReadOnlyList<TelOperation>> QueryTelOperationsFixed([FromQuery] QueryTelOperationsFixedDto dto) => 
             _callApplication.QueryTelOperationsAsync(dto, HttpContext.RequestAborted);
+
+        /// <summary>
+        /// 查询坐席操作记录基础数据
+        /// </summary>
+        [HttpGet("base-data-tel-operation")]
+        public object BaseDataTelOperation()
+        {
+            return new
+            {
+                Operations = _callApplication.GetTelOperationOptions()
+            };
+        }
     }
 }

+ 9 - 9
src/Hotline.Api/StartupHelper.cs

@@ -263,18 +263,18 @@ namespace Hotline.Api
                 switch (callCenterConfiguration.CallCenterType)
                 {
                     case AppDefaults.CallCenterType.XingTang:
-                        var getCallsJobKey = new JobKey(nameof(XingTangCallsSyncJob));
-                        d.AddJob<XingTangCallsSyncJob>(getCallsJobKey);
-                        d.AddTrigger(d => d
-                            .WithIdentity("get-callsxt-trigger")
-                            .ForJob(getCallsJobKey)
-                            .StartNow()
-                            .WithCronSchedule("0/5 * * * * ?")
-                        );
+                        // var getCallsJobKey = new JobKey(nameof(XingTangCallsSyncJob));
+                        // d.AddJob<XingTangCallsSyncJob>(getCallsJobKey);
+                        // d.AddTrigger(t => t
+                        //     .WithIdentity("get-callsxt-trigger")
+                        //     .ForJob(getCallsJobKey)
+                        //     .StartNow()
+                        //     .WithCronSchedule("0/5 * * * * ?")
+                        // );
 
                         var getOperationsJobKey = new JobKey(nameof(XingTangTelOperationSyncJob));
                         d.AddJob<XingTangTelOperationSyncJob>(getOperationsJobKey);
-                        d.AddTrigger(d => d
+                        d.AddTrigger(t => t
                             .WithIdentity("get-operationsxt-trigger")
                             .ForJob(getOperationsJobKey)
                             .StartNow()

+ 12 - 0
src/Hotline.Application/CallCenter/DefaultCallApplication.cs

@@ -4,6 +4,7 @@ using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Tels;
 using Hotline.Orders;
 using Hotline.Repository.SqlSugar.Extensions;
+using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Dtos.TrCallCenter;
 using Hotline.Share.Enums.CallCenter;
@@ -216,6 +217,7 @@ public abstract class DefaultCallApplication : ICallApplication
             .WhereIF(dto.Direction != null, d => d.Direction == dto.Direction)
             .WhereIF(dto.WaitDurationStart != null && dto.WaitDurationStart > 0, d => d.WaitDuration >= dto.WaitDurationStart)
             .WhereIF(dto.WaitDurationEnd != null && dto.WaitDurationEnd > 0, d => d.WaitDuration <= dto.WaitDurationEnd)
+            .OrderByDescending(d=>d.Id)
             .Select((d, o) => new CallNativeDto
             {
                 OrderId = o.Id,
@@ -235,6 +237,7 @@ public abstract class DefaultCallApplication : ICallApplication
             .WhereIF(!string.IsNullOrEmpty(dto.StaffNo), d => d.StaffNo == dto.StaffNo)
             .WhereIF(!string.IsNullOrEmpty(dto.GroupId), d => d.GroupId == dto.GroupId)
             .WhereIF(dto.OperateState != null, d => d.OperateState == dto.OperateState)
+            .OrderByDescending(d=>d.Id)
             .ToFixedListAsync(dto, cancellationToken);
     }
 
@@ -358,5 +361,14 @@ public abstract class DefaultCallApplication : ICallApplication
         throw new NotImplementedException();
     }
 
+    /// <summary>
+    /// 查询分机操作选项
+    /// </summary>
+    /// <returns></returns>
+    public List<Kv> GetTelOperationOptions()
+    {
+        throw new NotImplementedException();
+    }
+
     #endregion
 }

+ 7 - 1
src/Hotline.Application/CallCenter/ICallApplication.cs

@@ -116,12 +116,18 @@ namespace Hotline.Application.CallCenter
         /// 查询通话记录
         /// </summary>
         Task<List<TrCallRecord>> QueryTianrunCallsAsync(
-            string? phone = null, 
+            string? phone = null,
             ECallDirection? direction = null,
             DateTime? callStartTimeStart = null,
             DateTime? callStartTimeEnd = null,
             CancellationToken cancellationToken = default);
 
         #endregion
+
+        /// <summary>
+        /// 查询分机操作选项
+        /// </summary>
+        /// <returns></returns>
+        List<Kv> GetTelOperationOptions();
     }
 }

+ 10 - 1
src/Hotline.Application/CallCenter/XingTangCallApplication.cs

@@ -27,6 +27,7 @@ using XF.Domain.Authentications;
 using XF.Domain.Cache;
 using XF.Domain.Exceptions;
 using XF.Domain.Repository;
+using XingTang.Sdk;
 
 namespace Hotline.Application.CallCenter
 {
@@ -375,6 +376,14 @@ namespace Hotline.Application.CallCenter
             throw new NotImplementedException();
         }
 
-       
+        /// <summary>
+        /// 查询分机操作选项
+        /// </summary>
+        /// <returns></returns>
+        public new List<Kv> GetTelOperationOptions()
+        {
+            var operations = XingtangSeatOperation.OperationDictionary.ToList();
+            return operations.Select(d => new Kv(d.Key.ToString(), d.Value)).ToList();
+        }
     }
 }

+ 2 - 2
src/Hotline.Repository.SqlSugar/Extensions/SqlSugarStartupExtensions.cs

@@ -207,8 +207,8 @@ namespace Hotline.Repository.SqlSugar.Extensions
             /***写AOP等方法***/
             db.Aop.OnLogExecuting = (sql, pars) =>
             {
-                Log.Information("Sql: {0}", sql);
-                Log.Information("SqlParameters: {0}", string.Join(',', pars.Select(d => d.Value)));
+                // Log.Information("Sql: {0}", sql);
+                // Log.Information("SqlParameters: {0}", string.Join(',', pars.Select(d => d.Value)));
             };
             db.Aop.OnError = (exp) =>//SQL报错
             {

+ 14 - 13
src/XingTang.Sdk/XingtangSeatOperation.cs

@@ -32,19 +32,9 @@ namespace XingTang.Sdk
         /// </summary>
         public int? ExecutionState { get; set; }
 
-        [SugarColumn(IsIgnore = true)]
+        [SugarColumn(IsIgnore = true)] 
         public string? ExtutionStateText => ExecutionState.HasValue
-            ? ExecutionState switch
-            {
-                0 => "签入",
-                1 => "接听",
-                2 => "置忙",
-                3 => "置闲",
-                16 => "签出",
-                17 => "呼出",
-                30 => "挂机",
-                _ => "未知"
-            }
+            ? OperationDictionary[ExecutionState.Value]
             : string.Empty;
 
         /// <summary>
@@ -80,5 +70,16 @@ namespace XingTang.Sdk
         public string Ver { get; set; }
 
         #endregion
+        
+        public static Dictionary<int, string> OperationDictionary = new()
+        {
+            { 0, "签入" },
+            { 1, "接听" },
+            { 2, "置忙" },
+            { 3, "置闲" },
+            { 16, "签出" },
+            { 17, "呼出" },
+            { 30, "挂机" },
+        };
     }
-}
+}