示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!GlobalUtils.IsShowZxToInvestor(UserId) && new GlobalUtils().GetNewVipUserInfo(UserId).Level < 3)
            {
                Response.Redirect("/Member/my_account.aspx");
                return;
            }

            SubscribeId = WEBRequest.GetGuid("SubscribeId", "");
            ProjectId   = WEBRequest.GetGuid("ProjectId", "");
            tab         = WEBRequest.GetQueryString("tab");
            if (!IsPostBack)
            {
                string postUrl = GlobalUtils.SubApiUrl;
                if (GlobalUtils.IsOpenSubscribeApi)
                {
                    //从聚合拿数据
                    string err      = "";
                    string response = TuanDai.HttpClient.HttpUtil.HttpGet(TdConfig.ApplicationName,
                                                                          postUrl + "/app/APPGetProjecInfo?id=" + ProjectId, "", out err, null, 3);
                    if (!string.IsNullOrEmpty(response) && string.IsNullOrEmpty(err))
                    {
                        ResponsePublicModel <List <ProjectDetailInfo> > pmodel =
                            JsonConvert.DeserializeObject <ResponsePublicModel <List <ProjectDetailInfo> > >(response);
                        if (pmodel != null && pmodel.data != null)
                        {
                            projectInfo = pmodel.data.FirstOrDefault();
                        }
                    }
                    else
                    {
                        TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName,
                                                                        "/app/APPGetProjecInfo", "ProjectId:" + ProjectId, err);
                    }
                    if (projectInfo == null)
                    {
                        //如果项目表信息为空,去智享库查一遍
                        projectInfo = JsonConvert.DeserializeObject <ProjectDetailInfo>(JsonConvert.SerializeObject(new ZXProjectBLL().GetProjectDetailInfo(ProjectId)));
                    }
                }
                else
                {
                    projectInfo = projectBll.GetProjectDetailInfo(ProjectId);
                }

                if (projectInfo == null)
                {
                    projectInfo = new ProjectDetailInfo();
                }
                if (projectInfo.Type == 18)
                {
                    //私募宝
                    ProjectSMBLL projectSmbll = new ProjectSMBLL();
                    projectSmb   = projectSmbll.GetProjectSMModel(projectInfo.Id);
                    simubaoCurve = projectBll.GetSimubaoCurve(UserId, SubscribeId);
                }


                //从聚合拿数据
                if (GlobalUtils.IsOpenSubscribeApi)
                {
                    string err      = "";
                    string response = TuanDai.HttpClient.HttpUtil.HttpGet(TdConfig.ApplicationName,
                                                                          postUrl + "/wap/WXGetSubscribeInfo?id=" + SubscribeId + "&projectId=" + ProjectId, "", out err,
                                                                          null, 3);
                    if (!string.IsNullOrEmpty(response) && string.IsNullOrEmpty(err))
                    {
                        ResponsePublicModel <WXSubscribeInfo> pmodel =
                            JsonConvert.DeserializeObject <ResponsePublicModel <WXSubscribeInfo> >(response);
                        if (pmodel != null)
                        {
                            subscribeInfo = pmodel.data;
                        }
                    }
                    else
                    {
                        TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName,
                                                                        "/wap/WXGetSubscribeInfo", "ProjectId:" + ProjectId, err);
                    }
                }
                else
                {
                    subscribeInfo = projectBll.WXGetSubscribeInfo(SubscribeId);
                }


                if (subscribeInfo == null)
                {
                    Response.Redirect(GlobalUtils.MTuanDaiURL + "/Member/Repayment/my_return_list.aspx");
                    return;
                }
                TenderMode = WXConverter.GetTenderModeString(subscribeInfo.TenderMode);

                if (projectInfo.Type == 23)
                {
                    ProjectXMBBLL xmbbll = new ProjectXMBBLL();
                    if (subscribeInfo.Status.Value.ToString().IsIn("3", "4"))
                    {
                        xmbReturn     = xmbbll.GetXMBReturnDetail(subscribeInfo.SubscribeId);
                        xmbDSInterest = xmbReturn.ReturnAmount - xmbReturn.Amount;
                        xmbHoldDay    = xmbReturn.HoldDay;
                        xmbDeadRate   = xmbReturn.InterestRate;
                    }
                    else
                    {
                        Tuple <int, decimal, decimal, string> tupleObj = BusinessDll.Invest.GetXMBProjectFloatRate(ProjectId, subscribeInfo.AddDate.Value, subscribeInfo.Amount ?? 0);
                        xmbHoldDay    = tupleObj.Item1;
                        xmbDeadRate   = tupleObj.Item2;
                        xmbDSInterest = tupleObj.Item3;
                    }
                    rateRangeList = xmbbll.GetXMBRateContrastInfo(ProjectId);
                }

                Status = WXConverter.GetSubscribeStatusString(projectInfo.Type, subscribeInfo.Status, subscribeInfo.IsBorrow);
                BindList();
                //当为分期宝时
                if (projectInfo != null && (projectInfo.Type ?? 0) == 15)
                {
                    FQUserApplyInfo = projectBll.WXGetFQUserApplyInfo(ProjectId.ToString());
                }

                if (this.listtable != null && this.listtable.Any())
                {
                    lastCycleDate = this.listtable.LastOrDefault().CycDate;
                    hasBackList   = this.listtable.Where(p => p.Desc == "已回款").ToList();
                    dueBackList   = this.listtable.Where(p => p.Desc == "待回款" || p.Desc == "已逾期").ToList();
                }
            }
        }
