diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs index 593a5d8b6..42e508bc2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs @@ -10,11 +10,14 @@ using NPOI.XSSF.UserModel; using System; using System.Collections.Generic; using System.Data; +using System.Drawing; using System.IO; using System.Linq; +using System.Security.Cryptography; using System.Text; using System.Web; using System.Web.Mvc; +using ThoughtWorks.QRCode.Codec; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { @@ -634,6 +637,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers var PayFeeTotal = FinaChargesStandardList.Select(x => x.Standard).Sum(); var jsonData = new { + StuInfoFreshData = StuInfoFreshData, FinaChargesStandardList = FinaChargesStandardList, PayFeeTotal = PayFeeTotal }; @@ -1226,6 +1230,62 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers } + + /// + /// 生成缴费二维码 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult PayFeeQRCode(string keyValue) + { + var imgUrl = ""; + Random ran = new Random(); + string merchantid = "105000082201406"; //UAT--可用防钓鱼接口 + string posid = "043724806"; //分行代码 + string branchid = "510000000"; + string orderid = DateTime.Now.ToString("yyyyMMddhhmmss") + ran.Next(0, 100000); + string payment = "788"; + //string payment = "0.1"; + string curcode = "01"; + string txcode = "530550"; + string remark1 = "51d7ab92-1b3d-43f8-9b34-5ecc6e118804" + "-" + "2021";// bean.stuId +"-" + bean.feiYear; + string remark2 = "02!700&03!88&";// reKey; + 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); + //HttpConnect conn = new HttpConnect(); + //string reJson = conn.Post(url, ""); + JsonBean MemberInfoList = JsonConvert.DeserializeObject(reJson); + if (MemberInfoList.SUCCESS.Equals("true")) + { + string imgCode = HttpMethods.Post(MemberInfoList.PAYURL); + MemberInfoList = JsonConvert.DeserializeObject(imgCode); + if (MemberInfoList.SUCCESS.Equals("true")) + { + imgUrl = CreateQRImg(MemberInfoList.QRURL, orderid); + } + } + + return Success(imgUrl); + } #endregion #region 上传图片 @@ -1279,5 +1339,50 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers } #endregion + public class JsonBean + { + /// + /// + /// + public string SUCCESS { get; set; } + public string PAYURL { get; set; } + public string QRURL { get; set; } + } + /// + /// 生成并保存二维码图片的方法 + /// + /// 输入的内容 + public string CreateQRImg(string str, string orderId) + { + Random ran = new Random(); + Bitmap bt; + str = HttpUtility.UrlDecode(str); + string enCodeString = str; + //生成设置编码实例 + QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); + //设置二维码的规模,默认4 + qrCodeEncoder.QRCodeScale = 3; + //设置二维码的版本,默认7 + qrCodeEncoder.QRCodeVersion = 7; + //设置错误校验级别,默认中等 + qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M; + //生成二维码图片 + bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8); + //二维码图片的名称 + string filename = orderId; + //保存二维码图片在photos路径下 + try + { + bt.Save(Server.MapPath("~/Content/images/") + filename + ".jpg"); + } + catch (Exception ex) + { + + return ""; + } + + //图片控件要显示的二维码图片路径 + return "~/Content/images/" + filename + ".jpg"; + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.cshtml index 21b382ff1..ba7fa3451 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.cshtml @@ -18,21 +18,23 @@ margin-right:50px; margin-top:20px; } + .table { + text-align: center; + margin: auto; + } + .tableLeft { + width: 30%; + }
费用明细
- - @* - - - - - - *@ -
第一项100元
合计:200元
+ + +
-
确认缴费
-
取消缴费
+
支付
+
查询
+
取消
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.js index b4af7c58f..c83802f23 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeForm.js @@ -6,6 +6,7 @@ */ var acceptClick; var keyValue = request('keyValue'); +var PayFeeTotal = 0;//应交费用 var bootstrap = function ($, learun) { "use strict"; var page = { @@ -15,11 +16,33 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { - //确认缴费 + //获取缴费二维码 $('#confirmPayFee').click(function () { - learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/IsPayFee', { keyValue: keyValue, status: 1 }, function () { - learun.frameTab.currentIframe().refreshGirdData(); + if (parseFloat($('#PayMoney').html()) > PayFeeTotal) { + return learun.alert.warning("所交费用超出应交费用!"); + } + //$('.paydetail').each(function(i, item) { + // console.log('item',item); + //}); + learun.httpAsyncPost(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/PayFeeQRCode', { keyValue: keyValue }, function (res) { + learun.loading(false); + console.log(res); + $('#qrcodeImg').attr('src', res.info); + //if (res.code == learun.httpCode.success) { + // if (!!callback) { + // callback(res); + // } + // learun.alert.success(res.info); + //} + //else { + // learun.alert.error(res.info); + // learun.httpErrorLog(res.info); + //} + //layer.close(layer.index); }); + //learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/PayFeeQRCode', { keyValue: keyValue}, function () { + // learun.frameTab.currentIframe().refreshGirdData(); + //}); }); //取消缴费 $('#cancelPayFee').click(function () { @@ -28,16 +51,51 @@ var bootstrap = function ($, learun) { }); }); + //计算实交金额 + $('table').on('change', + '.paydetail', + function () { + var num = 0; + $(".paydetail").each(function (i, item) { + num += parseFloat($(this).val()); + }); + $('#PayMoney').html(num); + }); }, initData: function () { if (!!keyValue) { $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/GetPayFeeDetail?keyValue=' + keyValue, function (data) { - var html = ""; - html += '收费项目名称收费项目标准'; + var StuInfoFresh = data['StuInfoFreshData']; + var className = ""; + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: StuInfoFresh.ClassNo, + keyId: 'classno', + callback: function (_data) { + className = _data['classname']; + } + }); + var deptName = ""; + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: StuInfoFresh.DeptNo, + keyId: 'deptno', + callback: function (_data) { + deptName = _data['deptname']; + } + }); + PayFeeTotal = parseFloat(data['PayFeeTotal']); + var html = "学号" + StuInfoFresh.StuNo + ""; + html += "姓名 " + StuInfoFresh.StuName + ""; + html += "班级" + className + ""; + html += "系别" + deptName + ""; + html += '缴费项目应交费用本次实交'; $.each(data['FinaChargesStandardList'], function (i, item) { - html += '' + item.ChargeItemName + '' + item.Standard + '元'; + html += '' + item.ChargeItemName + '' + item.Standard + '元'; }); - html += '合计: ' + data['PayFeeTotal'] + '元'; + html += '合计' + data['PayFeeTotal'] + '元' + data['PayFeeTotal'] + ''; + html += '贷款金额'; + html += '已交金额'; $('#PayFeeDetail').html(html); }); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml index 54c4b777e..fae9ce86b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.cshtml @@ -25,6 +25,7 @@  同步  查看 @* 缴费*@ +  二维码缴费  线上缴费  取消线上缴费 @* 填写贷款回执码*@ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js index 7b12b1be7..2521c8593 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/PayFeeIndex.js @@ -39,6 +39,25 @@ var bootstrap = function ($, learun) { }); } }); + //二维码缴费 + $('#lr_payCode').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + selectedRow = $('#gridtable').jfGridGet('rowdata'); + if (learun.checkrow(keyValue)) { + if (selectedRow.PayFeeStatus == "1") { + learun.alert.warning("当前新生已缴费!"); + return; + } + learun.layerForm({ + id: 'form_payCode', + title: '二维码缴费', + url: top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/PayFeeForm?keyValue=' + keyValue, + width: 800, + height: 600, + btn: null + }); + } + }); // 缴费 $('#lr_payFee').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 1efd44821..bab19b580 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -265,6 +265,9 @@ ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll + + ..\packages\ThoughtWorks.QRCode.1.1.0\lib\ThoughtWorks.QRCode.dll + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/packages.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/packages.config index 7d8ffd51c..b34fd9b03 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/packages.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/packages.config @@ -75,5 +75,6 @@ + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs index 01055cb7a..70e4b6e6c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs @@ -619,6 +619,27 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [Column("BANKLOCATION")] public string BankLocation { get; set; } + + /// + /// 缴费明细 + /// + [Column("PAYFEEDETAIL")] + public string PayFeeDetail { get; set; } + /// + /// 缴费金额 + /// + [Column("PAYMONEY")] + public decimal? PayMoney { get; set; } + /// + /// 贷款金额 + /// + [Column("LOANMONEY")] + public decimal? LoanMoney { get; set; } + /// + /// 是否开票 + /// + [Column("ISINVOICE")] + public int? IsInvoice { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/.signature.p7s b/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/.signature.p7s new file mode 100644 index 000000000..5920afe5e Binary files /dev/null and b/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/.signature.p7s differ diff --git a/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/ThoughtWorks.QRCode.1.1.0.nupkg b/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/ThoughtWorks.QRCode.1.1.0.nupkg new file mode 100644 index 000000000..c7891604b Binary files /dev/null and b/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/ThoughtWorks.QRCode.1.1.0.nupkg differ diff --git a/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/lib/ThoughtWorks.QRCode.dll b/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/lib/ThoughtWorks.QRCode.dll new file mode 100644 index 000000000..45b1b5267 Binary files /dev/null and b/Learun.Framework.Ultimate V7/packages/ThoughtWorks.QRCode.1.1.0/lib/ThoughtWorks.QRCode.dll differ