|
@@ -1,49 +1,40 @@
|
|
|
using DotNetCore.CAP;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
-using Hotline.Share.Dtos.Order;
|
|
|
-using Hotline.Share.Enums.Order;
|
|
|
-using MapsterMapper;
|
|
|
-using Microsoft.Extensions.Logging;
|
|
|
-using XF.Domain.Authentications;
|
|
|
-using XF.Domain.Cache;
|
|
|
-using XF.Domain.Dependency;
|
|
|
-using XF.Domain.Exceptions;
|
|
|
-using XF.Domain.Repository;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
+using Hotline.Configurations;
|
|
|
+using Hotline.ContingencyManagement.Notifies;
|
|
|
+using Hotline.EventBus;
|
|
|
using Hotline.File;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
|
+using Hotline.Push.Notifies;
|
|
|
using Hotline.Schedulings;
|
|
|
using Hotline.SeedData;
|
|
|
-using Hotline.Users;
|
|
|
-using Hotline.Share.Dtos;
|
|
|
+using Hotline.Settings;
|
|
|
using Hotline.Settings.Hotspots;
|
|
|
+using Hotline.Settings.TimeLimitDomain;
|
|
|
+using Hotline.Share.Dtos;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
-using Microsoft.AspNetCore.Http;
|
|
|
-using Hotline.Settings;
|
|
|
-using SqlSugar;
|
|
|
-using Hotline.Push.Notifies;
|
|
|
-using Hotline.Share.Enums.Push;
|
|
|
-using MediatR;
|
|
|
-using Hotline.Authentications;
|
|
|
-using Hotline.ContingencyManagement.Notifies;
|
|
|
-using Hotline.EventBus;
|
|
|
-using Hotline.Share.Enums.FlowEngine;
|
|
|
-using Mapster;
|
|
|
-using Microsoft.AspNetCore.Builder.Extensions;
|
|
|
-using Hotline.Configurations;
|
|
|
-using Microsoft.Extensions.Options;
|
|
|
-using Hotline.Share.Tools;
|
|
|
-using Hotline.Orders.Notifications;
|
|
|
-using Hotline.Share.Mq;
|
|
|
-using System.Security.Cryptography;
|
|
|
-using Hotline.FlowEngine.Definitions;
|
|
|
using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
+using Hotline.Share.Dtos.Order;
|
|
|
+using Hotline.Share.Enums.FlowEngine;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
+using Hotline.Share.Enums.Push;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
-using Hotline.Settings.TimeLimitDomain;
|
|
|
+using Hotline.Share.Mq;
|
|
|
+using Hotline.Share.Tools;
|
|
|
using Hotline.Snapshot.IRepository;
|
|
|
-using Hotline.Share.Dtos.Push;
|
|
|
-using System.Threading;
|
|
|
-using XF.Domain.Entities;
|
|
|
+using Hotline.Users;
|
|
|
+using Mapster;
|
|
|
+using MapsterMapper;
|
|
|
+using MediatR;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using SqlSugar;
|
|
|
+using XF.Domain.Authentications;
|
|
|
+using XF.Domain.Cache;
|
|
|
+using XF.Domain.Dependency;
|
|
|
+using XF.Domain.Exceptions;
|
|
|
+using XF.Domain.Repository;
|
|
|
|
|
|
namespace Hotline.Orders;
|
|
|
|
|
@@ -76,9 +67,9 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
private readonly ICalcExpireTime _expireTime;
|
|
|
private readonly ICallDomainService _callDomainService;
|
|
|
private readonly IOrderVisitDomainService _orderVisitDomainService;
|
|
|
-
|
|
|
+ private readonly IRepository<WorkflowTrace> _workflowTraceRepository;
|
|
|
|
|
|
- public OrderDomainService(
|
|
|
+ public OrderDomainService(
|
|
|
IOrderRepository orderRepository,
|
|
|
IRepository<OrderRedo> orderRedoRepository,
|
|
|
IRepository<OrderPublish> orderPublishRepository,
|
|
@@ -106,7 +97,8 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
IOrderSnapshotRepository orderSnapshotRepository,
|
|
|
ICalcExpireTime expireTime,
|
|
|
ICallDomainService callDomainService,
|
|
|
- IOrderVisitDomainService orderVisitDomainService)
|
|
|
+ IOrderVisitDomainService orderVisitDomainService,
|
|
|
+ IRepository<WorkflowTrace> workflowTraceRepository)
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
|
_orderRedoRepository = orderRedoRepository;
|
|
@@ -135,7 +127,8 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
_expireTime = expireTime;
|
|
|
_callDomainService = callDomainService;
|
|
|
_orderVisitDomainService = orderVisitDomainService;
|
|
|
- }
|
|
|
+ _workflowTraceRepository = workflowTraceRepository;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 归档后自动发布
|
|
@@ -259,7 +252,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
if (isReturn == false)
|
|
|
{
|
|
|
//order.FocusOnEvents!="7" 2025年4月29日 10:55:38 刘欣 临时新增,如果是旅游件不自动回访
|
|
|
- if (order is { FileOrgIsCenter: true, CounterSignType: null } && !order.IsProvince && order.FocusOnEvents!="7")
|
|
|
+ if (order is { FileOrgIsCenter: true, CounterSignType: null } && !order.IsProvince && order.FocusOnEvents != "7")
|
|
|
{
|
|
|
orderVisit.VisitState = EVisitState.Visited;
|
|
|
orderVisit.VisitTime = DateTime.Now;
|
|
@@ -289,37 +282,64 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
VisitId = visitId,
|
|
|
VisitTarget = EVisitTarget.Seat
|
|
|
};
|
|
|
-
|
|
|
- //部门回访明细
|
|
|
- var orgDetail = new OrderVisitDetail
|
|
|
- {
|
|
|
- VisitId = visitId,
|
|
|
- VisitOrgCode = order.ActualHandleOrgCode,
|
|
|
- VisitOrgName = order.ActualHandleOrgName,
|
|
|
- VisitTarget = EVisitTarget.Org
|
|
|
- };
|
|
|
-
|
|
|
- if (isReturn == false)
|
|
|
+ //中心会签件,批量发布时,默认不公开,需回访部门需默认勾选会签的所有一级部门(不勾选热线中心)
|
|
|
+ //部门会签件,批量发布时,默认不公开,需回访部门处不勾选部门,只对实际办理部门进行回访
|
|
|
+ if (_appOptions.Value.IsZiGong && order.CounterSignType == ECounterSignType.Center)
|
|
|
{
|
|
|
- //order.FocusOnEvents!="7" 2025年4月29日 10:55:38 刘欣 临时新增,如果是旅游件不自动回访
|
|
|
- if (order is { FileOrgIsCenter: true, CounterSignType: null, IsProvince: false } && order.FocusOnEvents != "7")
|
|
|
+ //查询所有参与会签的一级部门
|
|
|
+ //然后写入回访表
|
|
|
+ var orgList = await GetCountersignOneOrg(order.WorkflowId);
|
|
|
+ if (orgList != null && orgList.Any())
|
|
|
{
|
|
|
- var satisfy = new Kv() { Key = "4", Value = "满意" };
|
|
|
- orgDetail.OrgProcessingResults = satisfy;
|
|
|
- //orgDetail.OrgHandledAttitude = satisfy;
|
|
|
+ foreach (var item in orgList)
|
|
|
+ {
|
|
|
+ //部门回访明细
|
|
|
+ visitedDetail.Add(new OrderVisitDetail
|
|
|
+ {
|
|
|
+ VisitId = visitId,
|
|
|
+ VisitOrgCode = item.Key,
|
|
|
+ VisitOrgName = item.Value,
|
|
|
+ VisitTarget = EVisitTarget.Org
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //部门回访明细
|
|
|
+ var orgDetail = new OrderVisitDetail
|
|
|
+ {
|
|
|
+ VisitId = visitId,
|
|
|
+ VisitOrgCode = order.ActualHandleOrgCode,
|
|
|
+ VisitOrgName = order.ActualHandleOrgName,
|
|
|
+ VisitTarget = EVisitTarget.Org
|
|
|
+ };
|
|
|
|
|
|
- if (order is { FileOrgIsCenter: true, CounterSignType: null })
|
|
|
+ if (isReturn == false)
|
|
|
{
|
|
|
- seatDetail.VoiceEvaluate = EVoiceEvaluate.Satisfied;
|
|
|
- seatDetail.SeatEvaluate = ESeatEvaluate.Satisfied;
|
|
|
- order.Visited("4", "满意");
|
|
|
- order.Status = EOrderStatus.Visited;
|
|
|
- await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
+ //order.FocusOnEvents!="7" 2025年4月29日 10:55:38 刘欣 临时新增,如果是旅游件不自动回访
|
|
|
+ if (order is { FileOrgIsCenter: true, CounterSignType: null, IsProvince: false } && order.FocusOnEvents != "7")
|
|
|
+ {
|
|
|
+ var satisfy = new Kv() { Key = "4", Value = "满意" };
|
|
|
+ orgDetail.OrgProcessingResults = satisfy;
|
|
|
+ //orgDetail.OrgHandledAttitude = satisfy;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (order is { FileOrgIsCenter: true, CounterSignType: null })
|
|
|
+ {
|
|
|
+ seatDetail.VoiceEvaluate = EVoiceEvaluate.Satisfied;
|
|
|
+ seatDetail.SeatEvaluate = ESeatEvaluate.Satisfied;
|
|
|
+ order.Visited("4", "满意");
|
|
|
+ order.Status = EOrderStatus.Visited;
|
|
|
+ await _orderRepository.UpdateAsync(order, cancellationToken);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ visitedDetail.Add(orgDetail);
|
|
|
}
|
|
|
|
|
|
- visitedDetail.Add(orgDetail);
|
|
|
+
|
|
|
+
|
|
|
visitedDetail.Add(seatDetail);
|
|
|
|
|
|
await _orderVisitDetailRepository.AddRangeAsync(visitedDetail, cancellationToken);
|
|
@@ -681,29 +701,29 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task TriggerAverageOrder(CancellationToken cancellationToken)
|
|
|
{
|
|
|
- // 增加回收机制 先回收有未处理的工单 再进行平均派单
|
|
|
- //1.从排班里面获取今天上班的人
|
|
|
- //2.获取默认派单员剩下的工单
|
|
|
- //3.平均分配剩下的工单给今天上班的人
|
|
|
- #region 回收机制
|
|
|
- DateTime time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
- var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
-
|
|
|
- var schedulingUsers = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
- .Where(x => x.SchedulingTime!.Value == time && (x.AtWork == null || x.AtWork == false) )
|
|
|
- .Select(x=> new SchedulingUser { UserId = x.SchedulingUser.UserId } )
|
|
|
- .ToListAsync(cancellationToken);
|
|
|
+ // 增加回收机制 先回收有未处理的工单 再进行平均派单
|
|
|
+ //1.从排班里面获取今天上班的人
|
|
|
+ //2.获取默认派单员剩下的工单
|
|
|
+ //3.平均分配剩下的工单给今天上班的人
|
|
|
+ #region 回收机制
|
|
|
+ DateTime time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
+ var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
+
|
|
|
+ var schedulingUsers = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
+ .Where(x => x.SchedulingTime!.Value == time && (x.AtWork == null || x.AtWork == false))
|
|
|
+ .Select(x => new SchedulingUser { UserId = x.SchedulingUser.UserId })
|
|
|
+ .ToListAsync(cancellationToken);
|
|
|
var userIds = schedulingUsers.Select(x => x.UserId).ToList();
|
|
|
- var usersSteps = await _workflowDomainService.GetStepsBelongsDayToAsync(userIds, time, cancellationToken);
|
|
|
+ var usersSteps = await _workflowDomainService.GetStepsBelongsDayToAsync(userIds, time, cancellationToken);
|
|
|
if (usersSteps != null && usersSteps.Any())
|
|
|
{
|
|
|
- await _workflowDomainService.ChangeHandlerBatchAsync(new List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)>
|
|
|
- {
|
|
|
- new(AppDefaults.SendPoolId, "派单池", OrgSeedData.CenterId, OrgSeedData.CenterName,roleId,"派单员", usersSteps)
|
|
|
- }, cancellationToken);
|
|
|
- }
|
|
|
- #endregion
|
|
|
- var schedulings = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
+ await _workflowDomainService.ChangeHandlerBatchAsync(new List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)>
|
|
|
+ {
|
|
|
+ new(AppDefaults.SendPoolId, "派单池", OrgSeedData.CenterId, OrgSeedData.CenterName,roleId,"派单员", usersSteps)
|
|
|
+ }, cancellationToken);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ var schedulings = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
.Where(x => x.SchedulingTime!.Value == time && x.WorkingTime!.Value <= DateTime.Now.TimeOfDay && x.OffDutyTime!.Value >= DateTime.Now.TimeOfDay && x.AtWork == true)
|
|
|
.OrderBy(x => x.SendOrderNum).ToListAsync(cancellationToken);
|
|
|
if (schedulings.Any())
|
|
@@ -750,75 +770,75 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 提前触发平均派单
|
|
|
- /// </summary>
|
|
|
- /// <param name="cancellationToken"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task AdvancedTriggerAverageOrder(CancellationToken cancellationToken)
|
|
|
+ /// <summary>
|
|
|
+ /// 提前触发平均派单
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task AdvancedTriggerAverageOrder(CancellationToken cancellationToken)
|
|
|
{
|
|
|
- //1.从排班里面获取今天上班的人
|
|
|
- //2.获取默认派单员剩下的工单
|
|
|
- //3.平均分配剩下的工单给今天上班的人
|
|
|
- DateTime time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
+ //1.从排班里面获取今天上班的人
|
|
|
+ //2.获取默认派单员剩下的工单
|
|
|
+ //3.平均分配剩下的工单给今天上班的人
|
|
|
+ DateTime time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
DateTime fallsTime = DateTime.Parse("00:00:00");
|
|
|
- var schedulings = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
- .Where(x => x.SchedulingTime!.Value == time && x.WorkingTime!.Value != fallsTime.TimeOfDay && x.OffDutyTime!.Value != fallsTime.TimeOfDay )
|
|
|
- .OrderBy(x => x.SendOrderNum).ToListAsync(cancellationToken);
|
|
|
- var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
- if (schedulings.Any())
|
|
|
- {
|
|
|
- var steps = await _workflowDomainService.GetStepsBelongsToAsync(AppDefaults.SendPoolId,
|
|
|
- cancellationToken);
|
|
|
- if (steps.Any())
|
|
|
- {
|
|
|
- List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)> handlers = new();
|
|
|
- var avg = steps.Count / schedulings.Count;
|
|
|
- var remaining = steps.Count % schedulings.Count;
|
|
|
- var skip = 0;
|
|
|
- for (var i = 0; i < schedulings.Count; i++)
|
|
|
- {
|
|
|
- var scheduling = schedulings[i];
|
|
|
- var size = avg + (i < remaining ? 1 : 0);
|
|
|
- if (size > 0)
|
|
|
- {
|
|
|
- var stSteps = steps.Skip(skip).Take(size).ToList();
|
|
|
-
|
|
|
- handlers.Add(new(
|
|
|
- scheduling.SchedulingUser.UserId,
|
|
|
- scheduling.SchedulingUser.UserName,
|
|
|
- scheduling.SchedulingUser.OrgId,
|
|
|
- scheduling.SchedulingUser.OrgIdName,
|
|
|
- roleId, "派单员",
|
|
|
- stSteps));
|
|
|
- skip += size;
|
|
|
- scheduling.SendOrderNum = scheduling.SendOrderNum.HasValue ? scheduling.SendOrderNum.Value : 0;
|
|
|
- scheduling.SendOrderNum += size;
|
|
|
- await _schedulingRepository.Updateable()
|
|
|
- .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum, AdvancedSendOrderNum = size })
|
|
|
- .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
- await _orderRepository.Updateable().SetColumns(o => new Order()
|
|
|
- {
|
|
|
- CenterToOrgHandlerId = scheduling.SchedulingUser.UserId,
|
|
|
- CenterToOrgHandlerName = scheduling.SchedulingUser.UserName
|
|
|
- })
|
|
|
- .Where(o => stSteps.Any(s => s.ExternalId == o.Id)).ExecuteCommandAsync(cancellationToken);
|
|
|
- }
|
|
|
- }
|
|
|
- if (handlers.Any())
|
|
|
- await _workflowDomainService.ChangeHandlerBatchAsync(handlers, cancellationToken);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 工单校验- 交通类工单
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工单校验 - 交通类工单
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task<OrderValidation> OrderValidation(AddOrderDto dto, CancellationToken cancellationToken)
|
|
|
+ var schedulings = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
+ .Where(x => x.SchedulingTime!.Value == time && x.WorkingTime!.Value != fallsTime.TimeOfDay && x.OffDutyTime!.Value != fallsTime.TimeOfDay)
|
|
|
+ .OrderBy(x => x.SendOrderNum).ToListAsync(cancellationToken);
|
|
|
+ var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
+ if (schedulings.Any())
|
|
|
+ {
|
|
|
+ var steps = await _workflowDomainService.GetStepsBelongsToAsync(AppDefaults.SendPoolId,
|
|
|
+ cancellationToken);
|
|
|
+ if (steps.Any())
|
|
|
+ {
|
|
|
+ List<(string userId, string username, string orgId, string orgName, string? roleId, string? roleName, ICollection<WorkflowStep> steps)> handlers = new();
|
|
|
+ var avg = steps.Count / schedulings.Count;
|
|
|
+ var remaining = steps.Count % schedulings.Count;
|
|
|
+ var skip = 0;
|
|
|
+ for (var i = 0; i < schedulings.Count; i++)
|
|
|
+ {
|
|
|
+ var scheduling = schedulings[i];
|
|
|
+ var size = avg + (i < remaining ? 1 : 0);
|
|
|
+ if (size > 0)
|
|
|
+ {
|
|
|
+ var stSteps = steps.Skip(skip).Take(size).ToList();
|
|
|
+
|
|
|
+ handlers.Add(new(
|
|
|
+ scheduling.SchedulingUser.UserId,
|
|
|
+ scheduling.SchedulingUser.UserName,
|
|
|
+ scheduling.SchedulingUser.OrgId,
|
|
|
+ scheduling.SchedulingUser.OrgIdName,
|
|
|
+ roleId, "派单员",
|
|
|
+ stSteps));
|
|
|
+ skip += size;
|
|
|
+ scheduling.SendOrderNum = scheduling.SendOrderNum.HasValue ? scheduling.SendOrderNum.Value : 0;
|
|
|
+ scheduling.SendOrderNum += size;
|
|
|
+ await _schedulingRepository.Updateable()
|
|
|
+ .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum, AdvancedSendOrderNum = size })
|
|
|
+ .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
+ await _orderRepository.Updateable().SetColumns(o => new Order()
|
|
|
+ {
|
|
|
+ CenterToOrgHandlerId = scheduling.SchedulingUser.UserId,
|
|
|
+ CenterToOrgHandlerName = scheduling.SchedulingUser.UserName
|
|
|
+ })
|
|
|
+ .Where(o => stSteps.Any(s => s.ExternalId == o.Id)).ExecuteCommandAsync(cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (handlers.Any())
|
|
|
+ await _workflowDomainService.ChangeHandlerBatchAsync(handlers, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 工单校验- 交通类工单
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工单校验 - 交通类工单
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<OrderValidation> OrderValidation(AddOrderDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var valid = new OrderValidation { Validation = false, Result = "" };
|
|
|
var hotspot = await _hotspotRepository.GetAsync(dto.HotspotId, cancellationToken);
|
|
@@ -979,10 +999,36 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 查询中心最后一次会签的所有一级部门
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="workFlowId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<List<Kv>> GetCountersignOneOrg(string workFlowId)
|
|
|
+ {
|
|
|
+ //查询最后一次派单组发起的会签
|
|
|
+ var sendStep = await _workflowTraceRepository.Queryable()
|
|
|
+ .Where(p => p.WorkflowId == workFlowId && p.BusinessType == EBusinessType.Send && p.Status == EWorkflowStepStatus.Handled
|
|
|
+ && p.IsStartCountersign == true && !string.IsNullOrEmpty(p.StartCountersignId) && p.ModuleCode == "OrderHandle")
|
|
|
+ .OrderByDescending(p => p.CreationTime)
|
|
|
+ .FirstAsync();
|
|
|
+ //查询当前会签下面已办理的所有一级部门
|
|
|
+ if (sendStep != null)
|
|
|
+ {
|
|
|
+ var orgList = await _workflowTraceRepository.Queryable()
|
|
|
+ .Where(p => p.WorkflowId == workFlowId && p.CountersignPosition == ECountersignPosition.Direct
|
|
|
+ && p.CountersignId == sendStep.StartCountersignId && p.IsStartCountersign == false
|
|
|
+ && p.Status == EWorkflowStepStatus.Handled && p.BusinessType == EBusinessType.Department && p.HandlerOrgId.Length == 6)
|
|
|
+ .Select(p => new Kv(p.HandlerOrgId, p.HandlerOrgName))
|
|
|
+ .ToListAsync();
|
|
|
+ return orgList;
|
|
|
+ }
|
|
|
+ return new List<Kv>();
|
|
|
+ }
|
|
|
|
|
|
- #region private
|
|
|
+ #region private
|
|
|
|
|
|
- private async Task<Order> GetOrderByFlowIdAsync(string workflowId, CancellationToken cancellationToken)
|
|
|
+ private async Task<Order> GetOrderByFlowIdAsync(string workflowId, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(workflowId))
|
|
|
throw UserFriendlyException.SameMessage("无效流程编号");
|