|
|
@ -173,12 +173,16 @@ namespace SiNan.Business |
|
|
|
if (request.ShopId == 0) |
|
|
|
throw new BusinessException("缺少店铺Id"); |
|
|
|
|
|
|
|
if (request.PageSize > 5) |
|
|
|
request.PageSize = 5; |
|
|
|
|
|
|
|
ISelect<ProductSku>? skuChildSelect = string.IsNullOrEmpty(request.Sku) ? |
|
|
|
null : |
|
|
|
fsql.Select<ProductSku>().As("ps").Where(ps => ps.ShopId == request.ShopId && ps.Id == request.Sku); |
|
|
|
var productList = fsql.Select<Product>().Where(p => p.ShopId == request.ShopId) |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), p => p.Id == request.Spu) |
|
|
|
.WhereIf(skuChildSelect != null, p => skuChildSelect.Where(ps => ps.ProductId == p.Id).Any()) |
|
|
|
.OrderByDescending(p => p.CreateTime) |
|
|
|
.Page(request.PageIndex, request.PageSize) |
|
|
|
.Count(out var productCount) |
|
|
|
.ToList<ProductResponse>(); |
|
|
@ -278,6 +282,7 @@ namespace SiNan.Business |
|
|
|
Cost = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Recent30Day?.Cost ?? 0M), |
|
|
|
Profit = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Recent30Day?.Profit ?? 0M) |
|
|
|
}; |
|
|
|
|
|
|
|
productGoi.TotalCost = productGoi.ProductSkuGOIList.Sum(x => x.TotalCost); |
|
|
|
productGoi.TotalDeficit = productGoi.ProductSkuGOIList.Sum(x => x.TotalDeficit); |
|
|
|
} |
|
|
@ -291,8 +296,18 @@ namespace SiNan.Business |
|
|
|
|
|
|
|
public ListResponse<Product360PopularizeAnalysisCampaginRepsonse> QueryProduct360PopularizeGOI(Product360PopularizeAnalysisRequest request) |
|
|
|
{ |
|
|
|
if (request.SkuIdList == null || request.SkuIdList.Count() == 0) |
|
|
|
throw new BusinessException("缺少sku"); |
|
|
|
if (string.IsNullOrEmpty(request.Spu) && string.IsNullOrEmpty(request.Sku)) |
|
|
|
throw new BusinessException("不能同时缺少spu和sku条件"); |
|
|
|
|
|
|
|
var skuIdList = new List<string>(); |
|
|
|
if (!string.IsNullOrEmpty(request.Sku)) |
|
|
|
{ |
|
|
|
request.Spu = string.Empty; |
|
|
|
skuIdList.Add(request.Sku); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(request.Spu)) |
|
|
|
skuIdList = fsql.Select<ProductSku>().Where(ps => ps.ProductId == request.Spu).ToList(ps => ps.Id); |
|
|
|
|
|
|
|
List<Product360PopularizeAnalysisCampaginRepsonse> list = new List<Product360PopularizeAnalysisCampaginRepsonse>(); |
|
|
|
|
|
|
|
var startDate_Recent7day = DateTime.Now.Date.AddDays(-7); |
|
|
@ -304,8 +319,8 @@ namespace SiNan.Business |
|
|
|
var popularizeAdSkuSourceList = fsql.Select<JDPopularizeAdSku>() |
|
|
|
.Where(x => x.ShopId == request.ShopId) |
|
|
|
.Where(x => x.Date >= request.StartDate && x.Date <= request.EndDate) |
|
|
|
.WhereIf(request.SkuIdList.Count() == 1, x => x.Sku == request.SkuIdList[0]) |
|
|
|
.WhereIf(request.SkuIdList.Count() > 1, x => request.SkuIdList.Contains(x.Sku)) |
|
|
|
.WhereIf(skuIdList.Count() == 1, x => x.Sku == skuIdList[0]) |
|
|
|
.WhereIf(skuIdList.Count() > 1, x => skuIdList.Contains(x.Sku)) |
|
|
|
.ToList(); |
|
|
|
|
|
|
|
var kuaicheCampaignSourceList = popularizeAdSkuSourceList.Where(x => x.BusinessType == 2).ToList(); |
|
|
|