|
@@ -6,6 +6,7 @@ using Hotline.Settings;
|
|
using Hotline.Settings.Hotspots;
|
|
using Hotline.Settings.Hotspots;
|
|
using Hotline.Share.Attributes;
|
|
using Hotline.Share.Attributes;
|
|
using Hotline.Share.Dtos;
|
|
using Hotline.Share.Dtos;
|
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
using Hotline.Share.Dtos.Snapshot;
|
|
using Hotline.Share.Dtos.Snapshot;
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
using Hotline.Share.Enums.Order;
|
|
using Hotline.Share.Enums.Order;
|
|
@@ -16,6 +17,7 @@ using Hotline.Snapshot;
|
|
using Hotline.Snapshot.Interfaces;
|
|
using Hotline.Snapshot.Interfaces;
|
|
using Hotline.Tools;
|
|
using Hotline.Tools;
|
|
using Mapster;
|
|
using Mapster;
|
|
|
|
+using MediatR;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NPOI.SS.Formula.Functions;
|
|
using NPOI.SS.Formula.Functions;
|
|
@@ -464,4 +466,20 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
{
|
|
{
|
|
}, true);
|
|
}, true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public ISugarQueryable<HotspotDataStatisticsOutDto> GetHotspotDataStatisticsAsync(HotspotDataStatisticsInDto dto)
|
|
|
|
+ {
|
|
|
|
+ var isCenter = _sessionContext.OrgIsCenter;
|
|
|
|
+ var query = _hotspotTypeRepository.Queryable(includeDeleted: true)
|
|
|
|
+ .LeftJoin<Order>((hotspot, order) => order.HotspotSpliceName != null && (hotspot.HotSpotName == order.HotspotSpliceName || order.HotspotSpliceName.Contains(hotspot.HotSpotName)) && order.IsDeleted == false && order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime)
|
|
|
|
+ .WhereIF(isCenter == false, (hotspot, order) => order.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
|
+ .Where(hotspot => hotspot.ParentId == null)
|
|
|
|
+ .GroupBy((hotspot, order) => new { hotspot.Id, hotspot.HotSpotName })
|
|
|
|
+ .Select((hotspot, order) => new HotspotDataStatisticsOutDto
|
|
|
|
+ {
|
|
|
|
+ Name = hotspot.HotSpotName,
|
|
|
|
+ OrderCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.Id != null, 1, 0)),
|
|
|
|
+ });
|
|
|
|
+ return query;
|
|
|
|
+ }
|
|
}
|
|
}
|