Browse Source

goi查询接口

GOIAggregation
sanji 2 years ago
parent
commit
186a386563
  1. 4
      .editorconfig
  2. 9
      SiNan.API.sln
  3. 236
      SiNan.Business/GOIBusiness.cs
  4. 9
      SiNan.Model/Core/GOI/GOIBySku.cs
  5. 75
      SiNan.Model/Db/GOI/JDOrderPopularizeRelation.cs
  6. 88
      SiNan.Model/Db/GOI/JDPopularizeAdGroup.cs
  7. 108
      SiNan.Model/Db/GOI/JDPopularizeAdSku.cs
  8. 81
      SiNan.Model/Db/GOI/JDPopularizeCampaign.cs
  9. 289
      SiNan.Model/Db/Order/Order.cs
  10. 121
      SiNan.Model/Db/Order/OrderCostDetail.cs
  11. 3
      SiNan.Model/Dto/Request/Product/QueryProductGOIRequest.cs
  12. 16
      SiNan.Model/Enums.cs
  13. 14
      SiNan.Model/MappingProfiles.cs
  14. 5
      SiNan.Model/SiNan.Model.csproj

4
.editorconfig

@ -0,0 +1,4 @@
[*.cs]
# CS8601: 引用类型赋值可能为 null。
dotnet_diagnostic.CS8601.severity = none

9
SiNan.API.sln

