|
@@ -30,6 +30,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
|
|
|
|
|
|
+
|
|
public BiOrderController(
|
|
public BiOrderController(
|
|
IOrderRepository orderRepository,
|
|
IOrderRepository orderRepository,
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
@@ -591,6 +592,73 @@ namespace Hotline.Api.Controllers.Bi
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <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)
|
|
|
|
+ .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
|
|
|
|
+ })
|
|
|
|
+ .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)
|
|
|
|
+ .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
|
|
|
|
+ })
|
|
|
|
+ .ToListAsync();
|
|
|
|
+ return list;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 部门满意度统计
|
|
/// 部门满意度统计
|
|
/// </summary>
|
|
/// </summary>
|