|
@@ -1,11 +1,15 @@
|
|
|
-using Hotline.Application.FlowEngine;
|
|
|
+using DotNetCore.CAP;
|
|
|
+using Hotline.Application.FlowEngine;
|
|
|
using Hotline.FlowEngine.Notifications;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
|
using Hotline.KnowledgeBase;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
+using Hotline.Share.Mq;
|
|
|
+using MapsterMapper;
|
|
|
using MediatR;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Newtonsoft.Json;
|
|
@@ -19,14 +23,20 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
|
|
|
private readonly IOrderDomainService _orderDomainService;
|
|
|
private readonly ILogger<NextStepHandler> _logger;
|
|
|
private readonly IKnowledgeDomainService _knowledgeDomainService;
|
|
|
+ private readonly ICapPublisher _capPublisher;
|
|
|
+ private readonly IMapper _mapper;
|
|
|
|
|
|
public NextStepHandler(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IKnowledgeDomainService knowledgeDomainService,
|
|
|
+ ICapPublisher capPublisher,
|
|
|
+ IMapper mapper,
|
|
|
ILogger<NextStepHandler> logger)
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_knowledgeDomainService = knowledgeDomainService;
|
|
|
+ _capPublisher = capPublisher;
|
|
|
+ _mapper = mapper;
|
|
|
_logger = logger;
|
|
|
}
|
|
|
|
|
@@ -44,10 +54,17 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
|
|
|
switch (workflow.ModuleCode)
|
|
|
{
|
|
|
case WorkflowModuleConsts.OrderManage:
|
|
|
- await _orderDomainService.ManageFlowNextAsync(
|
|
|
- notification.FlowAssignMode, notification.IsCountersignStart, notification.IsCountersignEnd,
|
|
|
- workflow.ExternalId, workflow.CurrentStepTime, workflow.CurrentStepName, workflow.ExpiredTime, workflow.ProcessType,
|
|
|
- cancellationToken);
|
|
|
+ var orderDto = await _orderDomainService.ManageFlowNextAsync(
|
|
|
+ notification.FlowAssignMode, notification.IsCountersignStart, notification.IsCountersignEnd,
|
|
|
+ workflow.ExternalId, workflow.CurrentStepTime, workflow.CurrentStepName, workflow.ExpiredTime, workflow.ProcessType,
|
|
|
+ cancellationToken);
|
|
|
+
|
|
|
+ await _capPublisher.PublishAsync(EventNames.HotlineOrderFlow, new OrderFlowDto
|
|
|
+ {
|
|
|
+ Order = orderDto,
|
|
|
+ WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace)
|
|
|
+ },
|
|
|
+ cancellationToken: cancellationToken);
|
|
|
break;
|
|
|
case WorkflowModuleConsts.KnowledgeAdd:
|
|
|
case WorkflowModuleConsts.KnowledgeUpdate:
|