|
@@ -45,6 +45,7 @@ using DocumentFormat.OpenXml.Bibliography;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using Hotline.Share.Dtos.File;
|
|
|
using Hotline.File;
|
|
|
+using Hotline.KnowledgeBase;
|
|
|
|
|
|
namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
@@ -86,6 +87,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
private readonly IRepository<CallNative> _callNativeRepository;
|
|
|
private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
private readonly IRepository<OrderTsDetails> _orderTsDetailsRepository;
|
|
|
+ private readonly IRepository<KnowledgeQuote> _knowledgeQuoteRepository;
|
|
|
|
|
|
public BiOrderController(
|
|
|
IOrderRepository orderRepository,
|
|
@@ -123,7 +125,8 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
IOrderVisitApplication orderVisitApplication,
|
|
|
IRepository<CallNative> callNativeRepository,
|
|
|
IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
- IRepository<OrderTsDetails> orderTsDetailsRepository)
|
|
|
+ IRepository<OrderTsDetails> orderTsDetailsRepository,
|
|
|
+ IRepository<KnowledgeQuote> knowledgeQuoteRepository)
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
@@ -161,6 +164,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
_callNativeRepository = callNativeRepository;
|
|
|
_appOptions = appOptions;
|
|
|
_orderTsDetailsRepository = orderTsDetailsRepository;
|
|
|
+ _knowledgeQuoteRepository = knowledgeQuoteRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -5217,7 +5221,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
[HttpGet("query_order_ts_details_list")]
|
|
|
public async Task<PagedDto<OrderTsDetailsDto>> QueryOrderTsDetailsList([FromQuery] PagedKeywordRequest dto)
|
|
|
{
|
|
|
- var (total, items) = await _orderApplication.QueryOrderTsDetailslList(dto).ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+ var (total, items) = await _orderApplication.QueryOrderTsDetailsList(dto).ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
|
|
|
return new PagedDto<OrderTsDetailsDto>(total, _mapper.Map<IReadOnlyList<OrderTsDetailsDto>>(items));
|
|
|
}
|
|
@@ -5230,7 +5234,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
[HttpPost("query_order_ts_details_list/export")]
|
|
|
public async Task<FileStreamResult> ExportQueryOrderTsDetailsList([FromQuery] ExportExcelDto<PagedKeywordRequest> dto)
|
|
|
{
|
|
|
- var query = _orderApplication.QueryOrderTsDetailslList(dto.QueryDto);
|
|
|
+ var query = _orderApplication.QueryOrderTsDetailsList(dto.QueryDto);
|
|
|
|
|
|
List<OrderTsDetailsDto> lists;
|
|
|
if (dto.IsExportAll)
|
|
@@ -5270,5 +5274,67 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where(p => p.Terms == KeyWord)
|
|
|
.ToListAsync(HttpContext.RequestAborted);
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 知识库引用
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("query_knowledge_quote_list")]
|
|
|
+ public async Task<PagedDto<OrderTsDetailsDto>> QueryKnowledgeQuoteList([FromQuery] PagedKeywordRequest dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderApplication.QueryKnowledgeQuoteList(dto).ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<OrderTsDetailsDto>(total, _mapper.Map<IReadOnlyList<OrderTsDetailsDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 知识库引用导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("query_knowledge_quote_list/export")]
|
|
|
+ public async Task<FileStreamResult> ExportQueryKnowledgeQuoteList([FromQuery] ExportExcelDto<PagedKeywordRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _orderApplication.QueryKnowledgeQuoteList(dto.QueryDto);
|
|
|
+
|
|
|
+ List<OrderTsDetailsDto> lists;
|
|
|
+ if (dto.IsExportAll)
|
|
|
+ {
|
|
|
+ lists = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ lists = items;
|
|
|
+ }
|
|
|
+
|
|
|
+ var listDtos = _mapper.Map<ICollection<OrderTsDetailsDto>>(lists);
|
|
|
+
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+
|
|
|
+ var dtos = listDtos
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(OrderTsDetailsDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "知识库引用数据");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 根据知识库引用查询工单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="KeyWord"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("get_query_knowledge_quote_order_list")]
|
|
|
+ public async Task<List<KnowledgeQuote>> GetQueryKnowledgeQuoteOrderList(string KeyWord)
|
|
|
+ {
|
|
|
+ return await _knowledgeQuoteRepository.Queryable()
|
|
|
+ .Where(p => p.KnowledgeId == KeyWord)
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
}
|