|
@ -140,19 +140,19 @@ namespace BBWYB.Server.Business |
|
|
|
|
|
|
|
|
#region 查询最近90天采购金额
|
|
|
#region 查询最近90天采购金额
|
|
|
var recent90dPurchasedAmountList = fsql.Select<OrderCostDetail, Order, OrderPurchaseInfo>() |
|
|
var recent90dPurchasedAmountList = fsql.Select<OrderCostDetail, Order, OrderPurchaseInfo>() |
|
|
.InnerJoin((ocd, o, opi) => ocd.OrderId == o.Id) |
|
|
.InnerJoin((ocd, o, opi) => ocd.OrderId == o.Id) |
|
|
.InnerJoin((ocd, o, opi) => o.Id == opi.OrderId) |
|
|
.InnerJoin((ocd, o, opi) => o.Id == opi.OrderId) |
|
|
.Where((ocd, o, opi) => o.OrderState != Enums.OrderState.已取消 && |
|
|
.Where((ocd, o, opi) => o.OrderState != Enums.OrderState.已取消 && |
|
|
ocd.IsEnabled == true && |
|
|
ocd.IsEnabled == true && |
|
|
opi.IsEnabled == true && |
|
|
opi.IsEnabled == true && |
|
|
opi.CreateTime >= recent90d && |
|
|
opi.CreateTime >= recent90d && |
|
|
purchaserIdList.Contains(opi.PurchaserId)) |
|
|
purchaserIdList.Contains(opi.PurchaserId)) |
|
|
.GroupBy((ocd, o, opi) => opi.PurchaserId) |
|
|
.GroupBy((ocd, o, opi) => opi.PurchaserId) |
|
|
.ToList(g => new |
|
|
.ToList(g => new |
|
|
{ |
|
|
{ |
|
|
PurchaserId = g.Key, |
|
|
PurchaserId = g.Key, |
|
|
PurchasedAmount = g.Sum(g.Value.Item1.SkuAmount + g.Value.Item1.PurchaseFreight) |
|
|
PurchasedAmount = g.Sum(g.Value.Item1.SkuAmount + g.Value.Item1.PurchaseFreight) |
|
|
}); |
|
|
}); |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
foreach (var purchaserId in purchaserIdList) |
|
|
foreach (var purchaserId in purchaserIdList) |
|
@ -172,7 +172,7 @@ namespace BBWYB.Server.Business |
|
|
#region 订单数/最近采购时间
|
|
|
#region 订单数/最近采购时间
|
|
|
var purchasedCountAndTime = poList.FirstOrDefault(x => x.PurchaserId == purchaserId); |
|
|
var purchasedCountAndTime = poList.FirstOrDefault(x => x.PurchaserId == purchaserId); |
|
|
var purchasedCount = purchasedCountAndTime?.Count ?? 0; |
|
|
var purchasedCount = purchasedCountAndTime?.Count ?? 0; |
|
|
var lastPurchaseTime = purchasedCountAndTime?.MaxPurchaseTime; |
|
|
var lastPurchasedTime = purchasedCountAndTime?.MaxPurchaseTime; |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 采购金额
|
|
|
#region 采购金额
|
|
@ -194,6 +194,7 @@ namespace BBWYB.Server.Business |
|
|
.Set(p => p.PurchasedSkuCount, purchasedSkuCount) |
|
|
.Set(p => p.PurchasedSkuCount, purchasedSkuCount) |
|
|
.Set(p => p.PurchasedCount, purchasedCount) |
|
|
.Set(p => p.PurchasedCount, purchasedCount) |
|
|
.Set(p => p.PurchasedAmount, purchasedAmount) |
|
|
.Set(p => p.PurchasedAmount, purchasedAmount) |
|
|
|
|
|
.Set(p => p.LastPurchasedTime, lastPurchasedTime) |
|
|
.Set(p => p.Recent90dPurchasedAmount, recent90dPurchasedAmount) |
|
|
.Set(p => p.Recent90dPurchasedAmount, recent90dPurchasedAmount) |
|
|
.Set(p => p.Recent90dPurchasedCount, recent90dPurchasedCount); |
|
|
.Set(p => p.Recent90dPurchasedCount, recent90dPurchasedCount); |
|
|
updatePurchaserList.Add(update); |
|
|
updatePurchaserList.Add(update); |
|
|