|
@@ -8,8 +8,10 @@ using Hotline.Settings;
|
|
|
using Hotline.Settings.TimeLimits;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.JudicialManagement;
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
using MapsterMapper;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using SqlSugar;
|
|
|
using System.Diagnostics.Eventing.Reader;
|
|
@@ -67,6 +69,7 @@ namespace Hotline.Api.Controllers
|
|
|
.WhereIF(dto.IsEnforcementOrder.HasValue, d => d.IsEnforcementOrder == dto.IsEnforcementOrder)//是否行政执法类
|
|
|
.WhereIF(dto.IsPassTheBuckOrder.HasValue, d => d.IsPassTheBuckOrder == dto.IsPassTheBuckOrder)//是否推诿
|
|
|
.WhereIF(dto.IsTheClueTrue.HasValue, d => d.IsTheClueTrue == dto.IsTheClueTrue)//线索是否属实
|
|
|
+ .WhereIF(dto.EventTypeId.Any(), d => dto.EventTypeId.Contains(d.EventTypeId))//事项分类
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Title), d => d.Order.Title.Contains(dto.Title!)) //标题
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), d => d.Order.ProvinceNo.Contains(dto.ProvinceNo)) //省本地编号
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), d => d.Order.No.Contains(dto.No)) //工单编码
|
|
@@ -230,7 +233,7 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
OrgName = d.Order.OrgLevelOneName,
|
|
|
CountNum = SqlFunc.AggregateCount(d.Order.OrgLevelOneCode),
|
|
|
- TheClueIsTrue = SqlFunc.AggregateSum(SqlFunc.IIF(d.IsTheClueTrue.HasValue && d.IsTheClueTrue.Value==true, 1, 0)),
|
|
|
+ TheClueIsTrue = SqlFunc.AggregateSum(SqlFunc.IIF(d.IsTheClueTrue.HasValue && d.IsTheClueTrue.Value == true, 1, 0)),
|
|
|
TheClueIsNotTrue = SqlFunc.AggregateSum(SqlFunc.IIF(d.IsTheClueTrue.HasValue && d.IsTheClueTrue.Value == false, 1, 0)),
|
|
|
EnforcementOrder = SqlFunc.AggregateSum(SqlFunc.IIF(d.IsEnforcementOrder, 1, 0))
|
|
|
})
|
|
@@ -238,5 +241,90 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
return data;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 事项分类统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartDate"></param>
|
|
|
+ /// <param name="EndDate"></param>
|
|
|
+ /// <param name="Id"></param>
|
|
|
+ /// <param name="AreaCode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("enforcement_event_classification_statistics")]
|
|
|
+ public async Task<object> GetEventClassificationStatisticsAsync(DateTime StartDate, DateTime EndDate, string Id, string AreaCode)
|
|
|
+ {
|
|
|
+
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+ var items = await _judicialComplaintsEventTypeRepository.Queryable()
|
|
|
+ .LeftJoin<EnforcementOrders>((x, o) => o.EventTypeSpliceName != null && (x.EventTypeName == o.EventTypeSpliceName || o.EventTypeSpliceName.Contains(x.EventTypeName)))
|
|
|
+ .LeftJoin<Order>((x, o, p) => p.Id == o.Id)
|
|
|
+ .Where((x, o, p) => p.FiledTime >= StartDate && p.FiledTime <= EndDate)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(AreaCode), (x, o, p) => p.AreaCode == AreaCode)
|
|
|
+ .Where((x, o, p) => x.ParentId == Id)
|
|
|
+ .GroupBy((x, o, p) => new { x.Id, x.EventTypeName })
|
|
|
+ .Select((x, o, p) => new
|
|
|
+ {
|
|
|
+ Id = x.Id,
|
|
|
+ Name = x.EventTypeName,
|
|
|
+ Num = SqlFunc.AggregateSum(SqlFunc.IIF(p.Id != null, 1, 0)),
|
|
|
+ Sublevel = SqlFunc.AggregateSum(SqlFunc.IIF(x.EventTypeName != o.EventTypeName, 1, 0)) > 0,
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var total = new
|
|
|
+ {
|
|
|
+ Id = "0",
|
|
|
+ Name = "合计",
|
|
|
+ Num = items.Sum(x => x.Num),
|
|
|
+ Sublevel = false
|
|
|
+ };
|
|
|
+
|
|
|
+ var orderCount = new
|
|
|
+ {
|
|
|
+ TheClueIsTrue = 0,
|
|
|
+ TheClueIsNotTrue = 0,
|
|
|
+ EnforcementOrder = 0,
|
|
|
+ PassTheBuckOrder = 0
|
|
|
+ };
|
|
|
+
|
|
|
+ return new { List = items, Total = total , OrderCount = orderCount };
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 区域受理排行
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("regional_classification_statistics")]
|
|
|
+ public async Task<object> GetRegionalClassificationStatisticsAsync(DateTime StartDate, DateTime EndDate)
|
|
|
+ {
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+ var list = await _enforcementOrdersRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Where(x => x.Order.Id != null)
|
|
|
+ .Where(x => x.Order.FiledTime >= StartDate && x.Order.FiledTime <= EndDate)
|
|
|
+ .LeftJoin<SystemArea>((x, o) => x.Order.AreaCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) == o.Id)
|
|
|
+ .Where((x, o) => x.Order.Status >= EOrderStatus.Filed)
|
|
|
+ .GroupBy((x, o) => new
|
|
|
+ {
|
|
|
+ AreaCode = x.Order.AreaCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
+ o.AreaName,
|
|
|
+ })
|
|
|
+ .Select((x, o) => new
|
|
|
+ {
|
|
|
+ AreaCode = x.Order.AreaCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
+ AreaName = o.AreaName,
|
|
|
+ OrderCountNum = SqlFunc.AggregateCount(x.Order.AreaCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
+ TheClueIsTrue = SqlFunc.AggregateSum(SqlFunc.IIF(x.IsTheClueTrue.HasValue && x.IsTheClueTrue.Value == true, 1, 0)),
|
|
|
+ TheClueIsNotTrue = SqlFunc.AggregateSum(SqlFunc.IIF(x.IsTheClueTrue.HasValue && x.IsTheClueTrue.Value == false, 1, 0)),
|
|
|
+ EnforcementOrder = SqlFunc.AggregateSum(SqlFunc.IIF(x.IsEnforcementOrder, 1, 0))
|
|
|
+ }).MergeTable()
|
|
|
+ .Where(x => x.AreaCode != "519800" && x.AreaCode != "519900")
|
|
|
+ .OrderByDescending(it => it.OrderCountNum)
|
|
|
+ .ToListAsync();
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|
|
|
}
|