|
@@ -30,6 +30,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
|
private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
|
|
|
|
+
|
|
|
public BiOrderController(
|
|
|
IOrderRepository orderRepository,
|
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
@@ -72,7 +73,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
OrgName = o.Name,
|
|
|
OrgId = x.ActualHandleOrgCode,
|
|
|
HandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF((int)x.Status >= 300 && x.ExpiredTime > x.FiledTime, 1, 0)),
|
|
|
- NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF((int)x.Status < 300 && x.ExpiredTime > x.FiledTime, 1, 0)),
|
|
|
+ NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF((int)x.Status < 300 && x.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
}).MergeTable();
|
|
|
var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
|
.LeftJoin<WorkflowCountersignMember>((x,o)=>x.Id ==o.WorkflowCountersignId)
|
|
@@ -419,68 +420,6 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
return new PagedDto<OrderSpecialDto>(total, _mapper.Map<IReadOnlyList<OrderSpecialDto>>(items));
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 受理类型前十
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- //[HttpGet("accept_type_top10_list")]
|
|
|
- //public async Task<object> AcceptTypeTop10List([FromQuery] ReportPagedRequest dto)
|
|
|
- // {
|
|
|
- // if (!dto.StartTime.HasValue || !dto.EndTime.HasValue) throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
- // dto.PageIndex = 1;
|
|
|
- // dto.PageSize = 10;
|
|
|
- // var acceptType = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.AcceptType);
|
|
|
- // List<dynamic> listReturn = new List<dynamic>();
|
|
|
- // var validQuery = await _orderRepository.Queryable(false, false, false)
|
|
|
- // .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- // .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- // .Select(x => new
|
|
|
- // {
|
|
|
- // AcceptType = x.AcceptType,
|
|
|
- // OneHotspot = SqlFunc.Substring(x.HotspotSpliceName, 0, SqlFunc.CharIndex("-", x.HotspotSpliceName + "-")),
|
|
|
- // Id = x.Id
|
|
|
- // }).MergeTable()
|
|
|
- // .GroupBy(x => new { x.OneHotspot })
|
|
|
- // .Select(x => new
|
|
|
- // {
|
|
|
- // Name = x.OneHotspot,
|
|
|
- // Id = "0",
|
|
|
- // AcceptName = "有效受理量",
|
|
|
- // Num = SqlFunc.AggregateSum(SqlFunc.IIF(true, 1, 0)),
|
|
|
- // }).ToListAsync();
|
|
|
- // listReturn.AddRange(validQuery);
|
|
|
- // foreach (var item in acceptType)
|
|
|
- // {
|
|
|
- // var query = await _orderRepository.Queryable(false, false, false)
|
|
|
- // .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- // .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- // .Select(x => new
|
|
|
- // {
|
|
|
- // AcceptType = x.AcceptType,
|
|
|
- // OneHotspot = SqlFunc.Substring(x.HotspotSpliceName, 0, SqlFunc.CharIndex("-", x.HotspotSpliceName + "-")),
|
|
|
- // Id = x.Id
|
|
|
- // }).MergeTable()
|
|
|
- // .GroupBy(x => new { x.OneHotspot })
|
|
|
- // .Select(x => new
|
|
|
- // {
|
|
|
- // Name = x.OneHotspot,
|
|
|
- // Id = item.Id,
|
|
|
- // AcceptName = item.DicDataName,
|
|
|
- // Num = SqlFunc.AggregateSum(SqlFunc.IIF(item.DicDataName.Equals(x.AcceptType), 1, 0)),
|
|
|
- // }).ToListAsync();
|
|
|
- // listReturn.AddRange(query);
|
|
|
- // }
|
|
|
- // // if (!string.IsNullOrEmpty(dto.SortField))
|
|
|
- // // {
|
|
|
- // // listReturn = dto.SortRule == 0 ? (from items in listReturn orderby items.Num select items).ToList() : (from items in listReturn orderby items.Num descending select items).ToList();
|
|
|
- // //}
|
|
|
- // // else {
|
|
|
- // // listReturn = (from items in listReturn orderby items.Num descending select items).ToList() ;
|
|
|
- // //}
|
|
|
- // return new { Header= acceptType,Data = listReturn };
|
|
|
- //}
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 受理类型前十
|
|
|
/// </summary>
|
|
@@ -591,33 +530,106 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 部门满意度统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="StartDate"></param>
|
|
|
- /// <param name="EndDate"></param>
|
|
|
- /// <param name="OrgName"></param>
|
|
|
- /// <param name="TypeId">1:办件结果 2:办件态度</param>
|
|
|
- /// <param name="LineNum"></param>
|
|
|
- /// <returns></returns>
|
|
|
- // [HttpGet("visit-org-satisfaction-statistics")]
|
|
|
- //public async Task VisitAndOrgSatisfactionStatistics(DateTime StartDate,DateTime EndDate,string OrgName,int TypeId,string? LineNum )
|
|
|
- //{
|
|
|
- // EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
- // var list = await _orderVisitDetailRepository.Queryable()
|
|
|
- // .Includes(x => x.OrderVisit)
|
|
|
- // .Where(x => x.OrderVisit.VisitTime >= StartDate && x.OrderVisit.VisitTime <= EndDate && x.VisitTarget == EVisitTarget.Org)
|
|
|
- // .WhereIF(!string.IsNullOrEmpty(OrgName),x=>x.VisitOrgName.Contains(OrgName))
|
|
|
- // .GroupBy(x=> new { x.VisitOrgCode ,x.VisitOrgName })
|
|
|
- // .Select(x => new
|
|
|
- // {
|
|
|
- // OrgName = x.VisitOrgName,
|
|
|
- // OrgCode= x.VisitOrgCode,
|
|
|
-
|
|
|
- // })
|
|
|
- // .ToListAsync();
|
|
|
-
|
|
|
-
|
|
|
- // }
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 热点类型小类统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartDate"></param>
|
|
|
+ /// <param name="EndDate"></param>
|
|
|
+ /// <param name="TypeId">0:全部 ,1:市民,2:企业</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("hotspot-statistics")]
|
|
|
+ public async Task<object> HotspotStatistics(DateTime StartDate,DateTime EndDate,int TypeId,string? HotspotCode)
|
|
|
+ {
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(HotspotCode))
|
|
|
+ {
|
|
|
+ var list = await _hotspotTypeRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((it, o) => it.Id == o.HotspotId)
|
|
|
+ .Where((it, o) => o.StartTime >= StartDate && o.StartTime <= EndDate && o.Id!=null)
|
|
|
+ .WhereIF(TypeId==1,(it,o)=> o.IdentityType == EIdentityType.Citizen)
|
|
|
+ .WhereIF(TypeId==2,(it,o)=> o.IdentityType == EIdentityType.Enterprise)
|
|
|
+ .GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("2")) })
|
|
|
+ .Select((it, o) => new
|
|
|
+ {
|
|
|
+ HotspotCode = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("2")),
|
|
|
+ SumCount = SqlFunc.AggregateCount(it.HotSpotName)
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<Hotspot>((x,q)=> x.HotspotCode == q.Id)
|
|
|
+ .Select((x, q) => new {
|
|
|
+ HotspotCode = x.HotspotCode,
|
|
|
+ SumCount = x.SumCount,
|
|
|
+ HotspotName = q.HotSpotName,
|
|
|
+ HasChild = SqlFunc.Subqueryable<Hotspot>().Where(d => d.ParentId == x.HotspotCode).Any()
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string count = (HotspotCode.Length + 2).ToString();
|
|
|
+ string countx = HotspotCode.Length.ToString();
|
|
|
+ var list = await _hotspotTypeRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((it, o)=> it.Id == o.HotspotId)
|
|
|
+ .Where((it, o) => o.StartTime >= StartDate && o.StartTime <= EndDate && it.ParentId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(countx)) == HotspotCode)
|
|
|
+ .WhereIF(TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
|
+ .WhereIF(TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
|
+ .GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(count)) })
|
|
|
+ .Select((it, o) => new
|
|
|
+ {
|
|
|
+ HotspotCode = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(count)),
|
|
|
+ SumCount = SqlFunc.AggregateCount(it.HotSpotName)
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<Hotspot>((x, q) => x.HotspotCode == q.Id)
|
|
|
+ .Select((x, q) => new
|
|
|
+ {
|
|
|
+ HotspotCode = x.HotspotCode,
|
|
|
+ SumCount = x.SumCount,
|
|
|
+ HotspotName = q.HotSpotName,
|
|
|
+ HasChild = SqlFunc.Subqueryable<Hotspot>().Where(d => d.ParentId == x.HotspotCode).Any()
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ return list;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 部门满意度统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartDate"></param>
|
|
|
+ /// <param name="EndDate"></param>
|
|
|
+ /// <param name="OrgName"></param>
|
|
|
+ /// <param name="TypeId">1:办件结果 2:办件态度</param>
|
|
|
+ /// <param name="LineNum"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("visit-org-satisfaction-statistics")]
|
|
|
+ public async Task VisitAndOrgSatisfactionStatistics(DateTime StartDate, DateTime EndDate, string OrgName, int TypeId, string? LineNum)
|
|
|
+ {
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+ var list = await _orderVisitDetailRepository.Queryable()
|
|
|
+ .Includes(x => x.OrderVisit)
|
|
|
+ .Where(x => x.OrderVisit.VisitTime >= StartDate && x.OrderVisit.VisitTime <= EndDate && x.VisitTarget == EVisitTarget.Org)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(OrgName), x => x.VisitOrgName.Contains(OrgName))
|
|
|
+ .GroupBy(x => new { x.VisitOrgCode, x.VisitOrgName })
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
+ OrgName = x.VisitOrgName,
|
|
|
+ OrgCode = x.VisitOrgCode,
|
|
|
+
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|