From 42a3e35216aee7390bace0270cd4d90a4728657d Mon Sep 17 00:00:00 2001 From: sanji Date: Fri, 10 Nov 2023 16:06:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=94=B9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SiNan.API/Controllers/GOIController.cs | 2 +- SiNan.Business/GOIBusiness.cs | 20 ++++++++++--------- SiNan.Business/ProductBusiness.cs | 1 - .../Response/JDXX/JDXXHistogramResponse.cs | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/SiNan.API/Controllers/GOIController.cs b/SiNan.API/Controllers/GOIController.cs index 1db72c8..9613491 100644 --- a/SiNan.API/Controllers/GOIController.cs +++ b/SiNan.API/Controllers/GOIController.cs @@ -42,7 +42,7 @@ namespace SiNan.API.Controllers /// /// [HttpPost] - public JDXXHistogramResponse QueryProduct360HistogramStatistics([FromBody] JDXXHistogramRequest request) + public List QueryProduct360HistogramStatistics([FromBody] JDXXHistogramRequest request) { return goiBusiness.QueryProduct360HistogramStatistics(request); } diff --git a/SiNan.Business/GOIBusiness.cs b/SiNan.Business/GOIBusiness.cs index 6af0cae..6b8ff47 100644 --- a/SiNan.Business/GOIBusiness.cs +++ b/SiNan.Business/GOIBusiness.cs @@ -480,7 +480,7 @@ namespace SiNan.Business }; } - public JDXXHistogramResponse QueryProduct360HistogramStatistics(JDXXHistogramRequest request) + public List QueryProduct360HistogramStatistics(JDXXHistogramRequest request) { List skuIdList = null; if (!string.IsNullOrEmpty(request.Sku)) @@ -495,16 +495,18 @@ namespace SiNan.Business var startDate = DateTime.Now.Date.AddDays(-14); var endDate = DateTime.Now.Date.AddSeconds(-1); - var data = fsql.Select().Where(s => skuIdList.Contains(s.Sku)) + var datas = fsql.Select().Where(s => skuIdList.Contains(s.Sku)) .Where(s => s.CreateTime >= startDate && s.CreateTime <= endDate) - .ToAggregate(s => new JDXXHistogramResponse() + .GroupBy(s => s.Sku) + .ToList(g => new JDXXHistogramResponse() { - UV = s.Sum(s.Key.Uv), - Sales = s.Sum(s.Key.Sales), - Profit = s.Sum(s.Key.Profits), - TotalCost = s.Sum(s.Key.TotalCost) + Sku = g.Key, + UV = g.Sum(g.Value.Uv), + Sales = g.Sum(g.Value.Sales), + Profit = g.Sum(g.Value.Profits), + TotalCost = g.Sum(g.Value.TotalCost) }); - return data; + return datas; } public Product360TopStatisticsResponse QueryProduct360TopStatistics(Product360TopStatisticsRequest request) @@ -548,7 +550,7 @@ namespace SiNan.Business .WhereIf(!string.IsNullOrEmpty(request.Sku), (o, osku) => osku.SkuId == request.Sku) .Sum((o, osku) => osku.ItemTotal); - var pingjia = fsql.Select().Where(x => x.SpusId == spu).OrderByDescending(x => x.CreateTime).ToOne(x => x.TotalCount); + var pingjia = freeSqlMultiDBManager.XXfsql.Select().Where(x => x.SpusId == spu).OrderByDescending(x => x.CreateTime).ToOne(x => x.TotalCount); var historyPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, null, null); diff --git a/SiNan.Business/ProductBusiness.cs b/SiNan.Business/ProductBusiness.cs index b41accf..23701f6 100644 --- a/SiNan.Business/ProductBusiness.cs +++ b/SiNan.Business/ProductBusiness.cs @@ -48,7 +48,6 @@ namespace SiNan.Business public IList GetProductSkuList(SearchProductSkuRequest searchProductSkuRequest) { - var sendResult = restApiService.SendRequest("http://bbwytest.qiyue666.com", "api/product/GetProductSkuList", searchProductSkuRequest, null, HttpMethod.Post); if (sendResult.StatusCode != System.Net.HttpStatusCode.OK) throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode }; diff --git a/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs b/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs index 31a0432..ee266d5 100644 --- a/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs +++ b/SiNan.Model/Dto/Response/JDXX/JDXXHistogramResponse.cs @@ -21,5 +21,6 @@ /// 利润 /// public decimal? Profit { get; set; } + public string Sku { get; set; } } }