Browse Source

Merge branch 'master' of http://code.qiyue666.com/pengcong001/bbwy

AddValidOverTime
506583276@qq.com 2 years ago
parent
commit
3578b533fd
  1. 13
      BBWY.Server.Business/Statistics/StatisticsBusiness.cs
  2. 10
      BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs

13
BBWY.Server.Business/Statistics/StatisticsBusiness.cs

@ -209,7 +209,7 @@ namespace BBWY.Server.Business
GOIByShop shopGoi = null; GOIByShop shopGoi = null;
#region spu goi #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, SpuIdList = spuIdList,
StartTime = xingXiangSearchOrderRequest.SearchDate, StartTime = xingXiangSearchOrderRequest.SearchDate,
@ -218,14 +218,14 @@ namespace BBWY.Server.Business
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK) if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new BusinessException("查询spu goi失败"); throw new BusinessException("查询spu goi失败");
var listRes = JsonConvert.DeserializeObject<ListResponse<GOIBySpu>>(httpResult.Content); var listRes = JsonConvert.DeserializeObject<ApiResponse<ListResponse<GOIBySpu>>>(httpResult.Content)?.Data;
spuGoiList = listRes.ItemList; spuGoiList = listRes.ItemList;
} }
#endregion #endregion
#region shop goi #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, xingXiangSearchOrderRequest.ShopId,
StartTime = xingXiangSearchOrderRequest.SearchDate, StartTime = xingXiangSearchOrderRequest.SearchDate,
@ -234,7 +234,7 @@ namespace BBWY.Server.Business
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK) if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new BusinessException("查询店铺 goi失败"); throw new BusinessException("查询店铺 goi失败");
shopGoi = JsonConvert.DeserializeObject<GOIByShop>(httpResult.Content); shopGoi = JsonConvert.DeserializeObject<ApiResponse<GOIByShop>>(httpResult.Content)?.Data;
} }
#endregion #endregion
@ -280,6 +280,7 @@ namespace BBWY.Server.Business
{ {
var productAmount = orderSkuList.Where(osku => osku.ProductId == d.Spu).Sum(osku => osku.ItemTotal * osku.Price); 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((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); d.ShopYingLiRatio = shopProductAmount == 0 ? 0 : Math.Round((shopGoi.Profit - shopGoi.Cost) / shopProductAmount.Value, 2);
@ -295,7 +296,9 @@ namespace BBWY.Server.Business
TotalSDOrderAmount = detailList.Sum(xx => xx.SDOrderAmount), TotalSDOrderAmount = detailList.Sum(xx => xx.SDOrderAmount),
TotalSDOrderCount = sdOrderList.Count(), TotalSDOrderCount = sdOrderList.Count(),
TotalSDOrderCost = detailList.Sum(xx => xx.SDOrderCost), 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
}; };
} }

10
BBWY.Server.Model/Dto/Response/Order/XingXinagSearchResponse.cs

@ -29,6 +29,16 @@ namespace BBWY.Server.Model.Dto
/// 总利润 /// 总利润
/// </summary> /// </summary>
public decimal TotalProfit { get; set; } public decimal TotalProfit { get; set; }
/// <summary>
/// 店铺毛利率
/// </summary>
public decimal? ShopProfitRatio { get; set; }
/// <summary>
/// 店铺盈利率
/// </summary>
public decimal? ShopYingLiRatio { get; set; }
} }
public class XingXiangItemResponse public class XingXiangItemResponse

Loading…
Cancel
Save