Browse Source

订单优惠公式调整

AddValidOverTime
shanji 2 years ago
parent
commit
cb8a95380d
  1. 6
      BBWY.Server.Business/Sync/OrderSyncBusiness.cs
  2. 18
      BBWY.Server.Business/TestBusiness.cs

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

@ -480,7 +480,8 @@ namespace BBWY.Server.Business
//actualProductAmount = orderPayment - freightPrice + pingtaibutie; //actualProductAmount = orderPayment - freightPrice + pingtaibutie;
pingtaiChengDanYouHuiQuan = (orderTotalInfo?.TotalPingTaiChengDanYouHuiQuan ?? 0M); pingtaiChengDanYouHuiQuan = (orderTotalInfo?.TotalPingTaiChengDanYouHuiQuan ?? 0M);
actualProductAmount = orderSellerPrice + pingtaiChengDanYouHuiQuan; actualProductAmount = orderSellerPrice + pingtaiChengDanYouHuiQuan;
preferentialAmount = orderTotalPrice - (actualProductAmount ?? 0M) - freightPrice; //preferentialAmount = orderTotalPrice - (actualProductAmount ?? 0M) - freightPrice;
preferentialAmount = orderTotalPrice - (actualProductAmount ?? 0M);
dbOrder = new Order() dbOrder = new Order()
{ {
Id = orderId, Id = orderId,
@ -595,7 +596,8 @@ namespace BBWY.Server.Business
pingtaiChengDanYouHuiQuan = (orderTotalInfo?.TotalPingTaiChengDanYouHuiQuan ?? 0M); pingtaiChengDanYouHuiQuan = (orderTotalInfo?.TotalPingTaiChengDanYouHuiQuan ?? 0M);
actualProductAmount = orderSellerPrice + pingtaiChengDanYouHuiQuan; actualProductAmount = orderSellerPrice + pingtaiChengDanYouHuiQuan;
preferentialAmount = orderTotalPrice - (actualProductAmount ?? 0M) - freightPrice; //preferentialAmount = orderTotalPrice - (actualProductAmount ?? 0M) - freightPrice;
preferentialAmount = orderTotalPrice - (actualProductAmount ?? 0M);
//preferentialAmount = dbOrder.PreferentialAmount; //preferentialAmount = dbOrder.PreferentialAmount;
if (storageType != null && dbOrder.StorageType != storageType) if (storageType != null && dbOrder.StorageType != storageType)

18
BBWY.Server.Business/TestBusiness.cs

@ -190,11 +190,17 @@ namespace BBWY.Server.Business
fsql.Update<OrderSku>().Set(osku => osku.ShouldPay, 0).Where(osku => orderIdList.Contains(osku.OrderId)).ExecuteAffrows(); fsql.Update<OrderSku>().Set(osku => osku.ShouldPay, 0).Where(osku => orderIdList.Contains(osku.OrderId)).ExecuteAffrows();
}); });
foreach (var orderId in orderIdList) for (var i = 0; i < orderIdList.Count(); i++)
{ {
var orderId = orderIdList[i];
orderSyncBusiness.SyncOrder(shop, orderId); orderSyncBusiness.SyncOrder(shop, orderId);
Thread.Sleep(1000); Console.WriteLine($"shopProgress {shopIndex}/{shopList.Count()} {shop.ShopName},orderProgress {i + 1}/{orderIdList.Count()}");
} }
// foreach (var orderId in orderIdList)
// {
// orderSyncBusiness.SyncOrder(shop, orderId);
// Thread.Sleep(1000);
// }
var orderList = fsql.Select<Order>(orderIdList).ToList(); var orderList = fsql.Select<Order>(orderIdList).ToList();
var orderSkuList = fsql.Select<OrderSku>().Where(osku => osku.Price > 0 && orderIdList.Contains(osku.OrderId)).ToList(); var orderSkuList = fsql.Select<OrderSku>().Where(osku => osku.Price > 0 && orderIdList.Contains(osku.OrderId)).ToList();
@ -217,7 +223,8 @@ namespace BBWY.Server.Business
foreach (var orderSku in currentOrderSkuList) foreach (var orderSku in currentOrderSkuList)
{ {
var ocd = currentOrderCostDetailList.FirstOrDefault(x => x.SkuId == orderSku.SkuId); var ocd = currentOrderCostDetailList.FirstOrDefault(x => x.SkuId == orderSku.SkuId);
if (ocd != null)
{
ocd.CalculationSkuGrossProfit(orderSku.ShouldPay ?? 0M, ocd.CalculationSkuGrossProfit(orderSku.ShouldPay ?? 0M,
orderSku.PingTaiChengDanYouHuiQuan ?? 0M, orderSku.PingTaiChengDanYouHuiQuan ?? 0M,
orderSku.SuperRedEnvelope ?? 0M, orderSku.SuperRedEnvelope ?? 0M,
@ -227,9 +234,12 @@ namespace BBWY.Server.Business
var update = fsql.Update<OrderCostDetail>(ocd.Id).Set(x => x.SkuGrossProfit, ocd.SkuGrossProfit); var update = fsql.Update<OrderCostDetail>(ocd.Id).Set(x => x.SkuGrossProfit, ocd.SkuGrossProfit);
updateOrderCostDetailList.Add(update); updateOrderCostDetailList.Add(update);
} }
}
var currentAfterOrderList = afterOrderList.Where(af => af.OrderId == order.Id).ToList(); var currentAfterOrderList = afterOrderList.Where(af => af.OrderId == order.Id).ToList();
var orderTotal = orderTotalList.FirstOrDefault(on => on.Id == order.Id); var orderTotal = orderTotalList.FirstOrDefault(on => on.Id == order.Id);
var orderCost = orderCostList.FirstOrDefault(oc => oc.OrderId == order.Id); var orderCost = orderCostList.FirstOrDefault(oc => oc.OrderId == order.Id);
if (orderCost != null && orderTotal != null)
{
orderCost.CalculationOrderProfitAndCost(order.ActualProductAmount ?? 0M, orderCost.CalculationOrderProfitAndCost(order.ActualProductAmount ?? 0M,
orderTotal.TotalPingTaiChengDanYouHuiQuan ?? 0M, orderTotal.TotalPingTaiChengDanYouHuiQuan ?? 0M,
orderTotal.TotalVenderFee ?? 0M, orderTotal.TotalVenderFee ?? 0M,
@ -245,6 +255,8 @@ namespace BBWY.Server.Business
}); });
} }
} }
}
} }
} }
} }

Loading…
Cancel
Save