xf 4 달 전
부모
커밋
a0c11f923d
3개의 변경된 파일104개의 추가작업 그리고 12개의 파일을 삭제
  1. 10 0
      src/Hotline.Api/Controllers/OrderController.cs
  2. 6 0
      src/Hotline/Orders/IOrderDomainService.cs
  3. 88 12
      src/Hotline/Orders/OrderDomainService.cs

+ 10 - 0
src/Hotline.Api/Controllers/OrderController.cs

@@ -4684,6 +4684,16 @@ public class OrderController : BaseController
         audit.InitId();
         if (dto.Files.Any())
             audit.FileJson = await _fileRepository.AddFileAsync(dto.Files, audit.Id, "", HttpContext.RequestAborted);
+        if (_appOptions.Value.IsZiGong && prevStep.BusinessType == EBusinessType.Send)
+        {
+            // 平均派单
+            var averageSendOrder = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.AverageSendOrder).SettingValue[0]);
+            if (averageSendOrder)
+            {
+                var handler = await _orderDomainService.AverageOrder(HttpContext.RequestAborted);
+                dto.Handler = handler;
+            }
+        }
 
         //自贡需求:
         // 1. 工单退回、特提、重办到话务部节点时,所有坐席都可以查看和办理

+ 6 - 0
src/Hotline/Orders/IOrderDomainService.cs

@@ -1,6 +1,7 @@
 using Hotline.Schedulings;
 using Hotline.Share.Dtos.FlowEngine;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Enums.FlowEngine;
 
 namespace Hotline.Orders
 {
@@ -112,5 +113,10 @@ namespace Hotline.Orders
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
         Task VisitNoneByCancelPublishAsync(string orderId, CancellationToken cancellationToken);
+
+        /// <summary>
+        /// 查询退回操作目标节点的指派方式
+        /// </summary>
+        ReverseFlowStepAssignInfo GetOrderPreviousAssignInfo(EBusinessType targetStepBusinessType, AssignStepHandler? handler);
     }
 }

+ 88 - 12
src/Hotline/Orders/OrderDomainService.cs

@@ -222,7 +222,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
             orderVisit.EmployeeId = string.Empty;
         }
 
