|
@@ -3,30 +3,74 @@ using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Requests;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using Hotline.Application.Quality;
|
|
|
+using Hotline.Repository.SqlSugar.Extensions;
|
|
|
+using Hotline.Share.Dtos.Quality;
|
|
|
+using Hotline.Tools;
|
|
|
|
|
|
namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
|
public class BiQualityController : BaseController
|
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
|
+ private readonly IQualityApplication _qualityApplication;
|
|
|
public BiQualityController(
|
|
|
- IMapper mapper
|
|
|
- ) {
|
|
|
+ IMapper mapper,
|
|
|
+ IQualityApplication qualityApplication
|
|
|
+ )
|
|
|
+ {
|
|
|
_mapper = mapper;
|
|
|
- }
|
|
|
+ _qualityApplication = qualityApplication;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 坐席质检分析
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- //[HttpGet("seats_quality_analyse")]
|
|
|
- //public async Task<PagedDto<object>> SeatsQualityAnalyse([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>
|
|
|
+ [HttpGet("seats_quality_analyse")]
|
|
|
+ public async Task<PagedDto<SeatsQualityAnalyseDto>> SeatsQualityAnalyse([FromQuery] PagedKeywordRequest dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _qualityApplication.SeatsQualityAnalyse(dto, HttpContext.RequestAborted).ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<SeatsQualityAnalyseDto>(total, _mapper.Map<IReadOnlyList<SeatsQualityAnalyseDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 坐席质检分析导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("seats_quality_analyse/export")]
|
|
|
+ public async Task<FileStreamResult> SeatsQualityAnalyseExport([FromBody] ExportExcelDto<PagedKeywordRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _qualityApplication.SeatsQualityAnalyse(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ List<Hotline.Quality.Quality> 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<SeatsQualityAnalyseDto>>(lists);
|
|
|
+
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+
|
|
|
+ var dtos = listDtos
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(SeatsQualityAnalyseDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "坐席质检分析");
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+}
|