@ -7,9 +7,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiNan.API", "SiNan.API\SiNa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiNan.Business", "SiNan.Business\SiNan.Business.csproj", "{D936217A-5B0C-4E88-B9BD-F97A3C2EA1D9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiNan.Model", "SiNan.Model\SiNan.Model.csproj", "{8524A12A-FE6B-49BC-866B-52CB53C8BD1F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiNan.Model", "SiNan.Model\SiNan.Model.csproj", "{8524A12A-FE6B-49BC-866B-52CB53C8BD1F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiNan.Common", "SiNan.Common\SiNan.Common.csproj", "{521CB52C-EA2F-482D-AE07-EEF966552094}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiNan.Common", "SiNan.Common\SiNan.Common.csproj", "{521CB52C-EA2F-482D-AE07-EEF966552094}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{03E977B9-54D8-45AC-97CB-C1B4D89BE94B}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

236
SiNan.Business/GOIBusiness.cs

@ -1,5 +1,12 @@
using SiNan.Common.Log;
using AutoMapper;
using FreeSql;
using Google.Protobuf.Collections;
using SiNan.Common.Extensions;
using SiNan.Common.Log;
using SiNan.Common.Models;
using SiNan.Model;
using SiNan.Model.Core;
using SiNan.Model.Db;
using SiNan.Model.Dto;
using Yitter.IdGenerator;
@ -13,9 +20,234 @@ namespace SiNan.Business
this.freeSqlMultiDBManager = freeSqlMultiDBManager;
}
private IList<GOIBySku> StatisticsProductLevelGOI(IList<string> skuIdList, DateTime startDate, DateTime endDate)
{
var costs = fsql.Select<JDPopularizeAdSku>()
.Where(jas => skuIdList.Contains(jas.Sku) && jas.Date >= startDate && jas.Date <= endDate)
.GroupBy(jas => jas.Sku)
.ToList(g => new
{
Cost = g.Sum(g.Value.Cost),
Sku = g.Key
});
var profits = fsql.Select<OrderCostDetail, Order>()
.InnerJoin((ocd, o) => ocd.OrderId == o.Id)
.Where((ocd, o) => skuIdList.Contains(ocd.SkuId) &&
ocd.IsEnabled &&
ocd.CreateTime >= startDate &&
ocd.CreateTime <= endDate &&
o.OrderState != Enums.OrderState.)
.GroupBy((ocd, o) => ocd.SkuId)
.ToList(g => new
{
Profit = g.Sum(g.Value.Item1.SkuGrossProfit),
Sku = g.Key
});
IList<GOIBySku> list = new List<GOIBySku>();
foreach (var c in costs)
{
var skugoi = list.FirstOrDefault(x => x.Sku == c.Sku);
if (skugoi == null)
{
skugoi = new GOIBySku() { Sku = c.Sku };
list.Add(skugoi);
}
skugoi.Cost = c.Cost;
}
foreach (var p in profits)
{
var skugoi = list.FirstOrDefault(x => x.Sku == p.Sku);
if (skugoi == null)
{
skugoi = new GOIBySku() { Sku = p.Sku };
list.Add(skugoi);
}
skugoi.Profit = p.Profit;
}
return list;
}
private IList<GOIBySku> StatisticsPopularizeLevelGOI(IList<string> skuIdList, DateTime startDate, DateTime endDate)
{
IList<GOIBySku> list = new List<GOIBySku>();
var costs = fsql.Select<JDPopularizeAdSku>()
.Where(jas => skuIdList.Contains(jas.Sku) &&
jas.Date >= startDate && jas.Date <= endDate)
.GroupBy(jas => jas.Sku)
.ToList(g => new
{
Cost = g.Sum(g.Value.Cost),
Sku = g.Key
});
var profits = fsql.Select<JDOrderPopularizeRelation, OrderCostDetail, Order>()
.InnerJoin((jr, ocd, o) => jr.OrderId == ocd.OrderId)
.InnerJoin((jr, ocd, o) => jr.OrderId == o.Id)
.Where((jr, ocd, o) => skuIdList.Contains(jr.PopularizeSku) &&
jr.CookieTime >= startDate && jr.CookieTime <= endDate &&
ocd.IsEnabled == true &&
o.OrderState != Enums.OrderState.)
.GroupBy((jr, ocd, o) => jr.PopularizeSku)
.ToList(g => new
{
Profit = g.Sum(g.Value.Item2.SkuGrossProfit),
Sku = g.Key
});
foreach (var c in costs)
{
var skugoi = list.FirstOrDefault(x => x.Sku == c.Sku);
if (skugoi == null)
{
skugoi = new GOIBySku() { Sku = c.Sku };
list.Add(skugoi);
}
skugoi.Cost = c.Cost;
}
foreach (var p in profits)
{
var skugoi = list.FirstOrDefault(x => x.Sku == p.Sku);
if (skugoi == null)
{
skugoi = new GOIBySku() { Sku = p.Sku };
list.Add(skugoi);
}
skugoi.Profit = p.Profit;
}
return list;
}
public ListResponse<ProductGOIResponse> QueryProductGOI(QueryProductGOIRequest request)
{
return new ListResponse<ProductGOIResponse>();
if (request.ShopId == 0)
throw new BusinessException("缺少店铺Id");
ISelect<ProductSku>? skuChildSelect = string.IsNullOrEmpty(request.Sku) ?
null :
fsql.Select<ProductSku>().As("ps").Where(ps => ps.ShopId == request.ShopId && ps.Id == request.Sku);
var productList = fsql.Select<Product>().Where(p => p.ShopId == request.ShopId)
.WhereIf(!string.IsNullOrEmpty(request.Spu), p => p.Id == request.Spu)
.WhereIf(skuChildSelect != null, p => skuChildSelect.Where(ps => ps.ProductId == p.Id).Any())
.Page(request.PageIndex, request.PageSize)
.Count(out var productCount)
.ToList<ProductResponse>();
if (productList.Count == 0)
return new ListResponse<ProductGOIResponse>() { ItemList = new List<ProductGOIResponse>() };
var productIdList = productList.Select(p => p.Id).ToList();
var skuList = fsql.Select<ProductSku>().Where(ps => productIdList.Contains(ps.Id)).ToList<ProductSkuResponse>();
var skuIdList = skuList.Select(s => s.Id).ToList();
var startDate_yestoday = DateTime.Now.Date.AddDays(-1);
var endDate_yestoday = DateTime.Now.Date.AddSeconds(-1);
var startDate_Recent7day = DateTime.Now.Date.AddDays(-7);
var endDate_Recent7day = DateTime.Now.Date.AddSeconds(-1);
var startDate_Recent30day = DateTime.Now.Date.AddDays(-30);
var endDate_Recent30day = DateTime.Now.Date.AddSeconds(-1);
#region 商品维度
//昨天
var yestodayProductLevelGOIList = StatisticsProductLevelGOI(skuIdList, startDate_yestoday, endDate_yestoday);
//近7天
var recent7dayProductLevelGOIList = StatisticsProductLevelGOI(skuIdList, startDate_Recent7day, endDate_Recent7day);
//近30天
var recent30dayProductLevelGOIList = StatisticsProductLevelGOI(skuIdList, startDate_Recent30day, endDate_Recent30day);
#endregion
#region 推广维度
//昨天
var yestodayPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, startDate_yestoday, endDate_yestoday);
//近7天
var recent7dayPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, startDate_Recent7day, endDate_Recent7day);
//近30天
var recent30dayPopularizeLevelGOIList = StatisticsPopularizeLevelGOI(skuIdList, startDate_Recent30day, endDate_Recent30day);
#endregion
#region 累计花费
var accumulatCosts = fsql.Select<JDPopularizeAdSku>()
.Where(x => x.ShopId == request.ShopId &&
skuIdList.Contains(x.Sku) &&
x.Date >= request.StartDate &&
x.Date <= request.EndDate)
.GroupBy(x => x.Sku)
.ToList(g => new
{
Cost = g.Sum(g.Value.Cost),
Sku = g.Key
});
#endregion
List<ProductGOIResponse> productGOIList = new List<ProductGOIResponse>();
foreach (var product in productList)
{
var productGoi = product.Map<ProductGOIResponse>();
productGOIList.Add(productGoi);
productGoi.ProductSkuGOIList = skuList.Where(ps => ps.ProductId == product.Id).Map<List<ProductSkuGOIResponse>>();
foreach (var productSku in productGoi.ProductSkuGOIList)
{
productSku.ProductGOI_Yestoday = yestodayProductLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);
productSku.ProductGOI_Recent7Day = recent7dayProductLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);
productSku.ProductGOI_Recent30Day = recent30dayProductLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);
productSku.PromotionGOI_Yestoday = yestodayPopularizeLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);
productSku.PromotionGOI_Recent7Day = recent7dayPopularizeLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);
productSku.PromotionGOI_Recent30Day = recent30dayPopularizeLevelGOIList.FirstOrDefault(x => x.Sku == productSku.Id);
productSku.TotalCost = accumulatCosts.FirstOrDefault(x => x.Sku == productSku.Id)?.Cost ?? 0M;
}
productGoi.ProductGOI_Yestoday = new GOIResponse()
{
Cost = productGoi.ProductSkuGOIList.Sum(x => x.ProductGOI_Yestoday?.Cost ?? 0M),
Profit = productGoi.ProductSkuGOIList.Sum(x => x.ProductGOI_Yestoday?.Profit ?? 0M)
};
productGoi.ProductGOI_Recent7Day = new GOIResponse()
{
Cost = productGoi.ProductSkuGOIList.Sum(x => x.ProductGOI_Recent7Day?.Cost ?? 0M),
Profit = productGoi.ProductSkuGOIList.Sum(x => x.ProductGOI_Recent7Day?.Profit ?? 0M)
};
productGoi.ProductGOI_Recent30Day = new GOIResponse()
{
Cost = productGoi.ProductSkuGOIList.Sum(x => x.ProductGOI_Recent30Day?.Cost ?? 0M),
Profit = productGoi.ProductSkuGOIList.Sum(x => x.ProductGOI_Recent30Day?.Profit ?? 0M)
};
productGoi.PromotionGOI_Yestoday = new GOIResponse()
{
Cost = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Yestoday?.Cost ?? 0M),
Profit = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Yestoday?.Profit ?? 0M)
};
productGoi.PromotionGOI_Recent7Day = new GOIResponse()
{
Cost = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Recent7Day?.Cost ?? 0M),
Profit = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Recent7Day?.Profit ?? 0M)
};
productGoi.PromotionGOI_Recent30Day = new GOIResponse()
{
Cost = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Recent30Day?.Cost ?? 0M),
Profit = productGoi.ProductSkuGOIList.Sum(x => x.PromotionGOI_Recent30Day?.Profit ?? 0M)
};
productGoi.TotalCost = productGoi.ProductSkuGOIList.Sum(x => x.TotalCost);
}
return new ListResponse<ProductGOIResponse>()
{
Count = productCount,
ItemList = productGOIList
};
}
}
}

