|
@@ -45,6 +45,7 @@ using PanGu;
|
|
|
using SqlSugar;
|
|
|
using System.Data;
|
|
|
using System.Dynamic;
|
|
|
+using ExtendedNumerics.Exceptions;
|
|
|
using FluentValidation;
|
|
|
using Hotline.FlowEngine.Definitions;
|
|
|
using Hotline.FlowEngine.Notifications;
|
|
@@ -61,6 +62,7 @@ using Quartz.Simpl;
|
|
|
using J2N.Text;
|
|
|
using Hotline.Application.FlowEngine;
|
|
|
using Hotline.Article;
|
|
|
+using Hotline.Share.Dtos.CallCenter;
|
|
|
|
|
|
namespace Hotline.Application.Orders;
|
|
|
|
|
@@ -110,8 +112,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
private readonly IRepository<OrderTsDetails> _orderTsDetailsRepository;
|
|
|
private readonly IRepository<KnowledgeQuote> _knowledgeQuoteRepository;
|
|
|
private readonly IRepository<OrderSpecial> _orderSpecialRepository;
|
|
|
+ private readonly IRepository<User> _userRepository;
|
|
|
private readonly IWorkflowApplication _workflowApplication;
|
|
|
private readonly ICircularRecordDomainService _circularRecordDomainService;
|
|
|
+ private readonly ISessionContextManager _sessionContextManager;
|
|
|
|
|
|
public OrderApplication(
|
|
|
IOrderDomainService orderDomainService,
|
|
@@ -157,8 +161,12 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<OrderTsDetails> orderTsDetailsRepository,
|
|
|
IRepository<KnowledgeQuote> knowledgeQuoteRepository,
|
|
|
IRepository<OrderSpecial> orderSpecialRepository,
|
|
|
+ IRepository<User> userRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
|
- ICircularRecordDomainService circularRecordDomainService)
|
|
|
+ ICircularRecordDomainService circularRecordDomainService,
|
|
|
+ ISessionContextCreator sessionContextCreator,
|
|
|
+ ISessionContextManager sessionContextManager
|
|
|
+ )
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_workflowDomainService = workflowDomainService;
|
|
@@ -203,8 +211,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderTsDetailsRepository = orderTsDetailsRepository;
|
|
|
_knowledgeQuoteRepository = knowledgeQuoteRepository;
|
|
|
_orderSpecialRepository = orderSpecialRepository;
|
|
|
+ _userRepository = userRepository;
|
|
|
_workflowApplication = workflowApplication;
|
|
|
_circularRecordDomainService = circularRecordDomainService;
|
|
|
+ _sessionContextManager = sessionContextManager;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -343,9 +353,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
public ISugarQueryable<Order> GetAboutToExpireAsync(AboutToExpireListDto dto)
|
|
|
{
|
|
|
DateTime? dateTime = DateTime.Now;
|
|
|
- var IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
- int orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
- var orgCode = _sessionContextProvider.SessionContext.OrgId;
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ int orgLevel = _sessionContext.OrgLevel;
|
|
|
+ var orgCode = _sessionContext.OrgId;
|
|
|
var query = _orderRepository.Queryable();
|
|
|
if (IsCenter == true)
|
|
|
query = _orderRepository.Queryable(canView: !IsCenter);
|
|
@@ -354,11 +364,11 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(orgLevel == 3, d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
.Where(step => step.ExternalId == d.Id && step.Status != EWorkflowStepStatus.Handled &&
|
|
|
((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) &&
|
|
|
- step.HandlerId == _sessionContextProvider.SessionContext.RequiredUserId) ||
|
|
|
+ step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
(step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) &&
|
|
|
- step.HandlerOrgId == _sessionContextProvider.SessionContext.RequiredOrgId) ||
|
|
|
+ step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
(step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) &&
|
|
|
- _sessionContextProvider.SessionContext.Roles.Contains(step.RoleId))))
|
|
|
+ _sessionContext.Roles.Contains(step.RoleId))))
|
|
|
.Any())
|
|
|
.WhereIF(orgLevel == 2 || orgLevel == 1, d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
.Where(step => step.ExternalId == d.Id &&
|
|
@@ -428,9 +438,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
// //stTime = _timeLimitDomainService.WorkDay(stTime);
|
|
|
// //DateTime stTime2 = _timeLimitDomainService.WorkDay(DateTime.Now);
|
|
|
// DateTime? dateTime = DateTime.Now;
|
|
|
- // var IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
- // int orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
- // var orgCode = _sessionContextProvider.SessionContext.OrgId;
|
|
|
+ // var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ // int orgLevel = _sessionContext.OrgLevel;
|
|
|
+ // var orgCode = _sessionContext.OrgId;
|
|
|
// //var query = _orderRepository.Queryable();
|
|
|
// //if (IsCenter == true)
|
|
|
// // query = _orderRepository.Queryable(canView: !IsCenter);
|
|
@@ -440,11 +450,11 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
// .WhereIF(orgLevel == 3, d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
// .Where(step => step.ExternalId == d.Id && step.Status != EWorkflowStepStatus.Handled &&
|
|
|
// ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) &&
|
|
|
- // step.HandlerId == _sessionContextProvider.SessionContext.RequiredUserId) ||
|
|
|
+ // step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
// (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) &&
|
|
|
- // step.HandlerOrgId == _sessionContextProvider.SessionContext.RequiredOrgId) ||
|
|
|
+ // step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
// (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) &&
|
|
|
- // _sessionContextProvider.SessionContext.Roles.Contains(step.RoleId))))
|
|
|
+ // _sessionContext.Roles.Contains(step.RoleId))))
|
|
|
// .Any())
|
|
|
// .WhereIF(orgLevel == 2 || orgLevel == 1, d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
// .Where(step => step.ExternalId == d.Id &&
|
|
@@ -533,18 +543,18 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
// DateTime stTime = _timeLimitDomainService.WorkDay(DateTime.Now);
|
|
|
DateTime stTime = _expireTime.WorkDay(DateTime.Now).GetAwaiter().GetResult();
|
|
|
- var IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
- int orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
- var orgCode = _sessionContextProvider.SessionContext.OrgId;
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ int orgLevel = _sessionContext.OrgLevel;
|
|
|
+ var orgCode = _sessionContext.OrgId;
|
|
|
return _orderRepository.Queryable(canView: false).Includes(d => d.OrderDelays)
|
|
|
.WhereIF(orgLevel == 3, d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
.Where(step => step.ExternalId == d.Id && step.Status != EWorkflowStepStatus.Handled &&
|
|
|
((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) &&
|
|
|
- step.HandlerId == _sessionContextProvider.SessionContext.RequiredUserId) ||
|
|
|
+ step.HandlerId == _sessionContext.RequiredUserId) ||
|
|
|
(step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) &&
|
|
|
- step.HandlerOrgId == _sessionContextProvider.SessionContext.RequiredOrgId) ||
|
|
|
+ step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
|
|
|
(step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) &&
|
|
|
- _sessionContextProvider.SessionContext.Roles.Contains(step.RoleId))))
|
|
|
+ _sessionContext.Roles.Contains(step.RoleId))))
|
|
|
.Any())
|
|
|
// .WhereIF(orgLevel == 2 || orgLevel == 1, d => d.ActualHandleOrgCode.StartsWith(orgCode))
|
|
|
.WhereIF(orgLevel == 2 || orgLevel == 1, d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
@@ -699,13 +709,16 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <summary>
|
|
|
/// 接收外部平台工单
|
|
|
/// </summary>
|
|
|
- public Task<AddOrderResponse> ReceiveOrderFromExternalAsync(AddOrderDto dto, CancellationToken cancellationToken)
|
|
|
+ public async Task<AddOrderResponse> ReceiveOrderFromExternalAsync(AddOrderDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
switch (dto.Source)
|
|
|
{
|
|
|
case ESource.ProvinceStraight:
|
|
|
- SessionContextCreator.CreateSessionContext(_sessionContextProvider, "province");
|
|
|
- return ReceiveOrderFromProvinceAsync(dto, dto.Files, cancellationToken);
|
|
|
+ //SessionContextCreator.CreateSessionContext(_sessionContextProvider, "province");
|
|
|
+ //await _sessionContextCreator.CreateSessionContextAsync("province", cancellationToken);
|
|
|
+ _sessionContextManager.ChangeSessionContext("province");
|
|
|
+
|
|
|
+ return await ReceiveOrderFromProvinceAsync(dto, dto.Files, cancellationToken);
|
|
|
case ESource.Police110:
|
|
|
case ESource.CityDataExchangeLz:
|
|
|
case ESource.CityDataExchangeYB:
|
|
@@ -723,11 +736,11 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
case ESource.ZGGC:
|
|
|
case ESource.ZGTFTB:
|
|
|
case ESource.YBHumanSocietyAPP:
|
|
|
- return ReceiveOrderFromOtherPlatformAsync(dto, dto.Files, cancellationToken);
|
|
|
+ return await ReceiveOrderFromOtherPlatformAsync(dto, dto.Files, cancellationToken);
|
|
|
case ESource.Hotline:
|
|
|
case ESource.HotlineImport:
|
|
|
default:
|
|
|
- return ReceiveOrderFromOtherPlatformAsync(dto, dto.Files, cancellationToken);
|
|
|
+ return await ReceiveOrderFromOtherPlatformAsync(dto, dto.Files, cancellationToken);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -741,9 +754,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
var order = await _orderRepository.Queryable()
|
|
|
.FirstAsync(d => d.Id == dto.Id || d.No == dto.OrderNo, cancellationToken);
|
|
|
+
|
|
|
if (order != null && dto.Files != null && dto.Files.Any())
|
|
|
{
|
|
|
- order.FileJson = await _fileRepository.AddFileAsync(dto.Files, order.Id, "", cancellationToken);
|
|
|
+ List<FileJson> file = order.FileJson;
|
|
|
+ List<FileJson> fileNew = await _fileRepository.AddFileAsync(dto.Files, order.Id, cancellationToken);
|
|
|
+ file.AddRange(fileNew);
|
|
|
+ order.FileJson = file;
|
|
|
await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
}
|
|
|
}
|
|
@@ -1155,7 +1172,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
|
|
|
expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne, dto.Workflow.Opinion,
|
|
|
- _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
canUpdateOrderSender);
|
|
|
//TODO发送短信即将超期
|
|
|
//_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
@@ -1188,7 +1205,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
|
|
|
expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne, dto.Workflow.Opinion,
|
|
|
- _sessionContextProvider.SessionContext.RequiredUserId, _sessionContextProvider.SessionContext.UserName,
|
|
|
+ _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
canUpdateOrderSender);
|
|
|
//TODO发送短信即将超期
|
|
|
//_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
@@ -1270,11 +1287,11 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
if (_appOptions.Value.IsZiGong == true)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(visit.EmployeeId))
|
|
|
- visit.EmployeeId = _sessionContextProvider.SessionContext.UserId;
|
|
|
+ visit.EmployeeId = _sessionContext.UserId;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- visit.EmployeeId = _sessionContextProvider.SessionContext.UserId;
|
|
|
+ visit.EmployeeId = _sessionContext.UserId;
|
|
|
}
|
|
|
|
|
|
visit.CallId = dto.CallId;
|
|
@@ -1332,10 +1349,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
//handle visit trace
|
|
|
//上面取得当前操作人,需求变动前暂时可以这样写
|
|
|
var visitor = new UserInfo(
|
|
|
- _sessionContextProvider.SessionContext.UserId,
|
|
|
- _sessionContextProvider.SessionContext.UserName,
|
|
|
- _sessionContextProvider.SessionContext.OrgId,
|
|
|
- _sessionContextProvider.SessionContext.OrgName);
|
|
|
+ _sessionContext.UserId,
|
|
|
+ _sessionContext.UserName,
|
|
|
+ _sessionContext.OrgId,
|
|
|
+ _sessionContext.OrgName);
|
|
|
await _workflowDomainService.HandleVisitTraceAsync(visit.Id, visitor, visit.VisitTime ?? DateTime.Now, cancellationToken);
|
|
|
|
|
|
var orderDto = _mapper.Map<OrderDto>(visit.Order);
|
|
@@ -1363,7 +1380,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
Id = visit.Id,
|
|
|
Order = orderDto,
|
|
|
OrderVisitDetails = _mapper.Map<List<VisitDetailDto>>(visit.OrderVisitDetails),
|
|
|
- VisitName = _sessionContextProvider.SessionContext.UserName,
|
|
|
+ VisitName = _sessionContext.UserName,
|
|
|
VisitTime = visit.VisitTime,
|
|
|
VisitType = visit.VisitType,
|
|
|
VisitState = visit.VisitState,
|
|
@@ -1414,7 +1431,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(m => m.Id == item.Id)
|
|
|
.SetColumns(m => m.VisitState == EVisitState.SMSVisiting)
|
|
|
// .SetColumns(m => m.VisitType == EVisitType.SmsVisit)
|
|
|
- .SetColumns(m => m.EmployeeId == _sessionContextProvider.SessionContext.RequiredUserId)
|
|
|
+ .SetColumns(m => m.EmployeeId == _sessionContext.RequiredUserId)
|
|
|
.ExecuteCommandAsync(cancellationToken);
|
|
|
|
|
|
// 发送短信后推送一个 48小时的延迟消息队列. 当消息队列收到消息时, 判断用户是否回复了, 如果未回复短信就 默认满意
|
|
@@ -1459,7 +1476,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
public ISugarQueryable<Order> QueryOrders(QueryOrderDto dto)
|
|
|
{
|
|
|
- var isCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ var isCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var query = _orderRepository.Queryable(canView: false);
|
|
|
if (!isCenter)
|
|
@@ -1467,7 +1484,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
query.Where(d => SqlFunc.Subqueryable<WorkflowStep>()
|
|
|
.Where(step => step.ExternalId == d.Id &&
|
|
|
!string.IsNullOrEmpty(step.HandlerOrgId) &&
|
|
|
- step.HandlerOrgId.StartsWith(_sessionContextProvider.SessionContext.RequiredOrgId)).Any());
|
|
|
+ step.HandlerOrgId.StartsWith(_sessionContext.RequiredOrgId)).Any());
|
|
|
}
|
|
|
|
|
|
query = query.Includes(d => d.OrderScreens).Includes(d => d.OrderTags);
|
|
@@ -1597,8 +1614,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.OrderByIF(dto is { SortField: "hotspotName", SortRule: 1 }, d => d.HotspotName, OrderByType.Desc) //热点分类降序
|
|
|
.OrderByIF(dto is { SortField: "acceptorName", SortRule: 0 }, d => d.AcceptorName, OrderByType.Asc) //受理人升序
|
|
|
.OrderByIF(dto is { SortField: "acceptorName", SortRule: 1 }, d => d.AcceptorName, OrderByType.Desc) //受理人降序
|
|
|
- .OrderByIF(dto is { SortField: "actualHandleTime", SortRule: 0 }, d => d.ActualHandleTime, OrderByType.Asc) //接办时间升序
|
|
|
- .OrderByIF(dto is { SortField: "actualHandleTime", SortRule: 1 }, d => d.ActualHandleTime, OrderByType.Desc) //接办时间降序
|
|
|
+ .OrderByIF(dto is { SortField: "currentStepAcceptTime", SortRule: 0 }, d => d.CurrentStepAcceptTime, OrderByType.Asc) //接办时间升序
|
|
|
+ .OrderByIF(dto is { SortField: "currentStepAcceptTime", SortRule: 1 }, d => d.CurrentStepAcceptTime, OrderByType.Desc) //接办时间降序
|
|
|
;
|
|
|
|
|
|
return query;
|
|
@@ -1611,14 +1628,14 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order, WorkflowStep> QueryUnsignedOrders(QueryUnsignedOrdersRequest dto)
|
|
|
{
|
|
|
- var IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
return _orderRepository.Queryable()
|
|
|
.LeftJoin<WorkflowStep>((x, ws) => x.Id == ws.ExternalId)
|
|
|
.WhereIF(dto.StartTime.HasValue, (x, ws) => ws.CreationTime >= dto.StartTime)
|
|
|
.WhereIF(dto.EndTime.HasValue, (x, ws) => ws.CreationTime <= dto.EndTime)
|
|
|
- .WhereIF(dto.Level == 0 && IsCenter == false, (x, ws) => ws.AcceptorOrgId.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
- .WhereIF(dto.Level == 1, (x, ws) => ws.AcceptorOrgId == _sessionContextProvider.SessionContext.OrgId)
|
|
|
- .WhereIF(dto.Level == 2, (x, ws) => ws.AcceptorOrgId.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .WhereIF(dto.Level == 0 && IsCenter == false, (x, ws) => ws.AcceptorOrgId.StartsWith(_sessionContext.OrgId))
|
|
|
+ .WhereIF(dto.Level == 1, (x, ws) => ws.AcceptorOrgId == _sessionContext.OrgId)
|
|
|
+ .WhereIF(dto.Level == 2, (x, ws) => ws.AcceptorOrgId.StartsWith(_sessionContext.OrgId))
|
|
|
.WhereIF(dto.Signed == 0, (x, ws) => ws.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.WaitForAccept)
|
|
|
.WhereIF(dto.Signed == 1, (x, ws) => ws.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.WaitForHandle)
|
|
|
.Where((x, ws) => ws.CountersignPosition == Share.Enums.FlowEngine.ECountersignPosition.None && x.Status > EOrderStatus.WaitForAccept)
|
|
@@ -1666,7 +1683,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
|
|
|
//dto.EndTime = dto.EndTime.Value.AddDays(1).AddSeconds(-1);
|
|
|
|
|
|
- var IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ var IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
|
|
|
var queryOrder = _systemOrganizeRepository.Queryable()
|
|
@@ -1675,7 +1692,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.EndTime.HasValue, (x, o) => o.CreationTime <= dto.EndTime)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 1, (x, o) => o.IdentityType == EIdentityType.Citizen)
|
|
|
.WhereIF(dto.TypeId != null && dto.TypeId == 2, (x, o) => o.IdentityType == EIdentityType.Enterprise)
|
|
|
- .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContextProvider.SessionContext.RequiredOrgId)
|
|
|
+ .WhereIF(IsCenter == false, (x, o) => o.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
.GroupBy((x, o) => new { x.Id, x.Name })
|
|
|
.Select((x, o) => new OrderBiOrgDataListVo
|
|
|
{
|
|
@@ -1795,7 +1812,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<Order> QueryOrgDataListDetail(OrgDataListAllDetailRequest dto)
|
|
|
{
|
|
|
- bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var quer = _orderRepository.Queryable()
|
|
|
.InnerJoin<SystemOrganize>((x, so) => x.ActualHandleOrgCode == so.Id && so.Level == 1)
|
|
@@ -1805,7 +1822,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where((x, so) =>
|
|
|
(x.Status >= EOrderStatus.Filed && x.ExpiredTime < x.FiledTime) ||
|
|
|
(x.Status < EOrderStatus.Filed && x.ExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(IsCenter == false, (x, so) => x.ActualHandleOrgCode == _sessionContextProvider.SessionContext.RequiredOrgId)
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => x.ActualHandleOrgCode == _sessionContext.RequiredOrgId)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrgName), (x, so) => x.AcceptorOrgName == dto.OrgName)
|
|
|
.Select(x => new Order { DaysOverdueOrgName = x.ActualHandleOrgName, Id = x.Id.SelectAll() });
|
|
|
|
|
@@ -1817,7 +1834,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where((x, so) => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
.Where((x, so) => (x.Status == Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < x.HandleTime) ||
|
|
|
(x.Status != Share.Enums.FlowEngine.EWorkflowStepStatus.Handled && x.StepExpiredTime < SqlFunc.GetDate()))
|
|
|
- .WhereIF(IsCenter == false, (x, so) => x.HandlerOrgId == _sessionContextProvider.SessionContext.RequiredOrgId)
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => x.HandlerOrgId == _sessionContext.RequiredOrgId)
|
|
|
.WhereIF(dto.ExpiredType is 2, (x, so, o) => o.OrderDelays.Any(x => x.DelayState == EDelayState.Pass))
|
|
|
.GroupBy(x => new { x.ExternalId, x.HandlerOrgName })
|
|
|
.Select(x => new { Id = x.ExternalId, WorkflowId = x.ExternalId, HandlerOrgName = x.HandlerOrgName });
|
|
@@ -1927,9 +1944,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgSatisfactionStatistics(PagedKeywordSonRequest dto)
|
|
|
{
|
|
|
- bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
- var orgLevel = _sessionContextProvider.SessionContext.OrgLevel;
|
|
|
- string orgLevelStr = (_sessionContextProvider.SessionContext.RequiredOrgId.Length + 3).ToString();
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
+ var orgLevel = _sessionContext.OrgLevel;
|
|
|
+ string orgLevelStr = (_sessionContext.RequiredOrgId.Length + 3).ToString();
|
|
|
|
|
|
var list = _orderVisitDetailRepository.Queryable()
|
|
|
.Where(x => x.OrderVisit.VisitTime >= dto.StartTime.Value && x.OrderVisit.VisitTime <= dto.EndTime.Value &&
|
|
@@ -1938,7 +1955,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(string.IsNullOrEmpty(dto.LineNum) == false, x => x.OrderVisit.Order.CallRecord.Gateway.Contains(dto.LineNum))
|
|
|
.WhereIF(dto.TypeCode != null && dto.TypeCode == 1, x => x.OrderVisit.Order.IdentityType == EIdentityType.Citizen)
|
|
|
.WhereIF(dto.TypeCode != null && dto.TypeCode == 2, x => x.OrderVisit.Order.IdentityType == EIdentityType.Enterprise)
|
|
|
- .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
.WhereIF(dto.VisitType != null, x => x.OrderVisit.VisitType == dto.VisitType)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.OrderVisit.Order.Title.Contains(dto.Title)) // 工单标题
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderVisit.Order.No == dto.No) // 工单编号
|
|
@@ -2092,7 +2109,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
var query = _statisticsDepartSatisfiedRepository.Queryable()
|
|
|
.LeftJoin<SystemOrganize>((x, so) => x.DepartmentId == so.oldBmid)
|
|
|
- .WhereIF(IsCenter == false, (x, so) => so.Id.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .WhereIF(IsCenter == false, (x, so) => so.Id.StartsWith(_sessionContext.OrgId))
|
|
|
.Where((x, so) => x.Time >= dto.StartTime.Value && x.Time <= dto.EndTime.Value);
|
|
|
if (IsCenter)
|
|
|
{
|
|
@@ -2195,7 +2212,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<VisitAndOrgSatisfactionStatisticsDto>> VisitAndOrgStatisfactionOrgDetail(PagedKeywordSonRequest dto)
|
|
|
{
|
|
|
- bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
var org = await _systemOrganizeRepository.Queryable().FirstAsync(x => x.Id == dto.OrgCode);
|
|
|
|
|
|
string orgLevelStr = (dto.OrgCode.Length + 3).ToString();
|
|
@@ -2215,7 +2232,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(dto.TypeCode != null && dto.TypeCode == 2,
|
|
|
(x, it) => it.OrderVisit.Order.IdentityType == EIdentityType.Enterprise)
|
|
|
.WhereIF(IsCenter == false,
|
|
|
- (x, it) => it.VisitOrgCode.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ (x, it) => it.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
.WhereIF(dto.VisitType != null, (x, it) => it.OrderVisit.VisitType == dto.VisitType)
|
|
|
.GroupBy((x, it) => new
|
|
|
{
|
|
@@ -2647,7 +2664,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<VisitAndHotspotSatisfactionStatisticsDto>> VisitAndHotspotSatisfactionStatistics(VisitAndHotspotPagedKeywordRequest dto)
|
|
|
{
|
|
|
- bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
|
|
|
var list = _orderVisitDetailRepository.Queryable()
|
|
|
.Includes(x => x.OrderVisit, v => v.Order)
|
|
@@ -2657,7 +2674,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(x => x.OrderVisit.VisitTime >= dto.StartTime.Value && x.OrderVisit.VisitTime <= dto.EndTime.Value &&
|
|
|
x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(x.VisitOrgCode))
|
|
|
.WhereIF(string.IsNullOrEmpty(dto.HotspotName) == false, (x, h) => h.HotSpotName == dto.HotspotName)
|
|
|
- .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
.WhereIF(dto.TypeId == 1, x => x.OrgProcessingResults != null)
|
|
|
.WhereIF(dto.TypeId == 2, x => x.OrgHandledAttitude != null);
|
|
|
|
|
@@ -2796,7 +2813,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public ISugarQueryable<OrderVisitDetail> VisitAndHotspotSatisfactionDetail(VisitAndHotspotPagedKeywordRequest dto)
|
|
|
{
|
|
|
- bool IsCenter = _sessionContextProvider.SessionContext.OrgIsCenter;
|
|
|
+ bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
var key = string.Empty;
|
|
|
if (!string.IsNullOrEmpty(dto.TitleCode))
|
|
|
{
|
|
@@ -2831,7 +2848,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(x => x.OrderVisit.VisitTime >= dto.StartTime && x.OrderVisit.VisitTime <= dto.EndTime && x.VisitTarget == EVisitTarget.Org &&
|
|
|
x.OrderVisit.VisitState == EVisitState.Visited)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.HotspotName), x => x.OrderVisit.Order.Hotspot.HotSpotFullName.StartsWith(dto.HotspotName))
|
|
|
- .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContextProvider.SessionContext.OrgId))
|
|
|
+ .WhereIF(IsCenter == false, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
.WhereIF(dto.TypeId is 1, x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == key)
|
|
|
.WhereIF(dto.TypeId is 2, x => SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == key);
|
|
|
}
|
|
@@ -3078,6 +3095,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.Where(x => x.HandlerName != null && x.HandlerName != "")
|
|
|
.WhereIF(dto.AuditType is 1, x => x.Name == "班长审批")
|
|
|
.WhereIF(dto.AuditType is 2, x => x.Name == "中心领导")
|
|
|
+ .WhereIF(_appOptions.Value.IsZiGong && dto.AuditType is 3, x => x.Name == "中心初审")
|
|
|
.GroupBy(x => new { x.HandlerName })
|
|
|
.Select(x => new OrderScreenAuditVo
|
|
|
{
|
|
@@ -3269,33 +3287,30 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
// x => SqlFunc.JsonListObjectAny(x.OrgHandledAttitude, "Key", dto.OrgHandledAttitude))
|
|
|
//.WhereIF(!string.IsNullOrEmpty(dto.OrgNoSatisfiedReason),
|
|
|
// x => SqlFunc.JsonField(x.OrgNoSatisfiedReason, "Key") == dto.OrgNoSatisfiedReason)
|
|
|
- .Where(x => x.OrderVisit.VisitState == EVisitState.Visited && x.OrderVisit.IsCanHandle);
|
|
|
+ .Where(x => x.OrderVisit.VisitState == EVisitState.Visited && x.OrderVisit.IsCanHandle)
|
|
|
+ .WhereIF(dto.DataScope is 1, x => x.VisitOrgCode == _sessionContext.OrgId);
|
|
|
if (_sessionContext.OrgId != null && !_sessionContext.OrgIsCenter)
|
|
|
{
|
|
|
- query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- x => x.OrderVisit.Order.Title.Contains(dto.Keyword!) ||
|
|
|
- x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
- .Where(x => x.VisitTarget == EVisitTarget.Org && x.VisitOrgCode == _sessionContext.OrgId && (
|
|
|
+ query.WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.OrderVisit.Order.Title.Contains(dto.Keyword!) || x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
+ .Where(x => 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"
|
|
|
- ));
|
|
|
+ ))
|
|
|
+ .WhereIF(dto.DataScope is 0, x => x.VisitOrgCode.StartsWith(_sessionContext.OrgId))
|
|
|
+ ;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- x => x.OrderVisit.Order.Title.Contains(dto.Keyword!) ||
|
|
|
- x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
+ query.WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.OrderVisit.Order.Title.Contains(dto.Keyword!) || x.OrderVisit.Order.No.Contains(dto.Keyword!))
|
|
|
.WhereIF(dto.ScreenType == EOrderScreenType.Org, x => 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"
|
|
|
))
|
|
|
- .WhereIF(dto.ScreenType == EOrderScreenType.Seat,
|
|
|
- x => x.VisitTarget == EVisitTarget.Seat &&
|
|
|
- (x.SeatEvaluate == ESeatEvaluate.VeryNoSatisfied || x.SeatEvaluate == ESeatEvaluate.NoSatisfied))
|
|
|
+ .WhereIF(dto.ScreenType == EOrderScreenType.Seat, x => x.VisitTarget == EVisitTarget.Seat && (x.SeatEvaluate == ESeatEvaluate.VeryNoSatisfied || x.SeatEvaluate == ESeatEvaluate.NoSatisfied))
|
|
|
;
|
|
|
}
|
|
|
|
|
@@ -3307,7 +3322,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.OrderByIF(dto is { SortRule: 1, SortField: "order.filedTime" }, x => x.OrderVisit.Order.FiledTime, OrderByType.Desc)
|
|
|
.OrderByIF(dto is { SortRule: 0, SortField: "orderVisit.visitTime" }, x => x.OrderVisit.VisitTime, OrderByType.Asc)
|
|
|
.OrderByIF(dto is { SortRule: 1, SortField: "orderVisit.visitTime" }, x => x.OrderVisit.VisitTime, OrderByType.Desc)
|
|
|
- .OrderByIF(dto is { SortRule: 0, SortField: "screenByEndTime" }, x => x.ScreenByEndTime, OrderByType.Asc)
|
|
|
+ .OrderByIF(dto is { SortRule: 0, SortField: "screenByEndTime" }, x => x.ScreenByEndTime, OrderByType.Asc)//截止申请日期排序
|
|
|
.OrderByIF(dto is { SortRule: 1, SortField: "screenByEndTime" }, x => x.ScreenByEndTime, OrderByType.Desc)
|
|
|
.OrderByIF(dto.SortRule is null, x => x.CreationTime, OrderByType.Desc);
|
|
|
}
|
|
@@ -3470,8 +3485,17 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrderTagCode),
|
|
|
d => SqlFunc.Subqueryable<OrderRelationTag>().InnerJoin<SystemDicData>((s, p) => s.TagId == p.Id)
|
|
|
.Where((s, p) => p.DicDataValue == dto.OrderTagCode && d.OrderId == s.OrderId).Any()) //工单标签
|
|
|
- .OrderByIF(dto.VisitStateQuery != EVisitStateQuery.Visited, d => d.Order.IsUrgent, OrderByType.Desc)
|
|
|
- .OrderByDescending(d => d.PublishTime);
|
|
|
+ .OrderByIF(_appOptions.Value.IsYiBin && dto.VisitStateQuery != EVisitStateQuery.Visited, d => d.Order.IsUrgent, OrderByType.Desc)
|
|
|
+ .OrderByIF(_appOptions.Value.IsZiGong == false, d => d.PublishTime, OrderByType.Desc)
|
|
|
+ //.OrderByDescending(d => d.PublishTime)
|
|
|
+ .OrderByIF(dto is { SortField: "publishTime", SortRule: 0 }, x => x.PublishTime, OrderByType.Asc) // 发布时间升序
|
|
|
+ .OrderByIF(dto is { SortField: "publishTime", SortRule: 1 }, x => x.PublishTime, OrderByType.Desc)// 发布时间升序
|
|
|
+ .OrderByIF(dto is { SortField: "order.creationTime", SortRule: 0 }, x => x.Order.CreationTime, OrderByType.Asc) // 受理时间升序
|
|
|
+ .OrderByIF(dto is { SortField: "order.creationTime", SortRule: 1 }, x => x.Order.CreationTime, OrderByType.Desc) // 受理时间升序
|
|
|
+ .OrderByIF(dto is { SortField: "order.filedTime", SortRule: 0 }, x => x.Order.FiledTime, OrderByType.Asc) // 办结时间升序
|
|
|
+ .OrderByIF(dto is { SortField: "order.filedTime", SortRule: 1 }, x => x.Order.FiledTime, OrderByType.Desc) // 办结时间升序
|
|
|
+ .OrderByIF(_appOptions.Value.IsZiGong && string.IsNullOrEmpty(dto.SortField), d => d.PublishTime, OrderByType.Desc)
|
|
|
+ ;
|
|
|
return query;
|
|
|
}
|
|
|
|
|
@@ -3637,7 +3661,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_sessionContext.ChangeSession(startStep.HandlerId);
|
|
|
var isAutoFillSummaryOpinion = _systemSettingCacheManager.IsAutoFillSummaryOpinion;
|
|
|
|
|
|
- await _workflowDomainService.NextAsync(operater, nextDto, order.ExpiredTime, isAutoFillSummaryOpinion,
|
|
|
+ await _workflowDomainService.NextAsync(nextDto,
|
|
|
+ expiredTime: order.ExpiredTime,
|
|
|
+ isAutoFillSummaryOpinion: isAutoFillSummaryOpinion,
|
|
|
cancellationToken: cancellationToken);
|
|
|
}
|
|
|
|
|
@@ -4097,8 +4123,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
async (workflow, currentStep, targetStepDefine, targetStep, targetStepNew) =>
|
|
|
{
|
|
|
var stepAssignInfo = recall.NextHandlers.FirstOrDefault()
|
|
|
- ?? await GetOrderRecallAssignInfoAsync(workflow, targetStepDefine, targetStep,
|
|
|
- recall, cancellation);
|
|
|
+ ?? GetOrderRecallAssignInfoAsync(workflow, targetStepDefine, targetStep,
|
|
|
+ recall, cancellation).Result;
|
|
|
if (stepAssignInfo is null) return;
|
|
|
var validator = new StepAssignInfoValidator();
|
|
|
await validator.ValidateAndThrowAsync(stepAssignInfo, cancellation);
|
|
@@ -4107,10 +4133,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
cancellation);
|
|
|
|
|
|
|
|
|
- //if (order.ActualHandleOrgCode != OrgSeedData.CenterId && order.Status < EOrderStatus.Filed)
|
|
|
- //{
|
|
|
- // await _circularRecordDomainService.OrderSpecialCircularMessage(special, order, cancellation);
|
|
|
- //}
|
|
|
+ if (_appOptions.Value.IsYiBin && order.ActualHandleOrgCode != OrgSeedData.CenterId && order.Status < EOrderStatus.Filed)
|
|
|
+ {
|
|
|
+ await _circularRecordDomainService.OrderSpecialCircularMessage(special, order, cancellation);
|
|
|
+ }
|
|
|
|
|
|
if (_appOptions.Value.IsZiGong && dto.BusinessType == EBusinessType.Send)
|
|
|
{
|
|
@@ -4545,7 +4571,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
d => d.CreationTime >= dto.ApplyStartTime && d.CreationTime <= dto.ApplyEndTime)
|
|
|
//.WhereIF(dto.AuditStatus is 1 , d=>d.Status == ETerminateStatus.Approval || d.Status == ETerminateStatus.SendBack )
|
|
|
//.WhereIF(dto.AuditStatus is 2, d => d.Status == ETerminateStatus.End || dto.Status == ETerminateStatus.Refuse)
|
|
|
- .WhereIF(dto.QueryType is 1, d => d.CreatorId == _sessionContextProvider.SessionContext.UserId)
|
|
|
+ .WhereIF(dto.QueryType is 1, d => d.CreatorId == _sessionContext.UserId)
|
|
|
.WhereIF(dto.Status.HasValue, d => d.Status == dto.Status)
|
|
|
.WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, d => d.Order.StartTime >= dto.StartTime && d.Order.StartTime <= dto.EndTime)
|
|
|
.OrderByDescending(d => d.CreationTime);
|
|
@@ -4630,7 +4656,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
case 2: //办结: 当前登录坐席作为最初受理人已办结的工单
|
|
|
query.Where(d =>
|
|
|
d.Status >= EOrderStatus.Filed
|
|
|
- && d.AcceptorId == _sessionContextProvider.SessionContext.RequiredUserId);
|
|
|
+ && d.AcceptorId == _sessionContext.RequiredUserId);
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -4640,10 +4666,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
// (hasHandled || step.Status != EWorkflowStepStatus.Handled) &&
|
|
|
// (!hasHandled || step.Status == EWorkflowStepStatus.Handled &&
|
|
|
// step.TraceState != EWorkflowTraceState.StepRemoveByPrevious) &&
|
|
|
- // ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContextProvider.SessionContext.RequiredUserId) ||
|
|
|
- // (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContextProvider.SessionContext.RequiredOrgId) ||
|
|
|
- // (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContextProvider.SessionContext.Roles.Contains(step.RoleId)))).Any() ||
|
|
|
- // (string.IsNullOrEmpty(d.WorkflowId) && (string.IsNullOrEmpty(d.SignerId) || d.SignerId == _sessionContextProvider.SessionContext.RequiredUserId))
|
|
|
+ // ((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() ||
|
|
|
+ // (string.IsNullOrEmpty(d.WorkflowId) && (string.IsNullOrEmpty(d.SignerId) || d.SignerId == _sessionContext.RequiredUserId))
|
|
|
//);
|
|
|
|
|
|
//随手拍
|
|
@@ -4659,7 +4685,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
//// 交办件:已派单其他节点的工单,该选项卡下工单若办结就不显示
|
|
|
//.WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 1, d => /*d.ProcessType == EProcessType.Jiaoban &&*/ d.Status < EOrderStatus.Filed)
|
|
|
//// 办结件:当前登录坐席作为最初受理人已办结的工单
|
|
|
- //.WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 2, d => d.Status >= EOrderStatus.Filed && d.AcceptorId == _sessionContextProvider.SessionContext.RequiredUserId)
|
|
|
+ //.WhereIF(dto.TypeCode.HasValue == true && dto.TypeCode == 2, d => d.Status >= EOrderStatus.Filed && d.AcceptorId == _sessionContext.RequiredUserId)
|
|
|
.WhereIF(dto.IsProvince.HasValue, d => d.IsProvince == dto.IsProvince)
|
|
|
//.WhereIF(dto.IsHandled.HasValue, d => handleStatuses.Contains(d.Status))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.StartsWith(dto.Keyword!))
|
|
@@ -5021,7 +5047,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
{
|
|
|
var query = _orderSendBackAuditRepository.Queryable()
|
|
|
.Where(x => x.ApplyOrgId.Length == 6 && x.CreationTime > x.OrderExpiredTime)
|
|
|
- .WhereIF(!_sessionContext.OrgIsCenter, x=>x.ApplyOrgId == _sessionContext.OrgId)
|
|
|
+ .WhereIF(!_sessionContext.OrgIsCenter, x => x.ApplyOrgId == _sessionContext.OrgId)
|
|
|
.WhereIF(dto.StartTime.HasValue && dto.EndTime.HasValue, x => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
|
|
|
.GroupBy(x => new { x.ApplyOrgId, x.ApplyOrgName })
|
|
|
.Select(x => new ExtendedSendBackVo()
|
|
@@ -5180,7 +5206,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
async (workflow1, currentStep1, prevStepDefine, prevStep1, newStep) =>
|
|
|
{
|
|
|
var stepAssignInfo =
|
|
|
- await GetOrderPreviousAssignInfoAsync(workflow1, prevStepDefine, prevStep1, cancellationToken);
|
|
|
+ GetOrderPreviousAssignInfoAsync(workflow1, prevStepDefine, prevStep1, cancellationToken).Result;
|
|
|
if (stepAssignInfo is null) return;
|
|
|
var validator = new StepAssignInfoValidator();
|
|
|
await validator.ValidateAndThrowAsync(stepAssignInfo);
|
|
@@ -5230,6 +5256,98 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Order() { ProcessType = processType, SendBackNum = order.SendBackNum })
|
|
|
.Where(o => o.Id == order.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
}
|
|
|
+
|
|
|
+ if (_appOptions.Value.IsYiBin && order.IsProvince && sendBack.ApplyOrgId.Length == 6 && sendBack.SendBackOrgId == OrgSeedData.CenterId)
|
|
|
+ {
|
|
|
+ if (currentStep.FlowAssignType == EFlowAssignType.User)
|
|
|
+ {
|
|
|
+ await _circularRecordDomainService.OrderSendBackCircularMessage(currentStep.HandlerId, currentStep.HandlerName, order, cancellationToken);
|
|
|
+ }
|
|
|
+ else if (currentStep.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(currentStep.RoleId))
|
|
|
+ {
|
|
|
+
|
|
|
+ var users = await _userRepository.Queryable().Includes(x => x.Roles).Where(x => x.Roles.Where(x => x.Id == currentStep.RoleId).Any()).ToListAsync();
|
|
|
+ foreach (var user in users)
|
|
|
+ {
|
|
|
+ await _circularRecordDomainService.OrderSendBackCircularMessage(user.Id, user.Name, order, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 依据当前待办节点获取任意一个合法办理人
|
|
|
+ /// </summary>
|
|
|
+ public async Task<User> GetHandlerRandomAsync(WorkflowStep step, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ User user;
|
|
|
+ switch (step.BusinessType)
|
|
|
+ {
|
|
|
+ case EBusinessType.Seat:
|
|
|
+ var roleSeat = _systemSettingCacheManager.GetSetting(SettingConstants.RoleZuoXi)?.SettingValue.FirstOrDefault();
|
|
|
+ if (string.IsNullOrEmpty(roleSeat))
|
|
|
+ throw new UserFriendlyException($"未配置坐席角色, {SettingConstants.RoleZuoXi}", "未配置坐席角色");
|
|
|
+ user = await _userRepository.Queryable()
|
|
|
+ .Where(d => d.Roles.Any(x => x.Name == roleSeat))
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (user is null)
|
|
|
+ throw UserFriendlyException.SameMessage("坐席角色未设置用户");
|
|
|
+ break;
|
|
|
+ case EBusinessType.Send:
|
|
|
+ var roleSend = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue.FirstOrDefault();
|
|
|
+ if (string.IsNullOrEmpty(roleSend))
|
|
|
+ throw new UserFriendlyException($"未配置派单角色, {SettingConstants.RolePaiDan}", "未配置派单角色");
|
|
|
+ user = await _userRepository.Queryable()
|
|
|
+ .Where(d => d.Roles.Any(x => x.Name == roleSend))
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (user is null)
|
|
|
+ throw UserFriendlyException.SameMessage("派单角色未设置用户");
|
|
|
+ break;
|
|
|
+ case EBusinessType.CenterMonitor:
|
|
|
+ var roleCenterMonitor = _systemSettingCacheManager.GetSetting(SettingConstants.SeatsMonitor)?.SettingValue.FirstOrDefault();
|
|
|
+ if (string.IsNullOrEmpty(roleCenterMonitor))
|
|
|
+ throw new UserFriendlyException($"未配置中心班长角色, {SettingConstants.SeatsMonitor}", "未配置中心班长角色");
|
|
|
+ user = await _userRepository.Queryable()
|
|
|
+ .Where(d => d.Roles.Any(x => x.Name == roleCenterMonitor))
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (user is null)
|
|
|
+ throw UserFriendlyException.SameMessage("中心班长角色未设置用户");
|
|
|
+ break;
|
|
|
+ case EBusinessType.CenterLeader:
|
|
|
+ var roleCenterLeader = _systemSettingCacheManager.GetSetting(SettingConstants.RoleCenterLeader)?.SettingValue.FirstOrDefault();
|
|
|
+ if (string.IsNullOrEmpty(roleCenterLeader))
|
|
|
+ throw new UserFriendlyException($"未配置中心领导角色, {SettingConstants.RoleCenterLeader}", "未配置中心领导角色");
|
|
|
+ user = await _userRepository.Queryable()
|
|
|
+ .Where(d => d.Roles.Any(x => x.Name == roleCenterLeader))
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (user is null)
|
|
|
+ throw UserFriendlyException.SameMessage("中心领导角色未设置用户");
|
|
|
+ break;
|
|
|
+ case EBusinessType.Department:
|
|
|
+ var roleJingBanRen = _systemSettingCacheManager.GetSetting(SettingConstants.RoleJingBanRen)?.SettingValue.FirstOrDefault();
|
|
|
+ if (string.IsNullOrEmpty(roleJingBanRen))
|
|
|
+ throw new UserFriendlyException($"未配置部门经办人角色, {SettingConstants.RoleJingBanRen}", "未配置部门经办人角色");
|
|
|
+ user = await _userRepository.Queryable()
|
|
|
+ .Where(d => d.OrgId == step.HandlerOrgId && d.Roles.Any(x => x.Name == roleJingBanRen))
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (user is null)
|
|
|
+ throw new UserFriendlyException($"该部门经办人角色未设置用户,部门:{step.HandlerOrgId}, 角色:{SettingConstants.RoleJingBanRen}");
|
|
|
+ break;
|
|
|
+ case EBusinessType.DepartmentLeader:
|
|
|
+ var roleBuMenLingDao = _systemSettingCacheManager.GetSetting(SettingConstants.RoleLingDao)?.SettingValue.FirstOrDefault();
|
|
|
+ if (string.IsNullOrEmpty(roleBuMenLingDao))
|
|
|
+ throw new UserFriendlyException($"未配置部门领导角色, {SettingConstants.RoleJingBanRen}", "未配置部门领导角色");
|
|
|
+ user = await _userRepository.Queryable()
|
|
|
+ .Where(d => d.OrgId == step.HandlerOrgId && d.Roles.Any(x => x.Name == roleBuMenLingDao))
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (user is null)
|
|
|
+ throw new UserFriendlyException($"该部门领导角色未设置用户,部门:{step.HandlerOrgId}, 角色:{SettingConstants.RoleJingBanRen}");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new OutOfRangeException(nameof(GetHandlerRandomAsync));
|
|
|
+ }
|
|
|
+
|
|
|
+ return user;
|
|
|
}
|
|
|
|
|
|
#endregion
|