|
@@ -1,8 +1,11 @@
|
|
using Hotline.Caching.Interfaces;
|
|
using Hotline.Caching.Interfaces;
|
|
using Hotline.CallCenter.Calls;
|
|
using Hotline.CallCenter.Calls;
|
|
|
|
+using Hotline.FlowEngine.WorkflowModules;
|
|
using Hotline.FlowEngine.Workflows;
|
|
using Hotline.FlowEngine.Workflows;
|
|
using Hotline.Orders;
|
|
using Hotline.Orders;
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
|
|
+using Hotline.Schedulings;
|
|
|
|
+using Hotline.Repository.SqlSugar.System;
|
|
using Hotline.Settings;
|
|
using Hotline.Settings;
|
|
using Hotline.Settings.Hotspots;
|
|
using Hotline.Settings.Hotspots;
|
|
using Hotline.Share.Dtos;
|
|
using Hotline.Share.Dtos;
|
|
@@ -46,6 +49,8 @@ namespace Hotline.Api.Controllers.Bi
|
|
private readonly ISessionContext _sessionContext;
|
|
private readonly ISessionContext _sessionContext;
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
private readonly IRepository<OrderSpecialDetail> _orderSpecialDetailRepository;
|
|
private readonly IRepository<OrderSpecialDetail> _orderSpecialDetailRepository;
|
|
|
|
+ private readonly IRepository<WorkflowStepHandler> _workflowStepHandler;
|
|
|
|
+ private readonly IRepository<WorkflowTrace> _workflowTraceRepository;
|
|
|
|
|
|
public BiOrderController(
|
|
public BiOrderController(
|
|
IOrderRepository orderRepository,
|
|
IOrderRepository orderRepository,
|
|
@@ -63,7 +68,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
IRepository<AiOrderVisitDetail> aiOrderVisitDetailRepository,
|
|
IRepository<AiOrderVisitDetail> aiOrderVisitDetailRepository,
|
|
ISessionContext sessionContext,
|
|
ISessionContext sessionContext,
|
|
ISystemSettingCacheManager systemSettingCacheManager,
|
|
ISystemSettingCacheManager systemSettingCacheManager,
|
|
- IRepository<OrderSpecialDetail> orderSpecialDetailRepository
|
|
|
|
|
|
+ IRepository<OrderSpecialDetail> orderSpecialDetailRepository,
|
|
|
|
+ IRepository<WorkflowStepHandler> workflowStepHandler,
|
|
|
|
+ IRepository<WorkflowTrace> workflowTraceRepository
|
|
)
|
|
)
|
|
{
|
|
{
|
|
_orderRepository = orderRepository;
|
|
_orderRepository = orderRepository;
|
|
@@ -82,21 +89,41 @@ namespace Hotline.Api.Controllers.Bi
|
|
_sessionContext = sessionContext;
|
|
_sessionContext = sessionContext;
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
_orderSpecialDetailRepository = orderSpecialDetailRepository;
|
|
_orderSpecialDetailRepository = orderSpecialDetailRepository;
|
|
|
|
+ _workflowStepHandler = workflowStepHandler;
|
|
|
|
+ _workflowTraceRepository = workflowTraceRepository;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//public async Task OrgDataListDetail([FromQuery] OrgDataListDetailRequest dto)
|
|
//public async Task OrgDataListDetail([FromQuery] OrgDataListDetailRequest dto)
|
|
//{
|
|
//{
|
|
- // dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
+ // dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
- // await _orderRepository.Queryable()
|
|
|
|
- // .Where(x => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
|
|
+ // var queryOrder = _orderRepository.Queryable()
|
|
|
|
+ // .Where(x => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
// .WhereIF(dto.QueryType == 1, x => x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) //业务已办超期
|
|
// .WhereIF(dto.QueryType == 1, x => x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) //业务已办超期
|
|
// //.WhereIF(dto.QueryType== 2,) //会签已办超期
|
|
// //.WhereIF(dto.QueryType== 2,) //会签已办超期
|
|
// .WhereIF(dto.QueryType == 3, x => x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()) //业务待办超期
|
|
// .WhereIF(dto.QueryType == 3, x => x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()) //业务待办超期
|
|
// //.WhereIF(dto.QueryType ==4,) //会签待办超期
|
|
// //.WhereIF(dto.QueryType ==4,) //会签待办超期
|
|
- // .ToPageListAsync(dto.PageIndex, dto.PageSize);
|
|
|
|
-
|
|
|
|
|
|
+ // .MergeTable();
|
|
|
|
+ // //.ToPageListAsync(dto.PageIndex, dto.PageSize);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
|
|
+ // .LeftJoin<WorkflowCountersignMember>((x, o) => x.Id == o.WorkflowCountersignId)
|
|
|
|
+ // .Where( x => x.CreationTime >= dto.StartTime)
|
|
|
|
+ // .Where( x => x.CreationTime <= dto.EndTime)
|
|
|
|
+ // .MergeTable();
|
|
|
|
+
|
|
|
|
+ // var query = queryOrder.LeftJoin(queryCountersign, (or, co) => or.Id == co.w)
|
|
|
|
+ // .Select((or, co) => new OrderBiOrgDataListVo
|
|
|
|
+ // {
|
|
|
|
+ // OrgName = or.OrgName,
|
|
|
|
+ // OrgId = or.OrgId,
|
|
|
|
+ // HandlerExtendedNum = or.HandlerExtendedNum,
|
|
|
|
+ // NoHandlerExtendedNum = or.NoHandlerExtendedNum,
|
|
|
|
+ // CounterHandlerExtendedNum = co.CounterHandlerExtendedNum,
|
|
|
|
+ // CounterNoHandlerExtendedNum = co.CounterNoHandlerExtendedNum
|
|
|
|
+ // }).MergeTable();
|
|
//}
|
|
//}
|
|
|
|
|
|
|
|
|
|
@@ -114,19 +141,37 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
|
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
- var queryOrder = _orderRepository.Queryable(false, false, false)
|
|
|
|
- .LeftJoin<SystemOrganize>((x, o) => x.ActualHandleOrgCode == o.Id)
|
|
|
|
- .WhereIF(dto.StartTime.HasValue, (x, o) => x.CreationTime >= dto.StartTime)
|
|
|
|
- .WhereIF(dto.EndTime.HasValue, (x, o) => x.CreationTime <= dto.EndTime)
|
|
|
|
- .WhereIF(IsCenter == false, (x, o) => x.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
|
- .GroupBy((x, o) => new { x.ActualHandleOrgCode, o.Name })
|
|
|
|
|
|
+
|
|
|
|
+ var queryOrder = _systemOrganizeRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x,o)=> x.Id == o.ActualHandleOrgCode)
|
|
|
|
+ .WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= dto.StartTime)
|
|
|
|
+ .WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= dto.EndTime)
|
|
|
|
+ .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
|
+ .GroupBy((x,o) => new { x.Id, x.Name })
|
|
.Select((x, o) => new OrderBiOrgDataListVo
|
|
.Select((x, o) => new OrderBiOrgDataListVo
|
|
{
|
|
{
|
|
- OrgName = o.Name,
|
|
|
|
- OrgId = x.ActualHandleOrgCode,
|
|
|
|
- HandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime, 1, 0)),
|
|
|
|
- NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
|
|
|
+ OrgName = x.Name,
|
|
|
|
+ OrgId = x.Id,
|
|
|
|
+ HandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status >= EOrderStatus.Filed && o.ExpiredTime < o.FiledTime, 1, 0)),
|
|
|
|
+ NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status < EOrderStatus.Filed && o.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
}).MergeTable();
|
|
}).MergeTable();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //var queryOrder = _orderRepository.Queryable(false, false, false)
|
|
|
|
+ // .LeftJoin<SystemOrganize>((x, o) => x.ActualHandleOrgCode == o.Id)
|
|
|
|
+ // .WhereIF(dto.StartTime.HasValue, (x, o) => x.CreationTime >= dto.StartTime)
|
|
|
|
+ // .WhereIF(dto.EndTime.HasValue, (x, o) => x.CreationTime <= dto.EndTime)
|
|
|
|
+ // .WhereIF(IsCenter == false, (x, o) => x.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
|
+ // .GroupBy((x, o) => new { x.ActualHandleOrgCode, o.Name })
|
|
|
|
+ // .Select((x, o) => new OrderBiOrgDataListVo
|
|
|
|
+ // {
|
|
|
|
+ // OrgName = o.Name,
|
|
|
|
+ // OrgId = x.ActualHandleOrgCode,
|
|
|
|
+ // HandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime, 1, 0)),
|
|
|
|
+ // NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
|
+ // }).MergeTable();
|
|
|
|
+
|
|
var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
.LeftJoin<WorkflowCountersignMember>((x, o) => x.Id == o.WorkflowCountersignId)
|
|
.LeftJoin<WorkflowCountersignMember>((x, o) => x.Id == o.WorkflowCountersignId)
|
|
.WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
.WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
@@ -264,6 +309,8 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
|
|
|
dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
+
|
|
if (dto.Type == 0)
|
|
if (dto.Type == 0)
|
|
{
|
|
{
|
|
dto.ChainEndTime = dto.ChainEndTime.Value.AddDays(1).AddSeconds(-1);
|
|
dto.ChainEndTime = dto.ChainEndTime.Value.AddDays(1).AddSeconds(-1);
|
|
@@ -274,6 +321,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
.WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= dto.StartTime)
|
|
.WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= dto.StartTime)
|
|
.WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= dto.EndTime)
|
|
.WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= dto.EndTime)
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), (x, o) => x.HotSpotName.Contains(dto.Keyword!))
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), (x, o) => x.HotSpotName.Contains(dto.Keyword!))
|
|
|
|
+ .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
.Where((x, o) => x.ParentId == dto.Id)
|
|
.Where((x, o) => x.ParentId == dto.Id)
|
|
.Where((x, o) => x.IsDeleted == false)
|
|
.Where((x, o) => x.IsDeleted == false)
|
|
.GroupBy((x, o) => new { x.Id, x.HotSpotName })
|
|
.GroupBy((x, o) => new { x.Id, x.HotSpotName })
|
|
@@ -310,6 +358,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
.WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= chainStartTime)
|
|
.WhereIF(dto.StartTime.HasValue, (x, o) => o.CreationTime >= chainStartTime)
|
|
.WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= chainEndTime)
|
|
.WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= chainEndTime)
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), (x, o) => x.HotSpotName.Contains(dto.Keyword!))
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), (x, o) => x.HotSpotName.Contains(dto.Keyword!))
|
|
|
|
+ .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
.Where((x, o) => x.ParentId == dto.Id)
|
|
.Where((x, o) => x.ParentId == dto.Id)
|
|
.Where((x, o) => x.IsDeleted == false)
|
|
.Where((x, o) => x.IsDeleted == false)
|
|
.GroupBy((x, o) => new { x.Id, x.HotSpotName })
|
|
.GroupBy((x, o) => new { x.Id, x.HotSpotName })
|
|
@@ -676,6 +725,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
{
|
|
{
|
|
EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
if (string.IsNullOrEmpty(HotspotCode))
|
|
if (string.IsNullOrEmpty(HotspotCode))
|
|
{
|
|
{
|
|
@@ -684,6 +734,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
.Where((it, o) => o.CreationTime >= StartDate && o.CreationTime <= EndDate && o.Id != null)
|
|
.Where((it, o) => o.CreationTime >= StartDate && o.CreationTime <= EndDate && o.Id != null)
|
|
.WhereIF(TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
.WhereIF(TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
.WhereIF(TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
.WhereIF(TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
|
|
+ .WhereIF(IsCenter == false, (it, o) => o.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
.GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("2")) })
|
|
.GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("2")) })
|
|
.Select((it, o) => new
|
|
.Select((it, o) => new
|
|
{
|
|
{
|
|
@@ -712,6 +763,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
.Where((it, o) => o.CreationTime >= StartDate && o.CreationTime <= EndDate && it.ParentId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(countx)) == HotspotCode)
|
|
.Where((it, o) => o.CreationTime >= StartDate && o.CreationTime <= EndDate && it.ParentId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(countx)) == HotspotCode)
|
|
.WhereIF(TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
.WhereIF(TypeId == 1, (it, o) => o.IdentityType == EIdentityType.Citizen)
|
|
.WhereIF(TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
.WhereIF(TypeId == 2, (it, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
|
|
+ .WhereIF(IsCenter == false, (it, o) => o.ActualHandleOrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
.GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(count)) })
|
|
.GroupBy((it, o) => new { Id = it.Id.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>(count)) })
|
|
.Select((it, o) => new
|
|
.Select((it, o) => new
|
|
{
|
|
{
|
|
@@ -758,13 +810,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
{
|
|
{
|
|
VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
VisitOrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
})
|
|
})
|
|
- .GroupByIF(IsCenter == false, x => new
|
|
|
|
- {
|
|
|
|
- VisitOrgCode = x.VisitOrgCode
|
|
|
|
- })
|
|
|
|
.Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
.Select(x => new VisitAndOrgSatisfactionStatisticsDto()
|
|
{
|
|
{
|
|
- OrgCode = SqlFunc.IIF(IsCenter, x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")), x.VisitOrgCode),
|
|
|
|
|
|
+ OrgCode = x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
TotalSumCount = SqlFunc.AggregateCount(x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
VerySatisfiedCount = SqlFunc.IIF(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))),//非常满意数
|
|
VerySatisfiedCount = SqlFunc.IIF(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))),//非常满意数
|
|
SatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
SatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
@@ -1192,7 +1240,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
/// <param name="TypeCode">0:全部,1:中心,2:部门</param>
|
|
/// <param name="TypeCode">0:全部,1:中心,2:部门</param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
[HttpGet("department_acceptance_type_statistics")]
|
|
[HttpGet("department_acceptance_type_statistics")]
|
|
- public async Task<object> DepartmentAcceptanceTypeStatistics(DateTime StartDate, DateTime EndDate, int TypeCode)
|
|
|
|
|
|
+ public async Task<List<DepartmentAcceptanceTypeStatisticsDto>> DepartmentAcceptanceTypeStatistics(DateTime StartDate, DateTime EndDate, int TypeCode)
|
|
{
|
|
{
|
|
EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
@@ -1256,39 +1304,8 @@ namespace Hotline.Api.Controllers.Bi
|
|
})
|
|
})
|
|
.ToListAsync();
|
|
.ToListAsync();
|
|
|
|
|
|
- var sumModel = new DepartmentAcceptanceTypeStatisticsDto
|
|
|
|
- {
|
|
|
|
- OrgName = "合计",
|
|
|
|
- ZxAllCount = orderData.Sum(x => x.ZxAllCount),
|
|
|
|
- ZxAllTimes = orderData.Sum(x => x.ZxAllTimes),
|
|
|
|
- ZxAcceptanceTypeCode = "10",
|
|
|
|
-
|
|
|
|
- JyAllCount = orderData.Sum(x => x.JyAllCount),
|
|
|
|
- JyAllTimes = orderData.Sum(x => x.JyAllTimes),
|
|
|
|
- JyAcceptanceTypeCode = "15",
|
|
|
|
-
|
|
|
|
- QzAllCount = orderData.Sum(x => x.QzAllCount),
|
|
|
|
- QzAllTimes = orderData.Sum(x => x.QzAllTimes),
|
|
|
|
- QzAcceptanceTypeCode = "20",
|
|
|
|
|
|
|
|
- ByAllCount = orderData.Sum(x => x.ByAllCount),
|
|
|
|
- ByAllTimes = orderData.Sum(x => x.ByAllTimes),
|
|
|
|
- ByAcceptanceTypeCode = "25",
|
|
|
|
-
|
|
|
|
- JbAllCount = orderData.Sum(x => x.JbAllCount),
|
|
|
|
- JbAllTimes = orderData.Sum(x => x.JbAllTimes),
|
|
|
|
- JbAcceptanceTypeCode = "30",
|
|
|
|
-
|
|
|
|
- TsAllCount = orderData.Sum(x => x.TsAllCount),
|
|
|
|
- TsAllTimes = orderData.Sum(x => x.TsAllTimes),
|
|
|
|
- TsAcceptanceTypeCode = "35",
|
|
|
|
-
|
|
|
|
- QtAllCount = orderData.Sum(x => x.QtAllCount),
|
|
|
|
- QtAllTimes = orderData.Sum(x => x.QtAllTimes),
|
|
|
|
- QtAcceptanceTypeCode = "40"
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- return new { DataList = orderData, SumModel = sumModel };
|
|
|
|
|
|
+ return orderData;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1413,12 +1430,12 @@ namespace Hotline.Api.Controllers.Bi
|
|
dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
var (total, items) = await _orderRepository.Queryable()
|
|
var (total, items) = await _orderRepository.Queryable()
|
|
.Where(p => p.CreationTime >= dto.StartDate && p.CreationTime <= dto.EndDate && p.Status > EOrderStatus.WaitForAccept)//&& p.Status >= EOrderStatus.Filed
|
|
.Where(p => p.CreationTime >= dto.StartDate && p.CreationTime <= dto.EndDate && p.Status > EOrderStatus.WaitForAccept)//&& p.Status >= EOrderStatus.Filed
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.OrgCode == "001", p => p.OrgLevelOneCode == dto.OrgCode)
|
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.OrgCode != "001" && dto.SuperiorOrgCode != dto.OrgCode, p => p.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.OrgCode != "001" && dto.SuperiorOrgCode == dto.OrgCode, p => p.ActualHandleOrgCode == dto.OrgCode)
|
|
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.OrgCode == "001", p => p.ActualHandleOrgCode == dto.OrgCode)
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.OrgCode != "001" && _sessionContext.RequiredOrgId != dto.OrgCode, p => p.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.OrgCode != "001" && _sessionContext.RequiredOrgId == dto.OrgCode, p => p.ActualHandleOrgCode == dto.OrgCode)
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AcceptTypeCode), p => p.AcceptTypeCode == dto.AcceptTypeCode)
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AcceptTypeCode), p => p.AcceptTypeCode == dto.AcceptTypeCode)
|
|
- .WhereIF(dto.TypeCode == 1, p => p.OrgLevelOneCode == "001")
|
|
|
|
- .WhereIF(dto.TypeCode == 2, p => p.OrgLevelOneCode != "001")
|
|
|
|
|
|
+ .WhereIF(dto.TypeCode == 1, p => p.ActualHandleOrgCode == "001")
|
|
|
|
+ .WhereIF(dto.TypeCode == 2, p => p.ActualHandleOrgCode != "001")
|
|
.OrderByDescending(d => d.CreationTime)
|
|
.OrderByDescending(d => d.CreationTime)
|
|
.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
|
|
|
@@ -1792,5 +1809,71 @@ namespace Hotline.Api.Controllers.Bi
|
|
return rsp;
|
|
return rsp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 派单量统计
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpGet("send_order_report")]
|
|
|
|
+ public async Task<object> SendOrderReport([FromQuery] QuerySendOrderRequest dto)
|
|
|
|
+ {
|
|
|
|
+ if (!dto.StartTime.HasValue || !dto.EndTime.HasValue)
|
|
|
|
+ throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
|
+ var items = await _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
|
|
|
|
+ .LeftJoin<WorkflowStepHandler>((x, w, wsh) => x.StepId == wsh.WorkflowStepId)
|
|
|
|
+ .InnerJoin<SchedulingUser>((x, w, wsh, su) => wsh.UserId == su.UserId)
|
|
|
|
+ .Where((x, w, wsh, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
|
|
|
|
+ .Where((x, w, wsh, su) =>x.CreationTime >= dto.StartTime.Value)
|
|
|
|
+ .Where((x, w, wsh, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.UserName),(x, w, wsh, su) => su.UserName == dto.UserName)
|
|
|
|
+ .GroupBy((x, w, wsh, su) => new { su.UserId, su.UserName})
|
|
|
|
+ .Having((x, w, wsh, su) => SqlFunc.AggregateCount(x.WorkflowId) == 1)
|
|
|
|
+ .Select((x, w, wsh, su) => new BiOrderSendVo
|
|
|
|
+ {
|
|
|
|
+ UserId = su.UserId,
|
|
|
|
+ UserName = su.UserName,
|
|
|
|
+ SendOrderNum = SqlFunc.AggregateSum(SqlFunc.IIF(true, 1, 0)),
|
|
|
|
+ NoSendOrderNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.HandlerId == null || x.HandlerId == "", 1, 0)),
|
|
|
|
+ ReSendOrderNum = 0,
|
|
|
|
+ }).ToListAsync();
|
|
|
|
+ var items2 = await _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
|
|
|
|
+ .LeftJoin<WorkflowStepHandler>((x, w, wsh) => x.StepId == wsh.WorkflowStepId)
|
|
|
|
+ .InnerJoin<SchedulingUser>((x, w, wsh, su) => wsh.UserId == su.UserId)
|
|
|
|
+ .Where((x, w, wsh, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
|
|
|
|
+ .Where((x, w, wsh, su) => x.CreationTime >= dto.StartTime.Value)
|
|
|
|
+ .Where((x, w, wsh, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.UserName), (x, w, wsh, su) => su.UserName == dto.UserName)
|
|
|
|
+ .GroupBy((x, w, wsh, su) => new { su.UserId, su.UserName })
|
|
|
|
+ .Having((x, w, wsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
|
+ .Select((x, w, wsh, su) => new BiOrderSendVo
|
|
|
|
+ {
|
|
|
|
+ UserId = su.UserId,
|
|
|
|
+ UserName = su.UserName,
|
|
|
|
+ SendOrderNum = 0,
|
|
|
|
+ NoSendOrderNum = 0,
|
|
|
|
+ ReSendOrderNum = SqlFunc.AggregateSum(SqlFunc.IIF(true, 1, 0)),
|
|
|
|
+ }).ToListAsync();
|
|
|
|
+
|
|
|
|
+ var res = (from t1 in items
|
|
|
|
+ join t2 in items2 on t1.UserId equals t2.UserId into t1_t2
|
|
|
|
+ from item in t1_t2.DefaultIfEmpty()
|
|
|
|
+ select new
|
|
|
|
+ {
|
|
|
|
+ UserId = t1.UserId,
|
|
|
|
+ UserName = t1.UserName,
|
|
|
|
+ SendOrderNum = t1.SendOrderNum,
|
|
|
|
+ NoSendOrderNum = t1.NoSendOrderNum,
|
|
|
|
+ ReSendOrderNum = t1_t2.Select(x => x.NoSendOrderNum).FirstOrDefault(),
|
|
|
|
+ ChainRate = t1_t2.Select(x => x.NoSendOrderNum).FirstOrDefault() > 0 ?
|
|
|
|
+ ((double.Parse(t1.SendOrderNum.ToString()) - double.Parse(t1_t2.Select(x => x.NoSendOrderNum).FirstOrDefault().ToString())) / double.Parse(t1.SendOrderNum.ToString()) * 100).ToString("F2") + "%" : "100.00%",
|
|
|
|
+ }).ToList();
|
|
|
|
+
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|