|
@@ -1,9 +1,11 @@
|
|
-using Hotline.Configurations;
|
|
|
|
|
|
+using DocumentFormat.OpenXml.Drawing;
|
|
|
|
+using Hotline.Configurations;
|
|
using Hotline.KnowledgeBase;
|
|
using Hotline.KnowledgeBase;
|
|
using Hotline.Orders;
|
|
using Hotline.Orders;
|
|
using Hotline.Repository.SqlSugar.Orders;
|
|
using Hotline.Repository.SqlSugar.Orders;
|
|
using Hotline.Settings;
|
|
using Hotline.Settings;
|
|
using Hotline.Settings.Hotspots;
|
|
using Hotline.Settings.Hotspots;
|
|
|
|
+using Hotline.Share.Dtos;
|
|
using Hotline.Share.Dtos.Bigscreen;
|
|
using Hotline.Share.Dtos.Bigscreen;
|
|
using Hotline.Share.Dtos.Order;
|
|
using Hotline.Share.Dtos.Order;
|
|
using Hotline.Share.Enums.KnowledgeBase;
|
|
using Hotline.Share.Enums.KnowledgeBase;
|
|
@@ -28,11 +30,13 @@ namespace Hotline.Api.Controllers.Bigscreen
|
|
private readonly IRepository<OrderVisitDetail> _orderVisitDetailRepository;
|
|
private readonly IRepository<OrderVisitDetail> _orderVisitDetailRepository;
|
|
private readonly IRepository<SystemArea> _systemAreaRepository;
|
|
private readonly IRepository<SystemArea> _systemAreaRepository;
|
|
private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
|
+ private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
|
|
|
|
|
|
public DataScreenController(IOrderRepository orderRepository, IRepository<OrderVisit> orderVisitRepository,
|
|
public DataScreenController(IOrderRepository orderRepository, IRepository<OrderVisit> orderVisitRepository,
|
|
IRepository<OrderDelay> orderDelayRepository, IRepository<Knowledge> knowledgeRepository, IRepository<KnowledgePv> knowledgePvRepository,
|
|
IRepository<OrderDelay> orderDelayRepository, IRepository<Knowledge> knowledgeRepository, IRepository<KnowledgePv> knowledgePvRepository,
|
|
IMapper mapper, IRepository<OrderVisitDetail> orderVisitDetailRepository, IRepository<SystemArea> systemAreaRepository,
|
|
IMapper mapper, IRepository<OrderVisitDetail> orderVisitDetailRepository, IRepository<SystemArea> systemAreaRepository,
|
|
- IOptionsSnapshot<AppConfiguration> appOptions)
|
|
|
|
|
|
+ IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
|
+ IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository)
|
|
{
|
|
{
|
|
_orderRepository = orderRepository;
|
|
_orderRepository = orderRepository;
|
|
_orderVisitRepository = orderVisitRepository;
|
|
_orderVisitRepository = orderVisitRepository;
|
|
@@ -43,6 +47,7 @@ namespace Hotline.Api.Controllers.Bigscreen
|
|
_orderVisitDetailRepository = orderVisitDetailRepository;
|
|
_orderVisitDetailRepository = orderVisitDetailRepository;
|
|
_systemAreaRepository = systemAreaRepository;
|
|
_systemAreaRepository = systemAreaRepository;
|
|
_appOptions = appOptions;
|
|
_appOptions = appOptions;
|
|
|
|
+ _orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -590,5 +595,69 @@ namespace Hotline.Api.Controllers.Bigscreen
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 二次办理统计
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="StartTime"></param>
|
|
|
|
+ /// <param name="EndTime"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [AllowAnonymous]
|
|
|
|
+ [HttpGet("order-secondary-statistics")]
|
|
|
|
+ public async Task<SecondaryProcessingOrderStatisticsDto> OrderSecondaryStatistics(DateTime StartTime, DateTime EndTime)
|
|
|
|
+ {
|
|
|
|
+ EndTime = EndTime.AddDays(1).AddSeconds(-1);
|
|
|
|
+ var data = new SecondaryProcessingOrderStatisticsDto
|
|
|
|
+ {
|
|
|
|
+ OrderCount = await _orderSecondaryHandlingRepository.Queryable()
|
|
|
|
+ .Where(x => x.AuditTime >= StartTime && x.AuditTime <= EndTime && x.State != ESecondaryHandlingState.NotApply
|
|
|
|
+ && x.State != ESecondaryHandlingState.Apply && x.State != ESecondaryHandlingState.Refuse).CountAsync(),
|
|
|
|
+
|
|
|
|
+ OrderOverdueCount = await _orderSecondaryHandlingRepository.Queryable()
|
|
|
|
+ .Includes(x => x.Order)
|
|
|
|
+ .Where(x => x.Order.ExpiredStatus == EExpiredStatus.Expired && x.AuditTime >= StartTime && x.AuditTime <= EndTime
|
|
|
|
+ && x.State != ESecondaryHandlingState.NotApply
|
|
|
|
+ && x.State != ESecondaryHandlingState.Apply && x.State != ESecondaryHandlingState.Refuse)
|
|
|
|
+ .CountAsync(),
|
|
|
|
+
|
|
|
|
+ OrderSoonOverdueCount = await _orderSecondaryHandlingRepository.Queryable()
|
|
|
|
+ .Includes(x => x.Order)
|
|
|
|
+ .Where(x => x.Order.ExpiredStatus == EExpiredStatus.GoingToExpired && x.AuditTime >= StartTime && x.AuditTime <= EndTime
|
|
|
|
+ && x.State != ESecondaryHandlingState.NotApply
|
|
|
|
+ && x.State != ESecondaryHandlingState.Apply && x.State != ESecondaryHandlingState.Refuse)
|
|
|
|
+ .CountAsync()
|
|
|
|
+ };
|
|
|
|
+ var da = await _orderSecondaryHandlingRepository.Queryable()
|
|
|
|
+ .LeftJoin<OrderVisit>((os, ov) => os.VisitId == ov.Id)
|
|
|
|
+ .LeftJoin<OrderVisitDetail>((os, ov, od) => os.VisitDetailId == od.Id)
|
|
|
|
+ .Where((os, ov, od) => ov.VisitTime >= StartTime && ov.VisitTime <= EndTime && os.State != ESecondaryHandlingState.NotApply
|
|
|
|
+ && os.State != ESecondaryHandlingState.Apply && os.State != ESecondaryHandlingState.Refuse)
|
|
|
|
+ .Select((os, ov, od) => new SecondarySatisfactionDto()
|
|
|
|
+ {
|
|
|
|
+ Count = SqlFunc.AggregateCount(os.Id),
|
|
|
|
+ NoSatisfiedCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(od.OrgProcessingResults, "Key") == "1"
|
|
|
|
+ || SqlFunc.JsonField(od.OrgProcessingResults, "Key") == "2", 1, 0)),//不满意数
|
|
|
|
+ }).FirstAsync();
|
|
|
|
+ if (da != null)
|
|
|
|
+ data.SatisfactionRate = da.SatisfiedRate;
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 二次办理中工单概览
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [AllowAnonymous]
|
|
|
|
+ [HttpGet("order-secondary-handling-query")]
|
|
|
|
+ public async Task<List<OrderSecondaryHandlingDto>> OrderSecondaryHandlingDetailQuery()
|
|
|
|
+ {
|
|
|
|
+ var quer = await _orderSecondaryHandlingRepository.Queryable()
|
|
|
|
+ .Includes(x=>x.Order)
|
|
|
|
+ .Where(x => x.CreationTime.Date == DateTime.Now.Date)
|
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
|
+ .Take(50)
|
|
|
|
+ .ToListAsync();
|
|
|
|
+ return _mapper.Map<List<OrderSecondaryHandlingDto>>(quer);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|