|
@@ -558,39 +558,50 @@ namespace Hotline.Api.Controllers
|
|
|
/// <returns></returns>
|
|
|
[AllowAnonymous]
|
|
|
[HttpPost("AiResult")]
|
|
|
- public async Task AiResult([FromBody] AiQualityResultDto dto)
|
|
|
+ public async Task AiResult([FromBody] List<AiQualityResultDto> dto)
|
|
|
{
|
|
|
- var quality = await _qualitey.GetAsync(dto.record_id);
|
|
|
- if (quality is { State: EQualityState.Apply } && dto.score_items != null && dto.score_items.Any())
|
|
|
+ foreach (var item in dto)
|
|
|
{
|
|
|
- List<QualityDetail> details = new List<QualityDetail>();
|
|
|
- foreach (var item in dto.score_items)
|
|
|
+ var quality = await _qualitey.GetAsync(item.record_id);
|
|
|
+ if (quality is { State: EQualityState.Apply } && item.score_items != null && item.score_items.Any())
|
|
|
{
|
|
|
- QualityDetail detail = new QualityDetail
|
|
|
+ List<QualityDetail> details = new List<QualityDetail>();
|
|
|
+ foreach (var item2 in item.score_items)
|
|
|
{
|
|
|
- QualityId = quality.Id,
|
|
|
- Second = 0,
|
|
|
- Name = item.name,
|
|
|
- //Content = item.name,
|
|
|
- Grade = item.score
|
|
|
- };
|
|
|
- details.Add(detail);
|
|
|
+ QualityDetail detail = new QualityDetail
|
|
|
+ {
|
|
|
+ QualityId = quality.Id,
|
|
|
+ Second = 0,
|
|
|
+ Name = item2.name,
|
|
|
+ //Content = item.name,
|
|
|
+ Grade = item2.score
|
|
|
+ };
|
|
|
+ details.Add(detail);
|
|
|
+ }
|
|
|
+ await _qualiteyDetail.AddRangeAsync(details);
|
|
|
}
|
|
|
- await _qualiteyDetail.AddRangeAsync(details);
|
|
|
}
|
|
|
}
|
|
|
- //[AllowAnonymous]
|
|
|
- //[HttpPost("AiResultTest/{id}")]
|
|
|
- //public async Task TaskAsync(string id)
|
|
|
- //{
|
|
|
- // var quality = await _qualitey.GetAsync(id);
|
|
|
- // var order = await _orderRepository.GetAsync(quality.OrderId);
|
|
|
- // if (order != null && !string.IsNullOrEmpty(order.CallId))
|
|
|
- // {
|
|
|
- // var call = await _trCallRecordRepository.GetAsync(x => x.CallAccept == order.CallId);
|
|
|
- // await _aiQualityService.CreateAiOrderQualityTask(quality, call, order, HttpContext.RequestAborted);
|
|
|
- // }
|
|
|
- //}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 重推质检
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [AllowAnonymous]
|
|
|
+ [HttpPost("AiResultTest/{id}")]
|
|
|
+ public async Task TaskAsync(string id)
|
|
|
+ {
|
|
|
+ var quality = await _qualitey.GetAsync(id, HttpContext.RequestAborted);
|
|
|
+ var order = await _orderRepository.GetAsync(quality.OrderId, HttpContext.RequestAborted);
|
|
|
+ if (order != null && !string.IsNullOrEmpty(order.CallId))
|
|
|
+ {
|
|
|
+ quality.AiQuality = true;
|
|
|
+ var call = await _trCallRecordRepository.GetAsync(x => x.CallAccept == order.CallId, HttpContext.RequestAborted);
|
|
|
+ await _aiQualityService.CreateAiOrderQualityTask(quality, call, order, HttpContext.RequestAborted);
|
|
|
+ await _qualitey.UpdateAsync(quality, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|