|
@@ -28,16 +28,18 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly IRepository<WorkflowCountersign> _workflowCountersignRepository;
|
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
|
+ private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
|
|
|
|
public BiOrderController(
|
|
|
- IOrderRepository orderRepository,
|
|
|
- IRepository<Hotspot> hotspotTypeRepository,
|
|
|
- ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
|
- IRepository<OrderVisitDetail> orderVisitDetailRepository,
|
|
|
- IRepository<OrderDelay> orderDelayRepository,
|
|
|
- IRepository<WorkflowCountersign> workflowCountersignRepository,
|
|
|
- IRepository<OrderSpecial> orderSpecialRepository,
|
|
|
- IMapper mapper
|
|
|
+ IOrderRepository orderRepository,
|
|
|
+ IRepository<Hotspot> hotspotTypeRepository,
|
|
|
+ ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
|
+ IRepository<OrderVisitDetail> orderVisitDetailRepository,
|
|
|
+ IRepository<OrderDelay> orderDelayRepository,
|
|
|
+ IRepository<WorkflowCountersign> workflowCountersignRepository,
|
|
|
+ IRepository<OrderSpecial> orderSpecialRepository,
|
|
|
+ IMapper mapper,
|
|
|
+ IRepository<OrderVisit> orderVisitRepository
|
|
|
)
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
@@ -48,6 +50,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
_workflowCountersignRepository = workflowCountersignRepository;
|
|
|
_orderSpecialRepository = orderSpecialRepository;
|
|
|
_mapper = mapper;
|
|
|
+ _orderVisitRepository = orderVisitRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -564,6 +567,57 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
return await _orderRepository.HotPortJoinOrgStatistics(dto.StartTime, dto.EndTime);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 回访量统计
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("visit-measure-statistics")]
|
|
|
+ public async Task<List<VisitMeasureStatisticsDto>> VisitMeasureStatistics(DateTime StartDate,DateTime EndDate,string? VisitName)
|
|
|
+ {
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+ var list = await _orderVisitRepository.Queryable()
|
|
|
+ .Includes(x => x.Employee)
|
|
|
+ .Where(x => x.VisitTime >= StartDate && x.VisitTime <= EndDate && x.VisitState == EVisitState.Visited)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(VisitName),x=>x.Employee.Name.Contains(VisitName))
|
|
|
+ .GroupBy(x=> new { x.EmployeeId,x.Employee.Name })
|
|
|
+ .Select(x=> new VisitMeasureStatisticsDto()
|
|
|
+ {
|
|
|
+ VisitName = x.Employee.Name,
|
|
|
+ AiVisitCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitType== EVisitType.ChipVoiceVisit,1,0)),
|
|
|
+ ArtificialVisitCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.VisitType == EVisitType.ArtificialVisit,1,0)),
|
|
|
+ SumCount = SqlFunc.AggregateCount(x.EmployeeId)
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 部门满意度统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartDate"></param>
|
|
|
+ /// <param name="EndDate"></param>
|
|
|
+ /// <param name="OrgName"></param>
|
|
|
+ /// <param name="TypeId">1:办件结果 2:办件态度</param>
|
|
|
+ /// <param name="LineNum"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ // [HttpGet("visit-org-satisfaction-statistics")]
|
|
|
+ //public async Task VisitAndOrgSatisfactionStatistics(DateTime StartDate,DateTime EndDate,string OrgName,int TypeId,string? LineNum )
|
|
|
+ //{
|
|
|
+ // EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+ // var list = await _orderVisitDetailRepository.Queryable()
|
|
|
+ // .Includes(x => x.OrderVisit)
|
|
|
+ // .Where(x => x.OrderVisit.VisitTime >= StartDate && x.OrderVisit.VisitTime <= EndDate && x.VisitTarget == EVisitTarget.Org)
|
|
|
+ // .WhereIF(!string.IsNullOrEmpty(OrgName),x=>x.VisitOrgName.Contains(OrgName))
|
|
|
+ // .GroupBy(x=> new { x.VisitOrgCode ,x.VisitOrgName })
|
|
|
+ // .Select(x => new
|
|
|
+ // {
|
|
|
+ // OrgName = x.VisitOrgName,
|
|
|
+ // OrgCode= x.VisitOrgCode,
|
|
|
+
|
|
|
+ // })
|
|
|
+ // .ToListAsync();
|
|
|
+
|
|
|
|
|
|
+ // }
|
|
|
}
|
|
|
}
|