|
@@ -1,10 +1,14 @@
|
|
|
using Hotline.Application.Knowledge;
|
|
|
using Hotline.KnowledgeBase;
|
|
|
-using Hotline.Permissions;
|
|
|
+using Hotline.Repository.SqlSugar.Extensions;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.Knowledge;
|
|
|
+using Hotline.Share.Dtos.ObservationPiece;
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Enums.KnowledgeBase;
|
|
|
+using Hotline.Share.Requests;
|
|
|
+using Hotline.Tools;
|
|
|
using Hotline.Users;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
@@ -268,5 +272,52 @@ namespace Hotline.Api.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region 知识超期未更新统计
|
|
|
+ /// <summary>
|
|
|
+ /// 知识超期未更新统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("get-know-overdue-statistics-list")]
|
|
|
+ public async Task<PagedDto<KnowedgeStatisticsDto>> GetKnowOverdueStatisticsList([FromQuery] PagedKeywordRequest dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _knowApplication.GetKnowedgeStatistics(dto)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<KnowedgeStatisticsDto>(total, items);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///知识超期未更新统计导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("get-know-overdue-statistics-list-export")]
|
|
|
+ public async Task<FileStreamResult> GetKnowOverdueStatisticsListExport([FromBody] ExportExcelDto<PagedKeywordRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _knowApplication.GetKnowedgeStatistics(dto.QueryDto);
|
|
|
+ List<KnowedgeStatisticsDto> data;
|
|
|
+ if (dto.IsExportAll)
|
|
|
+ {
|
|
|
+ data = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ data = items;
|
|
|
+ }
|
|
|
+
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass<KnowedgeStatisticsDto>(dto.ColumnInfos);
|
|
|
+
|
|
|
+ var dtos = data
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(KnowedgeStatisticsDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "知识超期未更新统计");
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|