-        if (order is { FileOrgIsCenter:true, CounterSignType: null } && !order.IsProvince)
+        if (order is { FileOrgIsCenter: true, CounterSignType: null } && !order.IsProvince)
         {
             orderVisit.VisitState = EVisitState.Visited;
             orderVisit.VisitTime = DateTime.Now;
@@ -256,7 +256,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         orgDetail.VisitOrgCode = order.ActualHandleOrgCode;
         orgDetail.VisitOrgName = order.ActualHandleOrgName;
         orgDetail.VisitTarget = EVisitTarget.Org;
-        if (order is { FileOrgIsCenter:true , CounterSignType: null, IsProvince: false })
+        if (order is { FileOrgIsCenter: true, CounterSignType: null, IsProvince: false })
         {
             var satisfy = new Kv() { Key = "4", Value = "满意" };
             orgDetail.OrgProcessingResults = satisfy;
@@ -265,7 +265,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
 
         visitedDetail.Add(orgDetail);
 
-        if (order is { FileOrgIsCenter:true, CounterSignType: null })
+        if (order is { FileOrgIsCenter: true, CounterSignType: null })
         {
             seatDetail.VoiceEvaluate = EVoiceEvaluate.Satisfied;
             seatDetail.SeatEvaluate = ESeatEvaluate.Satisfied;
@@ -299,7 +299,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         {
             try
             {
-                if (order.Source != ESource.ProvinceStraight && order.FileOrgIsCenter.Value  == false)
+                if (order.Source != ESource.ProvinceStraight && order.FileOrgIsCenter.Value == false)
                 {
                     var code = "";
                     //受理类型为“投诉、举报”
@@ -398,6 +398,82 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         }
     }
 
+    /// <summary>
+    /// 查询退回操作目标节点的指派方式
+    /// </summary>
+    public ReverseFlowStepAssignInfo GetOrderPreviousAssignInfo(EBusinessType targetStepBusinessType, AssignStepHandler? handler)
+    {
+        //自贡需求:
+        // 1. 工单退回、特提、重办到话务部节点时,所有坐席都可以查看和办理
+        // 2. 退回到派单组时需执行平均分配逻辑
+        //宜宾需求:
+        // 1、退回至话务部:所有坐席都可以查看和办理(除某些场景下本来就需指定办理对象,如:发布时退回……)
+        // 2、退回至派单组:默认退给之前的派单员(除某些场景下本来就需指定办理对象,如:发布时退回……)
+        // 3、话务员特提至话务部:根据特提申请时候选择来,指定的办理对象才能查看和办理
+        // 4、派单员特提至派单组:根据特提申请时候选择来,指定的办理对象才能查看和办理
+        // 5、班长特提至派单组,办理对象必选(已实现)
+        // 6、班长特提至话务部,办理对象非必选,没选择则所有坐席都可以查看和办理
+
+
+        //todo 基本策略:保持原节点
+        //中心领导,部门领导等,原节点策略
+        var rsp = new ReverseFlowStepAssignInfo();
+
+        if (_appOptions.Value.IsZiGong)
+        {
+            if (targetStepBusinessType == EBusinessType.Seat)
+            {
+                rsp = new ReverseFlowStepAssignInfo
+                {
+                    ReverseFlowStepCreationPolicy = EReverseFlowStepCreationPolicy.OriginStepRole
+                };
+            }
+            else if (targetStepBusinessType == EBusinessType.Send)
+            {
+                if (handler is null)
+                    throw new UserFriendlyException("参数异常,退回派单组需要通过平均派单指定办理人");
+
+                rsp.ReverseFlowStepCreationPolicy = EReverseFlowStepCreationPolicy.AssignHandler;
+                rsp.AssignStepHandler = new AssignStepHandler
+                {
+                    FlowAssignType = EFlowAssignType.User,
+                    UserId = handler.UserId,
+                    Username = handler.Username,
+                    OrgId = handler.OrgId,
+                    OrgName = handler.OrgName,
+                    RoleId = handler.RoleId,
+                    RoleName = handler.RoleName
+                };
+            }
+            else if (targetStepBusinessType == EBusinessType.Department)
+            {
+                rsp = new ReverseFlowStepAssignInfo
+                {
+                    ReverseFlowStepCreationPolicy = EReverseFlowStepCreationPolicy.OriginStepOrg
+                };
+            }
+        }
+        else if (_appOptions.Value.IsYiBin)
+        {
+            if (targetStepBusinessType == EBusinessType.Seat)
+            {
+                rsp = new ReverseFlowStepAssignInfo
+                {
+                    ReverseFlowStepCreationPolicy = EReverseFlowStepCreationPolicy.OriginStepRole
+                };
+            }
+            else if (targetStepBusinessType == EBusinessType.Send)
+            {
+                rsp = new ReverseFlowStepAssignInfo
+                {
+                    ReverseFlowStepCreationPolicy = EReverseFlowStepCreationPolicy.OriginStepUser
+                };
+            }
+        }
+
+        return rsp;
+    }
+
     public async Task<Order> GetOrderAsync(string? orderId, bool withHotspot = false, bool withAcceptor = false,
         bool withExtension = false, CancellationToken cancellationToken = default)
     {
@@ -586,17 +662,17 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
             scheduling.SendOrderNum += sendNum;
             if (!scheduling.LoginSendOrderNum.HasValue)
             {
-	            scheduling.LoginSendOrderNum = scheduling.LoginSendOrderNum.HasValue && scheduling.LoginSendOrderNum > sendNum ? scheduling.LoginSendOrderNum : sendNum;
-				await _schedulingRepository.Updateable()
-					.SetColumns(s => new Scheduling() { LoginSendOrderNum = scheduling.LoginSendOrderNum })
-					.Where(s => s.SchedulingTime == scheduling.SchedulingTime).ExecuteCommandAsync(cancellationToken);
-			}
+                scheduling.LoginSendOrderNum = scheduling.LoginSendOrderNum.HasValue && scheduling.LoginSendOrderNum > sendNum ? scheduling.LoginSendOrderNum : sendNum;
+                await _schedulingRepository.Updateable()
+                    .SetColumns(s => new Scheduling() { LoginSendOrderNum = scheduling.LoginSendOrderNum })
+                    .Where(s => s.SchedulingTime == scheduling.SchedulingTime).ExecuteCommandAsync(cancellationToken);
+            }
             sendNum = scheduling.LoginSendOrderNum.Value;
-			await _schedulingRepository.Updateable()
+            await _schedulingRepository.Updateable()
                 .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum, AtWork = scheduling.AtWork })
                 .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
-		
-			if (sendNum <= 0) return;
+
+            if (sendNum <= 0) return;
             var sendSteps = steps.Take(sendNum).ToList();
             await _orderRepository.Updateable().SetColumns(o => new Order()
             {