|
@@ -7,6 +7,7 @@ using DotNetCore.CAP;
|
|
|
using Fw.Utility.Client;
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
using Hotline.Ai.Visit;
|
|
|
+using Hotline.Application.CallCenter;
|
|
|
using Hotline.Application.ExportExcel;
|
|
|
using Hotline.Application.FlowEngine;
|
|
|
using Hotline.Application.JudicialManagement;
|
|
@@ -141,11 +142,13 @@ public class TestController : BaseController
|
|
|
private readonly IRepository<ContingencyManagementHotspot> _contingencyManagementHotspotRepository;
|
|
|
private readonly IRepository<Hotspot> _hotspotRepository;
|
|
|
private readonly IOrderApplication _orderApplication;
|
|
|
- //private readonly ITypedCache<List<User>> _cache;
|
|
|
- //private readonly ICacheManager<User> _cache;
|
|
|
+ private readonly IOrderDomainService _orderDomainService;
|
|
|
+ private readonly ICallApplication _callApplication;
|
|
|
+ //private readonly ITypedCache<List<User>> _cache;
|
|
|
+ //private readonly ICacheManager<User> _cache;
|
|
|
|
|
|
|
|
|
- public TestController(
|
|
|
+ public TestController(
|
|
|
INewRockClient client,
|
|
|
ILogger<TestController> logger,
|
|
|
IAuthorizeGenerator authorizeGenerator,
|
|
@@ -192,7 +195,9 @@ IRepository<EnforcementOrders> enforcementOrdersRepository,
|
|
|
IRepository<JudicialManagementOrders> judicialManagementOrdersRepository,
|
|
|
IRepository<EnforcementOrdersHandler> enforcementOrdersHandlerRepository,
|
|
|
IRepository<ContingencyManagementHotspot> contingencyManagementHotspotRepository,
|
|
|
-IRepository<Hotspot> hotspotRepository
|
|
|
+IRepository<Hotspot> hotspotRepository,
|
|
|
+IOrderDomainService orderDomainService,
|
|
|
+ICallApplication callApplication
|
|
|
)
|
|
|
{
|
|
|
_logger = logger;
|
|
@@ -238,7 +243,8 @@ IRepository<Hotspot> hotspotRepository
|
|
|
_contingencyManagementHotspotRepository = contingencyManagementHotspotRepository;
|
|
|
_hotspotRepository = hotspotRepository;
|
|
|
_orderApplication = orderApplication;
|
|
|
-
|
|
|
+ _orderDomainService = orderDomainService;
|
|
|
+ _callApplication = callApplication;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1095,6 +1101,109 @@ IRepository<Hotspot> hotspotRepository
|
|
|
return $"{publicKey} \r\n {privateKey}";
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 处理错误工单数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("handle-order-data")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task HandleData()
|
|
|
+ {
|
|
|
+ //var steps = await _workflowStepRepository.Queryable()
|
|
|
+ // .LeftJoin<Order>((ws, d) => ws.ExternalId == d.Id)
|
|
|
+ // .Where((ws, d) => d.Status == EOrderStatus.Handling && d.ProcessType == EProcessType.Zhiban && ws.Status == EWorkflowStepStatus.Handled && ws.StepType == EStepType.End)
|
|
|
+ // .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ var steps = await _workflowStepRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((ws, d) => ws.ExternalId == d.Id)
|
|
|
+ .Where((ws, d) => d.Status == EOrderStatus.Handling && d.ProcessType == EProcessType.Zhiban && ws.Status == EWorkflowStepStatus.Handled && ws.StepType == EStepType.End)
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ _logger.LogInformation($"取到数据{steps.Count}条");
|
|
|
+ foreach (var step in steps)
|
|
|
+ {
|
|
|
+ var order = await _orderDomainService.GetOrderAsync(step.ExternalId,
|
|
|
+ withExtension: true, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ var now = step.HandleTime.Value;
|
|
|
+ var handleDuration = order.CenterToOrgTime.HasValue && order.ActualHandleTime.HasValue
|
|
|
+ ? _timeLimitDomainService.CalcWorkTime(order.CenterToOrgTime.Value,
|
|
|
+ order.ActualHandleTime.Value, order.ProcessType is EProcessType.Zhiban)
|
|
|
+ : 0;
|
|
|
+ var fileDuration = order.CenterToOrgTime.HasValue
|
|
|
+ ? _timeLimitDomainService.CalcWorkTime(order.CenterToOrgTime.Value,
|
|
|
+ now, order.ProcessType is EProcessType.Zhiban)
|
|
|
+ : 0;
|
|
|
+ var allDuration = order.StartTime.HasValue
|
|
|
+ ? _timeLimitDomainService.CalcWorkTime(order.StartTime.Value, now,
|
|
|
+ order.ProcessType is EProcessType.Zhiban)
|
|
|
+ : 0;
|
|
|
+ var creationTimeHandleDurationWorkday = order.ActualHandleTime.HasValue
|
|
|
+ ? _timeLimitDomainService.CalcWorkTimeEx(order.CreationTime, now,
|
|
|
+ order.ProcessType is EProcessType.Zhiban)
|
|
|
+ : 0;
|
|
|
+ var centerToOrgHandleDurationWorkday = order.ActualHandleTime.HasValue && order.CenterToOrgTime.HasValue
|
|
|
+ ? _timeLimitDomainService.CalcWorkTimeEx(order.CenterToOrgTime.Value, now,
|
|
|
+ order.ProcessType is EProcessType.Zhiban)
|
|
|
+ : 0;
|
|
|
+ order.File(now, handleDuration, fileDuration, allDuration, creationTimeHandleDurationWorkday, centerToOrgHandleDurationWorkday);
|
|
|
+ order.FileUserId = step.HandlerId;// notification.Trace.HandlerId;
|
|
|
+ order.FileUserName = step.HandlerName;// notification.Trace.HandlerName;
|
|
|
+ order.FileUserOrgId = step.HandlerOrgId;// notification.Trace.HandlerOrgId;
|
|
|
+ order.FileUserOrgName = step.HandlerOrgName;// notification.Trace.HandlerOrgName;
|
|
|
+ order.FileOrgIsCenter = step.HandlerOrgIsCenter; //notification.Trace.HandlerOrgIsCenter;
|
|
|
+ order.FileOpinion = step.Opinion;//.Dto.Opinion;
|
|
|
+ order.FileUserRole = EFileUserType.Seat;
|
|
|
+ order.IsResolved = false;
|
|
|
+
|
|
|
+
|
|
|
+ order.ActualHandleStepCode = step.Code;
|
|
|
+ order.ActualHandleStepName = step.Name;
|
|
|
+ order.ActualHandleStepId = step.Id;
|
|
|
+ order.ActualHandleStepCreateTime = step.CreationTime;
|
|
|
+ order.ActualHandleStepAcceptTime = step.AcceptTime;
|
|
|
+ order.ActualHandleTime = step.HandleTime;
|
|
|
+ order.ActualHandlerId = step.HandlerId;
|
|
|
+ order.ActualHandlerName = step.HandlerName;
|
|
|
+ order.ActualHandleOrgCode = step.HandlerOrgId;
|
|
|
+ order.ActualHandleOrgName = step.HandlerOrgName;
|
|
|
+ order.ActualHandleOrgAreaCode = step.HandlerOrgAreaCode;
|
|
|
+ order.ActualHandleOrgAreaName = step.HandlerOrgAreaName;
|
|
|
+
|
|
|
+
|
|
|
+ order.CurrentStepId = order.ActualHandleStepId;
|
|
|
+ order.CurrentStepCode = order.ActualHandleStepCode;
|
|
|
+ order.CurrentStepName = order.ActualHandleStepName;
|
|
|
+ order.CurrentStepCreateTime = order.ActualHandleStepCreateTime;
|
|
|
+ order.CurrentStepAcceptTime = order.ActualHandleStepAcceptTime;
|
|
|
+ order.CurrentHandleTime = order.ActualHandleTime;
|
|
|
+ order.CurrentHandlerId = order.ActualHandlerId;
|
|
|
+ order.CurrentHandlerName = order.ActualHandlerName;
|
|
|
+ order.CurrentHandleOrgName = order.ActualHandleOrgName;
|
|
|
+ order.CurrentHandleOrgId = order.ActualHandleOrgCode;
|
|
|
+ order.CurrentHandleOrgAreaCode = order.ActualHandleOrgAreaCode;
|
|
|
+ order.CurrentHandleOrgAreaName = order.ActualHandleOrgAreaName;
|
|
|
+
|
|
|
+ await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
|
|
|
+ //var workflowTrace = await _workflowTraceRepository.Queryable().Where(x => x.WorkflowId == step.WorkflowId && x.Code == "end").OrderByDescending(x=>x.HandleTime).FirstAsync();
|
|
|
+ //var orderFlowDto = new OrderFlowDto
|
|
|
+ //{
|
|
|
+ // Order = _mapper.Map<OrderDto>(order)
|
|
|
+ //};
|
|
|
+ //if (workflowTrace!=null)
|
|
|
+ //{
|
|
|
+ // orderFlowDto.WorkflowTrace = _mapper.Map<WorkflowTraceDto>(workflowTrace);
|
|
|
+ //}
|
|
|
+ //if (order.SourceChannelCode == AppDefaults.SourceChannel.DianHua &&
|
|
|
+ // !string.IsNullOrEmpty(order.CallId))
|
|
|
+ //{
|
|
|
+
|
|
|
+ // var call = await _callApplication.GetCallAsync(order.CallId, HttpContext.RequestAborted);
|
|
|
+ // if (call is not null)
|
|
|
+ // orderFlowDto.TrCallRecordDto = _mapper.Map<TrCallDto>(call);
|
|
|
+ //}
|
|
|
+ //await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, orderFlowDto, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 处理工单流程错误数据 话务部直接归档件 没有归档节点
|
|
|
/// </summary>
|