@@ -15,6 +15,9 @@ using Learun.Util.Operat; | |||
using Newtonsoft.Json; | |||
using ThoughtWorks.QRCode.Codec; | |||
using System.Threading.Tasks; | |||
using System.Net.NetworkInformation; | |||
using System.Net; | |||
using System.Net.Http; | |||
namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||
{ | |||
@@ -96,7 +99,7 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||
return Success(new { success = "1" }); | |||
} | |||
else | |||
return Success(new { success = "0",info= "当前不在缴费时间范围" }); | |||
return Success(new { success = "0", info = "当前不在缴费时间范围" }); | |||
} | |||
[HttpGet] | |||
@@ -206,8 +209,8 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||
{ | |||
finaChargeStuYearIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
} | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult SetUnInvoiceHandleByFSYID(string keyValue) | |||
@@ -215,7 +218,7 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||
//触发开具发票任务 | |||
//通过调用digitalschoolapi的接口实现任务触发 | |||
string excelInvoice = Config.GetValue("ExcelInvoiceTwo"); | |||
Task.Run(() => HttpMethods.Post(excelInvoice+ "?FSYID="+keyValue)); | |||
Task.Run(() => HttpMethods.Post(excelInvoice + "?FSYID=" + keyValue)); | |||
return Success("操作成功!"); | |||
} | |||
/// <summary> | |||
@@ -260,62 +263,107 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||
FinaChargeStuYearEntity entity = strEntity.ToObject<FinaChargeStuYearEntity>(); | |||
List<FinaChargeStuOrderDetailEntity> list = detailList.ToObject<List<FinaChargeStuOrderDetailEntity>>(); | |||
var imgUrl = ""; | |||
Random ran = new Random(); | |||
string merchantid = "105000082201406";//商户号 | |||
string posid = "043724806";//商户柜台代码 | |||
string branchid = "510000000";//分行代码 | |||
string orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); | |||
string payment = entity.PayMoney.ToString(); | |||
string curcode = "01"; | |||
string txcode = "530550"; | |||
string remark1 = entity.StuNo; | |||
string remark2 = entity.FSYear.ToString(); | |||
string returntype = "3"; | |||
string timeout = DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"); | |||
string pub32tr2 = "40d987faa793a0a27e7a86ef020111"; | |||
string bankURL = "https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain?CCB_IBSVersion=V6"; | |||
string tmp = "MERCHANTID=" + merchantid + "&POSID=" + posid + "&BRANCHID=" + branchid + "&ORDERID=" + orderid; | |||
tmp += "&PAYMENT=" + payment + "&CURCODE=" + curcode + "&TXCODE=" + txcode + "&REMARK1=" + remark1; | |||
tmp += "&REMARK2=" + remark2 + "&RETURNTYPE=" + returntype + "&TIMEOUT=" + timeout; | |||
MD5 md5 = MD5.Create(); | |||
string tmp1 = tmp; | |||
tmp += "&PUB=" + pub32tr2; | |||
byte[] buffer = Encoding.Default.GetBytes(tmp); | |||
byte[] md5Buffer = md5.ComputeHash(buffer); | |||
string strMd5 = ""; | |||
//hdnOrderId.Value = orderid; | |||
foreach (byte item in md5Buffer) | |||
{ | |||
strMd5 += item.ToString("x2"); | |||
} | |||
String url = bankURL + "&" + tmp1 + "&MAC=" + strMd5; | |||
string reJson = HttpMethods.Post(url); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_ExecuteResultJson = reJson; | |||
logEntity.WriteLog(); | |||
//HttpConnect conn = new HttpConnect(); | |||
//string reJson = conn.Post(url, ""); | |||
JsonBean MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(reJson); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
//访问学校财务服务器 | |||
string payresulturl = Config.GetValue("payresulturl"); | |||
string par = "requestXml="; | |||
Encoding encoding = Encoding.GetEncoding("gb2312"); | |||
byte[] payload = encoding.GetBytes(par); | |||
HttpClient httpClient = new HttpClient(); | |||
HttpContent content = new ByteArrayContent(payload); | |||
try | |||
{ | |||
string imgCode = HttpMethods.Post(MemberInfoList.PAYURL); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_ExecuteResultJson = imgCode; | |||
logEntity.WriteLog(); | |||
MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(imgCode); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
var result = httpClient.PostAsync(payresulturl, content); | |||
//LogEntity logEntity2 = new LogEntity(); | |||
//logEntity2.F_CategoryId = 121; | |||
//logEntity2.F_SourceObjectId = "preaccess"; | |||
//logEntity2.F_SourceContentJson = "成功"; | |||
//logEntity2.F_ExecuteResultJson = result.ToString(); | |||
//logEntity2.WriteLog(); | |||
try | |||
{ | |||
Random ran = new Random(); | |||
string merchantid = "105000082201406";//商户号 | |||
string posid = "043724806";//商户柜台代码 | |||
string branchid = "510000000";//分行代码 | |||
string orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); | |||
string payment = entity.PayMoney.ToString(); | |||
string curcode = "01"; | |||
string txcode = "530550"; | |||
string remark1 = entity.StuNo; | |||
string remark2 = entity.FSYear.ToString(); | |||
string returntype = "3"; | |||
string timeout = DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"); | |||
string pub32tr2 = "40d987faa793a0a27e7a86ef020111"; | |||
string bankURL = "https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain?CCB_IBSVersion=V6"; | |||
string tmp = "MERCHANTID=" + merchantid + "&POSID=" + posid + "&BRANCHID=" + branchid + "&ORDERID=" + orderid; | |||
tmp += "&PAYMENT=" + payment + "&CURCODE=" + curcode + "&TXCODE=" + txcode + "&REMARK1=" + remark1; | |||
tmp += "&REMARK2=" + remark2 + "&RETURNTYPE=" + returntype + "&TIMEOUT=" + timeout; | |||
MD5 md5 = MD5.Create(); | |||
string tmp1 = tmp; | |||
tmp += "&PUB=" + pub32tr2; | |||
byte[] buffer = Encoding.Default.GetBytes(tmp); | |||
byte[] md5Buffer = md5.ComputeHash(buffer); | |||
string strMd5 = ""; | |||
//hdnOrderId.Value = orderid; | |||
foreach (byte item in md5Buffer) | |||
{ | |||
strMd5 += item.ToString("x2"); | |||
} | |||
String url = bankURL + "&" + tmp1 + "&MAC=" + strMd5; | |||
string reJson = HttpMethods.Post(url); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "qrcode"; | |||
logEntity.F_SourceContentJson = "成功"; | |||
logEntity.F_ExecuteResultJson = reJson; | |||
logEntity.WriteLog(); | |||
//HttpConnect conn = new HttpConnect(); | |||
//string reJson = conn.Post(url, ""); | |||
JsonBean MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(reJson); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
{ | |||
string imgCode = HttpMethods.Post(MemberInfoList.PAYURL); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "qrcode"; | |||
logEntity.F_SourceContentJson = "成功"; | |||
logEntity.F_ExecuteResultJson = imgCode; | |||
logEntity.WriteLog(); | |||
MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(imgCode); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
{ | |||
imgUrl = CreateQRImg(MemberInfoList.QRURL, orderid); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(imgUrl)) | |||
{ | |||
entity.orderid = orderid; | |||
finaChargeStuOrderIbll.SaveOrderData(entity, list); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
imgUrl = CreateQRImg(MemberInfoList.QRURL, orderid); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "qrcode"; | |||
logEntity.F_SourceContentJson = "失败"; | |||
logEntity.F_ExecuteResultJson = e.Message; | |||
logEntity.WriteLog(); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(imgUrl)) | |||
catch (Exception e) | |||
{ | |||
entity.orderid = orderid; | |||
finaChargeStuOrderIbll.SaveOrderData(entity, list); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "preaccess"; | |||
logEntity.F_SourceContentJson = "失败"; | |||
logEntity.F_ExecuteResultJson = e.Message; | |||
logEntity.WriteLog(); | |||
return Fail("缴费机器暂停缴费!"); | |||
} | |||
return Success(imgUrl); | |||
} | |||
@@ -181,6 +181,7 @@ | |||
<add key="ExcelInvoice" value="http://localhost:60037/api/PayFeeResult/SetUnInvoiceHandle"/> | |||
<add key="ExcelInvoiceTwo" value="http://localhost:60037/api/PayFeeResultTwo/SetUnInvoiceHandleByFSYID"/> | |||
<add key="HandPayResult" value="http://localhost:8020/api/PayFeeResultTwo/SetPayResultHandleByFCSOId"/> | |||
<add key="payresulturl" value="http://192.168.53.125:12345" /> | |||
<!--工资导入EXCEL列忽略项--> | |||
<add key="GzColumn" value="发放年份,发放月份,职员代码,发放次数"/> | |||
</appSettings> |
@@ -17,6 +17,7 @@ using Learun.Application.TwoDevelopment.Ask; | |||
using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement; | |||
using Newtonsoft.Json; | |||
using ThoughtWorks.QRCode.Codec; | |||
using System.Net.Http; | |||
namespace Learun.Application.WebApi.Modules | |||
{ | |||
@@ -106,62 +107,107 @@ namespace Learun.Application.WebApi.Modules | |||
FinaChargeStuYearEntity entity = parameter.strEntity.ToObject<FinaChargeStuYearEntity>(); | |||
List<FinaChargeStuOrderDetailEntity> list = parameter.detailList.ToObject<List<FinaChargeStuOrderDetailEntity>>(); | |||
var imgUrl = ""; | |||
Random ran = new Random(); | |||
string merchantid = "105000082201406";//商户号 | |||
string posid = "043724806";//商户柜台代码 | |||
string branchid = "510000000";//分行代码 | |||
string orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); | |||
string payment = entity.PayMoney.ToString(); | |||
string curcode = "01"; | |||
string txcode = "530550"; | |||
string remark1 = entity.StuNo; | |||
string remark2 = entity.FSYear.ToString(); | |||
string returntype = "3"; | |||
string timeout = DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"); | |||
string pub32tr2 = "40d987faa793a0a27e7a86ef020111"; | |||
string bankURL = "https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain?CCB_IBSVersion=V6"; | |||
string tmp = "MERCHANTID=" + merchantid + "&POSID=" + posid + "&BRANCHID=" + branchid + "&ORDERID=" + orderid; | |||
tmp += "&PAYMENT=" + payment + "&CURCODE=" + curcode + "&TXCODE=" + txcode + "&REMARK1=" + remark1; | |||
tmp += "&REMARK2=" + remark2 + "&RETURNTYPE=" + returntype + "&TIMEOUT=" + timeout; | |||
MD5 md5 = MD5.Create(); | |||
string tmp1 = tmp; | |||
tmp += "&PUB=" + pub32tr2; | |||
byte[] buffer = Encoding.Default.GetBytes(tmp); | |||
byte[] md5Buffer = md5.ComputeHash(buffer); | |||
string strMd5 = ""; | |||
//hdnOrderId.Value = orderid; | |||
foreach (byte item in md5Buffer) | |||
{ | |||
strMd5 += item.ToString("x2"); | |||
} | |||
String url = bankURL + "&" + tmp1 + "&MAC=" + strMd5; | |||
string reJson = HttpMethods.Post(url); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_ExecuteResultJson = reJson; | |||
logEntity.WriteLog(); | |||
//HttpConnect conn = new HttpConnect(); | |||
//string reJson = conn.Post(url, ""); | |||
JsonBean MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(reJson); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
//访问学校财务服务器 | |||
string payresulturl = Config.GetValue("payresulturl"); | |||
string par = "requestXml="; | |||
Encoding encoding = Encoding.GetEncoding("gb2312"); | |||
byte[] payload = encoding.GetBytes(par); | |||
HttpClient httpClient = new HttpClient(); | |||
HttpContent content = new ByteArrayContent(payload); | |||
try | |||
{ | |||
string imgCode = HttpMethods.Post(MemberInfoList.PAYURL); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_ExecuteResultJson = imgCode; | |||
logEntity.WriteLog(); | |||
MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(imgCode); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
var result = httpClient.PostAsync(payresulturl, content); | |||
//LogEntity logEntity2 = new LogEntity(); | |||
//logEntity2.F_CategoryId = 121; | |||
//logEntity2.F_SourceObjectId = "preaccess"; | |||
//logEntity2.F_SourceContentJson = "成功"; | |||
//logEntity2.F_ExecuteResultJson = result.ToString(); | |||
//logEntity2.WriteLog(); | |||
try | |||
{ | |||
imgUrl = CreateQRImg(MemberInfoList.QRURL, orderid); | |||
Random ran = new Random(); | |||
string merchantid = "105000082201406";//商户号 | |||
string posid = "043724806";//商户柜台代码 | |||
string branchid = "510000000";//分行代码 | |||
string orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); | |||
string payment = entity.PayMoney.ToString(); | |||
string curcode = "01"; | |||
string txcode = "530550"; | |||
string remark1 = entity.StuNo; | |||
string remark2 = entity.FSYear.ToString(); | |||
string returntype = "3"; | |||
string timeout = DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"); | |||
string pub32tr2 = "40d987faa793a0a27e7a86ef020111"; | |||
string bankURL = "https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain?CCB_IBSVersion=V6"; | |||
string tmp = "MERCHANTID=" + merchantid + "&POSID=" + posid + "&BRANCHID=" + branchid + "&ORDERID=" + orderid; | |||
tmp += "&PAYMENT=" + payment + "&CURCODE=" + curcode + "&TXCODE=" + txcode + "&REMARK1=" + remark1; | |||
tmp += "&REMARK2=" + remark2 + "&RETURNTYPE=" + returntype + "&TIMEOUT=" + timeout; | |||
MD5 md5 = MD5.Create(); | |||
string tmp1 = tmp; | |||
tmp += "&PUB=" + pub32tr2; | |||
byte[] buffer = Encoding.Default.GetBytes(tmp); | |||
byte[] md5Buffer = md5.ComputeHash(buffer); | |||
string strMd5 = ""; | |||
//hdnOrderId.Value = orderid; | |||
foreach (byte item in md5Buffer) | |||
{ | |||
strMd5 += item.ToString("x2"); | |||
} | |||
String url = bankURL + "&" + tmp1 + "&MAC=" + strMd5; | |||
string reJson = HttpMethods.Post(url); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "qrcode"; | |||
logEntity.F_SourceContentJson = "成功"; | |||
logEntity.F_ExecuteResultJson = reJson; | |||
logEntity.WriteLog(); | |||
//HttpConnect conn = new HttpConnect(); | |||
//string reJson = conn.Post(url, ""); | |||
JsonBean MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(reJson); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
{ | |||
string imgCode = HttpMethods.Post(MemberInfoList.PAYURL); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "qrcode"; | |||
logEntity.F_SourceContentJson = "成功"; | |||
logEntity.F_ExecuteResultJson = imgCode; | |||
logEntity.WriteLog(); | |||
MemberInfoList = JsonConvert.DeserializeObject<JsonBean>(imgCode); | |||
if (MemberInfoList.SUCCESS.Equals("true")) | |||
{ | |||
imgUrl = CreateQRImg(MemberInfoList.QRURL, orderid); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(imgUrl)) | |||
{ | |||
entity.orderid = orderid; | |||
finaChargeStuOrderIbll.SaveOrderData(entity, list); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "qrcode"; | |||
logEntity.F_SourceContentJson = "失败"; | |||
logEntity.F_ExecuteResultJson = e.Message; | |||
logEntity.WriteLog(); | |||
} | |||
} | |||
if (!string.IsNullOrEmpty(imgUrl)) | |||
catch (Exception e) | |||
{ | |||
entity.orderid = orderid; | |||
finaChargeStuOrderIbll.SaveOrderData(entity, list); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 121; | |||
logEntity.F_SourceObjectId = "preaccess"; | |||
logEntity.F_SourceContentJson = "失败"; | |||
logEntity.F_ExecuteResultJson = e.Message; | |||
logEntity.WriteLog(); | |||
return Fail("缴费机器暂停缴费!"); | |||
} | |||
var backimgUrl = new { imgUrl }; | |||
return Success(backimgUrl); | |||
} | |||
@@ -108,5 +108,6 @@ | |||
<add key="QJUrl" value="www.qj.com"/> | |||
<!-- 报名选修课的最大课程数 --> | |||
<add key="ElectiveLessonApplyMax" value="2" /> | |||
<add key="payresulturl" value="http://192.168.53.125:12345" /> | |||
</appSettings> |