|
@@ -17,6 +17,8 @@ using XF.Domain.Exceptions;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
+using Org.BouncyCastle.Utilities;
|
|
|
+using Polly.Caching;
|
|
|
|
|
|
namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
@@ -657,7 +659,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
/// <param name="StartDate"></param>
|
|
|
/// <param name="EndDate"></param>
|
|
|
/// <returns></returns>
|
|
|
- [HttpGet("Center_report_forms_statistics")]
|
|
|
+ [HttpGet("center_report_forms_statistics")]
|
|
|
public async Task<CenterReportStatisticsDto> CenterReportFormsStatistics(DateTime StartDate, DateTime EndDate)
|
|
|
{
|
|
|
EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
@@ -856,6 +858,83 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
return centerReportStatisticsDto;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 部门受理类型统计周期
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartDate"></param>
|
|
|
+ /// <param name="EndDate"></param>
|
|
|
+ /// <param name="TypeCode">0:全部,1:中心,2:部门</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("department_acceptance_type_statistics")]
|
|
|
+ public async Task<List<DepartmentAcceptanceTypeStatisticsDto>> DepartmentAcceptanceTypeStatistics(DateTime StartDate, DateTime EndDate, int TypeCode)
|
|
|
+ {
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+ var orderData = await _orderRepository.Queryable()
|
|
|
+ .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
|
|
|
+ .Where((it, o) => it.CreationTime >= StartDate && it.CreationTime <= EndDate && (int)it.Status >= 300)
|
|
|
+ .WhereIF(TypeCode == 1, (it, o) => it.OrgLevelOneCode == "001")
|
|
|
+ .WhereIF(TypeCode == 2, (it, o) => it.OrgLevelOneCode != "001")
|
|
|
+ .GroupBy((it, o) => new
|
|
|
+ {
|
|
|
+ it.OrgLevelOneCode,
|
|
|
+ o.Name,
|
|
|
+ o.OrgType
|
|
|
+ })
|
|
|
+ .Select((it, o) => new DepartmentAcceptanceTypeStatisticsDto
|
|
|
+ {
|
|
|
+ OrgName = it.OrgLevelOneCode == "001" ? "热线中心" : o.Name,
|
|
|
+ OrgCode = it.OrgLevelOneCode,
|
|
|
+ OrgType = (int)o.OrgType == 2 ? "区县部门" : "市直部门",
|
|
|
+ ZxAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "10", 1, 0)),
|
|
|
+ ZxAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "10" && it.AllDuration != null, it.AllDuration, 0)),
|
|
|
+ ZxAcceptanceTypeCode = "10",
|
|
|
+
|
|
|
+ JyAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "15", 1, 0)),
|
|
|
+ JyAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "15" && it.FileDurationWorkday != null, it.FileDurationWorkday, 0)),
|
|
|
+ JyAcceptanceTypeCode = "15",
|
|
|
+
|
|
|
+ QzAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "20", 1, 0)),
|
|
|
+ QzAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "20" && it.FileDurationWorkday != null, it.FileDurationWorkday, 0)),
|
|
|
+ QzAcceptanceTypeCode = "20",
|
|
|
+
|
|
|
+ ByAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "25", 1, 0)),
|
|
|
+ ByAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "25" && it.FileDurationWorkday != null, it.FileDurationWorkday, 0)),
|
|
|
+ ByAcceptanceTypeCode = "25",
|
|
|
+
|
|
|
+ JbAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "30", 1, 0)),
|
|
|
+ JbAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "30" && it.FileDurationWorkday != null, it.FileDurationWorkday, 0)),
|
|
|
+ JbAcceptanceTypeCode = "30",
|
|
|
+
|
|
|
+ TsAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "35", 1, 0)),
|
|
|
+ TsAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "35" && it.FileDurationWorkday != null, it.FileDurationWorkday, 0)),
|
|
|
+ TsAcceptanceTypeCode = "35",
|
|
|
+
|
|
|
+ QtAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "40", 1, 0)),
|
|
|
+ QtAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "40" && it.FileDurationWorkday != null, it.FileDurationWorkday, 0)),
|
|
|
+ QtAcceptanceTypeCode = "40"
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ return orderData;
|
|
|
+ }
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("department_acceptance_type_order_list")]
|
|
|
+ public async Task<PagedDto<OrderDto>> DepartmentAcceptanceTypeOrderList([FromQuery] DepartmentKeyWordRequest dto)
|
|
|
+ {
|
|
|
+ dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+ var (total, items) = await _orderRepository.Queryable()
|
|
|
+ .Where(p => p.CreationTime >= dto.StartDate && p.CreationTime <= dto.EndDate && (int)p.Status >= 300)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneCode), p => p.OrgLevelOneCode == dto.OrgLevelOneCode)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.AcceptTypeCode), p => p.AcceptTypeCode == dto.AcceptTypeCode)
|
|
|
+ .OrderByDescending(d => d.CreationTime)
|
|
|
+ .ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
|
+ }
|
|
|
}
|
|
|
}
|