|
|
@ -10,6 +10,7 @@ using FreeSql; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
@ -24,6 +25,10 @@ namespace BBWY.Server.Business |
|
|
|
private IFreeSql fsql; |
|
|
|
|
|
|
|
private IIdGenerator idGenerator; |
|
|
|
|
|
|
|
private Lazy<ProductBusiness> productBusinessLazy; |
|
|
|
private ProductBusiness productBusiness => productBusinessLazy.Value; |
|
|
|
|
|
|
|
private Lazy<FreeSqlMultiDBManager> freeSqlMultiDBManagerLazy; |
|
|
|
private FreeSqlMultiDBManager freeSqlMultiDBManager => freeSqlMultiDBManagerLazy.Value; |
|
|
|
|
|
|
@ -36,6 +41,7 @@ namespace BBWY.Server.Business |
|
|
|
this.fsql = fsql; |
|
|
|
this.idGenerator = idGenerator; |
|
|
|
freeSqlMultiDBManagerLazy = new Lazy<FreeSqlMultiDBManager>(() => serviceProvider.GetService<FreeSqlMultiDBManager>()); |
|
|
|
productBusinessLazy = new Lazy<ProductBusiness>(() => serviceProvider.GetService<ProductBusiness>()); |
|
|
|
} |
|
|
|
|
|
|
|
private ISelect<Order, OrderConsignee, OrderCost> GetOrderListQueryConditions(SearchOrderRequest searchOrderRequest) |
|
|
@ -977,9 +983,48 @@ namespace BBWY.Server.Business |
|
|
|
if (orderApiResult.StatusCode != System.Net.HttpStatusCode.OK) |
|
|
|
throw new BusinessException($"获取未付款订单失败 {orderApiResult.Content}"); |
|
|
|
|
|
|
|
var orderJToken = JToken.Parse(orderApiResult.Content); |
|
|
|
var orderInfoJToken = orderJToken["Data"]["jingdong_pop_order_notPayOrderById_responce"]["orderDataNotPayInfo"]; |
|
|
|
if (orderInfoJToken == null) |
|
|
|
throw new BusinessException("未查询到代付款订单"); |
|
|
|
|
|
|
|
} |
|
|
|
orderResponse = new OrderResponse() |
|
|
|
{ |
|
|
|
Id = orderInfoJToken["orderId"].ToString(), |
|
|
|
ShopId = request.ShopId.ToString(), |
|
|
|
OrderStartTime = DateTime.Parse(orderInfoJToken["orderCreated"].ToString()), |
|
|
|
ItemList = new List<OrderSkuResponse>(), |
|
|
|
Platform = request.Platform |
|
|
|
}; |
|
|
|
|
|
|
|
var orderSkuIds = string.Join(",", orderInfoJToken["itemList"].Children().Select(j => j.Value<string>("skuId"))); |
|
|
|
var skuList = productBusiness.GetProductSkuList(new SearchProductSkuRequest() |
|
|
|
{ |
|
|
|
AppKey = request.AppKey, |
|
|
|
AppSecret = request.AppSecret, |
|
|
|
AppToken = request.AppToken, |
|
|
|
Platform = request.Platform, |
|
|
|
Sku = orderSkuIds |
|
|
|
}); |
|
|
|
|
|
|
|
foreach (var sku in skuList) |
|
|
|
{ |
|
|
|
if (sku.Price != 0) |
|
|
|
{ |
|
|
|
var num = orderInfoJToken["itemList"].Children().FirstOrDefault(j => j.Value<string>("skuId") == sku.Id)?.Value<int>("num") ?? 1; |
|
|
|
orderResponse.ItemList.Add(new OrderSkuResponse() |
|
|
|
{ |
|
|
|
Logo = sku.Logo, |
|
|
|
OrderId = request.OrderId, |
|
|
|
Price = sku.Price, |
|
|
|
Title = sku.Title, |
|
|
|
ProductId = sku.ProductId, |
|
|
|
Id = sku.Id, |
|
|
|
ItemTotal = num |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return orderResponse; |
|
|
|
} |
|
|
|
} |
|
|
|