Exemplo n.º 1
0
        /// <summary>
        /// 根据订单ID获取拆单订单的相关订单
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <int> GetRelatedSplitOrderIDs(int orderId, SplitQueryType type)
        {
            List <int> order = new List <int>();

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = orderClient.GetRelatedSplitOrderIDs(orderId, type);
                    if (!fetchResult.Success)
                    {
                        Logger.Warn($"GetRelatedSplitOrderIDs,根据订单ID获取拆单订单的相关订单接口失败,message:{fetchResult.ErrorMessage}");
                    }
                    else
                    {
                        order = fetchResult.Result == null ? new List <int>() : fetchResult.Result.ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"GetRelatedSplitOrderIDs 接口异常,异常信息:{ex.Message},堆栈信息:{ex.StackTrace}");
            }
            return(order);
        }
Exemplo n.º 2
0
 private static void Done(List <int> data)
 {
     if (data.Any())
     {
         var       num = 1;
         Stopwatch sw  = new Stopwatch();
         sw.Start();
         foreach (var item in data)
         {
             using (var client = new OrderQueryClient())
             {
                 var dat = client.GetRelatedSplitOrderIDs(item, SplitQueryType.Full);
                 if (dat.Success && dat.Result.Count() == 1)
                 {
                     using (var client2 = new ShopCommentClient())
                     {
                         var result = client2.SetShopCommentStatus(item);
                         if (result.Success == false || result.Result == false)
                         {
                             OrderDataLogger.Warn($"重置订单号为{item}的数据失败");
                         }
                     }
                 }
             }
             if (num % 20 == 0)
             {
                 sw.Stop();
                 OrderDataLogger.Info($"重置异常订单第{num - 20}到{num}条,共{data.Count},用时{sw.ElapsedMilliseconds}");
                 sw.Reset();
                 sw.Start();
             }
             num += 1;
         }
     }
 }
 /// <summary>
 /// 获取订单的拆单订单
 /// </summary>
 /// <param name="orderId"></param>
 /// <returns></returns>
 public static List <int> GetRelatedSplitOrderIds(int orderId)
 {
     try
     {
         using (var queryClient = new OrderQueryClient())
         {
             var queryResult = queryClient.GetRelatedSplitOrderIDs(orderId, SplitQueryType.Full);
             queryResult.ThrowIfException(true);
             return(queryResult.Result?.ToList());
         }
     }
     catch (Exception ex)
     {
         _logger.Error($"获取订单的拆单订单失败:{orderId}", ex);
         return(null);
     }
 }