|
@@ -49,6 +49,7 @@ using Hotline.File;
|
|
|
using Hotline.KnowledgeBase;
|
|
|
using DocumentFormat.OpenXml.Vml.Spreadsheet;
|
|
|
using Hotline.Share.Tools;
|
|
|
+using MediatR;
|
|
|
|
|
|
namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
@@ -1147,79 +1148,81 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
public async Task<object> HotPortJoinOrgStatistics([FromQuery] HotPortJoinOrgStatisticsRequest dto)
|
|
|
{
|
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
- return await _orderRepository.HotPortJoinOrgStatistics(dto.StartTime, dto.EndTime, IsCenter, _sessionContext.OrgId);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 热点类型部门统计--导出
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- //[HttpPost("hotport-org-statistics/export")]
|
|
|
- //public async Task<FileStreamResult> ExportHotPortJoinOrgStatistics([FromBody] ExportHotPortJoinOrgStatisticsRequest dto)
|
|
|
- //{
|
|
|
- // if (!dto.StartTime.HasValue || !dto.EndTime.HasValue) throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
- // if (dto.AddColumnName is null || dto.AddColumnName.Count == 0) throw UserFriendlyException.SameMessage("导出字段不能为空");
|
|
|
- // if (dto.AddColumnName.FirstOrDefault() != "部门名称") throw UserFriendlyException.SameMessage("导出字段第一个必须是'部门名称'");
|
|
|
-
|
|
|
- // var (dissatisfiedReason, list) = await _orderRepository.HotPortJoinOrgStatistics(dto, _sessionContext.OrgIsCenter);
|
|
|
- // var dataTable = await _orderReportApplication.ExportQueryVisitNoSatisfiedAsync(dissatisfiedReason, list, dto.AddColumnName);
|
|
|
-
|
|
|
- // return ExcelStreamResult(ExcelHelper.CreateStream(dataTable), "回访不满意原因统计");
|
|
|
- //}
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 热点类型部门统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("hotport-org-statistics-detail")]
|
|
|
- public async Task<PagedDto<OrderDto>> HotPortJoinOrgStatisticsDetail([FromQuery] HotPortJoinOrgStatisticsRequestDetail dto)
|
|
|
- {
|
|
|
- var (total, items) = await _orderRepository.HotPortJoinOrgStatisticsDetail(dto)
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
- return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 热点类型部门统计明细导出
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPost("hotport-org-statistics-detail/export")]
|
|
|
- public async Task<FileStreamResult> HotPortJoinOrgStatisticsDetailExport([FromBody] ExportExcelDto<HotPortJoinOrgStatisticsRequestDetail> dto)
|
|
|
- {
|
|
|
- var query = _orderRepository.HotPortJoinOrgStatisticsDetail(dto.QueryDto);
|
|
|
- List<Order> data;
|
|
|
- if (dto.IsExportAll)
|
|
|
- {
|
|
|
- data = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
- data = items;
|
|
|
- }
|
|
|
- var orderDtos = _mapper.Map<IReadOnlyList<OrderDto>>(data);
|
|
|
- dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
-
|
|
|
- var dtos = orderDtos
|
|
|
- .Select(stu => _mapper.Map(stu, typeof(OrderDto), dynamicClass))
|
|
|
- .Cast<object>()
|
|
|
- .ToList();
|
|
|
-
|
|
|
- var stream = ExcelHelper.CreateStream(dtos);
|
|
|
-
|
|
|
- return ExcelStreamResult(stream, "热点类型部门统计明细");
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 回访量统计导出
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPost("visit-measure-statistics-export")]
|
|
|
+ var (hotSpot, data) = await _orderRepository.HotPortJoinOrgStatistics(dto.StartTime, dto.EndTime, IsCenter, _sessionContext.OrgId);
|
|
|
+ return new { hotSpot, data };
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热点类型部门统计--导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("hotport-org-statistics/export")]
|
|
|
+ public async Task<FileStreamResult> ExportHotPortJoinOrgStatistics([FromBody] ExportHotPortJoinOrgStatisticsRequest dto)
|
|
|
+ {
|
|
|
+ if (!dto.StartTime.HasValue || !dto.EndTime.HasValue) throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
+ if (dto.AddColumnName is null || dto.AddColumnName.Count == 0) throw UserFriendlyException.SameMessage("导出字段不能为空");
|
|
|
+ if (dto.AddColumnName.FirstOrDefault() != "部门名称") throw UserFriendlyException.SameMessage("导出字段第一个必须是'部门名称'");
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+
|
|
|
+ var (hotSpot, list) = await _orderRepository.HotPortJoinOrgStatistics(dto.StartTime.Value, dto.EndTime.Value, IsCenter, _sessionContext.OrgId);
|
|
|
+ var dataTable = await _orderReportApplication.ExportHotPortJoinOrgStatisticsAsync(hotSpot, list, dto.AddColumnName);
|
|
|
+
|
|
|
+ return ExcelStreamResult(ExcelHelper.CreateStream(dataTable), "热点类型部门统计");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热点类型部门统计明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("hotport-org-statistics/detail")]
|
|
|
+ public async Task<PagedDto<OrderDto>> HotPortJoinOrgStatisticsDetail([FromQuery] HotPortJoinOrgStatisticsRequestDetail dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderRepository.HotPortJoinOrgStatisticsDetail(dto)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 热点类型部门统计明细导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("hotport-org-statistics/detail/export")]
|
|
|
+ public async Task<FileStreamResult> HotPortJoinOrgStatisticsDetailExport([FromBody] ExportExcelDto<HotPortJoinOrgStatisticsRequestDetail> dto)
|
|
|
+ {
|
|
|
+ var query = _orderRepository.HotPortJoinOrgStatisticsDetail(dto.QueryDto);
|
|
|
+ List<Order> data;
|
|
|
+ if (dto.IsExportAll)
|
|
|
+ {
|
|
|
+ data = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ data = items;
|
|
|
+ }
|
|
|
+ var orderDtos = _mapper.Map<IReadOnlyList<OrderDto>>(data);
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+
|
|
|
+ var dtos = orderDtos
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(OrderDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "热点类型部门统计明细");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 回访量统计导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("visit-measure-statistics-export")]
|
|
|
[AllowAnonymous]
|
|
|
public async Task<FileStreamResult> VisitMeasureStatisticsExport([FromBody] ExportExcelDto<VisitMeasureStatisticsRequest> dto)
|
|
|
{
|