9
SiNan.Model/Core/GOI/GOIBySku.cs

@ -0,0 +1,9 @@
using SiNan.Model.Dto;
namespace SiNan.Model.Core
{
public class GOIBySku : GOIResponse
{
public string Sku { get; set; }
}
}

75
SiNan.Model/Db/GOI/JDOrderPopularizeRelation.cs

@ -0,0 +1,75 @@
using FreeSql.DataAnnotations;
using System;
namespace SiNan.Model.Db
{
/// <summary>
/// 京东订单推广归属关系表
/// </summary>
[Table(Name = "jdorderpopularizerelation", DisableSyncStructure = true)]
public partial class JDOrderPopularizeRelation {
[ Column(IsPrimary = true)]
public long Id { get; set; }
/// <summary>
/// 单元Id
/// </summary>
public long? AdGroupId { get; set; }
/// <summary>
/// 创意Id
/// </summary>
public long? AdId { get; set; }
/// <summary>
/// 业务线(快车:2 京速推:134217728)
/// </summary>
public int? BusinessType { get; set; }
/// <summary>
/// 计划Id
/// </summary>
public long? CampaignId { get; set; }
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
[Column(DbType = "datetime")]
public DateTime? OrderTime { get; set; }
/// <summary>
/// 点击时间
/// </summary>
[Column(DbType = "datetime")]
public DateTime? CookieTime { get; set; }
/// <summary>
/// 订单Id
/// </summary>
[Column(StringLength = 50)]
public string OrderId { get; set; }
/// <summary>
/// 下单Sku
/// </summary>
[Column(StringLength = 50)]
public string PlaceOrderSku { get; set; }
/// <summary>
/// 推广Sku
/// </summary>
[Column(StringLength = 50)]
public string PopularizeSku { get; set; }
public long? ShopId { get; set; }
}
}

