|
@@ -0,0 +1,989 @@
|
|
|
|
+using Hotline.Application.Orders;
|
|
|
|
+using Hotline.Caching.Interfaces;
|
|
|
|
+using Hotline.CallCenter.Calls;
|
|
|
|
+using Hotline.FlowEngine.WorkflowModules;
|
|
|
|
+using Hotline.FlowEngine.Workflows;
|
|
|
|
+using Hotline.Orders;
|
|
|
|
+using Hotline.Settings;
|
|
|
|
+using Hotline.Settings.Hotspots;
|
|
|
|
+using Hotline.Settings.TimeLimits;
|
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
|
+using Hotline.Share.Dtos;
|
|
|
|
+using Hotline.Share.Enums.FlowEngine;
|
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
|
+using Hotline.Share.Requests;
|
|
|
|
+using MapsterMapper;
|
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
|
+using SqlSugar;
|
|
|
|
+using System;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+using System.Linq;
|
|
|
|
+using System.Text;
|
|
|
|
+using System.Threading.Tasks;
|
|
|
|
+using XF.Domain.Authentications;
|
|
|
|
+using XF.Domain.Dependency;
|
|
|
|
+using XF.Domain.Repository;
|
|
|
|
+
|
|
|
|
+namespace Hotline.Application.StatisticalReport
|
|
|
|
+{
|
|
|
|
+ public class OrderReportApplication : IOrderReportApplication, IScopeDependency
|
|
|
|
+ {
|
|
|
|
+ private readonly IOrderRepository _orderRepository;
|
|
|
|
+ private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
|
|
+ private readonly ISystemDicDataCacheManager _sysDicDataCacheManager;
|
|
|
|
+ private readonly IRepository<OrderVisitDetail> _orderVisitDetailRepository;
|
|
|
|
+ private readonly IRepository<OrderDelay> _orderDelayRepository;
|
|
|
|
+ private readonly IMapper _mapper;
|
|
|
|
+ private readonly IRepository<WorkflowCountersign> _workflowCountersignRepository;
|
|
|
|
+ //private readonly IRepository<WorkflowStepHandler> _workflowStepHandleRepository;
|
|
|
|
+ private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
|
|
+ private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
|
|
+ private readonly IRepository<TrCallRecord> _trCallRecordRepository;
|
|
|
|
+ private readonly IRepository<OrderPublish> _orderPublishRepository;
|
|
|
|
+ private readonly IRepository<SystemOrganize> _systemOrganizeRepository;
|
|
|
|
+ private readonly IRepository<AiOrderVisitDetail> _aiOrderVisitDetailRepository;
|
|
|
|
+ private readonly ISessionContext _sessionContext;
|
|
|
|
+ private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
|
+ private readonly IRepository<OrderSpecialDetail> _orderSpecialDetailRepository;
|
|
|
|
+ private readonly IRepository<WorkflowTrace> _workflowTraceRepository;
|
|
|
|
+ private readonly IRepository<OrderScreen> _orderScreenRepository;
|
|
|
|
+ private readonly IOrderSecondaryHandlingApplication _orderSecondaryHandlingApplication;
|
|
|
|
+ private readonly ITimeLimitDomainService _timeLimitDomainService;
|
|
|
|
+
|
|
|
|
+ public OrderReportApplication(
|
|
|
|
+ IOrderRepository orderRepository,
|
|
|
|
+ IRepository<Hotspot> hotspotTypeRepository,
|
|
|
|
+ ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
|
|
+ IRepository<OrderVisitDetail> orderVisitDetailRepository,
|
|
|
|
+ IRepository<OrderDelay> orderDelayRepository,
|
|
|
|
+ IRepository<WorkflowCountersign> workflowCountersignRepository,
|
|
|
|
+ IRepository<OrderSpecial> orderSpecialRepository,
|
|
|
|
+ IMapper mapper,
|
|
|
|
+ IRepository<OrderVisit> orderVisitRepository,
|
|
|
|
+ IRepository<TrCallRecord> trCallRecordRepository,
|
|
|
|
+ IRepository<OrderPublish> orderPublishRepository,
|
|
|
|
+ IRepository<SystemOrganize> systemOrganizeRepository,
|
|
|
|
+ IRepository<AiOrderVisitDetail> aiOrderVisitDetailRepository,
|
|
|
|
+ ISessionContext sessionContext,
|
|
|
|
+ ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
|
+ IRepository<OrderSpecialDetail> orderSpecialDetailRepository,
|
|
|
|
+ IRepository<WorkflowTrace> workflowTraceRepository,
|
|
|
|
+ IRepository<OrderScreen> orderScreenRepository,
|
|
|
|
+ //IRepository<WorkflowStepHandler> workflowStepHandleRepository,
|
|
|
|
+ IOrderSecondaryHandlingApplication orderSecondaryHandlingApplication,
|
|
|
|
+ ITimeLimitDomainService timeLimitDomainService
|
|
|
|
+ )
|
|
|
|
+ {
|
|
|
|
+ _orderRepository = orderRepository;
|
|
|
|
+ _hotspotTypeRepository = hotspotTypeRepository;
|
|
|
|
+ _sysDicDataCacheManager = sysDicDataCacheManager;
|
|
|
|
+ _orderVisitDetailRepository = orderVisitDetailRepository;
|
|
|
|
+ _orderDelayRepository = orderDelayRepository;
|
|
|
|
+ _workflowCountersignRepository = workflowCountersignRepository;
|
|
|
|
+ _orderSpecialRepository = orderSpecialRepository;
|
|
|
|
+ _mapper = mapper;
|
|
|
|
+ _orderVisitRepository = orderVisitRepository;
|
|
|
|
+ _trCallRecordRepository = trCallRecordRepository;
|
|
|
|
+ _orderPublishRepository = orderPublishRepository;
|
|
|
|
+ _systemOrganizeRepository = systemOrganizeRepository;
|
|
|
|
+ _aiOrderVisitDetailRepository = aiOrderVisitDetailRepository;
|
|
|
|
+ _sessionContext = sessionContext;
|
|
|
|
+ _systemSettingCacheManager = systemSettingCacheManager;
|
|
|
|
+ _orderSpecialDetailRepository = orderSpecialDetailRepository;
|
|
|
|
+ _workflowTraceRepository = workflowTraceRepository;
|
|
|
|
+ _orderScreenRepository = orderScreenRepository;
|
|
|
|
+ //_workflowStepHandleRepository = workflowStepHandleRepository;
|
|
|
|
+ _orderSecondaryHandlingApplication = orderSecondaryHandlingApplication;
|
|
|
|
+ _timeLimitDomainService = timeLimitDomainService;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 部门办件统计表
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public ISugarQueryable<DepartmentalProcessingStatisticsDataDto> DepartmentalProcessingStatistics(DepartmentalProcessingStatisticsRequest dto)
|
|
|
|
+ {
|
|
|
|
+ dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
+
|
|
|
|
+ //工单 已办=归完档的工单数+会签已办数量
|
|
|
|
+ #region 工单
|
|
|
|
+ var queryOrder = _orderRepository.Queryable()
|
|
|
|
+ .Where(it => it.CreationTime >= dto.StartDate && it.CreationTime <= dto.EndDate && it.Status > EOrderStatus.WaitForAccept)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, it => it.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select(it => new
|
|
|
|
+ {
|
|
|
|
+ it.Id,
|
|
|
|
+ OrgCode = IsCenter == true ? it.ActualHandleOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) : it.ActualHandleOrgCode.Substring(0, _sessionContext.RequiredOrgId.Length + 3),
|
|
|
|
+ it.ActualHandleOrgCode,
|
|
|
|
+ it.Status,//工单状态
|
|
|
|
+ it.ExpiredTime,//期满时间
|
|
|
|
+ it.ActualHandleTime,//办理时间
|
|
|
|
+ it.CounterSignType,//会签
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(IsCenter == false, it => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
|
+ .GroupBy(it => new
|
|
|
|
+ {
|
|
|
|
+ it.OrgCode
|
|
|
|
+ })
|
|
|
|
+ .Select(it => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
|
+ // OrderCountNum = SqlFunc.AggregateCount(it.OrgCode),//总量
|
|
|
|
+ YBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed, 1, 0)),//已办// SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed, 1, 0)),//已办
|
|
|
|
+ ZBOrderCountNum = 0, //ZBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status < EOrderStatus.Filed, 1, 0)),//在办
|
|
|
|
+ Archived = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed, 1, 0)),//已归档
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed && it.ActualHandleTime > it.ExpiredTime, 1, 0)),//已办超期
|
|
|
|
+ ZBOverdue = 0,// SqlFunc.AggregateSum(SqlFunc.IIF(it.Status < EOrderStatus.Filed && it.ExpiredTime < SqlFunc.GetDate(), 1, 0)),//待办超期
|
|
|
|
+ CompleteOnTime = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed && it.ActualHandleTime <= it.ExpiredTime, 1, 0)),//按时办结
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 发布
|
|
|
|
+ //发布
|
|
|
|
+ var queryPublish = _orderPublishRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ o.Id,
|
|
|
|
+ OrgCode = IsCenter == true ? o.ActualHandleOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) : o.ActualHandleOrgCode.Substring(0, _sessionContext.RequiredOrgId.Length + 3),
|
|
|
|
+ x.PublishState,
|
|
|
|
+ o.Status
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(IsCenter == false, it => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
|
+ .GroupBy(it => new { it.OrgCode })
|
|
|
|
+ .Select(it => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status == EOrderStatus.Filed, 1, 0)),//待发布 --已归档的就是待发布
|
|
|
|
+ PublishedOpen = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Published && it.PublishState, 1, 0)),//已发布公开
|
|
|
|
+ PublishedNoOpen = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Published && !it.PublishState, 1, 0)),//已发布不公开
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 会签(已办超期、待办超期)
|
|
|
|
+ //会签(已办超期、待办超期)
|
|
|
|
+ //var queryCountersign = _workflowStepHandleRepository.Queryable()
|
|
|
|
+ // .LeftJoin<WorkflowTrace>((x, o) => x.WorkflowStepId == o.StepId)
|
|
|
|
+ var queryCountersign = _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && t.CreationTime >= dto.StartDate && t.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((t, o) => new
|
|
|
|
+ {
|
|
|
|
+ OrgCode = IsCenter == true ? t.HandlerOrgId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) : t.HandlerOrgId.Substring(0, _sessionContext.RequiredOrgId.Length + 3),// d.OrgId,
|
|
|
|
+ t.HandleTime,
|
|
|
|
+ t.StepExpiredTime,
|
|
|
|
+ t.Status,
|
|
|
|
+ t.CountersignPosition,
|
|
|
|
+ o.Id
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(IsCenter == false, it => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
|
+ .GroupBy(d => new { d.OrgCode})
|
|
|
|
+ .Select(d => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = d.OrgCode,
|
|
|
|
+ //OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status >= EWorkflowStepStatus.Handled, 1, 0)),// 0,//已办
|
|
|
|
+ ZBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EWorkflowStepStatus.Handled, 1, 0)),// 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition == ECountersignPosition.None && d.Status < EWorkflowStepStatus.Handled && DateTime.Now >= d.StepExpiredTime, 1, 0)),// 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status >= EWorkflowStepStatus.Handled && d.HandleTime > d.StepExpiredTime, 1, 0)),
|
|
|
|
+ HQZBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status < EWorkflowStepStatus.Handled && DateTime.Now >= d.StepExpiredTime, 1, 0)),
|
|
|
|
+ DelayEnd = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status >= EWorkflowStepStatus.Handled, 1, 0)),
|
|
|
|
+ DelayWait = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status < EWorkflowStepStatus.Handled, 1, 0)),
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 延期
|
|
|
|
+ //延期
|
|
|
|
+ var orderDelay = _orderDelayRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ OrgCode = IsCenter == true ? x.ApplyOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) : x.ApplyOrgCode.Substring(0, _sessionContext.RequiredOrgId.Length + 3),
|
|
|
|
+ x.DelayState
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(IsCenter == false, it => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
|
+ .GroupBy(x => new { x.OrgCode })
|
|
|
|
+ .Select(x => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.DelayState == EDelayState.Pass, 1, 0)),
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 甄别
|
|
|
|
+ //甄别
|
|
|
|
+ var orderScreen = _orderScreenRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), (x, o) => x.CreatorOrgId.Contains(dto.OrgName))
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ x.Id,
|
|
|
|
+ OrgCode = IsCenter == true ? x.CreatorOrgId.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) : x.CreatorOrgId.Substring(0, _sessionContext.RequiredOrgId.Length + 3),
|
|
|
|
+ x.Status
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(IsCenter == false, it => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
|
+ .GroupBy(x => new { x.OrgCode })
|
|
|
|
+ .Select(x => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.Id != null, 1, 0)),
|
|
|
|
+ ScreenApproval = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EScreenStatus.Approval || x.Status == EScreenStatus.Apply, 1, 0)),
|
|
|
|
+ ScreenPass = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EScreenStatus.End, 1, 0)),
|
|
|
|
+ ScreenNotPass = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EScreenStatus.Refuse, 1, 0)),
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 满意度
|
|
|
|
+ //满意度
|
|
|
|
+ var orderVisit = _orderVisitDetailRepository.Queryable()
|
|
|
|
+ .LeftJoin<OrderVisit>((x, o) => x.VisitId == o.Id)
|
|
|
|
+ .LeftJoin<Order>((x, o, p) => o.OrderId == p.Id)
|
|
|
|
+ .Where((x, o, p) => x.OrderVisit.VisitTime >= dto.StartDate && x.OrderVisit.VisitTime <= dto.EndDate && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o, p) => p.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((x, o, p) => new
|
|
|
|
+ {
|
|
|
|
+ OrgCode = IsCenter == true ? x.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")) : x.VisitOrgCode.Substring(0, _sessionContext.RequiredOrgId.Length + 3),
|
|
|
|
+ x.OrgProcessingResults
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(IsCenter == false, it => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
|
|
|
|
+ .GroupBy(x => new { x.OrgCode })
|
|
|
|
+ .Select(x => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") != "2", 1, 0)),
|
|
|
|
+ NotSatisfactionCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2", 1, 0))
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ //联合查询
|
|
|
|
+ return _orderRepository.OrderUnionAll(queryOrder, queryPublish, queryCountersign, orderDelay, orderScreen, orderVisit)
|
|
|
|
+ .LeftJoin<SystemOrganize>((p, o) => p.OrgCode == o.Id)
|
|
|
|
+ .Select((p, o) => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = p.OrgCode,
|
|
|
|
+ OrgName = o.Name,
|
|
|
|
+ OrgType = o.OrgType,
|
|
|
|
+ //OrderCountNum = p.OrderCountNum,
|
|
|
|
+ YBOrderCountNum = p.YBOrderCountNum,
|
|
|
|
+ ZBOrderCountNum = p.ZBOrderCountNum,
|
|
|
|
+ Archived = p.Archived,
|
|
|
|
+ ToBeArchived = p.ToBeArchived,
|
|
|
|
+ WaitPublished = p.WaitPublished,
|
|
|
|
+ PublishedOpen = p.PublishedOpen,
|
|
|
|
+ PublishedNoOpen = p.PublishedNoOpen,
|
|
|
|
+ YBOverdue = p.YBOverdue,
|
|
|
|
+ ZBOverdue = p.ZBOverdue,
|
|
|
|
+ CompleteOnTime = p.CompleteOnTime,
|
|
|
|
+ HQYBOverdue = p.HQYBOverdue,
|
|
|
|
+ HQZBOverdue = p.HQZBOverdue,
|
|
|
|
+ DelayEnd = p.DelayEnd,
|
|
|
|
+ DelayWait = p.DelayWait,
|
|
|
|
+ OrderDelayCount = p.OrderDelayCount,
|
|
|
|
+ ScreenCount = p.ScreenCount,
|
|
|
|
+ ScreenApproval = p.ScreenApproval,
|
|
|
|
+ ScreenPass = p.ScreenPass,
|
|
|
|
+ ScreenNotPass = p.ScreenNotPass,
|
|
|
|
+ SatisfactionCount = p.SatisfactionCount,
|
|
|
|
+ NotSatisfactionCount = p.NotSatisfactionCount
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(string.IsNullOrEmpty(dto.OrgName) == false, x => x.OrgName.Contains(dto.OrgName));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 部门办件统计表--子级
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public ISugarQueryable<DepartmentalProcessingStatisticsDataDto> DepartmentalProcessingChildStatistics(DepartmentalProcessingStatisticsRequest dto)
|
|
|
|
+ {
|
|
|
|
+ dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
|
|
+
|
|
|
|
+ #region 工单
|
|
|
|
+ //工单
|
|
|
|
+ var queryOrder = _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.IsProvince.HasValue && dto.IsProvince == true, it => it.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select(it => new
|
|
|
|
+ {
|
|
|
|
+ it.Id,
|
|
|
|
+ OrgCode = it.ActualHandleOrgCode.Substring(0, dto.OrgCode.Length + 3),
|
|
|
|
+ it.ActualHandleOrgCode,
|
|
|
|
+ it.Status,//工单状态
|
|
|
|
+ it.ExpiredTime,//期满时间
|
|
|
|
+ it.ActualHandleTime,//办理时间
|
|
|
|
+ it.CounterSignType,//会签
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(it => new
|
|
|
|
+ {
|
|
|
|
+ it.OrgCode
|
|
|
|
+ })
|
|
|
|
+ .Select(it => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
|
+ // OrderCountNum = SqlFunc.AggregateCount(it.OrgCode),//总量
|
|
|
|
+ YBOrderCountNum = 0,//SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed, 1, 0)),//已办
|
|
|
|
+ ZBOrderCountNum = 0,// ZBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status < EOrderStatus.Filed, 1, 0)),//在办
|
|
|
|
+ Archived = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed, 1, 0)),//已归档
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed && it.ActualHandleTime > it.ExpiredTime, 1, 0)),//已办超期
|
|
|
|
+ ZBOverdue = 0,// SqlFunc.AggregateSum(SqlFunc.IIF(it.Status < EOrderStatus.Filed && it.ExpiredTime < SqlFunc.GetDate(), 1, 0)),//待办超期
|
|
|
|
+ CompleteOnTime = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Filed && it.ActualHandleTime <= it.ExpiredTime, 1, 0)),//按时办结
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 发布
|
|
|
|
+ //发布
|
|
|
|
+ var queryPublish = _orderPublishRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o) => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o) => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ o.Id,
|
|
|
|
+ OrgCode = o.ActualHandleOrgCode.Substring(0, dto.OrgCode.Length + 3),
|
|
|
|
+ PublishState = x.PublishState,
|
|
|
|
+ Status = o.Status
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(it => new { it.OrgCode })
|
|
|
|
+ .Select(it => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status == EOrderStatus.Filed, 1, 0)),//待发布 --已归档的就是待发布
|
|
|
|
+ PublishedOpen = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Published && it.PublishState, 1, 0)),//已发布公开
|
|
|
|
+ PublishedNoOpen = SqlFunc.AggregateSum(SqlFunc.IIF(it.Status >= EOrderStatus.Published && !it.PublishState, 1, 0)),//已发布不公开
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 会签(已办超期、待办超期)
|
|
|
|
+ //会签(已办超期、待办超期)
|
|
|
|
+ //var queryCountersign = _workflowStepHandleRepository.Queryable()
|
|
|
|
+ // .LeftJoin<WorkflowTrace>((x, o) => x.WorkflowStepId == o.StepId)
|
|
|
|
+ var queryCountersign = _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && t.CreationTime >= dto.StartDate && t.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((t, o) => new
|
|
|
|
+ {
|
|
|
|
+ OrgCode = t.HandlerOrgId.Substring(0, dto.OrgCode.Length + 3),
|
|
|
|
+ t.HandleTime,
|
|
|
|
+ t.StepExpiredTime,
|
|
|
|
+ t.Status,
|
|
|
|
+ t.CountersignPosition,
|
|
|
|
+ o.Id
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(d => new { d.OrgCode })
|
|
|
|
+ .Select(d => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = d.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status >= EWorkflowStepStatus.Handled, 1, 0)),//已办
|
|
|
|
+ ZBOrderCountNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EWorkflowStepStatus.Handled, 1, 0)),// 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EWorkflowStepStatus.Handled && DateTime.Now >= d.StepExpiredTime, 1, 0)),// 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status >= EWorkflowStepStatus.Handled && d.HandleTime > d.StepExpiredTime, 1, 0)),
|
|
|
|
+ HQZBOverdue = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status < EWorkflowStepStatus.Handled && DateTime.Now >= d.StepExpiredTime, 1, 0)),
|
|
|
|
+ DelayEnd = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status >= EWorkflowStepStatus.Handled, 1, 0)),
|
|
|
|
+ DelayWait = SqlFunc.AggregateSum(SqlFunc.IIF(d.CountersignPosition > ECountersignPosition.None && d.Status < EWorkflowStepStatus.Handled, 1, 0)),
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 延期
|
|
|
|
+ //延期
|
|
|
|
+ var orderDelay = _orderDelayRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o) => x.ApplyOrgCode == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o) => x.ApplyOrgCode.StartsWith(dto.OrgCode))
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.ApplyOrgCode.Substring(0, dto.OrgCode.Length + 3),
|
|
|
|
+ x.DelayState
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(x => new { x.OrgCode })
|
|
|
|
+ .Select(x => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.DelayState == EDelayState.Pass, 1, 0)),
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 甄别
|
|
|
|
+ //甄别
|
|
|
|
+ var orderScreen = _orderScreenRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), (x, o) => x.CreatorOrgId.Contains(dto.OrgName))
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o) => x.CreatorOrgId == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o) => x.CreatorOrgId.StartsWith(dto.OrgCode))
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ x.Id,
|
|
|
|
+ OrgCode = x.CreatorOrgId.Substring(0, dto.OrgCode.Length + 3),
|
|
|
|
+ x.Status
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(x => new { x.OrgCode })
|
|
|
|
+ .Select(x => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.Id != null, 1, 0)),
|
|
|
|
+ ScreenApproval = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EScreenStatus.Approval || x.Status == EScreenStatus.Apply, 1, 0)),
|
|
|
|
+ ScreenPass = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EScreenStatus.End, 1, 0)),
|
|
|
|
+ ScreenNotPass = SqlFunc.AggregateSum(SqlFunc.IIF(x.Status == EScreenStatus.Refuse, 1, 0)),
|
|
|
|
+ SatisfactionCount = 0,
|
|
|
|
+ NotSatisfactionCount = 0,
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 满意度
|
|
|
|
+ //满意度
|
|
|
|
+ var orderVisit = _orderVisitDetailRepository.Queryable()
|
|
|
|
+ .LeftJoin<OrderVisit>((x, o) => x.VisitId == o.Id)
|
|
|
|
+ .LeftJoin<Order>((x, o, p) => o.OrderId == p.Id)
|
|
|
|
+ .Where((x, o) => x.OrderVisit.VisitTime >= dto.StartDate && x.OrderVisit.VisitTime <= dto.EndDate && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o) => x.VisitOrgCode == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o) => x.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o, p) => p.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((x, o) => new
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.VisitOrgCode.Substring(0, dto.OrgCode.Length + 3),
|
|
|
|
+ x.OrgProcessingResults
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(x => new { x.OrgCode })
|
|
|
|
+ .Select(x => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = x.OrgCode,
|
|
|
|
+ // OrderCountNum = 0,//总量
|
|
|
|
+ YBOrderCountNum = 0,//已办
|
|
|
|
+ ZBOrderCountNum = 0,//在办
|
|
|
|
+ Archived = 0,
|
|
|
|
+ ToBeArchived = 0,
|
|
|
|
+ WaitPublished = 0,
|
|
|
|
+ PublishedOpen = 0,
|
|
|
|
+ PublishedNoOpen = 0,
|
|
|
|
+ YBOverdue = 0,
|
|
|
|
+ ZBOverdue = 0,
|
|
|
|
+ CompleteOnTime = 0,
|
|
|
|
+ HQYBOverdue = 0,
|
|
|
|
+ HQZBOverdue = 0,
|
|
|
|
+ DelayEnd = 0,
|
|
|
|
+ DelayWait = 0,
|
|
|
|
+ OrderDelayCount = 0,
|
|
|
|
+ ScreenCount = 0,
|
|
|
|
+ ScreenApproval = 0,
|
|
|
|
+ ScreenPass = 0,
|
|
|
|
+ ScreenNotPass = 0,
|
|
|
|
+ SatisfactionCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") != "2", 1, 0)),
|
|
|
|
+ NotSatisfactionCount = SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2", 1, 0))
|
|
|
|
+ })
|
|
|
|
+ .MergeTable();
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ //联合查询
|
|
|
|
+ return _orderRepository.OrderUnionAll(queryOrder, queryPublish, queryCountersign, orderDelay, orderScreen, orderVisit)
|
|
|
|
+ .LeftJoin<SystemOrganize>((p, o) => p.OrgCode == o.Id)
|
|
|
|
+ .Select((p, o) => new DepartmentalProcessingStatisticsDataDto
|
|
|
|
+ {
|
|
|
|
+ OrgCode = p.OrgCode,
|
|
|
|
+ OrgName = o.Name,
|
|
|
|
+ OrgType = o.OrgType,
|
|
|
|
+ //OrderCountNum = p.OrderCountNum,
|
|
|
|
+ YBOrderCountNum = p.YBOrderCountNum,
|
|
|
|
+ ZBOrderCountNum = p.ZBOrderCountNum,
|
|
|
|
+ Archived = p.Archived,
|
|
|
|
+ ToBeArchived = p.ToBeArchived,
|
|
|
|
+ WaitPublished = p.WaitPublished,
|
|
|
|
+ PublishedOpen = p.PublishedOpen,
|
|
|
|
+ PublishedNoOpen = p.PublishedNoOpen,
|
|
|
|
+ YBOverdue = p.YBOverdue,
|
|
|
|
+ ZBOverdue = p.ZBOverdue,
|
|
|
|
+ CompleteOnTime = p.CompleteOnTime,
|
|
|
|
+ HQYBOverdue = p.HQYBOverdue,
|
|
|
|
+ HQZBOverdue = p.HQZBOverdue,
|
|
|
|
+ DelayEnd = p.DelayEnd,
|
|
|
|
+ DelayWait = p.DelayWait,
|
|
|
|
+ OrderDelayCount = p.OrderDelayCount,
|
|
|
|
+ ScreenCount = p.ScreenCount,
|
|
|
|
+ ScreenApproval = p.ScreenApproval,
|
|
|
|
+ ScreenPass = p.ScreenPass,
|
|
|
|
+ ScreenNotPass = p.ScreenNotPass,
|
|
|
|
+ SatisfactionCount = p.SatisfactionCount,
|
|
|
|
+ NotSatisfactionCount = p.NotSatisfactionCount
|
|
|
|
+ })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .WhereIF(string.IsNullOrEmpty(dto.OrgName) == false, x => x.OrgName.Contains(dto.OrgName));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 部门办件统计表--明细
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public ISugarQueryable<SelectOrderId> GetDepartmentalProcessingStatisticsList(DepartmentalProcessingStatisticsRequest dto, CancellationToken cancellationToken)
|
|
|
|
+ {
|
|
|
|
+ dto.EndDate = dto.EndDate.AddDays(1).AddSeconds(-1);
|
|
|
|
+
|
|
|
|
+ RefAsync<int> total = 0;
|
|
|
|
+ string stye = "";
|
|
|
|
+ switch (dto.StatisticsType)
|
|
|
|
+ {
|
|
|
|
+ case EStatisticsType.YBOrderCountNum:
|
|
|
|
+ //工单
|
|
|
|
+ stye = "0";
|
|
|
|
+ break;
|
|
|
|
+ case EStatisticsType.ToBeArchived:
|
|
|
|
+ case EStatisticsType.Archived:
|
|
|
|
+ case EStatisticsType.YBOverdue:
|
|
|
|
+ //工单
|
|
|
|
+ stye = "1";
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case EStatisticsType.WaitPublished:
|
|
|
|
+ case EStatisticsType.PublishedOpen:
|
|
|
|
+ case EStatisticsType.PublishedNoOpen:
|
|
|
|
+ //发布
|
|
|
|
+ stye = "2";
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case EStatisticsType.OrderDelayCount:
|
|
|
|
+ //延期
|
|
|
|
+ stye = "3";
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case EStatisticsType.ScreenCount:
|
|
|
|
+ case EStatisticsType.ScreenApproval:
|
|
|
|
+ case EStatisticsType.ScreenPass:
|
|
|
|
+ case EStatisticsType.ScreenNotPass:
|
|
|
|
+ //甄别
|
|
|
|
+ stye = "4";
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case EStatisticsType.HQYBOverdue:
|
|
|
|
+ case EStatisticsType.HQZBOverdue:
|
|
|
|
+ case EStatisticsType.DelayEnd:
|
|
|
|
+ case EStatisticsType.DelayWait:
|
|
|
|
+ case EStatisticsType.ZBOrderCountNum:
|
|
|
|
+ case EStatisticsType.ZBOverdue:
|
|
|
|
+ //会签
|
|
|
|
+ stye = "5";
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case EStatisticsType.SubtotalOverdue:
|
|
|
|
+ //超期总数
|
|
|
|
+ stye = "6";
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ 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)//已办
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, it => it.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select(it => new SelectOrderId { Id = it.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ //var hqybquery = _workflowStepHandleRepository.Queryable()
|
|
|
|
+ // .LeftJoin<WorkflowTrace>((x, o) => x.WorkflowStepId == o.StepId)
|
|
|
|
+ var hqybquery = _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && t.CreationTime >= dto.StartDate && t.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (t, o) => t.HandlerOrgId == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (t, o) => t.HandlerOrgId.StartsWith(dto.OrgCode))
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.YBOrderCountNum, (t, o) => t.Status >= EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None)//会签已办
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (t, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ var queryData = _orderRepository.OrderListUnionAll(ybQuery, hqybquery).GroupBy(p => p.Id).MergeTable();
|
|
|
|
+
|
|
|
|
+ return queryData;
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 工单
|
|
|
|
+ if (stye == "1")
|
|
|
|
+ {
|
|
|
|
+ //工单
|
|
|
|
+ var queryData = _orderRepository.Queryable()
|
|
|
|
+ .Where(o => o.CreationTime >= dto.StartDate && o.CreationTime <= dto.EndDate && 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))
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.Archived, o => o.Status >= EOrderStatus.Filed)//已归档
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ToBeArchived, o => o.Status < EOrderStatus.WaitForAccept)//待归档--没得待归档数据
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.YBOverdue, o => o.Status >= EOrderStatus.Filed && o.ActualHandleTime > o.ExpiredTime)//已办超期
|
|
|
|
+ .OrderByDescending(o => o.CreationTime)
|
|
|
|
+ .Select(o => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ return queryData;
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 发布
|
|
|
|
+ if (stye == "2")
|
|
|
|
+ {
|
|
|
|
+ //发布
|
|
|
|
+ var queryPublish = _orderPublishRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o) => o.ActualHandleOrgCode == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o) => o.ActualHandleOrgCode.StartsWith(dto.OrgCode))
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.WaitPublished, (x, o) => o.Status == EOrderStatus.Filed)//待发布 --已归档的就是待发布
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.PublishedOpen, (x, o) => o.Status >= EOrderStatus.Published && x.PublishState)//已发布公开
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.PublishedNoOpen, (x, o) => o.Status == EOrderStatus.Published && !x.PublishState)//已发布不公开
|
|
|
|
+ .OrderByDescending((x, o) => o.CreationTime)
|
|
|
|
+ .Select((x, o) => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ return queryPublish;
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 延期
|
|
|
|
+ if (stye == "3")
|
|
|
|
+ {
|
|
|
|
+ //延期
|
|
|
|
+ var orderDelay = _orderDelayRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .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)//延期次数
|
|
|
|
+ .OrderByDescending((x, o) => o.CreationTime)
|
|
|
|
+ .Select((x, o) => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ return orderDelay;
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 甄别
|
|
|
|
+ if (stye == "4")
|
|
|
|
+ {
|
|
|
|
+ //甄别
|
|
|
|
+ var orderScreen = _orderScreenRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((x, o) => x.OrderId == o.Id)
|
|
|
|
+ .Where((x, o) => x.CreationTime >= dto.StartDate && x.CreationTime <= dto.EndDate)
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, (x, o) => o.Source == ESource.ProvinceStraight)
|
|
|
|
+ .WhereIF(dto.OrgCode == "001", (x, o) => x.CreatorOrgId == dto.OrgCode)
|
|
|
|
+ .WhereIF(dto.OrgCode != "001", (x, o) => x.CreatorOrgId.StartsWith(dto.OrgCode))
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ScreenCount, (x, o) => x.Id != null)//申请总量
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ScreenApproval, (x, o) => x.Status == EScreenStatus.Approval || x.Status == EScreenStatus.Apply)//待甄别
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ScreenPass, (x, o) => x.Status == EScreenStatus.End)//甄别通过
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ScreenNotPass, (x, o) => x.Status == EScreenStatus.Refuse)//甄别不通过
|
|
|
|
+ .OrderByDescending((x, o) => o.CreationTime)
|
|
|
|
+ .Select((x, o) => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ return orderScreen;
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 会签(已办超期、待办超期)
|
|
|
|
+ if (stye == "5")
|
|
|
|
+ {
|
|
|
|
+ //会签(已办超期、待办超期)
|
|
|
|
+ var queryCountersign = _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && t.CreationTime >= dto.StartDate && t.CreationTime <= dto.EndDate)
|
|
|
|
+ .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))
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.HQYBOverdue, (t, o) => t.Status >= EWorkflowStepStatus.Handled && t.HandleTime > t.StepExpiredTime && t.CountersignPosition > ECountersignPosition.None)//会签已办超期
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.HQZBOverdue, (t, o) => t.Status < EWorkflowStepStatus.Handled && DateTime.Now >= t.StepExpiredTime && t.CountersignPosition > ECountersignPosition.None)//会签待办超期
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.DelayEnd, (t, o) => t.Status >= EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None)//会签已办
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.DelayWait, (t, o) => t.Status < EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None)//会签待办
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ZBOrderCountNum, (t, o) => t.Status < EWorkflowStepStatus.Handled)//在办总量
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.ZBOverdue, (t, o) => t.Status < EWorkflowStepStatus.Handled && DateTime.Now >= t.StepExpiredTime)//在办超期
|
|
|
|
+ .OrderByDescending((t, o) => o.CreationTime)
|
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable()
|
|
|
|
+ .GroupBy(p => p.Id)
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ return queryCountersign;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 超期件数
|
|
|
|
+ //超期件数
|
|
|
|
+ if (stye == "6")
|
|
|
|
+ {
|
|
|
|
+ var queryOrder = _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.SubtotalOverdue, it => (it.Status >= EOrderStatus.Filed && it.ActualHandleTime > it.ExpiredTime))//已办超期
|
|
|
|
+ .WhereIF(dto.IsProvince.HasValue && dto.IsProvince == true, it => it.Source == ESource.ProvinceStraight)
|
|
|
|
+ .Select(it => new SelectOrderId { Id = it.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ //会签(已办超期、待办超期)
|
|
|
|
+ //var queryCountersign = _workflowStepHandleRepository.Queryable()
|
|
|
|
+ //.LeftJoin<WorkflowTrace>((x, o) => x.WorkflowStepId == o.StepId)
|
|
|
|
+ var queryCountersign = _workflowTraceRepository.Queryable()
|
|
|
|
+ .LeftJoin<Order>((t, o) => t.ExternalId == o.Id)
|
|
|
|
+ .Where((t, o) => t.ModuleCode == WorkflowModuleConsts.OrderHandle && t.CreationTime >= dto.StartDate && t.CreationTime <= dto.EndDate)
|
|
|
|
+ .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))
|
|
|
|
+
|
|
|
|
+ .WhereIF(dto.StatisticsType == EStatisticsType.SubtotalOverdue, (t, o) => (t.Status >= EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None && t.HandleTime > t.StepExpiredTime)
|
|
|
|
+ || (t.Status < EWorkflowStepStatus.Handled && t.CountersignPosition > ECountersignPosition.None && DateTime.Now >= t.StepExpiredTime)
|
|
|
|
+ || (t.Status < EWorkflowStepStatus.Handled && DateTime.Now >= t.StepExpiredTime))//会签已办超期/会签待办超期/待办超期
|
|
|
|
+
|
|
|
|
+ .Select((t, o) => new SelectOrderId { Id = o.Id })
|
|
|
|
+ .MergeTable();
|
|
|
|
+
|
|
|
|
+ var queryData = _orderRepository.OrderListUnionAll(queryOrder, queryCountersign).GroupBy(x => x.Id).MergeTable();
|
|
|
|
+
|
|
|
|
+ return queryData;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|