|
@@ -59,6 +59,7 @@ using Hotline.Share.Requests;
|
|
|
using Hotline.Share.Tools;
|
|
|
using Hotline.Snapshot;
|
|
|
using Hotline.Snapshot.IRepository;
|
|
|
+using Hotline.Special;
|
|
|
using Hotline.Tools;
|
|
|
using Hotline.Users;
|
|
|
using Hotline.Validators.FlowEngine;
|
|
@@ -1561,6 +1562,10 @@ public class OrderController : BaseController
|
|
|
dto.CallId = await _callApplication.PublishVisitRelevanceCallIdAsync(dto.Adapt<OrderRelevanceCallIdDto>(), HttpContext.RequestAborted);
|
|
|
dto.CallId = await _callApplication.GetOrSetCallIdAsync(dto.CallId, HttpContext.RequestAborted);
|
|
|
await _orderApplication.SaveOrderVisit(dto, HttpContext.RequestAborted);
|
|
|
+ if (dto.IsTransact.HasValue && dto.IsTransact.Value)
|
|
|
+ {
|
|
|
+ await Add(dto.OrderReTransact);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -3410,29 +3415,38 @@ public class OrderController : BaseController
|
|
|
|
|
|
if (_appOptions.Value.IsZiGong)
|
|
|
{
|
|
|
- await _workflowDomainService.PreviousAsync(dto,
|
|
|
- newStepConfig: (workflow, currentStep, prevStepDefine, prevStep, newPrevStep) =>
|
|
|
- {
|
|
|
- if (prevStepDefine.BusinessType is EBusinessType.Department)
|
|
|
- {
|
|
|
- newPrevStep.FlowAssignType = EFlowAssignType.Org;
|
|
|
- }
|
|
|
- else if (prevStepDefine.HandlerType is EHandlerType.Role)
|
|
|
- {
|
|
|
- newPrevStep.Assign(
|
|
|
- new StepAssignInfo
|
|
|
- {
|
|
|
- FlowAssignType = EFlowAssignType.Role,
|
|
|
- RoleId = prevStepDefine.HandlerTypeItems[0].Key,
|
|
|
- RoleName = prevStepDefine.HandlerTypeItems[0].Value
|
|
|
- });
|
|
|
- }
|
|
|
- else
|
|
|
+ //退回至申请人
|
|
|
+ if (dto.IsRecallToStartStep)
|
|
|
+ {
|
|
|
+ await _workflowDomainService.RecallToStartStepAsync(dto.WorkflowId, dto.Opinion, null, false, EHandleMode.Previous, EFlowAssignType.User,
|
|
|
+ cancellationToken: HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await _workflowDomainService.PreviousAsync(dto,
|
|
|
+ newStepConfig: (workflow, currentStep, prevStepDefine, prevStep, newPrevStep) =>
|
|
|
{
|
|
|
- newPrevStep.FlowAssignType = prevStep.FlowAssignType;
|
|
|
- }
|
|
|
- },
|
|
|
- cancellationToken: HttpContext.RequestAborted);
|
|
|
+ if (prevStepDefine.BusinessType is EBusinessType.Department)
|
|
|
+ {
|
|
|
+ newPrevStep.FlowAssignType = EFlowAssignType.Org;
|
|
|
+ }
|
|
|
+ else if (prevStepDefine.HandlerType is EHandlerType.Role)
|
|
|
+ {
|
|
|
+ newPrevStep.Assign(
|
|
|
+ new StepAssignInfo
|
|
|
+ {
|
|
|
+ FlowAssignType = EFlowAssignType.Role,
|
|
|
+ RoleId = prevStepDefine.HandlerTypeItems[0].Key,
|
|
|
+ RoleName = prevStepDefine.HandlerTypeItems[0].Value
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ newPrevStep.FlowAssignType = prevStep.FlowAssignType;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cancellationToken: HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -4323,9 +4337,19 @@ public class OrderController : BaseController
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
|
|
|
.Select(d => new OrderHistoryOutDto
|
|
|
{
|
|
|
+ Id = d.Id,
|
|
|
+ Title = d.Title,
|
|
|
+ No = d.No,
|
|
|
+ CurrentStepName = d.CurrentStepName,
|
|
|
+ CreationTime = d.CreationTime,
|
|
|
+ ActualHandleOrgName = d.ActualHandleOrgName,
|
|
|
+ Status = d.Status,
|
|
|
IsScreen = d.OrderScreens.Any(x => x.Status == EScreenStatus.End),
|
|
|
- TerminateStatus = d.OrderTerminates.OrderByDescending(p => p.CreationTime).Select(p => p.Status).FirstOrDefault()
|
|
|
- }, true)
|
|
|
+ IsTerminate = d.OrderTerminates.Any(p => p.Status == ETerminateStatus.End),
|
|
|
+ //TerminateStatus = SqlFunc.Subqueryable<OrderTerminate>().Where(s => s.OrderId == d.Id).OrderByDesc(s => s.CreationTime).Select(s => s.Status)
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .OrderByIF(_appOptions.Value.IsZiGong, d => d.IsTerminate, OrderByType.Desc)
|
|
|
.OrderByDescending(d => d.CreationTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<OrderHistoryOutDto>(total, _mapper.Map<IReadOnlyList<OrderHistoryOutDto>>(items));
|
|
@@ -4749,16 +4773,14 @@ public class OrderController : BaseController
|
|
|
//工单保存特殊身份验证
|
|
|
var specialIdentityVerification =
|
|
|
bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.SpecialIdentityVerification).SettingValue[0]);
|
|
|
+ var specialNumber = await _specialNumberRepository.GetAsync(p => p.PhoneNumber == dto.FromPhone, HttpContext.RequestAborted);
|
|
|
if (specialIdentityVerification)
|
|
|
{
|
|
|
- var specialNumber = await _specialNumberRepository.GetAsync(p => p.PhoneNumber == dto.FromPhone, HttpContext.RequestAborted);
|
|
|
if (specialNumber != null && specialNumber.PoliticalIdentityValue == "1")
|
|
|
{
|
|
|
- if (dto.OrderPushTypes == null || dto.OrderPushTypes.Count() == 0)
|
|
|
+ if (dto.OrderPushTypes == null || dto.OrderPushTypes.Count() == 0 || dto.OrderPushTypes.Exists(p => p.PushTypeCode == "9") == false)
|
|
|
throw UserFriendlyException.SameMessage("人大代表来电,请选择推送分类人大代表意见快办!");
|
|
|
|
|
|
- if (dto.OrderPushTypes.Exists(p => p.PushTypeCode == "9") == false)
|
|
|
- throw UserFriendlyException.SameMessage("人大代表来电,请选择推送分类人大代表意见快办!");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -4801,6 +4823,11 @@ public class OrderController : BaseController
|
|
|
var order = _mapper.Map<Orders.Order>(dto);
|
|
|
order.SignerId = _sessionContext.UserId;
|
|
|
order.SignerName = _sessionContext.UserName;
|
|
|
+ if (specialNumber != null)
|
|
|
+ {
|
|
|
+ order.PoliticalIdentityValue = specialNumber.PoliticalIdentityValue;
|
|
|
+ order.PoliticalIdentityName = specialNumber.PoliticalIdentityName;
|
|
|
+ }
|
|
|
order.InitId();
|
|
|
if (dto.Files.Any())
|
|
|
order.FileJson = await _fileRepository.AddFileAsync(dto.Files, order.Id, "", HttpContext.RequestAborted);
|
|
@@ -5009,15 +5036,12 @@ public class OrderController : BaseController
|
|
|
//工单保存特殊身份验证
|
|
|
var specialIdentityVerification =
|
|
|
bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.SpecialIdentityVerification).SettingValue[0]);
|
|
|
+ var specialNumber = await _specialNumberRepository.GetAsync(p => p.PhoneNumber == dto.FromPhone, HttpContext.RequestAborted);
|
|
|
if (specialIdentityVerification)
|
|
|
{
|
|
|
- var specialNumber = await _specialNumberRepository.GetAsync(p => p.PhoneNumber == dto.FromPhone, HttpContext.RequestAborted);
|
|
|
if (specialNumber != null && specialNumber.PoliticalIdentityValue == "1")
|
|
|
{
|
|
|
- if (dto.OrderPushTypes == null || dto.OrderPushTypes.Count() == 0)
|
|
|
- throw UserFriendlyException.SameMessage("人大代表来电,请选择推送分类人大代表意见快办!");
|
|
|
-
|
|
|
- if (dto.OrderPushTypes.Exists(p => p.PushTypeCode == "9") == false)
|
|
|
+ if (dto.OrderPushTypes == null || dto.OrderPushTypes.Count() == 0 || dto.OrderPushTypes.Exists(p => p.PushTypeCode == "9") == false)
|
|
|
throw UserFriendlyException.SameMessage("人大代表来电,请选择推送分类人大代表意见快办!");
|
|
|
}
|
|
|
}
|
|
@@ -5068,6 +5092,7 @@ public class OrderController : BaseController
|
|
|
copy.AuditTime = DateTime.Now;
|
|
|
copy.AuditUserId = _sessionContext.UserId;
|
|
|
copy.AuditUserName = _sessionContext.UserName;
|
|
|
+ copy.AuditSource = dto.IsEdit ? EOrderUpdateSource.Alter : EOrderUpdateSource.Accepted;
|
|
|
copy.InitId();
|
|
|
await _orderCopyRepository.AddAsync(copy, HttpContext.RequestAborted);
|
|
|
|
|
@@ -5093,6 +5118,12 @@ public class OrderController : BaseController
|
|
|
if (order.SourceChannelCode != AppDefaults.SourceChannel.DianHua)
|
|
|
order.CallId = null;
|
|
|
|
|
|
+ if (specialNumber != null)
|
|
|
+ {
|
|
|
+ order.PoliticalIdentityValue = specialNumber.PoliticalIdentityValue;
|
|
|
+ order.PoliticalIdentityName = specialNumber.PoliticalIdentityName;
|
|
|
+ }
|
|
|
+
|
|
|
if (dto.IsEdit && !string.IsNullOrEmpty(dto.CenterOpinion) && order.CenterToOrgOpinion != dto.CenterOpinion)
|
|
|
order.CenterToOrgOpinion = dto.CenterOpinion;
|
|
|
if (dto.IsEdit && !string.IsNullOrEmpty(dto.FileOpinion) && order.FileOpinion != dto.FileOpinion)
|
|
@@ -5545,14 +5576,12 @@ public class OrderController : BaseController
|
|
|
// 宜宾需求: 1.是否是派单节点 2.是否存在历史派单节点 3.存在获取上个派单节点 4.不存在走平均派单 过滤历史派单节点不为派单池
|
|
|
if (_appOptions.Value.IsYiBin || _appOptions.Value.IsZiGong)
|
|
|
{
|
|
|
- var sendOrderTraces =
|
|
|
- workflow.Traces.Where(x => x.BusinessType == EBusinessType.Send && x.HandlerId != AppDefaults.SendPoolId);
|
|
|
- if (sendOrderTraces.Any())
|
|
|
+ var sendOrderTrace = workflow.Traces
|
|
|
+ .Where(x => x.BusinessType == EBusinessType.Send && x.HandlerId != AppDefaults.SendPoolId)
|
|
|
+ .MaxBy(x => x.CreationTime);
|
|
|
+ if (sendOrderTrace is not null)
|
|
|
{
|
|
|
- var sendOrderTrace = workflow.Traces
|
|
|
- .Where(x => x.BusinessType == EBusinessType.Send && x.HandlerId != AppDefaults.SendPoolId)
|
|
|
- .OrderByDescending(x => x.CreationTime)
|
|
|
- .FirstOrDefault();
|
|
|
+ //todo
|
|
|
nextDto.NextHandlers = new List<StepAssignInfo>
|
|
|
{
|
|
|
new()
|
|
@@ -5763,11 +5792,11 @@ public class OrderController : BaseController
|
|
|
|
|
|
private async Task AverageSendOrderAsync(NextWorkflowDto nextDto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- // 平均派单
|
|
|
- var averageSendOrder = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.AverageSendOrder).SettingValue[0]);
|
|
|
- if (averageSendOrder)
|
|
|
+ if (!nextDto.NextHandlers.Any())
|
|
|
{
|
|
|
- if (!nextDto.NextHandlers.Any())
|
|
|
+ // 平均派单
|
|
|
+ var averageSendOrder = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.AverageSendOrder).SettingValue[0]);
|
|
|
+ if (averageSendOrder)
|
|
|
{
|
|
|
var handler = await _orderDomainService.AverageOrder(cancellationToken);
|
|
|
nextDto.NextHandlers = new List<StepAssignInfo> { handler };
|
|
@@ -5926,7 +5955,8 @@ public class OrderController : BaseController
|
|
|
CurrentStepOptions = definition?.Steps.Select(x => new Kv(x.Code, x.Name)),
|
|
|
IdentityTypeOptions = EnumExts.GetDescriptions<EIdentityType>(),
|
|
|
OrderTags = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.OrderTag),
|
|
|
- FocusOnEvents = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.FocusOnEvent)
|
|
|
+ FocusOnEvents = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.FocusOnEvent),
|
|
|
+ PoliticalIdentity = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.PoliticalIdentity)
|
|
|
};
|
|
|
return rsp;
|
|
|
}
|
|
@@ -9498,6 +9528,7 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
var (total, items) = await _orderCopyRepository.Queryable()
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.No.Contains(dto.Keyword!))
|
|
|
+ .WhereIF(_appOptions.Value.IsLuZhou, x => x.AuditSource == EOrderUpdateSource.Alter)
|
|
|
.OrderByDescending(x => x.CreationTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|