|
@@ -1,4 +1,5 @@
|
|
|
-using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.Application.Orders;
|
|
|
+using Hotline.Caching.Interfaces;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
using Hotline.FlowEngine.WorkflowModules;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
@@ -17,6 +18,7 @@ using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Requests;
|
|
|
+using Hotline.Tools;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
@@ -49,8 +51,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
private readonly IRepository<OrderSpecialDetail> _orderSpecialDetailRepository;
|
|
|
private readonly IRepository<WorkflowTrace> _workflowTraceRepository;
|
|
|
private readonly IRepository<OrderScreen> _orderScreenRepository;
|
|
|
+ private readonly IOrderSecondaryHandlingApplication _orderSecondaryHandlingApplication;
|
|
|
|
|
|
- public BiOrderController(
|
|
|
+ public BiOrderController(
|
|
|
IOrderRepository orderRepository,
|
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
|
ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
@@ -69,8 +72,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
IRepository<OrderSpecialDetail> orderSpecialDetailRepository,
|
|
|
IRepository<WorkflowTrace> workflowTraceRepository,
|
|
|
IRepository<OrderScreen> orderScreenRepository,
|
|
|
- IRepository<WorkflowStepHandler> workflowStepHandleRepository
|
|
|
- )
|
|
|
+ IRepository<WorkflowStepHandler> workflowStepHandleRepository,
|
|
|
+ IOrderSecondaryHandlingApplication orderSecondaryHandlingApplication
|
|
|
+ )
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
@@ -91,7 +95,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
_workflowTraceRepository = workflowTraceRepository;
|
|
|
_orderScreenRepository = orderScreenRepository;
|
|
|
_workflowStepHandleRepository = workflowStepHandleRepository;
|
|
|
- }
|
|
|
+ _orderSecondaryHandlingApplication = orderSecondaryHandlingApplication;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 部门超期统计明细
|
|
@@ -1697,7 +1703,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
HQZBOverdue = 0,
|
|
|
DelayEnd = 0,
|
|
|
DelayWait = 0,
|
|
|
- OrderDelayCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.DelayState != EDelayState.Withdraw, 1, 0)),
|
|
|
+ OrderDelayCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.DelayState == EDelayState.Pass, 1, 0)),
|
|
|
ScreenCount = 0,
|
|
|
ScreenApproval = 0,
|
|
|
ScreenPass = 0,
|
|
@@ -1987,7 +1993,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
|
OrgCode = d.OrgCode,
|
|
|
// OrderCountNum = 0,//总量
|
|
|
- YBOrderCountNum = 0,//已办
|
|
|
+ YBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status >= EWorkflowStepStatus.Handled, 1, 0)),//已办
|
|
|
ZBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EWorkflowStepStatus.Handled, 1, 0)),// 0,//在办
|
|
|
Archived = 0,
|
|
|
ToBeArchived = 0,
|
|
@@ -2043,7 +2049,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
HQZBOverdue = 0,
|
|
|
DelayEnd = 0,
|
|
|
DelayWait = 0,
|
|
|
- OrderDelayCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.DelayState != EDelayState.Withdraw, 1, 0)),
|
|
|
+ OrderDelayCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.DelayState == EDelayState.Pass, 1, 0)),
|
|
|
ScreenCount = 0,
|
|
|
ScreenApproval = 0,
|
|
|
ScreenPass = 0,
|
|
@@ -2223,6 +2229,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
switch (dto.StatisticsType)
|
|
|
{
|
|
|
case EStatisticsType.YBOrderCountNum:
|
|
|
+ //工单
|
|
|
+ stye = "0";
|
|
|
+ break;
|
|
|
case EStatisticsType.ToBeArchived:
|
|
|
case EStatisticsType.Archived:
|
|
|
case EStatisticsType.YBOverdue:
|
|
@@ -2268,6 +2277,41 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+ #region 工单已办
|
|
|
+ if (stye == "0")
|
|
|
+ {
|
|
|
+ var ybQuery = _orderRepository.Queryable()
|
|
|
+ .Where(it => it.CreationTime >= dto.StartDate && it.CreationTime <= dto.EndDate && it.Status > EOrderStatus.WaitForAccept)
|
|
|
+ .WhereIF(dto.OrgCode == "001", it => it.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", it => it.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, it => it.Status >= EOrderStatus.Filed)//已办
|
|
|
+ .Select(it => new SelectOrderId { Id = it.Id })
|
|
|
+ .MergeTable();
|
|
|
+
|
|
|
+ var hqybquery = _workflowStepHandleRepository.Queryable()
|
|
|
+ .LeftJoin<WorkflowTrace>((x, o) => x.WorkflowStepId == o.StepId)
|
|
|
+ .LeftJoin<Order>((x, o, p) => o.WorkflowId == p.WorkflowId)
|
|
|
+ .Where((x, o, p) => o.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartDate && o.CreationTime <= dto.EndDate)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o, p) => x.OrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o, p) => x.OrgId.StartsWith(dto.OrgCode))
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, (x, o, p) => o.Status >= EWorkflowStepStatus.Handled && o.CountersignPosition > ECountersignPosition.None)//会签已办
|
|
|
+ .Select((x, o, p) => new SelectOrderId { Id = p.Id })
|
|
|
+ .MergeTable();
|
|
|
+
|
|
|
+ var queryData = await _orderRepository.OrderListUnionAll(ybQuery, hqybquery)
|
|
|
+ .LeftJoin<Order>((x, o) => x.Id == o.Id)
|
|
|
+ .Select((x, o) => new { o })
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ var dtos = queryData.Select(d =>
|
|
|
+ {
|
|
|
+ var dto = _mapper.Map<OrderDto>(d.o);
|
|
|
+ return dto;
|
|
|
+ }).ToList();
|
|
|
+
|
|
|
+ return new PagedDto<OrderDto>(total, dtos);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
#region 工单
|
|
|
if (stye == "1")
|
|
@@ -2277,12 +2321,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where(it => it.CreationTime >= dto.StartDate && it.CreationTime <= dto.EndDate && it.Status > EOrderStatus.WaitForAccept)
|
|
|
.WhereIF(dto.OrgCode == "001", it => it.ActualHandleOrgCode == dto.OrgCode)
|
|
|
.WhereIF(dto.OrgCode != "001", it => it.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, it => it.Status >= EOrderStatus.Filed)//已办
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.ZBOrderCountNum, it => it.Status < EOrderStatus.Filed)//在办
|
|
|
.WhereIF(dto.StatisticsType == EStatisticsType.Archived, it => it.Status >= EOrderStatus.Filed)//已归档
|
|
|
.WhereIF(dto.StatisticsType == EStatisticsType.ToBeArchived, it => it.Status < EOrderStatus.WaitForAccept)//待归档--没得待归档数据
|
|
|
.WhereIF(dto.StatisticsType == EStatisticsType.YBOverdue, it => it.Status >= EOrderStatus.Filed && it.ActualHandleTime > it.ExpiredTime)//已办超期
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.ZBOverdue, it => it.Status < EOrderStatus.Filed && it.ExpiredTime < SqlFunc.GetDate())//待办超期
|
|
|
.OrderByDescending(it => it.CreationTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<OrderDto>(totalOrder, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
@@ -2324,7 +2365,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
.WhereIF(dto.OrgCode == "001", (x, o) => x.ApplyOrgCode == dto.OrgCode)
|
|
|
.WhereIF(dto.OrgCode != "001", (x, o) => x.ApplyOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.OrderDelayCount, (x, o) => x.DelayState != EDelayState.Withdraw)//延期次数
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.OrderDelayCount, (x, o) => x.DelayState == EDelayState.Pass)//延期次数
|
|
|
.OrderByDescending((x, o) => o.CreationTime)
|
|
|
.Select((x, o) => new { o })
|
|
|
.ToPageListAsync(dto.PageIndex, dto.PageSize, total, HttpContext.RequestAborted);
|
|
@@ -2755,7 +2796,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
.GroupBy((x, w, wfsh, su) => x.WorkflowId)
|
|
|
.Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
- .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
+ .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
.MergeTable()
|
|
|
.LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
|
|
|
.LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
|
|
@@ -2827,12 +2868,12 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
.GroupBy((x, w, wfsh, su) => x.WorkflowId)
|
|
|
.Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
- .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
+ .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
.MergeTable()
|
|
|
.LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
|
|
|
.LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
|
|
|
.LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId && wsh.CreationTime == a.CreationTime)
|
|
|
- .InnerJoin<SchedulingUser>((a, wt, wf, wsh, su) => wsh.UserId == su.UserId)
|
|
|
+ .InnerJoin<SchedulingUser>((a, wt, wf, wsh, su) => wsh.UserId == su.UserId)
|
|
|
.Where((a, wt, wf, wsh, su) => su.UserId == dto.UserId)
|
|
|
.GroupBy((a, wt, wf, wsh, su) => wf.ExternalId)
|
|
|
.Select((a, wt, wf, wsh, su) => new { Id = wf.ExternalId })
|
|
@@ -2845,6 +2886,257 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("secondary_handling_report")]
|
|
|
+ public async Task<List<SecondaryHandlingVo>> SecondaryHandlingReport([FromQuery] QuerySecondaryHandlingRequest dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingReport(dto, HttpContext.RequestAborted);
|
|
|
+ return await query.ToListAsync();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理统计导出
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("secondary_handling_report/_export")]
|
|
|
+ public async Task<FileStreamResult> SecondaryHandlingReportExport([FromBody] ExportExcelDto<QuerySecondaryHandlingRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingReport(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ List<SecondaryHandlingVo> secondaryHandling;
|
|
|
+ secondaryHandling = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+ var dtos = secondaryHandling
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(SecondaryHandlingVo), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "二次办理统计数据");
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("secondary_handling_detail_report")]
|
|
|
+ public async Task<PagedDto<OrderSecondaryHandlingDto>> SecondaryHandlingDetailReport([FromQuery] QuerySecondaryHandlingRequest dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingDetailReport(dto, HttpContext.RequestAborted);
|
|
|
+ var (total, items) = await query.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<OrderSecondaryHandlingDto>(total, _mapper.Map<IReadOnlyList<OrderSecondaryHandlingDto>>(items));
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理明细导出
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("secondary_handling_detail_report/_export")]
|
|
|
+ public async Task<FileStreamResult> SecondaryHandlingDetailReportExport([FromBody] ExportExcelDto<QuerySecondaryHandlingRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingDetailReport(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ List<OrderSecondaryHandling> secondaryHandling;
|
|
|
+ if (dto.IsExportAll)
|
|
|
+ {
|
|
|
+ secondaryHandling = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ secondaryHandling = items;
|
|
|
+ }
|
|
|
+
|
|
|
+ var secondaryHandlingDtos = _mapper.Map<ICollection<OrderSecondaryHandlingDto>>(secondaryHandling);
|
|
|
+
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+
|
|
|
+ var dtos = secondaryHandlingDtos
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(OrderSecondaryHandlingDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "二次办理列表数据");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理满意度统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("secondary_handling_satisfaction_report")]
|
|
|
+ public async Task<List<SecondaryHandlingSatisfactionVo>> SecondaryHandlingSatisfactionReport([FromQuery] QuerySecondaryHandlingRequest dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingSatisfactionReport(dto, HttpContext.RequestAborted);
|
|
|
+ var list = await query.ToListAsync();
|
|
|
+ //总计
|
|
|
+ var total = new SecondaryHandlingSatisfactionVo
|
|
|
+ {
|
|
|
+ OrgId ="0",
|
|
|
+ OrgName ="总计",
|
|
|
+ TotalSumCount = list.Select(x => x.TotalSumCount).Sum(),
|
|
|
+ VerySatisfiedCount = list.Select(x => x.VerySatisfiedCount).Sum(),
|
|
|
+ SatisfiedCount = list.Select(x => x.SatisfiedCount).Sum(),
|
|
|
+ RegardedAsSatisfiedCount = list.Select(x => x.RegardedAsSatisfiedCount).Sum(),
|
|
|
+ DefaultSatisfiedCount = list.Select(x => x.DefaultSatisfiedCount).Sum(),
|
|
|
+ NoSatisfiedCount = list.Select(x => x.NoSatisfiedCount).Sum(),
|
|
|
+ NoEvaluateCount = list.Select(x => x.NoEvaluateCount).Sum(),
|
|
|
+ NoPutThroughCount = list.Select(x => x.NoPutThroughCount).Sum()
|
|
|
+ };
|
|
|
+ list.Add(total);
|
|
|
+ //区县合计
|
|
|
+ var countyList = list.Where(x => x.OrgType == EOrgType.County).ToList();
|
|
|
+ var countyTotal = new SecondaryHandlingSatisfactionVo
|
|
|
+ {
|
|
|
+ OrgId = "0",
|
|
|
+ OrgName = "区县合计",
|
|
|
+ TotalSumCount = countyList.Select(x => x.TotalSumCount).Sum(),
|
|
|
+ VerySatisfiedCount = countyList.Select(x => x.VerySatisfiedCount).Sum(),
|
|
|
+ SatisfiedCount = countyList.Select(x => x.SatisfiedCount).Sum(),
|
|
|
+ RegardedAsSatisfiedCount = countyList.Select(x => x.RegardedAsSatisfiedCount).Sum(),
|
|
|
+ DefaultSatisfiedCount = countyList.Select(x => x.DefaultSatisfiedCount).Sum(),
|
|
|
+ NoSatisfiedCount = countyList.Select(x => x.NoSatisfiedCount).Sum(),
|
|
|
+ NoEvaluateCount = countyList.Select(x => x.NoEvaluateCount).Sum(),
|
|
|
+ NoPutThroughCount = countyList.Select(x => x.NoPutThroughCount).Sum()
|
|
|
+ };
|
|
|
+ list.Add(countyTotal);
|
|
|
+ //市直合计
|
|
|
+ var cityList = list.Where(x => x.OrgType == EOrgType.City).ToList();
|
|
|
+ var cityTotal = new SecondaryHandlingSatisfactionVo
|
|
|
+ {
|
|
|
+ OrgId = "0",
|
|
|
+ OrgName = "市直合计",
|
|
|
+ TotalSumCount = cityList.Select(x => x.TotalSumCount).Sum(),
|
|
|
+ VerySatisfiedCount = cityList.Select(x => x.VerySatisfiedCount).Sum(),
|
|
|
+ SatisfiedCount = cityList.Select(x => x.SatisfiedCount).Sum(),
|
|
|
+ RegardedAsSatisfiedCount = cityList.Select(x => x.RegardedAsSatisfiedCount).Sum(),
|
|
|
+ DefaultSatisfiedCount = cityList.Select(x => x.DefaultSatisfiedCount).Sum(),
|
|
|
+ NoSatisfiedCount = cityList.Select(x => x.NoSatisfiedCount).Sum(),
|
|
|
+ NoEvaluateCount = cityList.Select(x => x.NoEvaluateCount).Sum(),
|
|
|
+ NoPutThroughCount = cityList.Select(x => x.NoPutThroughCount).Sum()
|
|
|
+ };
|
|
|
+ list.Add(cityTotal);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理满意度统计导出
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("secondary_handling_satisfaction_report/_export")]
|
|
|
+ public async Task<FileStreamResult> SecondaryHandlingSatisfactionReportExport([FromBody] ExportExcelDto<QuerySecondaryHandlingRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingSatisfactionReport(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ List<SecondaryHandlingSatisfactionVo> secondaryHandling;
|
|
|
+ secondaryHandling = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ //总计
|
|
|
+ var total = new SecondaryHandlingSatisfactionVo
|
|
|
+ {
|
|
|
+ OrgId = "0",
|
|
|
+ OrgName = "总计",
|
|
|
+ TotalSumCount = secondaryHandling.Select(x => x.TotalSumCount).Sum(),
|
|
|
+ VerySatisfiedCount = secondaryHandling.Select(x => x.VerySatisfiedCount).Sum(),
|
|
|
+ SatisfiedCount = secondaryHandling.Select(x => x.SatisfiedCount).Sum(),
|
|
|
+ RegardedAsSatisfiedCount = secondaryHandling.Select(x => x.RegardedAsSatisfiedCount).Sum(),
|
|
|
+ DefaultSatisfiedCount = secondaryHandling.Select(x => x.DefaultSatisfiedCount).Sum(),
|
|
|
+ NoSatisfiedCount = secondaryHandling.Select(x => x.NoSatisfiedCount).Sum(),
|
|
|
+ NoEvaluateCount = secondaryHandling.Select(x => x.NoEvaluateCount).Sum(),
|
|
|
+ NoPutThroughCount = secondaryHandling.Select(x => x.NoPutThroughCount).Sum()
|
|
|
+ };
|
|
|
+ secondaryHandling.Add(total);
|
|
|
+ //区县合计
|
|
|
+ var countyList = secondaryHandling.Where(x => x.OrgType == EOrgType.County).ToList();
|
|
|
+ var countyTotal = new SecondaryHandlingSatisfactionVo
|
|
|
+ {
|
|
|
+ OrgId = "0",
|
|
|
+ OrgName = "区县合计",
|
|
|
+ TotalSumCount = countyList.Select(x => x.TotalSumCount).Sum(),
|
|
|
+ VerySatisfiedCount = countyList.Select(x => x.VerySatisfiedCount).Sum(),
|
|
|
+ SatisfiedCount = countyList.Select(x => x.SatisfiedCount).Sum(),
|
|
|
+ RegardedAsSatisfiedCount = countyList.Select(x => x.RegardedAsSatisfiedCount).Sum(),
|
|
|
+ DefaultSatisfiedCount = countyList.Select(x => x.DefaultSatisfiedCount).Sum(),
|
|
|
+ NoSatisfiedCount = countyList.Select(x => x.NoSatisfiedCount).Sum(),
|
|
|
+ NoEvaluateCount = countyList.Select(x => x.NoEvaluateCount).Sum(),
|
|
|
+ NoPutThroughCount = countyList.Select(x => x.NoPutThroughCount).Sum()
|
|
|
+ };
|
|
|
+ secondaryHandling.Add(countyTotal);
|
|
|
+ //市直合计
|
|
|
+ var cityList = secondaryHandling.Where(x => x.OrgType == EOrgType.City).ToList();
|
|
|
+ var cityTotal = new SecondaryHandlingSatisfactionVo
|
|
|
+ {
|
|
|
+ OrgId = "0",
|
|
|
+ OrgName = "市直合计",
|
|
|
+ TotalSumCount = cityList.Select(x => x.TotalSumCount).Sum(),
|
|
|
+ VerySatisfiedCount = cityList.Select(x => x.VerySatisfiedCount).Sum(),
|
|
|
+ SatisfiedCount = cityList.Select(x => x.SatisfiedCount).Sum(),
|
|
|
+ RegardedAsSatisfiedCount = cityList.Select(x => x.RegardedAsSatisfiedCount).Sum(),
|
|
|
+ DefaultSatisfiedCount = cityList.Select(x => x.DefaultSatisfiedCount).Sum(),
|
|
|
+ NoSatisfiedCount = cityList.Select(x => x.NoSatisfiedCount).Sum(),
|
|
|
+ NoEvaluateCount = cityList.Select(x => x.NoEvaluateCount).Sum(),
|
|
|
+ NoPutThroughCount = cityList.Select(x => x.NoPutThroughCount).Sum()
|
|
|
+ };
|
|
|
+ secondaryHandling.Add(cityTotal);
|
|
|
+
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+ var dtos = secondaryHandling
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(SecondaryHandlingSatisfactionVo), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "二次办理满意度统计数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理满意度明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("secondary_handling_satisfaction_detail_report")]
|
|
|
+ public async Task<PagedDto<OrderSecondaryHandlingDto>> SecondaryHandlingSatisfactionDetailReport([FromQuery] QuerySecondaryHandlingRequest dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingSatisfactionDetailReport(dto, HttpContext.RequestAborted);
|
|
|
+ var (total, items) = await query.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<OrderSecondaryHandlingDto>(total, _mapper.Map<IReadOnlyList<OrderSecondaryHandlingDto>>(items));
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理满意度明细导出
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("secondary_handling_satisfaction_detail_report/_export")]
|
|
|
+ public async Task<FileStreamResult> SecondaryHandlingSatisfactionDetailReport([FromBody] ExportExcelDto<QuerySecondaryHandlingRequest> dto)
|
|
|
+ {
|
|
|
+ var query = _orderSecondaryHandlingApplication.SecondaryHandlingSatisfactionDetailReport(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ List<OrderSecondaryHandling> secondaryHandling;
|
|
|
+ if (dto.IsExportAll)
|
|
|
+ {
|
|
|
+ secondaryHandling = await query.ToListAsync(HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var (_, items) = await query.ToPagedListAsync(dto.QueryDto, HttpContext.RequestAborted);
|
|
|
+ secondaryHandling = items;
|
|
|
+ }
|
|
|
+
|
|
|
+ var secondaryHandlingDtos = _mapper.Map<ICollection<OrderSecondaryHandlingDto>>(secondaryHandling);
|
|
|
+
|
|
|
+ dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
|
|
|
+
|
|
|
+ var dtos = secondaryHandlingDtos
|
|
|
+ .Select(stu => _mapper.Map(stu, typeof(OrderSecondaryHandlingDto), dynamicClass))
|
|
|
+ .Cast<object>()
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var stream = ExcelHelper.CreateStream(dtos);
|
|
|
+
|
|
|
+ return ExcelStreamResult(stream, "二次办理满意度列表数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|