Pārlūkot izejas kodu

mod: 省工单编号流水号从5开头

xf 11 mēneši atpakaļ
vecāks
revīzija
af286453b9
1 mainītis faili ar 67 papildinājumiem un 62 dzēšanām
  1. 67 62
      src/Hotline/Orders/OrderDomainService.cs

+ 67 - 62
src/Hotline/Orders/OrderDomainService.cs

@@ -40,7 +40,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
     private readonly IRepository<Hotspot> _hotspotRepository;
 
 
-	public OrderDomainService(
+    public OrderDomainService(
         IOrderRepository orderRepository,
         IRepository<OrderRedo> orderRedoRepository,
         IRepository<OrderPublish> orderPublishRepository,
@@ -77,7 +77,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         _systemSettingCacheManager = systemSettingCacheManager;
         _workflowDomainService = workflowDomainService;
         _hotspotRepository = hotspotRepository;
-	}
+    }
 
     public async Task<Order> GetOrderAsync(string? orderId, bool withHotspot = false, bool withAcceptor = false,
         bool withExtension = false, CancellationToken cancellationToken = default)
@@ -227,7 +227,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
             {
                 stepIds.Add(stepsList[0]);
                 stepsList.Remove(stepsList[0]);
-			}
+            }
             List<(string, string, string, string, IReadOnlyList<string> stepIds)> handlers = new();
             ; handlers.Add(new ValueTuple<string, string, string, string, IReadOnlyList<string>>(user.Id, user.Name, user.OrgId, user.Organization.Name, stepIds));
             var workflowIds = await _workflowDomainService.ChangeHandlerRangeAsync(OrderDefaults.SourceChannel.SendPoolId, handlers, cancellationToken);
@@ -238,10 +238,10 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
                 _mapper.Map(order.Workflow, order);
             }
             var scheduling = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
-	            .Where(x => x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && x.SchedulingUser.UserId == userId).FirstAsync(cancellationToken);
+                .Where(x => x.SchedulingTime == time && x.WorkingTime <= DateTime.Now.TimeOfDay && x.OffDutyTime >= DateTime.Now.TimeOfDay && x.SchedulingUser.UserId == userId).FirstAsync(cancellationToken);
             scheduling.SendOrderNum += sendNum;
             await _schedulingRepository.UpdateAsync(scheduling, cancellationToken);
-			await _orderRepository.UpdateRangeAsync(orders, cancellationToken);
+            await _orderRepository.UpdateRangeAsync(orders, cancellationToken);
         }
     }
 
@@ -306,21 +306,21 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
             }
         }
     }
-	#endregion
-	#region  工单校验- 交通类工单
-
-	/// <summary>
-	/// 工单校验  - 交通类工单
-	/// </summary>
-	/// <returns></returns>
-	public async Task<OrderValidation> OrderValidation(AddOrderDto dto, CancellationToken cancellationToken) 
+    #endregion
+    #region  工单校验- 交通类工单
+
+    /// <summary>
+    /// 工单校验  - 交通类工单
+    /// </summary>
+    /// <returns></returns>
+    public async Task<OrderValidation> OrderValidation(AddOrderDto dto, CancellationToken cancellationToken)
     {
         var valid = new OrderValidation { Validation = false, Result = "" };
         var hotspot = await _hotspotRepository.GetAsync(dto.HotspotId, cancellationToken);
         if (hotspot.TrunkNum.Equals(OrderDefaults.SourceChannel.TrafficTrunkNum))
         {
-	        switch (dto.AcceptTypeCode)
-	        {
+            switch (dto.AcceptTypeCode)
+            {
                 //投诉举报
                 case "30":
                 case "35":
@@ -328,74 +328,74 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
                     valid.Validation = dto.Content.Contains("意见") || dto.Content.Contains("建议") || dto.Content.Contains("信息") || dto.Content.Contains("咨询");
                     if (dto.Content.Length < 25)
                     {
-	                    valid.Validation = true;
-	                    valid.Result = "保存失败,受理内容字数不足!";
+                        valid.Validation = true;
+                        valid.Result = "保存失败,受理内容字数不足!";
                     }
-					break;
+                    break;
                 // 意见
                 case "1":
-	                valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("信息") || dto.Title.Contains("咨询");
-	                valid.Validation = dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("信息") || dto.Content.Contains("咨询");
-	                if (dto.Content.Length < 5)
-	                {
-		                valid.Validation = true;
-		                valid.Result = "保存失败,受理内容字数不足!";
-	                }
-					break;
-				//建议求助
-				case "15":
+                    valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("信息") || dto.Title.Contains("咨询");
+                    valid.Validation = dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("信息") || dto.Content.Contains("咨询");
+                    if (dto.Content.Length < 5)
+                    {
+                        valid.Validation = true;
+                        valid.Result = "保存失败,受理内容字数不足!";
+                    }
+                    break;
+                //建议求助
+                case "15":
                 case "20":
-	                valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("信息") || dto.Title.Contains("咨询");
-	                valid.Validation = dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("信息") || dto.Content.Contains("咨询");
-	                if (dto.Content.Length < 25)
-	                {
-		                valid.Validation = true;
-		                valid.Result = "保存失败,受理内容字数不足!";
-	                }
-					break;
+                    valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("信息") || dto.Title.Contains("咨询");
+                    valid.Validation = dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("信息") || dto.Content.Contains("咨询");
+                    if (dto.Content.Length < 25)
+                    {
+                        valid.Validation = true;
+                        valid.Result = "保存失败,受理内容字数不足!";
+                    }
+                    break;
                 // 咨询
                 case "10":
-	                valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("意见") || dto.Title.Contains("建议");
-	                valid.Validation = dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("意见") || dto.Content.Contains("建议");
+                    valid.Validation = dto.Title.Contains("投诉") || dto.Title.Contains("举报") || dto.Title.Contains("意见") || dto.Title.Contains("建议");
+                    valid.Validation = dto.Content.Contains("投诉") || dto.Content.Contains("举报") || dto.Content.Contains("意见") || dto.Content.Contains("建议");
                     if (dto.Content.Length < 5)
                     {
                         valid.Validation = true;
                         valid.Result = "保存失败,受理内容字数不足!";
-					}
-					break;
+                    }
+                    break;
                 // 表扬
                 case "25":
-	                if (dto.Content.Length < 25)
-	                {
-		                valid.Validation = true;
-		                valid.Result = "保存失败,受理内容字数不足!";
-	                }
-					break;
+                    if (dto.Content.Length < 25)
+                    {
+                        valid.Validation = true;
+                        valid.Result = "保存失败,受理内容字数不足!";
+                    }
+                    break;
                 default:
-	                if (dto.Content.Length < 5)
-	                {
-		                valid.Validation = true;
-		                valid.Result = "保存失败,受理内容字数不足!";
-	                }
-					break;
-			}
+                    if (dto.Content.Length < 5)
+                    {
+                        valid.Validation = true;
+                        valid.Result = "保存失败,受理内容字数不足!";
+                    }
+                    break;
+            }
         }
 
         if (valid.Validation && string.IsNullOrEmpty(valid.Result))
             valid.Result = "标题或受理内容出现限制词,请检查!";
-		return valid;
-	}
-	#endregion
+        return valid;
+    }
+    #endregion
 
-	#region SchedulingSendOrder
+    #region SchedulingSendOrder
 
 
 
-	#endregion
+    #endregion
 
-	#region private
+    #region private
 
-	private async Task<Order> GetOrderByFlowIdAsync(string workflowId, CancellationToken cancellationToken)
+    private async Task<Order> GetOrderByFlowIdAsync(string workflowId, CancellationToken cancellationToken)
     {
         if (string.IsNullOrEmpty(workflowId))
             throw UserFriendlyException.SameMessage("无效流程编号");
@@ -447,7 +447,12 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         //成员单位标识  99
         //宜宾市 511500  市级
         var today = DateTime.Today;
-        var count = no.Substring(no.Length - 5);
+        //var count = no.Substring(no.Length - 5);
+
+        //todo 双系统并行暂时执行此方案
+        var count = no.Substring(no.Length - 4);
+        count = (Convert.ToInt32(count) + 50000).ToString();
+
         var provinceCodes = new[] { "RGDH", "WX", "WB", "AP", "WZ", "YJ", "SCZWFWW", "XCX", "QT" };
         var prefix = provinceCodes.Any(d => d.Equals(sourceChannelCode))
             ? sourceChannelCode
@@ -469,7 +474,7 @@ public class CacheOrderNO
     public int TotalCount { get; set; }
 }
 
-public class OrderValidation 
+public class OrderValidation
 {
     public bool Validation { get; set; }