88
SiNan.Model/Db/GOI/JDPopularizeAdGroup.cs

@ -0,0 +1,88 @@
using FreeSql.DataAnnotations;
using System;
namespace SiNan.Model.Db
{
/// <summary>
/// 京东推广单元表
/// </summary>
[Table(Name = "jdpopularizeadgroup", DisableSyncStructure = true)]
public partial class JDPopularizeAdGroup
{
[Column(IsPrimary = true)]
public long Id { get; set; }
/// <summary>
/// 单元Id
/// </summary>
public long? AdGroupId { get; set; }
[Column(StringLength = 100)]
public string AdGroupName { get; set; }
/// <summary>
/// 业务线(快车:2 京速推:134217728)
/// </summary>
public int? BusinessType { get; set; }
/// <summary>
/// 计划Id
/// </summary>
public long? CampaignId { get; set; }
/// <summary>
/// 点击数
/// </summary>
[Column(Name = "clicks")]
public int? Clicks { get; set; }
/// <summary>
/// 总花费
/// </summary>
[Column(DbType = "decimal(18,2)")]
public decimal? Cost { get; set; }
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 计费日期
/// </summary>
[Column(DbType = "datetime")]
public DateTime? Date { get; set; }
/// <summary>
/// 展现次数
/// </summary>
[Column(Name = "impressions")]
public int? Impressions { get; set; }
/// <summary>
/// 账号归属
/// </summary>
[Column(Name = "pin")]
public string Pin { get; set; }
public long? ShopId { get; set; }
/// <summary>
/// 总加购人数
/// </summary>
[Column(Name = "totalCartCnt")]
public int? TotalCartCnt { get; set; }
/// <summary>
/// 总订单数
/// </summary>
[Column(Name = "totalOrderCnt")]
public int? TotalOrderCnt { get; set; }
}
}

108
SiNan.Model/Db/GOI/JDPopularizeAdSku.cs

@ -0,0 +1,108 @@
using FreeSql.DataAnnotations;
using System;
namespace SiNan.Model.Db
{
/// <summary>
/// 京东推广SKU创意表
/// </summary>
[Table(Name = "jdpopularizeadsku", DisableSyncStructure = true)]
public partial class JDPopularizeAdSku
{
[Column(IsPrimary = true)]
public long Id { get; set; }
/// <summary>
/// 单元Id
/// </summary>
public long? AdGroupId { get; set; }
/// <summary>
/// 创意Id
/// </summary>
public long? AdId { get; set; }
[Column(StringLength = 100)]
public string AdName { get; set; }
/// <summary>
/// 业务线(快车:2 京速推:134217728)
/// </summary>
public int? BusinessType { get; set; }
/// <summary>
/// 计划Id
/// </summary>
public long? CampaignId { get; set; }
/// <summary>
/// 点击数
/// </summary>
[Column(Name = "clicks")]
public int? Clicks { get; set; }
/// <summary>
/// 总花费
/// </summary>
[Column(DbType = "decimal(18,2)")]
public decimal? Cost { get; set; }
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 计费日期
/// </summary>
[Column(DbType = "datetime")]
public DateTime? Date { get; set; }
/// <summary>
/// 展现次数
/// </summary>
[Column(Name = "impressions")]
public int? Impressions { get; set; }
/// <summary>
/// 账号归属
/// </summary>
[Column(Name = "pin")]
public string Pin { get; set; }
public long? ShopId { get; set; }
[Column(StringLength = 50)]
public string Sku { get; set; }
/// <summary>
/// 总加购人数
/// </summary>
[Column(Name = "totalCartCnt")]
public int? TotalCartCnt { get; set; }
/// <summary>
/// 总订单数
/// </summary>
[Column(Name = "totalOrderCnt")]
public int? TotalOrderCnt { get; set; }
/// <summary>
/// 总订单金额
/// </summary>
[Column(Name = "totalOrderSum")]
public decimal TotalOrderSum { get; set; }
/// <summary>
/// 访客数
/// </summary>
[Column(Name = "visitorCnt")]
public int VisitorCnt { get; set; }
}
}

