From f3b313613f44d767d47cf4ddf94f0d63c6599634 Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Wed, 8 Nov 2023 21:01:20 +0800
Subject: [PATCH 1/2] 1
---
BBWY.Server.Business/Statistics/StatisticsBusiness.cs | 4 +++-
.../Dto/Response/Order/XingXinagSearchResponse.cs | 10 ++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs
index 0fd2515e..e5a0ba17 100644
--- a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs
+++ b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs
@@ -295,7 +295,9 @@ namespace BBWY.Server.Business
TotalSDOrderAmount = detailList.Sum(xx => xx.SDOrderAmount),
TotalSDOrderCount = sdOrderList.Count(),
TotalSDOrderCost = detailList.Sum(xx => xx.SDOrderCost),
- TotalProfit = detailList.Sum(xx => xx.Profit)
+ TotalProfit = detailList.Sum(xx => xx.Profit),
+ ShopYingLiRatio = detailList.FirstOrDefault()?.ShopYingLiRatio,
+ ShopProfitRatio = detailList.FirstOrDefault()?.ShopProfitRatio
};
}
diff --git a/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs b/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs
index 9a726b8b..fb790e6f 100644
--- a/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs
+++ b/BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs
@@ -29,6 +29,16 @@ namespace BBWY.Server.Model.Dto
/// 总利润
///
public decimal TotalProfit { get; set; }
+
+ ///
+ /// 店铺毛利率
+ ///
+ public decimal? ShopProfitRatio { get; set; }
+
+ ///
+ /// 店铺盈利率
+ ///
+ public decimal? ShopYingLiRatio { get; set; }
}
public class XingXiangItemResponse
From 8bd6fdc125c00173339cd3c68c44151f6b06b94b Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Thu, 9 Nov 2023 01:19:07 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=98=9F=E8=B1=A1=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BBWY.Server.Business/Statistics/StatisticsBusiness.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs
index e5a0ba17..8e5c9b8f 100644
--- a/BBWY.Server.Business/Statistics/StatisticsBusiness.cs
+++ b/BBWY.Server.Business/Statistics/StatisticsBusiness.cs
@@ -209,7 +209,7 @@ namespace BBWY.Server.Business
GOIByShop shopGoi = null;
#region spu goi
{
- var httpResult = restApiService.SendRequest("http://snapi.qiyue666.com/api/goi/QueryPopularizeLevelGOIBySpuId", string.Empty, new
+ var httpResult = restApiService.SendRequest("http://snapi.qiyue666.com/", "Api/GOI/QueryPopularizeLevelGOIBySpuId", new
{
SpuIdList = spuIdList,
StartTime = xingXiangSearchOrderRequest.SearchDate,
@@ -218,14 +218,14 @@ namespace BBWY.Server.Business
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new BusinessException("查询spu goi失败");
- var listRes = JsonConvert.DeserializeObject>(httpResult.Content);
+ var listRes = JsonConvert.DeserializeObject>>(httpResult.Content)?.Data;
spuGoiList = listRes.ItemList;
}
#endregion
#region shop goi
{
- var httpResult = restApiService.SendRequest("http://snapi.qiyue666.com/api/goi/QueryPopularizeLevelGOIByShopId", string.Empty, new
+ var httpResult = restApiService.SendRequest("http://snapi.qiyue666.com/", "Api/GOI/QueryPopularizeLevelGOIByShopId", new
{
xingXiangSearchOrderRequest.ShopId,
StartTime = xingXiangSearchOrderRequest.SearchDate,
@@ -234,7 +234,7 @@ namespace BBWY.Server.Business
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new BusinessException("查询店铺 goi失败");
- shopGoi = JsonConvert.DeserializeObject(httpResult.Content);
+ shopGoi = JsonConvert.DeserializeObject>(httpResult.Content)?.Data;
}
#endregion
@@ -280,6 +280,7 @@ namespace BBWY.Server.Business
{
var productAmount = orderSkuList.Where(osku => osku.ProductId == d.Spu).Sum(osku => osku.ItemTotal * osku.Price);
d.SpuYingLiRatio = Math.Round((spuGoi.Profit - spuGoi.Cost) / productAmount.Value, 2);
+ //d.SpuYingLiRatio = Math.Round((d.Profit - spuGoi.Cost) / productAmount.Value, 2);
}
d.ShopYingLiRatio = shopProductAmount == 0 ? 0 : Math.Round((shopGoi.Profit - shopGoi.Cost) / shopProductAmount.Value, 2);