Commit c52d28f5 by guanzhenshan

调整计算平台订单利润率

parent 297b34c9
...@@ -21,8 +21,8 @@ namespace Bailun.DC.DailyItemNoProfitRate ...@@ -21,8 +21,8 @@ namespace Bailun.DC.DailyItemNoProfitRate
//var _service = new Services(); //var _service = new Services();
//var day = DateTime.Parse(DateTime.Now.AddDays(-2).ToShortDateString()); //var day = DateTime.Parse(DateTime.Now.AddDays(-2).ToShortDateString());
//_service.Init(day.AddDays(-20), day); //_service.Init(day.AddDays(-20), day);
////_service.OneDayItemNoProfitRate(day.AddDays(-1), day);
//_service.SaveProfitRate(day.AddDays(-20), day); //_service.SaveProfitRate(day.AddDays(-20), day);
//_service.OneDayItemNoProfitRate(day.AddDays(-1), day);
} }
} }
} }
...@@ -114,9 +114,9 @@ namespace Bailun.DC.DailyItemNoProfitRate ...@@ -114,9 +114,9 @@ namespace Bailun.DC.DailyItemNoProfitRate
item.count = 1; //设置默认数量为 1 item.count = 1; //设置默认数量为 1
//转换为平台站点时间 //转换为平台站点时间
item.platform_paid_time = ToPlatformTime(item.website.ToUpper(),item.paid_time); var platform_paid_time = ToPlatformTime(item.website.ToUpper(),item.paid_time);
str += $"('{end.ToString("yyyy-MM-dd")}',{item.order_sku_id},'{item.bailun_order_id}','{item.origin_order_id}','{item.item_id}','{item.platform_sku}',{item.platform_sku_quantity_ordered},{item.count},'{item.bailun_sku}','{item.paid_time.ToString("yyyy-MM-dd HH:mm:ss")}',{item.amount_sales},{item.cost_product},{item.cost_platform_fee},{item.cost_paypal_fee},{item.cost_fba_fee},{item.cost_first},{item.cost_logistics},{item.cost_handle_platform},{item.cost_handle_bailun},'{item.warehouse_code}','{item.shipping_status}','{item.seller_order_exchange_rate}','{item.platform_type}','{item.website}','{item.bailun_account_id}','{item.platform_paid_time.ToString("yyyy-MM-dd HH:mm:ss")}'),"; str += $"('{end.ToString("yyyy-MM-dd")}',{item.order_sku_id},'{item.bailun_order_id}','{item.origin_order_id}','{item.item_id}','{item.platform_sku}',{item.platform_sku_quantity_ordered},{item.count},'{item.bailun_sku}','{item.paid_time.ToString("yyyy-MM-dd HH:mm:ss")}',{item.amount_sales},{item.cost_product},{item.cost_platform_fee},{item.cost_paypal_fee},{item.cost_fba_fee},{item.cost_first},{item.cost_logistics},{item.cost_handle_platform},{item.cost_handle_bailun},'{item.warehouse_code}','{item.shipping_status}','{item.seller_order_exchange_rate}','{item.platform_type}','{item.website}','{item.bailun_account_id}','{platform_paid_time.ToString("yyyy-MM-dd HH:mm:ss")}'),";
if (index % 1000 == 0 || index == list.Count) if (index % 1000 == 0 || index == list.Count)
{ {
//保存数据 //保存数据
...@@ -155,12 +155,13 @@ namespace Bailun.DC.DailyItemNoProfitRate ...@@ -155,12 +155,13 @@ namespace Bailun.DC.DailyItemNoProfitRate
Console.WriteLine("完成尾程字段是否预估更新" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("完成尾程字段是否预估更新" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//删除多余的订单数据,按平台时间过滤 //删除多余的订单数据,按平台时间过滤
cn.Execute($"delete from dc_mid_itemno_profit_order where day ='{end.ToString("yyyy-MM-dd")}' and platform_paid_time>='{start.ToString("yyyy-MM-dd")}' and platform_paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'"); cn.Execute($"delete from dc_mid_itemno_profit_order where day ='{end.ToString("yyyy-MM-dd")}' and (platform_paid_time<'{start.ToString("yyyy-MM-dd")}' or platform_paid_time>'{end.AddDays(1).ToString("yyyy-MM-dd")}')");
} }
Console.WriteLine("完成订单基础数据保存 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("完成订单基础数据保存 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
} }
SaveProfitRate(start, end); SaveProfitRate(start, end);
} }
...@@ -174,7 +175,7 @@ namespace Bailun.DC.DailyItemNoProfitRate ...@@ -174,7 +175,7 @@ namespace Bailun.DC.DailyItemNoProfitRate
var list = new List<Models.dc_daily_item_profit_rate>(); var list = new List<Models.dc_daily_item_profit_rate>();
var listBaseOrder = new List<dc_mid_itemno_profit_order>(); var listBaseOrder = new List<dc_mid_itemno_profit_order>();
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -182,7 +183,8 @@ namespace Bailun.DC.DailyItemNoProfitRate ...@@ -182,7 +183,8 @@ namespace Bailun.DC.DailyItemNoProfitRate
} }
//取出订单明细 //取出订单明细
listOrders = cn.Query<Models.dc_mid_itemno_profit_order>($"select * from dc_mid_itemno_profit_order where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'", null, null, true, 6 * 60).AsList(); var sql = $"select * from dc_mid_itemno_profit_order where day>='{end.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
listOrders = cn.Query<Models.dc_mid_itemno_profit_order>(sql, null, null, true, 6 * 60).AsList();
Console.WriteLine("完成取出订单数据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("完成取出订单数据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//取出item no的广告GMV //取出item no的广告GMV
...@@ -309,7 +311,7 @@ namespace Bailun.DC.DailyItemNoProfitRate ...@@ -309,7 +311,7 @@ namespace Bailun.DC.DailyItemNoProfitRate
} }
//取出订单明细 //取出订单明细
listOrders = cn.Query<Models.dc_mid_itemno_profit_order>($"select * from dc_mid_itemno_profit_order where platform_paid_time>='{start.ToString("yyyy-MM-dd")}' and platform_paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'").AsList(); listOrders = cn.Query<Models.dc_mid_itemno_profit_order>($"select * from dc_mid_itemno_profit_order where platform_paid_time>='{end.ToString("yyyy-MM-dd")}' and platform_paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'").AsList();
Console.WriteLine("完成取出订单数据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("完成取出订单数据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//取出item no的广告GMV //取出item no的广告GMV
......
...@@ -64,7 +64,7 @@ namespace Bailun.DC.Models ...@@ -64,7 +64,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 平台付款时间 /// 平台付款时间
/// </summary> /// </summary>
public DateTime platform_paid_time { get; set; } //public DateTime? platform_paid_time { get; set; }
/// <summary> /// <summary>
/// 销售额 /// 销售额
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment