|
@@ -33,6 +33,7 @@ namespace Hotline.Api.Controllers
|
|
public class PbxController : BaseController
|
|
public class PbxController : BaseController
|
|
{
|
|
{
|
|
private readonly ITelRepository _telRepository;
|
|
private readonly ITelRepository _telRepository;
|
|
|
|
+ private readonly ITelRestRepository _telRestRepository;
|
|
private readonly ITelDomainService _telDomainService;
|
|
private readonly ITelDomainService _telDomainService;
|
|
private readonly ITypedCache<Tel> _cacheTel;
|
|
private readonly ITypedCache<Tel> _cacheTel;
|
|
private readonly ITypedCache<TelGroup> _cacheTelGroup;
|
|
private readonly ITypedCache<TelGroup> _cacheTelGroup;
|
|
@@ -50,6 +51,7 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
public PbxController(
|
|
public PbxController(
|
|
ITelRepository telRepository,
|
|
ITelRepository telRepository,
|
|
|
|
+ ITelRestRepository telRestRepository,
|
|
ITelDomainService telDomainService,
|
|
ITelDomainService telDomainService,
|
|
ITypedCache<Tel> cacheTel,
|
|
ITypedCache<Tel> cacheTel,
|
|
ITypedCache<TelGroup> cacheTelGroup,
|
|
ITypedCache<TelGroup> cacheTelGroup,
|
|
@@ -66,6 +68,7 @@ namespace Hotline.Api.Controllers
|
|
ISystemSettingCacheManager systemSettingCacheManager)
|
|
ISystemSettingCacheManager systemSettingCacheManager)
|
|
{
|
|
{
|
|
_telRepository = telRepository;
|
|
_telRepository = telRepository;
|
|
|
|
+ _telRestRepository = telRestRepository;
|
|
_telDomainService = telDomainService;
|
|
_telDomainService = telDomainService;
|
|
_cacheTel = cacheTel;
|
|
_cacheTel = cacheTel;
|
|
_cacheTelGroup = cacheTelGroup;
|
|
_cacheTelGroup = cacheTelGroup;
|
|
@@ -220,12 +223,27 @@ namespace Hotline.Api.Controllers
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
if (work is null)
|
|
if (work is null)
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
|
+ var isResting = await _telRepository.IsRestingAsync(work.TelNo, HttpContext.RequestAborted);
|
|
|
|
+ if (isResting)
|
|
|
|
+ throw new UserFriendlyException("当前坐席正在休息");
|
|
|
|
+
|
|
bool isApply = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.RestApproval).SettingValue);
|
|
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);
|
|
|
|
|
|
+ var telRest = new TelRest(work.TelId, work.TelNo, work.UserId, work.UserName, dto.Reason, isApply);
|
|
|
|
+ if (!isApply)
|
|
|
|
+ {
|
|
|
|
+ await _deviceManager.TelRestAsync(telRest.TelNo, HttpContext.RequestAborted);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ telRest.WorkflowId = await _workflowApplication.StartWorkflowAsync(dto, 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>
|
|
/// <summary>
|
|
@@ -252,7 +270,7 @@ namespace Hotline.Api.Controllers
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
if (work is null)
|
|
if (work is null)
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
- await _telDomainService.HoldAsync(work.TelId,_sessionContext.RequiredUserId,_sessionContext.UserName,callId, HttpContext.RequestAborted);
|
|
|
|
|
|
+ await _telDomainService.HoldAsync(work.TelId, _sessionContext.RequiredUserId, _sessionContext.UserName, callId, HttpContext.RequestAborted);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -265,7 +283,7 @@ namespace Hotline.Api.Controllers
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
if (work is null)
|
|
if (work is null)
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
- await _telDomainService.UnHoldAsync(work.TelId,_sessionContext.RequiredUserId,callId, HttpContext.RequestAborted);
|
|
|
|
|
|
+ await _telDomainService.UnHoldAsync(work.TelId, _sessionContext.RequiredUserId, callId, HttpContext.RequestAborted);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 分机呼分机
|
|
/// 分机呼分机
|
|
@@ -710,7 +728,7 @@ namespace Hotline.Api.Controllers
|
|
return new { WorkCategorys = ivr, RestCategory = ivr, WorkToGroup = group, RestToGroup = group, WorkDay = workDay };
|
|
return new { WorkCategorys = ivr, RestCategory = ivr, WorkToGroup = group, RestToGroup = group, WorkDay = workDay };
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
}
|