Bläddra i källkod

修改推送归档结果到省上以及处理错误数据

tangjiang 2 månader sedan
förälder
incheckning
f5b7528825

+ 83 - 43
src/Hotline.Api/Controllers/PushProvinceController.cs

@@ -32,15 +32,17 @@ namespace Hotline.Api.Controllers
         private readonly ICallApplication _callApplication;
         private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
         private readonly IOrderScreenRepository _orderScreenRepository;
+        private readonly IRepository<WorkflowStep> _workflowStepRepository;
 
-		public PushProvinceController(ILogger<PushProvinceController> logger,
+        public PushProvinceController(ILogger<PushProvinceController> logger,
              IOrderRepository orderRepository,
              IMapper mapper,
              ICapPublisher capPublisher,
              IRepository<WorkflowTrace> workflowTraceRepository,
              ICallApplication callApplication,
              IOrderScreenRepository orderScreenRepository,
-			 IOptionsSnapshot<AppConfiguration> appOptions)
+             IOptionsSnapshot<AppConfiguration> appOptions,
+             IRepository<WorkflowStep> workflowStepRepository)
         {
             _logger = logger;
             _orderRepository = orderRepository;
@@ -50,7 +52,9 @@ namespace Hotline.Api.Controllers
             _callApplication = callApplication;
             _appOptions = appOptions;
             _orderScreenRepository = orderScreenRepository;
-		}
+            _workflowStepRepository = workflowStepRepository;
+
+        }
 
         /// <summary>
         /// 推送最新工单信息
