Commit 9173cc65 by guanzhenshan

调整获取帐号余额接口

parent 5e149ccc
...@@ -25,10 +25,16 @@ namespace Bailun.DC.DailyPlatformAccountBalance ...@@ -25,10 +25,16 @@ namespace Bailun.DC.DailyPlatformAccountBalance
//static void Main(string[] args) //static void Main(string[] args)
//{ //{
// var _services = new Services(); // var _services = new Services();
// var day = DateTime.Parse(DateTime.Now.AddDays(-8).ToShortDateString());
// while (day < DateTime.Now.AddDays(-1))
// {
// _services.Init(day);
// _services.SaveDaily(day);
// _services.UpdateBalanceSheet(day);
// day = day.AddDays(1);
// }
// _services.Init(DateTime.Parse(DateTime.Now.AddDays(-1).ToShortDateString()));
// _services.SaveDaily();
// _services.UpdateBalanceSheet(DateTime.Now.AddDays(-1));
//} //}
} }
} }
...@@ -42,7 +42,7 @@ namespace Bailun.DC.DailyPlatformAccountBalance ...@@ -42,7 +42,7 @@ namespace Bailun.DC.DailyPlatformAccountBalance
//每天跑一次 //每天跑一次
Console.WriteLine("开始启动每日记录保存 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("开始启动每日记录保存 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
SaveDaily(); SaveDaily(day);
Console.WriteLine("结束每日记录保存 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("结束每日记录保存 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//更新资产负债表平台余额字段 //更新资产负债表平台余额字段
...@@ -138,10 +138,10 @@ namespace Bailun.DC.DailyPlatformAccountBalance ...@@ -138,10 +138,10 @@ namespace Bailun.DC.DailyPlatformAccountBalance
/// <summary> /// <summary>
/// 保存每日余额 /// 保存每日余额
/// </summary> /// </summary>
public void SaveDaily() public void SaveDaily(DateTime day)
{ {
var sql = $@"insert into dc_daily_platform_account_balance (day,account,platform_name,currency,currencyrate,availableamount,availableamount_rmb,frozenmoney,frozenmoney_rmb,totalamount,totalamount_rmb,dc_createtime) var sql = $@"insert into dc_daily_platform_account_balance (day,account,platform_name,currency,currencyrate,availableamount,availableamount_rmb,frozenmoney,frozenmoney_rmb,totalamount,totalamount_rmb,dc_createtime)
select DATE_SUB(curdate(),INTERVAL 1 DAY),account,platform_name,currency,currencyrate,availableamount,availableamount_rmb,frozenmoney,frozenmoney_rmb,totalamount,totalamount_rmb,now() from dc_base_platform_account_balance t1"; select '{day.ToString("yyyy-MM-dd")}',account,platform_name,currency,currencyrate,availableamount,availableamount_rmb,frozenmoney,frozenmoney_rmb,totalamount,totalamount_rmb,now() from dc_base_platform_account_balance t1";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
...@@ -150,7 +150,7 @@ namespace Bailun.DC.DailyPlatformAccountBalance ...@@ -150,7 +150,7 @@ namespace Bailun.DC.DailyPlatformAccountBalance
cn.Open(); cn.Open();
} }
cn.Execute("delete from dc_daily_platform_account_balance where day=DATE_SUB(curdate(),INTERVAL 1 DAY);"); cn.Execute($"delete from dc_daily_platform_account_balance where day='{day.ToString("yyyy-MM-dd")}'");
cn.Execute(sql); cn.Execute(sql);
} }
......
...@@ -11,27 +11,27 @@ namespace Bailun.DC.SyncLogisticInfo ...@@ -11,27 +11,27 @@ namespace Bailun.DC.SyncLogisticInfo
/// 同步物流对账基础数据 /// 同步物流对账基础数据
/// </summary> /// </summary>
/// <param name="args"></param> /// <param name="args"></param>
static async Task Main(string[] args) //static async Task Main(string[] args)
{ //{
Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); // Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var builder = new HostBuilder().ConfigureServices((hostContext, services) => // var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{ // {
services.AddHostedService<Services>(); // services.AddHostedService<Services>();
}); // });
await builder.RunConsoleAsync(); // await builder.RunConsoleAsync();
} //}
//static void Main(string[] args) static void Main(string[] args)
//{ {
// //Console.WriteLine("Hello World!"); //Console.WriteLine("Hello World!");
// var _service = new Services(); var _service = new Services();
// _service.Init(); _service.Init();
//} }
......
...@@ -69,6 +69,8 @@ namespace Bailun.DC.SyncLogisticInfo ...@@ -69,6 +69,8 @@ namespace Bailun.DC.SyncLogisticInfo
} }
starttime = DateTime.Parse("2020-07-01");
endtime = DateTime.Parse("2020-08-01");
while (total == -1 || total>((page-1)*pagesize)) while (total == -1 || total>((page-1)*pagesize))
{ {
...@@ -85,10 +87,10 @@ namespace Bailun.DC.SyncLogisticInfo ...@@ -85,10 +87,10 @@ namespace Bailun.DC.SyncLogisticInfo
var str = Common.HttpHelper.NetHelper.HttpPostJson(url, JsonConvert.SerializeObject(j)); var str = Common.HttpHelper.NetHelper.HttpPostJson(url, JsonConvert.SerializeObject(j));
var json = Newtonsoft.Json.JsonConvert.DeserializeObject<mResult>(str); var json = Newtonsoft.Json.JsonConvert.DeserializeObject<mResult>(str);
if (json.success && json.result.result.Count > 0) if (json!=null && json.success && json.result.result.Count > 0)
{ {
Save(json.result.result); Save(json.result.result);
Console.WriteLine("获取到了" + json.result.result.Count + "条记录。"); Console.WriteLine("总记录数:"+ json.result.total + ",当前页记录数:" + json.result.result.Count + "条记录。");
total = json.result.total; total = json.result.total;
page++; page++;
} }
...@@ -119,12 +121,12 @@ namespace Bailun.DC.SyncLogisticInfo ...@@ -119,12 +121,12 @@ namespace Bailun.DC.SyncLogisticInfo
var m = new dc_base_logistics var m = new dc_base_logistics
{ {
bailun_shipment_cost_cny = item.bailunShipmentCostCNY, bailun_shipment_cost_cny = item.bailunShipmentCostCNY,
bill_code = item.billCode, bill_code = item.billCode??"",
company_code = item.company_Code, company_code = item.company_Code,
company_name = item.company_Name, company_name = item.company_Name,
cost_diff_decimal = item.costDiffDecimal, cost_diff_decimal = item.costDiffDecimal,
diff_state_type = item.diffStateType + "", diff_state_type = item.diffStateType + "",
fee_code = item.feeCode, fee_code = item.feeCode??"",
fee_product_type = item.feeProductType, fee_product_type = item.feeProductType,
generate_bill_status = item.generateBillStatus, generate_bill_status = item.generateBillStatus,
...@@ -132,7 +134,7 @@ namespace Bailun.DC.SyncLogisticInfo ...@@ -132,7 +134,7 @@ namespace Bailun.DC.SyncLogisticInfo
gmt_modify_time = DateTime.Now, gmt_modify_time = DateTime.Now,
info_id = item.infoId + "", info_id = item.infoId + "",
last_modification_time = item.lastModificationTime, last_modification_time = item.lastModificationTime,
line_name = item.line_Name, line_name = item.line_Name??"",
merchant_output_weight_kg = item.merchantOutputWeightKg, merchant_output_weight_kg = item.merchantOutputWeightKg,
merchant_output_weight_kg_original = item.merchantOutputWeightKg_Original ?? 0, merchant_output_weight_kg_original = item.merchantOutputWeightKg_Original ?? 0,
merchant_reconciliation_time = item.merchantReconciliationTime, merchant_reconciliation_time = item.merchantReconciliationTime,
......
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