|
@@ -1992,7 +1992,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
{
|
|
|
OrgCode = d.OrgCode,
|
|
|
// OrderCountNum = 0,//总量
|
|
|
- YBOrderCountNum = 0,//已办
|
|
|
+ YBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status >= EWorkflowStepStatus.Handled, 1, 0)),//已办
|
|
|
ZBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EWorkflowStepStatus.Handled, 1, 0)),// 0,//在办
|
|
|
Archived = 0,
|
|
|
ToBeArchived = 0,
|
|
@@ -2228,6 +2228,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
switch (dto.StatisticsType)
|
|
|
{
|
|
|
case EStatisticsType.YBOrderCountNum:
|
|
|
+ //工单
|
|
|
+ stye = "0";
|
|
|
+ break;
|
|
|
case EStatisticsType.ToBeArchived:
|
|
|
case EStatisticsType.Archived:
|
|
|
case EStatisticsType.YBOverdue:
|
|
@@ -2273,6 +2276,41 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+ #region 工单已办
|
|
|
+ if (stye == "0")
|
|
|
+ {
|
|
|
+ var ybQuery = _orderRepository.Queryable()
|
|
|
+ .Where(it => it.CreationTime >= dto.StartDate && it.CreationTime <= dto.EndDate && it.Status > EOrderStatus.WaitForAccept)
|
|
|
+ .WhereIF(dto.OrgCode == "001", it => it.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", it => it.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, it => it.Status >= EOrderStatus.Filed)//已办
|
|
|
+ .Select(it => new SelectOrderId { Id = it.Id })
|
|
|
+ .MergeTable();
|
|
|
+
|
|
|
+ var hqybquery = _workflowStepHandleRepository.Queryable()
|
|
|
+ .LeftJoin<WorkflowTrace>((x, o) => x.WorkflowStepId == o.StepId)
|
|
|
+ .LeftJoin<Order>((x, o, p) => o.WorkflowId == p.WorkflowId)
|
|
|
+ .Where((x, o, p) => o.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartDate && o.CreationTime <= dto.EndDate)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o, p) => x.OrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o, p) => x.OrgId.StartsWith(dto.OrgCode))
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, (x, o, p) => o.Status >= EWorkflowStepStatus.Handled && o.CountersignPosition > ECountersignPosition.None)//会签已办
|
|
|
+ .Select((x, o, p) => new SelectOrderId { Id = p.Id })
|
|
|
+ .MergeTable();
|
|
|
+
|
|
|
+ var queryData = await _orderRepository.OrderListUnionAll(ybQuery, hqybquery)
|
|
|
+ .LeftJoin<Order>((x, o) => x.Id == o.Id)
|
|
|
+ .Select((x, o) => new { o })
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ var dtos = queryData.Select(d =>
|
|
|
+ {
|
|
|
+ var dto = _mapper.Map<OrderDto>(d.o);
|
|
|
+ return dto;
|
|
|
+ }).ToList();
|
|
|
+
|
|
|
+ return new PagedDto<OrderDto>(total, dtos);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
#region 工单
|
|
|
if (stye == "1")
|
|
@@ -2282,12 +2320,9 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where(it => it.CreationTime >= dto.StartDate && it.CreationTime <= dto.EndDate && it.Status > EOrderStatus.WaitForAccept)
|
|
|
.WhereIF(dto.OrgCode == "001", it => it.ActualHandleOrgCode == dto.OrgCode)
|
|
|
.WhereIF(dto.OrgCode != "001", it => it.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, it => it.Status >= EOrderStatus.Filed)//已办
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.ZBOrderCountNum, it => it.Status < EOrderStatus.Filed)//在办
|
|
|
.WhereIF(dto.StatisticsType == EStatisticsType.Archived, it => it.Status >= EOrderStatus.Filed)//已归档
|
|
|
.WhereIF(dto.StatisticsType == EStatisticsType.ToBeArchived, it => it.Status < EOrderStatus.WaitForAccept)//待归档--没得待归档数据
|
|
|
.WhereIF(dto.StatisticsType == EStatisticsType.YBOverdue, it => it.Status >= EOrderStatus.Filed && it.ActualHandleTime > it.ExpiredTime)//已办超期
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.ZBOverdue, it => it.Status < EOrderStatus.Filed && it.ExpiredTime < SqlFunc.GetDate())//待办超期
|
|
|
.OrderByDescending(it => it.CreationTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<OrderDto>(totalOrder, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
@@ -2329,7 +2364,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
.WhereIF(dto.OrgCode == "001", (x, o) => x.ApplyOrgCode == dto.OrgCode)
|
|
|
.WhereIF(dto.OrgCode != "001", (x, o) => x.ApplyOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .WhereIF(dto.StatisticsType == EStatisticsType.OrderDelayCount, (x, o) => x.DelayState== EDelayState.Pass)//延期次数
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.OrderDelayCount, (x, o) => x.DelayState == EDelayState.Pass)//延期次数
|
|
|
.OrderByDescending((x, o) => o.CreationTime)
|
|
|
.Select((x, o) => new { o })
|
|
|
.ToPageListAsync(dto.PageIndex, dto.PageSize, total, HttpContext.RequestAborted);
|
|
@@ -2761,7 +2796,7 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
.GroupBy((x, w, wfsh, su) => x.WorkflowId)
|
|
|
.Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
- .Select((x, w, wfsh, su) => new { Id = x.WorkflowId , CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
+ .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
.MergeTable()
|
|
|
.LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
|
|
|
.LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
|
|
@@ -2833,12 +2868,12 @@ namespace Hotline.Api.Controllers.Bi
|
|
|
.Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
.GroupBy((x, w, wfsh, su) => x.WorkflowId)
|
|
|
.Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
- .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
+ .Select((x, w, wfsh, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
|
|
|
.MergeTable()
|
|
|
.LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
|
|
|
.LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
|
|
|
.LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId && wsh.CreationTime == a.CreationTime)
|
|
|
- .InnerJoin<SchedulingUser>((a, wt, wf, wsh, su) => wsh.UserId == su.UserId)
|
|
|
+ .InnerJoin<SchedulingUser>((a, wt, wf, wsh, su) => wsh.UserId == su.UserId)
|
|
|
.Where((a, wt, wf, wsh, su) => su.UserId == dto.UserId)
|
|
|
.GroupBy((a, wt, wf, wsh, su) => wf.ExternalId)
|
|
|
.Select((a, wt, wf, wsh, su) => new { Id = wf.ExternalId })
|