81
SiNan.Model/Db/GOI/JDPopularizeCampaign.cs

@ -0,0 +1,81 @@
using FreeSql.DataAnnotations;
using System;
namespace SiNan.Model.Db
{
/// <summary>
/// 京东推广计划表
/// </summary>
[Table(Name = "jdpopularizecampaign", DisableSyncStructure = true)]
public partial class JDPopularizeCampaign
{
[Column(IsPrimary = true)]
public long Id { get; set; }
/// <summary>
/// 业务线(快车:2 京速推:134217728)
/// </summary>
public int? BusinessType { get; set; }
/// <summary>
/// 计划Id
/// </summary>
public long? CampaignId { get; set; }
[Column(StringLength = 100)]
public string CampaignName { get; set; }
/// <summary>
/// 点击数
/// </summary>
[Column(Name = "clicks")]
public int? Clicks { get; set; }
/// <summary>
/// 总花费
/// </summary>
[Column(DbType = "decimal(18,2)")]
public decimal? Cost { get; set; }
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 计费日期
/// </summary>
[Column(DbType = "datetime")]
public DateTime? Date { get; set; }
/// <summary>
/// 展现次数
/// </summary>
[Column(Name = "impressions")]
public int? Impressions { get; set; }
/// <summary>
/// 账号归属
/// </summary>
[Column(Name = "pin")]
public string Pin { get; set; }
public long? ShopId { get; set; }
/// <summary>
/// 总加购人数
/// </summary>
[Column(Name = "totalCartCnt")]
public int? TotalCartCnt { get; set; }
/// <summary>
/// 总订单数
/// </summary>
[Column(Name = "totalOrderCnt")]
public int? TotalOrderCnt { get; set; }
}
}

289
SiNan.Model/Db/Order/Order.cs

