From b33afb7323f5d29730a552bc9d3d39a976427936 Mon Sep 17 00:00:00 2001 From: liangkun Date: Sun, 27 Aug 2023 20:35:55 +0800 Subject: [PATCH] =?UTF-8?q?fzp=20=E6=AD=A3=E5=BC=8F=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PayFeeResultTwoController.cs | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index 64d369b..0b5249d 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -33,7 +33,7 @@ namespace DigitalSchoolApi.Controllers /// public IHttpActionResult GetLastTenMinutes() { - RecurringJob.AddOrUpdate("PayFeeResultMinutes", + RecurringJob.AddOrUpdate("PayFeeResultMinutes20", () => GetResult(true), Cron.Minutely, TimeZoneInfo.Local); return Ok(); @@ -44,7 +44,7 @@ namespace DigitalSchoolApi.Controllers /// public IHttpActionResult GetLastDay() { - RecurringJob.AddOrUpdate("PayFeeResultDay", + RecurringJob.AddOrUpdate("PayFeeResultDay20", () => GetResult(false), Cron.Daily(0), TimeZoneInfo.Local); return Ok(); @@ -119,49 +119,49 @@ namespace DigitalSchoolApi.Controllers foreach (var item in list) { //轮询建行商户平台 - //XmlDocument xml = new XmlDocument(); - //xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); - //((XmlElement)xml.SelectSingleNode("TX/REQUEST_SN")).InnerText = DateTime.Now.ToString("yyyyMMddHHmmssfff"); - //((XmlElement)xml.SelectSingleNode("TX/TX_INFO/ORDER")).InnerText = item.orderid; - //((XmlElement)xml.SelectSingleNode("TX/USER_ID")).InnerText = "002"; - //((XmlElement)xml.SelectSingleNode("TX/PASSWORD")).InnerText = "xcyz123456"; - //string par = "requestXml=" + xml.InnerXml; - ////最后将字符串参数进行Url编码 - //Encoding encoding = Encoding.GetEncoding("gb2312"); - //byte[] payload = encoding.GetBytes(par); - //HttpClient httpClient = new HttpClient(); - //HttpContent content = new ByteArrayContent(payload); - //string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; - //xml.LoadXml(reStr); - //string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; - string s = "000000"; + XmlDocument xml = new XmlDocument(); + xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); + ((XmlElement)xml.SelectSingleNode("TX/REQUEST_SN")).InnerText = DateTime.Now.ToString("yyyyMMddHHmmssfff"); + ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/ORDER")).InnerText = item.orderid; + ((XmlElement)xml.SelectSingleNode("TX/USER_ID")).InnerText = "002"; + ((XmlElement)xml.SelectSingleNode("TX/PASSWORD")).InnerText = "xcyz123456"; + string par = "requestXml=" + xml.InnerXml; + //最后将字符串参数进行Url编码 + Encoding encoding = Encoding.GetEncoding("gb2312"); + byte[] payload = encoding.GetBytes(par); + HttpClient httpClient = new HttpClient(); + HttpContent content = new ByteArrayContent(payload); + string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; + xml.LoadXml(reStr); + string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; + //string s = "000000"; if (s.Equals("000000")) { - //using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) - //{ - // conncore.Execute( - // "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); - //} - //string Orderid = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER")).InnerText; - //string PAYMENT_MONEY = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAYMENT_MONEY")).InnerText; - //string ORDER_STATUS = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER_STATUS")).InnerText; - //string PAY_MODE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAY_MODE")).InnerText; - //string OriOvrlsttnEV_Trck_No = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/OriOvrlsttnEV_Trck_No")).InnerText; - //string TRAN_DATE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/TRAN_DATE")).InnerText; - //DateTime paytimedatetime = DateTime.Now; - //DateTime.TryParse(TRAN_DATE, out paytimedatetime); - ////remark1 为学号 - //string REM1 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM1")).InnerText; - ////remark2 为缴费年度 - //string REM2 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM2")).InnerText; - string PAYMENT_MONEY = item.SJAmount.ToString(); - string ORDER_STATUS = "1"; - string TRAN_DATE = DateTime.Now.ToString(); - string PAY_MODE = "ZFB"; - string OriOvrlsttnEV_Trck_No = "test001"; - string Orderid = item.orderid; - string REM1 = item.StuNo; - string REM2 = item.YearNo.ToString(); + using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); + } + string Orderid = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER")).InnerText; + string PAYMENT_MONEY = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAYMENT_MONEY")).InnerText; + string ORDER_STATUS = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER_STATUS")).InnerText; + string PAY_MODE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAY_MODE")).InnerText; + string OriOvrlsttnEV_Trck_No = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/OriOvrlsttnEV_Trck_No")).InnerText; + string TRAN_DATE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/TRAN_DATE")).InnerText; + DateTime paytimedatetime = DateTime.Now; + DateTime.TryParse(TRAN_DATE, out paytimedatetime); + //remark1 为学号 + string REM1 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM1")).InnerText; + //remark2 为缴费年度 + string REM2 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM2")).InnerText; + //string PAYMENT_MONEY = item.SJAmount.ToString(); + //string ORDER_STATUS = "1"; + //string TRAN_DATE = DateTime.Now.ToString(); + //string PAY_MODE = "ZFB"; + //string OriOvrlsttnEV_Trck_No = "test001"; + //string Orderid = item.orderid; + //string REM1 = item.StuNo; + //string REM2 = item.YearNo.ToString(); if (ORDER_STATUS=="1") { conn.Execute("update FinaChargeStuOrder set SJAmount='" + PAYMENT_MONEY + "',Status='" + ORDER_STATUS + "',PayTime='" + TRAN_DATE + "',PayMode='" + PAY_MODE + "',BankOrder='" + OriOvrlsttnEV_Trck_No + "' where orderid='" + Orderid + "'"); @@ -231,11 +231,11 @@ group by a.FSYear,b.StuNo ) aa left join } else { - //using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) - //{ - // conncore.Execute( - // "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); - //} + using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); + } } } }