|
@@ -8,9 +8,11 @@ using Fw.Utility.Client;
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
using Hotline.Ai.Visit;
|
|
|
using Hotline.Application.ExportExcel;
|
|
|
+using Hotline.Application.FlowEngine;
|
|
|
using Hotline.Application.JudicialManagement;
|
|
|
using Hotline.Application.Quality;
|
|
|
using Hotline.Application.StatisticalReport;
|
|
|
+using Hotline.Authentications;
|
|
|
using Hotline.CallCenter.BlackLists;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
using Hotline.CallCenter.Configs;
|
|
@@ -133,6 +135,7 @@ public class TestController : BaseController
|
|
|
private readonly IRepository<EnforcementOrders> _enforcementOrdersRepository;
|
|
|
private readonly IRepository<JudicialManagementOrders> _judicialManagementOrdersRepository;
|
|
|
private readonly IRepository<EnforcementOrdersHandler> _enforcementOrdersHandlerRepository;
|
|
|
+ private readonly IWorkflowApplication _workflowApplication;
|
|
|
|
|
|
private readonly IRepository<ContingencyManagementHotspot> _contingencyManagementHotspotRepository;
|
|
|
private readonly IRepository<Hotspot> _hotspotRepository;
|
|
@@ -966,12 +969,113 @@ IRepository<Hotspot> hotspotRepository
|
|
|
[HttpGet("t5")]
|
|
|
public async Task Test5()
|
|
|
{
|
|
|
- //var orderCount = await _orderRepository.Queryable()
|
|
|
- // .Where(d => d.Status >= EOrderStatus.Filed &&
|
|
|
- // d.CurrentStepId == null)
|
|
|
+ var query = _orderRepository.Queryable()
|
|
|
+ .Includes(d => d.Workflow, x => x.Steps)
|
|
|
+ .Where(d => d.Status >= EOrderStatus.Filed &&
|
|
|
+ d.CurrentStepId == null)
|
|
|
+ .OrderBy(d => d.Id);
|
|
|
+
|
|
|
+ var size = 1000;
|
|
|
+ var count = await query.CountAsync(HttpContext.RequestAborted);
|
|
|
+ _logger.LogWarning($"共计 {count} 条");
|
|
|
+ var batchs = (int)Math.Ceiling(Convert.ToDouble(count) / size);
|
|
|
+ for (int i = 0; i < batchs; i++)
|
|
|
+ {
|
|
|
+ _logger.LogWarning($"第 {i} 批次开始");
|
|
|
+ var orders = await query
|
|
|
+ .Skip(i * size)
|
|
|
+ .Take(size)
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+ foreach (var order in orders)
|
|
|
+ {
|
|
|
+ if (order.No.Trim().Length != 14)
|
|
|
+ {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (order.CounterSignType != null)
|
|
|
+ {
|
|
|
+ order.Workflow.CurrentStepId = order.Workflow.ActualHandleStepId;
|
|
|
+ order.Workflow.CurrentStepCode = order.Workflow.ActualHandleStepCode;
|
|
|
+ order.Workflow.CurrentStepName = order.Workflow.ActualHandleStepName;
|
|
|
+ order.Workflow.CurrentStepCreateTime = order.Workflow.ActualHandleStepCreateTime;
|
|
|
+ order.Workflow.CurrentStepAcceptTime = order.Workflow.ActualHandleStepAcceptTime;
|
|
|
+ order.Workflow.CurrentHandleTime = order.Workflow.ActualHandleTime;
|
|
|
+ order.Workflow.CurrentHandlerId = order.Workflow.ActualHandlerId;
|
|
|
+ order.Workflow.CurrentHandlerName = order.Workflow.ActualHandlerName;
|
|
|
+ order.Workflow.CurrentHandleOrgName = order.Workflow.ActualHandleOrgName;
|
|
|
+ order.Workflow.CurrentHandleOrgId = order.Workflow.ActualHandleOrgCode;
|
|
|
+ order.Workflow.CurrentHandleOrgAreaCode = order.Workflow.ActualHandleOrgAreaCode;
|
|
|
+ order.Workflow.CurrentHandleOrgAreaName = order.Workflow.ActualHandleOrgAreaName;
|
|
|
+
|
|
|
+ order.CurrentStepId = order.Workflow.ActualHandleStepId;
|
|
|
+ order.CurrentStepCode = order.Workflow.ActualHandleStepCode;
|
|
|
+ order.CurrentStepName = order.Workflow.ActualHandleStepName;
|
|
|
+ order.CurrentStepCreateTime = order.Workflow.ActualHandleStepCreateTime;
|
|
|
+ order.CurrentStepAcceptTime = order.Workflow.ActualHandleStepAcceptTime;
|
|
|
+ order.CurrentHandleTime = order.Workflow.ActualHandleTime;
|
|
|
+ order.CurrentHandlerId = order.Workflow.ActualHandlerId;
|
|
|
+ order.CurrentHandlerName = order.Workflow.ActualHandlerName;
|
|
|
+ order.CurrentHandleOrgName = order.Workflow.ActualHandleOrgName;
|
|
|
+ order.CurrentHandleOrgId = order.Workflow.ActualHandleOrgCode;
|
|
|
+ order.CurrentHandleOrgAreaCode = order.Workflow.ActualHandleOrgAreaCode;
|
|
|
+ order.CurrentHandleOrgAreaName = order.Workflow.ActualHandleOrgAreaName;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var endStep = order.Workflow.Steps.FirstOrDefault(d => d.StepType == EStepType.End);
|
|
|
+ if (endStep is null) continue;
|
|
|
+ var preStep = order.Workflow.Steps.FirstOrDefault(d => d.Id == endStep.PrevStepId);
|
|
|
+ if (preStep is null) continue;
|
|
|
+
|
|
|
+ order.Workflow.CurrentStepId = preStep.Id;
|
|
|
+ order.Workflow.CurrentStepCode = preStep.Code;
|
|
|
+ order.Workflow.CurrentStepName = preStep.Name;
|
|
|
+ order.Workflow.CurrentStepCreateTime = preStep.CreationTime;
|
|
|
+ order.Workflow.CurrentStepAcceptTime = preStep.AcceptTime;
|
|
|
+ order.Workflow.CurrentHandleTime = preStep.HandleTime;
|
|
|
+ order.Workflow.CurrentHandlerId = preStep.HandlerId;
|
|
|
+ order.Workflow.CurrentHandlerName = preStep.HandlerName;
|
|
|
+ order.Workflow.CurrentHandleOrgName = preStep.HandlerOrgName;
|
|
|
+ order.Workflow.CurrentHandleOrgId = preStep.HandlerOrgId;
|
|
|
+ order.Workflow.CurrentHandleOrgAreaCode = preStep.HandlerOrgAreaCode;
|
|
|
+ order.Workflow.CurrentHandleOrgAreaName = preStep.HandlerOrgAreaName;
|
|
|
+
|
|
|
+ order.CurrentStepId = order.Workflow.ActualHandleStepId;
|
|
|
+ order.CurrentStepCode = order.Workflow.ActualHandleStepCode;
|
|
|
+ order.CurrentStepName = order.Workflow.ActualHandleStepName;
|
|
|
+ order.CurrentStepCreateTime = order.Workflow.ActualHandleStepCreateTime;
|
|
|
+ order.CurrentStepAcceptTime = order.Workflow.ActualHandleStepAcceptTime;
|
|
|
+ order.CurrentHandleTime = order.Workflow.ActualHandleTime;
|
|
|
+ order.CurrentHandlerId = order.Workflow.ActualHandlerId;
|
|
|
+ order.CurrentHandlerName = order.Workflow.ActualHandlerName;
|
|
|
+ order.CurrentHandleOrgName = order.Workflow.ActualHandleOrgName;
|
|
|
+ order.CurrentHandleOrgId = order.Workflow.ActualHandleOrgCode;
|
|
|
+ order.CurrentHandleOrgAreaCode = order.Workflow.ActualHandleOrgAreaCode;
|
|
|
+ order.CurrentHandleOrgAreaName = order.Workflow.ActualHandleOrgAreaName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _logger.LogWarning($"更新数据:{orders.Count} 条");
|
|
|
+ await _orderRepository.UpdateNav(orders)
|
|
|
+ .Include(d => d.Workflow)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- //_logger.LogWarning($"更新数据:{updateSteps.Count} 条");
|
|
|
//await _workflowTraceRepository.UpdateRangeAsync(updateSteps, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
@@ -984,4 +1088,105 @@ IRepository<Hotspot> hotspotRepository
|
|
|
return $"{publicKey} \r\n {privateKey}";
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 处理工单流程错误数据 话务部直接归档件 没有归档节点
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartTime"></param>
|
|
|
+ /// <param name="EndTime"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("oders_workflow_step")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task AddJudicialManagementOrders()
|
|
|
+ {
|
|
|
+
|
|
|
+ var steps = await _workflowStepRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((ws, d) => ws.ExternalId == d.Id)
|
|
|
+ .Where((ws, d) => d.Status == EOrderStatus.Handling && ws.NextStepCode == "end" && ws.Status == EWorkflowStepStatus.Handled && ws.StepType == EStepType.Start)
|
|
|
+ .ToListAsync(HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ _logger.LogInformation($"取到数据 {steps.Count} 条");
|
|
|
+ foreach (var item in steps)
|
|
|
+ {
|
|
|
+ ///组装数据
|
|
|
+ //Workflow workflow
|
|
|
+ Workflow workflow = await _workflowDomainService.GetWorkflowAsync(item.WorkflowId, withDefine: true, withSteps: true,
|
|
|
+ cancellationToken: HttpContext.RequestAborted);
|
|
|
+ //WorkflowStep startStep
|
|
|
+ var startStep = workflow.Steps.FirstOrDefault(x => x.StepType == EStepType.Start);
|
|
|
+ if (startStep is null) continue;
|
|
|
+ //BasicWorkflowDto dto
|
|
|
+ BasicWorkflowDto dto = new BasicWorkflowDto
|
|
|
+ {
|
|
|
+ NextStepCode = "end",
|
|
|
+ NextStepName = "结束",
|
|
|
+ BackToCountersignEnd = false,
|
|
|
+ FlowDirection = null,
|
|
|
+ HandlerType = 0,
|
|
|
+ StepType = 0,
|
|
|
+ NextHandlers = new List<FlowStepHandler>(),
|
|
|
+ IsSms = false,
|
|
|
+ NextMainHandler = "",
|
|
|
+ IsStartCountersign = false,
|
|
|
+ External = new External
|
|
|
+ {
|
|
|
+ TimeLimit = null,
|
|
|
+ TimeLimitUnit = null,
|
|
|
+ IsPoliceReturn = false,
|
|
|
+ IsResolved = false,
|
|
|
+ },
|
|
|
+ BusinessType = EBusinessType.File,
|
|
|
+ ReviewResult = 0,
|
|
|
+ Remark = null,
|
|
|
+ Opinion = startStep.Opinion,
|
|
|
+ Files = new List<Share.Dtos.File.FileDto>()
|
|
|
+ };
|
|
|
+ //ISessionContext current
|
|
|
+ ISessionContext current = new ProvinceSessionContext
|
|
|
+ {
|
|
|
+ UserId = startStep.HandlerId,
|
|
|
+ UserName = startStep.HandlerName,
|
|
|
+ OrgId = startStep.HandlerOrgId,
|
|
|
+ OrgName = startStep.HandlerOrgName,
|
|
|
+ OrgAreaCode = startStep.HandlerOrgAreaCode,
|
|
|
+ OrgAreaName = startStep.HandlerOrgAreaName,
|
|
|
+ OrgLevel = 1
|
|
|
+ };
|
|
|
+
|
|
|
+ //StepDefine firstStepDefine
|
|
|
+ StepDefine firstStepDefine = workflow.WorkflowDefinition.FindStepDefine(startStep.NextStepCode);
|
|
|
+ //FlowAssignInfo flowAssignInfo
|
|
|
+ ////如果发起会签需检查是否支持发起会签
|
|
|
+ //var startStepDefine = workflow.WorkflowDefinition.FindStartStepDefine();
|
|
|
+
|
|
|
+ //下一节点是否为动态节点
|
|
|
+ var isNextDynamic = false;
|
|
|
+
|
|
|
+ FlowAssignInfo flowAssignInfo =
|
|
|
+ await _workflowApplication.GetNextStepFlowAssignInfoAsync(workflow, startStep, dto, firstStepDefine, isNextDynamic, HttpContext.RequestAborted);
|
|
|
+ //DateTime? expiredTime
|
|
|
+ DateTime? expiredTime = startStep.StepExpiredTime;
|
|
|
+
|
|
|
+ ///
|
|
|
+ await _mediator.Publish(
|
|
|
+ new StartWorkflowNotify(workflow, dto, flowAssignInfo, startStep.WorkflowTrace), HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ //firstStep是否为end,t: 实际办理节点为startStep, 并且handlerId赋值 f: 实际办理节点为firstStep, handlerId未赋值
|
|
|
+ workflow.UpdateActualStepWhenHandle(startStep,
|
|
|
+ current.RequiredUserId, current.UserName,
|
|
|
+ current.RequiredOrgId, current.OrgName,
|
|
|
+ current.OrgAreaCode, current.OrgAreaName,
|
|
|
+ current.OrgLevel);
|
|
|
+
|
|
|
+ workflow.UpdateCurrentStepWhenHandle(startStep,
|
|
|
+ current.OrgAreaCode, current.OrgAreaName, current.OrgLevel);
|
|
|
+
|
|
|
+ var endTrace = await _workflowDomainService.EndAsync(workflow, dto, firstStepDefine,
|
|
|
+ startStep, current, expiredTime, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ _logger.LogInformation($"处理完成");
|
|
|
+ }
|
|
|
+
|
|
|
}
|