EndWorkflowHandler.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Hotline.FlowEngine.Notifies;
  2. using Hotline.KnowledgeBase;
  3. using Hotline.Settings;
  4. using Hotline.Share.Enums.Order;
  5. using MediatR;
  6. namespace Hotline.Application.Handlers.FlowEngine;
  7. public class EndWorkflowHandler : INotificationHandler<EndWorkflowNotify>
  8. {
  9. private readonly KnowledgeDomainService _knowledgeDomainService;
  10. public EndWorkflowHandler(KnowledgeDomainService knowledgeDomainService)
  11. {
  12. _knowledgeDomainService = knowledgeDomainService;
  13. }
  14. /// <summary>Handles a notification</summary>
  15. /// <param name="notification">The notification</param>
  16. /// <param name="cancellationToken">Cancellation token</param>
  17. public async Task Handle(EndWorkflowNotify notification, CancellationToken cancellationToken)
  18. {
  19. var workflow = notification.Workflow;
  20. switch (workflow.ModuleCode)
  21. {
  22. case WorkflowModuleConsts.KnowledgeAdd://新增
  23. case WorkflowModuleConsts.KnowledgeUpdate://修改
  24. case WorkflowModuleConsts.KnowledgeDelete://删除
  25. await _knowledgeDomainService.EndWorkKnowledge(workflow, cancellationToken);
  26. break;
  27. case WorkflowModuleConsts.TelRestApply:
  28. //TODO 审核通过
  29. //notification.Workflow.ExternalId;
  30. break;
  31. }
  32. }
  33. }