Browse Source

产品GOI查询,总花费和总亏损应用时间条件

GOIAggregation
shanji 2 years ago
parent
commit
84ba35ac28
  1. 6
      SiNan.Business/GOIBusiness.cs
  2. 1
      SiNan.Model/Db/Product/Product.cs
  3. 4
      SiNan.Model/Dto/Response/GOI/ProductGOIResponse.cs
  4. 4
      SiNan.Model/Dto/Response/GOI/ProductSkuGOIResponse.cs

6
SiNan.Business/GOIBusiness.cs

@ -339,6 +339,7 @@ namespace SiNan.Business
{ {
if (request.ShopId == 0) if (request.ShopId == 0)
throw new BusinessException("缺少店铺Id"); throw new BusinessException("缺少店铺Id");
request.EndDate = request.EndDate.Date.AddDays(1).AddSeconds(-1);
if (request.PageSize > 10) if (request.PageSize > 10)
request.PageSize = 10; request.PageSize = 10;
@ -385,7 +386,7 @@ namespace SiNan.Business
var skuList = fsql.Select<ProductSku>().Where(ps => productIdList.Contains(ps.ProductId) && ps.State == 1).ToList<ProductSkuResponse>(); var skuList = fsql.Select<ProductSku>().Where(ps => productIdList.Contains(ps.ProductId) && ps.State == 1).ToList<ProductSkuResponse>();
var skuIdList = skuList.Select(s => s.Id).ToList(); var skuIdList = skuList.Select(s => s.Id).ToList();
var historyPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, null, null); var historyPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, request.StartDate, request.EndDate);
foreach (var product in productList) foreach (var product in productList)
{ {
@ -407,6 +408,7 @@ namespace SiNan.Business
{ {
if (!string.IsNullOrEmpty(request.Spu)) if (!string.IsNullOrEmpty(request.Spu))
throw new BusinessException("缺少spu"); throw new BusinessException("缺少spu");
request.EndDate = request.EndDate.Date.AddDays(1).AddSeconds(-1);
var productSkuList = fsql.Select<ProductSku, AggregationJDPopularizeSku>() var productSkuList = fsql.Select<ProductSku, AggregationJDPopularizeSku>()
.InnerJoin((ps, aps) => ps.Id == aps.Id) .InnerJoin((ps, aps) => ps.Id == aps.Id)
@ -447,7 +449,7 @@ namespace SiNan.Business
}).Map<List<ProductSkuGOIResponse>>(); }).Map<List<ProductSkuGOIResponse>>();
var skuIdList = productSkuList.Select(ps => ps.Id).ToList(); var skuIdList = productSkuList.Select(ps => ps.Id).ToList();
var historyPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, null, null); var historyPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, request.StartDate, request.EndDate);
foreach (var productSku in productSkuList) foreach (var productSku in productSkuList)
{ {
var historyPopularizeLevelGOI = historyPopularizeLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id); var historyPopularizeLevelGOI = historyPopularizeLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);

1
SiNan.Model/Db/Product/Product.cs

@ -54,7 +54,6 @@ namespace SiNan.Model.Db
/// </summary> /// </summary>
[Column(DbType = "decimal(18,2)")] [Column(DbType = "decimal(18,2)")]
public decimal? MaxDeficitThreshold { get; set; } = 0.00M; public decimal? MaxDeficitThreshold { get; set; } = 0.00M;
#endregion
} }
} }

4
SiNan.Model/Dto/Response/GOI/ProductGOIResponse.cs

@ -33,12 +33,12 @@
public GOIResponse PromotionGOI_Recent30Day { get; set; } public GOIResponse PromotionGOI_Recent30Day { get; set; }
/// <summary> /// <summary>
/// 累计花费 /// 花费
/// </summary> /// </summary>
public decimal TotalCost { get; set; } public decimal TotalCost { get; set; }
/// <summary> /// <summary>
/// 累计亏损 (正赚负亏) /// 亏损 (正赚负亏)
/// </summary> /// </summary>
public decimal TotalDeficit { get; set; } public decimal TotalDeficit { get; set; }

4
SiNan.Model/Dto/Response/GOI/ProductSkuGOIResponse.cs

@ -33,12 +33,12 @@
public GOIResponse PromotionGOI_Recent30Day { get; set; } public GOIResponse PromotionGOI_Recent30Day { get; set; }
/// <summary> /// <summary>
/// 累计花费 /// 花费
/// </summary> /// </summary>
public decimal TotalCost { get; set; } public decimal TotalCost { get; set; }
/// <summary> /// <summary>
/// 累计亏损 (正赚负亏) /// 亏损 (正赚负亏)
/// </summary> /// </summary>
public decimal TotalDeficit { get; set; } public decimal TotalDeficit { get; set; }

Loading…
Cancel
Save