14 changed files with 1056 additions and 7 deletions
@ -0,0 +1,27 @@ |
|||
using BBWYB.Server.Business.Sync; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace BBWYB.Server.API.Controllers |
|||
{ |
|||
|
|||
public class OrderSyncController : BaseApiController |
|||
{ |
|||
private OrderSyncBusiness orderSyncBusiness; |
|||
public OrderSyncController(IHttpContextAccessor httpContextAccessor, OrderSyncBusiness orderSyncBusiness) : base(httpContextAccessor) |
|||
{ |
|||
this.orderSyncBusiness = orderSyncBusiness; |
|||
} |
|||
|
|||
[HttpPost] |
|||
public void AutoOrderSync() |
|||
{ |
|||
orderSyncBusiness.AutoOrderSync(); |
|||
} |
|||
|
|||
[HttpPost("{shopId}/{orderId}")] |
|||
public void ManualOrderSync([FromRoute] long shopId, [FromRoute] string orderId) |
|||
{ |
|||
orderSyncBusiness.ManualOrderSync(shopId, orderId, null, null); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
namespace BBWYB.Server.Business |
|||
{ |
|||
public class FreeSqlMultiDBManager |
|||
{ |
|||
public IFreeSql BBWYfsql { get; set; } |
|||
public IFreeSql MDSfsql { get; set; } |
|||
} |
|||
} |
@ -1,7 +1,189 @@ |
|||
namespace BBWYB.Server.Business.Sync |
|||
using BBWYB.Common.Log; |
|||
using BBWYB.Common.Models; |
|||
using BBWYB.Server.Model; |
|||
using BBWYB.Server.Model.Db; |
|||
using BBWYB.Server.Model.Dto; |
|||
using FreeSql; |
|||
using SDKAdapter; |
|||
using SDKAdapter.OperationPlatform.Client; |
|||
using SDKAdapter.OperationPlatform.Models; |
|||
using Yitter.IdGenerator; |
|||
|
|||
namespace BBWYB.Server.Business.Sync |
|||
{ |
|||
public class OrderSyncBusiness |
|||
public class OrderSyncBusiness : BaseBusiness, IDenpendency |
|||
{ |
|||
private OP_PlatformClientFactory opPlatformClientFactory; |
|||
private VenderBusiness venderBusiness; |
|||
private TaskSchedulerManager taskSchedulerManager; |
|||
|
|||
public OrderSyncBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, OP_PlatformClientFactory opPlatformClientFactory, VenderBusiness venderBusiness, TaskSchedulerManager taskSchedulerManager) : base(fsql, nLogManager, idGenerator) |
|||
{ |
|||
this.opPlatformClientFactory = opPlatformClientFactory; |
|||
this.venderBusiness = venderBusiness; |
|||
this.taskSchedulerManager = taskSchedulerManager; |
|||
} |
|||
|
|||
public void AutoOrderSync() |
|||
{ |
|||
var shopList = venderBusiness.GetShopList(platform: Enums.Platform.拳探); |
|||
foreach (var shop in shopList) |
|||
{ |
|||
Task.Factory.StartNew(() => Sync(shop, string.Empty, DateTime.Now.AddHours(-3), DateTime.Now, AdapterEnums.SortTimeField.Modify, AdapterEnums.SortType.Desc), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.SyncOrderTaskScheduler); |
|||
} |
|||
} |
|||
|
|||
public void ManualOrderSync(long shopId, string orderId, DateTime? startTime, DateTime? endTime) |
|||
{ |
|||
var shop = venderBusiness.GetShopList(shopId, platform: Enums.Platform.拳探).FirstOrDefault(); |
|||
if (shop == null) |
|||
throw new BusinessException($"未找到店铺Id {shopId}"); |
|||
|
|||
Task.Factory.StartNew(() => Sync(shop, orderId, startTime, endTime, AdapterEnums.SortTimeField.Modify, AdapterEnums.SortType.Desc), CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.SyncOrderTaskScheduler); |
|||
} |
|||
|
|||
private void Sync(ShopResponse shop, |
|||
string orderId, |
|||
DateTime? startTime, |
|||
DateTime? endTime, |
|||
AdapterEnums.SortTimeField sortTimeField, |
|||
AdapterEnums.SortType sortType) |
|||
{ |
|||
var shopId = long.Parse(shop.ShopId); |
|||
var loggerName = $"订单同步-{shop.ShopName}"; |
|||
try |
|||
{ |
|||
var qtOrderList = opPlatformClientFactory.GetClient(AdapterEnums.PlatformType.拳探).GetOrderList(new OP_QueryOrderRequest() |
|||
{ |
|||
AppKey = shop.AppKey, |
|||
AppSecret = shop.AppSecret, |
|||
AppToken = shop.AppToken, |
|||
OrderId = orderId, |
|||
PageIndex = 1, |
|||
PageSize = 100, |
|||
Platform = AdapterEnums.PlatformType.拳探, |
|||
SortTimeField = sortTimeField, |
|||
SortType = sortType, |
|||
StartDate = startTime, |
|||
EndDate = endTime |
|||
}); |
|||
if (qtOrderList.Count == 0) |
|||
return; |
|||
|
|||
var qtOrderIdList = qtOrderList.Items.Select(qto => qto.OrderId).ToList(); |
|||
var dbOrderList = fsql.Select<Order>(qtOrderIdList).ToList(); |
|||
|
|||
List<Order> insertOrderList = new List<Order>(); |
|||
List<IUpdate<Order>> updateOrderList = new List<IUpdate<Order>>(); |
|||
|
|||
foreach (var qtOrder in qtOrderList.Items) |
|||
{ |
|||
var orderState = ConvertQuanTanOrderState(qtOrder.OrderState); |
|||
var dbOrder = dbOrderList.FirstOrDefault(o => o.Id == qtOrder.OrderId); |
|||
if (dbOrder == null) |
|||
{ |
|||
//新订单
|
|||
dbOrder = new Order() |
|||
{ |
|||
Id = qtOrder.OrderId, |
|||
BuyerRemark = qtOrder.BuyerRemark, |
|||
EndTime = qtOrder.EndTime, |
|||
ExpressName = qtOrder.DeliveryResponse.ExpressName, |
|||
FreightPrice = qtOrder.FreightAmount, |
|||
ModifyTime = qtOrder.ModifyTime, |
|||
Flag = string.Empty, |
|||
IsAfterSaleOrder = false, |
|||
OrderPayment = qtOrder.OrderPayment, |
|||
OrderSellerPrice = qtOrder.OrderProductAmount, |
|||
OrderTotalPrice = qtOrder.OrderTotalAmount, |
|||
OrderType = 0, |
|||
PayType = qtOrder.PayType, |
|||
Platform = Enums.Platform.拳探, |
|||
PreferentialAmount = qtOrder.PreferentialAmount, |
|||
PurchaseRemark = String.Empty, |
|||
ShopId = shopId, |
|||
SellerPreferentialAmount = qtOrder.SellerPreferentialAmount, |
|||
StartTime = qtOrder.StartTime, |
|||
StorageType = 0, |
|||
VenderRemark = qtOrder.VenderRemark, |
|||
WaybillNo = qtOrder.DeliveryResponse.WayBillNo, |
|||
OrderState = orderState |
|||
}; |
|||
|
|||
if (!insertOrderList.Any(o => o.Id == dbOrder.Id)) |
|||
insertOrderList.Add(dbOrder); |
|||
} |
|||
else |
|||
{ |
|||
var updateOrderState = false; |
|||
var updateWaybillNo = false; |
|||
var updateExpressName = false; |
|||
var updateModifyTime = false; |
|||
var updateBuyerRemark = false; |
|||
var updateVenderRemark = false; |
|||
|
|||
if (dbOrder.OrderState != orderState) |
|||
updateOrderState = true; |
|||
if (dbOrder.WaybillNo != qtOrder.DeliveryResponse.WayBillNo) |
|||
updateWaybillNo = true; |
|||
if (dbOrder.ExpressName != qtOrder.DeliveryResponse.ExpressName) |
|||
updateExpressName = true; |
|||
if (dbOrder.ModifyTime != qtOrder.ModifyTime) |
|||
updateModifyTime = true; |
|||
if (dbOrder.BuyerRemark != qtOrder.BuyerRemark) |
|||
updateBuyerRemark = true; |
|||
if (dbOrder.VenderRemark != qtOrder.VenderRemark) |
|||
updateVenderRemark = true; |
|||
|
|||
if (updateOrderState || updateWaybillNo || updateModifyTime || updateBuyerRemark || updateVenderRemark) |
|||
{ |
|||
var update = fsql.Update<Order>(dbOrder.Id).SetIf(updateOrderState, o => o.OrderState == orderState) |
|||
.SetIf(updateWaybillNo, o => o.WaybillNo, qtOrder.DeliveryResponse.WayBillNo) |
|||
.SetIf(updateExpressName, o => o.ExpressName, qtOrder.DeliveryResponse.ExpressName) |
|||
.SetIf(updateModifyTime, o => o.ModifyTime, qtOrder.ModifyTime) |
|||
.SetIf(updateBuyerRemark, o => o.BuyerRemark, qtOrder.BuyerRemark) |
|||
.SetIf(updateVenderRemark, o => o.VenderRemark, qtOrder.VenderRemark); |
|||
updateOrderList.Add(update); |
|||
} |
|||
} |
|||
} |
|||
|
|||
fsql.Transaction(() => |
|||
{ |
|||
if (insertOrderList.Count > 0) |
|||
fsql.Insert(insertOrderList).ExecuteAffrows(); |
|||
|
|||
if (updateOrderList.Count() > 0) |
|||
foreach (var update in updateOrderList) |
|||
update.ExecuteAffrows(); |
|||
}); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
nLogManager.GetLogger(loggerName).Error(ex); |
|||
} |
|||
} |
|||
|
|||
private Enums.OrderState ConvertQuanTanOrderState(string qtOrderState) |
|||
{ |
|||
/* |
|||
-1、已退款; |
|||
0、待发货; |
|||
1、待收货; |
|||
2、待评价; |
|||
3、已完成; |
|||
*/ |
|||
if (qtOrderState == "-1") |
|||
return Enums.OrderState.已退款; |
|||
if (qtOrderState == "0") |
|||
return Enums.OrderState.待出库; |
|||
if (qtOrderState == "1") |
|||
return Enums.OrderState.待收货; |
|||
if (qtOrderState == "2") |
|||
return Enums.OrderState.待收货; |
|||
if (qtOrderState == "3") |
|||
return Enums.OrderState.已完成; |
|||
return Enums.OrderState.Unknow; |
|||
} |
|||
} |
|||
} |
|||
|
@ -0,0 +1,29 @@ |
|||
using BBWY.Server.Model.Db.Mds; |
|||
using BBWYB.Common.Log; |
|||
using BBWYB.Common.Models; |
|||
using BBWYB.Server.Model; |
|||
using BBWYB.Server.Model.Dto; |
|||
using Yitter.IdGenerator; |
|||
|
|||
namespace BBWYB.Server.Business |
|||
{ |
|||
public class VenderBusiness : BaseBusiness, IDenpendency |
|||
{ |
|||
private FreeSqlMultiDBManager fsqlManager; |
|||
public VenderBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, FreeSqlMultiDBManager fsqlManager) : base(fsql, nLogManager, idGenerator) |
|||
{ |
|||
this.fsqlManager = fsqlManager; |
|||
} |
|||
|
|||
public IList<ShopResponse> GetShopList(long? shopId = null, Enums.Platform? platform = null, bool filterTurnoverDays = false, bool filterSiNan = false) |
|||
{ |
|||
return fsqlManager.MDSfsql.Select<Shops>().Where(s => !string.IsNullOrEmpty(s.ShopId)) |
|||
.WhereIf(shopId != null, s => s.ShopId == shopId.ToString()) |
|||
.WhereIf(platform != null, s => s.PlatformId == (int)platform) |
|||
.WhereIf(filterTurnoverDays, s => s.SkuSafeTurnoverDays != 0) |
|||
.WhereIf(filterSiNan, s => !string.IsNullOrEmpty(s.SiNanDingDingWebHook)) |
|||
.ToList<ShopResponse>(); |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,175 @@ |
|||
using FreeSql.DataAnnotations; |
|||
using System; |
|||
|
|||
namespace BBWY.Server.Model.Db.Mds |
|||
{ |
|||
|
|||
[Table(Name = "shops", DisableSyncStructure = true)] |
|||
public partial class Shops |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// Id
|
|||
/// </summary>
|
|||
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)] |
|||
public string Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Key
|
|||
/// </summary>
|
|||
|
|||
public string AppKey { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Secret
|
|||
/// </summary>
|
|||
|
|||
public string AppSecret { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Token
|
|||
/// </summary>
|
|||
|
|||
public string AppToken { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Key 暂定商品管理Key
|
|||
/// </summary>
|
|||
|
|||
public string AppKey2 { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Secret 暂定商品管理Secret
|
|||
/// </summary>
|
|||
|
|||
public string AppSecret2 { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺Token
|
|||
/// </summary>
|
|||
|
|||
public string AppToken2 { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建人Id
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string CreatorId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建人
|
|||
/// </summary>
|
|||
[Column(StringLength = 50, IsNullable = false)] |
|||
public string CreatorRealName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 0淘宝,1京东,2阿里巴巴
|
|||
/// </summary>
|
|||
|
|||
public int? PlatformId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台名称
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string PlatformName { get; set; } |
|||
|
|||
|
|||
public string PurchaseAppKey { get; set; } |
|||
|
|||
|
|||
public string PurchaseAppSecret { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购平台
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string PurchasePlatformId { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 商家编号
|
|||
/// </summary>
|
|||
public string VenderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺ID
|
|||
/// </summary>
|
|||
|
|||
public string ShopId { get; set; } |
|||
|
|||
|
|||
public string ShopName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺账号
|
|||
/// </summary>
|
|||
|
|||
public string ShopNick { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺类型
|
|||
/// </summary>
|
|||
|
|||
public string ShopType { get; set; } |
|||
|
|||
public string ManagePwd { get; set; } |
|||
|
|||
[Column(DbType = "decimal(11,2)")] |
|||
public decimal? PlatformCommissionRatio { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// SKU库存安全周转天数
|
|||
/// </summary>
|
|||
public int SkuSafeTurnoverDays { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 钉钉WebHook地址
|
|||
/// </summary>
|
|||
[Column(StringLength = 255)] |
|||
public string DingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 钉钉密钥
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string DingDingKey { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 司南策略等级
|
|||
/// </summary>
|
|||
public int SiNanPolicyLevel { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南钉钉WebHook地址
|
|||
/// </summary>
|
|||
[Column(StringLength = 255)] |
|||
public string SiNanDingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南钉钉密钥
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string SiNanDingDingKey { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// PJZS钉钉WebHook地址
|
|||
/// </summary>
|
|||
[Column(StringLength = 255)] |
|||
public string PJZSDingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// PJZS钉钉密钥
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string PJZSDingDingKey { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,153 @@ |
|||
using FreeSql.DataAnnotations; |
|||
|
|||
namespace BBWYB.Server.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(StringLength = 10)] |
|||
public string Flag { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品运费(用户承担)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? FreightPrice { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否为售后单
|
|||
/// </summary>
|
|||
|
|||
public bool? IsAfterSaleOrder { get; set; } = false; |
|||
|
|||
/// <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 = "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)")] |
|||
public int? OrderType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 支付方式
|
|||
/// </summary>
|
|||
[Column(DbType = "int(1)")] |
|||
public int? PayType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单平台
|
|||
/// </summary>
|
|||
[Column(DbType = "int(1)", MapType = typeof(int?))] |
|||
public Enums.Platform? Platform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台补贴
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? PreferentialAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购备注
|
|||
/// </summary>
|
|||
|
|||
public string PurchaseRemark { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 商家优惠金额(商家承担)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? SellerPreferentialAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 商家Id
|
|||
/// </summary>
|
|||
[Column(DbType = "bigint(1)")] |
|||
public long? ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 开始时间
|
|||
/// </summary>
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? StartTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 仓储类型
|
|||
/// </summary>
|
|||
[Column(DbType = "int(1)")] |
|||
public int? StorageType { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 商家备注
|
|||
/// </summary>
|
|||
[Column(StringLength = 500)] |
|||
public string VenderRemark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 运单号
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string WaybillNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 快递公司名称
|
|||
/// </summary>
|
|||
[Column(StringLength = 100)] |
|||
public string ExpressName { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,74 @@ |
|||
using FreeSql.DataAnnotations; |
|||
|
|||
namespace BBWYB.Server.Model.Db |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 订单收货信息表
|
|||
/// </summary>
|
|||
[Table(Name = "orderconsignee", DisableSyncStructure = true)] |
|||
public partial class OrderConsignee { |
|||
|
|||
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)] |
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货地址
|
|||
/// </summary>
|
|||
|
|||
public string Address { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 市
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string City { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 联系人
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string ContactName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 区
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string County { get; set; } |
|||
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否解码
|
|||
/// </summary>
|
|||
|
|||
public bool? IsDecode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 手机号
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string Mobile { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 省
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string Province { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 做记号
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string TelePhone { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 镇
|
|||
/// </summary>
|
|||
[Column(StringLength = 30)] |
|||
public string Town { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
using FreeSql.DataAnnotations; |
|||
|
|||
namespace BBWYB.Server.Model.Db |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 订单成本表
|
|||
/// </summary>
|
|||
[Table(Name = "ordercost", DisableSyncStructure = true)] |
|||
public partial class OrderCost { |
|||
|
|||
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)] |
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 所有服务单的售后成本(不含退款采购成本)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? AfterTotalCost { get; set; } = 0.00M; |
|||
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 发货快递费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? DeliveryExpressFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 是否手动编辑过成本
|
|||
/// </summary>
|
|||
|
|||
public bool? IsManualEdited { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点金额
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? PlatformCommissionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点百分比
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,5)")] |
|||
public decimal? PlatformCommissionRatio { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 优惠金额
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal PreferentialAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 利润
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? Profit { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购金额
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? PurchaseAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 退款金额
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? RefundAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 退款采购成本
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? RefundPurchaseAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 售后补发成本
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? ReissueAfterSaleAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 补发快递费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? ReissueFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 补发货款成本
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? ReissueProductAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 刷单佣金
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? SDCommissionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 刷单号费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(18,2)")] |
|||
public decimal? SDOrderAmount { get; set; } = 0.00M; |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,119 @@ |
|||
using FreeSql.DataAnnotations; |
|||
|
|||
namespace BBWYB.Server.Model.Db |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 订单成本明细表
|
|||
/// </summary>
|
|||
[Table(Name = "ordercostdetail", DisableSyncStructure = true)] |
|||
public partial class OrderCostDetail { |
|||
|
|||
[Column(DbType = "bigint(1)", IsPrimary = true)] |
|||
public long Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 耗材费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
[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; |
|||
|
|||
/// <summary>
|
|||
/// 头程运费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? FirstFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 入库操作费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? InStorageAmount { get; set; } = 0.00M; |
|||
|
|||
|
|||
public bool? IsEnabled { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 操作费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? OperationAmount { get; set; } = 0.00M; |
|||
|
|||
[Column(StringLength = 50)] |
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 出库操作费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? OutStorageAmount { get; set; } = 0.00M; |
|||
|
|||
[Column(StringLength = 50)] |
|||
public string ProductId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购运费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? PurchaseFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购单流水Id
|
|||
/// </summary>
|
|||
[Column(DbType = "bigint(1)")] |
|||
public long? PurchaseOrderPKId { get; set; } |
|||
|
|||
|
|||
public long? ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 货款成本
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? SkuAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// sku毛利
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? SkuGrossProfit { get; set; } = 0.00M; |
|||
|
|||
[Column(StringLength = 50)] |
|||
public string SkuId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 仓储费
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? StorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// Sku合计成本(不含发货运费)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? TotalCost { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件采购成本(不含发货运费)
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? UnitCost { get; set; } = 0.00M; |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
using FreeSql.DataAnnotations; |
|||
|
|||
namespace BBWYB.Server.Model.Db |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 订单SKU
|
|||
/// </summary>
|
|||
[Table(Name = "ordersku", DisableSyncStructure = true)] |
|||
public partial class OrderSku { |
|||
|
|||
[Column(IsPrimary = true)] |
|||
public long Id { get; set; } |
|||
|
|||
[Column(DbType = "datetime")] |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否退款
|
|||
/// </summary>
|
|||
|
|||
public bool? IsRefund { get; set; } = false; |
|||
|
|||
/// <summary>
|
|||
/// 销售数量
|
|||
/// </summary>
|
|||
[Column(DbType = "int(1)")] |
|||
public int? ItemTotal { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Logo
|
|||
/// </summary>
|
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
|
|||
[Column(StringLength = 50)] |
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 销售单价
|
|||
/// </summary>
|
|||
[Column(DbType = "decimal(20,2)")] |
|||
public decimal? Price { get; set; } |
|||
|
|||
[Column(StringLength = 50)] |
|||
public string ProductId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 货号
|
|||
/// </summary>
|
|||
[Column(StringLength = 50)] |
|||
public string ProductNo { get; set; } |
|||
|
|||
|
|||
public long? ShopId { get; set; } |
|||
|
|||
[Column(StringLength = 50, IsNullable = false)] |
|||
public string SkuId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
|
|||
public string Title { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,98 @@ |
|||
namespace BBWYB.Server.Model.Dto |
|||
{ |
|||
public class ShopResponse |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
public string ShopId { get; set; } |
|||
|
|||
public string VenderId { get; set; } |
|||
|
|||
public string ShopName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家类型
|
|||
/// </summary>
|
|||
public string ShopType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺平台
|
|||
/// </summary>
|
|||
public Enums.Platform PlatformId { get; set; } |
|||
|
|||
public string AppKey { get; set; } |
|||
|
|||
public string AppSecret { get; set; } |
|||
|
|||
public string AppToken { get; set; } |
|||
|
|||
public string AppKey2 { get; set; } |
|||
|
|||
public string AppSecret2 { get; set; } |
|||
|
|||
public string AppToken2 { get; set; } |
|||
|
|||
public string ManagePwd { get; set; } |
|||
|
|||
public decimal? PlatformCommissionRatio { get; set; } |
|||
|
|||
public IList<PurchaseAccountResponse> PurchaseList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// SKU库存安全周转天数
|
|||
/// </summary>
|
|||
public int SkuSafeTurnoverDays { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 钉钉WebHook地址
|
|||
/// </summary>
|
|||
public string DingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 钉钉密钥
|
|||
/// </summary>
|
|||
public string DingDingKey { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南策略等级
|
|||
/// </summary>
|
|||
public int SiNanPolicyLevel { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南钉钉WebHook地址
|
|||
/// </summary>
|
|||
public string SiNanDingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南钉钉密钥
|
|||
/// </summary>
|
|||
public string SiNanDingDingKey { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// PJZS钉钉WebHook地址
|
|||
/// </summary>
|
|||
public string PJZSDingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// PJZS钉钉密钥
|
|||
/// </summary>
|
|||
public string PJZSDingDingKey { get; set; } |
|||
} |
|||
|
|||
public class PurchaseAccountResponse |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
public string AccountName { get; set; } |
|||
|
|||
public string ShopId { get; set; } |
|||
|
|||
public Enums.Platform PurchasePlatformId { get; set; } |
|||
|
|||
public string AppKey { get; set; } |
|||
|
|||
public string AppSecret { get; set; } |
|||
|
|||
public string AppToken { get; set; } |
|||
} |
|||
} |
Loading…
Reference in new issue