From a293b8343ffa753ad637a9d22c1b9c9444823df6 Mon Sep 17 00:00:00 2001 From: sanji Date: Wed, 6 Dec 2023 13:59:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B8=E5=8D=97=E8=81=9A=E5=90=88=E9=81=97?= =?UTF-8?q?=E6=BC=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SiNan.Business/AggregationBusiness.cs | 38 +++++++++++++-------------- SiNan.Business/GOIBusiness.cs | 19 +++++++------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/SiNan.Business/AggregationBusiness.cs b/SiNan.Business/AggregationBusiness.cs index 3e5f1fb..fcdbcc1 100644 --- a/SiNan.Business/AggregationBusiness.cs +++ b/SiNan.Business/AggregationBusiness.cs @@ -810,27 +810,25 @@ namespace SiNan.Business var adSkuGoi_AggregationDate_PopularizeLevel = aggregationDate_PopularizeLevelList.FirstOrDefault(x => x.Sku == adSku.Sku && x.BusinessType == adSku.BusinessType); var adSkuGoi_AggregationDate_ProductLevel = aggregationDate_ProductLevelList.FirstOrDefault(x => x.Sku == adSku.Sku && x.BusinessType == adSku.BusinessType); - if (adSkuGoi_AggregationDate_PopularizeLevel != null || adSkuGoi_AggregationDate_ProductLevel != null) + var adSkuDailyAggregation = new AggregationJDPopularizeAdSkuDaily() { - var adSkuDailyAggregation = new AggregationJDPopularizeAdSkuDaily() - { - Id = idGenerator.NewLong(), - CreateTime = DateTime.Now, - Date = aggregationDate, - ShopId = shopId, - Cost = adSkuGoi_AggregationDate_PopularizeLevel?.Cost ?? 0M, - PopularizeLevelProfit = adSkuGoi_AggregationDate_PopularizeLevel?.Profit ?? 0M, - PopularizeLevelGOI = adSkuGoi_AggregationDate_PopularizeLevel?.GOI ?? 0M, - ProductLevelProfit = adSkuGoi_AggregationDate_ProductLevel?.Profit ?? 0M, - ProductLevelGOI = adSkuGoi_AggregationDate_ProductLevel?.GOI ?? 0M, - AdGroupId = adSku.AdGroupId, - CampaignId = adSku.CampaignId, - BusinessType = adSku.BusinessType, - SkuId = adSku.Sku, - AdId = adSku.AdId - }; - insertAggregationAdSkuDailyList.Add(adSkuDailyAggregation); - } + Id = idGenerator.NewLong(), + CreateTime = DateTime.Now, + Date = aggregationDate, + ShopId = shopId, + Cost = adSkuGoi_AggregationDate_PopularizeLevel?.Cost ?? 0M, + PopularizeLevelProfit = adSkuGoi_AggregationDate_PopularizeLevel?.Profit ?? 0M, + PopularizeLevelGOI = adSkuGoi_AggregationDate_PopularizeLevel?.GOI ?? 0M, + ProductLevelProfit = adSkuGoi_AggregationDate_ProductLevel?.Profit ?? 0M, + ProductLevelGOI = adSkuGoi_AggregationDate_ProductLevel?.GOI ?? 0M, + AdGroupId = adSku.AdGroupId, + CampaignId = adSku.CampaignId, + BusinessType = adSku.BusinessType, + SkuId = adSku.Sku, + AdId = adSku.AdId + }; + insertAggregationAdSkuDailyList.Add(adSkuDailyAggregation); + #endregion } diff --git a/SiNan.Business/GOIBusiness.cs b/SiNan.Business/GOIBusiness.cs index 094baf1..115562a 100644 --- a/SiNan.Business/GOIBusiness.cs +++ b/SiNan.Business/GOIBusiness.cs @@ -228,27 +228,28 @@ namespace SiNan.Business foreach (var skuId in skuIdList) { { - var cost = costs.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 2)?.Cost ?? 0M; - var profit = profits.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 2)?.Profit ?? 0M; - - if (cost != 0 || profit != 0) + var kuaicheCost = costs.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 2); + var kuaicheProfit = profits.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 2); + if (kuaicheCost != null || kuaicheProfit != null) { + var cost = kuaicheCost?.Cost ?? 0M; + var profit = kuaicheProfit?.Profit ?? 0M; var adskuGoi = new GOIByAdSku() { Sku = skuId, Cost = cost, Profit = profit, BusinessType = 2 }; list.Add(adskuGoi); } - } { - var cost = costs.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 134217728)?.Cost ?? 0M; - var profit = profits.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 134217728)?.Profit ?? 0M; - if (cost != 0 || profit != 0) + var zntfCost = costs.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 134217728); + var zntfProfit = profits.FirstOrDefault(x => x.Sku == skuId && x.BusinessType == 134217728); + if (zntfCost != null || zntfProfit != null) { + var cost = zntfCost?.Cost ?? 0M; + var profit = zntfProfit?.Profit ?? 0M; var adskuGoi = new GOIByAdSku() { Sku = skuId, Cost = cost, Profit = profit, BusinessType = 134217728 }; list.Add(adskuGoi); } } - } return list; }