|
|
@ -12,6 +12,7 @@ using Newtonsoft.Json; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using NLog; |
|
|
|
using System; |
|
|
|
using System.Collections.Concurrent; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
@ -171,12 +172,13 @@ namespace BBWY.Server.Business |
|
|
|
List<OrderSku> insertOrderSkuList = new List<OrderSku>(); |
|
|
|
List<OrderCoupon> insertOrderCouponList = new List<OrderCoupon>(); |
|
|
|
List<SkuDailySalesDetail> insertSkuDailySaleDetailList = new List<SkuDailySalesDetail>(); |
|
|
|
List<Giftorder> insertGiftorderList = new List<Giftorder>(); |
|
|
|
|
|
|
|
IList<IUpdate<Order>> updateOrderList = new List<IUpdate<Order>>(); |
|
|
|
IList<IUpdate<PurchaseOrder>> updatePurchaseOrderList = new List<IUpdate<PurchaseOrder>>(); |
|
|
|
IList<IUpdate<SkuDailySalesDetail>> updateSkuDailySalesDetailList = new List<IUpdate<SkuDailySalesDetail>>(); |
|
|
|
|
|
|
|
IDictionary<DateTime, List<SkuDailySalesDetail>> skuDailySalesDetailDictionary = new Dictionary<DateTime, List<SkuDailySalesDetail>>(); |
|
|
|
ConcurrentDictionary<DateTime, List<SkuDailySalesDetail>> skuDailySalesDetailDictionary = new ConcurrentDictionary<DateTime, List<SkuDailySalesDetail>>(); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 赠品
|
|
|
@ -192,6 +194,15 @@ namespace BBWY.Server.Business |
|
|
|
foreach (var orderJToken in newGiftOrderJArray) |
|
|
|
{ |
|
|
|
var orderStartTime = orderJToken.Value<DateTime>("orderStartTime"); |
|
|
|
insertGiftorderList.Add(new Giftorder() |
|
|
|
{ |
|
|
|
Id = orderJToken.Value<string>("orderId"), |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
Platform = Enums.Platform.京东, |
|
|
|
ShopId = shopId, |
|
|
|
StartTime = orderStartTime |
|
|
|
}); |
|
|
|
|
|
|
|
var itemInfoList = orderJToken["itemInfoList"] as JArray; |
|
|
|
foreach (var orderSkuJToken in itemInfoList) |
|
|
|
{ |
|
|
@ -717,6 +728,8 @@ namespace BBWY.Server.Business |
|
|
|
fsql.Insert(insertOrderCouponList).ExecuteAffrows(); |
|
|
|
if (insertSkuDailySaleDetailList.Count() > 0) |
|
|
|
fsql.Insert(insertSkuDailySaleDetailList).ExecuteAffrows(); |
|
|
|
if (insertGiftorderList.Count > 0) |
|
|
|
fsql.Insert(insertGiftorderList).ExecuteAffrows(); |
|
|
|
|
|
|
|
if (updatePurchaseOrderList.Count() > 0) |
|
|
|
{ |
|
|
@ -758,7 +771,7 @@ namespace BBWY.Server.Business |
|
|
|
/// <param name="spuId"></param>
|
|
|
|
/// <param name="price"></param>
|
|
|
|
/// <param name="itemTotal"></param>
|
|
|
|
private void CumulativeSkuDailySalesDetail(IDictionary<DateTime, List<SkuDailySalesDetail>> skuDailySalesDetailDictionary, |
|
|
|
private void CumulativeSkuDailySalesDetail(ConcurrentDictionary<DateTime, List<SkuDailySalesDetail>> skuDailySalesDetailDictionary, |
|
|
|
DateTime orderStartTime, |
|
|
|
long shopId, |
|
|
|
string skuId, |
|
|
@ -770,7 +783,7 @@ namespace BBWY.Server.Business |
|
|
|
if (!skuDailySalesDetailDictionary.TryGetValue(startDate, out List<SkuDailySalesDetail> skuDailySalesDetailList)) |
|
|
|
{ |
|
|
|
skuDailySalesDetailList = new List<SkuDailySalesDetail>(); |
|
|
|
skuDailySalesDetailDictionary.Add(orderStartTime, skuDailySalesDetailList); |
|
|
|
skuDailySalesDetailDictionary.TryAdd(startDate, skuDailySalesDetailList); |
|
|
|
} |
|
|
|
var skuDailySalesDetail = skuDailySalesDetailList.FirstOrDefault(s => s.Sku == skuId); |
|
|
|
if (skuDailySalesDetail == null) |
|
|
|