浏览代码

add: 增加系统参数“工单特提至坐席是否指派给选择对象”

xf 11 月之前
父节点
当前提交
e9f3c46716

+ 20 - 2
src/Hotline.Application/Handlers/FlowEngine/WorkflowRecallHandler.cs

@@ -1,4 +1,5 @@
 using DotNetCore.CAP;
+using Hotline.Caching.Interfaces;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WorkflowModules;
 using Hotline.FlowEngine.Workflows;
@@ -10,6 +11,7 @@ using Hotline.Share.Enums.Order;
 using MapsterMapper;
 using MediatR;
 using Microsoft.Extensions.Logging;
+using XF.Domain.Constants;
 
 namespace Hotline.Application.Handlers.FlowEngine;
 
@@ -19,6 +21,7 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
     private readonly IOrderRepository _orderRepository;
     private readonly IWorkflowDomainService _workflowDomainService;
     private readonly ITimeLimitDomainService _timeLimitDomainService;
+    private readonly ISystemSettingCacheManager _systemSettingCacheManager;
     private readonly ICapPublisher _capPublisher;
     private readonly IMapper _mapper;
     private readonly ILogger<WorkflowRecallHandler> _logger;
@@ -28,6 +31,7 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
         IOrderRepository orderRepository,
         IWorkflowDomainService workflowDomainService,
         ITimeLimitDomainService timeLimitDomainService,
+        ISystemSettingCacheManager systemSettingCacheManager,
         ICapPublisher capPublisher,
         IMapper mapper,
         ILogger<WorkflowRecallHandler> logger)
@@ -36,6 +40,7 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
         _orderRepository = orderRepository;
         _workflowDomainService = workflowDomainService;
         _timeLimitDomainService = timeLimitDomainService;
+        _systemSettingCacheManager = systemSettingCacheManager;
         _capPublisher = capPublisher;
         _mapper = mapper;
         _logger = logger;
@@ -57,11 +62,24 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
                 _mapper.Map(workflow, order);
                 if (notification.TargetStep.StepType is EStepType.Start)
                 {
+                    var isRecallToSeatDesignated = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.IsRecallToSeatDesignated).SettingValue[0]);
                     order.Status = EOrderStatus.SpecialToUnAccept;
-                    order.BackToUnsign();
+                    if (isRecallToSeatDesignated)
+                    {
+                        if (data.HandlerType is EHandlerType.Role or EHandlerType.AssignedUser)
+                        {
+                            var handler = data.NextHandlers.First();
+                            order.SignerId = handler.Key;
+                            order.SignerName = handler.Value;
+                        }
+                    }
+                    else
+                    {
+                        order.BackToUnsign();
+                    }
                 }
                 await _orderRepository.UpdateAsync(order, false, cancellationToken);
-				break;
+                break;
             case WorkflowModuleConsts.KnowledgeAdd:
             case WorkflowModuleConsts.KnowledgeUpdate:
             case WorkflowModuleConsts.KnowledgeDelete:

+ 5 - 0
src/XF.Domain/Constants/SettingConstants.cs

@@ -222,6 +222,11 @@ namespace XF.Domain.Constants
         /// </summary>
         public const string WebSystemSettingsTheme = "WebSystemSettingsTheme";
 
+        /// <summary>
+        /// 工单特提至坐席是否指派给选择对象
+        /// </summary>
+        public const string IsRecallToSeatDesignated = "IsRecallToSeatDesignated";
+
 
         #region 智能外呼