|
@@ -38,15 +38,17 @@ namespace Hotline.Api.Controllers
|
|
|
//private readonly IRepository<TrCallRecord> _trCallRecordRepository;
|
|
|
private readonly IQualityApplication _qualityApplication;
|
|
|
private readonly IOrderRepository _orderRepository;
|
|
|
- //private readonly IAiQualityService _aiQualityService;
|
|
|
- private readonly IServiceScopeFactory _serviceScopeFactory;
|
|
|
+
|
|
|
+ private readonly IServiceProvider _serviceProvider;
|
|
|
+ //private readonly IAiQualityService _aiQualityService;
|
|
|
+
|
|
|
private readonly ILogger<QualityController> _logger;
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
private readonly ICallApplication _callApplication;
|
|
|
private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
private readonly IRepository<SystemLog> _logRepository;
|
|
|
|
|
|
- public QualityController(
|
|
|
+ public QualityController(
|
|
|
ISessionContext sessionContext,
|
|
|
IMapper mapper,
|
|
|
IQualityRepository qualitey,
|
|
@@ -59,9 +61,9 @@ namespace Hotline.Api.Controllers
|
|
|
//IRepository<TrCallRecord> trCallRecordRepository,
|
|
|
IQualityApplication qualityApplication,
|
|
|
IOrderRepository orderRepository,
|
|
|
- //IAiQualityService aiQualityService,
|
|
|
- IServiceScopeFactory serviceScopeFactory,
|
|
|
- ILogger<QualityController> logger,
|
|
|
+ //IAiQualityService aiQualityService,
|
|
|
+ IServiceProvider serviceProvider,
|
|
|
+ ILogger<QualityController> logger,
|
|
|
ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
ICallApplication callApplication,
|
|
|
IOptionsSnapshot<AppConfiguration> appOptions,
|
|
@@ -79,14 +81,14 @@ namespace Hotline.Api.Controllers
|
|
|
//_trCallRecordRepository = trCallRecordRepository;
|
|
|
_qualityApplication = qualityApplication;
|
|
|
_orderRepository = orderRepository;
|
|
|
+ _serviceProvider = serviceProvider;
|
|
|
//_aiQualityService = aiQualityService;
|
|
|
- _serviceScopeFactory = serviceScopeFactory;
|
|
|
- _logger = logger;
|
|
|
+ _logger = logger;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
_callApplication = callApplication;
|
|
|
_appOptions = appOptions;
|
|
|
_logRepository = logRepository;
|
|
|
- }
|
|
|
+ }
|
|
|
#region 质检管理
|
|
|
/// <summary>
|
|
|
/// 删除质检
|
|
@@ -214,7 +216,7 @@ namespace Hotline.Api.Controllers
|
|
|
qualityDto.Order.RecordingAbsolutePath = call.AudioFile;
|
|
|
}
|
|
|
}
|
|
|
- if (!string.IsNullOrEmpty(qualityDto.Visit.CallId))
|
|
|
+ if (!string.IsNullOrEmpty(qualityDto?.Visit?.CallId))
|
|
|
{
|
|
|
var call = await _callApplication.GetCallAsync(qualityDto.Visit.CallId, HttpContext.RequestAborted);
|
|
|
if (call != null)
|
|
@@ -681,24 +683,23 @@ namespace Hotline.Api.Controllers
|
|
|
}
|
|
|
if (_appOptions.Value.IsYiBin)
|
|
|
{
|
|
|
- using var scope = _serviceScopeFactory.CreateScope();
|
|
|
- var aiser = scope.ServiceProvider.GetRequiredService<IAiQualityService>();
|
|
|
- var setting = _systemSettingCacheManager.GetSetting(SettingConstants.ViteRecordPrefix);
|
|
|
- try
|
|
|
- {
|
|
|
- aiser.CreateAiOrderQualityTask(
|
|
|
- quality.Id,
|
|
|
- audioFile,
|
|
|
- fromNo,
|
|
|
- callStartTime,
|
|
|
- setting?.SettingValue[0], quality.Source.ToString(), HttpContext.RequestAborted);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- _logger.LogError($"写入智能质检异常!, \r\n{e.Message}");
|
|
|
- }
|
|
|
- }
|
|
|
- await _qualitey.UpdateAsync(quality, HttpContext.RequestAborted);
|
|
|
+ var aiQualityService = _serviceProvider.GetRequiredService<IAiQualityService>();
|
|
|
+ var setting = _systemSettingCacheManager.GetSetting(SettingConstants.ViteRecordPrefix);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ await aiQualityService.CreateAiOrderQualityTask(
|
|
|
+ quality.Id,
|
|
|
+ audioFile,
|
|
|
+ fromNo,
|
|
|
+ callStartTime,
|
|
|
+ setting?.SettingValue[0], quality.Source.ToString(), HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ _logger.LogError($"写入智能质检异常!, \r\n{e.Message}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await _qualitey.UpdateAsync(quality, HttpContext.RequestAborted);
|
|
|
}
|
|
|
}
|
|
|
|