Procházet zdrojové kódy

自贡任务 351 回访不满意工单被特提后的相关需求

tangjiang před 1 měsícem
rodič
revize
63e7b91c61

+ 8 - 0
src/Hotline.Application/Orders/IOrderApplication.cs

@@ -342,6 +342,14 @@ namespace Hotline.Application.Orders
 
         Task SpecialVerify(OrderSpecialAddDto dto, Order order, CancellationToken cancellationToken);
 
+        /// <summary>
+        /// 省要求重办、省要求撤单 删除甄别等数据
+        /// </summary>
+        /// <param name="order"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        Task SpecialNewVerify(Order order, CancellationToken cancellationToken);
+
         Task EndCountersignAsync(EndCountersignDto dto, CancellationToken cancellationToken);
         ISugarQueryable<OrderPublish> GetPublishedOrder(PublishedPagedRequest dto);
         ISugarQueryable<Order> GetPublishOrderList(QueryOrderPublishDto dto);

+ 61 - 9
src/Hotline.Application/Orders/OrderApplication.cs

@@ -113,9 +113,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     private readonly IRepository<OrderSpecial> _orderSpecialRepository;
     private readonly IWorkflowApplication _workflowApplication;
     private readonly ICircularRecordDomainService _circularRecordDomainService;
-	private readonly IRepository<User> _userRepository;
+    private readonly IRepository<User> _userRepository;
 
-	public OrderApplication(
+    public OrderApplication(
         IOrderDomainService orderDomainService,
         IOrderRepository orderRepository,
         IWorkflowDomainService workflowDomainService,
@@ -161,7 +161,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         IRepository<OrderSpecial> orderSpecialRepository,
         IWorkflowApplication workflowApplication,
         ICircularRecordDomainService circularRecordDomainService,
-		IRepository<User> userRepository)
+        IRepository<User> userRepository)
     {
         _orderDomainService = orderDomainService;
         _workflowDomainService = workflowDomainService;
@@ -209,7 +209,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         _workflowApplication = workflowApplication;
         _circularRecordDomainService = circularRecordDomainService;
         _userRepository = userRepository;
-	}
+    }
 
     /// <summary>
     /// 更新工单办理期满时间(延期调用,其他不调用)
@@ -3338,7 +3338,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         var orderSecondaries = await _orderSecondaryHandlingRepository.Queryable()
             .Where(x => x.OrderId == dto.OrderId && x.State == ESecondaryHandlingState.Apply).ToListAsync(cancellationToken);
 
-        if (_appOptions.Value.IsYiBin)
+        if (_appOptions.Value.IsYiBin || _appOptions.Value.IsZiGong)
         {
             if (screen.Any())
             {
@@ -3382,6 +3382,55 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         }
     }
 
+    /// <summary>
+    /// 省要求重办、省要求撤单 删除甄别等数据
+    /// </summary>
+    /// <param name="order"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    public async Task SpecialNewVerify(Order order, CancellationToken cancellationToken)
+    {
+        var screen = await _orderScreenRepository.Queryable().Where(x => x.OrderId == order.Id && (int)x.Status < 2)
+        .ToListAsync(cancellationToken);
+        var sendBackAudit = await _orderSendBackAuditRepository.Queryable()
+            .Where(x => x.OrderId == order.Id && x.State == ESendBackAuditState.Apply).ToListAsync(cancellationToken);
+        var orderDelay = await _orderDelayRepository.Queryable().Where(x => x.OrderId == order.Id && x.DelayState == EDelayState.Examining)
+            .ToListAsync(cancellationToken);
+        var orderSecondaries = await _orderSecondaryHandlingRepository.Queryable()
+            .Where(x => x.OrderId == order.Id && x.State == ESecondaryHandlingState.Apply).ToListAsync(cancellationToken);
+
+        if (screen.Any())
+        {
+            await _orderScreenRepository.RemoveRangeAsync(screen, false, cancellationToken);
+        }
+
+        if (sendBackAudit.Any())
+        {
+            await _orderSendBackAuditRepository.RemoveRangeAsync(sendBackAudit, false, cancellationToken);
+        }
+
+        if (orderDelay.Any())
+        {
+            await _orderDelayRepository.RemoveRangeAsync(orderDelay, false, cancellationToken);
+        }
+
+        if (orderSecondaries.Any())
+        {
+            await _orderSecondaryHandlingRepository.RemoveRangeAsync(orderSecondaries, false, cancellationToken);
+        }
+
+        if (order.Workflow.IsInCountersign)
+        {
+            var workflowStep = await _workflowStepRepository.Queryable().Where(x => x.Id == order.Workflow.TopCountersignStepId)
+                .FirstAsync(cancellationToken);
+            if (workflowStep != null)
+            {
+                var dtoEnd = new EndCountersignDto() { CountersignId = workflowStep.StartCountersignId };
+                await EndCountersignAsync(dtoEnd, cancellationToken);
+            }
+        }
+    }
+
     public async Task EndCountersignAsync(EndCountersignDto dto, CancellationToken cancellationToken)
     {
         var countersign = await _workflowCountersignRepository.GetAsync(dto.CountersignId, cancellationToken);
@@ -4368,6 +4417,9 @@ public class OrderApplication : IOrderApplication, IScopeDependency
 
             await _orderRepository.UpdateAsync(order, cancellationToken);
             //await _workflowDomainService.RecallToStartStepAsync(order.WorkflowId, "省工单重派", current, cancellationToken);
+
+            //删除甄别、延期、二次办理等数据
+            await SpecialNewVerify(order, cancellationToken);
         }
 
         return _mapper.Map<AddOrderResponse>(order);
@@ -5239,8 +5291,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 .Where(o => o.Id == order.Id).ExecuteCommandAsync(cancellationToken);
         }
 
-		if (_appOptions.Value.IsYiBin && order.IsProvince && sendBack.ApplyOrgId.Length == 6 && sendBack.SendBackOrgId == OrgSeedData.CenterId )
-		{
+        if (_appOptions.Value.IsYiBin && order.IsProvince && sendBack.ApplyOrgId.Length == 6 && sendBack.SendBackOrgId == OrgSeedData.CenterId)
+        {
             if (currentStep.FlowAssignType == EFlowAssignType.User)
             {
                 await _circularRecordDomainService.OrderSendBackCircularMessage(currentStep.HandlerId, currentStep.HandlerName, order, cancellationToken);
@@ -5254,8 +5306,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                     await _circularRecordDomainService.OrderSendBackCircularMessage(user.Id, user.Name, order, cancellationToken);
                 }
             }
-		}
-	}
+        }
+    }
 
     #endregion
 }

+ 3 - 0
src/Hotline.Application/Subscribers/DatasharingSubscriber.cs

@@ -355,6 +355,9 @@ namespace Hotline.Application.Subscribers
 
                 await _orderRepository.UpdateAsync(order, cancellationToken);
             }
+
+            //删除甄别、延期、二次办理等数据
+            await _orderApplication.SpecialNewVerify(order, cancellationToken);
         }
 
         /// <summary>