Bläddra i källkod

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

田爽 5 månader sedan
förälder
incheckning
1b458a0761

+ 3 - 2
NuGet.Config

@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <packageSources>
-    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
-    <add key="fengwo.org" value="http://110.188.24.182:5555/v3/index.json" />
+    <clear />
+    <add key="nuget.org" value="https://api.nuget.org/v3/index.json"  protocolVersion="3"/>
+    <add key="fengwo.org" value="http://110.188.24.182:5555/v3/index.json" allowInsecureConnections="true"/>
   </packageSources>
 </configuration>

+ 2 - 1
src/Hotline.Application.Tests/Application/SystemSettingCacheManagerTest.cs

@@ -24,6 +24,8 @@ public class SystemSettingCacheManagerTest
     [Fact]
     public void CancelPublishOrderEnabled_Test()
     {
+        var dd = DateTime.Parse("11/19/2024 18:08:00");
+        _systemSettingCacheManager.CallSyncUnPushDateTime.ShouldBe(DateTime.Parse("2024/11/19 18:08:00"));
         var result = _systemSettingCacheManager.CancelPublishOrderEnabled;
         result.ShouldBeTrue();
         var seconds = _systemSettingCacheManager.VisitCallDelaySecond;
@@ -34,7 +36,6 @@ public class SystemSettingCacheManagerTest
         var delaySecondEntity = _systemSettingRepository.GetAsync("08dc0681-a6d2-4ce7-877d-db65f846d523");
         delaySecondEntity.ShouldNotBeNull("DefaultVisitSmsDelaySecond 系统设置为NULL");
 
-        _systemSettingCacheManager.CallSyncUnPushDateTime.ShouldBe(DateTime.Parse("2024/11/19 18:08:00"));
         _systemSettingCacheManager.GetAboutToExpireVersion.ShouldBe(0);
     }
 }

+ 6 - 1
src/Hotline.Application.Tests/Controller/OrderControllerTest.cs

@@ -133,7 +133,7 @@ public class OrderControllerTest : TestBase
     }
 
     /// <summary>
-    /// 验证中心直办工单归档后自动发布
+    /// 验证中心直办工单归档后 自动发布
     /// 是否推诿, 是否不积极
     /// </summary>
     /// <returns></returns>
@@ -155,6 +155,11 @@ public class OrderControllerTest : TestBase
         orderEntity.ShouldNotBeNull();
         orderEntity.IsEvasive.ShouldBeTrue();
         orderEntity.IsInactively.ShouldBeTrue();
+        orderEntity.Status.ShouldBe(EOrderStatus.Visited);
+        orderEntity.OrgProcessingResults.ShouldNotBeNull();
+        orderEntity.OrgProcessingResults.Key.ShouldBe("4");
+        orderEntity.OrgProcessingResults.Value.ShouldBe("满意");
+        orderEntity.SeatEvaluate.ShouldBe(ESeatEvaluate.Satisfied);
     }
 
     [Fact]

+ 1 - 0
src/Hotline.Application.Tests/Domain/OrderVisitDomainServiceTest.cs

@@ -153,6 +153,7 @@ public class OrderVisitDomainServiceTest : TestBase
                 org.OrgProcessingResults.Key.ShouldBe(orgResuktKey);
                 org.OrgProcessingResults.Value.ShouldBe(orgResuktValue);
 
+                // 验证跟新工单上的字段是否成功
                 orderEntity.OrgProcessingResults.ShouldNotBeNull();
                 orderEntity.OrgProcessingResults.Key.ShouldBe(orgResuktKey);
                 orderEntity.OrgProcessingResults.Value.ShouldBe(orgResuktValue);

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

@@ -499,35 +499,34 @@ public abstract class DefaultCallApplication : ICallApplication
     /// <returns></returns>
     public virtual async Task OrderRelateCallHandlerAsync(string orderId, CancellationToken cancellationToken)
     {
-        _systemLogRepository.Add("延迟更新工单通话", orderId, $"收到消息", status: 1);
-        var callId = await _orderRepository.Queryable()
-            .Where(m => m.Id == orderId)
-            .Select(m => m.CallId)
-            .FirstAsync(cancellationToken);
-        if (callId.IsNullOrEmpty()) return;
-
-        var callNo = await _callNativeRepository.Queryable()
-            .Where(m => m.Id == callId)
-            .Select(m => m.CallNo)
+        var orderCall = await _orderRepository.Queryable()
+            .LeftJoin<CallNative>((o, c) => o.CallId == c.Id)
+            .Where((o, c) => o.Id == orderId)
+            .Select((o, c) => new { o.CallId, c.CallNo })
             .FirstAsync(cancellationToken);
-        if (callNo.IsNullOrEmpty()) return;
-
-        var callNative = await _callNativeRepository.Queryable()
-            .Where(m => m.CallNo == callNo)
-            .ToListAsync(cancellationToken);
+        if (orderCall is null || orderCall.CallNo.IsNullOrEmpty())
+        {
+            _logger.LogError($"延迟更新工单通话, 工单: {orderId} 根据 order.id left join call_native 信息为空;");
+            return;
+        }
 
-        var call = callNative.Where(m => m.Direction == ECallDirection.In)
+        var call = await _callNativeRepository.Queryable()
+            .Where(m => m.CallNo == orderCall.CallNo && m.Direction == ECallDirection.In)
             .OrderByDescending(m => m.Duration)
-            .First();
+            .FirstAsync(cancellationToken);
+        if (call == null)
+        {
+            _logger.LogError($"延迟更新工单通话, 工单: {orderId} 根据 CallNo: {orderCall.CallNo} direction = 0 查询 call_native 信息为空;");
+            return;
+        }
 
-        // 只有一条通话记录, 不处理
         // 需要更新的callId 和 order.callId 相同, 不处理
-        if (callNative.Count < 2 || callId == call.Id)
+        if (orderCall.CallId == call.Id)
         {
             // 推省上
             await _capPublisher.PublishAsync(EventNames.HotlineCallConnectWithOrder, new PublishCallRecrodDto()
             {
-                Order = _orderRepository.GetAsync(orderId, cancellationToken).Adapt<OrderDto>(),
+                Order = (await _orderRepository.GetAsync(orderId, cancellationToken)).Adapt<OrderDto>(),
                 TrCallRecordDto = call.Adapt<TrCallDto>()
             }, cancellationToken: cancellationToken);
             return;
@@ -540,16 +539,16 @@ public abstract class DefaultCallApplication : ICallApplication
 
         await _callIdRelationRepository.Updateable()
             .SetColumns(m => m.CallId == call.Id)
-            .Where(m => m.Id == callNo)
+            .Where(m => m.Id == orderCall.CallId)
             .ExecuteCommandAsync(cancellationToken);
 
         // 推省上
         await _capPublisher.PublishAsync(EventNames.HotlineCallConnectWithOrder, new PublishCallRecrodDto()
         {
-            Order = _orderRepository.GetAsync(orderId, cancellationToken).Adapt<OrderDto>(),
+            Order = (await _orderRepository.GetAsync(orderId, cancellationToken)).Adapt<OrderDto>(),
             TrCallRecordDto = call.Adapt<TrCallDto>()
         }, cancellationToken: cancellationToken);
-        _systemLogRepository.Add("延迟更新工单通话", orderId, $"原CallId: {callId}, 更新CallId: {call.Id}", status: 1);
+        _systemLogRepository.Add("延迟更新工单通话", orderId, $"原CallId: {orderCall.CallId}, 更新CallId: {call.Id}", status: 1);
     }
 
     /// <summary>

+ 2 - 1
src/Hotline/Orders/OrderDomainService.cs

@@ -33,6 +33,7 @@ using Microsoft.AspNetCore.Builder.Extensions;
 using Hotline.Configurations;
 using Microsoft.Extensions.Options;
 using Hotline.Share.Tools;
+using Hotline.Orders.Notifications;
 
 namespace Hotline.Orders;
 
@@ -274,7 +275,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         await _orderVisitDetailRepository.AddRangeAsync(visitedDetail, cancellationToken);
         await _publisher.PublishAsync(new ContingencyManagementNotify(order, order.Title, order.Content, order.ActualOpinion),
     PublishStrategy.ParallelWhenAll, cancellationToken);
-
+        await _publisher.PublishAsync(new UpdateOrderVisitNotify(orderVisit.Adapt<OrderVisitNotifyDto>()), cancellationToken);
 
         if (order.IsProvince == false && orderVisit.VisitState == EVisitState.Visited)
         {

+ 1 - 2
src/Hotline/Orders/OrderVisitDomainService.cs

@@ -43,7 +43,6 @@ public class OrderVisitDomainService : IOrderVisitDomainService, IScopeDependenc
     /// <returns></returns>
     public async Task UpdateSmsReplyAsync(MessageDto data)
     {
-        _logger.LogInformation($"UpdateSmsReplyAsync 收到通知: {data.ToJson()}");
         if (data.IsSmsReply == false || data.SmsReplyContent.IsNullOrEmpty()) return;
 
         var orderVisits = await _orderVisitRepository.Queryable()
@@ -51,7 +50,7 @@ public class OrderVisitDomainService : IOrderVisitDomainService, IScopeDependenc
             .Where(m => m.Order.Contact == data.TelNumber)
             .Where(m => m.VisitState == EVisitState.SMSVisiting)
             .ToListAsync();
-
+            
         foreach (var orderVisit in orderVisits)
         {
             await UpdateSmsReplyAsync(orderVisit, data.SmsReplyContent!.Trim());

+ 1 - 2
src/Hotline/Push/FWMessage/PushDomainService.cs

@@ -130,7 +130,6 @@ public class PushDomainService : IPushDomainService, IScopeDependency
     /// <returns></returns>
     public async Task PushMsgUpdateStateAsync(PushReceiveMessageDto dto, CancellationToken cancellation)
     {
-        _logger.LogInformation("收到短信通知 PushMsgUpdateStateAsync");
         var data = await _messageRepository.GetAsync(p => p.Id == dto.ExternalId, cancellation);
         if (data != null)
         {
@@ -192,4 +191,4 @@ public class PushDomainService : IPushDomainService, IScopeDependency
         }
     }
     
-}
+}