瀏覽代碼

【增加】西昌:增加根据单个缴费订单编号手动处理缴费状态;

master^2
dyy 5 月之前
父節點
當前提交
0ee5641e03
共有 2 個檔案被更改,包括 109 行新增17 行删除
  1. +98
    -6
      DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs
  2. +11
    -11
      DigitalSchoolApi/Controllers/YKTTrabs.cs

+ 98
- 6
DigitalSchoolApi/Controllers/PayFeeResultTwoController.cs 查看文件

@@ -118,6 +118,19 @@ namespace DigitalSchoolApi.Controllers
return Ok();
}

/// <summary>
/// 根据学生缴费订单id手动处理缴费结果
/// </summary>
/// <param name="FCSOId"></param>
/// <returns></returns>
[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<FinaChargeStuOrderEntity>("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<FinaChargeStuYearItemEntity>(@"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<FinaChargeStuYearItemEntity>(@"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<FinaChargeStuOrderDetailEntity> detaillist = conn.Query<FinaChargeStuOrderDetailEntity>("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


+ 11
- 11
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())");
}
}
}


Loading…
取消
儲存