diff --git a/SiNan.Business/GOIBusiness.cs b/SiNan.Business/GOIBusiness.cs index 59b16ad..ae7e853 100644 --- a/SiNan.Business/GOIBusiness.cs +++ b/SiNan.Business/GOIBusiness.cs @@ -506,6 +506,20 @@ namespace SiNan.Business Profit = g.Sum(g.Value.Profits), TotalCost = g.Sum(g.Value.TotalCost) }); + + var totalUV = datas.Sum(x => x.UV); + var totalSales = datas.Sum(x => x.Sales); + var totalProfit = datas.Sum(x => x.Profit); + var totalCost = datas.Sum(x => x.TotalCost); + + foreach (var data in datas) + { + data.UVPercent = totalUV == 0 ? 0 : Math.Round((data.UV / totalUV) ?? 0, 2); + data.SalesPercent = totalSales == 0 ? 0 : Math.Round((data.Sales / totalSales) ?? 0, 2); + data.ProfitPercent = totalProfit == 0 ? 0 : Math.Round((data.Profit / totalProfit) ?? 0, 2); + data.TotalCostPercent = totalCost == 0 ? 0 : Math.Round((data.TotalCost / totalCost) ?? 0, 2); + } + return datas; } diff --git a/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs b/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs index ee266d5..d8ea9bd 100644 --- a/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs +++ b/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs @@ -7,20 +7,41 @@ /// public decimal? UV { get; set; } + /// + /// UV百分比 + /// + public decimal? UVPercent { get; set; } + /// /// 销量 /// public decimal? Sales { get; set; } + /// + /// 销量百分比 + /// + public decimal? SalesPercent { get; set; } + /// /// 花费 /// public decimal? TotalCost { get; set; } + /// + /// 花费百分比 + /// + public decimal? TotalCostPercent { get; set; } + /// /// 利润 /// public decimal? Profit { get; set; } + + /// + /// 利润百分比 + /// + public decimal? ProfitPercent { get; set; } + public string Sku { get; set; } } }