|
@@ -54,12 +54,28 @@ using XF.Domain.Entities;
|
|
|
using Hotline.Settings.TimeLimitDomain;
|
|
|
using Hotline.FlowEngine.WorkflowModules;
|
|
|
using Hotline.SeedData;
|
|
|
+using Hotline.Share.Enums.Push;
|
|
|
+using Hotline.Push.Notifies;
|
|
|
+using Hotline.Configurations;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Hotline.Share.Dtos.Push;
|
|
|
+using Mapster;
|
|
|
+using Hotline.Share.Tools;
|
|
|
+using Hotline.EventBus;
|
|
|
+using Hotline.Orders.Notifications;
|
|
|
+using Hotline.OrderTranspond;
|
|
|
|
|
|
namespace Hotline.Application.Orders;
|
|
|
|
|
|
public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
|
|
|
+ private readonly IMediator _mediator;
|
|
|
+ private readonly IRepository<TranspondCityRawData> _transpondCityRawDataRepository;
|
|
|
+ private readonly Publisher _publisher;
|
|
|
+ private readonly ISystemDicDataCacheManager _sysDicDataCacheManager;
|
|
|
+ private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
+ private readonly IRepository<OrderVisitDetail> _orderVisitedDetailRepository;
|
|
|
private readonly IOrderDomainService _orderDomainService;
|
|
|
private readonly IWorkflowDomainService _workflowDomainService;
|
|
|
private readonly IOrderRepository _orderRepository;
|
|
@@ -86,9 +102,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
private readonly IRepository<OrderScreen> _orderScreenRepository;
|
|
|
private readonly IRepository<OrderSendBackAudit> _orderSendBackAuditRepository;
|
|
|
private readonly ICalcExpireTime _expireTime;
|
|
|
+ private readonly IOptions<CityBaseConfiguration> _cityBaseConfiguration;
|
|
|
|
|
|
|
|
|
- public OrderApplication(
|
|
|
+ public OrderApplication(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowDomainService workflowDomainService,
|
|
@@ -114,7 +131,14 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<OrderPublish> orderPublishRepository,
|
|
|
IRepository<OrderScreen> orderScreenRepository,
|
|
|
IRepository<OrderSendBackAudit> orderSendBackAuditRepository,
|
|
|
- ICalcExpireTime expireTime)
|
|
|
+ ICalcExpireTime expireTime,
|
|
|
+ IMediator mediator,
|
|
|
+ IRepository<OrderVisitDetail> orderVisitedDetailRepository,
|
|
|
+ IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
+ IOptions<CityBaseConfiguration> cityBaseConfiguration,
|
|
|
+ ISystemDicDataCacheManager sysDicDataCacheManager,
|
|
|
+ Publisher publisher,
|
|
|
+ IRepository<TranspondCityRawData> transpondCityRawDataRepository)
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_workflowDomainService = workflowDomainService;
|
|
@@ -142,7 +166,14 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderPublishRepository = orderPublishRepository;
|
|
|
_orderSendBackAuditRepository = orderSendBackAuditRepository;
|
|
|
_expireTime = expireTime;
|
|
|
- }
|
|
|
+ _mediator = mediator;
|
|
|
+ _orderVisitedDetailRepository = orderVisitedDetailRepository;
|
|
|
+ _appOptions = appOptions;
|
|
|
+ _sysDicDataCacheManager = sysDicDataCacheManager;
|
|
|
+ _publisher = publisher;
|
|
|
+ _transpondCityRawDataRepository = transpondCityRawDataRepository;
|
|
|
+ _cityBaseConfiguration = cityBaseConfiguration;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新工单办理期满时间(延期调用,其他不调用)
|
|
@@ -233,14 +264,14 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
order.ProcessType is EProcessType.Zhiban)
|
|
|
: 0;
|
|
|
var creationTimeHandleDurationWorkday = order.ActualHandleTime.HasValue
|
|
|
- ?
|
|
|
+ ?
|
|
|
// _timeLimitDomainService.CalcWorkTime(
|
|
|
await _expireTime.CalcWorkTime(
|
|
|
order.CreationTime, now,
|
|
|
order.ProcessType is EProcessType.Zhiban)
|
|
|
: 0;
|
|
|
var centerToOrgHandleDurationWorkday = order.ActualHandleTime.HasValue && order.CenterToOrgTime.HasValue
|
|
|
- ?
|
|
|
+ ?
|
|
|
// _timeLimitDomainService.CalcWorkTime(
|
|
|
await _expireTime.CalcWorkTime(
|
|
|
order.CenterToOrgTime.Value, now,
|
|
@@ -269,6 +300,12 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
return _orderRepository.Queryable(canView: !IsCenter).Includes(d => d.OrderDelays)
|
|
|
+ .Where(d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
+ .Where(step => step.ExternalId == d.Id &&
|
|
|
+ ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
+ (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId))))
|
|
|
+ .Any())
|
|
|
.WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No.Contains(dto.No!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Title), d => d.Title.Contains(dto.Title!))
|
|
@@ -445,6 +482,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
case ESource.ZHYB:
|
|
|
case ESource.ZZPT:
|
|
|
case ESource.WLLZ:
|
|
|
+ case ESource.YBS:
|
|
|
return ReceiveOrderFromOtherPlatformAsync(dto, dto.Files, current, cancellationToken);
|
|
|
case ESource.Hotline:
|
|
|
case ESource.HotlineImport:
|
|
@@ -481,15 +519,15 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
var query = _orderRepository.Queryable()
|
|
|
.Includes(order => order.OrderPublish)
|
|
|
.LeftJoin<User>((order, user) => order.WaitForPublisherId == user.Id)
|
|
|
- .Where((order, user) => order.FiledTime >= dto.StartTime && order.FiledTime <= dto.EndTime && !string.IsNullOrEmpty(order.WaitForPublisherId))
|
|
|
+ .Where((order, user) => order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime && !string.IsNullOrEmpty(order.WaitForPublisherId))
|
|
|
.WhereIF(dto.ProcessType != null, (order, user) => order.ProcessType == dto.ProcessType)
|
|
|
.GroupBy((order, user) => new { order.WaitForPublisherId, user.Name })
|
|
|
.Select((order, user) => new PublishedOrderStatisticsDto
|
|
|
{
|
|
|
Id = order.WaitForPublisherId,
|
|
|
Name = user.Name,
|
|
|
- TotalCount = SqlFunc.AggregateCount(order.Id),
|
|
|
- WaitCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderPublish == null, 1, 0)),
|
|
|
+ //TotalCount = SqlFunc.AggregateCount(order.Id),
|
|
|
+ WaitCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.Status == EOrderStatus.Filed, 1, 0)),
|
|
|
PublicCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderPublish.PublishState == true, 1, 0)),
|
|
|
PrivateCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderPublish.PublishState == false, 1, 0))
|
|
|
});
|
|
@@ -516,19 +554,20 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
public async Task<(int, IList<PublishedOrderStatisticsDto>)> QueryPublishedOrderDepartmentAsync(QueryOrderPublishStatisticsAllDto dto, bool isFull)
|
|
|
{
|
|
|
+
|
|
|
var total = 0;
|
|
|
var items = new List<PublishedOrderStatisticsDto>();
|
|
|
|
|
|
var query = _orderRepository.Queryable()
|
|
|
.Includes(order => order.OrderPublish)
|
|
|
- .Where(order => order.FiledTime >= dto.StartTime && order.FiledTime <= dto.EndTime && order.ActualHandleOrgName != null)
|
|
|
+ .Where(order => order.CreationTime >= dto.StartTime && order.CreationTime <= dto.EndTime && order.ActualHandleOrgName != null)
|
|
|
.GroupBy(order => new { Name = order.ActualHandleOrgName, PublishTime = order.CreationTime.ToString("YYYY-MM-DD") })
|
|
|
.Select(order => new PublishedOrderStatisticsDto
|
|
|
{
|
|
|
Name = order.ActualHandleOrgName,
|
|
|
PublishTime = order.CreationTime.ToString("YYYY-MM-DD"),
|
|
|
- TotalCount = SqlFunc.AggregateCount(order.Id),
|
|
|
- // WaitCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderPublish == null, 1, 0)),
|
|
|
+ // TotalCount = SqlFunc.AggregateCount(order.Id),
|
|
|
+ WaitCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.Status == EOrderStatus.Filed, 1, 0)),
|
|
|
PublicCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderPublish.PublishState == true, 1, 0)),
|
|
|
PrivateCount = SqlFunc.AggregateSum(SqlFunc.IIF(order.OrderPublish.PublishState == false, 1, 0))
|
|
|
});
|
|
@@ -541,7 +580,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
(total, items) = await query.ToPagedListAsync(dto.PageIndex, dto.PageSize);
|
|
|
}
|
|
|
|
|
|
- items.ForEach(m => m.WaitCount = m.TotalCount - m.PublicCount - m.PrivateCount);
|
|
|
return (total, items);
|
|
|
}
|
|
|
|
|
@@ -630,6 +668,248 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 保存工单办理时页面填写的数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Order> SaveOrderWorkflowInfo(NextWorkflowDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var order = await _orderRepository.Queryable()
|
|
|
+ .FirstAsync(d => d.WorkflowId == dto.WorkflowId, cancellationToken)
|
|
|
+ ?? throw UserFriendlyException.SameMessage("无效工单编号");
|
|
|
+ if (await _orderSendBackAuditRepository.AnyAsync(x => x.OrderId == order.Id && x.State == ESendBackAuditState.Apply,
|
|
|
+ cancellationToken))
|
|
|
+ {
|
|
|
+ throw UserFriendlyException.SameMessage("该工单存在正在审核中的退回,不能办理");
|
|
|
+ }
|
|
|
+
|
|
|
+ ExpiredTimeWithConfig? expiredTimeConfig = null;
|
|
|
+ if (dto.NextHandlers.Any(d => d.Key == "001171" || d.Key == "001178"))
|
|
|
+ {
|
|
|
+ var timeResult = await _expireTime.CalcEndTime(DateTime.Now, ETimeType.WorkDay, 45, 80, 50);
|
|
|
+ expiredTimeConfig = new ExpiredTimeWithConfig
|
|
|
+ {
|
|
|
+ Count = 45,
|
|
|
+ TimeType = ETimeType.WorkDay,
|
|
|
+ TimeText = "45个工作日",
|
|
|
+ ExpiredTime = timeResult.EndTime,
|
|
|
+ NearlyExpiredTime = timeResult.NearlyExpiredTime,
|
|
|
+ NearlyExpiredTimeOne = timeResult.NearlyExpiredTimeOne
|
|
|
+ };
|
|
|
+ var canUpdateOrderSender = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.CanUpdateOrderSender).SettingValue[0]);
|
|
|
+ order.CenterToOrg(
|
|
|
+ expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
+ expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
|
|
|
+ expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne, dto.Opinion,
|
|
|
+ _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
+ canUpdateOrderSender);
|
|
|
+ //TODO发送短信即将超期
|
|
|
+ //_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
|
+ }
|
|
|
+ else if (dto.FlowDirection is EFlowDirection.CenterToOrg)
|
|
|
+ {
|
|
|
+ expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ var canUpdateOrderSender = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.CanUpdateOrderSender).SettingValue[0]);
|
|
|
+ order.CenterToOrg(
|
|
|
+ expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
+ expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
|
|
|
+ expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne, dto.Opinion,
|
|
|
+ _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
+ canUpdateOrderSender);
|
|
|
+ //TODO发送短信即将超期
|
|
|
+ //_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (dto.FlowDirection is EFlowDirection.CenterToCenter)
|
|
|
+ {
|
|
|
+ if (_appOptions.Value.IsZiGong == false)
|
|
|
+ {
|
|
|
+ expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ order.CenterToCenter(expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
+ expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime, expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne);
|
|
|
+ //TODO发送短信即将超期
|
|
|
+ //_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (expiredTimeConfig is not null)
|
|
|
+ _mapper.Map(expiredTimeConfig, order);
|
|
|
+
|
|
|
+ if (dto.LeaderSMSKey != null)
|
|
|
+ {
|
|
|
+ var dic = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.LeaderSMS).First(m => m.Id == dto.LeaderSMSKey);
|
|
|
+ _capPublisher.Publish(EventNames.HotlineLeaderSMS, new PublishLeaderSMSDto(order.Id, dic.DicDataName, dic.DicDataValue));
|
|
|
+ }
|
|
|
+
|
|
|
+ _mapper.Map(dto, order);
|
|
|
+ await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
+
|
|
|
+ if (_appOptions.Value.IsZiGong && dto.Transpond.HasValue && dto.Transpond.Value == true)
|
|
|
+ {
|
|
|
+ var count = await _transpondCityRawDataRepository.Queryable()
|
|
|
+ .Where(m => m.OrderCode == order.No && m.CityName == order.TranspondCityName
|
|
|
+ && m.Direction == ETranspondDirection.Out)
|
|
|
+ .CountAsync();
|
|
|
+ //处理市州互转
|
|
|
+ if (count == 0)
|
|
|
+ await _publisher.PublishAsync(new OrderStartWorkflowNotify(order.Id), PublishStrategy.ParallelWhenAll, cancellationToken);
|
|
|
+ }
|
|
|
+ return order;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 回访保存
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task SaveOrderVisit(VisitDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var visit = await _orderVisitRepository.Queryable()
|
|
|
+ .Includes(d => d.Order)
|
|
|
+ .Includes(d => d.OrderVisitDetails)
|
|
|
+ .FirstAsync(d => d.Id == dto.Id, cancellationToken);
|
|
|
+ if (visit is null)
|
|
|
+ throw UserFriendlyException.SameMessage("未知回访信息");
|
|
|
+
|
|
|
+ if (_appOptions.Value.IsYiBin && visit.VisitState == EVisitState.Visited)
|
|
|
+ throw UserFriendlyException.SameMessage("已回访,不能重复回访");
|
|
|
+
|
|
|
+ var first = dto.VisitDetails.FirstOrDefault(x => x.VisitTarget == EVisitTarget.Org);
|
|
|
+
|
|
|
+ visit.IsPutThrough = dto.IsPutThrough;
|
|
|
+ visit.AgainState = dto.IsAgain ? EAgainState.NeedAgain : EAgainState.NoAgain;
|
|
|
+ visit.EmployeeId = _sessionContext.UserId;
|
|
|
+ visit.CallId = dto.CallId;
|
|
|
+ if (first != null)
|
|
|
+ {
|
|
|
+ visit.NowEvaluate = first.OrgProcessingResults;
|
|
|
+ }
|
|
|
+
|
|
|
+ visit.VisitState = Share.Enums.Order.EVisitState.Visited;
|
|
|
+ visit.VisitTime = DateTime.Now;
|
|
|
+ if (!string.IsNullOrEmpty(visit.CallId))
|
|
|
+ {
|
|
|
+ visit.VisitType = EVisitType.CallVisit;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (visit.VisitType is null)
|
|
|
+ {
|
|
|
+ visit.VisitType = EVisitType.ArtificialVisit;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (first != null)
|
|
|
+ {
|
|
|
+ visit.Order.Visited(first.OrgProcessingResults.Key, first.OrgProcessingResults.Value);
|
|
|
+ }
|
|
|
+
|
|
|
+ visit.OrgJudge = dto.OrgJudge;
|
|
|
+ visit.SeatJudge = dto.SeatJudge;
|
|
|
+
|
|
|
+ if (visit.OrgJudge == true || visit.SeatJudge == true)
|
|
|
+ {
|
|
|
+ visit.JudgeState = EJudgeState.Judging;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0;i < visit.OrderVisitDetails.Count;i++)
|
|
|
+ {
|
|
|
+ var detail = visit.OrderVisitDetails[i];
|
|
|
+ var detaildto = dto.VisitDetails.FirstOrDefault(x => x.Id == detail.Id);
|
|
|
+ if (detaildto != null)
|
|
|
+ {
|
|
|
+ if (visit.Order.SourceChannelCode != "RGDH" && detaildto.VisitTarget == EVisitTarget.Seat)
|
|
|
+ {
|
|
|
+ detaildto.SeatEvaluate = ESeatEvaluate.DefaultSatisfied;
|
|
|
+ }
|
|
|
+
|
|
|
+ _mapper.Map(detaildto, visit.OrderVisitDetails[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
+ await _orderVisitedDetailRepository.UpdateRangeAsync(visit.OrderVisitDetails, cancellationToken);
|
|
|
+ await _orderRepository.UpdateAsync(visit.Order, cancellationToken);
|
|
|
+ var orderDto = _mapper.Map<OrderDto>(visit.Order);
|
|
|
+ if (first != null)
|
|
|
+ {
|
|
|
+ //推省上
|
|
|
+ await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderVisited,
|
|
|
+ new PublishVisitDto()
|
|
|
+ {
|
|
|
+ Order = orderDto,
|
|
|
+ No = visit.No,
|
|
|
+ VisitType = visit.VisitType,
|
|
|
+ VisitName = visit.CreatorName,
|
|
|
+ VisitTime = visit.VisitTime,
|
|
|
+ VisitRemark = string.IsNullOrEmpty(first.VisitContent) ? first.OrgProcessingResults?.Value : first.VisitContent,
|
|
|
+ AreaCode = visit.Order.AreaCode!,
|
|
|
+ SubjectResultSatifyCode = first.OrgProcessingResults.Key,
|
|
|
+ FirstSatisfactionCode = visit.Order.FirstVisitResultCode!,
|
|
|
+ ClientGuid = ""
|
|
|
+ }, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
+ //推门户
|
|
|
+ await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderVisitedWeb, new PublishVisitAllDto()
|
|
|
+ {
|
|
|
+ Id = visit.Id,
|
|
|
+ Order = orderDto,
|
|
|
+ OrderVisitDetails = _mapper.Map<List<VisitDetailDto>>(visit.OrderVisitDetails),
|
|
|
+ VisitName = _sessionContext.UserName,
|
|
|
+ VisitTime = visit.VisitTime,
|
|
|
+ VisitType = visit.VisitType,
|
|
|
+ VisitState = visit.VisitState,
|
|
|
+ PublishTime = visit.PublishTime,
|
|
|
+ }, cancellationToken: cancellationToken);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (first != null)
|
|
|
+ {
|
|
|
+ //写入质检
|
|
|
+ await _qualityApplication.AddQualityAsync(EQualitySource.Visit, visit.Order.Id, visit.Id,
|
|
|
+ cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 发送回访短信
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="NotImplementedException"></exception>
|
|
|
+ public async Task VisitPushSMSAsync(VisitSmsInDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var orderVisitList = await _orderVisitRepository.Queryable()
|
|
|
+ .Includes(d => d.Order)
|
|
|
+ .Where(d => dto.Ids.Contains(d.Id) && d.VisitState == EVisitState.WaitForVisit)
|
|
|
+ .Select(d => new { d.Id, d.Order.SourceChannelCode, d.Order.Contact, d.Order.Password, d.No, d.OrderId, d.Order.Title, d.Order.FromName })
|
|
|
+ .ToListAsync(cancellationToken);
|
|
|
+
|
|
|
+ foreach (var item in orderVisitList)
|
|
|
+ {
|
|
|
+ var code = "1013";
|
|
|
+ if (item.SourceChannelCode == "ZGSSP") code = "1012";
|
|
|
+ var messageDto = new Share.Dtos.Push.MessageDto
|
|
|
+ {
|
|
|
+ PushBusiness = EPushBusiness.VisitSms,
|
|
|
+ ExternalId = item.Id,
|
|
|
+ OrderId = item.OrderId,
|
|
|
+ PushPlatform = EPushPlatform.Sms,
|
|
|
+ Remark = item.Title,
|
|
|
+ Name = item.FromName,
|
|
|
+ TemplateCode = code,
|
|
|
+ Params = new List<string>() { item.No, item.Password },
|
|
|
+ TelNumber = item.Contact,
|
|
|
+ };
|
|
|
+ await _mediator.Publish(new PushMessageNotify(messageDto), cancellationToken);
|
|
|
+ await _orderVisitRepository.Updateable()
|
|
|
+ .Where(m => m.Id == item.Id)
|
|
|
+ .SetColumns(m => m.VisitState == EVisitState.SMSVisiting)
|
|
|
+ .SetColumns(m => m.VisitType == EVisitType.SmsVisit)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public ISugarQueryable<Order> QueryOrders(QueryOrderDto dto)
|
|
|
{
|
|
|
var isCenter = _sessionContext.OrgIsCenter;
|
|
@@ -648,31 +928,34 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
return query
|
|
|
.Includes(x => x.OrderScreens)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.StartsWith(dto.Keyword!)) //标题
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!)) //标题
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), d => d.ProvinceNo == dto.ProvinceNo) //省本地编号
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No == dto.No) //工单编码
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AcceptType), d => d.AcceptTypeCode == dto.AcceptType)//受理类型
|
|
|
- //.WhereIF(dto.AcceptTypes.Any(), d => dto.AcceptTypes.Contains(d.AcceptTypeCode)) //受理类型
|
|
|
+ //.WhereIF(dto.AcceptTypes.Any(), d => dto.AcceptTypes.Contains(d.AcceptTypeCode)) //受理类型
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Channel), d => d.SourceChannelCode == dto.Channel)
|
|
|
//.WhereIF(dto.Channels.Any(), d => dto.Channels.Contains(d.SourceChannelCode)) //来源渠道
|
|
|
//.WhereIF(dto.HotspotIds.Any(), d => dto.HotspotIds.Contains(d.HotspotId)) //热点类型
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Hotspot), d => d.HotspotSpliceName != null && d.HotspotSpliceName.Contains(dto.Hotspot))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.TransferPhone), d => d.TransferPhone == dto.TransferPhone!) //转接号码
|
|
|
- //.WhereIF(dto.OrgCodes.Any(), d => d.Workflow.Assigns.Any(s => dto.OrgCodes.Contains(s.OrgCode)))
|
|
|
- //.WhereIF(dto.OrgCodes.Any(), d => dto.OrgCodes.Contains(d.ActualHandleOrgCode)) //接办部门
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgId), d => d.CurrentHandleOrgId == dto.OrgId)//接办部门
|
|
|
+ //.WhereIF(dto.OrgCodes.Any(), d => d.Workflow.Assigns.Any(s => dto.OrgCodes.Contains(s.OrgCode)))
|
|
|
+ //.WhereIF(dto.OrgCodes.Any(), d => dto.OrgCodes.Contains(d.ActualHandleOrgCode)) //接办部门
|
|
|
+ //.WhereIF(!string.IsNullOrEmpty(dto.OrgId), d => d.CurrentHandleOrgId == dto.OrgId)//接办部门
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgLevelOneName),d=>d.OrgLevelOneName.Contains(dto.OrgLevelOneName)) //一级部门
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.ActualHandleOrgName),d=>d.ActualHandleOrgName.Contains(dto.ActualHandleOrgName)) //接办部门(综合查询模糊)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.NameOrNo), d => d.AcceptorName == dto.NameOrNo! || d.AcceptorStaffNo == dto.NameOrNo!) //受理人/坐席
|
|
|
.WhereIF(dto.CreationTimeStart.HasValue, d => d.CreationTime >= dto.CreationTimeStart) //受理时间开始
|
|
|
.WhereIF(dto.CreationTimeEnd.HasValue, d => d.CreationTime <= dto.CreationTimeEnd) //受理时间结束
|
|
|
- //.WhereIF(dto.EmergencyLevels.Any(), d => dto.EmergencyLevels.Contains(d.EmergencyLevel)) //紧急程度
|
|
|
+ //.WhereIF(dto.EmergencyLevels.Any(), d => dto.EmergencyLevels.Contains(d.EmergencyLevel)) //紧急程度
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.FromPhone), d => d.FromPhone == dto.FromPhone) //来电号码
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.PhoneNo), d => d.Contact == dto.PhoneNo!) //联系电话
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), d => d.PushTypeCode == dto.PushTypeCode) //推送分类
|
|
|
+ //.WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), d => d.PushTypeCode == dto.PushTypeCode) //推送分类
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), x => x.OrderPushTypes.Any(opt => opt.PushTypeCode == dto.PushTypeCode))//推送分类
|
|
|
.WhereIF(dto.ExpiredTimeStart.HasValue, d => d.ExpiredTime >= dto.ExpiredTimeStart) //超期时间开始
|
|
|
.WhereIF(dto.ExpiredTimeEnd.HasValue, d => d.ExpiredTime <= dto.ExpiredTimeEnd) //超期时间结束
|
|
|
- //.WhereIF(dto.Statuses.Any(), d => dto.Statuses.Contains(d.Status)) //工单状态
|
|
|
+ //.WhereIF(dto.Statuses.Any(), d => dto.Statuses.Contains(d.Status)) //工单状态
|
|
|
.WhereIF(dto.Status.HasValue, d => d.Status == dto.Status)//工单状态
|
|
|
- //.WhereIF(dto.Statuses.Any(d => d == EOrderStatus.SpecialToUnAccept), d => d.Status <= EOrderStatus.SpecialToUnAccept)
|
|
|
+ //.WhereIF(dto.Statuses.Any(d => d == EOrderStatus.SpecialToUnAccept), d => d.Status <= EOrderStatus.SpecialToUnAccept)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.ActualHandlerName), d => d.ActualHandlerName == dto.ActualHandlerName) //接办人
|
|
|
.WhereIF(dto.IsScreen == true, d => d.OrderScreens.Any(x => x.Status != EScreenStatus.Refuse)) //有甄别
|
|
|
.WhereIF(dto.IsScreen == false, d => !d.OrderScreens.Any(x => x.Status != EScreenStatus.Refuse)) //无甄别
|
|
@@ -683,8 +966,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.IsOverTime == false, d => (d.ExpiredTime > DateTime.Now && d.Status < EOrderStatus.Filed) || (d.ExpiredTime > d.ActualHandleTime && d.Status >= EOrderStatus.Filed)) //否 超期
|
|
|
.WhereIF(dto.IdentityType != null, d => d.IdentityType == dto.IdentityType) //来电主体
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.FromName), d => d.FromName == dto.FromName) //来电人姓名
|
|
|
- //.WhereIF(dto.AreaCodes.Any(), d => dto.AreaCodes.Contains(d.AreaCode)) //区域
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.AreaCode), d => d.AreaCode == dto.AreaCode)//区域
|
|
|
+ //.WhereIF(dto.AreaCodes.Any(), d => dto.AreaCodes.Contains(d.AreaCode)) //区域
|
|
|
+ //.WhereIF(!string.IsNullOrEmpty(dto.AreaCode), d => d.AreaCode == dto.AreaCode)//区域
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.AreaCode) && dto.AreaCode.LastIndexOf("00")>0,d=>d.AreaCode.StartsWith(SqlFunc.Substring(dto.AreaCode,0,4)))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.AreaCode) && dto.AreaCode.LastIndexOf("00")<=0,d=>d.AreaCode.StartsWith(dto.AreaCode))
|
|
|
.WhereIF(dto.IsProvinceOrder.HasValue && dto.IsProvinceOrder == true, d => d.Source == ESource.ProvinceStraight)
|
|
|
.WhereIF(dto.IsProvinceOrder.HasValue && dto.IsProvinceOrder == false, d => d.Source != ESource.ProvinceStraight)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.SensitiveWord), d => SqlFunc.JsonArrayAny(d.Sensitive, dto.SensitiveWord))
|
|
@@ -706,8 +991,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order, WorkflowStep> QueryUnsignedOrders(QueryUnsignedOrdersRequest dto)
|
|
|
{
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
return _orderRepository.Queryable()
|
|
|
.LeftJoin<WorkflowStep>((x, ws) => x.Id == ws.ExternalId)
|
|
@@ -729,13 +1012,11 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> QueryOrderSource(QueryOrderSourceRequest dto)
|
|
|
{
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
return _orderRepository.Queryable()
|
|
|
.WhereIF(dto.StartTime.HasValue, d => d.CreationTime >= dto.StartTime)
|
|
|
.WhereIF(dto.EndTime.HasValue, d => d.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(dto.TypeId != null && dto.TypeId == 1, x => x.IdentityType == EIdentityType.Citizen)
|
|
|
- .WhereIF(dto.TypeId != null && dto.TypeId == 2, x => x.IdentityType == EIdentityType.Enterprise)
|
|
|
+ .WhereIF(dto.TypeId != null && dto.TypeId == 1, x => x.IdentityType == EIdentityType.Citizen)
|
|
|
+ .WhereIF(dto.TypeId != null && dto.TypeId == 2, x => x.IdentityType == EIdentityType.Enterprise)
|
|
|
.Where(d => d.SourceChannel != null && d.SourceChannel != "");
|
|
|
}
|
|
|
|
|
@@ -841,8 +1122,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> QueryOrgDataListDetail(OrgDataListDetailRequest dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
-
|
|
|
var quer = _orderRepository.Queryable()
|
|
|
.InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
|
.Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
@@ -882,7 +1161,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> QueryOrgDataListDetail(OrgDataListAllDetailRequest dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var quer = _orderRepository.Queryable()
|
|
@@ -921,11 +1199,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderReTransactVo> OrderReTransact(QueryOrderReTransactRequest dto)
|
|
|
{
|
|
|
-
|
|
|
return _orderSpecialDetailRepository.Queryable()
|
|
|
.Includes(x => x.OrderSpecial)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
- .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
+ .Where(x => x.OrderSpecial.SpecialType == ESpecialType.ReTransact)
|
|
|
.Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
.Where(x => x.OrderSpecial.CreationTime <= dto.EndTime)
|
|
|
.GroupBy(x => new { Time = x.OrderSpecial.CreationTime.ToString("yyyy-MM-dd"), x.OrgId, x.OrgName })
|
|
@@ -948,13 +1225,12 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
if (!dto.StartTime.HasValue || !dto.EndTime.HasValue)
|
|
|
throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
return _orderSpecialDetailRepository.Queryable()
|
|
|
.Includes(x => x.OrderSpecial, s => s.Order)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrgName), x => x.OrgName.Contains(dto.OrgName!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.ErrorName), x => x.ErrorName.Contains(dto.ErrorName!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderSpecial!.Order!.No!.Contains(dto.No!))
|
|
|
- .Where(x => x.OrderSpecial.ESpecialType == ESpecialType.ReTransact)
|
|
|
+ .Where(x => x.OrderSpecial.SpecialType == ESpecialType.ReTransact)
|
|
|
.Where(x => x.OrderSpecial.CreationTime >= dto.StartTime)
|
|
|
.Where(x => x.OrderSpecial.CreationTime <= dto.EndTime);
|
|
|
}
|
|
@@ -964,8 +1240,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgSatisfactionStatistics(PagedKeywordSonRequest dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
-
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var list = _orderVisitDetailRepository.Queryable()
|
|
@@ -1059,8 +1333,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgStatisfactionOrgDetail(PagedKeywordSonRequest dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
-
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var list = await _systemOrganizeRepository.Queryable().Where(x => x.Id.StartsWith(dto.OrgCode))
|
|
@@ -1108,7 +1380,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 热点区域统计
|
|
@@ -1117,7 +1389,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<(List<SystemArea> area, object items)> HotspotAndAreaStatistics(HotspotAndAreaStatisticsReq dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
var areaList = _systemAreaRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == 6 && x.Id != "510000").OrderBy(x => x.Id).MergeTable();
|
|
|
|
|
|
var endIndex = (2 * dto.HotspotLevel).ToString();
|
|
@@ -1186,7 +1457,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<DataTable> HotspotAndAreaStatisticsExport(HotspotAndAreaStatisticsReq dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
var areaList = _systemAreaRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == 6 && x.Id != "510000").OrderBy(x => x.Id).MergeTable();
|
|
|
|
|
|
var endIndex = (2 * dto.HotspotLevel).ToString();
|
|
@@ -1407,8 +1677,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<VisitAndHotspotSatisfactionStatisticsDto>> VisitAndHotspotSatisfactionStatistics(VisitAndHotspotPagedKeywordRequest dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
-
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var list = _orderVisitDetailRepository.Queryable()
|
|
@@ -1476,7 +1744,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderVisitDetail> VisitAndHotspotSatisfactionDetail(VisitAndHotspotPagedKeywordRequest dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
var key = string.Empty;
|
|
|
if (!string.IsNullOrEmpty(dto.TitleCode))
|
|
@@ -1524,8 +1791,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
if (!dto.StartTime.HasValue || !dto.EndTime.HasValue) throw UserFriendlyException.SameMessage("请选择时间!");
|
|
|
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
-
|
|
|
var query = _orderRepository.Queryable(false, false, false)
|
|
|
.WhereIF(dto.StartTime.HasValue, it => it.CreationTime >= dto.StartTime)
|
|
|
.WhereIF(dto.EndTime.HasValue, it => it.CreationTime <= dto.EndTime)
|
|
@@ -1582,7 +1847,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<(List<SystemDicData> acceptTypes, object items)> HotspotAndAcceptTypeStatistics(HotspotAndAcceptTypeStatisticsReq dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
var dicList = _systemDicDataRepository.Queryable().Where(x => x.DicTypeCode == "AcceptType").OrderBy(x => x.Sort).MergeTable();
|
|
|
var endIndex = (2 * dto.HotspotLevel).ToString();
|
|
|
var hotspotList = _hotspotRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == int.Parse(endIndex))
|
|
@@ -1644,7 +1908,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<DataTable> HotspotAndAcceptTypeStatisticsExport(HotspotAndAcceptTypeStatisticsReq dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
var dicList = _systemDicDataRepository.Queryable().Where(x => x.DicTypeCode == "AcceptType").OrderBy(x => x.Sort).MergeTable();
|
|
|
var endIndex = (2 * dto.HotspotLevel).ToString();
|
|
|
var hotspotList = _hotspotRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == int.Parse(endIndex))
|
|
@@ -1706,7 +1969,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> HotspotAndAcceptTypeStatisticsDetail(HotspotAndAcceptTypeStatisticsDetailReq dto)
|
|
|
{
|
|
|
- dto.EndTime = dto.EndTime.AddDays(1).AddSeconds(-1);
|
|
|
var query = _orderRepository.Queryable()
|
|
|
.Where(x => x.HotspotId.StartsWith(dto.HotspotId) && x.CreationTime >= dto.StartTime && x.CreationTime < dto.EndTime)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AcceptTypeCode), x => x.AcceptTypeCode.StartsWith(dto.AcceptTypeCode))
|
|
@@ -1720,8 +1982,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderScreenApplyVo> OrderScreenApply(OrderScreenApplyPagedRequest dto)
|
|
|
{
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
var query = _orderScreenRepository.Queryable()
|
|
|
.WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, x => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.ApplyUserName), x => x.CreatorName == dto.ApplyUserName)
|
|
@@ -1743,22 +2003,20 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderScreenAuditVo> OrderScreenAudit(OrderScreenAuditPagedRequest dto)
|
|
|
{
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
- var query = _workflowTraceRepository.Queryable()
|
|
|
- .WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, x => x.HandleTime >= dto.StartTime && x.HandleTime <= dto.EndTime)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.AuditUserName), x => x.HandlerName == dto.AuditUserName)
|
|
|
- .Where(x=> x.HandlerName != null && x.HandlerName != "" )
|
|
|
- .WhereIF(dto.AuditType is 1,x=>x.Name == "班长审批")
|
|
|
- .WhereIF(dto.AuditType is 2, x => x.Name == "中心领导")
|
|
|
- .GroupBy(x => new { x.HandlerName })
|
|
|
- .Select(x => new OrderScreenAuditVo
|
|
|
- {
|
|
|
- AuditName = x.HandlerName,
|
|
|
- AuditNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceType == EWorkflowTraceType.Normal, 1, 0)),
|
|
|
- AuditBackNum = SqlFunc.AggregateSum(SqlFunc.IIF( x.TraceType == EWorkflowTraceType.Previous , 1, 0)),
|
|
|
- });
|
|
|
- return query;
|
|
|
+ var query = _workflowTraceRepository.Queryable()
|
|
|
+ .WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, x => x.HandleTime >= dto.StartTime && x.HandleTime <= dto.EndTime)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.AuditUserName), x => x.HandlerName == dto.AuditUserName)
|
|
|
+ .Where(x => x.HandlerName != null && x.HandlerName != "")
|
|
|
+ .WhereIF(dto.AuditType is 1, x => x.Name == "班长审批")
|
|
|
+ .WhereIF(dto.AuditType is 2, x => x.Name == "中心领导")
|
|
|
+ .GroupBy(x => new { x.HandlerName })
|
|
|
+ .Select(x => new OrderScreenAuditVo
|
|
|
+ {
|
|
|
+ AuditName = x.HandlerName,
|
|
|
+ AuditNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceType == EWorkflowTraceType.Normal, 1, 0)),
|
|
|
+ AuditBackNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.TraceType == EWorkflowTraceType.Previous, 1, 0)),
|
|
|
+ });
|
|
|
+ return query;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1768,8 +2026,6 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderCenterAcceptVo> OrderCenterAccept(OrderCenterAcceptPagedRequest dto)
|
|
|
{
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
var sendBack = _orderSendBackAuditRepository.Queryable()
|
|
|
.Where(x => x.State == ESendBackAuditState.End)
|
|
|
.GroupBy(x => x.OrderId).Select(x => new { OrderId = x.OrderId });
|
|
@@ -1789,7 +2045,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
InvalidNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.AcceptType == "无效", 1, 0)),
|
|
|
HandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status >= EOrderStatus.Filed, 1, 0)),
|
|
|
NoHandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EOrderStatus.Filed, 1, 0)),
|
|
|
- BackNum = SqlFunc.AggregateSum(SqlFunc.IIF(s.OrderId != null && s.OrderId != "", 1, 0)),
|
|
|
+ BackNum = SqlFunc.AggregateSum(SqlFunc.IIF(s.OrderId != null && s.OrderId != "", 1, 0)),
|
|
|
DutyDeskNum = SqlFunc.AggregateDistinctCount(d.AcceptorId)
|
|
|
});
|
|
|
return query;
|
|
@@ -1801,30 +2057,28 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderCenterAcceptUserVo> OrderCenterAcceptUser(OrderCenterAcceptPagedRequest dto)
|
|
|
{
|
|
|
- if (dto.EndTime.HasValue)
|
|
|
- dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
var sendBack = _orderSendBackAuditRepository.Queryable()
|
|
|
.Where(x => x.State == ESendBackAuditState.End)
|
|
|
.GroupBy(x => x.OrderId).Select(x => new { OrderId = x.OrderId });
|
|
|
|
|
|
- var query = _orderRepository.Queryable()
|
|
|
- .LeftJoin(sendBack, (d, s) => d.Id == s.OrderId)
|
|
|
- .WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, d => d.CreationTime >= dto.StartTime && d.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(dto.TypeCode != null && dto.TypeCode == 1, d => d.IdentityType == EIdentityType.Citizen)
|
|
|
- .WhereIF(dto.TypeCode != null && dto.TypeCode == 2, d => d.IdentityType == EIdentityType.Enterprise)
|
|
|
- .GroupBy(d => d.AcceptorName)
|
|
|
- .Select((d, s) => new OrderCenterAcceptUserVo
|
|
|
- {
|
|
|
- AcceptUserName = d.AcceptorName,
|
|
|
- AcceptNum = SqlFunc.AggregateCount(1),
|
|
|
- ValidNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.AcceptType != "无效", 1, 0)),
|
|
|
- RepetitionNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.DuplicateIds == null || SqlFunc.JsonArrayLength(d.DuplicateIds) > 0, 1, 0)),
|
|
|
- InvalidNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.AcceptType == "无效", 1, 0)),
|
|
|
- HandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status >= EOrderStatus.Filed, 1, 0)),
|
|
|
- NoHandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EOrderStatus.Filed, 1, 0)),
|
|
|
- BackNum = SqlFunc.AggregateSum(SqlFunc.IIF(s.OrderId != null && s.OrderId != "", 1, 0))
|
|
|
- });
|
|
|
- return query;
|
|
|
+ var query = _orderRepository.Queryable()
|
|
|
+ .LeftJoin(sendBack, (d, s) => d.Id == s.OrderId)
|
|
|
+ .WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, d => d.CreationTime >= dto.StartTime && d.CreationTime <= dto.EndTime)
|
|
|
+ .WhereIF(dto.TypeCode != null && dto.TypeCode == 1, d => d.IdentityType == EIdentityType.Citizen)
|
|
|
+ .WhereIF(dto.TypeCode != null && dto.TypeCode == 2, d => d.IdentityType == EIdentityType.Enterprise)
|
|
|
+ .GroupBy(d => d.AcceptorName)
|
|
|
+ .Select((d, s) => new OrderCenterAcceptUserVo
|
|
|
+ {
|
|
|
+ AcceptUserName = d.AcceptorName,
|
|
|
+ AcceptNum = SqlFunc.AggregateCount(1),
|
|
|
+ ValidNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.AcceptType != "无效", 1, 0)),
|
|
|
+ RepetitionNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.DuplicateIds == null || SqlFunc.JsonArrayLength(d.DuplicateIds) > 0, 1, 0)),
|
|
|
+ InvalidNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.AcceptType == "无效", 1, 0)),
|
|
|
+ HandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status >= EOrderStatus.Filed, 1, 0)),
|
|
|
+ NoHandleNum = SqlFunc.AggregateSum(SqlFunc.IIF(d.Status < EOrderStatus.Filed, 1, 0)),
|
|
|
+ BackNum = SqlFunc.AggregateSum(SqlFunc.IIF(s.OrderId != null && s.OrderId != "", 1, 0))
|
|
|
+ });
|
|
|
+ return query;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1916,7 +2170,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
//特提(撤回至发起)
|
|
|
if (!string.IsNullOrEmpty(order.WorkflowId))
|
|
|
{
|
|
|
- current = SessionContextCreator.CreateSessionContext("province");
|
|
|
+ current = SessionContextCreator.CreateSessionContext("province",_cityBaseConfiguration.Value);
|
|
|
await _workflowDomainService.RecallToStartStepAsync(order.WorkflowId, "省工单重派", current, cancellationToken);
|
|
|
}
|
|
|
}
|
|
@@ -1948,32 +2202,32 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
NoSendOrderNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.HandlerId == null || x.HandlerId == "", 1, 0)),
|
|
|
}).ToListAsync();
|
|
|
|
|
|
- var items2 = await _workflowTraceRepository.Queryable()
|
|
|
- .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
|
|
|
- //.LeftJoin<WorkflowStepHandler>((x, w, wfsh) => x.StepId == wfsh.WorkflowStepId && wfsh.IsActualHandler == true)
|
|
|
- .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)
|
|
|
- .Where((x, w, su) => w.ModuleCode == WorkflowModuleConsts.OrderHandle && x.BusinessType == EBusinessType.Send && x.Status == EWorkflowStepStatus.Handled
|
|
|
- && !string.IsNullOrEmpty(x.NextMainHandler) && x.NextMainHandler != OrgSeedData.CenterId)
|
|
|
- .Where((x, w, su) => x.CreationTime >= dto.StartTime.Value)
|
|
|
- .Where((x, w, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
- .GroupBy((x, w, su) => x.WorkflowId)
|
|
|
- .Having((x, w, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
- .Select((x, w, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(x.CreationTime) })
|
|
|
- .MergeTable()
|
|
|
- .LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
|
|
|
- .LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
|
|
|
- //.LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId && wsh.CreationTime == a.CreationTime)
|
|
|
- .InnerJoin<SchedulingUser>((a, wt, wf, su) => wt.HandlerId == su.UserId)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.UserName), ((a, wt, wf, su) => su.UserName == dto.UserName))
|
|
|
- .GroupBy((a, wt, wf, su) => new { su.UserId, su.UserName })
|
|
|
- .Select((a, wt, wf, su) => new BiOrderSendVo
|
|
|
- {
|
|
|
- UserId = su.UserId,
|
|
|
- UserName = su.UserName,
|
|
|
- SendOrderNum = 0,
|
|
|
- NoSendOrderNum = 0,
|
|
|
- ReSendOrderNum = SqlFunc.AggregateDistinctCount(wf.ExternalId),
|
|
|
- }).ToListAsync();
|
|
|
+ var items2 = await _workflowTraceRepository.Queryable()
|
|
|
+ .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
|
|
|
+ //.LeftJoin<WorkflowStepHandler>((x, w, wfsh) => x.StepId == wfsh.WorkflowStepId && wfsh.IsActualHandler == true)
|
|
|
+ .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)
|
|
|
+ .Where((x, w, su) => w.ModuleCode == WorkflowModuleConsts.OrderHandle && x.BusinessType == EBusinessType.Send && x.Status == EWorkflowStepStatus.Handled
|
|
|
+ && !string.IsNullOrEmpty(x.NextMainHandler) && x.NextMainHandler != OrgSeedData.CenterId)
|
|
|
+ .Where((x, w, su) => x.CreationTime >= dto.StartTime.Value)
|
|
|
+ .Where((x, w, su) => x.CreationTime <= dto.EndTime.Value)
|
|
|
+ .GroupBy((x, w, su) => x.WorkflowId)
|
|
|
+ .Having((x, w, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
|
|
|
+ .Select((x, w, su) => new { Id = x.WorkflowId, CreationTime = SqlFunc.AggregateMin(x.CreationTime) })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
|
|
|
+ .LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
|
|
|
+ //.LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId && wsh.CreationTime == a.CreationTime)
|
|
|
+ .InnerJoin<SchedulingUser>((a, wt, wf, su) => wt.HandlerId == su.UserId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.UserName), ((a, wt, wf, su) => su.UserName == dto.UserName))
|
|
|
+ .GroupBy((a, wt, wf, su) => new { su.UserId, su.UserName })
|
|
|
+ .Select((a, wt, wf, su) => new BiOrderSendVo
|
|
|
+ {
|
|
|
+ UserId = su.UserId,
|
|
|
+ UserName = su.UserName,
|
|
|
+ SendOrderNum = 0,
|
|
|
+ NoSendOrderNum = 0,
|
|
|
+ ReSendOrderNum = SqlFunc.AggregateDistinctCount(wf.ExternalId),
|
|
|
+ }).ToListAsync();
|
|
|
|
|
|
var res = (from t1 in items
|
|
|
join t2 in items2 on t1.UserId equals t2.UserId into t1_t2
|
|
@@ -2007,23 +2261,23 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
dto.EndTime = dto.EndTime?.AddDays(1).AddSeconds(-1);
|
|
|
}
|
|
|
- return _orderVisitRepository.Queryable()
|
|
|
- .WhereIF(dto.StartTime.HasValue, x => x.VisitTime >= dto.StartTime)
|
|
|
- .WhereIF(dto.EndTime.HasValue, x => x.VisitTime <= dto.EndTime)
|
|
|
- .GroupBy(x => new { EmployeeId = x.EmployeeId, Name = x.Employee.Name })
|
|
|
- .Select(x => new OrderVisitJudeStatisticsRep()
|
|
|
- {
|
|
|
- EmpId = x.EmployeeId,
|
|
|
- EmpName = x.Employee.Name,
|
|
|
- OrgJudeCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue, 1, 0)), //部门扭转总件
|
|
|
- OrgJudeApprovalingCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.JudgeState == EJudgeState.Judging, 1, 0)),
|
|
|
- OrgJudeSuccessCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.JudgeState == EJudgeState.Agreed, 1, 0)),
|
|
|
- OrgJudeFailCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.JudgeState == EJudgeState.UnAgreed, 1, 0)),
|
|
|
- SeatJudeCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue, 1, 0)),
|
|
|
- SeatJudeApprovalingCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.JudgeState == EJudgeState.Judging, 1, 0)),
|
|
|
- SeatJudeSuccessCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.JudgeState == EJudgeState.Agreed, 1, 0)),
|
|
|
- SeatJudeFailCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.JudgeState == EJudgeState.UnAgreed, 1, 0))
|
|
|
- });
|
|
|
+ return _orderVisitRepository.Queryable()
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.VisitTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.VisitTime <= dto.EndTime)
|
|
|
+ .GroupBy(x => new { EmployeeId = x.EmployeeId, Name = x.Employee.Name })
|
|
|
+ .Select(x => new OrderVisitJudeStatisticsRep()
|
|
|
+ {
|
|
|
+ EmpId = x.EmployeeId,
|
|
|
+ EmpName = x.Employee.Name,
|
|
|
+ OrgJudeCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.OrgJudge == true && x.JudgeState != null, 1, 0)), //部门扭转总件
|
|
|
+ OrgJudeApprovalingCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.OrgJudge == true && x.JudgeState == EJudgeState.Judging, 1, 0)),
|
|
|
+ OrgJudeSuccessCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.OrgJudge == true && x.JudgeState == EJudgeState.Agreed, 1, 0)),
|
|
|
+ OrgJudeFailCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.OrgJudge.HasValue && x.OrgJudge == true && x.JudgeState == EJudgeState.UnAgreed, 1, 0)),
|
|
|
+ SeatJudeCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.SeatJudge == true && x.JudgeState != null, 1, 0)),
|
|
|
+ SeatJudeApprovalingCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.SeatJudge == true && x.JudgeState == EJudgeState.Judging, 1, 0)),
|
|
|
+ SeatJudeSuccessCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.SeatJudge == true && x.JudgeState == EJudgeState.Agreed, 1, 0)),
|
|
|
+ SeatJudeFailCount = SqlFunc.AggregateSum(SqlFunc.IIF(x.SeatJudge.HasValue && x.SeatJudge == true && x.JudgeState == EJudgeState.UnAgreed, 1, 0))
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
#endregion
|