|
@@ -1,6 +1,7 @@
|
|
|
using DotNetCore.CAP;
|
|
|
using Hotline.Application.CallCenter;
|
|
|
using Hotline.Application.Quality;
|
|
|
+using Hotline.Caching.Interfaces;
|
|
|
using Hotline.CallCenter.Configs;
|
|
|
using Hotline.Configurations;
|
|
|
using Hotline.FlowEngine.Notifications;
|
|
@@ -8,6 +9,7 @@ using Hotline.FlowEngine.WorkflowModules;
|
|
|
using Hotline.KnowledgeBase;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Push.Notifies;
|
|
|
+using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Dtos.TrCallCenter;
|
|
@@ -39,6 +41,7 @@ namespace Hotline.Application.Handlers.FlowEngine
|
|
|
private readonly ICallApplication _callApplication;
|
|
|
private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
private readonly IMediator _mediator;
|
|
|
+ private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
|
|
|
public WorkflowStartHandler(
|
|
|
IOrderDomainService orderDomainService,
|
|
@@ -52,8 +55,9 @@ namespace Hotline.Application.Handlers.FlowEngine
|
|
|
IRepository<User> userRepository,
|
|
|
ICallApplication callApplication,
|
|
|
IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
- IMediator mediator
|
|
|
- )
|
|
|
+ IMediator mediator,
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager
|
|
|
+ )
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_knowledgeDomainService = knowledgeDomainService;
|
|
@@ -68,6 +72,7 @@ namespace Hotline.Application.Handlers.FlowEngine
|
|
|
_callApplication = callApplication;
|
|
|
_appOptions = appOptions;
|
|
|
_mediator = mediator;
|
|
|
+ _systemSettingCacheManager = systemSettingCacheManager;
|
|
|
}
|
|
|
|
|
|
/// <summary>Handles a notification</summary>
|
|
@@ -138,9 +143,10 @@ namespace Hotline.Application.Handlers.FlowEngine
|
|
|
switch (notification.FlowAssignInfo.FlowAssignType)
|
|
|
{
|
|
|
case EFlowAssignType.Org:
|
|
|
- var orgCodes = notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
|
|
|
+ var orgCodes = notification.Trace.NextHandlers.Select(x => x.OrgId); //notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
|
|
|
+ var acceptSmsRoleIds = _systemSettingCacheManager.GetSetting(SettingConstants.AcceptSmsRoleIds)?.SettingValue;
|
|
|
var orgList = await _userRepository.Queryable().Where(x =>
|
|
|
- orgCodes.Contains(x.OrgId) && x.Roles.Any(d => d.Id == "08dae71e-0eca-4bc4-89fe-7eaefae8a98e" || d.Id == "08dc48c7-b681-4539-860b-f391cf2aa267" || d.Id == "08dc48c7-bcf7-4c6e-8246-346db53d5bd6" || d.Id == "08dc48c8-42b8-4433-8d0f-5e177052d59d")).ToListAsync();
|
|
|
+ orgCodes.Contains(x.OrgId) && x.Roles.Any(d => orgCodes.Contains(d.Id))).ToListAsync();
|
|
|
foreach (var item in orgList)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(item.PhoneNo))
|
|
@@ -163,9 +169,9 @@ namespace Hotline.Application.Handlers.FlowEngine
|
|
|
|
|
|
break;
|
|
|
case EFlowAssignType.User:
|
|
|
- var userCodes = notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
|
|
|
+ var userCodes = notification.Trace.NextHandlers.Select(x => x.UserId); //notification.FlowAssignInfo.HandlerObjects.Select(x => x.Key);
|
|
|
var userList = await _userRepository.Queryable().Where(x =>
|
|
|
- userCodes.Contains(x.Id) && x.Roles.Any(d => d.Id == "08dae71e-0eca-4bc4-89fe-7eaefae8a98e" || d.Id == "08dc48c7-b681-4539-860b-f391cf2aa267" || d.Id == "08dc48c7-bcf7-4c6e-8246-346db53d5bd6" || d.Id == "08dc48c8-42b8-4433-8d0f-5e177052d59d")).ToListAsync();
|
|
|
+ userCodes.Contains(x.Id) && !string.IsNullOrEmpty(x.PhoneNo)).ToListAsync();
|
|
|
foreach (var item in userList)
|
|
|
{
|
|
|
var messageDto = new Share.Dtos.Push.MessageDto
|