|
@@ -597,18 +597,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
NoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.Status < EOrderStatus.Filed && o.ExpiredTime < SqlFunc.GetDate(), 1, 0)),
|
|
|
}).MergeTable();
|
|
|
|
|
|
- //var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
|
- // .LeftJoin<WorkflowCountersignMember>((x, o) => x.Id == o.WorkflowCountersignId)
|
|
|
- // .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- // .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- // .GroupBy((x, o) => o.Key)
|
|
|
- // .Select((x, o) => new OrderBiOrgDataListVo
|
|
|
- // {
|
|
|
- // OrgId = o.Key,
|
|
|
- // CounterHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.IsHandled && x.IsExpired.HasValue && x.IsExpired.Value == true, 1, 0)),
|
|
|
- // CounterNoHandlerExtendedNum = SqlFunc.AggregateSum(SqlFunc.IIF(o.IsHandled == false && x.IsExpired.HasValue && x.IsExpired.Value == true, 1, 0)),
|
|
|
- // }).MergeTable();
|
|
|
-
|
|
|
var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
.Where(x=>x.CountersignPosition != ECountersignPosition.None)
|
|
|
.WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
@@ -622,9 +610,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
}).MergeTable();
|
|
|
|
|
|
var query = queryOrder.LeftJoin(queryCountersign, (or, co) => or.OrgId == co.OrgId)
|
|
|
- .LeftJoin<SystemOrganize>((or, co, so) => or.OrgId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) == so.Id)
|
|
|
- //宜宾只统计一级部门
|
|
|
- .Where((or, co, so) => so.Level == 1)
|
|
|
+ //.LeftJoin<SystemOrganize>((or, co, so) => or.OrgId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) == so.Id)
|
|
|
+ .LeftJoin<SystemOrganize>((or, co, so) => or.OrgId == so.Id && so.Level == 1)
|
|
|
.GroupBy((or, co, so) => new { so.Id, so.Name })
|
|
|
.Select((or, co, so) => new OrderBiOrgDataListVo
|
|
|
{
|
|
@@ -664,42 +651,32 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
- var quer = _orderRepository.Queryable()
|
|
|
- .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id)
|
|
|
- .Where(x => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
- //.WhereIF(dto.Statuses.Any(), x => dto.Statuses.Contains(x.Status)) //工单状态
|
|
|
- .WhereIF(dto.QueryType == 1, x => x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) //业务已办超期
|
|
|
- .WhereIF(dto.QueryType == 3, x => x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()) //业务待办超期
|
|
|
- .WhereIF(dto.QueryType == 5, x =>
|
|
|
- (x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) || (x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.QueryType is 1 or 3 , x => x.ActualHandleOrgCode == dto.OrgCode)
|
|
|
- //.WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.QueryType is 1 or 3 && dto.OrgCode != "001", x => x.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .MergeTable();
|
|
|
-
|
|
|
- if (dto.QueryType is 2 or 4 or 5)
|
|
|
+ var quer = _orderRepository.Queryable()
|
|
|
+ .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ //.WhereIF(dto.Statuses.Any(), x => dto.Statuses.Contains(x.Status)) //工单状态
|
|
|
+ .WhereIF(dto.QueryType == 1, (x, so) => x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) //业务已办超期
|
|
|
+ .WhereIF(dto.QueryType == 3, (x, so) => x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()) //业务待办超期
|
|
|
+ .WhereIF(dto.QueryType == 5, (x, so) =>
|
|
|
+ (x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) || (x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) , (x, so) => x.ActualHandleOrgCode == dto.OrgCode)
|
|
|
+ .Select(x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
+ if (dto.QueryType is 2 or 4 )
|
|
|
{
|
|
|
- //var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
|
- // .LeftJoin<WorkflowCountersignMember>((x, o) => x.Id == o.WorkflowCountersignId)
|
|
|
- // .Where((x, o) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime && x.IsExpired.HasValue && x.IsExpired.Value == true)
|
|
|
- // .WhereIF(dto.QueryType == 2, (x, o) => o.IsHandled == true) //会签已办超期
|
|
|
- // .WhereIF(dto.QueryType == 4, (x, o) => o.IsHandled == false) //会签待办超期
|
|
|
- // .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.QueryType is 2 or 4 or 5, (x, o) => o.Key.StartsWith(dto.OrgCode))
|
|
|
- // //.GroupBy((x,o)=>x.WorkflowId)
|
|
|
- // .Select((x, o) => new { Id = x.WorkflowId })
|
|
|
- // .MergeTable();
|
|
|
var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
- .Includes(x=>x.Workflow)
|
|
|
- .LeftJoin<Order>((x,o)=>x.ExternalId == o.Id)
|
|
|
- .Where((x, o) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
- .Where((x, o) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(dto.QueryType == 2, (x, o) => x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime) //会签已办超期
|
|
|
- .WhereIF(dto.QueryType == 4, (x, o) => x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate())//会签待办超期
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && dto.QueryType is 2 or 4 or 5, (x, o) => x.HandlerOrgId == dto.OrgCode)
|
|
|
- .GroupBy((x, o) => o)
|
|
|
- .Select((x, o)=>o)
|
|
|
- .MergeTable();
|
|
|
- //quer = quer.InnerJoin(queryCountersign, (x, c) => x.WorkflowId == c.Id);
|
|
|
- quer = _orderRepository.UnionAll(quer, queryCountersign).Distinct();
|
|
|
+ .Includes(x => x.Workflow)
|
|
|
+ .InnerJoin<SystemOrganize>((x, so) => x.HandlerOrgId == so.Id && so.Level == 1)
|
|
|
+ .Where((x, so) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(dto.QueryType == 2, (x, so) => x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime) //会签已办超期
|
|
|
+ .WhereIF(dto.QueryType == 4, (x, so) => x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate())//会签待办超期
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) , (x, so) => x.HandlerOrgId == dto.OrgCode)
|
|
|
+ .GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
+ .Select(x => new { Id = x.ExternalId, WorkflowId = x.ExternalId, HandlerOrgName = x.HandlerOrgName });
|
|
|
+
|
|
|
+ quer = _orderRepository.Queryable().InnerJoin(queryCountersign, (o, w) => o.Id == w.Id)
|
|
|
+ .Select((o, w) => new Order { DaysOverdueOrgName = w.HandlerOrgName, Id = o.Id.SelectAll() });
|
|
|
+ //quer = _orderRepository.UnionAll(quer, queryCountersignOrder);
|
|
|
}
|
|
|
return quer;
|
|
|
}
|
|
@@ -715,44 +692,29 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var quer = _orderRepository.Queryable()
|
|
|
- .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id)
|
|
|
- .Where(x => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(dto.Statuses.Any(), x => dto.Statuses.Contains(x.Status)) //工单状态
|
|
|
- .WhereIF( dto.ExpiredType is 2, x=>x.OrderDelays.Any(x=> x.DelayState == EDelayState.Pass))
|
|
|
- .Where(x =>
|
|
|
+ .InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(dto.Statuses.Any(), (x, so) => dto.Statuses.Contains(x.Status)) //工单状态
|
|
|
+ .WhereIF( dto.ExpiredType is 2, (x, so) => x.OrderDelays.Any(x=> x.DelayState == EDelayState.Pass))
|
|
|
+ .Where((x, so) =>
|
|
|
(x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) || (x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(IsCenter == false, x => x.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName) , x => x.AcceptorOrgName == dto.OrgName)
|
|
|
- .MergeTable();
|
|
|
-
|
|
|
- // var queryCountersign = _workflowCountersignRepository.Queryable()
|
|
|
- // .LeftJoin<WorkflowCountersignMember>((x, o) => x.Id == o.WorkflowCountersignId)
|
|
|
- // .Where((x, o) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime && x.IsExpired.HasValue && x.IsExpired.Value == true)
|
|
|
- // .WhereIF(IsCenter == false, (x, o) => o.Key.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
- //.WhereIF(!string.IsNullOrEmpty(dto.OrgName), (x, o) => o.Value == dto.OrgName)
|
|
|
- // .Select((x, o) => new { Id = x.WorkflowId, ActualHandleOrgCode = o.Key, ActualHandleOrgName = o.Value })
|
|
|
- // .MergeTable();
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => x.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName) , (x, so) => x.AcceptorOrgName == dto.OrgName)
|
|
|
+ .Select( x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
+
|
|
|
var queryCountersign = _workflowStepRepository.Queryable()
|
|
|
.Includes(x => x.Workflow)
|
|
|
- .LeftJoin<Order>((x, o) => x.ExternalId == o.Id)
|
|
|
- .Where((x, o) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
- .Where((x, o) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
- .Where((x, o) => (x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime)||(x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(IsCenter == false, (x,o) => x.HandlerOrgId == _sessionContext.RequiredOrgId)
|
|
|
- .GroupBy((x, o) => o)
|
|
|
- .Select((x, o) => new Order
|
|
|
- {
|
|
|
- DaysOverdueOrgName = x.HandlerOrgName,
|
|
|
- Id = x.Id.SelectAll()
|
|
|
- })
|
|
|
- .MergeTable();
|
|
|
-
|
|
|
- //quer = quer.LeftJoin(queryCountersign, (x, c) => x.WorkflowId == c.Id).Select((x, c) => new Order
|
|
|
- // {
|
|
|
- // DaysOverdueOrgName = SqlFunc.IIF(!string.IsNullOrEmpty(c.Id), c.ActualHandleOrgName, x.ActualHandleOrgName),
|
|
|
- // Id = x.Id.SelectAll()
|
|
|
- //}) ;
|
|
|
- quer = _orderRepository.UnionAll(quer, queryCountersign).Distinct();
|
|
|
+ .InnerJoin<SystemOrganize>((x, so) => x.HandlerOrgId == so.Id && so.Level == 1)
|
|
|
+ .Where((x, so) => x.CountersignPosition != ECountersignPosition.None && x.Workflow.ModuleCode == "OrderHandle")
|
|
|
+ .Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
+ .Where((x, so) => (x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime)||(x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate()))
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => x.HandlerOrgId == _sessionContext.RequiredOrgId)
|
|
|
+ .GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
+ .Select(x => new { Id = x.ExternalId, WorkflowId = x.ExternalId, HandlerOrgName = x.HandlerOrgName });
|
|
|
+
|
|
|
+ var queryCountersignOrder = _orderRepository.Queryable().InnerJoin(queryCountersign, (o, w) => o.Id == w.Id)
|
|
|
+ .Select((o,w)=> new Order { DaysOverdueOrgName = w.HandlerOrgName, Id = o.Id.SelectAll() });
|
|
|
+ quer = _orderRepository.UnionAll(quer, queryCountersignOrder).MergeTable().InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id);
|
|
|
return quer;
|
|
|
}
|
|
|
|