|
@@ -33,6 +33,7 @@ using Hotline.Share.Enums.Quality;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
using Hotline.Share.Mq;
|
|
|
using Hotline.Share.Requests;
|
|
|
+using Hotline.Statistics;
|
|
|
using Hotline.Tools;
|
|
|
using Hotline.Users;
|
|
|
using Mapster;
|
|
@@ -95,6 +96,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
private readonly IOrderDelayRepository _orderDelayRepository;
|
|
|
private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
|
|
|
private readonly IRepository<SchedulingUser> _schedulingUserRepository;
|
|
|
+ private readonly IRepository<StatisticsHotspotSatisfied> _statisticsHotspotSatisfiedRepository;
|
|
|
|
|
|
public OrderApplication(
|
|
|
IOrderDomainService orderDomainService,
|
|
@@ -135,6 +137,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<OrderPublishHistory> orderPublishHistoryRepository,
|
|
|
IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
|
|
|
IRepository<SchedulingUser> schedulingUserRepository,
|
|
|
+ IRepository<StatisticsHotspotSatisfied> statisticsHotspotSatisfiedRepository,
|
|
|
IOrderDelayRepository orderDelayRepository)
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
@@ -176,6 +179,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderDelayRepository = orderDelayRepository;
|
|
|
_orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
|
|
|
_schedulingUserRepository = schedulingUserRepository;
|
|
|
+ _statisticsHotspotSatisfiedRepository = statisticsHotspotSatisfiedRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1771,8 +1775,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgSatisfactionStatistics(PagedKeywordSonRequest dto)
|
|
|
{
|
|
|
bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
- int orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
- string orgLevelStr = ((orgLevel + 1) * 3).ToString();
|
|
|
+ var orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
var list = _orderVisitDetailRepository.Queryable()
|
|
|
.Where(x => x.OrderVisit.VisitTime >= dto.StartTime.Value && x.OrderVisit.VisitTime <= dto.EndTime.Value &&
|
|
|
x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
@@ -1840,13 +1843,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
data = await list.GroupBy(x => new
|
|
|
{
|
|
|
- VisitOrgCode = x.VisitOrgCode//.Substring(SqlFunc.MappingColumn<int>("0"),SqlFunc.MappingColumn<int>(orgLevelStr))
|
|
|
+ x.VisitOrgCode
|
|
|
})
|
|
|
.Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
{
|
|
|
- OrgCode = x.VisitOrgCode,//.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
+ OrgCode = x.VisitOrgCode,
|
|
|
TotalSumCount =
|
|
|
- SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr))),
|
|
|
+ SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1,
|
|
|
SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "5", 1, 0)),
|
|
|
SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "5", 1, 0))), //非常满意数
|
|
@@ -1887,7 +1890,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
})
|
|
|
.ToListAsync();
|
|
|
}
|
|
|
-
|
|
|
return data;
|
|
|
}
|
|
|
|
|
@@ -2275,7 +2277,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
var data = new List<VisitAndHotspotSatisfactionStatisticsDto>();
|
|
|
|
|
|
- if (IsCenter && list != null)
|
|
|
+ if (IsCenter && list != null)
|
|
|
{
|
|
|
data = await list.GroupBy((x, h) => new
|
|
|
{
|
|
@@ -2352,6 +2354,50 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.ToListAsync();
|
|
|
}
|
|
|
|
|
|
+ //老系统数据
|
|
|
+ if (await _statisticsHotspotSatisfiedRepository.Queryable().Where(x=>x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value).AnyAsync())
|
|
|
+ {
|
|
|
+ var oldList =await _statisticsHotspotSatisfiedRepository.Queryable()
|
|
|
+ .InnerJoin<Hotspot>((x, h) =>
|
|
|
+ h.Id == x.HotspotId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("2")) &&
|
|
|
+ h.ParentId == null)
|
|
|
+ .GroupBy((x, h) => new
|
|
|
+ {
|
|
|
+ HotspotName = h.HotSpotName,
|
|
|
+ HotspotId = h.Id
|
|
|
+ })
|
|
|
+ .Select((x, h) => new VisitAndHotspotSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ HotspotName = h.HotSpotName,
|
|
|
+ HotspotId = h.Id,
|
|
|
+ TotalSumCount = SqlFunc.AggregateSum(x.Total) ,
|
|
|
+ VerySatisfiedCount = SqlFunc.AggregateSum(x.VerySatisfaction), //非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.AggregateSum(x.Satisfaction), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.AggregateSum(x.TreatSatisfaction), //视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.AggregateSum(x.DefaultSatisfaction), //默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.AggregateSum(x.Dissatisfaction), //不满意
|
|
|
+ NoEvaluateCount = SqlFunc.AggregateSum(x.NotEvaluated), //未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.AggregateSum(x.BlockCall), //未接通
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ data = (from t1 in data
|
|
|
+ join t2 in oldList on t1.HotspotId equals t2.HotspotId into t1_t2
|
|
|
+ from item in t1_t2.DefaultIfEmpty()
|
|
|
+ select new VisitAndHotspotSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ HotspotName = t1.HotspotName,
|
|
|
+ HotspotId = t1.HotspotId,
|
|
|
+ TotalSumCount = t1.TotalSumCount + t1_t2.Select(x=>x.TotalSumCount).FirstOrDefault(),
|
|
|
+ VerySatisfiedCount = t1.VerySatisfiedCount + t1_t2.Select(x => x.VerySatisfiedCount).FirstOrDefault(),//非常满意数
|
|
|
+ SatisfiedCount = t1.SatisfiedCount + t1_t2.Select(x => x.SatisfiedCount).FirstOrDefault(), //满意数
|
|
|
+ RegardedAsSatisfiedCount = t1.RegardedAsSatisfiedCount + t1_t2.Select(x => x.RegardedAsSatisfiedCount).FirstOrDefault(), //视为满意
|
|
|
+ DefaultSatisfiedCount = t1.DefaultSatisfiedCount + t1_t2.Select(x => x.DefaultSatisfiedCount).FirstOrDefault(), //默认满意
|
|
|
+ NoSatisfiedCount = t1.NoSatisfiedCount + t1_t2.Select(x => x.NoSatisfiedCount).FirstOrDefault(), //不满意
|
|
|
+ NoEvaluateCount = t1.NoEvaluateCount + t1_t2.Select(x => x.NoEvaluateCount).FirstOrDefault(), //未做评价
|
|
|
+ NoPutThroughCount = t1.NoPutThroughCount + t1_t2.Select(x => x.NoPutThroughCount).FirstOrDefault(), //未接通
|
|
|
+ }).ToList();
|
|
|
+ }
|
|
|
return data;
|
|
|
}
|
|
|
|