protected string GetNextReturnMoneyDay(Guid userId) { string sql = @"SELECT TOP 1 Convert (VARCHAR(10),CycDate,120) AS CycDate, SUM(ISNULL(Amount,0)+ISNULL(InterestAmout,0)+ISNULL(TuandaiRedPacket,0) +ISNULL(PublisherRedPacket,0) ) AS TotalAmount FROM ( SELECT sd.CycDate, CASE WHEN sd.InvestType IN(3,2) THEN 0 ELSE sd.Amount END AS Amount, CASE WHEN sd.InvestType = 3 THEN 0 ELSE sd.InterestAmout END AS InterestAmout, CASE WHEN sd.InvestType = 3 THEN 0 ELSE ISNULL(sd.TuandaiRedPacket,0) END AS TuandaiRedPacket, CASE WHEN sd.InvestType = 3 THEN 0 ELSE ISNULL(sd.PublisherRedPacket,0) END AS PublisherRedPacket FROM dbo.SubscribeDetail sd with(nolock) WHERE isnull(sd.InvestType,0)!=1 and sd.SubscribeUserId=@UserId and sd.CycDate>getdate() union all select we.CycDate, we.Amount, we.InterestAmount,we.TuanDaiRedPacket, we.PublisherRedPacket from dbo.We_OrderDetail we where we.IsHandle=0 and we.UserId=@UserId and we.CycDate>getdate() )a GROUP BY Convert (VARCHAR(10),CycDate,120) having sum(isnull(Amount, 0) + isnull(InterestAmout, 0)+ isnull(TuandaiRedPacket, 0) + isnull(PublisherRedPacket, 0))>0 ORDER BY CycDate ASC"; var para = new Dapper.DynamicParameters(); para.Add("@UserId", userId); var item = PublicConn.QuerySingle <NextReturnMoneyDay>(sql, ref para); if (item != null) { return("<span>" + item.CycDate.ToString("yyyy-MM-dd") + "<b>" + ToolStatus.ConvertLowerMoney(item.TotalAmount) + "</b>元</span>"); } else { return("<span>无回款日</span>"); } }
//获取充值记录分页数据 public void GetRechageShowList() { int pagesize = 15; int pageindex = Tool.SafeConvert.ToInt32(HttpContext.Current.Request.Form["pageIndex"], 1); if (pageindex < 1) { pageindex = 1; } Guid userId = WebUserAuth.UserId.Value; if (userId == null || userId == Guid.Empty) { PrintJson("0", "还未登录"); return; } int status = Tool.WEBRequest.GetFormInt("status", 0); StringBuilder sb = new StringBuilder(); int totalcount = 0; ProjectBLL bll = new ProjectBLL(); IList <WXAccountRechare> list = bll.WXGetUserAccountRechare(status, userId, pagesize, pageindex, out totalcount); double divide = totalcount / pagesize; double floor = System.Math.Floor(divide); if (totalcount % pagesize != 0) { floor++; } int pageCount = Convert.ToInt32(floor);//总页数 if (list != null && list.Count() > 0) { int index = 1; sb.Append("{\"result\":\"1\",\"pagecount\":\"" + pageCount + "\",\"list\":["); foreach (WXAccountRechare temp in list) { sb.Append("{\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount) + "\",\"AddDate\":\"" + (temp.AddDate.ToString("yyyy-MM-dd HH:mm")) + "\",\"StatusStr\":\"" + GetStatusIcon(temp.Status) + "\",\"DeviceType\":\"" + GetDeviceType(temp.From ?? 1)); if (index == list.Count()) { sb.Append("\"}]}"); } else { sb.Append("\"},"); } index++; } } else { sb.Append("{\"result\":\"0\",\"pagecount\":\"0\"}"); } this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); }
//加息金额 protected string GetPlusRateMoney() { decimal plusAmount = (subscribeInfo.TuandaiRedPacket ?? 0) + (subscribeInfo.PublisherRedPacket ?? 0); if (plusAmount > 0) { return(string.Format("<span class=\"f23px c-fd6040\">+ {0}</span>", ToolStatus.ConvertLowerMoney(plusAmount))); } return(""); }
/// <summary> /// 剩余金额 /// </summary> /// <param name="model"></param> /// <returns></returns> public string GetLostMoneyString(WeProductDetailInfo model) { decimal amount = ((model.TotalQty ?? 0) - (model.OrderQty ?? 0)) * (model.UnitAmount ?? 0); if (amount > 10000) { return(ToolStatus.ConvertLowerMoney(amount / 10000) + "万"); } else { return(ToolStatus.ConvertLowerMoney(amount) + "元"); } }
protected int IsRegHasOneMonth = 1; //注册是否满一个月 protected void Page_Load(object sender, EventArgs e) { Response.Redirect("/pages/downloadGuide.aspx", true); if (!this.IsPostBack) { var userId = WebUserAuth.UserId.Value; if (userId != null && userId != Guid.Empty) { GetIsProjectFreePaidUser(userId); GetUserVipMsg(userId); var userBll = new UserBLL(); var user = userBll.GetUserBasicInfoModelById(userId); //2016.5.4号注册的加条件: 注册满1个月才能发资产标,即1个月零1天才能发资产标,一个月以内进入发标页面后弹框提示“您好,注册满一个月后才能发布资产标” if (user.AddDate >= DateTime.Parse("2016-05-04 12:00")) { IsRegHasOneMonth = user.AddDate.Value.AddMonths(1) < DateTime.Now ? 1 : 0; } this.options = new List <Tuple <int, decimal, decimal, int, string> >(); var result1 = WXInvest.CheckNetIssueConditions(userId); if (result1.Success) { var fund = userBll.GetUserFundAccountInfo(userId); var setting = WXInvest.GetJingSetting(); tuandaiFeeRate = user.Level == 1 ? setting.Param1Value.ToDecimal(0) : setting.Param2Value.ToDecimal(0); creditAmount = WXInvest.GetUserJingAvailableAmount(user, fund, setting, out maxDeadline); string text = string.Format("资产标(借款额度{0}元)", ToolStatus.ConvertLowerMoney(creditAmount)); this.options.Add(new Tuple <int, decimal, decimal, int, string>(6, creditAmount, tuandaiFeeRate, maxDeadline, text)); this.deadLineDesc = string.Format("还款期限最高{0}个月", maxDeadline); } //资产标短期标配置 WebSettingBLL setbll = new WebSettingBLL(); WebSettingInfo deadlineDay = setbll.GetWebSettingInfo("78A758ED-6D5C-4991-A804-6601E50960AD"); minDeadlineDay = Tool.SafeConvert.ToInt32(deadlineDay.Param1Value, 15); maxDeadlineDay = Tool.SafeConvert.ToInt32(deadlineDay.Param2Value, 29); endDeadlineDay = deadlineDay.Param3Value.ToDateTime(DateTime.MaxValue); //var result2 = WXInvest.CheckStockIssueConditions(userId); //if (result2.Success) //{ // var setting = WXInvest.GetStockSetting(); // var tuandaiFeeRate = user.Level == 1 ? setting.Param1Value.ToDecimal(0) : setting.Param2Value.ToDecimal(0); // var amount = user.aviCreditGrantingAmount ?? 0; // var text = string.Format("资产标-综合授信(授信额度{0}元)", ToolStatus.ConvertLowerMoney(amount)); // this.options.Add(new Tuple<int, decimal, decimal, int, string>(7, amount, tuandaiFeeRate, 24, text)); // if (!result1.Success) this.deadLineDesc = string.Format("还款期限最高{0}个月", 24); //} } } }
/// <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 GetWithDrawalShowList() { int pagesize = 15; int pageindex = Tool.SafeConvert.ToInt32(HttpContext.Current.Request.Form["pageIndex"], 1); int status = Tool.SafeConvert.ToInt32(HttpContext.Current.Request.Form["status"], -1); if (pageindex < 1) { pageindex = 1; } StringBuilder sb = new StringBuilder(); int totalcount = 0; ProjectBLL bll = new ProjectBLL(); IList <WXAppWithdrewFund> list = bll.WXGetUserWithdrewFund(WebUserAuth.UserId.Value, pagesize, pageindex, status, out totalcount); if (list != null && list.Count() > 0) { int index = 1; sb.Append("{\"result\":\"1\",\"totalcount\":\"" + totalcount + "\",\"list\":["); foreach (WXAppWithdrewFund temp in list) { sb.Append("{\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount ?? 0) + "\",\"AppDate\":\"" + (temp.AppDate.Value.ToString("yyyy-MM-dd HH:mm")) + "\",\"StatusStr\":\"" + this.GetWithdrawStatusIcon(temp.Status ?? 0)); if (index == list.Count()) { sb.Append("\"}]}"); } else { sb.Append("\"},"); } index++; } } else { sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\"}"); } this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); }
protected string GetShowAmount(SubscribeInfo item) { string strResult = ""; if (item.Amount > 0) { strResult += "+ ¥" + ToolStatus.ConvertLowerMoney(item.Amount); } if (item.InterestAmout > 0) { strResult += "+ ¥" + ToolStatus.ConvertLowerMoney(item.InterestAmout); } if (item.TuandaiRedPacket > 0 || item.PublisherRedPacket > 0) { strResult += "+ ¥" + ToolStatus.ConvertLowerMoney(item.TuandaiRedPacket + item.PublisherRedPacket); } if (strResult.Length > 0) { strResult = strResult.Substring(2); } return(strResult); }
/// <summary> /// 投资,收益 /// </summary> /// <param name="value"></param> /// <param name="type"></param> /// <returns></returns> public string GetValue(int value, string type = "0") { BillInfo Info; if (type == "1") { Info = ReturnList.FirstOrDefault(p => p.ParaValue1 == value); } else { Info = InvestList.FirstOrDefault(p => p.ParaValue1 == value); } if (Info != null) { return(ToolStatus.ConvertLowerMoney(Info.ParaValue3)); } else { return("0.00"); } }
public static string GetWePlanSurplusMoney(WeProductDetailInfo weInfo) { decimal o = (weInfo.PlanAmount ?? 0) - (weInfo.OrderQty ?? 0) * (weInfo.UnitAmount ?? 0); return(string.Format("<span>{0}</span>{1}", (o >= 10000) ? ToolStatus.ConvertWanMoney(o) : ToolStatus.ConvertLowerMoney(o), (o >= 10000) ? "万" : "元")); }
//加载转让信息 public void InitApplicationTransfer() { //TuanDB.JunTeEntities dbRead = TuanDB.JunTeEntities.Read(); Guid subscribeId = Guid.Empty; Guid.TryParse(Context.Request["id"], out subscribeId); Guid userId = WebUserAuth.UserId.Value; //TuanDB.Subscribe subscribeEntity = dbRead.Subscribe.FirstOrDefault(p => p.Id == subscribeId && p.SubscribeUserId == userId); var subscribeEntity = new SubscribeBLL().GetSubscribeById(subscribeId); if (subscribeEntity == null) { PrintJson("0", "数据异常"); return; } ProjectBLL bll = new ProjectBLL(); ProjectDetailInfo projectEntity = bll.GetProjectDetailInfo(subscribeEntity.ProjectId.Value); //Project projectEntity = dbRead.Project.FirstOrDefault(p => p.Id == subscribeEntity.ProjectId); if (projectEntity == null) { PrintJson("0", "数据异常"); return; } InitApplicationtransferInfo initApplicationtransferEntity = new InitApplicationtransferInfo(); initApplicationtransferEntity.Title = projectEntity.Title; initApplicationtransferEntity.TypeName = ToolStatus.ConvertProjectType(projectEntity.Type ?? 0); initApplicationtransferEntity.InterestRate = projectEntity.InterestRate ?? 0; initApplicationtransferEntity.RepaymentTypeName = ToolStatus.ConvertRepaymentType(projectEntity.RepaymentType ?? 0); initApplicationtransferEntity.Deadline = projectEntity.Deadline ?? 0; initApplicationtransferEntity.LowerUnit = projectEntity.LowerUnit ?? 0; initApplicationtransferEntity.SubscribeShares = subscribeEntity.SubscribeShares ?? 0; initApplicationtransferEntity.Amount = "0"; initApplicationtransferEntity.InterestAmount = "0"; //var subscribeDetailList = dbRead.SubscribeDetail.Where(p => p.SubscribeId == subscribeId); var subscribeDetailList = new SubscribeDetailBLL().GetSubscribeDetailListBySubscribeId(subscribeId); if (subscribeDetailList.Count() > 0) { initApplicationtransferEntity.Amount = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.Amount)); initApplicationtransferEntity.InterestAmount = ToolStatus.ConvertLowerMoney(subscribeDetailList.Sum(p => p.InterestAmout.Value)); } initApplicationtransferEntity.RefundedMonths = subscribeEntity.RefundedMonths ?? 0; initApplicationtransferEntity.TotalRefundMonths = subscribeEntity.TotalRefundMonths ?? 0; initApplicationtransferEntity.PreCycDate = subscribeEntity.PreCycDate.HasValue ? subscribeEntity.PreCycDate.Value.ToString("yyyy-MM-dd") : ""; string sql = string.Empty; if (projectEntity.RepaymentType == 1)//到期还本息 { sql = "SELECT dateDiff(day,@BeginDate,getdate())-1"; } else { sql = "SELECT dateDiff(day,dbo.f_GetRepaymentAdvance_Date(@BeginDate,@Month),getdate())"; } var para = new Dapper.DynamicParameters(); para.Add("@BeginDate", subscribeEntity.AddDate); para.Add("@Month", subscribeEntity.RefundedMonths); initApplicationtransferEntity.Days = PublicConn.QuerySingle <int>(sql, ref para); //using (SqlConnection connection = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString)) //{ // connection.Open(); // int day = connection.Query<int>(sql, new { BeginDate = subscribeEntity.AddDate, Month = subscribeEntity.RefundedMonths }).First(); // connection.Close(); // connection.Dispose(); // initApplicationtransferEntity.Days = day; //} initApplicationtransferEntity.result = 1; PrintJson(initApplicationtransferEntity); }
//获取债权转让列表 public void GetZQZRCanTransferList() { int pageSize = GlobalUtils.PageSize; int pageIndex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1); string pStatus = WEBRequest.GetFormString("status"); if (pageIndex < 1) { pageIndex = 1; } Guid userid = WebUserAuth.UserId.HasValue ? WebUserAuth.UserId.Value : Guid.Empty; if (userid == Guid.Empty) { PrintJson("0", "您还未登录!"); return; } int outputStatus = 0; if (pStatus == "CanTran") { #region 可转让标 int count = 0; List <NegotiableInfo> list = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetNegotiableList(userid, 3, pageIndex, pageSize, out outputStatus, out count); List <NegotiableInfoExt> dataList = new List <NegotiableInfoExt>(); if (outputStatus == -1) { PrintJson("0", "有发净股标或者逾期垫付未还"); } else { foreach (NegotiableInfo item in list) { NegotiableInfoExt extItem = new NegotiableInfoExt(); extItem.ProjectId = item.ProjectId; extItem.Id = item.Id; extItem.Title = item.Title; extItem.TotalRefundMonths = item.TotalRefundMonths; extItem.RefundedMonths = item.RefundedMonths; extItem.TypeName = ToolStatus.ConvertProjectType(item.Type); extItem.DueInAmount = ToolStatus.ConvertLowerMoney(item.Amount + item.InterestAmout); extItem.PreCycDateStr = item.PreCycDate.ToString("yyyy-MM-dd"); extItem.TenderModeName = GetTenderMode(item.TenderMode); extItem.InterestRate = ToolStatus.DeleteZero(item.InterestRate); extItem.RepaymentType = ToolStatus.ConvertRepaymentType(item.RepaymentType); dataList.Add(extItem); } } if (count == 0) { PrintJson("0", "没有找到数据"); return; } int pageCount = GetPageCount(count, pageSize); var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList }; PrintJson(objData); #endregion } else if (pStatus == "Traning") { #region 转让中 int transferCount = 0; List <SubScribeTransferInfo> tempList = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetSubScribeTransferList(userid, 1, pageSize, pageIndex, out transferCount); if (transferCount == 0) { PrintJson("0", "没有找到数据"); return; } int pageCount = GetPageCount(transferCount, pageSize); List <SubScribeTransferInfoExt> dataList = new List <SubScribeTransferInfoExt>(); foreach (SubScribeTransferInfo item in tempList) { SubScribeTransferInfoExt extItem = new SubScribeTransferInfoExt(); extItem.ProjectId = item.ProjectId; extItem.Id = item.Id; extItem.Title = item.Title; extItem.SumTransferAmount = ToolStatus.ConvertLowerMoney(item.sumTransferAmount); extItem.ProgressStr = Convert.ToDouble(item.Progress).ToString("f1"); extItem.LastTimeStr = item.remainTime; extItem.AddDate = item.AddDate; extItem.TotalAmountStr = ToolStatus.ConvertLowerMoney(item.TotalAmount); DateTime EndTransferDate = DateTime.Parse(item.AddDate.ToString("yyyy-MM-dd") + " 23:59:59"); if (DateTime.Now > EndTransferDate) { extItem.LastSecond = 0; } else { extItem.LastSecond = Convert.ToInt32((EndTransferDate - DateTime.Now).TotalSeconds); } dataList.Add(extItem); } var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList }; PrintJson(objData); #endregion } else { #region 已完成 int transferCount = 0; List <SubScribeTransferInfo> tempList = new TuanDai.PortalSystem.BLL.SubScriberansferBLL().GetSubScribeTransferList(userid, 2, pageSize, pageIndex, out transferCount); if (transferCount == 0) { PrintJson("0", "没有找到数据"); return; } int pageCount = GetPageCount(transferCount, pageSize); List <SubScribeTransferInfoExt> dataList = new List <SubScribeTransferInfoExt>(); foreach (SubScribeTransferInfo item in tempList) { SubScribeTransferInfoExt extItem = new SubScribeTransferInfoExt(); extItem.ProjectId = item.ProjectId; extItem.Id = item.Id; extItem.Title = item.Title; extItem.SumTransferAmount = ToolStatus.ConvertLowerMoney(item.sumTransferAmount); extItem.ProgressStr = Convert.ToDouble(item.Progress).ToString("f1"); dataList.Add(extItem); } var objData = new { result = "1", msg = "", pageCount = pageCount, list = dataList }; PrintJson(objData); #endregion } }
//获取转让详情数据 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(); }
public static string GetProjectSurplusMoney(WXProjectListInfo project) { decimal num = ((project.TotalShares ?? 0) - (project.CastedShares ?? 0)) * project.LowerUnit; return(string.Format("<span>{0}</span>{1}", (num >= 10000) ? ToolStatus.ConvertWanMoney(num) : ToolStatus.ConvertLowerMoney(num), (num >= 10000) ? "万" : "元")); }
protected string GetProjectSurplusMoney(WXProjectListInfo itemInfo) { decimal amount = ((itemInfo.TotalShares ?? 0) - (itemInfo.CastedShares ?? 0)) * itemInfo.LowerUnit; return(string.Format("<span>{0}</span>{1}", (amount >= 10000) ? ToolStatus.ConvertWanMoney(amount) : ToolStatus.ConvertLowerMoney(amount), (amount >= 10000) ? "万" : "元")); }
protected string GetProjectSurplusMoney(WXProjectListInfo project) { decimal num = ((project.TotalShares ?? 0) - (project.CastedShares ?? 0)) * project.LowerUnit; return(string.Format("<span class=\"c-212121 f13px\">{0}{1}</span>", (num >= 10000) ? ToolStatus.ConvertWanMoney(num) : ToolStatus.ConvertLowerMoney(num), (num >= 10000) ? "万" : "元")); }
protected string GetWePlanSurplusMoney(WeProductDetailInfo weInfo) { decimal o = (weInfo.PlanAmount ?? 0) - (weInfo.OrderQty ?? 0) * (weInfo.UnitAmount ?? 0); return(string.Format("<span class=\"c-212121 f13px\">{0}{1}</span>", (o >= 10000) ? ToolStatus.ConvertWanMoney(o) : ToolStatus.ConvertLowerMoney(o), (o >= 10000) ? "万" : "元")); }
protected string GetPreInterest() { return(ToolStatus.ConvertLowerMoney(model.JoinAmount * model.YearRate * model.Deadline * decimal.Parse("0.01") / 12)); }
//获取提现记录分页数据 public void GetSubscribeUserList() { int pagesize = 15; int pageindex = Tool.SafeConvert.ToInt32(HttpContext.Current.Request.Form["pageIndex"], 1); if (pageindex < 1) { pageindex = 1; } Guid projectId = Tool.SafeHttpWebRequest.GetFormGuid("projectid", Guid.Empty); string projecttype = Tool.WEBRequest.GetString("projecttype"); StringBuilder sb = new StringBuilder(); int totalcount = 0; WeOrderBLL webll = new WeOrderBLL(); List <TuanDai.WXApiWeb.Common.WXSubscribeRecord_Bak> subList = null; //当为We计划时 if (projecttype.ToLower() == "weplan") { totalcount = GetOrderCount(projectId); } else if (projecttype.ToLower() == "zqzr") { //债权转让 totalcount = GetZQZRSubscribeListCount(projectId); } else { subList = TuanDai.WXApiWeb.Common.WXInvest.WXGetSubscribeList(projectId, pagesize, pageindex, out totalcount); } if (totalcount > 0) { int index = 1; sb.Append("{\"result\":\"1\",\"totalcount\":\"" + totalcount + "\",\"list\":["); if (projecttype.ToLower() == "weplan") { #region We计划处理 List <WeOrderInfo> welist = GetOrderList(projectId, pageindex, pagesize); foreach (WeOrderInfo temp in welist) { string tenderMode = TuanDai.WXApiWeb.pages.invest.SubscribeUser.GetWeTenderName(temp.DeviceType); if (index == welist.Count()) { sb.Append("{\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount ?? 0) + "\",\"AddDate\":\"" + (temp.OrderDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) + "\",\"NickName\":\"" + (temp.TelNo == null ? TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringName(temp.UserName) : TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringTelNo(temp.TelNo)) + "\",\"OrderType\":\"" + tenderMode + "\",\"IsAuto\":\"False\"}]}"); } else { sb.Append("{\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount ?? 0) + "\",\"AddDate\":\"" + (temp.OrderDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) + "\",\"NickName\":\"" + (temp.TelNo == null ? TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringName(temp.UserName) : TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringTelNo(temp.TelNo)) + "\",\"OrderType\":\"" + tenderMode + "\",\"IsAuto\":\"False\"},"); } index++; } #endregion } else if (projecttype.ToLower() == "zqzr") { #region List <SubscribeUserInfo> zqSubList = GetZQZRSubscribelist(projectId, pagesize, pageindex); foreach (SubscribeUserInfo temp in zqSubList) { sb.Append("{\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount) + "\",\"AddDate\":\"" + (temp.OrderDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) + "\",\"NickName\":\"" + (temp.NickName == null ? TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringName(temp.UserName) : TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringTelNo(temp.NickName)) + "\",\"OrderType\":\"" + temp.OrderType + "\",\"IsAuto\":\"" + temp.IsAuto); if (index == zqSubList.Count()) { sb.Append("\"}]}"); } else { sb.Append("\"},"); } index++; } #endregion } else { #region //一般的标 foreach (TuanDai.WXApiWeb.Common.WXSubscribeRecord_Bak temp in subList) { string orderType = TuanDai.WXApiWeb.pages.invest.SubscribeUser.GetProjectTenderName(temp.TenderMode); sb.Append("{\"Amount\":\"" + ToolStatus.ConvertLowerMoney(temp.Amount ?? 0) + "\",\"AddDate\":\"" + (temp.AddDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) + "\",\"NickName\":\"" + (temp.NickName == null ? TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringName(temp.UserName) : TuanDai.WXApiWeb.pages.invest.SubscribeUser.SubStringTelNo(temp.NickName)) + "\",\"OrderType\":\"" + orderType + "\",\"IsAuto\":\"" + temp.IsAuto); if (index == subList.Count()) { sb.Append("\"}]}"); } else { sb.Append("\"},"); } index++; } #endregion } } else { sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\"}"); } this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); }
/// <summary> /// 收益统计 /// </summary> protected void GetProfitStatistics(Guid userId) { string sqlText = @"SELECT SUM(A1) AS dueAmount,SUM(A2) AS recAmount,SUM(A3) AS overDueAmount,SUM(A4) AS prizeAmount FROM ( SELECT ISNULL(a.InterestAmout,0)+ISNULL(a.TuandaiRedPacket,0)+ISNULL(a.PublisherRedPacket,0) A1,0 AS A2,0 AS A3,0 AS A4 FROM SubscribeDetail a WITH(NOLOCK) left join SubscribeExtend b with(nolock) on b.SubscribeId=a.SubscribeId WHERE a.SubscribeUserId=@UserId UNION ALL SELECT 0 AS A1,0 A2 , case when s.isvip = 1 then ISNULL(SUM(ISNULL(B.OverDueInterest,0)),0)+ISNULL(SUM(ISNULL(B.PenaltyAmount,0)),0)/3*2 when s.isvip = 0 then ISNULL(SUM(ISNULL(B.OverDueInterest,0)),0) else 0 end A3,0 AS A4 FROM OverDueRecord B WITH(NOLOCK) join Subscribe s with(nolock) on b.SubscribeId = s.Id left join SubscribeExtend ex with(nolock) on ex.SubscribeId=s.Id WHERE s.SubscribeUserId=@UserId AND B.IsBorrow=1 and isnull(ex.IsFTB,0)!=1 GROUP BY s.IsVip UNION ALL SELECT 0 AS A1,ISNULL(RealInterestAmout,0)+ISNULL(TuandaiRedPacket,0)+ISNULL(PublisherRedPacket,0)-ISNULL(InvestCommission,0) A2,0 AS A3,0 AS A4 FROM SubscribeDetailHistory_h1 a WITH(NOLOCK) left join SubscribeExtend ex with(nolock) on ex.SubscribeId=a.SubscribeId WHERE isnull(ex.IsFTB,0)!=1 and NOT EXISTS (SELECT b.SubscribeId,b.periods FROM dbo.OverDueRecord b WITH(NOLOCK) WHERE b.SubscribeId = a.SubscribeId AND b.periods = a.Periods AND b.SubscribeUserId=@UserID AND b.IsBorrow=0 ) AND a.SubscribeUserId=@UserId UNION ALL SELECT 0 AS A1,0 AS A2,0 AS A3,ISNULL(SUM(ISNULL(PrizeValue,0)),0) AS A4 FROM UserPrize WITH(NOLOCK) WHERE (TypeId IN (4,11,13,14) AND IsReceive=1 and ReceiveDate>=@usePrizeDate or TypeId=3 and IsUsed=1 and UseDate>=@usePrizeDate )AND UserId=@UserID UNION ALL SELECT isnull(DueComeInterest,0) as A1,isnull(NetEarningsInterest,0) + isnull(TuanDaiRedPacket,0) AS A2,0 AS A3, 0 AS A4 FROM We_FundAccountInfo a WITH(NOLOCK) where UserId=@UserId ) T"; DynamicParameters dyParams = new DynamicParameters(); dyParams.Add("@UserId", userId); if (IsExistsInDBHistory(DateTime.Parse(DateTime.Today.AddMonths(-2).ToString("yyyy-MM-01")), DateTime.Parse(DateTime.Today.AddMonths(-1).ToString("yyyy-MM-01")).AddSeconds(-1), userId)) { dyParams.Add("@usePrizeDate", DateTime.Today.AddMonths(-1).ToString("yyyy-MM-01")); } else { dyParams.Add("@usePrizeDate", DateTime.Today.AddMonths(-2).ToString("yyyy-MM-01")); } dyParams.Add("@extenderMoney", 0, DbType.Decimal, ParameterDirection.Output, 18, null, 2); profitmodel = PublicConn.QuerySingle <ProfitStatistics>(sqlText, ref dyParams); if (profitmodel == null) { profitmodel = new ProfitStatistics(); } string rsql = @"SELECT ISNULL(SUM(EarnMoney),0) FROM dbo.ExtendEarnRecord WITH(NOLOCK) WHERE UserID =@UserID and HandleStatus = 1"; profitmodel.extenderMoney = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <decimal>(TdConfig.ApplicationName, TdConfig.DBReportWrite, rsql, ref dyParams); NetEarningsInterest = decimal.Parse(ToolStatus.ConvertLowerMoney(profitmodel.recAmount)); DueComeInterest = decimal.Parse(ToolStatus.ConvertLowerMoney(profitmodel.dueAmount)); //从历史库中查询红包金额 string sqlText2 = @"SELECT ISNULL(SUM(ISNULL(PrizeValue,0)),0) FROM UserPrize WITH(NOLOCK) WHERE (TypeId IN (4,11,13,14) AND IsReceive=1 or TypeId=3 and IsUsed=1) AND UserId=@UserID "; dyParams = new DynamicParameters(); dyParams.Add("@UserId", userId); decimal dHistoryPrizeValue = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <decimal>(TdConfig.ApplicationName, TdConfig.DBHistoryRead, sqlText2, ref dyParams); profitmodel.prizeAmount += dHistoryPrizeValue; }