@@ -63,7 +67,7 @@ namespace Hotline.Api.Controllers
         {
             Provinces = Provinces.Trim();
             string[] provinceNos = Provinces.Split(',');
-            for (int i = 0;i < provinceNos.Length;i++)
+            for (int i = 0; i < provinceNos.Length; i++)
             {
                 provinceNos[i] = provinceNos[i].Trim();
             }
@@ -92,7 +96,7 @@ namespace Hotline.Api.Controllers
         {
             Provinces = Provinces.Trim();
             string[] provinceNos = Provinces.Split(',');
-            for (int i = 0;i < provinceNos.Length;i++)
+            for (int i = 0; i < provinceNos.Length; i++)
             {
                 provinceNos[i] = provinceNos[i].Trim();
             }
@@ -143,7 +147,7 @@ namespace Hotline.Api.Controllers
         {
             Provinces = Provinces.Trim();
             string[] provinceNos = Provinces.Split(',');
-            for (int i = 0;i < provinceNos.Length;i++)
+            for (int i = 0; i < provinceNos.Length; i++)
             {
                 provinceNos[i] = provinceNos[i].Trim();
             }
@@ -200,7 +204,7 @@ namespace Hotline.Api.Controllers
         {
             provinces = provinces.Trim();
             var provinceNos = provinces.Split(',');
-            for (int i = 0;i < provinceNos.Length;i++)
+            for (int i = 0; i < provinceNos.Length; i++)
             {
                 provinceNos[i] = provinceNos[i].Trim();
             }
@@ -241,44 +245,80 @@ namespace Hotline.Api.Controllers
         [AllowAnonymous]
         public async Task OrderScreenPushProvince([FromBody] string Provinces)
         {
-	        Provinces = Provinces.Trim();
-	        string[] provinceNos = Provinces.Split(',');
-	        for (int i = 0; i < provinceNos.Length; i++)
-	        {
-		        provinceNos[i] = provinceNos[i].Trim();
-	        }
+            Provinces = Provinces.Trim();
+            string[] provinceNos = Provinces.Split(',');
+            for (int i = 0; i < provinceNos.Length; i++)
+            {
+                provinceNos[i] = provinceNos[i].Trim();
+            }
+
+            var unpublishScreens = await _orderScreenRepository.Queryable().Includes(x => x.Order)
+                .Where(x => provinceNos.Contains(x.Order.ProvinceNo) && !string.IsNullOrEmpty(x.Order.ProvinceNo) && x.Order.Status >= EOrderStatus.Filed)
+                .ToListAsync(HttpContext.RequestAborted);
+            if (unpublishScreens != null && unpublishScreens.Any())
+            {
+                foreach (var screen in unpublishScreens)
+                {
+                    var traces = await _workflowTraceRepository.Queryable()
+                        .Where(d => d.WorkflowId == screen.WorkflowId && d.ModuleCode == WorkflowModuleConsts.OrderScreen).ToListAsync(HttpContext.RequestAborted);
+                    var currentStep = traces
+                        .FirstOrDefault(x => x.Status == EWorkflowStepStatus.WaitForAccept ||
+                                             x.Status == EWorkflowStepStatus.WaitForHandle);
+                    var prevStep = traces.FirstOrDefault(x => x.Id == currentStep.PrevStepId);
+
+                    var screenDto = _mapper.Map<OrderScreenListDto>(screen);
+                    var screenOrderDto = _mapper.Map<OrderDto>(screen.Order);
+                    //省件甄别--以省审批前一个节点整理的甄别意见为准推送省上 宜宾
+                    if (_appOptions.Value.IsYiBin && prevStep is not null && !string.IsNullOrEmpty(prevStep.Opinion))
+                    {
+                        screenDto.Content = prevStep.Opinion;
+                        screenDto.Files = new List<Share.Dtos.File.FileDto>();
+                    }
+                    //推省上
+                    _capPublisher.Publish(Hotline.Share.Mq.EventNames.HotlineOrderScreenApply, new PublishScreenDto()
+                    {
+                        Order = screenOrderDto,
+                        Screen = screenDto,
+                        ClientGuid = ""
+                    });
+                }
+            }
+        }
+
+        /// <summary>
+        /// 推送工单归档数据
+        /// </summary>
+        /// <param name="No"></param>
+        /// <param name="fileTime"></param>
+        /// <returns></returns>
+        [HttpPost("pushfiledtoprovincenew")]
+        [AllowAnonymous]
+        public async Task PushFiledToProvinceNew(string No, DateTime fileTime)
+        {
+            var order = await _orderRepository.GetAsync(p => p.No == No, HttpContext.RequestAborted);
+            if (order != null)
+            {
+                order.FiledTime = fileTime;
+                order.ActualHandleStepCreateTime = fileTime.AddMinutes(-30);
+                order.ActualHandleStepAcceptTime = fileTime.AddMinutes(-10);
 
-	        var unpublishScreens = await _orderScreenRepository.Queryable().Includes(x=>x.Order)
-		        .Where(x => provinceNos.Contains(x.Order.ProvinceNo) && !string.IsNullOrEmpty(x.Order.ProvinceNo) && x.Order.Status >= EOrderStatus.Filed)
-		        .ToListAsync(HttpContext.RequestAborted);
-	        if (unpublishScreens != null && unpublishScreens.Any())
-	        {
-		        foreach (var screen in unpublishScreens)
-		        {
-					var traces = await _workflowTraceRepository.Queryable()
-						.Where(d => d.WorkflowId == screen.WorkflowId  && d.ModuleCode == WorkflowModuleConsts.OrderScreen).ToListAsync(HttpContext.RequestAborted);
-					var currentStep = traces
-						.FirstOrDefault(x => x.Status == EWorkflowStepStatus.WaitForAccept ||
-						                     x.Status == EWorkflowStepStatus.WaitForHandle);
-					var prevStep = traces.FirstOrDefault(x => x.Id == currentStep.PrevStepId);
+                var notification = await _workflowStepRepository.Queryable().Includes(x => x.Workflow, w => w.Steps).Where(x => x.ExternalId == order.Id
+                && x.BusinessType == EBusinessType.File && x.StepType == EStepType.End).FirstAsync(HttpContext.RequestAborted);
+                if (notification != null)
+                {
+                    var orderFlowDto = new OrderFlowDto
+                    {
+                        Order = _mapper.Map<OrderDto>(order),
+                    };
+                    var workflowTrace = _mapper.Map<WorkflowTraceDto>(notification);
+                    workflowTrace.HandleTime = fileTime;
 
-					var screenDto = _mapper.Map<OrderScreenListDto>(screen);
-					var screenOrderDto = _mapper.Map<OrderDto>(screen.Order);
-					//省件甄别--以省审批前一个节点整理的甄别意见为准推送省上 宜宾
-					if (_appOptions.Value.IsYiBin && prevStep is not null &&  !string.IsNullOrEmpty(prevStep.Opinion))
-					{
-						screenDto.Content = prevStep.Opinion;
-						screenDto.Files = new List<Share.Dtos.File.FileDto>();
-					}
-					//推省上
-					_capPublisher.Publish(Hotline.Share.Mq.EventNames.HotlineOrderScreenApply, new PublishScreenDto()
-					{
-						Order = screenOrderDto,
-						Screen = screenDto,
-						ClientGuid = ""
-					});
-				}
-	        }
+                    orderFlowDto.WorkflowTrace = workflowTrace;
+                    //这里需要判断是否是警情退回
+                    orderFlowDto.IsNonPoliceReturn = false;
+                    await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, orderFlowDto, cancellationToken: HttpContext.RequestAborted);
+                }
+            }
         }
 
     }

+ 218 - 272
src/Hotline.Api/Controllers/TestController.cs

@@ -152,14 +152,14 @@ public class TestController : BaseController
     private readonly ICalcExpireTime _expireTime;
     private readonly ICallNativeRepository _callNativeRepository;
     private readonly IRepository<OldSendProData> _oldSendProDataRepository;
-	private readonly IOrderScreenRepository _orderScreenRepository;
-	private readonly IRepository<OrderVisit> _orderVisitRepository;
+    private readonly IOrderScreenRepository _orderScreenRepository;
+    private readonly IRepository<OrderVisit> _orderVisitRepository;
     private readonly IThirdIdentiyService _thirdIdentiyService;
-	private readonly IServiceProvider _serviceProvider;
-	private readonly IRepository<OrderDelay> _orderDelayRepository;
+    private readonly IServiceProvider _serviceProvider;
+    private readonly IRepository<OrderDelay> _orderDelayRepository;
 
 
-	public TestController(
+    public TestController(
         //INewRockClient client,
         ILogger<TestController> logger,
         //IAuthorizeGenerator authorizeGenerator,
@@ -209,14 +209,14 @@ ICallApplication callApplication,
         IOptionsSnapshot<AppConfiguration> appOptions,
         ISystemSettingCacheManager systemSettingCacheManager,
         ICalcExpireTime expireTime,
-		IRepository<OrderDelay> orderDelayRepository,
-		ICallNativeRepository callNativeRepository,
+        IRepository<OrderDelay> orderDelayRepository,
+        ICallNativeRepository callNativeRepository,
         IRepository<OldSendProData> oldSendProDataRepository,
         IThirdIdentiyService thirdIdentiyService,
-		IOrderScreenRepository orderScreenRepository,
-		IRepository<OrderVisit> orderVisitRepository,
-		IServiceProvider serviceProvider
-		)
+        IOrderScreenRepository orderScreenRepository,
+        IRepository<OrderVisit> orderVisitRepository,
+        IServiceProvider serviceProvider
+        )
     {
         _logger = logger;
         //_authorizeGenerator = authorizeGenerator;
@@ -270,8 +270,8 @@ ICallApplication callApplication,
         _orderScreenRepository = orderScreenRepository;
         _orderVisitRepository = orderVisitRepository;
         _serviceProvider = serviceProvider;
-		_orderDelayRepository = orderDelayRepository; 
-	}
+        _orderDelayRepository = orderDelayRepository;
+    }
 
     /// <summary>
     /// 测试获取电话号码
@@ -563,7 +563,7 @@ ICallApplication callApplication,
         //var r = _timeLimitDomainService.CalcExpiredTime(DateTime.Now, EFlowDirection.CenterToCenter, batchId);
         //var r = _timeLimitDomainService.CalcEndTime(DateTime.Parse("2024-09-12 14:45:47"), Share.Enums.Settings.ETimeType.WorkDay, 2, 80, 50);
         //_capPublisher.PublishDelay((DateTime.Now.AddMinutes(2) - DateTime.Now), EventNames.OrderRelateCall, "123");
-        var times =await _expireTime.CalcExpiredTime(DateTime.Parse("2025-01-14 09:45:00"), DateTime.Parse("2025-01-07 09:16:53.691249"), EFlowDirection.CenterToOrg,new OrderTimeClacInfo() { AcceptTypeCode= "20" });
+        var times = await _expireTime.CalcExpiredTime(DateTime.Parse("2025-01-14 09:45:00"), DateTime.Parse("2025-01-07 09:16:53.691249"), EFlowDirection.CenterToOrg, new OrderTimeClacInfo() { AcceptTypeCode = "20" });
         //await _expireTime.CalcWorkTimeToDecimal(visit.VisitTime.Value, DateTime.Now, false);
         //var times = await _expireTime.CalcWorkTimeToDecimal(DateTime.Parse("2024-12-16 21:36:27"), DateTime.Parse("2024-12-17 12:47:05"), false);
         //var query = _userRepository.Queryable().Where(x => false);
@@ -629,7 +629,7 @@ ICallApplication callApplication,
     [AllowAnonymous]
     public async Task<List<GetCaseReultSendModel>> ImportMarketSupervision(IFormFile file)
     {
-       
+
         using (var stream = new MemoryStream())
         {
             file.CopyTo(stream);
@@ -1033,11 +1033,11 @@ ICallApplication callApplication,
     }
 
     [HttpGet("t4")]
-	[AllowAnonymous]
-	public async Task<string> Test4()
+    [AllowAnonymous]
+    public async Task<string> Test4()
     {
         var a = await _expireTime.CalcWorkTimeToDecimal(DateTime.Parse("2024-12-17 22:33:22"), DateTime.Parse("2024-12-18 10:29:53"), false);
-		return DateTime.Now.ToString("O");
+        return DateTime.Now.ToString("O");
     }
 
 
@@ -1046,23 +1046,23 @@ ICallApplication callApplication,
     /// </summary>
     /// <returns></returns>
 	[HttpGet("order_screen_timeconsuming")]
-	[AllowAnonymous]
-	public async Task OrderScreenTimeConsuming()
-	{
+    [AllowAnonymous]
+    public async Task OrderScreenTimeConsuming()
+    {
         var screens = await _orderScreenRepository.Queryable().ToListAsync();
         foreach (var item in screens)
         {
-            var visit = await _orderVisitRepository.Queryable().Where(x=>x.Id == item.VisitId).FirstAsync();
+            var visit = await _orderVisitRepository.Queryable().Where(x => x.Id == item.VisitId).FirstAsync();
             if (visit != null)
             {
-				var time = await _expireTime.CalcWorkTimeToDecimal(visit.VisitTime.Value, item.CreationTime, false);
+                var time = await _expireTime.CalcWorkTimeToDecimal(visit.VisitTime.Value, item.CreationTime, false);
                 await _orderScreenRepository.Updateable().SetColumns(x => new OrderScreen { TimeConsuming = time }).Where(x => x.Id == item.Id).ExecuteCommandAsync();
-			}
+            }
         }
-		
-	}
 
-	[AllowAnonymous]
+    }
+
+    [AllowAnonymous]
     [HttpGet("t5")]
     public async Task<string> GetUserAllowAnonymous()
     {
@@ -1198,88 +1198,89 @@ ICallApplication callApplication,
         }
     }
 
