From 754af7e85f7882bca3bdbb4a045a65d550bff54a Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 3 Apr 2024 11:49:32 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Web.config | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DigitalSchoolApi/Web.config b/DigitalSchoolApi/Web.config index 33d69d6..0ca5377 100644 --- a/DigitalSchoolApi/Web.config +++ b/DigitalSchoolApi/Web.config @@ -21,7 +21,7 @@ - + @@ -53,18 +53,18 @@ - + - + - + - + From 017b7d2599f0ec16d47e5f0a7955bdef3af09bdd Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 3 Apr 2024 11:50:21 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E9=95=BF=E9=98=B3=E4=B8=80=E5=8D=A1?= =?UTF-8?q?=E9=80=9A=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 73451f2..928270e 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -813,7 +813,7 @@ namespace DigitalSchoolApi.Controllers conncore.Execute( "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'typecode','开票typecode:" + item.Key + "',getdate())"); } - InvoiceEBillByTypeTwo(conn,orderEntity, item.Key, item); + InvoiceEBillByTypeTwo(conn, orderEntity, item.Key, item); } catch (Exception ex) { @@ -1030,7 +1030,7 @@ namespace DigitalSchoolApi.Controllers } } - private static void InvoiceEBillByTypeTwo(IDbConnection conn,FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping stuEnrollFeeOrderDetailList) + private static void InvoiceEBillByTypeTwo(IDbConnection conn, FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping stuEnrollFeeOrderDetailList) { Encoding encoding = Encoding.UTF8; string StuName = conn.QuerySingle("select StuName from FinaChargeStudent where stuno='" + orderEntity.StuNo + "'").StuName; @@ -2330,14 +2330,14 @@ namespace DigitalSchoolApi.Controllers { string JylsUrl = ConfigurationManager.AppSettings["JylsUrl"]; var Historylist = Convert.ToInt64(conn.ExecuteScalar("select isnull(Max(centralNo),0) from MealCardRunTab ")); - string data = "{ \"pageNo\":\"1\",\"PageSize\":\"1000\",\"Date\":\"" + DateTime.Now.ToShortDateString() + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\"}"; + string data = "{ \"pageNo\":\"1\",\"PageSize\":\"1000\",\"Date\":\"" + DateTime.Now.ToShortDateString() + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\",\"depcode\":\"7D\"}"; var responses = HttpMethods.sendHttpPost(JylsUrl, Token, data); var RequsetList = JsonConvert.DeserializeObject(responses); if (RequsetList.pageTotal > 0) { for (int i = 1; i <= RequsetList.pageTotal; i++) { - data = "{ \"pageNo\":\"" + i + " \",\"PageSize\":\"1000\",\"Date\":\"" + DateTime.Now.ToShortDateString() + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\"}"; + data = "{ \"pageNo\":\"" + i + " \",\"PageSize\":\"1000\",\"Date\":\"" + DateTime.Now.ToShortDateString() + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\",\"depcode\":\"7D\"}"; var responses1 = HttpMethods.sendHttpPost(JylsUrl, Token, data); var RequsetList1 = JsonConvert.DeserializeObject(responses1); var NowCen = RequsetList1.data.flowlist.Max(x => x.centralNo); From 5f0fce131dc4251436af3cdb9504f6b4bb81a7b2 Mon Sep 17 00:00:00 2001 From: ndbs Date: Tue, 16 Apr 2024 16:02:40 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=B8=80=E5=8D=A1=E9=80=9A=E6=8C=89?= =?UTF-8?q?=E5=B0=8F=E6=97=B6=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 95 +++++++++++++++--------- 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 521ba26..aa78019 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -1860,7 +1860,7 @@ namespace DigitalSchoolApi.Controllers List departments = db.Query("select * from LR_Base_Department").ToList(); int anumDept = 0; int unumDept = 0; - + foreach (var item in depts) { try @@ -2353,11 +2353,6 @@ namespace DigitalSchoolApi.Controllers { try { - 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(),55555,'一卡通交易流水1','开始执行',getdate())"); - } string Token = ""; #region 登陆获取token //获取配置文件 @@ -2377,57 +2372,83 @@ namespace DigitalSchoolApi.Controllers 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(),55555,'一卡通交易流水2','Token秘钥获取成功',getdate())"); + $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'一卡通交易流水','Token秘钥获取成功',getdate())"); } #endregion #region 插入数据 using (IDbConnection conn = new SqlConnection(_sqlConnection)) { + var tday = DateTime.Now.ToShortDateString(); + DateTime StartTime = DateTime.Today.AddHours(0); + DateTime EndTime = DateTime.Today.AddHours(1); + string JylsUrl = ConfigurationManager.AppSettings["JylsUrl"]; var Historylist = Convert.ToInt64(conn.ExecuteScalar("select isnull(Max(centralNo),0) from MealCardRunTab ")); - string data = "{ \"pageNo\":\"1\",\"PageSize\":\"1000\",\"Date\":\"" + DateTime.Now.ToShortDateString() + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\",\"depcode\":\"7D\"}"; + string data = "{ \"pageNo\":\"1\",\"PageSize\":\"1000\",\"Date\":\"" + tday + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\",\"depcode\":\"7D\"}"; var responses = HttpMethods.sendHttpPost(JylsUrl, Token, data); var RequsetList = JsonConvert.DeserializeObject(responses); - if (RequsetList.pageTotal > 0) + + + 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(),55555,'一卡通数据()','本次一共" + RequsetList.total + "条数据',getdate())"); + } + + + for (int k = 0; k <= 23; k++) { - for (int i = 1; i <= RequsetList.pageTotal; i++) + using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { - data = "{ \"pageNo\":\"" + i + " \",\"PageSize\":\"1000\",\"Date\":\"" + DateTime.Now.ToShortDateString() + "\",\"StartTime\":\"00:00:00\",\"EndTime\":\"23:59:59\",\"depcode\":\"7D\"}"; - var responses1 = HttpMethods.sendHttpPost(JylsUrl, Token, data); - var RequsetList1 = JsonConvert.DeserializeObject(responses1); - var NowCen = RequsetList1.data.flowlist.Max(x => x.centralNo); - if (NowCen > Historylist) + conncore.Execute( + $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'一卡通数据','第" + k + "次循环',getdate())"); + } + if (k != 0) + { + StartTime = StartTime.AddHours(1); + EndTime = EndTime.AddHours(1); + } + data = "{ \"pageNo\":\"1\",\"PageSize\":\"1000\",\"Date\":\"" + tday + "\",\"StartTime\":\"" + StartTime + "\",\"EndTime\":\"" + EndTime + "\",\"depcode\":\"7D\"}"; + responses = HttpMethods.sendHttpPost(JylsUrl, Token, data); + RequsetList = JsonConvert.DeserializeObject(responses); + + if (RequsetList.pageTotal > 0) + { + int total = (int)Math.Ceiling((decimal)RequsetList.total / 1000); + using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { - 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(),55555,'一卡通交易流水3','准备开始插入数据',getdate())"); - } - for (int j = 0; j < RequsetList1.data.flowlist.Count; j++) + conncore.Execute( + $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'一卡通交易流水1','一共" + RequsetList.total + "条数据',getdate())"); + } + + for (int i = 1; i <= total; i++) + { + data = "{ \"pageNo\":\"" + i + " \",\"PageSize\":\"1000\",\"Date\":\"" + tday + "\",\"StartTime\":\"" + StartTime + "\",\"EndTime\":\"" + EndTime + "\",\"depcode\":\"7D\"}"; + responses = HttpMethods.sendHttpPost(JylsUrl, Token, data); + RequsetList = JsonConvert.DeserializeObject(responses); + if (RequsetList.data.flowlist.Count > 0) { - var nowCen = Convert.ToInt32(conn.ExecuteScalar("select Count(*) from MealCardRunTab where centralNo='" + RequsetList1.data.flowlist[j].centralNo + "' ")); - if (nowCen <= 0) - { - conn.Execute( - "insert into MealCardRunTab(Id,accountNo,accountName,depName,personId,identiName,flowtype,flowamount,balance,cardNo,centralTm,centralNo,occurTime,node,bigGroup,smallGroup,seg,pos) " + - "values(newid(), '" + RequsetList1.data.flowlist[j].accountNo + "', '" + RequsetList1.data.flowlist[j].accountName + "', '" + RequsetList1.data.flowlist[j].depName + "','" + RequsetList1.data.flowlist[j].personId + "','" + RequsetList1.data.flowlist[j].identiName + "','" + RequsetList1.data.flowlist[j].flowType + "','" + RequsetList1.data.flowlist[j].flowAmount + - "','" + RequsetList1.data.flowlist[j].balance + "','" + RequsetList1.data.flowlist[j].cardNo + "','" + RequsetList1.data.flowlist[j].centralTm + "','" + RequsetList1.data.flowlist[j].centralNo + "','" + RequsetList1.data.flowlist[j].occurTime + "','" + RequsetList1.data.flowlist[j].node + "','" + RequsetList1.data.flowlist[j].bigGroup + "','" + RequsetList1.data.flowlist[j].group + "','" + RequsetList1.data.flowlist[j].seg + "','" + RequsetList1.data.flowlist[j].pos + "')"); - } - using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) + var NowCen = RequsetList.data.flowlist.Max(x => x.centralNo); + if (NowCen > Historylist) { - conncore.Execute( - $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'一卡通交易流水4','第" + j + "次插入数据完成',getdate())"); + for (int j = 0; j < RequsetList.data.flowlist.Count; j++) + { + var nowCen = Convert.ToInt32(conn.ExecuteScalar("select Count(*) from MealCardRunTab where centralNo='" + RequsetList.data.flowlist[j].centralNo + "' ")); + if (nowCen <= 0) + { + conn.Execute( + "insert into MealCardRunTab(Id,accountNo,accountName,depName,personId,identiName,flowtype,flowamount,balance,cardNo,centralTm,centralNo,occurTime,node,bigGroup,smallGroup,seg,pos) " + + "values(newid(), '" + RequsetList.data.flowlist[j].accountNo + "', '" + RequsetList.data.flowlist[j].accountName + "', '" + RequsetList.data.flowlist[j].depName + "','" + RequsetList.data.flowlist[j].personId + "','" + RequsetList.data.flowlist[j].identiName + "','" + RequsetList.data.flowlist[j].flowType + "','" + RequsetList.data.flowlist[j].flowAmount + + "','" + RequsetList.data.flowlist[j].balance + "','" + RequsetList.data.flowlist[j].cardNo + "','" + RequsetList.data.flowlist[j].centralTm + "','" + RequsetList.data.flowlist[j].centralNo + "','" + RequsetList.data.flowlist[j].occurTime + "','" + RequsetList.data.flowlist[j].node + "','" + RequsetList.data.flowlist[j].bigGroup + "','" + RequsetList.data.flowlist[j].group + "','" + RequsetList.data.flowlist[j].seg + "','" + RequsetList.data.flowlist[j].pos + "')"); + } + } } } } - 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(),55555,'一卡通交易流水5','插入数据',getdate())"); - } } } + } #endregion } From 216729801cfc8f35e5285f7092503bab08ecc431 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Thu, 23 May 2024 16:51:22 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E6=94=B6=E8=B4=B9=E7=B3=BB=E7=BB=9F=E4=B8=8E=E7=A5=A8=E6=8D=AE?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=AF=B9=E6=8E=A5=E7=9A=84=E5=BC=80=E7=A5=A8?= =?UTF-8?q?=E7=82=B9=E7=BC=96=E7=A0=81=E6=94=B9=E4=B8=BA004=EF=BC=8CplaceC?= =?UTF-8?q?ode=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 8492281..344067e 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -672,7 +672,7 @@ namespace DigitalSchoolApi.Controllers eBillListClass eBillListitem = new eBillListClass(); eBillListitem.busNo = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); eBillListitem.ivcDate = DateTime.Now.ToString("yyyy-MM-dd"); - eBillListitem.placeCode = "001"; + eBillListitem.placeCode = "004"; eBillListitem.billCode = "4004"; eBillListitem.channel = "23"; eBillListitem.payerType = "1"; @@ -848,7 +848,7 @@ namespace DigitalSchoolApi.Controllers biParam.busType = appid; biParam.busNo = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); biParam.ivcDate = DateTime.Now.ToString("yyyy-MM-dd"); - biParam.placeCode = "001"; + biParam.placeCode = "004"; biParam.billCode = billCode;//"4004"; biParam.channel = "28"; if (orderEntity.PayMode == "BHK" || orderEntity.PayMode == "THK")//BHK:建行;THK:他行;ZFB:支付宝;CFT:微信 @@ -1042,7 +1042,7 @@ namespace DigitalSchoolApi.Controllers biParam.busType = appid; biParam.busNo = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); biParam.ivcDate = DateTime.Now.ToString("yyyy-MM-dd"); - biParam.placeCode = "001"; + biParam.placeCode = "004"; biParam.billCode = billCode;//"4004"; biParam.channel = "28"; if (orderEntity.PayMode == "BHK" || orderEntity.PayMode == "THK")//BHK:建行;THK:他行;ZFB:支付宝;CFT:微信 From 084a1b294f12837fc1a58fab0b6f6716582e1007 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Fri, 7 Jun 2024 14:12:20 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E7=BC=B4=E8=B4=B9=E5=90=8E=E5=A4=84=E7=90=86=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=AD=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PayFeeResultTwoController.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index b2383f0..9238627 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -158,7 +158,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conn = new SqlConnection(_sqlConnection)) { List stuorderlist = null; - stuorderlist = conn.Query(@"select StuNo,YearNo,FSYId,'ExcelOffLine' as PayMode from FinaChargeStuOrder where Status=1 and fsyid='"+ FSYID + @"' + stuorderlist = conn.Query(@"select StuNo,YearNo,FSYId,'ExcelOffLine' as PayMode from FinaChargeStuOrder where Status=1 and fsyid='" + FSYID + @"' group by StuNo, YearNo, FSYId, PayMode").ToList(); foreach (var stuorderEntity in stuorderlist) { @@ -204,7 +204,19 @@ namespace DigitalSchoolApi.Controllers byte[] payload = encoding.GetBytes(par); HttpClient httpClient = new HttpClient(); HttpContent content = new ByteArrayContent(payload); - string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; + string reStr = string.Empty; + try + { + reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; + } + catch (Exception e) + { + 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','对接支付结果地址接口失败:" + reStr + ":" + e.Message + ":" + e.StackTrace + "',getdate())"); + } + } xml.LoadXml(reStr); string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; //string s = "000000"; From 0ee5641e03646c59d2d872e71160f7892c245749 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 19 Jun 2024 17:58:01 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C=EF=BC=9A=E5=A2=9E=E5=8A=A0=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E7=BC=B4=E8=B4=B9=E8=AE=A2=E5=8D=95=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=E6=89=8B=E5=8A=A8=E5=A4=84=E7=90=86=E7=BC=B4=E8=B4=B9?= =?UTF-8?q?=E7=8A=B6=E6=80=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PayFeeResultTwoController.cs | 104 +++++++++++++++++- DigitalSchoolApi/Controllers/YKTTrabs.cs | 22 ++-- 2 files changed, 109 insertions(+), 17 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index 9238627..eecf942 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -118,6 +118,19 @@ namespace DigitalSchoolApi.Controllers return Ok(); } + /// + /// 根据学生缴费订单id手动处理缴费结果 + /// + /// + /// + [HttpPost] + public IHttpActionResult SetPayResultHandleByFCSOId(string FCSOId) + { + + BackgroundJob.Enqueue(() => DoPayResultHandleByFCSOId(FCSOId)); + return Ok(); + } + public void UnInvoiceHandle(bool isexcel) { try @@ -214,7 +227,7 @@ namespace DigitalSchoolApi.Controllers 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','对接支付结果地址接口失败:" + reStr + ":" + e.Message + ":" + e.StackTrace + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','FCSOId:" + item.Id + " 对接支付结果地址接口失败:" + reStr + ":" + e.Message + ":" + e.StackTrace + "',getdate())"); } } xml.LoadXml(reStr); @@ -225,7 +238,7 @@ namespace DigitalSchoolApi.Controllers 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','s = 000000: " + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','FCSOId:" + item.Id + " s = 000000: " + 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; @@ -308,9 +321,7 @@ group by a.FSYear,b.StuNo ) aa left join 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','orderid:" + Orderid + " StuNo:" + REM1 + "',getdate())"); - conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','缴费状态更新成功',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','FCSOId:" + item.Id + " orderid:" + Orderid + " StuNo:" + REM1 + " 缴费状态更新成功',getdate())"); } } } @@ -319,7 +330,7 @@ group by a.FSYear,b.StuNo ) aa left join 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())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','FCSOId:" + item.Id + " error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); } } } @@ -335,6 +346,87 @@ group by a.FSYear,b.StuNo ) aa left join } } + public void DoPayResultHandleByFCSOId(string FCSOId) + { + try + { + using (IDbConnection conn = new SqlConnection(_sqlConnection)) + { + var item = conn.QuerySingleOrDefault("select * from FinaChargeStuOrder where Id='" + FCSOId + "' and Status=0 and OrderType=1 "); + if (item != null) + { + conn.Execute("update FinaChargeStuOrder set Status='1' where Id='" + item.Id + "'"); + + //记录缴费前余额、待缴金额 + var oldFinaChargeStuYearItem = conn.Query(@"select b.* from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode + where a.[FCSOId] = '" + item.Id + "' and b.FSYId = '" + item.FSYId + "'"); + //实缴、缴费余额更新 + //FinaChargeStuYearItem表 + conn.Execute(@"update [dbo].[FinaChargeStuYearItem] set SJAmount=b.SJAmount+a.SJAmount,NeedToPay=NeedToPay-a.SJAmount,PayFeeStatus=(case when(NeedToPay-a.SJAmount<=0) then 1 when(NeedToPay-a.SJAmount=Standard) then 0 else 4 end) +from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode +where a.[FCSOId]='" + item.Id + "' and b.FSYId='" + item.FSYId + "'"); + //FinaChargeStuYear表 + conn.Execute(@" update FinaChargeStuYear set SJAmount=aa.SJAmount,NeedToPay=aa.NeedToPay,PayFeeStatus=(case when(aa.NeedToPay<=0) then 1 else 4 end) +from (select isnull(sum(a.[NeedToPay]),0) as [NeedToPay],isnull(sum(a.SJAmount),0) as SJAmount,a.FSYear,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId +group by a.FSYear,b.StuNo ) aa left join + FinaChargeStuYear b on aa.stuno=b.stuno and aa.FSYear=b.FSYear + where aa.StuNo='" + item.StuNo + "' and aa.FSYear='" + item.YearNo + "'"); + //FinaChargeStudent表 + conn.Execute(@"update FinaChargeStudent set NeedToPay=a.NeedToPay + from (select isnull(sum([NeedToPay]),0) as [NeedToPay],StuNo from [FinaChargeStuYear] group by StuNo) a left join + FinaChargeStudent b on a.stuno=b.stuno where a.stuno='" + item.StuNo + "'"); + //FinaChargeStuBalance流水表 + //记录缴费后余额、待缴金额 + var newFinaChargeStuYearItem = conn.Query(@"select b.* from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode + where a.[FCSOId] = '" + item.Id + "' and b.FSYId = '" + item.FSYId + "'"); + IEnumerable detaillist = conn.Query("select * from FinaChargeStuOrderDetail where FCSOId='" + item.Id + "'"); + foreach (var finaChargeStuOrderDetailEntity in detaillist) + { + if (finaChargeStuOrderDetailEntity.SJAmount > 0) + { + //计算学生缴费项目当前欠缴金额 + var olditem = oldFinaChargeStuYearItem.FirstOrDefault(m => m.ChargeItemCode == finaChargeStuOrderDetailEntity.ChargeItemCode); + var newitem = newFinaChargeStuYearItem.FirstOrDefault(m => m.ChargeItemCode == finaChargeStuOrderDetailEntity.ChargeItemCode); + conn.Execute(@"insert into FinaChargeStuBalance(Id, StuNo, FSYear, FCSOId, ChargeItemCode, ChargeItemName, Standard, DJAmount, PaymentAmount, QJAmount, OldBalance, ChangeAmount, NowBalance, ChangeDate, ChangeType) values( + newid(),'" + item.StuNo + "','" + item.YearNo + "','" + item.Id + "','" + finaChargeStuOrderDetailEntity.ChargeItemCode + "','" + finaChargeStuOrderDetailEntity.ChargeItemName + "','" + finaChargeStuOrderDetailEntity.YJAmount + "'," + + "'" + olditem.NeedToPay + "','" + finaChargeStuOrderDetailEntity.SJAmount + "','" + newitem.NeedToPay + "','" + olditem.FSBlance + "'," + + "'0','" + newitem.FSBlance + "',getdate(),'1')"); + } + } + int PayFeeStatus = Convert.ToInt32(conn.ExecuteScalar("select PayFeeStatus from FinaChargeStuYear where StuNo='" + item.StuNo + "' and FSYear='" + item.YearNo + "'")); + if (PayFeeStatus == 1) + { + 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','【手动处理缴费结果】FCSOId:" + FCSOId + " StuNo:" + item.StuNo + "可以触发开票接口',getdate())"); + } + //开票 + Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(item)); + } + 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','【手动处理缴费结果】FCSOId:" + FCSOId + " StuNo:" + item.StuNo + " 缴费状态更新成功',getdate())"); + } + } + + } + } + catch (Exception e) + { + using (IDbConnection conn = new SqlConnection(_sqlConnection)) + { + conn.Execute("update FinaChargeStuOrder set PayTime=null,PayMode=null,BankOrder=null where Id='" + FCSOId + "'"); + } + 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','【手动处理缴费结果】catch error:" + e.Message + ":" + e.StackTrace + "',getdate())"); + } + } + } + public void GetOrderResult(string orderid) { try diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 5af514a..6fe3f04 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -811,7 +811,7 @@ namespace DigitalSchoolApi.Controllers 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,'typecode','开票typecode:" + item.Key + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'typecode','FCSOId:" + orderEntity.Id + " 开票typecode:" + item.Key + "',getdate())"); } InvoiceEBillByTypeTwo(conn, orderEntity, item.Key, item); } @@ -820,7 +820,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','开票异常:" + ex.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票异常:" + ex.Message + "',getdate())"); } } } @@ -831,7 +831,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','开票异常:" + ex.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票准备报错:" + ex.Message + "',getdate())"); } } } @@ -1086,7 +1086,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','发送给开票系统原始数据:" + JsonConvert.SerializeObject(biParam) + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 发送给开票系统原始数据:" + JsonConvert.SerializeObject(biParam) + "',getdate())"); } var data = Convert.ToBase64String(encoding.GetBytes(JsonConvert.SerializeObject(biParam))); var noise = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); @@ -1113,7 +1113,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','开票系统返回:" + datain + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统返回:" + datain + "',getdate())"); } string returnresult = encoding.GetString(Convert.FromBase64String(datain)); if (returnresult != "") @@ -1127,7 +1127,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','开票系统成功返回:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统成功返回:" + messagedecode + "',getdate())"); } dynamic billInfo = JsonConvert.DeserializeObject(messagedecode); string eBillCode = billInfo.eBillCode; @@ -1162,7 +1162,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','查询开票url返回:" + datainvoice + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url返回:" + datainvoice + "',getdate())"); } string returnresultinvoice = encoding.GetString(Convert.FromBase64String(datainvoice)); resultobj = JsonConvert.DeserializeObject(returnresultinvoice); @@ -1173,7 +1173,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','查询开票url成功返回:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url成功返回:" + messagedecode + "',getdate())"); } dynamic InvoiceUrlInfo = JsonConvert.DeserializeObject(messagedecode); string pictureUrl = InvoiceUrlInfo.pictureUrl; @@ -1187,7 +1187,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','查询开票url错误:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url错误:" + messagedecode + "',getdate())"); } } } @@ -1198,7 +1198,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','开票系统错误:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统错误:" + messagedecode + "',getdate())"); } } } @@ -1210,7 +1210,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','开票系统报错:" + e.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统报错:" + e.Message + "',getdate())"); } } } From 06ff2232b5315bc7fb10a609ed440069c0167dec Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Mon, 12 Aug 2024 13:28:20 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E5=BA=93=E5=AD=A6=E7=94=9F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=9A=E5=8F=96=E6=B6=88=E5=AF=B9=E4=B8=93=E4=B8=9A=E7=9A=84?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 6fe3f04..9a46ed2 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -1443,7 +1443,7 @@ namespace DigitalSchoolApi.Controllers //教室组织机构 List zzjg = conn_oracle.Query("select * from V_JS_ZZJG where ID!='0'").ToList(); //学生信息 - List xsxx = conn_oracle.Query("select * from V_XSXX where MAJOR_CODE is not null ").ToList(); + List xsxx = conn_oracle.Query("select * from V_XSXX ").ToList(); //记录获取数据条数 using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { From 551f9661a7745c3423a41299a889316310f00d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E5=AF=92?= <823756726@qq.com> Date: Wed, 14 Aug 2024 14:54:34 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91?= =?UTF-8?q?=E5=A1=94=E9=87=8C=E6=9C=A8=EF=BC=9A=E4=BB=8E=E8=B6=85=E6=98=9F?= =?UTF-8?q?oracle=E4=B8=AD=E9=97=B4=E5=BA=93=E5=90=8C=E6=AD=A5=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE=E5=88=B0=E6=95=B0?= =?UTF-8?q?=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/TLMSchoolController.cs | 382 +++++++++++++++++- DigitalSchoolApi/Controllers/YKTController.cs | 68 +++- DigitalSchoolApi/DigitalSchoolApi.csproj | 4 +- .../Models/OracleEducationalSystemInfoSync.cs | 181 +++++++++ DigitalSchoolApi/Web.config | 7 +- 5 files changed, 633 insertions(+), 9 deletions(-) create mode 100644 DigitalSchoolApi/Models/OracleEducationalSystemInfoSync.cs diff --git a/DigitalSchoolApi/Controllers/TLMSchoolController.cs b/DigitalSchoolApi/Controllers/TLMSchoolController.cs index d74167b..ca52f8c 100644 --- a/DigitalSchoolApi/Controllers/TLMSchoolController.cs +++ b/DigitalSchoolApi/Controllers/TLMSchoolController.cs @@ -21,6 +21,8 @@ using Learun.Util; using Microsoft.AspNet.SignalR.Client; using Newtonsoft.Json; using Convert = System.Convert; +using DESEncrypt = Learun.Util.DESEncrypt; +using Md5Helper = Learun.Util.Md5Helper; namespace DigitalSchoolApi.Controllers { @@ -33,6 +35,8 @@ namespace DigitalSchoolApi.Controllers private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; private static string _tlmzyMiddleConnection = ConfigurationManager.ConnectionStrings["TLMZYMiddleDBString"].ConnectionString; + private readonly static string _tlmMiddleConnection =ConfigurationManager.ConnectionStrings["TLMMiddleDBString"].ConnectionString; + /// /// 超过设置的晚归时间后,推送到负责人 @@ -427,6 +431,9 @@ where DateDiff(dd,t.CheckDate,getdate())=0 and t.OutTime<'{lateReturnTime}' and } } + + + #region 数校同步到oracle中间库 /// /// 系部 /// @@ -481,7 +488,6 @@ where DateDiff(dd,t.CheckDate,getdate())=0 and t.OutTime<'{lateReturnTime}' and } } } - /// /// 专业 /// @@ -669,7 +675,6 @@ where DateDiff(dd,t.CheckDate,getdate())=0 and t.OutTime<'{lateReturnTime}' and var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); basedbname = aa.Substring(aa.IndexOf("=") + 1); } - var sqlstring = new StringBuilder(); sqlstring.Append("select t.StuId,t.StuNo,t.DeptNo,t.MajorNo,t.Grade,t.ClassNo,t.StuName,t.GenderNo,t.Birthday,t.IdentityCardNo,t.mobile,u.F_UserId from StuInfoBasic t "); sqlstring.Append(" left join " + basedbname + ".dbo.LR_Base_User u on t.StuNo=u.F_Account and t.StuName=u.F_RealName and t.IdentityCardNo=u.F_IdentityCardNo "); @@ -844,6 +849,379 @@ where DateDiff(dd,t.CheckDate,getdate())=0 and t.OutTime<'{lateReturnTime}' and } } + #endregion + + #region oracle同步到数校 + + /// + /// 从oracle中间库同步系部数据 + /// + public static void SyncDeptOracle() + { + try + { + IEnumerable entityList = null; + using (IDbConnection conn = new OracleConnection(_tlmMiddleConnection)) + { + entityList = conn.Query("SELECT * FROM \"CX_JW_YX\" WHERE YXBH in (SELECT YXBH FROM \"CX_JW_ZY\" GROUP BY YXBH)"); + } + using (IDbConnection conn = new SqlConnection(_misConnection)) + { + try + { + var maxSort = -1; + try + { + maxSort = conn.QueryFirstOrDefault("select MAX(DeptSort) FROM CdDept"); + } + catch (Exception e) + { + maxSort = -1; + } + + //插入sql + foreach (var item in entityList) + { + CdDeptEntity model = null; + using (IDbConnection xbconn = new SqlConnection(_misConnection)) + { + model = xbconn.QueryFirstOrDefault($"select * from CdDept where DeptNo='{item.YXBH}'"); + } + if (model == null) + { + maxSort++; + var id = item.ID.Length == 30 ? Guid.ParseExact(item.ID, "N") : Guid.NewGuid(); + //没有就新增 + var sql = + "INSERT INTO CdDept(DeptId, DeptNo, DeptName, DeptShortName, DeptEnBrief, DeptSort, DeptEnShort, DeptDirector, " + + "DeptpSychology, TeachSecretary, DeptOldName, F_SchoolId, SyncFlag, DeptSubsidizer) " + + $"VALUES ('{id}', '{item.YXBH}', '{item.YXMC}', '', '', {maxSort}, NULL,NULL," + + " NULL, NULL, NULL, '207fa1a9-160c-4943-a89b-8fa4db0547ce', '0',NULL);"; + conn.Execute(sql); + } + else + { + //存在就修改 + var sql = $"UPDATE CdDept SET DeptName='{item.YXMC}' where DeptNo='{model.DeptNo}';"; + conn.Execute(sql); + } + + } + //插入数据同步结果 + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步系部信息完成','系部同步数量:" + + entityList.Count() + "条',getdate())"); + } + } + catch (Exception e) + { + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步系部信息异常','" + + e.Message + "',getdate())"); + } + } + } + } + catch (Exception e) + { + using (IDbConnection conn = new SqlConnection(_admsConnection)) + { + conn.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步系部信息异常','错误信息:" + + e.Message + "',getdate())"); + } + } + } + /// + /// 从oracle中间库同步专业数据 Photo数据 + /// + public static void SyncMajorOracle() + { + try + { + IEnumerable entityList = null; + using (IDbConnection conn = new OracleConnection(_tlmMiddleConnection)) + { + entityList = conn.Query("SELECT * FROM \"CX_JW_ZY\""); + } + using (IDbConnection conn = new SqlConnection(_misConnection)) + { + try + { + //插入sql + foreach (var item in entityList) + { + CdMajorEntity model = null; + using (IDbConnection xbconn = new SqlConnection(_misConnection)) + { + model = xbconn.QueryFirstOrDefault($"select * from CdMajor where MajorNo='{item.ZYBH}'"); + } + + if (model == null) + { + var id = item.ID.Length == 30 ? Guid.ParseExact(item.ID, "N") : Guid.NewGuid(); + var sql = + $"INSERT INTO CdMajor([ID], [MajorNo], [MajorName], [LengthOfSchooling], [SubjectSpeciesNo], [DeptNo], [GovMajorNo], [GovMajorName], " + + $"[MajorNameEn], [SubjectSpeciesNo1], [GraduateNo], [CheckMark], [MajorNameBrief], [MajorDirector], [FreshStuMark], [F_SchoolId], [SyncFlag], " + + $"[RecruitObject], [DevelopLevel], [Certificate], [DevelopTarget], [Introduce], [Photo], [Year], [Province], [City], [Area]) " + + $"VALUES ('{id}', '{item.ZYBH}', '{item.ZYMC}', {Convert.ToInt32(item.XZ.Replace("年", ""))}, ''," + + $" '{item.YXBH}', '{item.ZYBH}', '{item.ZYMC}', '', NULL, '2', '1', '', '', NULL, '207fa1a9-160c-4943-a89b-8fa4db0547ce', '0', '', '', '', '', '', NULL, NULL, NULL, NULL, NULL);"; + conn.Execute(sql); + } + else + { + var sql = $"UPDATE CdMajor SET MajorName='{item.ZYMC}',LengthOfSchooling={Convert.ToInt32(item.XZ.Replace("年", ""))},DeptNo='{item.YXBH}',GovMajorName='{item.ZYMC}' where MajorNo='{model.MajorNo}';"; + conn.Execute(sql); + } + } + //插入数据同步结果 + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步专业信息完成','专业同步数量:" + + entityList.Count() + "条',getdate())"); + } + } + catch (Exception e) + { + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步专业信息异常','" + + e.Message + "',getdate())"); + } + } + } + } + catch (Exception e) + { + using (IDbConnection conn = new SqlConnection(_admsConnection)) + { + conn.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步专业信息异常','错误信息:" + + e.Message + "',getdate())"); + } + } + } + /// + /// 从oracle中间库同步班级数据 + /// + public static void SyncClassInfoOracle() + { + try + { + IEnumerable entityList = null; + using (IDbConnection conn = new OracleConnection(_tlmMiddleConnection)) + { + entityList = conn.Query("SELECT * FROM \"CX_JW_BJ\""); + } + using (IDbConnection conn = new SqlConnection(_misConnection)) + { + try + { + //插入sql + foreach (var item in entityList) + { + ClassInfoEntity model = null; + using (IDbConnection xbconn = new SqlConnection(_misConnection)) + { + model = xbconn.QueryFirstOrDefault($"select * from ClassInfo where ClassNo='{item.BJBH}'"); + } + + if (model == null) + { + var id = item.ID.Length == 30 ? Guid.ParseExact(item.ID, "N") : Guid.NewGuid(); + var sql = + "INSERT INTO ClassInfo([ClassId], [ClassNo], [ClassName], [DeptNo], [MajorNo], [MajorDetailNo], [MajorDetailName], [Grade], " + + "[StuNum], [SerialNum], [ClassDiredctorNo], [ClassTutorNo], [ClassNameFull], [CheckMark], [SyncFlag], [ClassType], [IsSeparate])" + + $" VALUES ('{id}', '{item.BJBH}', '{item.BJMC}', '{item.YXBH}', '{item.ZYBH}', NULL, NULL," + + $" '{item.SZNJ.Substring(item.SZNJ.Length - 2)}', 1, '', '', '', NULL, '1', '0', '', '0');"; + conn.Execute(sql); + } + else + { + var sql = + $"UPDATE ClassInfo SET ClassName='{item.BJMC}',DeptNo='{item.YXBH}',MajorNo='{item.ZYBH}',Grade='{item.SZNJ.Substring(item.SZNJ.Length - 2)}' where ClassNo='{model.ClassNo}';"; + conn.Execute(sql); + } + } + //插入数据同步结果 + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步班级信息完成','班级同步数量:" + + entityList.Count() + "条',getdate())"); + } + } + catch (Exception e) + { + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步班级信息异常','" + + e.Message + "',getdate())"); + } + } + } + } + catch (Exception e) + { + using (IDbConnection conn = new SqlConnection(_admsConnection)) + { + conn.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步班级信息异常','错误信息:" + + e.Message + "',getdate())"); + } + } + } + /// + /// 从oracle中间库同步学生数据 + /// + public static void SyncStuInfoOracle(string date) + { + try + { + //增加列sql + //ALTER TABLE StuInfoBasic ADD XJZT nvarchar(50); --增加XJZT 学籍状态 + //EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'学籍状态', @level0type = N'Schema', @level0name = dbo, @level1type = N'Table', @level1name = StuInfoBasic, @level2type = N'Column', @level2name = XJZT; + //ALTER TABLE StuInfoBasic ADD XSDQZT nvarchar(50); --增加XSDQZT 学生当前状态 + //EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'学生当前状态', @level0type = N'Schema', @level0name = dbo, @level1type = N'Table', @level1name = StuInfoBasic, @level2type = N'Column', @level2name = XSDQZT; + if (string.IsNullOrEmpty(date)) + { + date = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); + } + IEnumerable entityList = null; + using (IDbConnection conn = new OracleConnection(_tlmMiddleConnection)) + { + entityList = conn.Query($"SELECT ID,XH,KSH,YXBH,ZYBH,BJBH,SZNJ,XM,XMPY,XB,CSRQ,LXDH,SFZX,XJZT,XSDQZT,ZZMM,MZ,SFZJH FROM \"CX_JW_XSXX\" WHERE UPDATE_DATE> TO_DATE('{date}', 'YYYY-MM-DD')"); + } + using (IDbConnection conn = new SqlConnection(_misConnection)) + { + try + { + //插入sql + foreach (var item in entityList) + { + StuInfoBasicEntity model = null; + using (IDbConnection xbconn = new SqlConnection(_misConnection)) + { + model = xbconn.QueryFirstOrDefault($"select * from StuInfoBasic where StuNo='{item.XH}'"); + } + var mzSql = + $"SELECT t.F_ItemValue FROM LR_Base_DataItemDetail t INNER JOIN LR_Base_DataItem t2 ON t.F_ItemId = t2.F_ItemId WHERE t2.F_ItemCode = 'National' AND t.F_ItemName='{item.MZ}'"; + var xb = item.XB == "男" ? 1 : 0; + var MZ = ""; + if (model == null) + { + var basedbname = string.Empty; + if (_admsConnection.IndexOf("database=") > 0) + { + var aa = _admsConnection.Split(';').First(x => x.Contains("database=")); + basedbname = aa.Substring(aa.IndexOf("=") + 1); + } + else if (_admsConnection.IndexOf("Initial Catalog=") > 0) + { + var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); + basedbname = aa.Substring(aa.IndexOf("=") + 1); + } + var key = Md5Helper.Encrypt(CreateNo(), 16).ToLower(); + var pwd = Md5Helper.Encrypt(DESEncrypt.Encrypt(Md5Helper.Encrypt("tlmzy123456", 32).ToLower(), key).ToLower(), 32).ToLower(); + var id= item.ID.Length == 30 ? Guid.ParseExact(item.ID, "N"):Guid.NewGuid(); + var sql = + "INSERT INTO StuInfoBasic(StuId,StuNo,StuCode,NoticeNo,GraduateYear,ksh,DeptNo,MajorNo,Grade,ClassNo,StuName,SpellFull,GenderNo,Birthday,PartyFaceNo," + + "FamilyOriginNo,NationalityNo,ResidenceNo,HealthStatusNo,GraduateNo,OverseasChineseNo,GoodAt,IdentityCardNo,InSchoolAddress," + + "InSchoolTelephone,Remark,mobile,CheckMark,InSchoolStatus,F_SchoolId,EduSystem,StudyModality,XJZT,XSDQZT) " + + $"VALUES('{id}','{item.XH}','{item.XH}','{item.XH}','','{item.KSH}', '{item.YXBH}', '{item.ZYBH}'," + + $"'{item.SZNJ.Substring(item.SZNJ.Length - 2)}','{item.BJBH}','{item.XM}', '{item.XMPY}','{xb}','{item.CSRQ}','{GetZZMM(item.ZZMM)}',''," + + $"'{MZ}','','1','2','0','','{item.SFZJH}','','',''," + + $"'{item.LXDH}','1','{item.SFZX}','207fa1a9-160c-4943-a89b-8fa4db0547ce', '2', '1','{item.XJZT}','{item.XSDQZT}');"; + //conn.Execute(sql); + var userSql = + $"INSERT INTO {basedbname}.dbo.LR_Base_User(F_UserId,F_EnCode,F_Account,F_Password,F_Secretkey,F_RealName,F_Gender,F_CompanyId," + + $"F_DepartmentId,F_DeleteMark,F_EnabledMark,F_Description,F_CreateDate,F_CreateUserId,F_CreateUserName,F_IdentityCardNo) VALUES('{Guid.NewGuid():D}'," + + $"'{item.XH}','{item.XH}','{pwd}','{key}','{item.XM}','{xb}','207fa1a9-160c-4943-a89b-8fa4db0547ce','{item.YXBH}',0,1,'学生'," + + $"'{DateTime.Now:yyyy-MM-dd hh:mm:ss}','System','数据同步','{item.SFZJH}');"; + conn.Execute(sql+userSql); + } + else + { + var sql = + $"UPDATE StuInfoBasic SET StuName='{item.XM}',SpellFull='{item.XMPY}',GenderNo={xb},Birthday='{item.CSRQ}',IdentityCardNo='{item.SFZJH}'," + + $"Grade='{item.SZNJ.Substring(item.SZNJ.Length - 2)}',DeptNo='{item.YXBH}'," + + $"MajorNo='{item.ZYBH}',ClassNo='{item.BJBH}',ksh='{item.KSH}',mobile='{item.LXDH}'," + + $"InSchoolStatus='{item.SFZX}', XJZT='{item.XJZT}',XSDQZT='{item.XSDQZT}' where StuNo='{model.StuNo}';"; + conn.Execute(sql); + } + } + //插入数据同步结果 + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步学生信息完成','学生同步数量:" + + entityList.Count() + "条',getdate())"); + } + } + catch (Exception e) + { + using (IDbConnection conncore = new SqlConnection(_admsConnection)) + { + conncore.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步学生信息异常','" + + e.Message + "',getdate())"); + } + } + } + } + catch (Exception e) + { + using (IDbConnection conn = new SqlConnection(_admsConnection)) + { + conn.Execute( + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往塔里木中间库同步学生信息异常','错误信息:" + + e.Message + "',getdate())"); + } + } + } + + /// + /// 获取政治面貌代码 + /// + /// + private static string GetZZMM(string zzmmstr) + { + if (string.IsNullOrEmpty(zzmmstr)) + { + return "13"; + } + if (zzmmstr.Contains("共青") || zzmmstr.Contains("青年")) + { + return "03"; + } + else if (zzmmstr.Contains("群众")) + { + return "13"; + } + + return "13"; + } + /// + /// 自动生成编号 201008251145409865 + /// + /// + private static string CreateNo() + { + Random random = new Random(); + string strRandom = random.Next(1000, 10000).ToString(); //生成编号 + string code = DateTime.Now.ToString("yyyyMMddHHmmss") + strRandom;//形如 + return code; + } + + #endregion + /// /// 发送邮件提醒 /// diff --git a/DigitalSchoolApi/Controllers/YKTController.cs b/DigitalSchoolApi/Controllers/YKTController.cs index 027ea9b..7ef5251 100644 --- a/DigitalSchoolApi/Controllers/YKTController.cs +++ b/DigitalSchoolApi/Controllers/YKTController.cs @@ -14,12 +14,50 @@ using Learun.Application.Organization; namespace DigitalSchoolApi.Controllers { - public class YKTController : BaseController + public class YKTController : BaseController { private readonly static string _admsConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; - - + /// + /// 从oracle中间库中同步学生 + /// + /// + [HttpGet] + public IHttpActionResult SyncStuInfoOracle(string date) + { + TLMSchoolController.SyncStuInfoOracle(date); + return Ok("同步成功"); + } + /// + /// 从oracle中间库中同步院系 + /// + /// + [HttpGet] + public IHttpActionResult SyncDeptOracle() + { + TLMSchoolController.SyncDeptOracle(); + return Ok("同步成功"); + } + /// + /// 从oracle中间库中同步专业 + /// + /// + [HttpGet] + public IHttpActionResult SyncMajorOracle() + { + TLMSchoolController.SyncMajorOracle(); + return Ok("同步成功"); + } + /// + /// 从oracle中间库中同步班级 + /// + /// + [HttpGet] + public IHttpActionResult SyncClassInfoOracle() + { + TLMSchoolController.SyncClassInfoOracle(); + return Ok("同步成功"); + } /// /// 西昌一卡通推送 /// @@ -451,7 +489,29 @@ namespace DigitalSchoolApi.Controllers //TLMSchoolController.CloseAccount(); return Ok(); } - + /// + /// 塔里木从超星oracle中间库同步学生基础数据到数校 + /// + public IHttpActionResult SyncTLMZYMiddleToBaseInfo() + { + //院系 + RecurringJob.AddOrUpdate("SyncTLMZYMiddleToDepartment", + () => TLMSchoolController.SyncDeptOracle(), + Cron.Daily(1), TimeZoneInfo.Local); + //专业 + RecurringJob.AddOrUpdate("SyncTLMZYMiddleToMajor", + () => TLMSchoolController.SyncMajorOracle(), + Cron.Daily(1), TimeZoneInfo.Local); + //班级 + RecurringJob.AddOrUpdate("SyncTLMZYMiddleToClassInfo", + () => TLMSchoolController.SyncClassInfoOracle(), + Cron.Daily(1), TimeZoneInfo.Local); + //学生 + RecurringJob.AddOrUpdate("SyncTLMZYMiddleToStuInfo", + () => TLMSchoolController.SyncStuInfoOracle(null), + Cron.Daily(1), TimeZoneInfo.Local); + return Ok(); + } /// /// 往塔里木oracle中间库中同步数校基础信息 /// diff --git a/DigitalSchoolApi/DigitalSchoolApi.csproj b/DigitalSchoolApi/DigitalSchoolApi.csproj index b8b867e..c1c4720 100644 --- a/DigitalSchoolApi/DigitalSchoolApi.csproj +++ b/DigitalSchoolApi/DigitalSchoolApi.csproj @@ -14,7 +14,8 @@ DigitalSchoolApi v4.6.1 true - + + @@ -424,6 +425,7 @@ + diff --git a/DigitalSchoolApi/Models/OracleEducationalSystemInfoSync.cs b/DigitalSchoolApi/Models/OracleEducationalSystemInfoSync.cs new file mode 100644 index 0000000..216a591 --- /dev/null +++ b/DigitalSchoolApi/Models/OracleEducationalSystemInfoSync.cs @@ -0,0 +1,181 @@ +using System; + +namespace DigitalSchoolApi.Models +{ + /// + /// 塔里木同步oracle中间库数据实体 + /// + public class OracleEducationalSystemInfoSync + { + + } + /// + /// 院系 + /// + public class CX_JW_YX + { + public string ID { get; set; } + /// + /// 院系编号 + /// + public string YXBH { get; set; } + /// + /// 院系名称 + /// + public string YXMC { get; set; } + } + /// + /// 专业 + /// + public class CX_JW_ZY + { + public string ID { get; set; } + /// + /// 专业编号 + /// + public string ZYBH { get; set; } + /// + /// 专业名称 + /// + public string ZYMC { get; set; } + /// + /// 专业简称 + /// + public string ZYJC { get; set; } + /// + /// 专业英文名称 + /// + public string ZYYWMC { get; set; } + /// + /// 所属院系(CX_JW_YX中的ID字段) + /// + public string YXID { get; set; } + /// + /// 院系编号 + /// + public string YXBH { get; set; } + /// + /// 学制 + /// + public string XZ { get; set; } + /// + ///培养层次 + /// + public string PYCC { get; set; } + } + /// + /// 班级 + /// + public class CX_JW_BJ + { + public string ID { get; set; } + /// + /// 班级编号 + /// + public string BJBH { get; set; } + /// + /// 班级名称 + /// + public string BJMC { get; set; } + /// + /// 院系(CX_JW_YX中的ID字段) + /// + public string YXID { get; set; } + /// + /// 院系编号 + /// + public string YXBH { get; set; } + /// + /// 专业(CX_JW_ZY中的ID字段) + /// + public string ZYID { get; set; } + /// + /// 专业编号 + /// + public string ZYBH { get; set; } + /// + /// 年级 + /// + public string SZNJ { get; set; } + /// + /// 校区(CX_JW_XQ中的ID字段) + /// + public string XQID { get; set; } + /// + /// 校区(CX_JW_XQ中的ID字段) + /// + public string KYZT { get; set; } + } + /// + /// 学生信息 + /// + public class CX_JW_XSXX + { + public string ID { get; set; } + /// + /// 学号 + /// + public string XH { get; set; } + /// + /// 姓名 + /// + public string XM { get; set; } + /// + /// 姓名拼音 + /// + public string XMPY { get; set; } + /// + /// 性别 + /// + public string XB { get; set; } + /// + /// 出生日期 + /// + public string CSRQ { get; set; } + /// + /// 身份证件号 + /// + public string SFZJH { get; set; } + /// + /// 所在年级 + /// + public string SZNJ { get; set; } + public string YXBH { get; set; } + /// + /// 专业编号 + /// + public string ZYBH { get; set; } + /// + /// 班级编号 + /// + public string BJBH { get; set; } + /// + /// 学籍状态 + /// + public string XJZT { get; set; } + /// + /// 是否在校 + /// + public string SFZX { get; set; } + /// + /// 学生当前状态 + /// + public string XSDQZT { get; set; } + /// + /// 考生号 + /// + public string KSH { get; set; } + /// + /// 民族 + /// + public string MZ { get; set; } + /// + /// 联系电话 + /// + public string LXDH { get; set; } + /// + /// 政治面貌 + /// + public string ZZMM { get; set; } + } +} \ No newline at end of file diff --git a/DigitalSchoolApi/Web.config b/DigitalSchoolApi/Web.config index 0ca5377..3a518d1 100644 --- a/DigitalSchoolApi/Web.config +++ b/DigitalSchoolApi/Web.config @@ -53,9 +53,11 @@ - + + - + + @@ -67,6 +69,7 @@ + - + - + From 3693da08105a11e55c5ef02c182cc2e2c831f242 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 4 Sep 2024 13:47:18 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C=EF=BC=9A=E5=90=8C=E6=AD=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=97=A5=E5=BF=97=E4=BC=98=E5=8C=96=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 9a46ed2..8b1a6fc 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -1458,7 +1458,7 @@ namespace DigitalSchoolApi.Controllers conncore.Execute( $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库班级数据','获取oracle班级数据共{bjxx.Count()}条',getdate())"); conncore.Execute( - $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库教室数据','获取oracle教室数据共{jsxx.Count()}条',getdate())"); + $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库教室数据','获取oracle教室数据共{zzjg.Count()}条',getdate())"); conncore.Execute( $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库学生数据','获取oracle学生数据共{xsxx.Count()}条',getdate())"); } From 1403ea38dd3e52ba48c79d2ee43dea0a9443b76a Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 4 Sep 2024 13:47:43 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C=EF=BC=9A=E7=BC=B4=E8=B4=B9=E5=90=8E=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=BB=BB=E5=8A=A1=E6=97=A5=E5=BF=97=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index 9026155..3b84959 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -71,7 +71,7 @@ namespace DigitalSchoolApi.Controllers { RecurringJob.AddOrUpdate("PayFeeResultMinutes20", () => GetResult(true), - Cron.MinuteInterval(2), TimeZoneInfo.Local); + Cron.MinuteInterval(5), TimeZoneInfo.Local); return Ok(); } /// @@ -227,7 +227,7 @@ namespace DigitalSchoolApi.Controllers 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','FCSOId:" + item.Id + " 对接支付结果地址接口失败:" + reStr + ":" + e.Message + ":" + e.StackTrace + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'ccb','FCSOId:" + item.Id + " 对接支付结果地址接口失败:" + reStr + ":" + e.Message + ":" + e.StackTrace + "',getdate(),'" + item.Id + "')"); } continue; } @@ -331,9 +331,9 @@ group by a.FSYear,b.StuNo ) aa left join 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','FCSOId:" + item.Id + " error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'ccb','FCSOId:" + item.Id + " error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate(),'" + item.Id + "')"); } - //YDCA02910001流水记录不存在;0250E0200001流水记录不存在;YALA02910002查询过于频繁,请稍后再试 + //s:YDCA02910001流水记录不存在;0250E0200001流水记录不存在;YALA02910002查询过于频繁,请稍后再试 } } } From a2a2661044240394f8c4f34a7258a5c55fbbd123 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Thu, 5 Sep 2024 16:50:44 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=AD=A6=E7=94=9F=EF=BC=9A=E5=A2=9E=E5=8A=A0=E8=80=83?= =?UTF-8?q?=E7=94=9F=E5=8F=B7=E5=90=8C=E6=AD=A5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 11 +++++++++++ DigitalSchoolApi/Models/XCStudentEntity.cs | 1 + 2 files changed, 12 insertions(+) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 8b1a6fc..d3ad63b 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -1942,6 +1942,11 @@ namespace DigitalSchoolApi.Controllers { sb.Append($" ClassNo='{item.CLASS_ID}',"); } + //考生号 + if (!string.IsNullOrEmpty(item.KSH)) + { + sb.Append($" ksh='{item.KSH}',"); + } if (!string.IsNullOrEmpty(item.FORMER_NAME)) { sb.Append($" FORMER_NAME='{item.FORMER_NAME}',"); @@ -2089,6 +2094,12 @@ namespace DigitalSchoolApi.Controllers fieleSb.Append("ClassNo,"); sb.Append($" '{xsxx.CLASS_ID}',"); } + //考生号 + if (!string.IsNullOrEmpty(xsxx.KSH)) + { + fieleSb.Append("ksh,"); + sb.Append($" '{xsxx.KSH}',"); + } if (!string.IsNullOrEmpty(xsxx.PINYIN)) { fieleSb.Append("SpellFull,"); diff --git a/DigitalSchoolApi/Models/XCStudentEntity.cs b/DigitalSchoolApi/Models/XCStudentEntity.cs index 2cfc08f..d27afa8 100644 --- a/DigitalSchoolApi/Models/XCStudentEntity.cs +++ b/DigitalSchoolApi/Models/XCStudentEntity.cs @@ -932,6 +932,7 @@ namespace DigitalSchoolApi.Models public string STU_STATE_CODE { get; set; } public string STU_ROLL_CODE { get; set; } public string IS_NORMAL { get; set; } + public string KSH { get; set; } } public class V_Dept From 1e38ff814112f5413cd65da187ea4d6022154331 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Tue, 10 Sep 2024 15:21:32 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C-=E7=BC=B4=E8=B4=B9=E5=90=8E=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PayFeeResultTwoController.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index 3b84959..f597ca3 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -204,6 +204,12 @@ namespace DigitalSchoolApi.Controllers List list = conn.Query("select * from FinaChargeStuOrder where PlaceOrderTime>='" + lastdate + "' and Status=0 and OrderType=1 ").ToList(); foreach (var item in list) { + //校验 + var orderentity = conn.QueryFirstOrDefault($"select * from FinaChargeStuOrder where Id='{item.Id}' "); + if (orderentity == null || orderentity.Status == 1) + { + continue; + } //轮询建行商户平台 XmlDocument xml = new XmlDocument(); xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); @@ -262,7 +268,13 @@ namespace DigitalSchoolApi.Controllers //string REM1 = item.StuNo; //string REM2 = item.YearNo.ToString(); if (ORDER_STATUS == "1") - { + { + //校验 + var orderentity2 = conn.QueryFirstOrDefault($"select * from FinaChargeStuOrder where Id='{item.Id}' "); + if (orderentity2 == null || orderentity2.Status == 1) + { + continue; + } conn.Execute("update FinaChargeStuOrder set SJAmount='" + PAYMENT_MONEY + "',Status='" + ORDER_STATUS + "',PayTime='" + TRAN_DATE + "',PayMode='" + PAY_MODE + "',BankOrder='" + OriOvrlsttnEV_Trck_No + "' where orderid='" + Orderid + "'"); ////判断实缴金额是否缴清费用 //decimal sjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(sum(SJAmount),0) from FinaChargeStuOrder where StuNo='" + REM1 + "' and Status=1 and YearNo='" + REM2 + "' ")); @@ -313,17 +325,17 @@ group by a.FSYear,b.StuNo ) aa left join "'0','" + newitem.FSBlance + "',getdate(),'1')"); } } + 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','FCSOId:" + item.Id + " orderid:" + Orderid + " StuNo:" + REM1 + " 缴费状态更新成功',getdate())"); + } int PayFeeStatus = Convert.ToInt32(conn.ExecuteScalar("select PayFeeStatus from FinaChargeStuYear where StuNo='" + item.StuNo + "' and FSYear='" + item.YearNo + "'")); if (PayFeeStatus == 1) { //开票 Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(item)); } - 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','FCSOId:" + item.Id + " orderid:" + Orderid + " StuNo:" + REM1 + " 缴费状态更新成功',getdate())"); - } } } else From dd9ff2a120fcd3325eecb335456f01ad0058df10 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 18 Sep 2024 17:42:53 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C-=E7=BC=B4=E8=B4=B9=E5=90=8E=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=8E=A5=E5=8F=A3=EF=BC=9A=E4=BC=98=E5=8C=96=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=A1=BA=E5=BA=8F=E5=92=8C=E5=AE=9A=E6=97=B6=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E9=97=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index f597ca3..0954bca 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -71,7 +71,7 @@ namespace DigitalSchoolApi.Controllers { RecurringJob.AddOrUpdate("PayFeeResultMinutes20", () => GetResult(true), - Cron.MinuteInterval(5), TimeZoneInfo.Local); + "0 0/5 * * * ?", TimeZoneInfo.Local); return Ok(); } /// @@ -201,7 +201,7 @@ namespace DigitalSchoolApi.Controllers string lastdate = iflasttenminutes ? DateTime.Now.AddMinutes(-30).ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.AddDays(-20).ToString("yyyy-MM-dd HH:mm:ss"); - List list = conn.Query("select * from FinaChargeStuOrder where PlaceOrderTime>='" + lastdate + "' and Status=0 and OrderType=1 ").ToList(); + List list = conn.Query("select * from FinaChargeStuOrder where PlaceOrderTime>='" + lastdate + "' and Status=0 and OrderType=1 order by PlaceOrderTime desc").ToList(); foreach (var item in list) { //校验 From 456f8c14e04b6ba5549f10f6493c9e8d3b8eccdd Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Mon, 23 Sep 2024 13:25:15 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C-=E7=BC=B4=E8=B4=B9=E5=BC=80=E7=A5=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96=EF=BC=8C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AE=8C=E5=96=84=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index d3ad63b..a6857ae 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -941,7 +941,7 @@ namespace DigitalSchoolApi.Controllers string checkCode = billInfo.checkCode; //记录票号 var recordId = Guid.NewGuid(); - conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1')"); + conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus,FCSOId,CreateTime) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1','{orderEntity.Id}',getdate())"); //conn.Execute("update StuEnrollFeeOrder set billBatchCode='" + eBillCode + "',billNo='" + eBillNo + "',random='" + checkCode + "',billStatus=1 where orderid='" + OrderId + "'"); if (IsNewOrOld) { @@ -1086,7 +1086,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 发送给开票系统原始数据:" + JsonConvert.SerializeObject(biParam) + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 发送给开票系统原始数据:" + JsonConvert.SerializeObject(biParam) + "',getdate(),'" + orderEntity.Id + "')"); } var data = Convert.ToBase64String(encoding.GetBytes(JsonConvert.SerializeObject(biParam))); var noise = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); @@ -1113,7 +1113,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统返回:" + datain + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统返回:" + datain + "',getdate(),'" + orderEntity.Id + "')"); } string returnresult = encoding.GetString(Convert.FromBase64String(datain)); if (returnresult != "") @@ -1127,7 +1127,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统成功返回:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统成功返回:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } dynamic billInfo = JsonConvert.DeserializeObject(messagedecode); string eBillCode = billInfo.eBillCode; @@ -1135,7 +1135,7 @@ namespace DigitalSchoolApi.Controllers string checkCode = billInfo.checkCode; //记录票号 var recordId = Guid.NewGuid(); - conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1')"); + conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus,FCSOId,CreateTime) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1','{orderEntity.Id}',getdate())"); //查询票据url var invoiceobj = new { billBatchCode = eBillCode, billNo = eBillNo, random = checkCode, channelMode = "1" }; @@ -1162,7 +1162,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url返回:" + datainvoice + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url返回:" + datainvoice + "',getdate(),'" + orderEntity.Id + "')"); } string returnresultinvoice = encoding.GetString(Convert.FromBase64String(datainvoice)); resultobj = JsonConvert.DeserializeObject(returnresultinvoice); @@ -1173,7 +1173,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url成功返回:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url成功返回:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } dynamic InvoiceUrlInfo = JsonConvert.DeserializeObject(messagedecode); string pictureUrl = InvoiceUrlInfo.pictureUrl; @@ -1187,7 +1187,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url错误:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url错误:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } } } @@ -1198,7 +1198,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统错误:" + messagedecode + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统错误:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } } } @@ -1210,7 +1210,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统报错:" + e.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统报错:" + e.Message + "',getdate(),'" + orderEntity.Id + "')"); } } } From 665fe20d102058b25fd287a5b335adb5a1c21563 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Fri, 27 Sep 2024 09:34:57 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A5=BF=E6=98=8C=EF=BC=9A=E6=89=B9=E9=87=8F=E8=A1=A5=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E7=A5=A8=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PayFeeResultTwoController.cs | 38 ++++++++++++++++++- DigitalSchoolApi/Controllers/YKTTrabs.cs | 24 ++++++------ 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs index 0954bca..c9f6115 100644 --- a/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs +++ b/DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs @@ -106,6 +106,40 @@ namespace DigitalSchoolApi.Controllers BackgroundJob.Enqueue(() => DoUnInvoiceHandleByFSYID(FSYID)); return Ok(); } + /// + /// 根据年度学生缴费id批量触发开票任务 + /// + /// 学年,如2024 + /// + [HttpPost] + public IHttpActionResult SetUnInvoiceHandleByFSYIDs(string yearno) + { + try + { + using (IDbConnection conn = new SqlConnection(_sqlConnection)) + { + var FinaChargeStuYearList = conn.Query($@"select f.* +from FinaChargeStuYear f +left join StuEnrollInvoiceRecord s on f.StuNo=s.StuNo and f.FSYear=s.YearNo + where f.FSYear='{yearno}' and f.PayFeeStatus =1 + and s.Id is null"); + foreach (var item in FinaChargeStuYearList) + { + DoUnInvoiceHandleByFSYID(item.FSYId); + } + } + } + catch (Exception e) + { + 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,'piaoju','" + yearno + "学年批量开票异常:" + e.Message + "',getdate())"); + } + } + + return Ok(); + } /// /// 补开发票 @@ -186,7 +220,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','" + e.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FSYId:" + FSYID + ",异常原因:" + e.Message + "',getdate(),'" + FSYID + "')"); } } } @@ -268,7 +302,7 @@ namespace DigitalSchoolApi.Controllers //string REM1 = item.StuNo; //string REM2 = item.YearNo.ToString(); if (ORDER_STATUS == "1") - { + { //校验 var orderentity2 = conn.QueryFirstOrDefault($"select * from FinaChargeStuOrder where Id='{item.Id}' "); if (orderentity2 == null || orderentity2.Status == 1) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index a6857ae..ce1b708 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -811,7 +811,7 @@ namespace DigitalSchoolApi.Controllers 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,'typecode','FCSOId:" + orderEntity.Id + " 开票typecode:" + item.Key + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'typecode','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票typecode:" + item.Key + "',getdate())"); } InvoiceEBillByTypeTwo(conn, orderEntity, item.Key, item); } @@ -820,7 +820,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 开票异常:" + ex.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票异常:" + ex.Message + "',getdate())"); } } } @@ -831,7 +831,7 @@ namespace DigitalSchoolApi.Controllers 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,'piaoju','FCSOId:" + orderEntity.Id + " 开票准备报错:" + ex.Message + "',getdate())"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票准备报错:" + ex.Message + "',getdate())"); } } } @@ -1086,7 +1086,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 发送给开票系统原始数据:" + JsonConvert.SerializeObject(biParam) + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";发送给开票系统原始数据:" + JsonConvert.SerializeObject(biParam) + "',getdate(),'" + orderEntity.Id + "')"); } var data = Convert.ToBase64String(encoding.GetBytes(JsonConvert.SerializeObject(biParam))); var noise = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); @@ -1113,7 +1113,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统返回:" + datain + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票系统返回:" + datain + "',getdate(),'" + orderEntity.Id + "')"); } string returnresult = encoding.GetString(Convert.FromBase64String(datain)); if (returnresult != "") @@ -1127,7 +1127,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统成功返回:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票系统成功返回:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } dynamic billInfo = JsonConvert.DeserializeObject(messagedecode); string eBillCode = billInfo.eBillCode; @@ -1135,7 +1135,7 @@ namespace DigitalSchoolApi.Controllers string checkCode = billInfo.checkCode; //记录票号 var recordId = Guid.NewGuid(); - conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus,FCSOId,CreateTime) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1','{orderEntity.Id}',getdate())"); + conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus,FCSOId,CreateTime,FSYId) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1','{orderEntity.Id}',getdate(),'{orderEntity.FSYId}')"); //查询票据url var invoiceobj = new { billBatchCode = eBillCode, billNo = eBillNo, random = checkCode, channelMode = "1" }; @@ -1162,7 +1162,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url返回:" + datainvoice + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";查询开票url返回:" + datainvoice + "',getdate(),'" + orderEntity.Id + "')"); } string returnresultinvoice = encoding.GetString(Convert.FromBase64String(datainvoice)); resultobj = JsonConvert.DeserializeObject(returnresultinvoice); @@ -1173,7 +1173,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url成功返回:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";查询开票url成功返回:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } dynamic InvoiceUrlInfo = JsonConvert.DeserializeObject(messagedecode); string pictureUrl = InvoiceUrlInfo.pictureUrl; @@ -1187,7 +1187,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 查询开票url错误:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";查询开票url错误:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } } } @@ -1198,7 +1198,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统错误:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票系统错误:" + messagedecode + "',getdate(),'" + orderEntity.Id + "')"); } } } @@ -1210,7 +1210,7 @@ namespace DigitalSchoolApi.Controllers using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) { conncore.Execute( - "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + " 开票系统报错:" + e.Message + "',getdate(),'" + orderEntity.Id + "')"); + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime,F_Module) values(newid(),121,'piaoju','FCSOId:" + orderEntity.Id + ";FSYId:" + orderEntity.FSYId + ";开票系统报错:" + e.Message + "',getdate(),'" + orderEntity.Id + "')"); } } }