|
@@ -63,6 +63,7 @@ using XF.Domain.Entities;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
using XF.Utility.EnumExtensions;
|
|
|
+using static NPOI.SS.Format.CellNumberFormatter;
|
|
|
|
|
|
namespace Hotline.Api.Controllers;
|
|
|
|
|
@@ -132,7 +133,7 @@ public class OrderController : BaseController
|
|
|
private readonly ICalcExpireTime _expireTime;
|
|
|
private readonly IRepository<OrderPushType> _orderPushTypeRepository;
|
|
|
|
|
|
- public OrderController(
|
|
|
+ public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
@@ -253,7 +254,7 @@ public class OrderController : BaseController
|
|
|
_expireTime = expireTime;
|
|
|
_orderPushTypeRepository = orderPushTypeRepository;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 工单发布
|
|
@@ -603,7 +604,7 @@ public class OrderController : BaseController
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 已发布列表
|
|
|
/// </summary>
|
|
@@ -962,7 +963,7 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
|
|
|
//_mapper.Map(dto.VisitDetails,visit.OrderVisitDetails);
|
|
|
- for (int i = 0; i < visit.OrderVisitDetails.Count; i++)
|
|
|
+ for (int i = 0;i < visit.OrderVisitDetails.Count;i++)
|
|
|
{
|
|
|
var detail = visit.OrderVisitDetails[i];
|
|
|
var detaildto = dto.VisitDetails.FirstOrDefault(x => x.Id == detail.Id);
|
|
@@ -1770,7 +1771,9 @@ public class OrderController : BaseController
|
|
|
.Includes(x => x.OrderVisit, y => y.Employee)
|
|
|
//.LeftJoin<OrderScreen>((x, s) => x.Id == s.VisitDetailId && s.IsDeleted == false)
|
|
|
.Includes(x => x.OrderScreens)
|
|
|
- .Where(x => x.OrderScreens.Any(s => s.Status == EScreenStatus.SendBack && s.SendBackApply == true) || x.OrderScreens.Any(s => (s.Status != EScreenStatus.SendBack && s.SendBackApply != true)) == false)
|
|
|
+ .Where(x => x.OrderScreens.Any(s => s.Status == EScreenStatus.SendBack && s.SendBackApply == true) || x.OrderScreens.Any() == false
|
|
|
+ //|| x.OrderScreens.Any(s => (s.Status != EScreenStatus.SendBack && s.SendBackApply != true)) == false
|
|
|
+ )
|
|
|
.WhereIF(dto.ScreenSendBack is 1, x => x.OrderScreens.Any(s => s.Status == EScreenStatus.SendBack && s.SendBackApply == true))
|
|
|
.WhereIF(dto.ScreenSendBack is 2, x => x.OrderScreens.Any(s => (s.Status != EScreenStatus.SendBack && s.SendBackApply != true)) == false)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderVisit.Order!.No!.Contains(dto.No!))
|
|
@@ -1967,7 +1970,7 @@ public class OrderController : BaseController
|
|
|
try
|
|
|
{
|
|
|
//二次回访会改写数据
|
|
|
- await _orderRepository.OrderScreenRevisionVisit(visit.Id, false, HttpContext.RequestAborted);
|
|
|
+ //await _orderRepository.OrderScreenRevisionVisit(visit.Id, false, HttpContext.RequestAborted);
|
|
|
var startDto = _mapper.Map<StartWorkflowDto>(dto.Workflow);
|
|
|
startDto.DefinitionModuleCode = WorkflowModuleConsts.OrderScreen;
|
|
|
startDto.Opinion = dto.Data.Content;
|
|
@@ -2654,19 +2657,19 @@ public class OrderController : BaseController
|
|
|
[HttpGet("history_all")]
|
|
|
public async Task<PagedDto<OrderDto>> QueryAll([FromQuery] QueryOrderHistoryDto dto)
|
|
|
{
|
|
|
- var (total, items) = await _orderRepository.Queryable()
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.PhoneNo),d => d.Contact == dto.PhoneNo)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrderId), d => d.Id != dto.OrderId)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
|
|
|
- .OrderByDescending(d => d.CreationTime)
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
- return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
|
+ var (total, items) = await _orderRepository.Queryable()
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.PhoneNo), d => d.Contact == dto.PhoneNo)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrderId), d => d.Id != dto.OrderId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
|
|
|
+ .OrderByDescending(d => d.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 查询重复工单
|
|
|
- /// </summary>
|
|
|
- [HttpGet("duplicate")]
|
|
|
+ /// <summary>
|
|
|
+ /// 查询重复工单
|
|
|
+ /// </summary>
|
|
|
+ [HttpGet("duplicate")]
|
|
|
public async Task<PagedDto<OrderDto>> Query([FromQuery] QueryOrderDuplicateDto dto)
|
|
|
{
|
|
|
if (!dto.OrderIds.Any())
|
|
@@ -2930,16 +2933,16 @@ public class OrderController : BaseController
|
|
|
// 工单推送分类
|
|
|
if (dto.OrderPushTypes.Any())
|
|
|
{
|
|
|
- var pushTypeAny = await _orderPushTypeRepository.AnyAsync(x => x.OrderId == order.Id);
|
|
|
- if (pushTypeAny)
|
|
|
- await _orderPushTypeRepository.RemoveAsync(x => x.OrderId == order.Id);
|
|
|
- dto.OrderPushTypes.ForEach(x => x.OrderId = order.Id);
|
|
|
+ var pushTypeAny = await _orderPushTypeRepository.AnyAsync(x => x.OrderId == order.Id);
|
|
|
+ if (pushTypeAny)
|
|
|
+ await _orderPushTypeRepository.RemoveAsync(x => x.OrderId == order.Id);
|
|
|
+ dto.OrderPushTypes.ForEach(x => x.OrderId = order.Id);
|
|
|
var orderPushTypes = _mapper.Map<List<OrderPushType>>(dto.OrderPushTypes);
|
|
|
- await _orderPushTypeRepository.AddRangeAsync(orderPushTypes);
|
|
|
- var pushTypes = dto.OrderPushTypes.Select(x => x.PushType);
|
|
|
- order.PushType = string.Join(",", pushTypes);
|
|
|
+ await _orderPushTypeRepository.AddRangeAsync(orderPushTypes);
|
|
|
+ var pushTypes = dto.OrderPushTypes.Select(x => x.PushType);
|
|
|
+ order.PushType = string.Join(",", pushTypes);
|
|
|
}
|
|
|
- await _orderDomainService.AddAsync(order, true, HttpContext.RequestAborted);
|
|
|
+ await _orderDomainService.AddAsync(order, true, HttpContext.RequestAborted);
|
|
|
|
|
|
//订阅此事件的内部处理工单数据只能更新各自业务的字段,不能全部更新
|
|
|
//新增工单其他处理事件 (受理短信)
|
|
@@ -3124,24 +3127,24 @@ public class OrderController : BaseController
|
|
|
// 工单推送分类
|
|
|
if (dto.OrderPushTypes.Any())
|
|
|
{
|
|
|
- var pushTypeAny = await _orderPushTypeRepository.AnyAsync(x => x.OrderId == order.Id);
|
|
|
- if (pushTypeAny)
|
|
|
- await _orderPushTypeRepository.RemoveAsync(x => x.OrderId == order.Id);
|
|
|
- order.OrderPushTypes.ForEach(x => x.OrderId = order.Id);
|
|
|
- var orderPushTypes = _mapper.Map<List<OrderPushType>>(dto.OrderPushTypes);
|
|
|
- await _orderPushTypeRepository.AddRangeAsync(orderPushTypes);
|
|
|
- var pushTypes = dto.OrderPushTypes.Select(x => x.PushType);
|
|
|
- order.PushType = string.Join(",", pushTypes);
|
|
|
- }
|
|
|
- await _orderRepository.UpdateNav(order).Include(d => d.OrderExtension).ExecuteCommandAsync();
|
|
|
+ var pushTypeAny = await _orderPushTypeRepository.AnyAsync(x => x.OrderId == order.Id);
|
|
|
+ if (pushTypeAny)
|
|
|
+ await _orderPushTypeRepository.RemoveAsync(x => x.OrderId == order.Id);
|
|
|
+ order.OrderPushTypes.ForEach(x => x.OrderId = order.Id);
|
|
|
+ var orderPushTypes = _mapper.Map<List<OrderPushType>>(dto.OrderPushTypes);
|
|
|
+ await _orderPushTypeRepository.AddRangeAsync(orderPushTypes);
|
|
|
+ var pushTypes = dto.OrderPushTypes.Select(x => x.PushType);
|
|
|
+ order.PushType = string.Join(",", pushTypes);
|
|
|
+ }
|
|
|
+ await _orderRepository.UpdateNav(order).Include(d => d.OrderExtension).ExecuteCommandAsync();
|
|
|
|
|
|
//订阅此事件的内部处理工单数据只能更新各自业务的字段,不能全部更新
|
|
|
//修改工单其他处理事件 (受理短信)
|
|
|
await _publisher.PublishAsync(new UpdateOrderNotify(order), PublishStrategy.ParallelWhenAll, HttpContext.RequestAborted);
|
|
|
|
|
|
|
|
|
- //敏感分词
|
|
|
- await _orderApplication.OrderSensitiveParticiple(dto.Content, order.Id, HttpContext.RequestAborted);
|
|
|
+ //敏感分词
|
|
|
+ await _orderApplication.OrderSensitiveParticiple(dto.Content, order.Id, HttpContext.RequestAborted);
|
|
|
// 副本工单
|
|
|
var copy = new OrderCopy();
|
|
|
_mapper.Map(order, copy);
|
|
@@ -3152,7 +3155,7 @@ public class OrderController : BaseController
|
|
|
copy.InitId();
|
|
|
await _orderCopyRepository.AddAsync(copy, HttpContext.RequestAborted);
|
|
|
return new { Id = order.Id, No = order.No, Password = order.Password };
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 开始工单办理流程
|
|
@@ -3193,9 +3196,17 @@ public class OrderController : BaseController
|
|
|
//}
|
|
|
else
|
|
|
{
|
|
|
- //期满时间
|
|
|
- //expiredTimeConfig = _timeLimitDomainService.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.AcceptTypeCode);
|
|
|
- expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ if (_appOptions.Value.IsZiGong)
|
|
|
+ {
|
|
|
+ expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //期满时间
|
|
|
+ //expiredTimeConfig = _timeLimitDomainService.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.AcceptTypeCode);
|
|
|
+ expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToOrg, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
_mapper.Map(expiredTimeConfig, order);
|
|
@@ -3312,16 +3323,22 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
else if (dto.FlowDirection is EFlowDirection.CenterToCenter)
|
|
|
{
|
|
|
- // expiredTimeConfig = _timeLimitDomainService.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, order.AcceptTypeCode);
|
|
|
- expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, order.Adapt<OrderTimeClacInfo>());
|
|
|
- order.CenterToCenter(expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
- expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime, expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne);
|
|
|
- //TODO发送短信即将超期
|
|
|
- //_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
|
+ if (_appOptions.Value.IsZiGong == false)
|
|
|
+ {
|
|
|
+ // expiredTimeConfig = _timeLimitDomainService.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, order.AcceptTypeCode);
|
|
|
+ expiredTimeConfig = await _expireTime.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ order.CenterToCenter(expiredTimeConfig.TimeText, expiredTimeConfig.Count,
|
|
|
+ expiredTimeConfig.TimeType, expiredTimeConfig.ExpiredTime, expiredTimeConfig.NearlyExpiredTime, expiredTimeConfig.NearlyExpiredTimeOne);
|
|
|
+ //TODO发送短信即将超期
|
|
|
+ //_capPublisher.PublishDelay(expiredTimeConfig.NearlyExpiredTime - DateTime.Now, EventNames.HotlineOrderNearlyExpiredTimeSms, new PublishNearlyExpiredTimeSmsDto() { OrderId = order.Id });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- _mapper.Map(expiredTimeConfig, order);
|
|
|
- await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
|
|
|
+ if (expiredTimeConfig is not null)
|
|
|
+ {
|
|
|
+ _mapper.Map(expiredTimeConfig, order);
|
|
|
+ await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
//1.是否是判断节点 2.是否存在历史派单节点 3.存在获取上个派单节点 4.不存在走平均派单
|
|
|
if (dto.BusinessType == EBusinessType.Send)
|
|
|
{
|
|
@@ -4422,7 +4439,7 @@ public class OrderController : BaseController
|
|
|
model.Status = order.Status;
|
|
|
|
|
|
var audit = true;
|
|
|
- var specialAduit = _systemSettingCacheManager.GetSetting(SettingConstants.SpecialAduit);
|
|
|
+ var specialAduit = _systemSettingCacheManager.GetSetting(SettingConstants.SpecialAduit);
|
|
|
if (bool.Parse(specialAduit?.SettingValue[0]))
|
|
|
{
|
|
|
//if (!dto.Audit) model.State = 1;
|
|
@@ -4435,10 +4452,11 @@ public class OrderController : BaseController
|
|
|
if (roles != null && roles.Contains(item)) audit = false;
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
audit = false;
|
|
|
- }
|
|
|
- if (!audit) model.State = 1;
|
|
|
+ }
|
|
|
+ if (!audit) model.State = 1;
|
|
|
|
|
|
model.InitId();
|
|
|
if (dto.Files.Any())
|
|
@@ -4446,16 +4464,16 @@ public class OrderController : BaseController
|
|
|
await _orderSpecialRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
|
if (model.State == 1)
|
|
|
{
|
|
|
- if (_appOptions.Value.IsZiGong && dto.BusinessType == EBusinessType.Send)
|
|
|
- {
|
|
|
- // 平均派单
|
|
|
- var averageSendOrder = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.AverageSendOrder).SettingValue[0]);
|
|
|
- if (averageSendOrder)
|
|
|
- {
|
|
|
- var handler = await _orderDomainService.AverageOrder(HttpContext.RequestAborted);
|
|
|
- dto.NextHandlers = new List<FlowStepHandler> { handler };
|
|
|
- }
|
|
|
- }
|
|
|
+ if (_appOptions.Value.IsZiGong && dto.BusinessType == EBusinessType.Send)
|
|
|
+ {
|
|
|
+ // 平均派单
|
|
|
+ var averageSendOrder = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.AverageSendOrder).SettingValue[0]);
|
|
|
+ if (averageSendOrder)
|
|
|
+ {
|
|
|
+ var handler = await _orderDomainService.AverageOrder(HttpContext.RequestAborted);
|
|
|
+ dto.NextHandlers = new List<FlowStepHandler> { handler };
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
var recall = new RecallDto
|
|
|
{
|
|
@@ -4472,7 +4490,29 @@ public class OrderController : BaseController
|
|
|
//if (dto.AlterTime)
|
|
|
//{
|
|
|
// var expiredTime = _timeLimitDomainService.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
- var expiredTime = await _expireTime.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
+
|
|
|
+ ExpiredTimeWithConfig? expiredTime = null;
|
|
|
+ _logger.LogInformation($"特提时间计算 special: {dto.ToJson()}");
|
|
|
+ if (_appOptions.Value.IsZiGong)
|
|
|
+ {
|
|
|
+ _logger.LogInformation($"特提时间计算 自贡");
|
|
|
+ if (dto.FlowDirection != null)
|
|
|
+ {
|
|
|
+ _logger.LogInformation($"特提时间计算 自贡 有方向");
|
|
|
+ expiredTime = await _expireTime.CalcExpiredTime(DateTime.Now, dto.FlowDirection.Value, order.Adapt<OrderTimeClacInfo>());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _logger.LogInformation($"特提时间计算 自贡 无方向");
|
|
|
+ expiredTime = await _expireTime.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _logger.LogInformation($"特提时间计算 非自贡");
|
|
|
+ expiredTime = await _expireTime.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
+ }
|
|
|
+
|
|
|
var processType = dto.FlowDirection is EFlowDirection.OrgToCenter or EFlowDirection.CenterToCenter or EFlowDirection.FiledToCenter
|
|
|
? EProcessType.Zhiban
|
|
|
: EProcessType.Jiaoban;
|
|
@@ -5006,9 +5046,9 @@ public class OrderController : BaseController
|
|
|
//.WhereIF(dto.EmergencyLevels.Any(), d => dto.EmergencyLevels.Contains(d.EmergencyLevel))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.PhoneNo),
|
|
|
d => d.FromPhone.Contains(dto.PhoneNo!) || d.Contact.Contains(dto.PhoneNo!))
|
|
|
- //.WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), d => d.PushTypeCode == dto.PushTypeCode)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), d => d.OrderPushTypes.Any(opt => opt.PushTypeCode == dto.PushTypeCode)) //推送分类
|
|
|
- .WhereIF(dto.ExpiredTimeStart.HasValue, d => d.ExpiredTime >= dto.ExpiredTimeStart)
|
|
|
+ //.WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), d => d.PushTypeCode == dto.PushTypeCode)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.PushTypeCode), d => d.OrderPushTypes.Any(opt => opt.PushTypeCode == dto.PushTypeCode)) //推送分类
|
|
|
+ .WhereIF(dto.ExpiredTimeStart.HasValue, d => d.ExpiredTime >= dto.ExpiredTimeStart)
|
|
|
.WhereIF(dto.ExpiredTimeEnd.HasValue, d => d.ExpiredTime <= dto.ExpiredTimeEnd)
|
|
|
.WhereIF(dto.Status.HasValue, d => d.Status == dto.Status)//工单状态
|
|
|
.WhereIF(dto.Status != null && dto.Status == EOrderStatus.BackToUnAccept, d => d.Status <= EOrderStatus.HandOverToUnAccept);
|