|
@@ -6,6 +6,7 @@ using Hotline.CallCenter.Devices;
|
|
|
using Hotline.CallCenter.Ivrs;
|
|
|
using Hotline.CallCenter.Manage;
|
|
|
using Hotline.CallCenter.Tels;
|
|
|
+using Hotline.FlowEngine.Definitions;
|
|
|
using Hotline.Permissions;
|
|
|
using Hotline.Repository.SqlSugar.CallCenter;
|
|
|
using Hotline.Settings;
|
|
@@ -47,6 +48,7 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly ITrunkIvrManagerRepository _trunkIvrManagerRepository;
|
|
|
private readonly IIvrCategoryRepository _ivrCategoryRepository;
|
|
|
private readonly IWorkflowApplication _workflowApplication;
|
|
|
+ private readonly IDefinitionDomainService _definitionDomainService;
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
|
|
|
public PbxController(
|
|
@@ -65,6 +67,7 @@ namespace Hotline.Api.Controllers
|
|
|
ITrunkIvrManagerRepository trunkIvrManagerRepository,
|
|
|
IIvrCategoryRepository ivrCategoryRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
|
+ IDefinitionDomainService definitionDomainService,
|
|
|
ISystemSettingCacheManager systemSettingCacheManager)
|
|
|
{
|
|
|
_telRepository = telRepository;
|
|
@@ -82,6 +85,7 @@ namespace Hotline.Api.Controllers
|
|
|
_trunkIvrManagerRepository = trunkIvrManagerRepository;
|
|
|
_ivrCategoryRepository = ivrCategoryRepository;
|
|
|
_workflowApplication = workflowApplication;
|
|
|
+ _definitionDomainService = definitionDomainService;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
}
|
|
|
|
|
@@ -246,15 +250,16 @@ namespace Hotline.Api.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- telRest.WorkflowId = await _workflowApplication.StartWorkflowAsync(dto, HttpContext.RequestAborted);
|
|
|
+ var startWorkflowDto = _mapper.Map<StartWorkflowDto>(dto);
|
|
|
+ var denition = await _definitionDomainService.GetLastVersionDefinitionByModuleCodeAsync(WorkflowModuleConsts.TelRestApply,
|
|
|
+ HttpContext.RequestAborted);
|
|
|
+ if (denition is null)
|
|
|
+ throw UserFriendlyException.SameMessage("未配置流程模板");
|
|
|
+ startWorkflowDto.DefinitionCode = denition.Code;
|
|
|
+ startWorkflowDto.Title = dto.Reason;
|
|
|
+ telRest.WorkflowId = await _workflowApplication.StartWorkflowAsync(startWorkflowDto, HttpContext.RequestAborted);
|
|
|
}
|
|
|
await _telRestRepository.AddAsync(telRest, HttpContext.RequestAborted);
|
|
|
-
|
|
|
- //string id = await _telDomainService.RestAsync(work, dto.Reason, isApply, HttpContext.RequestAborted);
|
|
|
-
|
|
|
- //var startworkflow = _mapper.Map<StartWorkflowDto>(dto);
|
|
|
- //if (isApply)
|
|
|
- // await _workflowApplication.StartWorkflowAsync(dto, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|