@ -0,0 +1,289 @@
using FreeSql.DataAnnotations;
namespace SiNan.Model.Db
{
/// <summary>
/// 订单表
/// </summary>
[Table(Name = "order", DisableSyncStructure = true)]
public partial class Order
{
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)]
public string Id { get; set; }
/// <summary>
/// 买家备注
/// </summary>
public string BuyerRemark { get; set; }
/// <summary>
/// 结束时间
/// </summary>
[Column(DbType = "datetime")]
public DateTime? EndTime { get; set; }
/// <summary>
/// 商品运费(用户承担)
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal FreightPrice { get; set; } = 0.00M;
/// <summary>
/// 修改时间
/// </summary>
[Column(DbType = "datetime")]
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 用户应付金额
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal OrderPayment { get; set; } = 0.00M;
/// <summary>
/// 订单货款金额
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal OrderSellerPrice { get; set; } = 0.00M;
/// <summary>
/// 平台补贴
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal PreferentialAmount { get; set; } = 0.00M;
/// <summary>
/// 商家优惠金额(商家承担)
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal SellerPreferentialAmount { get; set; } = 0.00M;
/// <summary>
/// 订单状态
/// </summary>
[Column(DbType = "int(1)", MapType = typeof(int?))]
public Enums.OrderState? OrderState { get; set; }
/// <summary>
/// 订单总价
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal OrderTotalPrice { get; set; } = 0.00M;
/// <summary>
/// 订单类型
/// </summary>
[Column(DbType = "int(1)", MapType = typeof(int?))]
public Enums.OrderType? OrderType { get; set; }
/// <summary>
/// 支付方式
/// </summary>
[Column(DbType = "int(1)", MapType = typeof(int?))]
public Enums.PayType? PayType { get; set; }
/// <summary>
/// 订单平台
/// </summary>
[Column(DbType = "int(1)", MapType = typeof(int?))]
public Enums.Platform? Platform { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[Column(DbType = "datetime")]
public DateTime? StartTime { get; set; }
/// <summary>
/// 仓储类型
/// </summary>
[Column(DbType = "int(1)", MapType = typeof(int?))]
public Enums.StorageType? StorageType { get; set; }
/// <summary>
/// 入仓订单标识
/// </summary>
[Column(StringLength = 50)]
public string StoreOrder { get; set; }
/// <summary>
/// 商家Id
/// </summary>
public long ShopId { get; set; }
/// <summary>
/// 商家备注
/// </summary>
public string VenderRemark { get; set; }
public string PurchaseRemark { get; set; }
/// <summary>
/// 仓库Id
/// </summary>
[Column(StringLength = 50)]
public string StoreId { get; set; }
/// <summary>
/// 运单号
/// </summary>
[Column(StringLength = 200)]
public string WaybillNo { get; set; }
/// <summary>
/// 订单旗帜
/// </summary>
[Column(StringLength = 10)]
public string Flag { get; set; }
/// <summary>
/// 刷单类型
/// </summary>
[Column(MapType = (typeof(int?)))]
public Enums.SDType? SDType { get; set; }
/// <summary>
/// 刷单关键词
/// </summary>
[Column(StringLength = 50)]
public string SDKey { get; set; }
/// <summary>
/// 刷单支付渠道
/// </summary>
[Column(MapType = (typeof(int?)))]
public Enums.PayChannelType? SDPayChannel { get; set; }
/// <summary>
/// 刷单交易账单号
/// </summary>
[Column(StringLength = 50)]
public string SDPayBillNo { get; set; }
/// <summary>
/// 刷单人
/// </summary>
[Column(StringLength = 20)]
public string SDOperator { get; set; }
/// <summary>
/// 是否为售后订单
/// </summary>
[Column(DbType = "bit")]
public bool IsAfterSaleOrder { get; set; } = false;
/// <summary>
/// 是否为赠品
/// </summary>
[Column(DbType = "bit")]
public bool IsGift { get; set; } = false;
#region 订单成本
/// <summary>
/// 平台扣点金额
/// </summary>
[Column(IsIgnore = true)]
public decimal? PlatformCommissionAmount { get; set; }
/// <summary>
/// 平台扣点百分比
/// </summary>
[Column(IsIgnore = true)]
public decimal? PlatformCommissionRatio { get; set; }
/// <summary>
/// 利润
/// </summary>
[Column(IsIgnore = true)]
public decimal? Profit { get; set; }
/// <summary>
/// 采购金额
/// </summary>
[Column(IsIgnore = true)]
public decimal? PurchaseAmount { get; set; } = 0.00M;
/// <summary>
/// 刷单佣金
/// </summary>
[Column(IsIgnore = true)]
public decimal? SDCommissionAmount { get; set; } = 0.00M;
/// <summary>
/// 刷单号费
/// </summary>
[Column(IsIgnore = true)]
public decimal? SDOrderAmount { get; set; } = 0.00M;
/// <summary>
/// 发货快递费
/// </summary>
[Column(IsIgnore = true)]
public decimal? DeliveryExpressFreight { get; set; } = 0.00M;
/// <summary>
/// 是否手动编辑过成本
/// </summary>
[Column(IsIgnore = true)]
public bool IsManualEdited { get; set; } = false;
/// <summary>
/// 退款金额
/// </summary>
[Column(IsIgnore = true)]
public decimal RefundAmount { get; set; } = 0.00M;
/// <summary>
/// 退款采购金额
/// </summary>
[Column(IsIgnore = true)]
public decimal RefundPurchaseAmount { get; set; } = 0.0M;
/// <summary>
/// 所有服务单的售后成本(不含退款采购成本)
/// </summary>
[Column(IsIgnore = true)]
public decimal AfterTotalCost { get; set; } = 0.0M;
#endregion
#region 收货人信息
[Column(IsIgnore = true)]
public string Address { get; set; }
[Column(IsIgnore = true)]
public string City { get; set; }
[Column(IsIgnore = true)]
public string ContactName { get; set; }
[Column(IsIgnore = true)]
public string County { get; set; }
[Column(IsIgnore = true)]
public string Mobile { get; set; }
[Column(IsIgnore = true)]
public string Province { get; set; }
[Column(IsIgnore = true)]
public string TelePhone { get; set; }
[Column(IsIgnore = true)]
public string Town { get; set; }
[Column(IsIgnore = true)]
public bool? IsDecode { get; set; }
#endregion
#region 仓库
[Column(IsIgnore = true)]
public string StoreName { get; set; }
#endregion
}
}

