protected FundAccountInfo_Zx ZxFundModelFromDq; //定期库统计智享数据 protected void Page_Load(object sender, EventArgs e) { if (!WebUserAuth.IsAuthenticated) { Response.Redirect("//passport.tuandai.com/2login?ret=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl)); return; } var xiajia = new WebSettingBLL().GetWebSettingInfo("D3E0C6CC-30A0-4E5B-8A83-446269F8C96F"); if (xiajia == null) { xiajia = new WebSettingInfo(); xiajia.Param1Value = "2018-04-17"; } var userId = WebUserAuth.UserId.Value; var userModel = new UserBLL().GetUserBasicInfoModelById(userId); if ((GetDQDueInMoney(userId) <= 0 && new GlobalUtils().GetNewVipUserInfo(userId).Level < 5) || userModel.AddDate >= DateTime.Parse(xiajia.Param1Value)) { Response.Redirect("/Member/My_account.aspx"); } DqFundModel = GetDQFundModel(userId); if (DqFundModel == null) { DqFundModel = new WXFundStatistModel(); } if (DqFundModel.DueComeInterest >= decimal.Parse("-0.03") && DqFundModel.DueComeInterest < 0) { DqFundModel.DueComeInterest = 0; } GetZxFundModelFromDQ(userId); }
/// <summary> /// 获取定期理财的数据 /// </summary> /// <param name="userId"></param> /// <returns></returns> protected WXFundStatistModel GetDQFundModel(Guid userId) { //return WXFundClient.GetFundStatistData(userId); string strSQL = @"select isnull(AviMoney,0) as AviMoney,isnull(DueInPAndI,0) as DueInPAndI, isnull(AviMoney,0)+isnull(DueInPAndI,0)+isnull(DueConfirmWithdrawDeposit,0)+isnull(RewardMoney,0)+isnull(FreezeAcount,0)+isnull(BorrowerOut,0)+isnull(WithdrawDepositProgress,0) as TotalAmount, isnull(DueComeInterest,0) as DueComeInterest,isnull(FreezeAcount,0) as FreezeAcount, isnull(TotalInvest,0) as TotalInvest, isnull(TotalBorrow,0) as TotalBorrow, isnull(BorrowerOut,0)+isnull(DueConfirmWithdrawDeposit,0)+isnull(WithdrawDepositProgress,0) as OnWayAmount,isnull(TotalWithdrawDepositHandRecharge,0) as WithdrawFee, isnull(TotalRecharge,0) as TotalRecharge,isnull(TotalWithdrawDeposit,0) as TotalWithDrawal,isnull(TotalPenaltyOfInvest,0) as TotalPenaltyOfInvest from FundAccountInfo with(nolock) where UserId=@userId"; DynamicParameters dyParams = new DynamicParameters(); dyParams.Add("@userId", userId); WXFundStatistModel fundInfo = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <WXFundStatistModel>(TdConfig.ApplicationName, "/BD/dqread", strSQL, ref dyParams); if (fundInfo == null) { fundInfo = new WXFundStatistModel(); } //decimal waitWeAmount = GetWePlanWaitInvestment(userId); fundInfo.FreezeAcount += 0; fundInfo.TotalAmount = fundInfo.TotalAmount + 0; //累计已收收益 strSQL = @" SELECT SUM(recAmount) recAmount FROM ( SELECT SUM(ISNULL(RealInterestAmout,0)+ISNULL(TuandaiRedPacket,0)+ISNULL(PublisherRedPacket,0)-ISNULL(InvestCommission,0)) recAmount FROM SubscribeDetailHistory_h1 a WITH(NOLOCK) WHERE a.SubscribeUserId=@UserID 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) ) T"; dyParams = new DynamicParameters(); dyParams.Add("@UserID", userId); decimal recAmount = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <decimal?>(TdConfig.ApplicationName, "/BD/dqread", strSQL, ref dyParams) ?? 0; fundInfo.TotaltEarnInterest = recAmount; string sql = @"select sum(isnull(a3,0)) from ( SELECT 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 FROM OverDueRecord B WITH(NOLOCK) join Subscribe s with(nolock) on b.SubscribeId = s.Id WHERE s.SubscribeUserId=@UserId AND B.IsBorrow=1 AND isnull(b.isHide,0)=0 GROUP BY s.IsVip )a"; var para = new DynamicParameters(); para.Add("@UserId", userId); fundInfo.TotalPenaltyOfInvest = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <decimal?>(TdConfig.ApplicationName, "/BD/dqread", sql, ref para) ?? 0; return(fundInfo); }
protected void LoadData() { Guid userId = WebUserAuth.UserId.Value; if (Request.QueryString["uid"] != null) { userId = Guid.Parse(Request.QueryString["uid"]); } TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL(); userModel = bll.GetUserBasicInfoModelById(userId); if (userModel == null) { Response.Redirect("//passport.tuandai.com/2login?ret=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl)); return; } userRegDate = userModel.AddDate.Value; GetProfitStatistics(userId); GetAccountInfo(userId); DqFundModel = GetDQFundModel(userId); ZxFundModel = new TuanDai.ZXSystem.BLL.FundStatisticsBLL().GetFundStatisticsInfoByUserId(userId); if (ZxFundModel == null) { ZxFundModel = new FundStatisticsInfo(); } GetZxFundModelFromDQ(userId); if (DqFundModel == null) { DqFundModel = new WXFundStatistModel(); } if (DqFundModel.DueComeInterest >= decimal.Parse("-0.03") && DqFundModel.DueComeInterest < 0) { DqFundModel.DueComeInterest = 0; } JoinTDDay = Tool.DateHelper.GetDateDiffDay(DateTime.Parse(userModel.AddDate.Value.ToString("yyyy-MM-dd")), DateTime.Today.AddDays(1)); if (JoinTDDay <= 0) { JoinTDDay = 1; } totalPayAmount = (fundAccountInfo.NetPayOutInterest ?? 0) + (fundAccountInfo.TotalPayOutMember ?? 0) + (fundAccountInfo.TotalWithdrawDepositHandRecharge ?? 0) + (fundAccountInfo.TotalInvestCommission ?? 0) + (fundAccountInfo.BorrowCommission ?? 0) + (fundAccountInfo.DuePayOutInterest ?? 0); //GetTotalWithDrawal(); TotalWithDrawal = fundAccountInfo.TotalWithdrawDeposit ?? 0; }