示例#2
0
        /// <summary>
        /// 获取回款记录明细
        /// </summary>
        /// <param name="subscribeId">申购Id</param>
        /// <returns></returns>
        protected List <SubscribeInfo> GetSubscribeDetailList(Guid subscribeId, Guid ProjectId)
        {
            List <SubscribeInfo> list = new List <SubscribeInfo>();

            if (GlobalUtils.IsOpenSubscribeApi)
            {
                string postUrl  = GlobalUtils.SubApiUrl;
                string err      = "";
                string response = HttpClient.HttpUtil.HttpGet(TdConfig.ApplicationName, postUrl + "/wap/getSubscribeDetailList?subscribeId=" + subscribeId + "&pid=" + ProjectId, "", out err, null, 3);
                if (!string.IsNullOrEmpty(response))
                {
                    ResponsePublicModel <List <SubscribeInfo> > responsePublicModel =
                        JsonConvert.DeserializeObject <ResponsePublicModel <List <SubscribeInfo> > >(response);
                    if (responsePublicModel != null && responsePublicModel.data != null)
                    {
                        list = responsePublicModel.data;
                    }
                }
                else
                {
                    list = new List <SubscribeInfo>();
                    TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "/wap/getSubscribeDetailList", "", err);
                }
            }
            else
            {
                string sqlText = @"SELECT ISNULL(Amount,0) Amount,ISNULL(InterestAmout,0) InterestAmout,ISNULL(InvestCommission,0) Commssion,
                            ISNULL(TuandaiRedPacket,0) TuandaiRedPacket,Periods,CycDate,[Desc],PenaltyAmount,IsBorrow,AddDate as OverDueDate,isnull(PublisherRedPacket,0) as PublisherRedPacket,InvestDate,OverDueInterest
                            FROM
                            (
                                SELECT a.Amount,a.InterestAmout,a.InvestCommission,a.BorrorCommission,a.TuandaiRedPacket,a.Periods,a.CycDate,'待回款' as [Desc],
                                CASE c.IsVip WHEN 0 THEN 0 WHEN 1 THEN (b.PrePenalty/2+(b.PenaltyAmount-b.PrePenalty)*2/3) ELSE 0 END AS PenaltyAmount,isnull(b.IsBorrow,1) as IsBorrow,b.AddDate,
                                a.PublisherRedPacket, c.AddDate as InvestDate,0 as OverDueInterest
                                FROM SubscribeDetail a with(nolock)
                                LEFT JOIN OverDueRecord b with(nolock) ON a.SubscribeId=b.SubscribeId AND a.Periods=b.periods and  isnull(b.IsHide,0)=0
                                INNER JOIN Subscribe c with(nolock) ON a.SubscribeId=c.Id
                                WHERE a.SubscribeId=@SubscribeId
                            )t ORDER BY Periods ASC";
                var    para    = new Dapper.DynamicParameters();
                para.Add("@SubscribeId", subscribeId);
                list = PublicConn.QueryBySql <SubscribeInfo>(sqlText, ref para);

                //回款历史表
                sqlText = @"select  a.RealAmount Amount,a.RealInterestAmout InterestAmout,a.InvestCommission Commssion,a.BorrorCommission,
                                a.TuandaiRedPacket,a.Periods,ISNULL(a.RepayAdvanceDate,a.CycDate) CycDate,'已回款' as [Desc],
                                0 AS PenaltyAmount,1 as IsBorrow,NULL as OverDueDate,
                                a.PublisherRedPacket, NULL as InvestDate,0 OverDueInterest from SubscribeDetailHistory_h1 a with(nolock) where SubscribeId=@SubscribeID order by Periods";
                var hlist = TuanDai.DB.TuanDaiDB.Query <SubscribeInfo>(TdConfig.ApplicationName,
                                                                       TdConfig.DBSubDetailHisRead, sqlText, ref para);
                if (hlist != null && hlist.Count > 0)
                {
                    foreach (var item in hlist)
                    {
                        //历史表有逾期的数据(已回款)
                        sqlText = string.Empty;
                        sqlText = @"select isnull(b.IsBorrow,1) IsBorrow,isnull(b.PrePenalty,0) PrePenalty,isnull(b.PenaltyAmount,0) PenaltyAmount,b.AddDate OverDueDate,c.IsVip,c.AddDate InvestDate ,0 as OverDueInterest from OverDueRecord b  with(nolock) inner join Subscribe c with(nolock)  on c.id=b.SubscribeId where b.SubscribeId=@SubscribeID and b.periods=@periods and ISNULL(b.IsBorrow,1) =1 and isnull(b.IsHide,0)=0";
                        para.Add("@periods", item.Periods);

                        OverInfo info = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <OverInfo>(TdConfig.ApplicationName,
                                                                                            TdConfig.DBRead, sqlText, ref para);
                        if (info != null)
                        {
                            item.Desc            = "已回款";
                            item.OverDueDate     = info.OverDueDate;
                            item.InvestDate      = info.InvestDate;
                            item.IsBorrow        = true;
                            item.OverDueInterest = info.OverDueInterest;
                            if (info.IsVip)
                            {
                                item.PenaltyAmount = info.PrePenalty / 2 + (info.PenaltyAmount - info.PrePenalty) * 2 / 3;
                            }
                            else
                            {
                                item.PenaltyAmount = 0;
                            }
                        }
                        //历史表有逾期的数据(已逾期)
                        sqlText = string.Empty;
                        sqlText = @"select isnull(b.IsBorrow,1) IsBorrow,isnull(b.PrePenalty,0) PrePenalty,isnull(b.PenaltyAmount,0) PenaltyAmount,b.AddDate OverDueDate,c.IsVip,c.AddDate InvestDate,isnull(b.OverDueInterest,0) OverDueInterest from OverDueRecord b  with(nolock) inner join Subscribe c with(nolock)  on c.id=b.SubscribeId where b.SubscribeId=@SubscribeID and b.periods=@periods and ISNULL(b.IsBorrow,1) =0 and isnull(b.IsHide,0)=0";
                        para.Add("@periods", item.Periods);

                        OverInfo info1 = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <OverInfo>(TdConfig.ApplicationName,
                                                                                             TdConfig.DBRead, sqlText, ref para);
                        if (info1 != null)
                        {
                            item.Desc            = "已逾期";
                            item.OverDueDate     = info1.OverDueDate;
                            item.InvestDate      = info1.InvestDate;
                            item.IsBorrow        = false;
                            item.OverDueInterest = info1.OverDueInterest;
                            if (info1.IsVip)
                            {
                                item.PenaltyAmount = info1.PrePenalty / 2 + (info1.PenaltyAmount - info1.PrePenalty) * 2 / 3;
                            }
                            else
                            {
                                item.PenaltyAmount = 0;
                            }
                        }
                    }
                }

                if (list == null)
                {
                    list = new List <SubscribeInfo>();
                }
                if (hlist != null)
                {
                    list.AddRange(hlist);
                }
            }

            return(list);
        }