|
@@ -14,6 +14,7 @@ using Hotline.Share.Dtos.Ai;
|
|
|
using Hotline.Share.Dtos.Bi;
|
|
|
using Hotline.Share.Dtos.Bigscreen;
|
|
|
using Hotline.Share.Dtos.CallCenter;
|
|
|
+using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
@@ -3010,6 +3011,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
[HttpGet("hotspot-area-statistics")]
|
|
|
public async Task<object> HotspotAndAreaStatistics([FromQuery] HotspotAndAreaStatisticsReq dto)
|
|
|
{
|
|
|
+
|
|
|
var (areaList, returnList) = await _orderApplication.HotspotAndAreaStatistics(dto);
|
|
|
|
|
|
return new { AreaList = areaList, Data = returnList };
|
|
@@ -3037,7 +3039,32 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
[HttpGet("accepttype-statistics")]
|
|
|
public async Task<List<AcceptTypeStatisticsDto>> AcceptTypeStatistics([FromQuery] AcceptTypeStatisticsReq dto)
|
|
|
{
|
|
|
+ dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
+ var list = await _orderRepository.Queryable()
|
|
|
+ .Where(x => x.CreationTime >= dto.StartTime && x.CreationTime < dto.EndTime)
|
|
|
+ .GroupBy(x => x.AcceptType)
|
|
|
+ .Select(x => new AcceptTypeStatisticsDto
|
|
|
+ {
|
|
|
+ AcceptType = x.AcceptType,
|
|
|
+ SumCount = SqlFunc.AggregateCount(x.AcceptType),
|
|
|
+ CompletionCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status>= EOrderStatus.Filed,1,0)),
|
|
|
+ VisitCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EOrderStatus.Visited,1,0))
|
|
|
+ }).ToListAsync();
|
|
|
+ int SumCount = list.Sum(x => x.SumCount);
|
|
|
+ list.Add(new AcceptTypeStatisticsDto()
|
|
|
+ {
|
|
|
+ AcceptType="合计",
|
|
|
+ SumCount = SumCount,
|
|
|
+ CompletionCount = list.Sum(x=>x.CompletionCount),
|
|
|
+ VisitCount = list.Sum(x=>x.VisitCount)
|
|
|
+ });
|
|
|
|
|
|
+ list.ForEach(x =>
|
|
|
+ {
|
|
|
+ x.SumCountRate = SumCount > 0 ? Math.Round((double)x.SumCount / (double)SumCount) : 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
|