121
SiNan.Model/Db/Order/OrderCostDetail.cs

@ -0,0 +1,121 @@
using FreeSql.DataAnnotations;
namespace SiNan.Model.Db
{
[Table(Name = "ordercostdetail", DisableSyncStructure = true)]
public partial class OrderCostDetail
{
[Column(DbType = "bigint(1)", IsPrimary = true)]
public long Id { get; set; }
[Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 扣减数量
/// </summary>
[Column(DbType = "int(1)")]
public int DeductionQuantity { get; set; } = 0;
/// <summary>
/// 发货运费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal DeliveryExpressFreight { get; set; } = 0.00M;
[Column(StringLength = 50)]
public string OrderId { get; set; }
[Column(StringLength = 50)]
public string ProductId { get; set; }
/*/// <summary>
/// 单件成本
/// </summary>*/
//[Column(DbType = "decimal(20,2)")]
//public decimal UnitCost { get; set; } = 0.00M;
/// <summary>
/// 采购单流水Id
/// </summary>
[Column(DbType = "bigint(1)")]
public long PurchaseOrderPKId { get; set; }
[Column(StringLength = 50)]
public string SkuId { get; set; }
/// <summary>
/// Sku成本(商品成本)
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal SkuAmount { get; set; } = 0.00M;
/// <summary>
/// 采购运费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal PurchaseFreight { get; set; } = 0.00M;
/// <summary>
/// 头程运费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal FirstFreight { get; set; } = 0.00M;
///// <summary>
///// 操作费
///// </summary>
//[Column(DbType = "decimal(20,2)")]
//public decimal OperationAmount { get; set; } = 0.00M;
/// <summary>
/// 入仓操作费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal InStorageAmount { get; set; } = 0.00M;
/// <summary>
/// 出仓操作费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal OutStorageAmount { get; set; } = 0.00M;
/// <summary>
/// 耗材费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal ConsumableAmount { get; set; } = 0.00M;
/// <summary>
/// 仓储费
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal StorageAmount { get; set; } = 0.00M;
[Column(DbType = "bit")]
public bool IsEnabled { get; set; } = true;
/// <summary>
/// sku毛利
/// </summary>
[Column(DbType = "decimal(20,2)")]
public decimal SkuGrossProfit { get; set; } = 0.00M;
/// <summary>
/// 总计
/// </summary>
[Column(IsIgnore = true)]
public decimal TotalCost
{
get
{
return SkuAmount + PurchaseFreight + FirstFreight + InStorageAmount + OutStorageAmount + StorageAmount + ConsumableAmount;
}
}
//[Column(DbType = "decimal(20,2)")]
//public decimal TotalCost { get; set; } = 0.00M;
}
}

3
SiNan.Model/Dto/Request/Product/QueryProductGOIRequest.cs

@ -14,6 +14,9 @@
public DateTime EndDate { get; set; }
/// <summary>
/// 页码 从1开始
/// </summary>
public int PageIndex { get; set; }
public int PageSize { get; set; }

16
SiNan.Model/Enums.cs

@ -22,5 +22,21 @@
= 4,
= 10
}
/// <summary>
/// 订单状态
/// </summary>
public enum OrderState
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7,
退 = 8
}
}
}

14
SiNan.Model/MappingProfiles.cs

@ -0,0 +1,14 @@
using AutoMapper;
using SiNan.Model.Dto;
namespace SiNan.Model
{
public class MappingProfiles : Profile
{
public MappingProfiles()
{
CreateMap<ProductResponse, ProductGOIResponse>();
CreateMap<ProductSkuResponse, ProductSkuGOIResponse>();
}
}
}

5
SiNan.Model/SiNan.Model.csproj

@ -8,6 +8,11 @@
</PropertyGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="FreeSql" Version="3.2.801" />
</ItemGroup>

Loading…
Cancel
Save