-	/// <summary>
-	/// 老系统数据同步
-	/// </summary>
-	/// <returns></returns>
-	[HttpGet("old_data_synchronization")]
-	[AllowAnonymous]
-	public async Task oldDataSynchronization([FromQuery] string? no)
-	{
-		var orders = new List<Order>();
-		if (string.IsNullOrEmpty(no))
-		{
-			orders = await _orderRepository.Queryable().Where(x => x.No.Length == 12 && x.ActualHandleTime == null && x.CenterToOrgTime == null)
-                .Where(x=>x.CreationTime >= DateTime.Parse("2024-01-01") && x.CreationTime <  DateTime.Parse("2024-02-01")).ToListAsync();
-		}
-		else
-		{
-			orders = await _orderRepository.Queryable().Where(x => x.No == no).ToListAsync();
-		}
-		foreach (var order in orders)
-		{
-
-			var steps = await _workflowStepRepository.Queryable().Where(x => x.ExternalId == order.Id).ToListAsync();
-
-			var actualHandleStep = steps.Where(x => x.HandlerOrgId == order.ActualHandleOrgCode).OrderByDescending(x => x.CreationTime).FirstOrDefault();
-			var CenterToOrgStep = steps.Where(x => x.AssignerOrgId == "001" && x.HandlerOrgId != "001").OrderByDescending(x => x.CreationTime).FirstOrDefault();
-
-			order.ActualHandleTime = actualHandleStep.HandleTime;
-			order.CenterToOrgTime = CenterToOrgStep is null? null : CenterToOrgStep.CreationTime;
-
-			await _orderRepository.Updateable().SetColumns(x => new Order { ActualHandleTime = order.ActualHandleTime, CenterToOrgTime = order.CenterToOrgTime }).Where(x => x.Id == order.Id).ExecuteCommandAsync();
-
-
-			var now = order.FiledTime.Value;
-			var handleDuration = order.StartTime.HasValue
-				? //_timeLimitDomainService.CalcWorkTime(
-				await _expireTime.CalcWorkTime(
-					order.StartTime.Value,
-					now, order.ProcessType is EProcessType.Zhiban)
-				: 0;
-			var fileDuration = order.CenterToOrgTime.HasValue
-				? // _timeLimitDomainService.CalcWorkTime(
-				await _expireTime.CalcWorkTime(
-					order.CenterToOrgTime.Value,
-					now, order.ProcessType is EProcessType.Zhiban)
-				: 0;
-			var allDuration = order.StartTime.HasValue
-				?
-				//_timeLimitDomainService.CalcWorkTime(
-				await _expireTime.CalcWorkTime(
-					order.StartTime.Value, now,
-					order.ProcessType is EProcessType.Zhiban)
-				: 0;
-			var creationTimeHandleDurationWorkday = order.ActualHandleTime.HasValue
-				?
-				// _timeLimitDomainService.CalcWorkTime(
-				await _expireTime.CalcWorkTime(
-					order.CreationTime, now,
-					order.ProcessType is EProcessType.Zhiban)
-				: 0;
-			var centerToOrgHandleDurationWorkday = order.ActualHandleTime.HasValue && order.CenterToOrgTime.HasValue
-				?
-				// _timeLimitDomainService.CalcWorkTime(
-				await _expireTime.CalcWorkTime(
-					order.CenterToOrgTime.Value, now,
-					order.ProcessType is EProcessType.Zhiban)
-				: 0;
-			creationTimeHandleDurationWorkday = creationTimeHandleDurationWorkday <= 0 ? 10 : creationTimeHandleDurationWorkday;
-			centerToOrgHandleDurationWorkday = centerToOrgHandleDurationWorkday <= 0 ? 10 : centerToOrgHandleDurationWorkday;
-
-			order.File(now, handleDuration, fileDuration, allDuration, creationTimeHandleDurationWorkday, centerToOrgHandleDurationWorkday);
-
-		}
-
-	}
-
-	[HttpGet("aiXingTang")]
-	[AllowAnonymous]
-	public async Task aiXingTang() {
-		var aiQualityService = _serviceProvider.GetRequiredService<IAiQualityService>();
+    /// <summary>
+    /// 老系统数据同步
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet("old_data_synchronization")]
+    [AllowAnonymous]
+    public async Task oldDataSynchronization([FromQuery] string? no)
+    {
+        var orders = new List<Order>();
+        if (string.IsNullOrEmpty(no))
+        {
+            orders = await _orderRepository.Queryable().Where(x => x.No.Length == 12 && x.ActualHandleTime == null && x.CenterToOrgTime == null)
+                .Where(x => x.CreationTime >= DateTime.Parse("2024-01-01") && x.CreationTime < DateTime.Parse("2024-02-01")).ToListAsync();
+        }
+        else
+        {
+            orders = await _orderRepository.Queryable().Where(x => x.No == no).ToListAsync();
+        }
+        foreach (var order in orders)
+        {
+
+            var steps = await _workflowStepRepository.Queryable().Where(x => x.ExternalId == order.Id).ToListAsync();
+
+            var actualHandleStep = steps.Where(x => x.HandlerOrgId == order.ActualHandleOrgCode).OrderByDescending(x => x.CreationTime).FirstOrDefault();
+            var CenterToOrgStep = steps.Where(x => x.AssignerOrgId == "001" && x.HandlerOrgId != "001").OrderByDescending(x => x.CreationTime).FirstOrDefault();
+
+            order.ActualHandleTime = actualHandleStep.HandleTime;
+            order.CenterToOrgTime = CenterToOrgStep is null ? null : CenterToOrgStep.CreationTime;
+
+            await _orderRepository.Updateable().SetColumns(x => new Order { ActualHandleTime = order.ActualHandleTime, CenterToOrgTime = order.CenterToOrgTime }).Where(x => x.Id == order.Id).ExecuteCommandAsync();
+
+
+            var now = order.FiledTime.Value;
+            var handleDuration = order.StartTime.HasValue
+                ? //_timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.StartTime.Value,
+                    now, order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var fileDuration = order.CenterToOrgTime.HasValue
+                ? // _timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.CenterToOrgTime.Value,
+                    now, order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var allDuration = order.StartTime.HasValue
+                ?
+                //_timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.StartTime.Value, now,
+                    order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var creationTimeHandleDurationWorkday = order.ActualHandleTime.HasValue
+                ?
+                // _timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.CreationTime, now,
+                    order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var centerToOrgHandleDurationWorkday = order.ActualHandleTime.HasValue && order.CenterToOrgTime.HasValue
+                ?
+                // _timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.CenterToOrgTime.Value, now,
+                    order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            creationTimeHandleDurationWorkday = creationTimeHandleDurationWorkday <= 0 ? 10 : creationTimeHandleDurationWorkday;
+            centerToOrgHandleDurationWorkday = centerToOrgHandleDurationWorkday <= 0 ? 10 : centerToOrgHandleDurationWorkday;
+
+            order.File(now, handleDuration, fileDuration, allDuration, creationTimeHandleDurationWorkday, centerToOrgHandleDurationWorkday);
+
+        }
+
+    }
+
+    [HttpGet("aiXingTang")]
+    [AllowAnonymous]
+    public async Task aiXingTang()
+    {
+        var aiQualityService = _serviceProvider.GetRequiredService<IAiQualityService>();
         await aiQualityService.CreateAiOrderQualityTask("cs202501030002.mp3", HttpContext.RequestAborted);
 
-	}
+    }
 
     /// <summary>
     /// 加密验证
