|
@@ -26,406 +26,410 @@ using Hotline.Share.Enums.FlowEngine;
|
|
|
|
|
|
namespace Hotline.Application.Orders
|
|
|
{
|
|
|
- public class OrderSecondaryHandlingApplication : IOrderSecondaryHandlingApplication, IScopeDependency
|
|
|
- {
|
|
|
- private readonly IMapper _mapper;
|
|
|
- private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
|
|
|
- private readonly IFileRepository _fileRepository;
|
|
|
- private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
|
- private readonly ISessionContext _sessionContext;
|
|
|
- private readonly IOrderRepository _orderRepository;
|
|
|
- private readonly ITimeLimitDomainService _timeLimitDomainService;
|
|
|
- private readonly ICapPublisher _capPublisher;
|
|
|
- private readonly IWorkflowApplication _workflowApplication;
|
|
|
- private readonly IRepository<OrderPublish> _orderPublishRepository;
|
|
|
- private readonly IRepository<OrderPublishHistory> _orderPublishHistoryRepository;
|
|
|
- private readonly IWorkflowDomainService _workflowDomainService;
|
|
|
- private readonly IRepository<OrderVisitDetail> _orderVisitedDetailRepository;
|
|
|
+ public class OrderSecondaryHandlingApplication : IOrderSecondaryHandlingApplication, IScopeDependency
|
|
|
+ {
|
|
|
+ private readonly IMapper _mapper;
|
|
|
+ private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
|
|
|
+ private readonly IFileRepository _fileRepository;
|
|
|
+ private readonly IRepository<OrderVisit> _orderVisitRepository;
|
|
|
+ private readonly ISessionContext _sessionContext;
|
|
|
+ private readonly IOrderRepository _orderRepository;
|
|
|
+ private readonly ITimeLimitDomainService _timeLimitDomainService;
|
|
|
+ private readonly ICapPublisher _capPublisher;
|
|
|
+ private readonly IWorkflowApplication _workflowApplication;
|
|
|
+ private readonly IRepository<OrderPublish> _orderPublishRepository;
|
|
|
+ private readonly IRepository<OrderPublishHistory> _orderPublishHistoryRepository;
|
|
|
+ private readonly IWorkflowDomainService _workflowDomainService;
|
|
|
+ private readonly IRepository<OrderVisitDetail> _orderVisitedDetailRepository;
|
|
|
|
|
|
- public OrderSecondaryHandlingApplication(
|
|
|
- IMapper mapper,
|
|
|
- IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
|
|
|
- IFileRepository fileRepository,
|
|
|
- IRepository<OrderVisit> orderVisitRepository,
|
|
|
- ISessionContext sessionContext,
|
|
|
- IOrderRepository orderRepository,
|
|
|
- ITimeLimitDomainService timeLimitDomainService,
|
|
|
- ICapPublisher capPublisher,
|
|
|
- IWorkflowApplication workflowApplication,
|
|
|
- IRepository<OrderPublish> orderPublishRepository,
|
|
|
- IRepository<OrderPublishHistory> orderPublishHistoryRepository,
|
|
|
- IWorkflowDomainService workflowDomainService,
|
|
|
- IRepository<OrderVisitDetail> orderVisitedDetailRepository
|
|
|
- ) {
|
|
|
- _mapper = mapper;
|
|
|
- _orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
|
|
|
- _fileRepository = fileRepository;
|
|
|
- _orderVisitRepository = orderVisitRepository;
|
|
|
- _sessionContext = sessionContext;
|
|
|
- _orderRepository = orderRepository;
|
|
|
- _timeLimitDomainService = timeLimitDomainService;
|
|
|
- _capPublisher = capPublisher;
|
|
|
- _workflowApplication = workflowApplication;
|
|
|
- _orderPublishRepository = orderPublishRepository;
|
|
|
- _orderPublishHistoryRepository = orderPublishHistoryRepository;
|
|
|
- _workflowDomainService = workflowDomainService;
|
|
|
- _orderVisitedDetailRepository = orderVisitedDetailRepository;
|
|
|
- }
|
|
|
+ public OrderSecondaryHandlingApplication(
|
|
|
+ IMapper mapper,
|
|
|
+ IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
|
|
|
+ IFileRepository fileRepository,
|
|
|
+ IRepository<OrderVisit> orderVisitRepository,
|
|
|
+ ISessionContext sessionContext,
|
|
|
+ IOrderRepository orderRepository,
|
|
|
+ ITimeLimitDomainService timeLimitDomainService,
|
|
|
+ ICapPublisher capPublisher,
|
|
|
+ IWorkflowApplication workflowApplication,
|
|
|
+ IRepository<OrderPublish> orderPublishRepository,
|
|
|
+ IRepository<OrderPublishHistory> orderPublishHistoryRepository,
|
|
|
+ IWorkflowDomainService workflowDomainService,
|
|
|
+ IRepository<OrderVisitDetail> orderVisitedDetailRepository
|
|
|
+ )
|
|
|
+ {
|
|
|
+ _mapper = mapper;
|
|
|
+ _orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
|
|
|
+ _fileRepository = fileRepository;
|
|
|
+ _orderVisitRepository = orderVisitRepository;
|
|
|
+ _sessionContext = sessionContext;
|
|
|
+ _orderRepository = orderRepository;
|
|
|
+ _timeLimitDomainService = timeLimitDomainService;
|
|
|
+ _capPublisher = capPublisher;
|
|
|
+ _workflowApplication = workflowApplication;
|
|
|
+ _orderPublishRepository = orderPublishRepository;
|
|
|
+ _orderPublishHistoryRepository = orderPublishHistoryRepository;
|
|
|
+ _workflowDomainService = workflowDomainService;
|
|
|
+ _orderVisitedDetailRepository = orderVisitedDetailRepository;
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理新增
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task AddAsync(AddOrderSecondaryHandlingDto dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- var model = _mapper.Map<OrderSecondaryHandling>(dto);
|
|
|
- if (string.IsNullOrEmpty(dto.Id))
|
|
|
- {
|
|
|
- model.InitId();
|
|
|
- }
|
|
|
- else {
|
|
|
- model = await _orderSecondaryHandlingRepository.GetAsync(dto.Id , cancellationToken);
|
|
|
- model.Content = dto.Content;
|
|
|
- }
|
|
|
- model.State = ESecondaryHandlingState.Apply;
|
|
|
- model.ApplyOrgId = _sessionContext.OrgId;
|
|
|
- model.ApplyOrgName = _sessionContext.OrgName;
|
|
|
-
|
|
|
- if (dto.Files.Any())
|
|
|
- model.FileJson = await _fileRepository.AddFileAsync(dto.Files, model.Id, "", cancellationToken);
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理新增
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task AddAsync(AddOrderSecondaryHandlingDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var model = _mapper.Map<OrderSecondaryHandling>(dto);
|
|
|
+ if (string.IsNullOrEmpty(dto.Id))
|
|
|
+ {
|
|
|
+ model.InitId();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ model = await _orderSecondaryHandlingRepository.GetAsync(dto.Id, cancellationToken);
|
|
|
+ model.Content = dto.Content;
|
|
|
+ }
|
|
|
+ model.State = ESecondaryHandlingState.Apply;
|
|
|
+ model.ApplyOrgId = _sessionContext.OrgId;
|
|
|
+ model.ApplyOrgName = _sessionContext.OrgName;
|
|
|
|
|
|
- var visit = await _orderVisitRepository.GetAsync(x => x.Id == dto.VisitId && x.VisitState != EVisitState.None, cancellationToken);
|
|
|
- if (visit != null)
|
|
|
- {
|
|
|
- model.VisitState = visit.VisitState;
|
|
|
- visit.VisitState = EVisitState.None;
|
|
|
- await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
- }
|
|
|
+ if (dto.Files.Any())
|
|
|
+ model.FileJson = await _fileRepository.AddFileAsync(dto.Files, model.Id, "", cancellationToken);
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(dto.Id))
|
|
|
- {
|
|
|
- await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
- }
|
|
|
- else {
|
|
|
- await _orderSecondaryHandlingRepository.AddAsync(model, cancellationToken);
|
|
|
- }
|
|
|
- }
|
|
|
+ var visit = await _orderVisitRepository.GetAsync(x => x.Id == dto.VisitId && x.VisitState != EVisitState.None, cancellationToken);
|
|
|
+ if (visit != null)
|
|
|
+ {
|
|
|
+ model.VisitState = visit.VisitState;
|
|
|
+ visit.VisitState = EVisitState.None;
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
+ }
|
|
|
|
|
|
- public async Task SendBackAsync(SendBackOrderSecondaryHandlingDto dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- var model =await _orderSecondaryHandlingRepository.GetAsync(dto.Id, cancellationToken);
|
|
|
- model.State = ESecondaryHandlingState.NotApply;
|
|
|
- model.SendBackContent = dto.SendBackContent;
|
|
|
- model.AuditUser = _sessionContext.UserName;
|
|
|
- model.AuditTime = DateTime.Now;
|
|
|
- model.SendBackNum = model.SendBackNum is null ? 1 : model.SendBackNum + 1;
|
|
|
- await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
- var visit = await _orderVisitRepository.GetAsync(x => x.Id == model.VisitId , cancellationToken);
|
|
|
- if (visit != null)
|
|
|
- {
|
|
|
- visit.VisitState = model.VisitState;
|
|
|
- await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!string.IsNullOrEmpty(dto.Id))
|
|
|
+ {
|
|
|
+ await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await _orderSecondaryHandlingRepository.AddAsync(model, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ public async Task SendBackAsync(SendBackOrderSecondaryHandlingDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var model = await _orderSecondaryHandlingRepository.GetAsync(dto.Id, cancellationToken);
|
|
|
+ model.State = ESecondaryHandlingState.NotApply;
|
|
|
+ model.SendBackContent = dto.SendBackContent;
|
|
|
+ model.AuditUser = _sessionContext.UserName;
|
|
|
+ model.AuditTime = DateTime.Now;
|
|
|
+ model.SendBackNum = model.SendBackNum is null ? 1 : model.SendBackNum + 1;
|
|
|
+ await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
+ var visit = await _orderVisitRepository.GetAsync(x => x.Id == model.VisitId, cancellationToken);
|
|
|
+ if (visit != null)
|
|
|
+ {
|
|
|
+ visit.VisitState = model.VisitState;
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理审批
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task AuditAsync(AuditOrderSecondaryHandlingDto dto, OrderSecondaryHandling model, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- model.State = dto.State;
|
|
|
- model.AuditContent = dto.AuditContent;
|
|
|
- model.AuditId = _sessionContext.UserId;
|
|
|
- model.AuditUser = _sessionContext.UserName;
|
|
|
- model.AuditTime = DateTime.Now;
|
|
|
- if (model.State == ESecondaryHandlingState.End)
|
|
|
- {
|
|
|
- var order = await _orderRepository.GetAsync(x => x.Id == model.OrderId, cancellationToken);
|
|
|
- if (string.IsNullOrEmpty(order.WorkflowId))
|
|
|
- throw UserFriendlyException.SameMessage("无效二次办理审批信息,没有找到对应流程信息!");
|
|
|
- var step = await _workflowDomainService.FindLastHandleStepAsync(order.WorkflowId, model.ApplyOrgId, cancellationToken);
|
|
|
- if (step == null)
|
|
|
- throw UserFriendlyException.SameMessage("无效二次办理审批信息,没有找到对应流程节点!");
|
|
|
- var recall = new RecallDto
|
|
|
- {
|
|
|
- WorkflowId = order.WorkflowId!,
|
|
|
- NextStepCode = step.Code,
|
|
|
- NextStepName = step.Name,
|
|
|
- NextHandlers = step.Handlers,
|
|
|
- Opinion = dto.AuditContent,
|
|
|
- FlowDirection = Share.Enums.FlowEngine.EFlowDirection.CenterToOrg,
|
|
|
- HandlerType = step.HandlerType,
|
|
|
- BusinessType = step.BusinessType
|
|
|
- };
|
|
|
- var reTransactNum = order.ReTransactNum is null ? 1 : order.ReTransactNum + 1;
|
|
|
- var expiredTime = _timeLimitDomainService.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
- var processType = step.FlowDirection == EFlowDirection.OrgToCenter || step.FlowDirection == EFlowDirection.CenterToCenter ? EProcessType.Zhiban : EProcessType.Jiaoban;
|
|
|
- await _orderRepository.Updateable().SetColumns(o => new Order() { ExpiredTime = expiredTime.ExpiredTime, NearlyExpiredTime = expiredTime.NearlyExpiredTime, ReTransactNum = reTransactNum, ProcessType = processType })
|
|
|
- .Where(o => o.Id == order.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
- var orderDto = _mapper.Map<OrderDto>(order);
|
|
|
- await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate, orderDto, cancellationToken: cancellationToken);
|
|
|
|
|
|
- await _workflowApplication.RecallAsync(recall, expiredTime.ExpiredTime, cancellationToken);
|
|
|
- var publish = await _orderPublishRepository.GetAsync(x => x.OrderId == model.OrderId);
|
|
|
- if (publish != null)
|
|
|
- {
|
|
|
- var publishHistory = _mapper.Map<OrderPublishHistory>(publish);
|
|
|
- publishHistory.OrderPublishId = publish.Id;
|
|
|
- publishHistory.ArrangeTitleAfter = publish.ArrangeTitle;
|
|
|
- publishHistory.ArrangeTitleBefor = publish.ArrangeTitle;
|
|
|
- publishHistory.ArrangeContentAfter = publish.ArrangeContent;
|
|
|
- publishHistory.ArrangeContentBefor = publish.ArrangeContent;
|
|
|
- publishHistory.ArrangeOpinionAfter = publish.ArrangeOpinion;
|
|
|
- publishHistory.ArrangeOpinionBefor = publish.ArrangeOpinion;
|
|
|
- await _orderPublishHistoryRepository.AddAsync(publishHistory, cancellationToken);
|
|
|
- await _orderPublishRepository.RemoveAsync(publish, false, cancellationToken);
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- var visit = await _orderVisitRepository.GetAsync(x => x.OrderId == model.OrderId, cancellationToken);
|
|
|
- visit.VisitState = model.VisitState;
|
|
|
- await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
- }
|
|
|
- await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理审批
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task AuditAsync(AuditOrderSecondaryHandlingDto dto, OrderSecondaryHandling model, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ model.State = dto.State;
|
|
|
+ model.AuditContent = dto.AuditContent;
|
|
|
+ model.AuditId = _sessionContext.UserId;
|
|
|
+ model.AuditUser = _sessionContext.UserName;
|
|
|
+ model.AuditTime = DateTime.Now;
|
|
|
+ if (model.State == ESecondaryHandlingState.End)
|
|
|
+ {
|
|
|
+ var order = await _orderRepository.GetAsync(x => x.Id == model.OrderId, cancellationToken);
|
|
|
+ if (string.IsNullOrEmpty(order.WorkflowId))
|
|
|
+ throw UserFriendlyException.SameMessage("无效二次办理审批信息,没有找到对应流程信息!");
|
|
|
+ var step = await _workflowDomainService.FindLastHandleStepAsync(order.WorkflowId, model.ApplyOrgId, cancellationToken);
|
|
|
+ if (step == null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效二次办理审批信息,没有找到对应流程节点!");
|
|
|
+ var recall = new RecallDto
|
|
|
+ {
|
|
|
+ WorkflowId = order.WorkflowId!,
|
|
|
+ NextStepCode = step.Code,
|
|
|
+ NextStepName = step.Name,
|
|
|
+ NextHandlers = new List<FlowStepHandler> { step.GetWorkflowStepHandler() },
|
|
|
+ Opinion = dto.AuditContent,
|
|
|
+ FlowDirection = Share.Enums.FlowEngine.EFlowDirection.CenterToOrg,
|
|
|
+ HandlerType = step.HandlerType,
|
|
|
+ BusinessType = step.BusinessType
|
|
|
+ };
|
|
|
+ var reTransactNum = order.ReTransactNum is null ? 1 : order.ReTransactNum + 1;
|
|
|
+ var expiredTime = _timeLimitDomainService.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
+ var processType = step.FlowDirection == EFlowDirection.OrgToCenter || step.FlowDirection == EFlowDirection.CenterToCenter ? EProcessType.Zhiban : EProcessType.Jiaoban;
|
|
|
+ await _orderRepository.Updateable().SetColumns(o => new Order() { ExpiredTime = expiredTime.ExpiredTime, NearlyExpiredTime = expiredTime.NearlyExpiredTime, ReTransactNum = reTransactNum, ProcessType = processType })
|
|
|
+ .Where(o => o.Id == order.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
+ var orderDto = _mapper.Map<OrderDto>(order);
|
|
|
+ await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate, orderDto, cancellationToken: cancellationToken);
|
|
|
|
|
|
+ await _workflowApplication.RecallAsync(recall, expiredTime.ExpiredTime, cancellationToken);
|
|
|
+ var publish = await _orderPublishRepository.GetAsync(x => x.OrderId == model.OrderId);
|
|
|
+ if (publish != null)
|
|
|
+ {
|
|
|
+ var publishHistory = _mapper.Map<OrderPublishHistory>(publish);
|
|
|
+ publishHistory.OrderPublishId = publish.Id;
|
|
|
+ publishHistory.ArrangeTitleAfter = publish.ArrangeTitle;
|
|
|
+ publishHistory.ArrangeTitleBefor = publish.ArrangeTitle;
|
|
|
+ publishHistory.ArrangeContentAfter = publish.ArrangeContent;
|
|
|
+ publishHistory.ArrangeContentBefor = publish.ArrangeContent;
|
|
|
+ publishHistory.ArrangeOpinionAfter = publish.ArrangeOpinion;
|
|
|
+ publishHistory.ArrangeOpinionBefor = publish.ArrangeOpinion;
|
|
|
+ await _orderPublishHistoryRepository.AddAsync(publishHistory, cancellationToken);
|
|
|
+ await _orderPublishRepository.RemoveAsync(publish, false, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var visit = await _orderVisitRepository.GetAsync(x => x.OrderId == model.OrderId, cancellationToken);
|
|
|
+ visit.VisitState = model.VisitState;
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
+ }
|
|
|
+ await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 获取申请列表
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderVisitDetail> ApplyQuery(MayScreenListDto dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- dto.CreationTimeEnd = DateTime.Now;
|
|
|
- //dto.CreationTimeStart = DateTime.Now;
|
|
|
- dto.CreationTimeStart = _timeLimitDomainService.CalcWorkTimeReduce(DateTime.Now, 5);
|
|
|
|
|
|
- var query = _orderVisitedDetailRepository.Queryable(false, true)
|
|
|
- .Includes(x => x.OrderVisit)
|
|
|
- .Includes(x => x.OrderVisit, y => y.Order)
|
|
|
- .Includes(x => x.OrderVisit, y => y.Employee)
|
|
|
- .Includes(x => x.SecondaryHandling)
|
|
|
- .LeftJoin<OrderScreen>((x, s) => x.Id == s.VisitDetailId && s.Status < EScreenStatus.End && s.IsDeleted == false)
|
|
|
- .Where((x, s) => s.Id == null && (x.SecondaryHandling.State == ESecondaryHandlingState.NotApply || x.SecondaryHandling.Id == null))
|
|
|
- .Where(x => x.OrderVisit.VisitTime < dto.CreationTimeEnd && x.OrderVisit.VisitTime > dto.CreationTimeStart)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderVisit.Order!.No!.Contains(dto.No!))
|
|
|
- .WhereIF(dto.IsProvince.HasValue, x => x.OrderVisit.Order!.IsProvince == dto.IsProvince)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.OrderVisit.Order!.Title!.Contains(dto.Title!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.SourceChannel), x => x.OrderVisit.Order!.SourceChannelCode! == dto.SourceChannel!)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.AcceptType), x => x.OrderVisit.Order!.AcceptTypeCode! == dto.AcceptType!)
|
|
|
- .WhereIF(dto.CounterSignType.HasValue, x => x.OrderVisit.Order!.CounterSignType == dto.CounterSignType)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneName), x => x.OrderVisit.Order!.OrgLevelOneName!.Contains(dto.OrgLevelOneName!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.ActualHandleOrgName), x => x.OrderVisit.Order!.ActualHandleOrgName!.Contains(dto.ActualHandleOrgName!))
|
|
|
- .WhereIF(dto.ActualHandleTime.HasValue && dto.EndActualHandleTime.HasValue, x => x.OrderVisit.Order!.ActualHandleTime >= dto.ActualHandleTime && x.OrderVisit.Order!.ActualHandleTime <= dto.EndActualHandleTime)
|
|
|
- .WhereIF(dto.FiledTime.HasValue && dto.EndFiledTime.HasValue, x => x.OrderVisit.Order!.FiledTime == dto.FiledTime && x.OrderVisit.Order!.FiledTime <= dto.EndFiledTime)
|
|
|
- .WhereIF(dto.CreationTime.HasValue && dto.EndCreationTime.HasValue, x => x.OrderVisit.Order!.CreationTime == dto.CreationTime && x.OrderVisit.Order!.CreationTime <= dto.EndCreationTime)
|
|
|
- .WhereIF(dto.VisitTime.HasValue && dto.EndVisitTime.HasValue, x => x.OrderVisit.VisitTime == dto.VisitTime && x.OrderVisit.VisitTime <= dto.EndVisitTime)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.VisitOrgName), x => x.VisitOrgName!.Contains(dto.VisitOrgName!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgProcessingResults), x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == dto.OrgProcessingResults)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgHandledAttitude), x => SqlFunc.JsonListObjectAny(x.OrgHandledAttitude, "Key", dto.OrgHandledAttitude))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgNoSatisfiedReason), x => SqlFunc.JsonField(x.OrgNoSatisfiedReason, "Key") == dto.OrgNoSatisfiedReason)
|
|
|
- .Where((x, s) => x.OrderVisit.VisitState != EVisitState.None && x.OrderVisit.IsCanHandle)
|
|
|
- .Where((x, s) => x.OrderVisit.Order.CounterSignType == null && x.OrderVisit.Order.ActualHandleOrgCode == _sessionContext.OrgId)
|
|
|
- ;
|
|
|
- if (_sessionContext.OrgId != null && !_sessionContext.OrgIsCenter)
|
|
|
- {
|
|
|
- query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- (x, s) => x.OrderVisit.Order.Title.Contains(dto.Keyword!) ||
|
|
|
- x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
- .Where((x, s) => x.VisitTarget == EVisitTarget.Org && x.VisitOrgCode.StartsWith(_sessionContext.OrgId) && (
|
|
|
- SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "1" ||
|
|
|
- SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2"
|
|
|
- || SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "1" ||
|
|
|
- SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2"
|
|
|
- ));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- (x, s) => x.OrderVisit.Order.Title.Contains(dto.Keyword!) ||
|
|
|
- x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
- .Where((x, s) => x.VisitTarget == EVisitTarget.Org && (
|
|
|
- SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "1" ||
|
|
|
- SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2"
|
|
|
- || SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "1" ||
|
|
|
- SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2"
|
|
|
- ));
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取申请列表
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderVisitDetail> ApplyQuery(MayScreenListDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ dto.CreationTimeEnd = DateTime.Now;
|
|
|
+ //dto.CreationTimeStart = DateTime.Now;
|
|
|
+ dto.CreationTimeStart = _timeLimitDomainService.CalcWorkTimeReduce(DateTime.Now, 5);
|
|
|
|
|
|
- return query.OrderByDescending((x, s) => x.CreationTime);
|
|
|
- }
|
|
|
+ var query = _orderVisitedDetailRepository.Queryable(false, true)
|
|
|
+ .Includes(x => x.OrderVisit)
|
|
|
+ .Includes(x => x.OrderVisit, y => y.Order)
|
|
|
+ .Includes(x => x.OrderVisit, y => y.Employee)
|
|
|
+ .Includes(x => x.SecondaryHandling)
|
|
|
+ .LeftJoin<OrderScreen>((x, s) => x.Id == s.VisitDetailId && s.Status < EScreenStatus.End && s.IsDeleted == false)
|
|
|
+ .Where((x, s) => s.Id == null && (x.SecondaryHandling.State == ESecondaryHandlingState.NotApply || x.SecondaryHandling.Id == null))
|
|
|
+ .Where(x => x.OrderVisit.VisitTime < dto.CreationTimeEnd && x.OrderVisit.VisitTime > dto.CreationTimeStart)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderVisit.Order!.No!.Contains(dto.No!))
|
|
|
+ .WhereIF(dto.IsProvince.HasValue, x => x.OrderVisit.Order!.IsProvince == dto.IsProvince)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.OrderVisit.Order!.Title!.Contains(dto.Title!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.SourceChannel), x => x.OrderVisit.Order!.SourceChannelCode! == dto.SourceChannel!)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.AcceptType), x => x.OrderVisit.Order!.AcceptTypeCode! == dto.AcceptType!)
|
|
|
+ .WhereIF(dto.CounterSignType.HasValue, x => x.OrderVisit.Order!.CounterSignType == dto.CounterSignType)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneName), x => x.OrderVisit.Order!.OrgLevelOneName!.Contains(dto.OrgLevelOneName!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ActualHandleOrgName), x => x.OrderVisit.Order!.ActualHandleOrgName!.Contains(dto.ActualHandleOrgName!))
|
|
|
+ .WhereIF(dto.ActualHandleTime.HasValue && dto.EndActualHandleTime.HasValue, x => x.OrderVisit.Order!.ActualHandleTime >= dto.ActualHandleTime && x.OrderVisit.Order!.ActualHandleTime <= dto.EndActualHandleTime)
|
|
|
+ .WhereIF(dto.FiledTime.HasValue && dto.EndFiledTime.HasValue, x => x.OrderVisit.Order!.FiledTime == dto.FiledTime && x.OrderVisit.Order!.FiledTime <= dto.EndFiledTime)
|
|
|
+ .WhereIF(dto.CreationTime.HasValue && dto.EndCreationTime.HasValue, x => x.OrderVisit.Order!.CreationTime == dto.CreationTime && x.OrderVisit.Order!.CreationTime <= dto.EndCreationTime)
|
|
|
+ .WhereIF(dto.VisitTime.HasValue && dto.EndVisitTime.HasValue, x => x.OrderVisit.VisitTime == dto.VisitTime && x.OrderVisit.VisitTime <= dto.EndVisitTime)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.VisitOrgName), x => x.VisitOrgName!.Contains(dto.VisitOrgName!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgProcessingResults), x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == dto.OrgProcessingResults)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgHandledAttitude), x => SqlFunc.JsonListObjectAny(x.OrgHandledAttitude, "Key", dto.OrgHandledAttitude))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgNoSatisfiedReason), x => SqlFunc.JsonField(x.OrgNoSatisfiedReason, "Key") == dto.OrgNoSatisfiedReason)
|
|
|
+ .Where((x, s) => x.OrderVisit.VisitState != EVisitState.None && x.OrderVisit.IsCanHandle)
|
|
|
+ .Where((x, s) => x.OrderVisit.Order.CounterSignType == null && x.OrderVisit.Order.ActualHandleOrgCode == _sessionContext.OrgId)
|
|
|
+ ;
|
|
|
+ if (_sessionContext.OrgId != null && !_sessionContext.OrgIsCenter)
|
|
|
+ {
|
|
|
+ query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
+ (x, s) => x.OrderVisit.Order.Title.Contains(dto.Keyword!) ||
|
|
|
+ x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
+ .Where((x, s) => x.VisitTarget == EVisitTarget.Org && x.VisitOrgCode.StartsWith(_sessionContext.OrgId) && (
|
|
|
+ SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "1" ||
|
|
|
+ SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2"
|
|
|
+ || SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "1" ||
|
|
|
+ SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2"
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
+ (x, s) => x.OrderVisit.Order.Title.Contains(dto.Keyword!) ||
|
|
|
+ x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
+ .Where((x, s) => x.VisitTarget == EVisitTarget.Org && (
|
|
|
+ SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "1" ||
|
|
|
+ SqlFunc.JsonField(x.OrgProcessingResults, "Key") == "2"
|
|
|
+ || SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "1" ||
|
|
|
+ SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == "2"
|
|
|
+ ));
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理列表查询
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderSecondaryHandling> Query(SecondaryHandlingListDto dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- if (dto.CreationTimeEnd.HasValue)
|
|
|
- dto.CreationTimeEnd = dto.CreationTimeEnd.Value.AddDays(1).AddSeconds(-1);
|
|
|
- return _orderSecondaryHandlingRepository.Queryable()
|
|
|
- .Includes(x => x.Order)
|
|
|
- .Includes(x => x.VisitDetail)
|
|
|
- .Includes(x => x.Visit, d => d.Order)
|
|
|
- .Where(x=>x.State> ESecondaryHandlingState.NotApply)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- x => x.Visit.Order.Title.Contains(dto.Keyword!) || x.Visit.Order.No.Contains(dto.Keyword!))
|
|
|
- .WhereIF(dto.Status is ESecondaryHandlingState.Apply, x => x.State == ESecondaryHandlingState.Apply)
|
|
|
- .WhereIF(dto.Status is ESecondaryHandlingState.Handled, x => x.State != ESecondaryHandlingState.Apply)
|
|
|
- .WhereIF(dto.Status is ESecondaryHandlingState.End, x => x.State == ESecondaryHandlingState.End)
|
|
|
- .WhereIF(dto.Status is ESecondaryHandlingState.Refuse, x => x.State == ESecondaryHandlingState.Refuse)
|
|
|
- .WhereIF(dto.CreationTimeStart.HasValue, x => x.CreationTime >= dto.CreationTimeStart)
|
|
|
- .WhereIF(dto.CreationTimeEnd.HasValue, x => x.CreationTime <= dto.CreationTimeEnd)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrderId), x => x.OrderId == dto.OrderId)
|
|
|
- .OrderByDescending(x => x.CreationTime);
|
|
|
- }
|
|
|
+ return query.OrderByDescending((x, s) => x.CreationTime);
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 获取实体
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task<OrderSecondaryHandling> Entity(string id, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- return await _orderSecondaryHandlingRepository.Queryable()
|
|
|
- .FirstAsync(x => x.Id == id, cancellationToken);
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理列表查询
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderSecondaryHandling> Query(SecondaryHandlingListDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (dto.CreationTimeEnd.HasValue)
|
|
|
+ dto.CreationTimeEnd = dto.CreationTimeEnd.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ return _orderSecondaryHandlingRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.VisitDetail)
|
|
|
+ .Includes(x => x.Visit, d => d.Order)
|
|
|
+ .Where(x => x.State > ESecondaryHandlingState.NotApply)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
+ x => x.Visit.Order.Title.Contains(dto.Keyword!) || x.Visit.Order.No.Contains(dto.Keyword!))
|
|
|
+ .WhereIF(dto.Status is ESecondaryHandlingState.Apply, x => x.State == ESecondaryHandlingState.Apply)
|
|
|
+ .WhereIF(dto.Status is ESecondaryHandlingState.Handled, x => x.State != ESecondaryHandlingState.Apply)
|
|
|
+ .WhereIF(dto.Status is ESecondaryHandlingState.End, x => x.State == ESecondaryHandlingState.End)
|
|
|
+ .WhereIF(dto.Status is ESecondaryHandlingState.Refuse, x => x.State == ESecondaryHandlingState.Refuse)
|
|
|
+ .WhereIF(dto.CreationTimeStart.HasValue, x => x.CreationTime >= dto.CreationTimeStart)
|
|
|
+ .WhereIF(dto.CreationTimeEnd.HasValue, x => x.CreationTime <= dto.CreationTimeEnd)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrderId), x => x.OrderId == dto.OrderId)
|
|
|
+ .OrderByDescending(x => x.CreationTime);
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<SecondaryHandlingVo> SecondaryHandlingReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
- return _orderSecondaryHandlingRepository.Queryable()
|
|
|
- .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
- .Where(x => x.State == ESecondaryHandlingState.End)
|
|
|
- .GroupBy(x => new { x.ApplyOrgId, x.ApplyOrgName })
|
|
|
- .Select(x => new SecondaryHandlingVo
|
|
|
- {
|
|
|
- OrgId = x.ApplyOrgId,
|
|
|
- OrgName = x.ApplyOrgName,
|
|
|
- Num = SqlFunc.AggregateCount(x.Id)
|
|
|
- })
|
|
|
- .OrderByIF(dto.SortRule == 0, x => x.Num, OrderByType.Asc)
|
|
|
- .OrderByIF(dto.SortRule == 1, x => x.Num, OrderByType.Desc);
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取实体
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<OrderSecondaryHandling> Entity(string id, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ return await _orderSecondaryHandlingRepository.Queryable()
|
|
|
+ .FirstAsync(x => x.Id == id, cancellationToken);
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理统计明细
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderSecondaryHandling> SecondaryHandlingDetailReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
- return _orderSecondaryHandlingRepository.Queryable()
|
|
|
- .Includes(x=>x.Order)
|
|
|
- .Includes(x=>x.Visit)
|
|
|
- .Includes(x=>x.VisitDetail)
|
|
|
- .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
- .Where(x=>x.ApplyOrgId == dto.OrgId)
|
|
|
- .Where(x => x.State == ESecondaryHandlingState.End);
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<SecondaryHandlingVo> SecondaryHandlingReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (dto.EndTime.HasValue)
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ return _orderSecondaryHandlingRepository.Queryable()
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
+ .Where(x => x.State == ESecondaryHandlingState.End)
|
|
|
+ .GroupBy(x => new { x.ApplyOrgId, x.ApplyOrgName })
|
|
|
+ .Select(x => new SecondaryHandlingVo
|
|
|
+ {
|
|
|
+ OrgId = x.ApplyOrgId,
|
|
|
+ OrgName = x.ApplyOrgName,
|
|
|
+ Num = SqlFunc.AggregateCount(x.Id)
|
|
|
+ })
|
|
|
+ .OrderByIF(dto.SortRule == 0, x => x.Num, OrderByType.Asc)
|
|
|
+ .OrderByIF(dto.SortRule == 1, x => x.Num, OrderByType.Desc);
|
|
|
+ }
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理统计明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderSecondaryHandling> SecondaryHandlingDetailReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (dto.EndTime.HasValue)
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ return _orderSecondaryHandlingRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Visit)
|
|
|
+ .Includes(x => x.VisitDetail)
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
+ .Where(x => x.ApplyOrgId == dto.OrgId)
|
|
|
+ .Where(x => x.State == ESecondaryHandlingState.End);
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理满意度统计
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<SecondaryHandlingSatisfactionVo> SecondaryHandlingSatisfactionReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
- return _orderSecondaryHandlingRepository.Queryable()
|
|
|
- .Includes(x => x.Order)
|
|
|
- .Includes(x => x.Visit)
|
|
|
- .Includes(x => x.VisitDetail)
|
|
|
- .Includes(x => x.Order, o => o.CallRecord)
|
|
|
- .LeftJoin<SystemOrganize>((x, o) => x.ApplyOrgId == o.Id)
|
|
|
- .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.Order.CallRecord.CDPN.Contains(dto.CDPN))
|
|
|
- .GroupBy((x,o) => new { x.ApplyOrgId, x.ApplyOrgName,o.OrgType })
|
|
|
- .Select((x, o) => new SecondaryHandlingSatisfactionVo()
|
|
|
- {
|
|
|
- OrgId = x.ApplyOrgId,
|
|
|
- OrgName = x.ApplyOrgName,
|
|
|
- OrgType = o.OrgType,
|
|
|
- TotalSumCount = SqlFunc.AggregateCount(x.Id),
|
|
|
- VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
- SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
- RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
- DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
- NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
- NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
- NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 二次办理满意度统计明细
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public ISugarQueryable<OrderSecondaryHandling> SecondaryHandlingSatisfactionDetailReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
- {
|
|
|
- var key = string.Empty;
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
- if (!string.IsNullOrEmpty(dto.Header))
|
|
|
- {
|
|
|
- switch (dto.Header)
|
|
|
- {
|
|
|
- case "verySatisfiedCount":
|
|
|
- key = "5";
|
|
|
- break;
|
|
|
- case "satisfiedCount":
|
|
|
- key = "4";
|
|
|
- break;
|
|
|
- case "regardedAsSatisfiedCount":
|
|
|
- key = "-1";
|
|
|
- break;
|
|
|
- case "defaultSatisfiedCount":
|
|
|
- key = "0";
|
|
|
- break;
|
|
|
- case "noSatisfiedCount":
|
|
|
- key = "2";
|
|
|
- break;
|
|
|
- case "noEvaluateCount":
|
|
|
- key = "7";
|
|
|
- break;
|
|
|
- case "noPutThroughCount":
|
|
|
- key = "6";
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理满意度统计
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<SecondaryHandlingSatisfactionVo> SecondaryHandlingSatisfactionReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (dto.EndTime.HasValue)
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ return _orderSecondaryHandlingRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Visit)
|
|
|
+ .Includes(x => x.VisitDetail)
|
|
|
+ .Includes(x => x.Order, o => o.CallRecord)
|
|
|
+ .LeftJoin<SystemOrganize>((x, o) => x.ApplyOrgId == o.Id)
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.Order.CallRecord.CDPN.Contains(dto.CDPN))
|
|
|
+ .GroupBy((x, o) => new { x.ApplyOrgId, x.ApplyOrgName, o.OrgType })
|
|
|
+ .Select((x, o) => new SecondaryHandlingSatisfactionVo()
|
|
|
+ {
|
|
|
+ OrgId = x.ApplyOrgId,
|
|
|
+ OrgName = x.ApplyOrgName,
|
|
|
+ OrgType = o.OrgType,
|
|
|
+ TotalSumCount = SqlFunc.AggregateCount(x.Id),
|
|
|
+ VerySatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
+ NoEvaluateCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.IIF(dto.TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- return _orderSecondaryHandlingRepository.Queryable()
|
|
|
- .Includes(x => x.Order)
|
|
|
- .Includes(x => x.Visit)
|
|
|
- .Includes(x => x.VisitDetail)
|
|
|
- .Includes(x => x.Order, o => o.CallRecord)
|
|
|
- .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.Order.CallRecord.CDPN.Contains(dto.CDPN))
|
|
|
- .WhereIF(dto.TypeId is 1 && !string.IsNullOrEmpty(key), x=> SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == key)
|
|
|
- .WhereIF(dto.TypeId is 2 && !string.IsNullOrEmpty(key), x => SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == key)
|
|
|
- .Where(x => x.ApplyOrgId == dto.OrgId)
|
|
|
- .Where(x => x.State == ESecondaryHandlingState.End);
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 二次办理满意度统计明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ISugarQueryable<OrderSecondaryHandling> SecondaryHandlingSatisfactionDetailReport(QuerySecondaryHandlingRequest dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var key = string.Empty;
|
|
|
+ if (dto.EndTime.HasValue)
|
|
|
+ dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
+ if (!string.IsNullOrEmpty(dto.Header))
|
|
|
+ {
|
|
|
+ switch (dto.Header)
|
|
|
+ {
|
|
|
+ case "verySatisfiedCount":
|
|
|
+ key = "5";
|
|
|
+ break;
|
|
|
+ case "satisfiedCount":
|
|
|
+ key = "4";
|
|
|
+ break;
|
|
|
+ case "regardedAsSatisfiedCount":
|
|
|
+ key = "-1";
|
|
|
+ break;
|
|
|
+ case "defaultSatisfiedCount":
|
|
|
+ key = "0";
|
|
|
+ break;
|
|
|
+ case "noSatisfiedCount":
|
|
|
+ key = "2";
|
|
|
+ break;
|
|
|
+ case "noEvaluateCount":
|
|
|
+ key = "7";
|
|
|
+ break;
|
|
|
+ case "noPutThroughCount":
|
|
|
+ key = "6";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ return _orderSecondaryHandlingRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Visit)
|
|
|
+ .Includes(x => x.VisitDetail)
|
|
|
+ .Includes(x => x.Order, o => o.CallRecord)
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.CreationTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.ApplyOrgName.Equals(dto.OrgName))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.CDPN), x => x.Order.CallRecord.CDPN.Contains(dto.CDPN))
|
|
|
+ .WhereIF(dto.TypeId is 1 && !string.IsNullOrEmpty(key), x => SqlFunc.JsonField(x.VisitDetail.OrgProcessingResults, "Key") == key)
|
|
|
+ .WhereIF(dto.TypeId is 2 && !string.IsNullOrEmpty(key), x => SqlFunc.JsonField(x.VisitDetail.OrgHandledAttitude, "Key") == key)
|
|
|
+ .Where(x => x.ApplyOrgId == dto.OrgId)
|
|
|
+ .Where(x => x.State == ESecondaryHandlingState.End);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|