|
@@ -1,4 +1,6 @@
|
|
|
-using Hotline.Caches;
|
|
|
+using Hotline.Application.FlowEngine;
|
|
|
+using Hotline.CacheManager;
|
|
|
+using Hotline.Caches;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
using Hotline.CallCenter.Devices;
|
|
|
using Hotline.CallCenter.Ivrs;
|
|
@@ -8,6 +10,7 @@ using Hotline.Permissions;
|
|
|
using Hotline.Repository.SqlSugar.CallCenter;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos.CallCenter;
|
|
|
+using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.Share.Dtos.Trunk;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Share.Requests;
|
|
@@ -18,6 +21,7 @@ using Microsoft.AspNetCore.Mvc;
|
|
|
using SqlSugar;
|
|
|
using XF.Domain.Authentications;
|
|
|
using XF.Domain.Cache;
|
|
|
+using XF.Domain.Constants;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Utility.EnumExtensions;
|
|
|
|
|
@@ -41,6 +45,8 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly ICallRepository _callRepository;
|
|
|
private readonly ITrunkIvrManagerRepository _trunkIvrManagerRepository;
|
|
|
private readonly IIvrCategoryRepository _ivrCategoryRepository;
|
|
|
+ private readonly IWorkflowApplication _workflowApplication;
|
|
|
+ private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
|
|
|
public PbxController(
|
|
|
ITelRepository telRepository,
|
|
@@ -55,7 +61,9 @@ namespace Hotline.Api.Controllers
|
|
|
ISessionContext sessionContext,
|
|
|
ICallRepository callRepository,
|
|
|
ITrunkIvrManagerRepository trunkIvrManagerRepository,
|
|
|
- IIvrCategoryRepository ivrCategoryRepository)
|
|
|
+ IIvrCategoryRepository ivrCategoryRepository,
|
|
|
+ IWorkflowApplication workflowApplication,
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager)
|
|
|
{
|
|
|
_telRepository = telRepository;
|
|
|
_telDomainService = telDomainService;
|
|
@@ -70,6 +78,8 @@ namespace Hotline.Api.Controllers
|
|
|
_callRepository = callRepository;
|
|
|
_trunkIvrManagerRepository = trunkIvrManagerRepository;
|
|
|
_ivrCategoryRepository = ivrCategoryRepository;
|
|
|
+ _workflowApplication = workflowApplication;
|
|
|
+ _systemSettingCacheManager = systemSettingCacheManager;
|
|
|
}
|
|
|
|
|
|
#region 话机
|
|
@@ -204,13 +214,18 @@ namespace Hotline.Api.Controllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[Permission(EPermission.Rest)]
|
|
|
- [HttpPut("rest")]
|
|
|
- public async Task Rest()
|
|
|
+ [HttpPost("rest")]
|
|
|
+ public async Task Rest([FromBody] StartRestDto dto)
|
|
|
{
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- await _telDomainService.RestAsync(work, HttpContext.RequestAborted);
|
|
|
+ bool isApply = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.RestApproval).SettingValue);
|
|
|
+ string id = await _telDomainService.RestAsync(work,dto.Reason,isApply, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ var startworkflow = _mapper.Map<StartWorkflowDto>(dto);
|
|
|
+ if (isApply)
|
|
|
+ await _workflowApplication.StartWorkflowAsync(dto, id, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|