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] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E8=A5=BF?= =?UTF-8?q?=E6=98=8C=EF=BC=9A=E6=89=B9=E9=87=8F=E8=A1=A5=E5=BC=80=E5=8F=91?= =?UTF-8?q?=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 + "')"); } } }