@@ -1294,169 +1295,114 @@ ICallApplication callApplication,
         return dto.AppId + EncryptProvider.AESEncrypt(strString, dto.Secret, dto.AppId);
     }
 
-	/// <summary>
-	/// 归档handle错误数据处理
-	/// </summary>
-	/// <returns></returns>
-	[HttpPost("end_order_data_dispose")]
-	[AllowAnonymous]
-	public async Task EndOrderDataDispose([FromBody] string No)
-	{
-		var orderNo = await _orderRepository.Queryable().Where(x => x.No == No).FirstAsync(HttpContext.RequestAborted);
-
-		var workflow = await _workflowRepository.Queryable().Where(x => x.ExternalId == orderNo.Id).FirstAsync(HttpContext.RequestAborted);
-
-		var notification = await _workflowStepRepository.Queryable().Includes(x=>x.Workflow,w=>w.Steps).Where(x => x.ExternalId == orderNo.Id && x.BusinessType == EBusinessType.File && x.StepType == EStepType.End).FirstAsync(HttpContext.RequestAborted);
-		var order = await _orderDomainService.GetOrderAsync(orderNo.Id,
-					   withExtension: true, cancellationToken: HttpContext.RequestAborted);
-		//order.CheckIfFiled();
-		//order.UpdateHandlingStatus(workflow.IsInCountersign);
-		_mapper.Map(workflow, order);
-		var now = DateTime.Now;
-		var handleDuration = order.CenterToOrgTime.HasValue && order.ActualHandleTime.HasValue
-			? // _timeLimitDomainService.CalcWorkTime(
-			await _expireTime.CalcWorkTime(
-				order.CenterToOrgTime.Value,
-			order.ActualHandleTime.Value, order.ProcessType is EProcessType.Zhiban)
-			: 0;
-		var fileDuration = order.CenterToOrgTime.HasValue
-			? //_timeLimitDomainService.CalcWorkTime(
-			await _expireTime.CalcWorkTime(
-				order.CenterToOrgTime.Value,
-				now, order.ProcessType is EProcessType.Zhiban)
-			: 0;
-		var allDuration = order.StartTime.HasValue
-			? // _timeLimitDomainService.CalcWorkTime(
-			await _expireTime.CalcWorkTime(
-				order.StartTime.Value, now,
-			order.ProcessType is EProcessType.Zhiban)
-			: 0;
-		var creationTimeHandleDurationWorkday = order.ActualHandleTime.HasValue
-			? //_timeLimitDomainService.CalcWorkTimeEx(
-			await _expireTime.CalcWorkTimeEx(
-				order.CreationTime, now,
-			order.ProcessType is EProcessType.Zhiban)
-			: 0;
-		var centerToOrgHandleDurationWorkday = order.ActualHandleTime.HasValue && order.CenterToOrgTime.HasValue
-			? //_timeLimitDomainService.CalcWorkTimeEx(
-			await _expireTime.CalcWorkTimeEx(
-				order.CenterToOrgTime.Value, now,
-			order.ProcessType is EProcessType.Zhiban)
-			: 0;
-		creationTimeHandleDurationWorkday = creationTimeHandleDurationWorkday <= 0 ? 10 : creationTimeHandleDurationWorkday;
-		centerToOrgHandleDurationWorkday = centerToOrgHandleDurationWorkday <= 0 ? 10 : centerToOrgHandleDurationWorkday;
-
-		order.File(now, handleDuration, fileDuration, allDuration, creationTimeHandleDurationWorkday, centerToOrgHandleDurationWorkday);
-		order.FileUserId = notification.HandlerId;
-		order.FileUserName = notification.HandlerName;
-		order.FileUserOrgId = notification.HandlerOrgId;
-		order.FileUserOrgName = notification.HandlerOrgName;
-		order.FileOrgIsCenter = notification.HandlerOrgIsCenter;
-		order.FileOpinion = notification.Opinion;
-
-		//记录冗余归档数据
-		if (notification.Workflow.Steps.Any(x => x.BusinessType == Share.Enums.FlowEngine.EBusinessType.Send))
-		{
-			order.FileUserRole = EFileUserType.Dispatch;
-		}
-		else
-		{
-			order.FileUserRole = EFileUserType.Seat;
-		}
-		if (order.ProcessType == EProcessType.Jiaoban)
-		{
-			order.FileUserRole = EFileUserType.Org;
-		}
-
-		//是否已解决
-		order.IsResolved = true;
-
-		await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
-		//var callRecord = await _trCallRecordRepository.GetAsync(p => p.CallAccept == order.CallId, cancellationToken); //由CallAccept改为OtherAccept
-		//var callRecord = await _trCallRecordRepository.GetAsync(p => p.OtherAccept == order.CallId, cancellationToken);
-		//var orderFlowDto = new OrderFlowDto
-		//{
-		//	Order = _mapper.Map<OrderDto>(order),
-		//	WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace)
-		//};
-		//// if (callRecord != null)
-		//// {
-		////     orderFlowDto.TrCallRecordDto = _mapper.Map<TrCallDto>(callRecord);
-		//// }
-		//if (order.SourceChannelCode == AppDefaults.SourceChannel.DianHua &&
-		//	!string.IsNullOrEmpty(order.CallId))
-		//{
-		//	if (_appOptions.Value.GetDefaultAppScopeConfiguration().CallCenterType == AppDefaults.CallCenterType.TianRun)
-		//	{
-		//		// var callRecord = await _trCallRecordRepository.GetAsync(p => p.OtherAccept == order.CallId, cancellationToken);
-		//		var callRecord = await _callApplication.GetTianrunCallAsync(order.CallId, HttpContext.RequestAborted);
-		//		if (callRecord != null)
-		//		{
-		//			orderFlowDto.TrCallRecordDto = _mapper.Map<TrCallDto>(callRecord);
-		//		}
-		//	}
-		//	else if (_appOptions.Value.GetDefaultAppScopeConfiguration().CallCenterType == AppDefaults.CallCenterType.XingTang)
-		//	{
-		//		var call = await _callApplication.GetCallAsync(order.CallId, HttpContext.RequestAborted);
-		//		if (call is not null)
-		//		{
-		//			orderFlowDto.TrCallRecordDto = _mapper.Map<TrCallDto>(call);
-
-		//			// 工单开始办理如果获取的通话记录是呼出并且录音文件是空就不推送通话记录
-		//			// 如果 通话记录是呼入, 并且没有录音文件
-		//			if (_systemSettingCacheManager.OrderStartHandlerPushCallIsNull && call.Direction == ECallDirection.Out && call.AudioFile.IsNullOrEmpty())
-		//			{
-		//				orderFlowDto.TrCallRecordDto = null;
-		//			}
-		//		}
-		//	}
-		//}
-
-		//这里需要判断是否是警情退回
-		//orderFlowDto.IsNonPoliceReturn = notification.Dto.External == null ? false : notification.Dto.External.IsPoliceReturn;
-		//await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFiled, orderFlowDto, cancellationToken: HttpContext.RequestAborted);
-		//await _publisher.PublishAsync(new SnapshotOrderFiledNotification(order.Id), PublishStrategy.ParallelWhenAll, HttpContext.RequestAborted);
-		//await _orderDomainService.OrderAutomaticPublishAsync(order, HttpContext.RequestAborted);
-		//try
-		//{
-		//    //写入质检  针对受理之后直接结束的工单
-		//    await _qualityApplication.AddQualityAsync(EQualitySource.Accepted, order.Id, cancellationToken);
-		//}
-		//catch (Exception e)
-		//{
-		//    _logger.LogError($"写入质检异常!orderId: {order.Id}, \r\n{e.Message}");
-		//}
-
-		//司法行政监督管理-工单处理
-		//如果没开启则不处理
-		//var isOpenJudicialManagement = _systemSettingCacheManager.GetSetting(SettingConstants.IsOpenJudicialManagement)?.SettingValue[0];
-		//if (isOpenJudicialManagement == "true")
-		//	await _publisher.PublishAsync(new JudicialManagementOrderNotify(order), PublishStrategy.ParallelWhenAll, HttpContext.RequestAborted);
-	}
-
-
-	/// <summary>
-	/// 延期EndHandle错误数据处理
-	/// </summary>
-	/// <returns></returns>
-	[HttpPost("end_order_delay")]
-	[AllowAnonymous]
-	public async Task EndOrderDelay([FromBody] OrderDelayEndHandleDto dto) {
-
-		var delay = await _orderDelayRepository.GetAsync(dto.DelayId);
-		if (delay != null)
-		{
-			//delay.Flowed(workflow.FlowedUserIds, workflow.FlowedOrgIds, workflow.HandlerUsers, workflow.HandlerOrgs);
-			delay.DelayState = dto.IsReviewPass ? EDelayState.Pass : EDelayState.NoPass;
-			await _orderDelayRepository.Updateable(delay)
-				.UpdateColumns(d => d.DelayState)
-				.ExecuteCommandAsync();
-			if (dto.IsReviewPass)
-			{
-				//处理工单延期
-				await _orderApplication.DelayOrderExpiredTimeAsync(delay.OrderId, delay.DelayNum,
-					delay.DelayUnit, delay.IsProDelay, HttpContext.RequestAborted);
-			}
-		}
-	}
+    /// <summary>
+    /// 归档handle错误数据处理
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("end_order_data_dispose")]
+    [AllowAnonymous]
+    public async Task EndOrderDataDispose([FromBody] string No, DateTime fileTime)
+    {
+        var orderNo = await _orderRepository.Queryable().Where(x => x.No == No).FirstAsync(HttpContext.RequestAborted);
+
+        var workflow = await _workflowRepository.Queryable().Where(x => x.ExternalId == orderNo.Id).FirstAsync(HttpContext.RequestAborted);
+
+        var notification = await _workflowStepRepository.Queryable().Includes(x => x.Workflow, w => w.Steps).Where(x => x.ExternalId == orderNo.Id && x.BusinessType == EBusinessType.File && x.StepType == EStepType.End).FirstAsync(HttpContext.RequestAborted);
+        var order = await _orderDomainService.GetOrderAsync(orderNo.Id,
+                       withExtension: true, cancellationToken: HttpContext.RequestAborted);
+        //order.CheckIfFiled();
+        //order.UpdateHandlingStatus(workflow.IsInCountersign);
+        _mapper.Map(workflow, order);
+        if (notification != null)
+        {
+
+            var now = fileTime;// DateTime.Now;
+            var handleDuration = order.CenterToOrgTime.HasValue && order.ActualHandleTime.HasValue
+                ? // _timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.CenterToOrgTime.Value,
+                order.ActualHandleTime.Value, order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var fileDuration = order.CenterToOrgTime.HasValue
+                ? //_timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.CenterToOrgTime.Value,
+                    now, order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var allDuration = order.StartTime.HasValue
+                ? // _timeLimitDomainService.CalcWorkTime(
+                await _expireTime.CalcWorkTime(
+                    order.StartTime.Value, now,
+                order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var creationTimeHandleDurationWorkday = order.ActualHandleTime.HasValue
+                ? //_timeLimitDomainService.CalcWorkTimeEx(
+                await _expireTime.CalcWorkTimeEx(
+                    order.CreationTime, now,
+                order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            var centerToOrgHandleDurationWorkday = order.ActualHandleTime.HasValue && order.CenterToOrgTime.HasValue
+                ? //_timeLimitDomainService.CalcWorkTimeEx(
+                await _expireTime.CalcWorkTimeEx(
+                    order.CenterToOrgTime.Value, now,
+                order.ProcessType is EProcessType.Zhiban)
+                : 0;
+            creationTimeHandleDurationWorkday = creationTimeHandleDurationWorkday <= 0 ? 10 : creationTimeHandleDurationWorkday;
+            centerToOrgHandleDurationWorkday = centerToOrgHandleDurationWorkday <= 0 ? 10 : centerToOrgHandleDurationWorkday;
+
+            order.File(now, handleDuration, fileDuration, allDuration, creationTimeHandleDurationWorkday, centerToOrgHandleDurationWorkday);
+            order.FileUserId = notification.HandlerId;
+            order.FileUserName = notification.HandlerName;
+            order.FileUserOrgId = notification.HandlerOrgId;
+            order.FileUserOrgName = notification.HandlerOrgName;
+            order.FileOrgIsCenter = notification.HandlerOrgIsCenter;
+            order.FileOpinion = notification.Opinion;
+
+            //记录冗余归档数据
+            if (notification.Workflow.Steps.Any(x => x.BusinessType == Share.Enums.FlowEngine.EBusinessType.Send))
+            {
+                order.FileUserRole = EFileUserType.Dispatch;
+            }
+            else
+            {
+                order.FileUserRole = EFileUserType.Seat;
+            }
+            if (order.ProcessType == EProcessType.Jiaoban)
+            {
+                order.FileUserRole = EFileUserType.Org;
+            }
+
+            //是否已解决
+            order.IsResolved = true;
+
+            await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
+        }
+    }
+
+
+    /// <summary>
+    /// 延期EndHandle错误数据处理
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("end_order_delay")]
+    [AllowAnonymous]
+    public async Task EndOrderDelay([FromBody] OrderDelayEndHandleDto dto)
+    {
+
+        var delay = await _orderDelayRepository.GetAsync(dto.DelayId);
+        if (delay != null)
+        {
+            //delay.Flowed(workflow.FlowedUserIds, workflow.FlowedOrgIds, workflow.HandlerUsers, workflow.HandlerOrgs);
+            delay.DelayState = dto.IsReviewPass ? EDelayState.Pass : EDelayState.NoPass;
+            await _orderDelayRepository.Updateable(delay)
+                .UpdateColumns(d => d.DelayState)
+                .ExecuteCommandAsync();
+            if (dto.IsReviewPass)
+            {
+                //处理工单延期
+                await _orderApplication.DelayOrderExpiredTimeAsync(delay.OrderId, delay.DelayNum,
+                    delay.DelayUnit, delay.IsProDelay, HttpContext.RequestAborted);
+            }
+        }
+    }
 }