From 7151ed87d1fcd0a5fed7d9bc729645489d50b0b2 Mon Sep 17 00:00:00 2001 From: sanji Date: Thu, 26 Oct 2023 10:29:51 +0800 Subject: [PATCH 1/2] 1 --- .../Statistics/JDReportFormStatisticsBusiness.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BBWY.Server.Business/Statistics/JDReportFormStatisticsBusiness.cs b/BBWY.Server.Business/Statistics/JDReportFormStatisticsBusiness.cs index 2f98c135..04a29edf 100644 --- a/BBWY.Server.Business/Statistics/JDReportFormStatisticsBusiness.cs +++ b/BBWY.Server.Business/Statistics/JDReportFormStatisticsBusiness.cs @@ -17,6 +17,7 @@ namespace BBWY.Server.Business.Statistics } + #region 计划/单元/创意/海投维度GOI public IList CalculationCampaignLevelGOI(GOIRequest gOIRequest) { var _7dEndDate = DateTime.Now.Date.AddDays(-1); @@ -501,6 +502,10 @@ namespace BBWY.Server.Business.Statistics return list; } + #endregion + + #region 商品维度 + public IList CalculationCampaignLevelProductGOI(GOIRequest gOIRequest) { var _7dEndDate = DateTime.Now.Date.AddDays(-1); @@ -980,6 +985,9 @@ namespace BBWY.Server.Business.Statistics return list; } + #endregion + + #region 推广维度 public IList CalculationCampaignLevelPopularizeGOI(GOIRequest gOIRequest) { @@ -1459,5 +1467,7 @@ namespace BBWY.Server.Business.Statistics } return list; } + + #endregion } } From a7a9103bd64eabf2430a648deed55ee5bf21f9db Mon Sep 17 00:00:00 2001 From: sanji Date: Thu, 26 Oct 2023 11:19:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?xx=E7=BB=9F=E8=AE=A1=E5=A2=9E=E5=8A=A0spu?= =?UTF-8?q?=E6=AF=9B=E5=88=A9=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Statistics/StatisticsBusiness.cs | 51 +++---------------- .../Response/Order/XingXinagSearchResponse.cs | 19 ++++++- 2 files changed, 24 insertions(+), 46 deletions(-) diff --git a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs index 54721e0e..2e51173b 100644 --- a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs +++ b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs @@ -138,15 +138,16 @@ namespace BBWY.Server.Business return list; } - private void XingXiangCumulative(IList detailList, string spuId, bool isSD, decimal profit, decimal sdProductAmount, decimal sdCost) + private void XingXiangCumulative(IList detailList, string spuId, bool isSD, decimal profit, decimal spuProductAmount, decimal sdProductAmount, decimal sdCost) { var xxRespose = detailList.FirstOrDefault(xx => xx.Spu == spuId); if (xxRespose == null) { - xxRespose = new XingXiangItemResponse() { Spu = spuId, Profit = 0M }; + xxRespose = new XingXiangItemResponse() { Spu = spuId, Profit = 0M, ActualAmount = 0M }; detailList.Add(xxRespose); } xxRespose.Profit += profit; + xxRespose.ActualAmount += spuProductAmount; if (isSD) { xxRespose.SDOrderCount++; @@ -182,6 +183,7 @@ namespace BBWY.Server.Business //DeliveryExpressFreight = oc.DeliveryExpressFreight, //PreferentialAmount = oc.PreferentialAmount, OrderSellerPrice = o.OrderSellerPrice, + FreightPrice = o.FreightPrice, //SellerPreferentialAmount = o.SellerPreferentialAmount, Profit = oc.Profit }); @@ -202,7 +204,7 @@ namespace BBWY.Server.Business if (order.StorageType == Enums.StorageType.SD) { - XingXiangCumulative(detailList, currentOrderSkuList[0].ProductId, true, order.Profit ?? 0M, order.OrderSellerPrice, Math.Abs(order.Profit ?? 0M)); + XingXiangCumulative(detailList, currentOrderSkuList[0].ProductId, true, order.Profit ?? 0M, order.OrderSellerPrice, order.OrderSellerPrice + order.FreightPrice, Math.Abs(order.Profit ?? 0M)); continue; } @@ -223,49 +225,8 @@ namespace BBWY.Server.Business var spuProfitPercent = tempOrderProfit == 0M ? 0M : tempSpuProfit / tempOrderProfit; var realSpuProfit = (order.Profit ?? 0M) * spuProfitPercent; - XingXiangCumulative(detailList, spuGroup.Key, false, realSpuProfit, 0, 0); + XingXiangCumulative(detailList, spuGroup.Key, false, realSpuProfit, tempSpuProductAmount, 0, 0); } - - //foreach (var group in spuGroups) - //{ - // var spuId = group.Key; - - // var profit = 0M; - // var sdCost = 0M; - // var prodcutAmount = group.Sum(osku => osku.Price * osku.ItemTotal) ?? 0; //货款 - // var skuSellerPreferentialAmount = order.SellerPreferentialAmount / skuCount * group.Count(); //该SPU分摊的商家优惠金额 - // prodcutAmount -= skuSellerPreferentialAmount; - // var commissionAmount = prodcutAmount * platformCommissionRatio; //该SPU的平台扣点金额 - // var freightPriceByUser = order.FreightPrice == 0 ? 0 : order.FreightPrice / skuCount * group.Count(); //该SPU分摊的用户承担运费 - // var currentOrderCostDetailList = orderCostDetailList.Where(ocd => ocd.OrderId == order.Id && ocd.ProductId == spuId).ToList(); - // var purchaseAmount = currentOrderCostDetailList.Count() > 0 ? currentOrderCostDetailList.Sum(ocd => ocd.TotalCost) : 0; - // var deliveryFreight = currentOrderCostDetailList.Count() > 0 ? currentOrderCostDetailList.Sum(ocd => ocd.DeliveryExpressFreight) : 0; - - // if (order.StorageType != Enums.StorageType.SD) - // { - // profit = prodcutAmount + freightPriceByUser - purchaseAmount - deliveryFreight - commissionAmount; - // } - // else - // { - // var sdCommissionAmount = order.SDCommissionAmount.Value / skuCount * group.Count(); - // profit = 0; - // sdCost = sdCommissionAmount + commissionAmount + order.DeliveryExpressFreight ?? 0M; - // totalSDOrderCost += sdCost; - // } - // var xxRespose = detailList.FirstOrDefault(xx => xx.Spu == spuId); - // if (xxRespose == null) - // { - // xxRespose = new XingXiangItemResponse() { Spu = spuId, Profit = 0M }; - // detailList.Add(xxRespose); - // } - // xxRespose.Profit += profit; - // if (order.StorageType == Enums.StorageType.SD) - // { - // xxRespose.SDOrderCount++; - // xxRespose.SDOrderAmount += prodcutAmount; - // xxRespose.SDOrderCost += sdCost; - // } - //} } var sdOrderList = orderList.Where(o => o.StorageType == Enums.StorageType.SD); diff --git a/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs b/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs index 1531e0ec..2cb074f3 100644 --- a/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs +++ b/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace BBWY.Server.Model.Dto { @@ -38,6 +39,22 @@ namespace BBWY.Server.Model.Dto public decimal Profit { get; set; } + /// + /// 实收金额 + /// + public decimal ActualAmount { get; set; } + + /// + /// 毛利率 + /// + public decimal ProfitRatio + { + get + { + return ActualAmount == 0 ? 0 : Math.Round(Profit / ActualAmount * 100, 2); + } + } + /// /// 刷单单量 ///