|
@@ -97,6 +97,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
|
|
|
private readonly IRepository<SchedulingUser> _schedulingUserRepository;
|
|
|
private readonly IRepository<StatisticsHotspotSatisfied> _statisticsHotspotSatisfiedRepository;
|
|
|
+ private readonly IRepository<StatisticsDepartSatisfied> _statisticsDepartSatisfiedRepository;
|
|
|
|
|
|
public OrderApplication(
|
|
|
IOrderDomainService orderDomainService,
|
|
@@ -138,6 +139,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
|
|
|
IRepository<SchedulingUser> schedulingUserRepository,
|
|
|
IRepository<StatisticsHotspotSatisfied> statisticsHotspotSatisfiedRepository,
|
|
|
+ IRepository<StatisticsDepartSatisfied> statisticsDepartSatisfiedRepository,
|
|
|
IOrderDelayRepository orderDelayRepository)
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
@@ -180,6 +182,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
|
|
|
_schedulingUserRepository = schedulingUserRepository;
|
|
|
_statisticsHotspotSatisfiedRepository = statisticsHotspotSatisfiedRepository;
|
|
|
+ _statisticsDepartSatisfiedRepository = statisticsDepartSatisfiedRepository;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1788,8 +1792,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.VisitType != null, x => x.OrderVisit.VisitType == dto.VisitType);
|
|
|
|
|
|
var data = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
+ var oldData = new List<VisitAndOrgSatisfactionStatisticsDto>();
|
|
|
|
|
|
- if (IsCenter && list != null)
|
|
|
+ if (IsCenter && list != null)
|
|
|
{
|
|
|
data = await list.GroupBy(x => new
|
|
|
{
|
|
@@ -1891,8 +1896,102 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
})
|
|
|
.ToListAsync();
|
|
|
}
|
|
|
+ //老系统数据
|
|
|
+ if (await _statisticsDepartSatisfiedRepository.Queryable().Where(x => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value).AnyAsync())
|
|
|
+ {
|
|
|
+ var query = _statisticsDepartSatisfiedRepository.Queryable()
|
|
|
+ .LeftJoin<SystemOrganize>((x, so) => x.DepartmentId == so.oldBmid)
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => so.Id.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .Where((x, so) => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value);
|
|
|
+ if (IsCenter)
|
|
|
+ {
|
|
|
+ oldData = await query.GroupBy((x, so) => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = so.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
|
+ }).Select((x, so) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = so.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
+ 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), //未接通
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
+ .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = o.Name,
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
+ OrgType = o.OrgType,
|
|
|
+ TotalSumCount = it.TotalSumCount,
|
|
|
+ VerySatisfiedCount = it.VerySatisfiedCount, //非常满意数
|
|
|
+ SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
+ RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount, //视为满意
|
|
|
+ DefaultSatisfiedCount = it.DefaultSatisfiedCount, //默认满意
|
|
|
+ NoSatisfiedCount = it.NoSatisfiedCount, //不满意
|
|
|
+ NoEvaluateCount = it.NoEvaluateCount, //未做评价
|
|
|
+ NoPutThroughCount = it.NoPutThroughCount, //未接通
|
|
|
+ })
|
|
|
+ .ToListAsync(); ;
|
|
|
|
|
|
- return data;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oldData = await query.GroupBy((x, so) => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = so.Id
|
|
|
+ }).Select((x, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = o.Id,//.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(orgLevelStr)),
|
|
|
+ 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), //未接通
|
|
|
+ })
|
|
|
+ .MergeTable().LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id && (o.Level == orgLevel || o.Level == (orgLevel + 1)))
|
|
|
+ .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = o.Name,
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
+ OrgType = o.OrgType,
|
|
|
+ TotalSumCount = it.TotalSumCount,
|
|
|
+ VerySatisfiedCount = it.VerySatisfiedCount, //非常满意数
|
|
|
+ SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
+ RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount, //视为满意
|
|
|
+ DefaultSatisfiedCount = it.DefaultSatisfiedCount, //默认满意
|
|
|
+ NoSatisfiedCount = it.NoSatisfiedCount, //不满意
|
|
|
+ NoEvaluateCount = it.NoEvaluateCount, //未做评价
|
|
|
+ NoPutThroughCount = it.NoPutThroughCount, //未接通
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
+ data = (from t1 in data
|
|
|
+ join t2 in oldData on t1.OrgCode equals t2.OrgCode into t1_t2
|
|
|
+ from item in t1_t2.DefaultIfEmpty()
|
|
|
+ select new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = t1.OrgName,
|
|
|
+ OrgCode = t1.OrgCode,
|
|
|
+ OrgType = t1.OrgType,
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|