Browse Source

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

Dun.Jason 8 tháng trước cách đây
mục cha
commit
e5356c9809

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

@@ -97,6 +97,19 @@ namespace Hotline.Api.Controllers
         public Task<IReadOnlyList<CallNativeDto>> QueryCallsFixed([FromQuery] QueryCallsFixedDto dto)
             => _callApplication.QueryCallsFixedAsync(dto, HttpContext.RequestAborted);
 
+        /// <summary>
+        /// 查询通话记录
+        /// </summary>
+        /// <param name="callId"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        [HttpGet("{callId}")]
+        public Task<CallNativeDto?> GetCall(string callId)
+        {
+            if (string.IsNullOrEmpty(callId)) return default;
+            return _callApplication.GetTelAsync(callId, HttpContext.RequestAborted);
+        }
+
         /// <summary>
         /// 通话记录基础数据
         /// </summary>

+ 22 - 9
src/Hotline.Application/CallCenter/DefaultCallApplication.cs

@@ -316,6 +316,19 @@ public abstract class DefaultCallApplication : ICallApplication
             .ToListAsync(cancellationToken);
     }
 
+    /// <summary>
+    /// 查询通话记录
+    /// </summary>
+    /// <param name="callId"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    public async Task<CallNativeDto?> GetTelAsync(string callId, CancellationToken cancellationToken)
+    {
+        var call = await _callNativeRepository.Queryable()
+             .FirstAsync(d => d.Id == callId, cancellationToken);
+        return _mapper.Map<CallNativeDto>(call);
+    }
+
     #region tianrun 临时方案
 
     public virtual Task<TrCallRecord?> GetTianrunCallAsync(string callId, CancellationToken cancellationToken)
@@ -329,18 +342,18 @@ public abstract class DefaultCallApplication : ICallApplication
     /// <returns></returns>
     public virtual async Task<TrCallRecord?> GetTianrunCallTransliterationAsync(string transliterationId, CancellationToken cancellationToken)
     {
-		throw new NotImplementedException();
-	}
+        throw new NotImplementedException();
+    }
 
-	public virtual async Task EditTransliterationStateAsync(string callId, ECallTransliterationState state, string transliterationId, CancellationToken cancellationToken)
+    public virtual async Task EditTransliterationStateAsync(string callId, ECallTransliterationState state, string transliterationId, CancellationToken cancellationToken)
     {
-		throw new NotImplementedException();
-	}
+        throw new NotImplementedException();
+    }
 
-	/// <summary>
-	/// 关联通话记录与order(添润)
-	/// </summary>
-	public virtual Task RelateTianrunCallWithOrderAsync(string callId, string orderId,
+    /// <summary>
+    /// 关联通话记录与order(添润)
+    /// </summary>
+    public virtual Task RelateTianrunCallWithOrderAsync(string callId, string orderId,
         CancellationToken cancellationToken)
     {
         throw new NotImplementedException();

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

@@ -139,5 +139,12 @@ namespace Hotline.Application.CallCenter
         /// <returns></returns>
         List<Kv> GetTelOperationOptions();
 
+        /// <summary>
+        /// 查询通话记录
+        /// </summary>
+        /// <param name="callId"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        Task<CallNativeDto?> GetTelAsync(string callId, CancellationToken cancellationToken);
     }
 }

+ 15 - 1
src/Hotline.Application/CallCenter/TianRunCallApplication.cs

@@ -14,6 +14,7 @@ using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Dtos.TrCallCenter;
 using Hotline.Share.Enums.CallCenter;
+using MapsterMapper;
 using Microsoft.AspNetCore.Http;
 using XF.Domain.Authentications;
 using XF.Domain.Exceptions;
@@ -28,13 +29,15 @@ namespace Hotline.Application.CallCenter
         private readonly ITrApplication _trApplication;
         private readonly ITelApplication _telApplication;
         private readonly ISystemSettingCacheManager _systemSettingCacheManager;
+        private readonly IMapper _mapper;
 
         public TianRunCallApplication(
             ISessionContext sessionContext,
             IRepository<TrCallRecord> trCallRecordRepository,
             ITrApplication trApplication,
             ITelApplication telApplication,
-            ISystemSettingCacheManager systemSettingCacheManager
+            ISystemSettingCacheManager systemSettingCacheManager,
+            IMapper mapper
         )
         {
             _sessionContext = sessionContext;
@@ -42,6 +45,7 @@ namespace Hotline.Application.CallCenter
             _trApplication = trApplication;
             _telApplication = telApplication;
             _systemSettingCacheManager = systemSettingCacheManager;
+            _mapper = mapper;
         }
 
         /// <summary>
@@ -169,5 +173,15 @@ namespace Hotline.Application.CallCenter
         {
             throw new NotImplementedException();
         }
+
+        /// <summary>
+        /// 查询通话记录
+        /// </summary>
+        public override async Task<CallNative?> GetCallAsync(string callId, CancellationToken cancellationToken)
+        {
+            var call = await _trCallRecordRepository.Queryable()
+                .FirstAsync(d => d.OtherAccept == callId, cancellationToken);
+            return _mapper.Map<CallNative>(call);
+        }
     }
 }

+ 8 - 0
src/Hotline.Application/Mappers/CallMapperConfigs.cs

@@ -117,6 +117,14 @@ namespace Hotline.Application.Mappers
                 .Map(d => d.Cpn, s => s.CPN)
                 .Map(d => d.Cdpn, s => s.CDPN)
                 ;
+
+            config.ForType<TrCallRecord, CallNative>()
+                .Map(d => d.CallNo, s => s.OtherAccept)
+                .Map(d => d.FromNo, s => s.CPN)
+                .Map(d => d.ToNo, s => s.CDPN)
+                .Map(d => d.EndRingTime, s => s.EndRingTimg)
+                .Map(d => d.AudioFile, s => s.RecordingAbsolutePath);
+
         }
 
         private DateTime? FormatDateTime(string? time)

+ 3 - 1
src/Hotline.Share/Dtos/CallCenter/CallNativeDto.cs

@@ -10,8 +10,10 @@ namespace Hotline.Share.Dtos.CallCenter
 {
     public class CallNativeDto
     {
+        public string Id { get; set; }
+
         /// <summary>
-        /// 通话记录编号
+        /// 通话记录编号(呼叫中心)
         /// </summary>
         public string CallNo { get; set; }