/// <summary> /// 获取的支付结果 /// </summary> protected void GetPayResult() { //HttpContext.Current.Response.ContentType = "application/octet-stream"; //HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("UTF-8"); //byte[] reqData = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.TotalBytes); //string jsonText = Encoding.Default.GetString(reqData); /* * BSId String 业务系统流水号 * Price String 支付的金额 * PayOrderNumber String 支付单号码(支付系统唯一标识) * OnlinePaymnetId String 在线支付标识 * PaymentId String 支付系统流水号 * Success String 成功则为:Success,失败不会通知 */ try { #region 取值 string BSId = DNTRequest.GetString("BSId"); string Price = DNTRequest.GetString("Price"); string PayOrderNumber = DNTRequest.GetString("PayOrderNumber"); string OnlinePaymnetId = DNTRequest.GetString("OnlinePaymnetId"); string PaymentId = DNTRequest.GetString("PaymentId"); string Success = DNTRequest.GetString("Success"); int orderApplyId = 0; int orderRebateId = 0; string insureNum = DNTRequest.GetString("insureNum"); StringBuilder where = new StringBuilder(); DataSet ds = null; DataTable dt = null; if (!string.IsNullOrEmpty(insureNum)) { OrderApplyBLL opOrderApplyBLL = new OrderApplyBLL(); OrderApply modelOrderApply = new OrderApply(); where.AppendFormat("insurenum='{0}'", insureNum); ds = new DataSet(); ds = opOrderApplyBLL.GetList(where.ToString()); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } } #endregion #region 支付结果更新 if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; orderApplyId = ComPage.SafeToInt(dr["OrderApplyID"]); #region 更新订单返利信息 OrderRebateBLL opSys_OrderRebate = new OrderRebateBLL(); OrderRebate modelSys_OrderRebate = new OrderRebate(); where = new StringBuilder(); where.AppendFormat("OrderApplyId={0}", orderApplyId); ds = new DataSet(); ds = opSys_OrderRebate.GetList(where.ToString()); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { modelSys_OrderRebate = opSys_OrderRebate.DataRowToModel(dt.Rows[0]); if (modelSys_OrderRebate != null) { litPrice.Text = modelSys_OrderRebate.OrderMoney.ToString("N2") + "元"; modelSys_OrderRebate.PayStatus = 1; orderRebateId = modelSys_OrderRebate.OrderRebateId; opSys_OrderRebate.Update(modelSys_OrderRebate); } } } #endregion #region 更新订单支付申请 if (orderRebateId > 0) { OrderPayApplyBLL opSys_OrderPayApplyBLL = new OrderPayApplyBLL(); OrderPayApply modelSys_OrderPayApply = new OrderPayApply(); where = new StringBuilder(); where.AppendFormat("OrderRebateId={0}", orderRebateId); ds = new DataSet(); ds = opSys_OrderPayApplyBLL.GetList(where.ToString()); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { modelSys_OrderPayApply = opSys_OrderPayApplyBLL.DataRowToModel(dt.Rows[0]); if (modelSys_OrderPayApply != null) { modelSys_OrderPayApply.PayOrderNumber = PayOrderNumber; modelSys_OrderPayApply.PayStatus = 1; modelSys_OrderPayApply.PayPlatform = 1; modelSys_OrderPayApply.PayMethod = 1; modelSys_OrderPayApply.PayCode = Success; string payMethod = "支付宝"; switch (modelSys_OrderPayApply.PayMethod) { case 1: payMethod = "支付宝"; break; } litPayMethod.Text = payMethod; litRemark.Text = modelSys_OrderPayApply.Remark; modelSys_OrderPayApply.PayDate = DateTime.Now; opSys_OrderPayApplyBLL.Update(modelSys_OrderPayApply); } } } } #endregion } else { litSuccess.Text = "未获取到支付信息"; } #endregion #region 显示到页面 litBSId.Text = insureNum; //litPayOrderNumber.Text = PayOrderNumber; litSuccess.Text = "支付成功"; #endregion #region 记录通知结果 var obj = new { BSId = BSId, Price = Price, PayOrderNumber = PayOrderNumber, OnlinePaymnetId = OnlinePaymnetId, PaymentId = PaymentId, Success = Success, }; string res = Newtonsoft.Json.JsonConvert.SerializeObject(obj); //ExceptionLogBLL.WriteExceptionLogToDB("支付通知:" + res); #endregion } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB("支付结果通知异常:" + ex.ToString()); } }
/// <summary> /// 获取分利列表 /// </summary> static public Object GetOrderRebateList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and ort.IsDeleted=0 "); DepartmentInfo df = new DepartmentInfo(); DepartmentInfoBLL bll = new DepartmentInfoBLL(); df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID); if (ComPage.CurrentAdmin.UserType != 1) { if ((df == null) || (df != null && df.IsReceiveBusiness != false)) { //where.Append(" AND moa.UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); where.Append(" AND moa.UserID IN(SELECT ID from[BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); } } #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string val = DNTRequest.GetString("searchValue"); if (string.IsNullOrEmpty(val)) { val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue"); val = System.Web.HttpContext.Current.Server.UrlDecode(val); } if (!string.IsNullOrEmpty(val)) { where.AppendFormat(" and (moa.InsureNum like'" + val + "%' or ort.TransNo like'" + val + "%') ", val); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; OrderRebateBLL orderRebatebll = new OrderRebateBLL(); DataTable dt = orderRebatebll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }