Dun.Jason il y a 1 an
Parent
commit
6aa6ca5701

+ 16 - 6
src/Hotline.Application/Handlers/FlowEngine/WorkflowEndHandler.cs

@@ -1,6 +1,7 @@
 using DotNetCore.CAP;
 using Hotline.Application.Orders;
 using Hotline.Article;
+using Hotline.CallCenter.Calls;
 using Hotline.CallCenter.Tels;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WorkflowModules;
@@ -11,6 +12,7 @@ using Hotline.Settings.TimeLimits;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.FlowEngine.Workflow;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Dtos.TrCallCenter;
 using Hotline.Share.Enums.Order;
 using MapsterMapper;
 using MediatR;
@@ -46,8 +48,9 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
     private readonly ILogger<WorkflowEndHandler> _logger;
     private readonly IKnowledgeRepository _knowledgeRepository;
     private readonly IKnowledgeWorkFlowRepository _knowledgeWorkFlowRepository;
+    private readonly IRepository<TrCallRecord> _trCallRecordRepository;
 
-	public WorkflowEndHandler(
+    public WorkflowEndHandler(
         IKnowledgeDomainService knowledgeDomainService,
         IOrderDomainService orderDomainService,
         IOrderApplication orderApplication,
@@ -69,7 +72,8 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
         IMediator mediator,
         IKnowledgeRepository knowledgeRepository,
         IKnowledgeWorkFlowRepository knowledgeWorkFlowRepository,
-		ILogger<WorkflowEndHandler> logger)
+		ILogger<WorkflowEndHandler> logger,
+        IRepository<TrCallRecord> trCallRecordRepository)
     {
         _knowledgeDomainService = knowledgeDomainService;
         _orderDomainService = orderDomainService;
@@ -92,7 +96,8 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
         _logger = logger;
         _knowledgeRepository = knowledgeRepository;
         _knowledgeWorkFlowRepository = knowledgeWorkFlowRepository;
-	}
+        _trCallRecordRepository = trCallRecordRepository;
+    }
 
     /// <summary>Handles a notification</summary>
     /// <param name="notification">The notification</param>
@@ -144,12 +149,17 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
                     :0;
                 order.File(now, handleDuration, fileDuration, allDuration);
                 await _orderRepository.UpdateAsync(order, cancellationToken);
-
-                await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, new OrderFlowDto
+                var callRecord = await _trCallRecordRepository.GetAsync(p => p.CallAccept == order.CallId, cancellationToken);
+                var orderFlowDto = new OrderFlowDto
                 {
                     Order = _mapper.Map<OrderDto>(order),
                     WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace)
-                }, cancellationToken: cancellationToken);
+                };
+                if (callRecord!=null)
+                {
+                    orderFlowDto.TrCallRecordDto  = _mapper.Map<TrCallDto>(callRecord);
+                }
+                await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, orderFlowDto, cancellationToken: cancellationToken);
 
                 break;
             case WorkflowModuleConsts.OrderScreen:

+ 3 - 0
src/Hotline.Share/Dtos/Order/OrderFlowDto.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Hotline.Share.Dtos.FlowEngine.Workflow;
+using Hotline.Share.Dtos.TrCallCenter;
 
 namespace Hotline.Share.Dtos.Order
 {
@@ -31,5 +32,7 @@ namespace Hotline.Share.Dtos.Order
         /// 办理人部门等级
         /// </summary>
         public int HandlerOrgLevel { get; set; }
+
+        public TrCallDto? TrCallRecordDto { get; set; }
     }
 }