|
@@ -29,6 +29,8 @@ using Hotline.Share.Dtos.Enterprise;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
using Hotline.Share.Dtos.Order;
|
|
|
+using Hotline.Share.Dtos.Order.Migration;
|
|
|
+using Hotline.Share.Dtos.Order.Publish;
|
|
|
using Hotline.Share.Dtos.Settings;
|
|
|
using Hotline.Share.Enums.CallCenter;
|
|
|
using Hotline.Share.Enums.FlowEngine;
|
|
@@ -44,7 +46,9 @@ using MapsterMapper;
|
|
|
using MediatR;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.OpenApi.Writers;
|
|
|
using MiniExcelLibs;
|
|
|
+using MongoDB.Driver;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.SS.Util;
|
|
|
using Org.BouncyCastle.Utilities;
|
|
@@ -247,12 +251,12 @@ public class OrderController : BaseController
|
|
|
var (total, items) = await _orderRepository.Queryable()
|
|
|
.Includes(d => d.OrderPublish)
|
|
|
.Where(x => x.Status == EOrderStatus.Filed)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- d => d.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.StartsWith(dto.Keyword!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No == dto.No)
|
|
|
.WhereIF(dto.PubState == EPubState.Pub, d => d.Status >= EOrderStatus.Published)
|
|
|
.WhereIF(dto.PubState == EPubState.NoPub, d => d.Status < EOrderStatus.Published)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.PubMan),
|
|
|
- d => d.AcceptorName.Contains(dto.PubMan!) || d.AcceptorStaffNo.Contains(dto.PubMan!))
|
|
|
+ //.WhereIF(!string.IsNullOrEmpty(dto.PubMan),
|
|
|
+ // d => d.AcceptorName.Contains(dto.PubMan!) || d.AcceptorStaffNo.Contains(dto.PubMan!))
|
|
|
.WhereIF(dto.PubRange == EPublicState.Pub, d => d.OrderPublish.PublishState)
|
|
|
.WhereIF(dto.PubRange == EPublicState.NoPub, d => !d.OrderPublish.PublishState)
|
|
|
.WhereIF(dto.FiledType != null && dto.FiledType == FiledType.CenterFiled, d => d.ProcessType == EProcessType.Zhiban)
|
|
@@ -266,6 +270,7 @@ public class OrderController : BaseController
|
|
|
.WhereIF(dto.CreationTimeEnd.HasValue, d => d.CreationTime <= dto.CreationTimeEnd)
|
|
|
.WhereIF(dto.FiledTimeStart.HasValue, d => d.OrderPublish.CreationTime >= dto.CreationTimeStart)
|
|
|
.WhereIF(dto.FiledTimeEnd.HasValue, d => d.OrderPublish.CreationTime <= dto.CreationTimeEnd)
|
|
|
+ .WhereIF(dto.QuerySelf.HasValue && dto.QuerySelf.Value, d => d.WaitForPublisherId == _sessionContext.RequiredUserId)
|
|
|
.OrderByDescending(d => d.FiledTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
|
|
@@ -377,10 +382,7 @@ public class OrderController : BaseController
|
|
|
throw UserFriendlyException.SameMessage("未找到工单,无法发布");
|
|
|
|
|
|
//新增发布工单
|
|
|
-
|
|
|
-
|
|
|
var orderPublish = _mapper.Map<OrderPublish>(dto);
|
|
|
-
|
|
|
orderPublish.OrderId = order.Id;
|
|
|
orderPublish.No = order.No;
|
|
|
|
|
@@ -399,6 +401,7 @@ public class OrderController : BaseController
|
|
|
orderVisit.VisitState = EVisitState.WaitForVisit;
|
|
|
orderVisit.PublishTime = DateTime.Now;
|
|
|
orderVisit.IsCanHandle = true;
|
|
|
+ orderVisit.EmployeeId = _sessionContext.RequiredUserId;
|
|
|
|
|
|
if (order is { ProcessType: EProcessType.Zhiban, CounterSignType: null })
|
|
|
{
|
|
@@ -553,7 +556,10 @@ public class OrderController : BaseController
|
|
|
[LogFilter("修改发布内容")]
|
|
|
public async Task PublishedModify([FromBody] PublishOrderModifyDto dto)
|
|
|
{
|
|
|
- var publishOrder = await _orderPublishRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ var publishOrder = await _orderPublishRepository.Queryable()
|
|
|
+ .Includes(x=>x.Order)
|
|
|
+ .Where(x => x.Id == dto.Id)
|
|
|
+ .FirstAsync(HttpContext.RequestAborted);
|
|
|
|
|
|
if (publishOrder is null)
|
|
|
{
|
|
@@ -567,6 +573,8 @@ public class OrderController : BaseController
|
|
|
history.ArrangeContentAfter = dto.ArrangeContent;
|
|
|
history.ArrangeOpinionBefor = publishOrder.ArrangeOpinion;
|
|
|
history.ArrangeOpinionAfter = dto.ArrangeOpinion;
|
|
|
+ history.PublishStateBefor = publishOrder.PublishState;
|
|
|
+ history.PublishStateAfter = dto.PublishState;
|
|
|
history.No = publishOrder.No;
|
|
|
history.OrderId = publishOrder.OrderId;
|
|
|
history.OrderPublishId = publishOrder.Id;
|
|
@@ -575,9 +583,15 @@ public class OrderController : BaseController
|
|
|
publishOrder.ArrangeTitle = dto.ArrangeTitle;
|
|
|
publishOrder.ArrangeContent = dto.ArrangeContent;
|
|
|
publishOrder.ArrangeOpinion = dto.ArrangeOpinion;
|
|
|
+ publishOrder.PublishState = dto.PublishState;
|
|
|
|
|
|
await _orderPublishRepository.UpdateAsync(publishOrder, HttpContext.RequestAborted);
|
|
|
await _orderPublishHistoryRepository.AddAsync(history, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ //推省上
|
|
|
+ var publishPublishOrder = _mapper.Map<PublishPublishOrderDto>(publishOrder);
|
|
|
+ publishPublishOrder.Order = _mapper.Map<OrderDto>(publishOrder.Order);
|
|
|
+ await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderPublishOrder, publishPublishOrder);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -592,6 +606,46 @@ public class OrderController : BaseController
|
|
|
.OrderByDescending(x => x.CreationTime).ToListAsync(HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 查询发布平移待办理人
|
|
|
+ /// </summary>
|
|
|
+ [HttpGet("published/migration")]
|
|
|
+ public async Task<IReadOnlyList<OrderMigrationHandler>> PublishMigration()
|
|
|
+ {
|
|
|
+ var setting = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan);
|
|
|
+ var roles = setting?.SettingValue.ToList();
|
|
|
+ var users = await _userRepository.Queryable()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .Includes(d => d.Roles)
|
|
|
+ .Where(d => d.Roles.Any(x => roles.Contains(x.Name)))
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ return users.Select(d => new OrderMigrationHandler
|
|
|
+ {
|
|
|
+ UserId = d.Id,
|
|
|
+ Username = d.Name,
|
|
|
+ OrgId = d.OrgId,
|
|
|
+ OrgName = d.Organization.Name,
|
|
|
+ RoleNames = string.Join(',', d.Roles.Select(x => x.DisplayName).ToList())
|
|
|
+ }).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 发布平移
|
|
|
+ /// </summary>
|
|
|
+ [HttpPost("publish/migration")]
|
|
|
+ public async Task PublishMigrationBatch([FromBody] PublishMigrationDto dto)
|
|
|
+ {
|
|
|
+ var orders = await _orderRepository.Queryable()
|
|
|
+ .Where(d => dto.OrderIds.Contains(d.Id) && d.Status == EOrderStatus.Filed)
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ foreach (var order in orders)
|
|
|
+ {
|
|
|
+ order.WaitForPublisherId = dto.UserId;
|
|
|
+ }
|
|
|
+
|
|
|
+ await _orderRepository.UpdateRangeAsync(orders, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 工单回访
|
|
@@ -609,18 +663,18 @@ public class OrderController : BaseController
|
|
|
.Includes(x => x.Employee)
|
|
|
.Includes(x => x.OrderVisitDetails)
|
|
|
.WhereIF(dto.VisitState == EVisitStateQuery.NoVisit,
|
|
|
- x => (x.VisitState == Share.Enums.Order.EVisitState.WaitForVisit ||
|
|
|
- x.VisitState == Share.Enums.Order.EVisitState.NoSatisfiedWaitForVisit) &&
|
|
|
+ x => (x.VisitState == EVisitState.WaitForVisit ||
|
|
|
+ x.VisitState == EVisitState.NoSatisfiedWaitForVisit) &&
|
|
|
x.Order.IsProvince == false)
|
|
|
- .WhereIF(dto.VisitState == EVisitStateQuery.Visited,
|
|
|
- x => x.VisitState == Share.Enums.Order.EVisitState.Visited)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- x => x.Order.Title.Contains(dto.Keyword!) || x.Order.No.Contains(dto.Keyword!))
|
|
|
+ .WhereIF(dto.VisitState == EVisitStateQuery.Visited, x => x.VisitState == EVisitState.Visited)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.Order.Title.StartsWith(dto.Keyword!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No == dto.No)
|
|
|
.WhereIF(dto.VisitType != null, x => x.VisitType == dto.VisitType)
|
|
|
.WhereIF(dto.FiledType != null && dto.FiledType == FiledType.CenterFiled, d => d.Order.ProcessType == EProcessType.Zhiban)
|
|
|
.WhereIF(dto.FiledType != null && dto.FiledType == FiledType.OrgFiled, d => d.Order.ProcessType == EProcessType.Jiaoban)
|
|
|
.WhereIF(dto.IsCountersign != null && dto.IsCountersign == true, d => d.Order.CounterSignType != null)
|
|
|
.WhereIF(dto.IsCountersign != null && dto.IsCountersign == false, d => d.Order.CounterSignType == null)
|
|
|
+ .WhereIF(dto.QuerySelf.HasValue && dto.QuerySelf.Value, d => d.EmployeeId == _sessionContext.RequiredUserId)
|
|
|
.OrderByDescending(x => x.PublishTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<OrderVisitDto>(total, _mapper.Map<IReadOnlyList<OrderVisitDto>>(items));
|
|
@@ -640,8 +694,6 @@ public class OrderController : BaseController
|
|
|
return rsp;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 回访详情
|
|
|
/// </summary>
|
|
@@ -720,7 +772,6 @@ public class OrderController : BaseController
|
|
|
return new PagedDto<OrderVisitDetailDto>(total, _mapper.Map<IReadOnlyList<OrderVisitDetailDto>>(items));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 回访保存
|
|
|
/// </summary>
|
|
@@ -769,7 +820,13 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
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;
|
|
|
+ }
|
|
|
//_mapper.Map(dto.VisitDetails,visit.OrderVisitDetails);
|
|
|
for (int i = 0; i < visit.OrderVisitDetails.Count; i++)
|
|
|
{
|
|
@@ -835,29 +892,80 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 批量分配回访人员
|
|
|
+ /// 扭转列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("visit/judge-query")]
|
|
|
+ public async Task<PagedDto<OrderVisitDto>> VisitJudgeQuery([FromQuery] VisitJudgeQueryReq dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderVisitRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Employee)
|
|
|
+ .Where(x => x.VisitState == EVisitState.Visited)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.No == dto.No)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.VisitUserName), x => x.Employee.Name.Contains(dto.VisitUserName))
|
|
|
+ .WhereIF(dto.AcceptTypes.Any(), d => dto.AcceptTypes.Contains(d.Order.AcceptTypeCode)) //受理类型
|
|
|
+ .WhereIF(dto.HotspotIds.Any(), d => dto.HotspotIds.Contains(d.Order.HotspotId)) //热点类型
|
|
|
+ .WhereIF(dto.OrgCodes.Any(), d => dto.OrgCodes.Contains(d.Order.ActualHandleOrgCode)) //接办部门
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.NameOrNo), d => d.Order.AcceptorName.Contains(dto.NameOrNo!) || d.Order.AcceptorStaffNo.Contains(dto.NameOrNo!)) //受理人/坐席
|
|
|
+ .WhereIF(dto.CreationTimeStart.HasValue, d => d.CreationTime >= dto.CreationTimeStart) //受理时间开始
|
|
|
+ .WhereIF(dto.CreationTimeEnd.HasValue, d => d.CreationTime <= dto.CreationTimeEnd) //受理时间结束
|
|
|
+ .WhereIF(dto.ActualHandleTimeStart.HasValue, d => d.Order.ActualHandleTime >= dto.ActualHandleTimeStart) //办结时间开始
|
|
|
+ .WhereIF(dto.ActualHandleTimeEnd.HasValue, d => d.Order.ActualHandleTime <= dto.ActualHandleTimeEnd) //办结时间结束
|
|
|
+ .WhereIF(dto.VisitTimeStart.HasValue, d => d.VisitTime >= dto.VisitTimeStart) //回访开始时间
|
|
|
+ .WhereIF(dto.VisitTimeEnd.HasValue, d => d.VisitTime <= dto.VisitTimeEnd)
|
|
|
+ .WhereIF(dto.IsIng == true, d => d.JudgeState == EJudgeState.Judging)
|
|
|
+ .WhereIF(dto.IsIng == false, d => d.JudgeState != EJudgeState.Judging)
|
|
|
+ .WhereIF(dto.JudgeState != null, d => d.JudgeState == dto.JudgeState)
|
|
|
+ .WhereIF(dto.OrgJudge != null, d => d.OrgJudge == dto.OrgJudge)
|
|
|
+ .WhereIF(dto.SeatJudge != null, d => d.SeatJudge == dto.SeatJudge)
|
|
|
+ .OrderByDescending(x => x.VisitTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderVisitDto>(total, _mapper.Map<IReadOnlyList<OrderVisitDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 扭转满意度
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- [HttpPost("visit/distribution")]
|
|
|
- public async Task<DistributionVisitRspDto> DistributionVisit([FromBody] DistributionVisitDto dto)
|
|
|
+ [HttpPost("visit/judge")]
|
|
|
+ public async Task<JudgeVisitRsp> JudgeVisit([FromBody] JudgeVisitReq dto)
|
|
|
{
|
|
|
int error = 0;
|
|
|
- foreach (var id in dto.Ids)
|
|
|
+ var list = await _orderVisitRepository.Queryable().Where(x => dto.Ids.Contains(x.Id) && x.VisitState == EVisitState.Visited).ToListAsync(HttpContext.RequestAborted);
|
|
|
+ list.ForEach(visit =>
|
|
|
{
|
|
|
- var visit = await _orderVisitRepository.Queryable().FirstAsync(d => d.Id == id, HttpContext.RequestAborted);
|
|
|
- if (visit != null && visit.VisitState == EVisitState.WaitForVisit)
|
|
|
- {
|
|
|
- visit.EmployeeId = dto.EmployeeId;
|
|
|
- await _orderVisitRepository.UpdateAsync(visit, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- error++;
|
|
|
- }
|
|
|
+ visit.JudgeState = dto.IsAgree ? EJudgeState.Agreed : EJudgeState.UnAgreed;
|
|
|
+ visit.JudgeUserId = _sessionContext.RequiredUserId;
|
|
|
+ visit.JudgeUserName = _sessionContext.UserName;
|
|
|
+ visit.JudgeTime = DateTime.Now;
|
|
|
+ visit.JudgeContent = dto.JudgeContent;
|
|
|
+ });
|
|
|
+ await _orderVisitRepository.UpdateRangeAsync(list, HttpContext.RequestAborted);
|
|
|
+ return new JudgeVisitRsp() { ErrorCount = error, SuccessCount = dto.Ids.Count - error };
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 回访平移
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("visit/migration")]
|
|
|
+ public async Task VisitMigrationBatch([FromBody] DistributionVisitDto dto)
|
|
|
+ {
|
|
|
+ var visits = await _orderVisitRepository.Queryable()
|
|
|
+ .Where(d => d.VisitState == EVisitState.WaitForVisit && dto.Ids.Contains(d.Id))
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ foreach (var visit in visits)
|
|
|
+ {
|
|
|
+ visit.EmployeeId = dto.EmployeeId;
|
|
|
}
|
|
|
|
|
|
- return new DistributionVisitRspDto() { ErrorCount = error, SuccessCount = dto.Ids.Count - error };
|
|
|
+ await _orderVisitRepository.UpdateRangeAsync(visits, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -2266,6 +2374,7 @@ public class OrderController : BaseController
|
|
|
var order = await _orderRepository.Queryable()
|
|
|
.Includes(d => d.OrderExtension)
|
|
|
.Includes(d => d.OrderDelays)
|
|
|
+ .Includes(d=> d.OrderPublish)
|
|
|
//.Includes(d => d.OrderScreens)
|
|
|
.Includes(d => d.OrderVisits, x => x.OrderVisitDetails)
|
|
|
.Includes(d => d.OrderVisits, x => x.Employee)
|
|
@@ -2331,6 +2440,11 @@ public class OrderController : BaseController
|
|
|
|
|
|
//dto.CanPrevious = canPrevious;
|
|
|
|
|
|
+ if (order.OrderPublish!=null)
|
|
|
+ {
|
|
|
+ dto.PublishState = order.OrderPublish.PublishState;
|
|
|
+ }
|
|
|
+
|
|
|
if (dto.FileJson != null && dto.FileJson.Any())
|
|
|
{
|
|
|
var ids = order.FileJson.Select(x => x.Id).ToList();
|
|
@@ -2696,20 +2810,24 @@ public class OrderController : BaseController
|
|
|
ExpiredTime = timeResult.EndTime,
|
|
|
NearlyExpiredTime = timeResult.NearlyExpiredTime
|
|
|
};
|
|
|
+ var canUpdateOrderSender = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.CanUpdateOrderSender).SettingValue[0]);
|
|
|
order.CenterToOrg(
|
|
|
expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
|
|
|
expiredTimeConfig.NearlyExpiredTime, dto.Opinion,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName);
|
|
|
+ _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
+ canUpdateOrderSender);
|
|
|
}
|
|
|
else if (dto.FlowDirection is EFlowDirection.CenterToOrg)
|
|
|
{
|
|
|
expiredTimeConfig = _timeLimitDomainService.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.AcceptTypeCode);
|
|
|
+ var canUpdateOrderSender = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.CanUpdateOrderSender).SettingValue[0]);
|
|
|
order.CenterToOrg(
|
|
|
expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime,
|
|
|
expiredTimeConfig.NearlyExpiredTime, dto.Opinion,
|
|
|
- _sessionContext.RequiredUserId, _sessionContext.UserName);
|
|
|
+ _sessionContext.RequiredUserId, _sessionContext.UserName,
|
|
|
+ canUpdateOrderSender);
|
|
|
//写入质检
|
|
|
await _qualityApplication.AddQualityAsync(EQualitySource.Send, order.Id, HttpContext.RequestAborted);
|
|
|
}
|
|
@@ -5409,4 +5527,50 @@ public class OrderController : BaseController
|
|
|
return _mapper.Map<IReadOnlyList<OrderModifyingRecordsDto>>(list);
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region 工单平移
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查询工单平移待办理人
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("migration/{orderId}")]
|
|
|
+ public async Task<GetOrderMigrationDto> Migration(string orderId)
|
|
|
+ {
|
|
|
+ var steps = await _workflowStepRepository.Queryable()
|
|
|
+ .Where(d => d.ExternalId == orderId && d.Status != EWorkflowStepStatus.Handled)
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ if (!steps.Any())
|
|
|
+ throw new UserFriendlyException("未查询到待办理节点");
|
|
|
+ if (steps.Count > 1)
|
|
|
+ throw new UserFriendlyException("多个待办理节点暂不支持平移");
|
|
|
+ var step = steps.First();
|
|
|
+ if (step.BusinessType is not EBusinessType.Center and not EBusinessType.Send)
|
|
|
+ throw UserFriendlyException.SameMessage("当前办理节点非中心暂不支持平移");
|
|
|
+
|
|
|
+ var setting = step.BusinessType is EBusinessType.Center
|
|
|
+ ? _systemSettingCacheManager.GetSetting(SettingConstants.RoleZuoXi)
|
|
|
+ : _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan);
|
|
|
+ var roles = setting?.SettingValue.ToList();
|
|
|
+ var users = await _userRepository.Queryable()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .Includes(d => d.Roles)
|
|
|
+ .Where(d => d.Roles.Any(x => roles.Contains(x.Name)))
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ return new GetOrderMigrationDto
|
|
|
+ {
|
|
|
+ StepId = step.Id,
|
|
|
+ Handlers = users.Select(d => new OrderMigrationHandler
|
|
|
+ {
|
|
|
+ UserId = d.Id,
|
|
|
+ Username = d.Name,
|
|
|
+ OrgId = d.OrgId,
|
|
|
+ OrgName = d.Organization.Name,
|
|
|
+ RoleNames = string.Join(',', d.Roles.Select(x => x.DisplayName).ToList())
|
|
|
+ }).ToList()
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|