diff --git a/ds-wms-service/DS.Module.Quartz/QuartzModuleInstall.cs b/ds-wms-service/DS.Module.Quartz/QuartzModuleInstall.cs index 4878212a..e2dc1548 100644 --- a/ds-wms-service/DS.Module.Quartz/QuartzModuleInstall.cs +++ b/ds-wms-service/DS.Module.Quartz/QuartzModuleInstall.cs @@ -16,7 +16,7 @@ namespace DS.Module.QuartzModuleInstall { // 配置 Quartz q.UseMicrosoftDependencyInjectionJobFactory(); - + q.AddJob(opts => opts.WithIdentity(jobKey)); q.AddTrigger(opts => opts .ForJob(jobKey) @@ -27,21 +27,22 @@ namespace DS.Module.QuartzModuleInstall }); - //打印时间 使用cron表达式 - - //var TimeJobjobKey = new JobKey("TimeJob"); + //获取银行流水 + var BankStatementKey = new JobKey("BankStatement"); - //services.AddQuartz(q => - //{ - // // 配置 Quartz - // q.UseMicrosoftDependencyInjectionJobFactory(); + services.AddQuartz(q => + { + // 配置 Quartz + q.UseMicrosoftDependencyInjectionJobFactory(); - // q.AddJob(opts => opts.WithIdentity(TimeJobjobKey)); - // q.AddTrigger(opts => opts - // .ForJob(TimeJobjobKey) - // .WithIdentity("Time-trigger") - // .WithCronSchedule("0 0/1 * 1/1 * ? *")); - //}); + q.AddJob(opts => opts.WithIdentity(BankStatementKey)); + q.AddTrigger(opts => opts + .ForJob(BankStatementKey) + .WithIdentity("BankStatement-trigger") + .WithSimpleSchedule(x => x + .WithIntervalInSeconds(60) + .RepeatForever())); + }); // 添加 Quartz 主机服务 diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/BankStatement.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/BankStatement.cs new file mode 100644 index 00000000..bebd45f9 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/BankStatement.cs @@ -0,0 +1,241 @@ +using DS.Module.Core.Data; +using DS.Module.Core; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Fee.Entity +{ + /// + /// 银行流水 + /// + [SqlSugar.SugarTable("bank_statement", "银行流水")] + public class BankStatement : BaseModel + { + /// + /// 客户名 + /// + public string Custom { get; set; } + + /// + /// 银行名 + /// + public string BankName { get; set; } + + /// + /// 账户名 + /// + public string AccountName { get; set; } + + /// + /// 账户id + /// + public string AccountId { get; set; } + + /// + /// 交易类型 + /// + public string TransactionType { get; set; } + + /// + /// 业务类型 + /// + public string BusinessType { get; set; } + + /// + /// 付款人开户行号 + /// + public string AccountHoldingBankNumberOfPayer { get; set; } + + /// + /// 付款人开户行名 + /// + public string PayerAccountBank { get; set; } + + /// + /// 付款人账号 + /// + public string PayerAccountNumber { get; set; } + + /// + /// 付款人名称 + /// + public string PayerName { get; set; } + + /// + /// 收款人开户行行号 + /// + public string AccountHoldingBankNumberOfPayee { get; set; } + + /// + /// 收款人开户行名 + /// + public string PayeeAccountBank { get; set; } + + /// + /// 收款人账号 + /// + public string PayeeAccountNumber { get; set; } + + /// + /// 收款人名称 + /// + public string PayeeName { get; set; } + + /// + /// 交易日期 + /// + public string TransactionDate { get; set; } + + /// + /// 交易时间 + /// + public string TransactionTime { get; set; } + + /// + /// 交易货币 + /// + public string TradeCurrency { get; set; } + + /// + /// 交易金额 + /// + public string TradeAmount { get; set; } + + /// + /// 交易后余额 + /// + public string AfterTransactionBalance { get; set; } + + /// + /// 起息日期 + /// + public string ValueDate { get; set; } + + /// + /// 汇率 + /// + public string ExchangeRate { get; set; } + + /// + /// 交易流水号 + /// + public string TransactionReferenceNumber { get; set; } + + /// + /// 客户申请号 + /// + public string OnlineBankingTransactionRef { get; set; } + + /// + /// 客户业务编号 + /// + public string CustomerTransactionRef { get; set; } + + /// + /// 凭证类型 + /// + public string VoucherType { get; set; } + + /// + /// 凭证号码 + /// + public string VoucherNumber { get; set; } + + /// + /// 记录标识号 + /// + public string RecordID { get; set; } + + /// + /// 摘要 + /// + public string Reference { get; set; } + + /// + /// 用途 + /// + public string Purpose { get; set; } + + /// + /// 交易附言 + /// + public string Remark { get; set; } + + /// + /// 备注 + /// + public string Remarks { get; set; } + + /// + /// 预留项1 + /// + public string Reserve1 { get; set; } + + /// + /// 预留项2 + /// + public string Reserve2 { get; set; } + + /// + /// 预留项3 + /// + public string Reserve3 { get; set; } + + /// + /// 名义付款人开户行行号 + /// + public string OpeningBankNumberOfNominalPayer { get; set; } + + /// + /// 名义付款人开户行名 + /// + public string OpeningBankNameOfNominalPayer { get; set; } + + /// + /// 名义付款人账号 + /// + public string AccountNumberOfNominalPayer { get; set; } + + /// + /// 名义付款人名称 + /// + public string NameOfNominalPayer { get; set; } + + /// + /// 名义收款人开户行行号 + /// + public string OpeningBankNumberOfNominalPayee { get; set; } + + /// + /// 名义收款人开户行名 + /// + public string OpeningBankNameOfNominalPayee { get; set; } + + /// + /// 名义收款人账号 + /// + public string AccountNumberOfNominalPayee { get; set; } + + /// + /// 名义收款人名称 + /// + public string NameOfNominalPayee { get; set; } + + + + /// + /// nas盘文件路径 + /// + public string FilePaths { get; set; } + + + /// + /// 机构Id + /// + public long OrgId { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Jobs/TimeJob.cs b/ds-wms-service/DS.WMS.Core/Jobs/TimeJob.cs deleted file mode 100644 index e6a0c62c..00000000 --- a/ds-wms-service/DS.WMS.Core/Jobs/TimeJob.cs +++ /dev/null @@ -1,22 +0,0 @@ -using DS.WMS.Core.HangfireJob.Interface; -using Quartz; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DS.WMS.Core.Jobs -{ - public class TimeJob : IJob - { - - - public async Task Execute(IJobExecutionContext context) - { - - Console.WriteLine($"当前时间: {DateTime.Now}"); - - } - } -} diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/BankStatementJob.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/BankStatementJob.cs new file mode 100644 index 00000000..f3f19354 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/BankStatementJob.cs @@ -0,0 +1,38 @@ +using DS.WMS.Core.QuarztJobs.Interface; +using Quartz; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Jobs +{ + + /// + /// 定时任务-获取银行流水 + /// + public class BankStatementJob : IJob + { + private readonly IBankStatementService _bank; + + public BankStatementJob(IBankStatementService bank) + { + _bank = bank; + } + + public async Task Execute(IJobExecutionContext context) + { + //定时获取银行流水 + try + { + await _bank.GetBankStatement(); + Console.WriteLine($"定时获取银行流水: {DateTime.Now}"); + } + catch (Exception ex) + { + Console.WriteLine($"定时获取银行流水报错: {DateTime.Now};错误内容{ex.Message}"); + } + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/BankStatementModel.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/BankStatementModel.cs new file mode 100644 index 00000000..03e7cb8a --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/BankStatementModel.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.QuarztJobs.Dtos +{ + public class BankStatementModel + { + } + + public class GetBankStatementPost + { + /// + /// 公司名称 + /// + public string AccountName { get; set; } + /// + /// 公司识别码 + /// + public string AccountKey { get; set; } + /// + /// 开始时间 + /// + public string BeginDate { get; set; } + /// + /// 结束时间 + /// + public string EndDate { get; set; } + } + + public class GetBankStatementPostOutput + { + public List result { get; set; } + } + + public class BankStatementData + { + public string Custom { get; set; } + public string BankName { get; set; } + public string AccountName { get; set; } + public string AccountId { get; set; } + public string TransactionType { get; set; } + public string BusinessType { get; set; } + public string AccountHoldingBankNumberOfPayer { get; set; } + public string PayerAccountBank { get; set; } + public string PayerAccountNumber { get; set; } + public string PayerName { get; set; } + public string AccountHoldingBankNumberOfPayee { get; set; } + public string PayeeAccountBank { get; set; } + public string PayeeAccountNumber { get; set; } + public string PayeeName { get; set; } + public string TransactionDate { get; set; } + public string TransactionTime { get; set; } + public string TradeCurrency { get; set; } + public string TradeAmount { get; set; } + public string AfterTransactionBalance { get; set; } + public string ValueDate { get; set; } + public string ExchangeRate { get; set; } + public string TransactionReferenceNumber { get; set; } + public string OnlineBankingTransactionRef { get; set; } + public string CustomerTransactionRef { get; set; } + public string VoucherType { get; set; } + public string VoucherNumber { get; set; } + public string RecordID { get; set; } + public string Reference { get; set; } + public string Purpose { get; set; } + public string Remark { get; set; } + public string Remarks { get; set; } + public string Reserve1 { get; set; } + public string Reserve2 { get; set; } + public string Reserve3 { get; set; } + public string OpeningBankNumberOfNominalPayer { get; set; } + public string OpeningBankNameOfNominalPayer { get; set; } + public string AccountNumberOfNominalPayer { get; set; } + public string NameOfNominalPayer { get; set; } + public string OpeningBankNumberOfNominalPayee { get; set; } + public string OpeningBankNameOfNominalPayee { get; set; } + public string AccountNumberOfNominalPayee { get; set; } + public string NameOfNominalPayee { get; set; } + public DateTime CreateTime { get; set; } + public string FilePaths { get; set; } + } + +} diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Dtos/InInvoiceModel.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/InInvoiceModel.cs similarity index 99% rename from ds-wms-service/DS.WMS.Core/HangfireJob/Dtos/InInvoiceModel.cs rename to ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/InInvoiceModel.cs index 7a0a90b1..a2ee46c0 100644 --- a/ds-wms-service/DS.WMS.Core/HangfireJob/Dtos/InInvoiceModel.cs +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Dtos/InInvoiceModel.cs @@ -4,12 +4,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DS.WMS.Core.HangfireJob.Dtos -{ - public class InInvoiceModel - { - } - +namespace DS.WMS.Core.QuarztJobs.Dtos +{ /// /// 请求获取进项发票接口参数 /// diff --git a/ds-wms-service/DS.WMS.Core/Jobs/InInvoiceJob.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/InInvoiceJob.cs similarity index 94% rename from ds-wms-service/DS.WMS.Core/Jobs/InInvoiceJob.cs rename to ds-wms-service/DS.WMS.Core/QuarztJobs/InInvoiceJob.cs index ef709f11..d5541eed 100644 --- a/ds-wms-service/DS.WMS.Core/Jobs/InInvoiceJob.cs +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/InInvoiceJob.cs @@ -1,4 +1,4 @@ -using DS.WMS.Core.HangfireJob.Interface; +using DS.WMS.Core.QuarztJobs.Interface; using Quartz; namespace DS.WMS.Core.Jobs diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/Interface/IBankStatementService.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Interface/IBankStatementService.cs new file mode 100644 index 00000000..56c3e045 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Interface/IBankStatementService.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.QuarztJobs.Interface +{ + public interface IBankStatementService + { + /// + /// 定时获取银行流水数据 + /// + /// + /// + /// + Task GetBankStatement(); + + } +} diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Interface/IInInvoiceJobService.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Interface/IInInvoiceJobService.cs similarity index 91% rename from ds-wms-service/DS.WMS.Core/HangfireJob/Interface/IInInvoiceJobService.cs rename to ds-wms-service/DS.WMS.Core/QuarztJobs/Interface/IInInvoiceJobService.cs index 3db974da..91a0bdb5 100644 --- a/ds-wms-service/DS.WMS.Core/HangfireJob/Interface/IInInvoiceJobService.cs +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Interface/IInInvoiceJobService.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DS.WMS.Core.HangfireJob.Interface +namespace DS.WMS.Core.QuarztJobs.Interface { public interface IInInvoiceJobService { diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/BankStatementService.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/BankStatementService.cs new file mode 100644 index 00000000..f51ae81d --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/BankStatementService.cs @@ -0,0 +1,141 @@ +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Fee.Entity; +using DS.WMS.Core.Invoice.Entity; +using DS.WMS.Core.QuarztJobs.Dtos; +using DS.WMS.Core.QuarztJobs.Interface; +using DS.WMS.Core.QuarztJobs.Other; +using DS.WMS.Core.Sys.Entity; +using Masuit.Tools; +using Microsoft.AspNet.SignalR.Infrastructure; +using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.QuarztJobs.Method +{ + /// + /// 银行流水 + /// + public class BankStatementService : IBankStatementService + { + private static readonly HttpClient _httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(60) }; + ISqlSugarClient? db; + public BankStatementService(IServiceProvider serviceProvider) + { + db = serviceProvider.GetRequiredService(); + + } + + public async Task GetBankStatement() + { + //获取组织机构请求授权列表 + if (db == null) + { + return; + } + + var orgauthlist = db.Queryable().ClearFilter().Where(t => t.Deleted == false && t.Type == "BankStatement").ToList(); + + + //遍历授权数据集 + foreach (var item in orgauthlist) + { + //组织请求远程接口api数据 + + GetBankStatementPost model = new GetBankStatementPost(); + model.AccountName = item.Key; // "青岛东胜伟业软件有限公司"; + model.AccountKey = item.Secret;// "bbb4ce881f31c954e4d18018b41126d4"; + model.BeginDate = DateTime.Now.AddDays(-1).ToString("yyyyMMdd"); //往前查24小时的银行流水数据 + model.EndDate = DateTime.Now.ToString("yyyyMMdd"); + + var result = await HttpHellp.PostAsync("http://47.104.90.170:9876/sync", JsonConvert.SerializeObject(model)); + List datalist = new List(); + //处理返回结果 + var info = JsonConvert.DeserializeObject(result); + + if (info != null && info.result != null) + { + var dbLink = await db.Queryable().ClearFilter().Where(t => t.TenantId == item.TenantId).FirstAsync(); + SqlSugarClient? tenantDb = null; + //查询租户数据库中是否有当前数据 + tenantDb = new SqlSugarClient(new ConnectionConfig + { + ConfigId = dbLink.Id, + ConnectionString = dbLink.Connection, + DbType = dbLink.DbType, + IsAutoCloseConnection = true + }); + + + var listdt = info.result.Select(t => t.TransactionReferenceNumber).ToList(); + var ininviceinfo = tenantDb.Queryable().Where(x =>listdt .Contains(x.TransactionReferenceNumber)).ToList(); + + + foreach (var itemdata in info.result) + { + //数据库中银行流水为空,则添加银行流水数据数据 + if (ininviceinfo.Where(t => t.TransactionReferenceNumber == itemdata.TransactionReferenceNumber).Count() == 0) + { + BankStatement bs = new BankStatement(); + bs.Id = SnowFlakeSingle.Instance.NextId(); + bs.OrgId = item.OrgId; + bs.Custom = itemdata.Custom; + bs.BankName = itemdata.BankName; + bs.AccountName = itemdata.AccountName; + bs.AccountId = itemdata.AccountId; + bs.TransactionType = itemdata.TransactionType; + bs.BusinessType = itemdata.BusinessType; + bs.AccountHoldingBankNumberOfPayer = itemdata.AccountHoldingBankNumberOfPayer; + bs.PayerAccountBank = itemdata.PayerAccountBank; + bs.PayerAccountNumber = itemdata.PayerAccountNumber; + bs.PayerName = itemdata.PayerName; + bs.AccountHoldingBankNumberOfPayee = itemdata.AccountHoldingBankNumberOfPayee; + bs.PayeeAccountBank = itemdata.PayeeAccountBank; + bs.PayeeAccountNumber = itemdata.PayeeAccountNumber; + bs.PayeeName = itemdata.PayeeName; + bs.TransactionDate = itemdata.TransactionDate; + bs.TransactionTime = itemdata.TransactionTime; + bs.TradeCurrency = itemdata.TradeCurrency; + bs.TradeAmount = itemdata.TradeAmount; + bs.AfterTransactionBalance = itemdata.AfterTransactionBalance; + bs.ValueDate = itemdata.ValueDate; + bs.ExchangeRate = itemdata.ExchangeRate; + bs.TransactionReferenceNumber = itemdata.TransactionReferenceNumber; + bs.OnlineBankingTransactionRef = itemdata.OnlineBankingTransactionRef; + bs.CustomerTransactionRef = itemdata.CustomerTransactionRef; + bs.VoucherType = itemdata.VoucherType; + bs.VoucherNumber = itemdata.VoucherNumber; + bs.RecordID = itemdata.RecordID; + bs.Reference = itemdata.Reference; + bs.Purpose = itemdata.Purpose; + bs.Remark = itemdata.Remark; + bs.Remarks = itemdata.Remarks; + bs.Reserve1 = itemdata.Reserve1; + bs.Reserve2 = itemdata.Reserve2; + bs.Reserve3 = itemdata.Reserve3; + bs.OpeningBankNumberOfNominalPayer = itemdata.OpeningBankNumberOfNominalPayer; + bs.OpeningBankNameOfNominalPayer = itemdata.OpeningBankNameOfNominalPayer; + bs.AccountNumberOfNominalPayer = itemdata.AccountNumberOfNominalPayer; + bs.NameOfNominalPayer = itemdata.NameOfNominalPayer; + bs.OpeningBankNumberOfNominalPayee = itemdata.OpeningBankNumberOfNominalPayee; + bs.OpeningBankNameOfNominalPayee = itemdata.OpeningBankNameOfNominalPayee; + bs.AccountNumberOfNominalPayee = itemdata.AccountNumberOfNominalPayee; + bs.NameOfNominalPayee = itemdata.NameOfNominalPayee; + bs.FilePaths = itemdata.FilePaths; + bs.CreateTime = DateTime.Now; + //await tenantDb.Insertable(bs).ExecuteCommandAsync(); + datalist.Add(bs); + } + } + await tenantDb.Insertable(datalist).ExecuteCommandAsync(); + + } + } + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/InInvoiceService.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs similarity index 81% rename from ds-wms-service/DS.WMS.Core/HangfireJob/Method/InInvoiceService.cs rename to ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs index f64af05c..5d27fe1f 100644 --- a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/InInvoiceService.cs +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Method/InInvoiceService.cs @@ -1,31 +1,21 @@ -using DS.Module.Core.Enums; -using DS.WMS.Core.HangfireJob.Dtos; -using DS.WMS.Core.HangfireJob.Interface; -using DS.WMS.Core.Invoice.Entity; -using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Invoice.Entity; +using DS.WMS.Core.QuarztJobs.Dtos; +using DS.WMS.Core.QuarztJobs.Interface; +using DS.WMS.Core.QuarztJobs.Other; using DS.WMS.Core.Sys.Entity; -using DS.WMS.Core.TaskPlat.Dtos; -using Google.Api.Gax.ResourceNames; -using LanguageExt.Common; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; -using NPOI.SS.Formula.Functions; using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -namespace DS.WMS.Core.HangfireJob.Method +namespace DS.WMS.Core.QuarztJobs.Method { /// /// 进项发票相关 /// public class InInvoiceService : IInInvoiceJobService { - private static readonly HttpClient _httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(60) }; + ISqlSugarClient? db; public InInvoiceService(IServiceProvider serviceProvider) { @@ -63,7 +53,7 @@ namespace DS.WMS.Core.HangfireJob.Method //model.kprqks = "2024-09-01 00:00:00";// DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss"); //往前查24小时的进项发票数据 //model.kprqjs = "2024-09-07 00:00:00"; //DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - var result = await PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataList", JsonConvert.SerializeObject(model), header); + var result = await HttpHellp.PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataList", JsonConvert.SerializeObject(model), header); //处理返回结果 var info= JsonConvert.DeserializeObject(result); @@ -90,7 +80,7 @@ namespace DS.WMS.Core.HangfireJob.Method { GetInInvoiceDataInfo gidi = new GetInInvoiceDataInfo(); gidi.fphm = itemdata.fphm; - var resultinfo = await PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataInfo", JsonConvert.SerializeObject(gidi), header); + var resultinfo = await HttpHellp.PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataInfo", JsonConvert.SerializeObject(gidi), header); var Iinfo = JsonConvert.DeserializeObject(resultinfo); if (Iinfo.code == 0) //调整 { @@ -194,46 +184,6 @@ namespace DS.WMS.Core.HangfireJob.Method } } } - - - /// - /// post请求 - /// - /// 请求地址 - /// 请求参数 - /// 请求头 - /// - public static async Task PostAsync(string serviceAddress, string requestJson = null, Dictionary headers = null) - { - try - { - string result = string.Empty; - Uri postUrl = new Uri(serviceAddress); - - using (HttpContent httpContent = new StringContent(requestJson)) - { - httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); - if (headers != null) - { - foreach (var header in headers) - { - httpContent.Headers.Add(header.Key, header.Value); - } - } - var response = await _httpClient.PostAsync(serviceAddress, httpContent); - - result = await response.Content.ReadAsStringAsync(); - - } - - return result; - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - return null; - } - + } } diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/Other/HttpHellp.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/Other/HttpHellp.cs new file mode 100644 index 00000000..d0d8d5c8 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/Other/HttpHellp.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.QuarztJobs.Other +{ + public class HttpHellp + { + private static readonly HttpClient _httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(60) }; + /// + /// post请求 + /// + /// 请求地址 + /// 请求参数 + /// 请求头 + /// + public static async Task PostAsync(string serviceAddress, string requestJson = null, Dictionary headers = null) + { + try + { + string result = string.Empty; + Uri postUrl = new Uri(serviceAddress); + + using (HttpContent httpContent = new StringContent(requestJson)) + { + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + if (headers != null) + { + foreach (var header in headers) + { + httpContent.Headers.Add(header.Key, header.Value); + } + } + var response = await _httpClient.PostAsync(serviceAddress, httpContent); + + result = await response.Content.ReadAsStringAsync(); + + } + + return result; + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + return null; + } + } + + + + +} diff --git a/ds-wms-service/DS.WMS.FeeApi/Program.cs b/ds-wms-service/DS.WMS.FeeApi/Program.cs index 36ae7877..047febb9 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Program.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Program.cs @@ -48,7 +48,7 @@ builder.Services.AddMultiLanguageInstall();// builder.Services.AddDjyModuleInstall();//Djy builder.Services.AddRuleEngineModuleInstall();//DjyУ -builder.Services.AddHangfireFeeInstall();//Hangfire +//builder.Services.AddHangfireFeeInstall();//Hangfire // ʹԶ Quartz // Quartz builder.Services.AddQuartzModuleInstall(); @@ -59,8 +59,8 @@ var app = builder.Build(); app.UsePublicMiddlewares(); -app.UseHangfireServer(); -app.UseJobMiddlewares(); +//app.UseHangfireServer(); +//app.UseJobMiddlewares(); //JobMiddleware.RegisterJob(j => j.GenerateFeesAsync(), Cron.Daily(23, 30));