shanji 3 years ago
parent
commit
b6e4d3ed0c
  1. 19
      BBWY.Server.Business/Sync/OrderSyncBusiness.cs
  2. 7
      BBWY.Server.Model/Db/Order/GiftOrder.cs

19
BBWY.Server.Business/Sync/OrderSyncBusiness.cs

@ -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)

7
BBWY.Server.Model/Db/Order/GiftOrder.cs

@ -5,7 +5,8 @@ namespace BBWY.Server.Model.Db
{
[Table(Name = "giftorder", DisableSyncStructure = true)]
public partial class Giftorder {
public partial class Giftorder
{
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)]
public string Id { get; set; }
@ -13,8 +14,8 @@ namespace BBWY.Server.Model.Db
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
public int? Platform { get; set; }
[Column(MapType = typeof(int))]
public Enums.Platform Platform { get; set; }
public long ShopId { get; set; }

Loading…
Cancel
Save