|
@@ -23,6 +23,7 @@ using Newtonsoft.Json;
|
|
|
using System.Threading;
|
|
|
using XF.Domain.Authentications;
|
|
|
using XF.Domain.Constants;
|
|
|
+using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
@@ -147,20 +148,34 @@ namespace Hotline.Api.Controllers
|
|
|
//过滤结果
|
|
|
var orgProcessingResults = new Kv();
|
|
|
var orgHandledAttitude = new Kv();
|
|
|
+ EVoiceEvaluate? seatEvaluate;
|
|
|
var visitContent = "";
|
|
|
+ var seatVisitContent = "";
|
|
|
foreach (var item in callRecord.QuestionnaireResult)
|
|
|
{
|
|
|
- //服务过程满意度
|
|
|
+ ////服务过程满意度
|
|
|
+ //if (item.QuestionId == _options.Value.QuestionIdOne)
|
|
|
+ //{
|
|
|
+ // if (item.QuestionResult == "满意")
|
|
|
+ // {
|
|
|
+ // orgHandledAttitude = new Kv() { Key="4", Value="满意" };
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // orgHandledAttitude = new Kv() { Key = "2", Value = "不满意" };
|
|
|
+
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //是否解决
|
|
|
if (item.QuestionId == _options.Value.QuestionIdOne)
|
|
|
{
|
|
|
- if (item.QuestionResult == "满意")
|
|
|
+ if (item.QuestionResult == "")
|
|
|
{
|
|
|
- orgHandledAttitude = new Kv() { Key="4", Value="满意" };
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- orgHandledAttitude = new Kv() { Key = "2", Value = "不满意" };
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
//办件结果满意度
|
|
@@ -173,13 +188,28 @@ namespace Hotline.Api.Controllers
|
|
|
else
|
|
|
{
|
|
|
orgProcessingResults = new Kv() { Key = "2", Value = "不满意" };
|
|
|
- visitContent = callRecord.SceneVariable[_options.Value.VisitContentId];
|
|
|
+ visitContent = callRecord.SceneVariable[_options.Value.VisitContentIdOne];
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
aiOrderVisitDetail.OrderVisit.VisitState = Share.Enums.Order.EVisitState.WaitForVisit;
|
|
|
}
|
|
|
+
|
|
|
+ //坐席是否满意
|
|
|
+ if (item.QuestionId == _options.Value.QuestionIdThree)
|
|
|
+ {
|
|
|
+ if (item.QuestionResult == "满意")
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ seatVisitContent = callRecord.SceneVariable[_options.Value.VisitContentIdTwo];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
//处理结果
|
|
|
orgDetail.ForEach(x =>
|
|
@@ -414,6 +444,12 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpPost("aivisit/add-aivisit")]
|
|
|
public async Task AddAiVisit([FromBody]AddAiVisitDto dto)
|
|
|
{
|
|
|
+ //验证是否有重复电话
|
|
|
+ if(dto.AiOrderVisitDetails.Distinct().Count() != dto.AiOrderVisitDetails.Count)
|
|
|
+ {
|
|
|
+ throw UserFriendlyException.SameMessage("任务中存在重复外呼号码,请检查后重新提交");
|
|
|
+ }
|
|
|
+
|
|
|
var model = _mapper.Map<AiOrderVisit>(dto);
|
|
|
|
|
|
var detaillist = _mapper.Map<List<AiOrderVisitDetail>>(dto.AiOrderVisitDetails);
|
|
@@ -432,11 +468,7 @@ namespace Hotline.Api.Controllers
|
|
|
x.AiOrderVisitState = Share.Enums.Ai.EAiOrderVisitState.InProgress;
|
|
|
});
|
|
|
await _aiOrderVisitDetailRepository.AddRangeAsync(detaillist, HttpContext.RequestAborted);
|
|
|
- //修改回访主表
|
|
|
- await _orderVisitRepository.Updateable()
|
|
|
- .SetColumns(x => x.IsCanAiVisit == false)
|
|
|
- .SetColumns(x=> x.VisitState == EVisitState.Visiting)
|
|
|
- .Where(x=> detaillist.Select(s=>s.OrderVisitId).Contains(x.Id)).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
+
|
|
|
//推送任务
|
|
|
//准备原始数据
|
|
|
var pushModel = await _aiOrderVisitRepository.Queryable()
|
|
@@ -445,6 +477,19 @@ namespace Hotline.Api.Controllers
|
|
|
.FirstAsync(x => x.Id == id);
|
|
|
|
|
|
var newModel = await _aiVisitService.CreateAiOrderVisitTask(pushModel, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(newModel.BatchUid))
|
|
|
+ {
|
|
|
+ //修改回访主表
|
|
|
+ await _orderVisitRepository.Updateable()
|
|
|
+ .SetColumns(x => x.IsCanAiVisit == false)
|
|
|
+ .SetColumns(x => x.VisitState == EVisitState.Visiting)
|
|
|
+ .Where(x => detaillist.Select(s => s.OrderVisitId).Contains(x.Id)).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ newModel.TaskState = Share.Enums.Ai.EAiOrderVisitTaskState.Ended;
|
|
|
+ }
|
|
|
await _aiOrderVisitRepository.UpdateAsync(newModel, HttpContext.RequestAborted);
|
|
|
await _aiOrderVisitDetailRepository.UpdateRangeAsync(newModel.AiOrderVisitDetails, HttpContext.RequestAborted);
|
|
|
}
|