Commit 5025ac91 by lizefeng

fix

parent 5ae80e0b
using AutoTurnOver.DB;
using AutoTurnOver.Models;
using AutoTurnOver.Services;
using AutoTurnOver.Utility;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace ResetOutofstock
{
class SynchroFinancialEventGroupsRabbitBackgroundService : RabbitWorkerBase<t_task_queue>
{
public SynchroFinancialEventGroupsRabbitBackgroundService() : base("拉取放款,预留数据", "aims:fba-transfer:input", 1)
{
}
protected override async Task DoWork(t_task_queue taskDto)
{
try
{
new AmazonDataSynchroService().SynchroFinancialEventGroups(accountId: int.Parse(taskDto.id));
Console.WriteLine($"解析亚马逊服务费 完成 ");
}
catch (Exception e)
{
RabbitMQHelper.EnqueneMsg("aims:fba-transfer:input", taskDto);
Console.WriteLine($"解析亚马逊服务费 数据异常,异常原因为:{e.Message},异常堆栈为:{e.StackTrace}");
}
}
}
}
......@@ -32,11 +32,26 @@ namespace AutoTurnOver.Services
{
public class AmazonDataSynchroService
{
public void SynchroFinancialEventGroupsSubmit()
{
var amazonAccounts = ApiServices.GetAmazonAccountList();
foreach (var item in amazonAccounts)
{
if (item.AmznSpDevAccountObj != null && item.AmznSpTokenObj != null)
{
RabbitMQHelper.EnqueneMsg("aims:fba-transfer:input", new t_task_queue { id = item.Id.ToString(), create_time = DateTime.Now });
}
}
}
public void SynchroFinancialEventGroups(string account = null, string siteEn = null)
public void SynchroFinancialEventGroups(string account = null, string siteEn = null,int accountId = 0)
{
// 拉取亚马逊账号
var amazonAccounts = ApiServices.GetAmazonAccountList();
if (accountId > 0)
{
amazonAccounts = amazonAccounts.Where(s => s.Id == accountId).ToList();
}
if (!string.IsNullOrWhiteSpace(account))
{
amazonAccounts = amazonAccounts.Where(s => s.Account == account).ToList();
......
......@@ -49,7 +49,7 @@ namespace ResetOutofstock
//report_invest_return_dao.SynchBtmOrderRefund();
//report_invest_return_dao.CalculationStockScore("962073701");
//dc_ana_deviation_dao.PushAnaTask();
//new AmazonDataSynchroService().SynchroFinancialEventGroups("Siqidzi","ES");
//new AmazonDataSynchroService().SynchroFinancialEventGroups("Onlymingue", "IT");
//new AmazonDataSynchroService().SetMarketplaceName(DateTime.Now);
//new AmazonDataSynchroService().SetSettlementByDate();
//new AmazonDataSynchroService().SetMarketplaceNameByDate();
......
......@@ -830,9 +830,9 @@ namespace ResetOutofstock
try
{
Console.WriteLine($"开始 拉取亚马逊提现记录,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
new AmazonDataSynchroService().SynchroFinancialEventGroups();
new AmazonDataSynchroService().SynchroFinancialEventGroupsSubmit();
Console.WriteLine($"结束 拉取亚马逊提现记录,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Thread.Sleep(1000 * 3);
Thread.Sleep(1000 * 60 * 60 * 4); // 4个小时提交一次
}
catch (Exception ex)
{
......
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