/// <summary>
        ///  获取订单关联信息
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        private static async Task <List <OrderRelationship> > GetOrderRelationShipOnly(int orderId)
        {
            List <OrderRelationship> order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.GetOrderRelationShipOnlyAsync(orderId, true);

                    fetchResult.ThrowIfException(true);

                    if (fetchResult.Success)
                    {
                        order = fetchResult.Result?.ToList();
                    }
                    else
                    {
                        Logger.Warn($"OrderQueryClient.GetOrderRelationShipOnly {orderId} 订单关联接口查询失败");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"GetOrderRelationShipOnly 接口异常;异常信息:{ex.Message};堆栈信息:{ex.StackTrace}", ex);
            }
            return(order);
        }
        /// <summary>
        /// 根据订单ID获取订单信息
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        private static async Task <OrderModel> FetchOrderInfoByID(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.FetchOrderInfoByIDAsync(orderId);

                    fetchResult.ThrowIfException(true);

                    if (fetchResult.Success)
                    {
                        order = fetchResult.Result;
                    }
                    else
                    {
                        Logger.Warn($"OrderQueryClient.FetchOrderInfoByIDAsync {orderId} 订单详情接口查询失败");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"FetchOrderInfoByID 接口异常;异常信息:{ex.Message};堆栈信息:{ex.StackTrace}", ex);
            }
            return(order);
        }
        /// <summary>
        /// 根据订单ID获取拆单订单的相关订单
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        private static async Task <List <int> > GetRelatedSplitOrderIDs(int orderId)
        {
            List <int> order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.GetRelatedSplitOrderIDsAsync(orderId, SplitQueryType.Full);

                    fetchResult.ThrowIfException(true);

                    if (fetchResult.Success)
                    {
                        order = fetchResult.Result?.ToList();
                    }
                    else
                    {
                        Logger.Warn($"OrderQueryClient.GetRelatedSplitOrderIDsAsync {orderId} 订单拆单关联接口查询失败");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"GetRelatedSplitOrderIDs 接口异常;异常信息:{ex.Message};堆栈信息:{ex.StackTrace}", ex);
            }
            return(order);
        }
        /// <summary>
        /// 获取订单信息(订单主信息和产品)
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public static OrderModel FetchOrderInfoByID(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = orderClient.FetchOrderInfoByID(orderId);
                    if (!fetchResult.Success)
                    {
                        Logger.Warn($"FetchOrderInfoByID,获取订单信息接口失败,message:{fetchResult.ErrorMessage}");
                    }
                    else
                    {
                        order = fetchResult.Result;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"FetchOrderInfoByID接口异常,异常信息:{ex.Message},堆栈信息:{ex.StackTrace}");
            }
            return(order);
        }
        /// <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);
        }
Example #6
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 string CheckOrderProductTypeByOrderId(int orderId)
        {
            var result = string.Empty;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = orderClient.CheckOrderProductTypeByOrderId(orderId);
                    if (!fetchResult.Success)
                    {
                        Logger.Warn($"CheckOrderProductTypeByOrderId,根据订单号判断订单产品类型接口失败,message:{fetchResult.ErrorMessage}");
                    }
                    else
                    {
                        result = fetchResult.Result ?? string.Empty;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"CheckOrderProductTypeByOrderId接口异常,异常信息:{ex.Message},堆栈信息:{ex.StackTrace}");
            }
            return(result);
        }
Example #8
0
        public static void testquery()
        {
            var req = new OrderQueryRequest()
            {
                ShipperCode = "SF", LogisticCode = "1234561"
            };
            Credential credential = new Credential()
            {
                SecretId  = "test1321750",
                SecretKey = "738881f4-fa19-4e11-bae8-e5877ed8d1d4",
            };

            var client = new OrderQueryClient(credential, new ClientProfile(), true);
            var rsp    = client.Query(req);
        }
 /// <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);
     }
 }
        /// <summary>
        ///     获取第三方渠道
        /// </summary>
        /// <returns></returns>
        protected async Task <List <string> > _GetThirdPartyOrderChannelAsync()
        {
            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.Get3rdOrderChannelAsync();

                    fetchResult.ThrowIfException();
                    return(fetchResult?.Result?.ToList());
                }
            }
            catch (Exception e)
            {
                Logger.Error($" {nameof(DefaultGameManager)} -> {nameof(_GetThirdPartyOrderChannelAsync)} ");
                throw;
            }
        }
Example #11
0
        /// <summary>
        /// 查询订单信息
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public OrderModel FetchOrderByOrderId(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = orderClient.FetchOrderByOrderId(orderId);
                    fetchResult.ThrowIfException(true);
                    order = fetchResult.Success ? fetchResult.Result : null;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(order);
        }
        /// <summary>
        /// 获取订单信息(订单主信息和产品)
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public static async Task <OrderModel> FetchOrderInfoByID(int orderId)
        {
            OrderModel order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.FetchOrderInfoByIDAsync(orderId);

                    fetchResult.ThrowIfException(true);
                    order = fetchResult.Success ? fetchResult.Result : null;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("FetchOrderInfoByID 接口异常", ex);
            }
            return(order);
        }
        /// <summary>
        /// 获取所有第三方订单渠道
        /// </summary>
        /// <returns></returns>
        public static async Task <IEnumerable <string> > Get3rdOrderChannel()
        {
            IEnumerable <string> result = new List <string>();

            try
            {
                using (var client = new OrderQueryClient())
                {
                    var getResult = await client.Get3rdOrderChannelAsync();//获取三方渠道集合

                    getResult.ThrowIfException(true);
                    result = getResult.Result;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("CheckOrderProductTypeByOrderIdAsync 接口异常", ex);
            }
            return(result);
        }
        /// <summary>
        /// 根据号判断订单产品类型
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public static async Task <string> CheckOrderProductTypeByOrderIdAsync(int orderId)
        {
            var result = string.Empty;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.CheckOrderProductTypeByOrderIdAsync(orderId);

                    fetchResult.ThrowIfException(true);
                    result = fetchResult.Success ? fetchResult.Result : null;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("CheckOrderProductTypeByOrderIdAsync 接口异常", ex);
            }
            return(result ?? string.Empty);
        }
        /// <summary>
        /// 根据订单ID获取拆单订单的相关订单
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static async Task <IEnumerable <int> > GetRelatedSplitOrderIDsAsync(int orderId, SplitQueryType type)
        {
            IEnumerable <int> order = null;

            try
            {
                using (var orderClient = new OrderQueryClient())
                {
                    var fetchResult = await orderClient.GetRelatedSplitOrderIDsAsync(orderId, type);

                    fetchResult.ThrowIfException(true);
                    order = fetchResult.Success ? fetchResult.Result : null;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetRelatedSplitOrderIDsAsync 接口异常", ex);
            }
            return(order);
        }