public void AddGPMargin() { Guid projectId = WEBRequest.GetFormGuid("ProjectId"); decimal amount = Decimal.Parse(WEBRequest.GetFormString("Amount")); string payPwd = WEBRequest.GetFormString("PayPwd"); Guid userId = WebUserAuth.UserId.Value; if (userId == null) { this.PrintJson("-3", "对不起,您还未登录!"); return; } ProjectBLL bll = new ProjectBLL(); string strResult = bll.WXGPAddMargin(userId, projectId, payPwd, amount); if (strResult.ToText() == "") { this.PrintJson("1", "补仓成功!"); return; } else { this.PrintJson("0", strResult); } }
/// <summary> /// We计划分期宝取消赎回 /// </summary> public void CancleWeFqbTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } int status = 0; TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL(); webll.RevokeWeFqbRansom(weOrderId, out status); if (status == 1) { PrintJson("1", "撤销转让成功"); } else { string errMsg = ""; switch (status) { case 0: errMsg = "系统异常"; break; case 2: errMsg = "不在赎回状态"; break; case 3: errMsg = "不是We计划分期宝"; break; case 4: errMsg = "债权已有人承接,不能撤销"; break; } PrintJson("0", errMsg); } }
public void PrepaymentSubmit() { Guid projectId = WEBRequest.GetFormGuid("ProjectId"); string payPwd = WEBRequest.GetFormString("TranPwd"); Guid userId = WebUserAuth.UserId.Value; if (userId == null || userId == Guid.Empty) { this.PrintJson("-3", "对不起,您还未登录!"); return; } if (GlobalUtils.IsOpenCGT) { TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney(); reqMode.UserId = userId.ToString(); List <Guid> listProject = new List <Guid>(); listProject.Add(projectId); reqMode.ProjectIds = listProject; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.Prepayment); PrintJson("8888", url); } else { ProjectBLL bll = new ProjectBLL(); string errorMsg = bll.PrepaymentSubmit(projectId, userId, payPwd); if (errorMsg != "") { this.PrintJson("-2", errorMsg); return; } //TuanDai.WXApiWeb.Common.SubscribeMsgHelper msghelper = new Common.SubscribeMsgHelper(); //推送提前还款信息到App //msghelper.AsyncSubscribeUserToMsg(projectId); //向所有投资者发送短信通知用户提前还款 //msghelper.SyncSendPhoneMsgToSubcribeUsers(projectId); SyncSendPhoneMsgToSubcribeUsers(projectId); SysLogHelper.WriteTraceLog("提前还款", "用户Id:" + userId.ToText() + " ProjectId:" + projectId.ToText()); this.PrintJson("1", ""); return; } }
/// <summary> /// 获取We计划分期宝的投资列表 /// </summary> public void GetWeFQBProjectList() { int pageindex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1); if (pageindex < 1) { pageindex = 1; } Guid userid = WebUserAuth.UserId.Value; Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); StringBuilder sb = new StringBuilder(); WeOrderBLL webll = new WeOrderBLL(); int totalCount = 0; int pagesize = 10; List <SubMyInvestWeDetail_Info> dataList = webll.GetMyInvestWeFQBList(userid, weOrderId, pageindex, pagesize, out totalCount); int pageCount = GetPageCount(totalCount, pagesize); if (dataList.Count() > 0) { int index = 1; sb.Append("{\"result\":\"1\",\"pageCount\":\"" + pageCount + "\",\"list\":["); foreach (SubMyInvestWeDetail_Info model in dataList) { string Title = model.Title.Length > 20 ? model.Title.Substring(0, 20) + "..." : model.Title; sb.Append("{\"Title\":\"" + Title + "\",\"Amount\":\"" + ToolStatus.ConvertLowerMoney(model.Amount) + "\",\"SubscribeId\":\"" + model.InvestId + "\",\"Type\":\"" + model.Type + "\",\"ProjectId\":\"" + model.ProjectId + "\",\"StatusDesc\":\"" + GetWeProjectStatusDesc(model) + "\",\"TotalRecord\":\"" + model.TotalRecord + "\",\"AddDate\":\"" + model.AddDate.ToString("yyyy-MM-dd HH:mm") + "\",\"RemarkMode\":\"" + GetRemarkMode(model.TenderMode, model.IsFromTran ? 1 : 0) + (index == dataList.Count() ? "\"}]}" : "\"},")); index++; } } else { sb.Append("{\"result\":\"0\",\"pageCount\":\"" + pageCount + "\"}"); } this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); }
//获取转让详情数据 public void GetZQZRTransferRecord() { int pageSize = 8; int pageIndex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1); Guid transferId = WEBRequest.GetFormGuid("transferId"); Guid userid = WebUserAuth.UserId.HasValue ? WebUserAuth.UserId.Value : Guid.Empty; if (userid == Guid.Empty) { PrintJson("0", "您还未登录!"); return; } SubscribeBLL bll = new SubscribeBLL(); int recordCount = 0; int index = 1; TransferRecord mTransferRecord = bll.GetTransferRecord(transferId, pageIndex, pageSize, out recordCount); StringBuilder sb = new StringBuilder(); sb.Append("{\"result\":\"1\",\"list\":["); foreach (var temp in mTransferRecord.listTranster) { sb.Append("{\"NickName\":\"" + BusinessDll.StringHandler.MaskStartPre(temp.UserName, 1) + "\",\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount) + "\",\"TotalShares\":\"" + temp.TotalShares + "\",\"ContractNo\":\"" + temp.ContractNo ); if (index == mTransferRecord.listTranster.Count()) { sb.Append("\"}]}"); } else { sb.Append("\"},"); } index++; } this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); }
/// <summary> /// 判断转让的债权是否有承接 /// </summary> public void CheckTransferHasJoin() { Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } string strSQL = "SELECT COUNT(1) AS cnt from dbo.Subscribe with(nolock) WHERE WeOrderId=@WeOrderId AND TransferedShares>0"; Dapper.DynamicParameters dyParams = new Dapper.DynamicParameters(); dyParams.Add("@WeOrderId", weOrderId); int count = TuanDai.DB.TuanDaiDB.Query <int>(TdConfig.DBRead, strSQL, ref dyParams).FirstOrDefault(); if (count <= 0) { PrintJson("1", "未承接"); } else { PrintJson("0", "已被承接"); } }
public void ApplyFTBTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } if ((model.uStatus ?? 0) != 1) { PrintJson("-10", "用户已被冻结"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } decimal applyAmount = WEBRequest.GetFormString("ApplyAmount").ToDecimal(0); if (applyAmount <= 0) { PrintJson("-1", "申请的退出本金必须大于0"); } if (applyAmount % 1 != 0) { PrintJson("-1", "请输入大于0的整数金额"); } if (GlobalUtils.IsOpenCGT) { var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyFTBTransferRequest { WeOrderId = weOrderId, TransferAmount = applyAmount }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.FTBPreExit); PrintJson("8888", url); } else { //验证交易密码 var bll = new UserSettingBLL(); var usersetting = bll.GetUserSettingInfo(userid); if (usersetting != null) { #region if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]); if (PayPwd != model.PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount == 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } else { PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会"); } } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; bll.UpdateUserSettingInfo(usersetting); } #endregion } int status = 0; string strError = ""; TuanDai.PortalSystem.BLL.WeFTBBLL webll = new TuanDai.PortalSystem.BLL.WeFTBBLL(); webll.ApplyFTBRansom(weOrderId, applyAmount, out status, out strError); PrintJson(status.ToString(), strError); } }
/// <summary> /// We计划分期宝申请赎回 /// </summary> public void ApplyWeFqbTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } if ((model.uStatus ?? 0) != 1) { PrintJson("-10", "用户已被冻结"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } if (GlobalUtils.IsOpenCGT) { var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyWeFQBTransferRequest { WeOrderId = weOrderId }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.WeFqbPreExit); PrintJson("8888", url); } else { //验证交易密码 var bll = new UserSettingBLL(); var usersetting = bll.GetUserSettingInfo(userid); if (usersetting != null) { if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]); if (PayPwd != model.PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount == 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } else { PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会"); } } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); } } int status = 0; TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL(); webll.ApplyWeFqbRansom(weOrderId, out status); if (status == 1) { PrintJson("1", "申请转让成功"); } else { string errMsg = ""; switch (status) { case 0: errMsg = "系统异常"; break; case 2: errMsg = "不是We计划分期宝"; break; case 3: errMsg = "回款中状态不允许赎回"; break; case 4: errMsg = "持有时间必须超过3个月"; break; case 5: errMsg = "只有投标中的We计划才能转让"; break; } PrintJson("0", errMsg); } } }