|
@@ -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;
|
|
@@ -111,10 +112,11 @@ 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;
|
|
|
|
|
|
- public OrderApplication(
|
|
|
+ public OrderApplication(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowDomainService workflowDomainService,
|
|
@@ -158,6 +160,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
IRepository<OrderTsDetails> orderTsDetailsRepository,
|
|
|
IRepository<KnowledgeQuote> knowledgeQuoteRepository,
|
|
|
IRepository<OrderSpecial> orderSpecialRepository,
|
|
|
+ IRepository<User> userRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
|
ICircularRecordDomainService circularRecordDomainService)
|
|
|
{
|
|
@@ -204,9 +207,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
|
|
|
_orderTsDetailsRepository = orderTsDetailsRepository;
|
|
|
_knowledgeQuoteRepository = knowledgeQuoteRepository;
|
|
|
_orderSpecialRepository = orderSpecialRepository;
|
|
|
+ _userRepository = userRepository;
|
|
|
_workflowApplication = workflowApplication;
|
|
|
_circularRecordDomainService = circularRecordDomainService;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新工单办理期满时间(延期调用,其他不调用)
|
|
@@ -1602,8 +1606,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;
|
|
@@ -4112,10 +4116,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)
|
|
|
{
|
|
@@ -5235,6 +5239,117 @@ 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<ISessionContext> 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()
|
|
|
+ .Includes(d=>d.Organization)
|
|
|
+ .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()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .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()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .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()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .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()
|
|
|
+ .Includes(d=>d.Organization)
|
|
|
+ .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()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .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));
|
|
|
+ }
|
|
|
+
|
|
|
+ //await _sessionContext.ChangeSessionAsync(user.Id, cancellationToken);
|
|
|
+ _sessionContext.ChangeSession(user.Id);
|
|
|
+
|
|
|
+ return new FakeSessionContext
|
|
|
+ {
|
|
|
+ UserId = user.Id,
|
|
|
+ UserName = user.Name,
|
|
|
+ OrgId = user.OrgId,
|
|
|
+ OrgName = user.Organization.Name,
|
|
|
+ OrgAreaCode = user.Organization.AreaCode,
|
|
|
+ OrgAreaName = user.Organization.AreaName,
|
|
|
+ OrgIsCenter = user.Organization.IsCenter,
|
|
|
+ OrgLevel = user.Organization.Level,
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
#endregion
|