|
@@ -192,7 +192,7 @@ FROM (
|
|
|
select ""HandlerOrgId"",0 ""YbOrderCountNum"",0 ""ZbOrderCountNum"",0 ""YbOverdue"" ,0 ""ZbOverdue"",SUM(( CASE WHEN ( ""HandlerOrgId"" IS NOT NULL ) THEN 1 ELSE 0 END )) AS ""HqybOverdue"",0 ""HqzbOverdue"",0 ""DelayEnd"",0 ""DelayWait"",0""Archived"",0 ""ToBeArchived"",0 ""WaitPublished"",0 ""PublishedOpen"",0 ""PublishedNoOpen"",0 ""OrderDelayCount"",0 ""ScreenCount"",0 ""ScreenApproval"", 0 ""ScreenPass"" , 0 ""ScreenNotPass"" ,0 ""SatisfactionCount"", 0 ""NotSatisfactionCount"" from(
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
- where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -202,7 +202,7 @@ FROM (
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime""
|
|
|
- and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -211,7 +211,7 @@ FROM (
|
|
|
select ""HandlerOrgId"",0 ""YbOrderCountNum"",0 ""ZbOrderCountNum"",0 ""YbOverdue"" ,0 ""ZbOverdue"",0 ""HqybOverdue"",0 ""HqzbOverdue"",SUM(( CASE WHEN ( ""HandlerOrgId"" IS NOT NULL ) THEN 1 ELSE 0 END )) AS ""DelayEnd"",0 ""DelayWait"" ,0""Archived"",0 ""ToBeArchived"",0 ""WaitPublished"",0 ""PublishedOpen"",0 ""PublishedNoOpen"",0 ""OrderDelayCount"",0 ""ScreenCount"",0 ""ScreenApproval"", 0 ""ScreenPass"" , 0 ""ScreenNotPass"" ,0 ""SatisfactionCount"", 0 ""NotSatisfactionCount"" from(
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
- where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -220,8 +220,7 @@ FROM (
|
|
|
select ""HandlerOrgId"",0 ""YbOrderCountNum"",0 ""ZbOrderCountNum"",0 ""YbOverdue"" ,0 ""ZbOverdue"",0 ""HqybOverdue"",0 ""HqzbOverdue"",0 ""DelayEnd"",SUM(( CASE WHEN ( ""HandlerOrgId"" IS NOT NULL ) THEN 1 ELSE 0 END )) AS ""DelayWait"" ,0""Archived"",0 ""ToBeArchived"",0 ""WaitPublished"",0 ""PublishedOpen"",0 ""PublishedNoOpen"",0 ""OrderDelayCount"",0 ""ScreenCount"",0 ""ScreenApproval"", 0 ""ScreenPass"" , 0 ""ScreenNotPass"",0 ""SatisfactionCount"", 0 ""NotSatisfactionCount"" from(
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
- where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime""
|
|
|
- and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -295,7 +294,6 @@ order by ""su"".""OrgCode""";
|
|
|
public async Task<List<DepartmentalProcessingStatisticsDataDto>> DepartmentalProcessingChildStatisticsNew(DepartmentalProcessingStatisticsRequest dto)
|
|
|
{
|
|
|
dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
- var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
//信件总量:信件总量=已办件数+在办件数,工单需去重
|
|
|
//已办件数:该部门已办理完成的工单总数(含参与会签的工单),若工单被部门多次办理,只统计一次
|
|
@@ -392,7 +390,7 @@ FROM (
|
|
|
select ""HandlerOrgId"",0 ""YbOrderCountNum"",0 ""ZbOrderCountNum"",0 ""YbOverdue"" ,0 ""ZbOverdue"",SUM(( CASE WHEN ( ""HandlerOrgId"" IS NOT NULL ) THEN 1 ELSE 0 END )) AS ""HqybOverdue"",0 ""HqzbOverdue"",0 ""DelayEnd"",0 ""DelayWait"",0""Archived"",0 ""ToBeArchived"",0 ""WaitPublished"",0 ""PublishedOpen"",0 ""PublishedNoOpen"",0 ""OrderDelayCount"",0 ""ScreenCount"",0 ""ScreenApproval"", 0 ""ScreenPass"" , 0 ""ScreenNotPass"" ,0 ""SatisfactionCount"", 0 ""NotSatisfactionCount"" from(
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
- where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -402,7 +400,7 @@ FROM (
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime""
|
|
|
- and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -411,7 +409,7 @@ FROM (
|
|
|
select ""HandlerOrgId"",0 ""YbOrderCountNum"",0 ""ZbOrderCountNum"",0 ""YbOverdue"" ,0 ""ZbOverdue"",0 ""HqybOverdue"",0 ""HqzbOverdue"",SUM(( CASE WHEN ( ""HandlerOrgId"" IS NOT NULL ) THEN 1 ELSE 0 END )) AS ""DelayEnd"",0 ""DelayWait"" ,0""Archived"",0 ""ToBeArchived"",0 ""WaitPublished"",0 ""PublishedOpen"",0 ""PublishedNoOpen"",0 ""OrderDelayCount"",0 ""ScreenCount"",0 ""ScreenApproval"", 0 ""ScreenPass"" , 0 ""ScreenNotPass"" ,0 ""SatisfactionCount"", 0 ""NotSatisfactionCount"" from(
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
- where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status"">=2 and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -420,8 +418,7 @@ FROM (
|
|
|
select ""HandlerOrgId"",0 ""YbOrderCountNum"",0 ""ZbOrderCountNum"",0 ""YbOverdue"" ,0 ""ZbOverdue"",0 ""HqybOverdue"",0 ""HqzbOverdue"",0 ""DelayEnd"",SUM(( CASE WHEN ( ""HandlerOrgId"" IS NOT NULL ) THEN 1 ELSE 0 END )) AS ""DelayWait"" ,0""Archived"",0 ""ToBeArchived"",0 ""WaitPublished"",0 ""PublishedOpen"",0 ""PublishedNoOpen"",0 ""OrderDelayCount"",0 ""ScreenCount"",0 ""ScreenApproval"", 0 ""ScreenPass"" , 0 ""ScreenNotPass"",0 ""SatisfactionCount"", 0 ""NotSatisfactionCount"" from(
|
|
|
select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
|
|
|
left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
|
|
|
- where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime""
|
|
|
- and ""CountersignPosition"">0 and ""t"".""CountersignPosition"">=1 {2}
|
|
|
+ where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}' and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and ""CountersignPosition"">0 {2}
|
|
|
GROUP BY ""HandlerOrgId"",""o"".""Id""
|
|
|
)""s"" where ""HandlerOrgId"" IS not NULL {4}
|
|
|
GROUP BY ""HandlerOrgId""
|
|
@@ -490,6 +487,241 @@ order by ""su"".""OrgCode""";
|
|
|
return _orderRepository.DepartmentalProcessingStatisticsNew(strSql);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 部门办件统计表--明细---新
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<SelectOrderId> GetDepartmentalProcessingStatisticsListNew(DepartmentalProcessingStatisticsRequest dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ ISugarQueryable<SelectOrderId> query =null;
|
|
|
+ switch (dto.StatisticsType)
|
|
|
+ {
|
|
|
+ case EStatisticsType.YBOrderCountNum://工单已办
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status >= EWorkflowStepStatus.Handled)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ZBOrderCountNum://工单在办
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status < EWorkflowStepStatus.Handled)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.OrderDelayCount://延期次数
|
|
|
+ query = _orderDelayRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Where(x => x.Order.CreationTime >= dto.StartTime && x.Order.CreationTime <= dto.EndTime && x.DelayState == EDelayState.Pass)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, x => x.Order.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", x => x.ApplyOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", x => x.ApplyOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .OrderByDescending(x => x.Order.CreationTime)
|
|
|
+ .Select(x => new SelectOrderId { Id = x.Order.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.YBOverdue://已办超期
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status >= EWorkflowStepStatus.Handled && t.HandleTime > t.StepExpiredTime && t.CountersignPosition == ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ZBOverdue://待办超期
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status < EWorkflowStepStatus.Handled && DateTime.Now > t.StepExpiredTime && t.CountersignPosition == ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.HQYBOverdue://会签已办超期
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status >= EWorkflowStepStatus.Handled && t.HandleTime > t.StepExpiredTime && t.CountersignPosition > ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.HQZBOverdue://会签待办超期
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status < EWorkflowStepStatus.Handled && DateTime.Now > t.StepExpiredTime && t.CountersignPosition > ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.SubtotalOverdue://超期件数
|
|
|
+ var cqybquery = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status >= EWorkflowStepStatus.Handled && t.HandleTime > t.StepExpiredTime && t.CountersignPosition >= ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ var cqdbquery = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status < EWorkflowStepStatus.Handled && DateTime.Now > t.StepExpiredTime && t.CountersignPosition >= ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ query = _orderRepository.UnionAll(cqybquery, cqdbquery).GroupBy(p => p.Id).MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.DelayEnd://会签已办
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status >= EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.DelayWait://会签待办
|
|
|
+ query = _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime
|
|
|
+ && t.Status < EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .GroupBy((t, o) => o.Id)
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ToBeArchived://待归档没得数据
|
|
|
+ query = _orderRepository.Queryable()
|
|
|
+ .Where(o => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && o.Status < EOrderStatus.WaitForAccept)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, o => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", o => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", o => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .Select(o => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.Archived://已归档
|
|
|
+ query = _orderRepository.Queryable()
|
|
|
+ .Where(o => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && o.Status >= EOrderStatus.Filed)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, o => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", o => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", o => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .Select(o => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.WaitPublished://待发布
|
|
|
+ query = _orderRepository.Queryable()
|
|
|
+ .Where(o => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && o.Status == EOrderStatus.Filed)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, o => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", o => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", o => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .Select(o => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.PublishedOpen://发布公开
|
|
|
+ query = _orderRepository.Queryable()
|
|
|
+ .Where(o => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && o.Status >= EOrderStatus.Published && o.IsPublicity == true)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, o => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", o => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", o => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .Select(o => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.PublishedNoOpen://发布不公开
|
|
|
+ query = _orderRepository.Queryable()
|
|
|
+ .Where(o => o.CreationTime >= dto.StartTime && o.CreationTime <= dto.EndTime && o.Status >= EOrderStatus.Published && o.IsPublicity == false)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, o => o.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", o => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", o => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .Select(o => new SelectOrderId { Id = o.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ScreenCount://甄别总量
|
|
|
+ query = _orderScreenRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Where(x => x.Order.CreationTime >= dto.StartTime && x.Order.CreationTime <= dto.EndTime && x.Order.Id != null)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, x => x.Order.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", x => x.CreatorOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", x => x.CreatorOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .Select(x => new SelectOrderId { Id = x.Order.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ScreenApproval://带甄别
|
|
|
+ query = _orderScreenRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Where(x => x.Order.CreationTime >= dto.StartTime && x.Order.CreationTime <= dto.EndTime && x.Order.Id != null
|
|
|
+ && (x.Status == EScreenStatus.Approval || x.Status == EScreenStatus.Apply))
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, x => x.Order.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", x => x.CreatorOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", x => x.CreatorOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .Select(x => new SelectOrderId { Id = x.Order.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ScreenPass://甄别通过
|
|
|
+ query = _orderScreenRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Where(x => x.Order.CreationTime >= dto.StartTime && x.Order.CreationTime <= dto.EndTime && x.Order.Id != null && x.Status == EScreenStatus.End)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, x => x.Order.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", x => x.CreatorOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", x => x.CreatorOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .Select(x => new SelectOrderId { Id = x.Order.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ case EStatisticsType.ScreenNotPass://甄别不通过
|
|
|
+ query = _orderScreenRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Where(x => x.Order.CreationTime >= dto.StartTime && x.Order.CreationTime <= dto.EndTime && x.Order.Id != null && x.Status == EScreenStatus.Refuse)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, x => x.Order.Source == ESource.ProvinceStraight)
|
|
|
+ .WhereIF(dto.OrgCode == "001", x => x.CreatorOrgId == dto.OrgCode)
|
|
|
+ .WhereIF(dto.OrgCode != "001", x => x.CreatorOrgId.StartsWith(dto.OrgCode))
|
|
|
+ .Select(x => new SelectOrderId { Id = x.Order.Id })
|
|
|
+ .MergeTable();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return query;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 部门办件统计表
|