Beispiel #1
0
        public WXMyBillsInfo WXGetMyBillsFromBigData(Guid userId, DateTime st, DateTime et, int pageIndex, int pageSize, int firstPageSize)
        {
            WXMyBillsInfo info   = new WXMyBillsInfo();
            string        getUrl = ConfigHelper.getConfigString("GetFtbTranListServerUrl") + "/member/master/queryUserTransactionRecords?userId=" + userId + "&startDate=" + st.ToString("yyyy-MM-dd 00:00:00") + "&endDate=" + et.ToString("yyyy-MM-dd 00:00:00") + "&type=-1&type1=-1&pageIndex=" + pageIndex + "&pageSize=" + pageSize + "&firstPageSize=" + firstPageSize;
            string        err    = "";
            string        resp   = HttpClient.HttpUtil.HttpGet(TdConfig.ApplicationName, getUrl, "", out err);

            if (!string.IsNullOrEmpty(resp))
            {
                ResponseBaseBills responseBase = JsonConvert.DeserializeObject <ResponseBaseBills>(resp);
                if (responseBase != null && responseBase.content != null && responseBase.content.Any())
                {
                    info.TotalCount = responseBase.totalElements;
                    info.List       = new List <WXMyBillDetialInfo>();
                    foreach (var item in responseBase.content)
                    {
                        WXMyBillDetialInfo detail = new WXMyBillDetialInfo();
                        detail.Amount        = item.amount;
                        detail.BillDate      = item.adddate;
                        detail.BillDesc      = item.desc;
                        detail.BillType      = item.type;
                        detail.FundProjectId = item.fundprojectid;
                        detail.Id            = item.id;
                        detail.InAmount      = item.inamount;
                        detail.PayOutAmount  = item.payoutamount;
                        info.List.Add(detail);
                    }
                }
            }
            return(info);
        }
Beispiel #2
0
        private void GetData()
        {
            var webset = new WebSettingBLL().GetWebSettingInfo("42E7BF6F-74F0-4375-A614-00AD81A4638E");

            if (webset == null)
            {
                webset             = new WebSettingInfo();
                webset.Param1Value = "6";
            }

            Guid userId = WebUserAuth.UserId.Value;

            model = WXGetMyBills(userId, 1, 10, DateTime.Now.AddDays(-int.Parse(webset.Param1Value)).ToDateString());
            int recordCount = model.TotalCount;

            int firstPageSize = 10;

            if (recordCount < 10)
            {
                firstPageSize = 10 - recordCount;
            }

            var bigModel = WXGetMyBillsFromBigData(userId, DateTime.Now.AddMonths(-2), DateTime.Now.AddDays(-int.Parse(webset.Param1Value)), 1, 10, firstPageSize);

            if (firstPageSize < 10 && bigModel.List != null)
            {
                model.List.AddRange(bigModel.List);
            }

            recordCount += bigModel.TotalCount;

            double divide = recordCount / 10;
            double floor  = System.Math.Floor(divide);

            if (recordCount % 10 != 0)
            {
                floor++;
            }
            pageCount  = Convert.ToInt32(floor);//总页数
            BannerList = new AdImageBLL().GetTuanDaiHot((int)ConstString.AdImageType.WEBImage, 1);
        }
Beispiel #3
0
        /// <summary>
        /// 获取我的账单数据
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页笔数</param>
        /// <returns></returns>
        public WXMyBillsInfo WXGetMyBills(Guid userId, int pageIndex, int pageSize, string startTime)
        {
            WXMyBillsInfo billResponse = new WXMyBillsInfo();

            string sql = @"SELECT @total=COUNT(1) FROM(
						SELECT 1 AS cnt
						FROM dbo.FundDetail A with(nolock,index=IDX_FundDetail_UserID)
						WHERE A.UserId=@UserId and adddate >@st
						) AS main;
						WITH oa AS(
						SELECT  ROW_NUMBER() OVER( ORDER BY A.AddDate DESC) AS RowNumber,  
							A.Amount,A.Id,A.[Desc] as BillDesc,
							A.UserId, A.[Type] as BillType, A.AddDate as BillDate, A.PayOutAmount, A.InAmount
						FROM  FundDetail A with(nolock,index=IDX_FundDetail_UserID)
						WHERE A.UserId=@UserId and a.adddate >@st)
						SELECT * FROM oa WHERE RowNumber  between (@pageIndex-1)*@pageSize+1 and @pageIndex*@pageSize"                        ;

            DynamicParameters paras = new DynamicParameters();

            paras.Add("@UserId", userId);
            paras.Add("@pageSize", pageSize);
            paras.Add("@pageIndex", pageIndex);
            paras.Add("@st", startTime);
            paras.Add("@total", 0, DbType.Int32, ParameterDirection.Output);

            List <WXMyBillDetialInfo> list = DB.TuanDaiDB.Query <WXMyBillDetialInfo>(TdConfig.ApplicationName, TdConfig.DBRead, sql, ref paras);

            //string err = "";
            //List<WXMyBillDetialInfo> list = DB.TuanDaiDB.Query<WXMyBillDetialInfo>(TdConfig.DBRead, sql, ref paras,ref err);
            billResponse.List       = list;
            billResponse.TotalCount = paras.Get <int?>("@total") ?? 0;
            if (billResponse.TotalCount > 0)
            {
                billResponse.result = "1";
            }
            else
            {
                billResponse.result = "2";
            }
            return(billResponse);
        }
Beispiel #4
0
        /// <summary>
        /// 获取我的账单记录
        /// </summary>
        public void GetMyBillsShowList()
        {
            int pagesize  = 10;
            int pageindex = Tool.SafeConvert.ToInt32(Context.Request.Form["pageIndex"], 1);

            if (pageindex < 1)
            {
                pageindex = 1;
            }
            TuanDai.PortalSystem.Model.WebSettingInfo webset = new WebSettingBLL().GetWebSettingInfo("42E7BF6F-74F0-4375-A614-00AD81A4638E");
            if (webset == null)
            {
                webset             = new TuanDai.PortalSystem.Model.WebSettingInfo();
                webset.Param1Value = "6";
            }

            StringBuilder sb          = new StringBuilder();
            int           totalcount  = 0;
            WXMyBillsInfo myBillModel = new my_bills().WXGetMyBills(WebUserAuth.UserId.Value, pageindex, GlobalUtils.PageSize, DateTime.Now.AddDays(-int.Parse(webset.Param1Value)).ToDateString());

            if (myBillModel == null)
            {
                myBillModel = new WXMyBillsInfo();
            }

            if (myBillModel != null)
            {
                //思路:先从主库取数据,再从大数据取数据衔接
                totalcount = myBillModel.TotalCount;
                int index         = 1;
                int pageCount     = GetPageCount(totalcount, pagesize);//总页数  主库数据页数
                int firstPageSize = 10;
                int newPageIndex  = 0;
                if (pageindex >= pageCount)
                {
                    newPageIndex  = pageindex - pageCount + 1;
                    firstPageSize = 10 - (totalcount % pagesize);
                }

                var bigModel = new my_bills().WXGetMyBillsFromBigData(WebUserAuth.UserId.Value, DateTime.Now.AddMonths(-2), DateTime.Now.AddDays(-int.Parse(webset.Param1Value)), newPageIndex, 10, firstPageSize);
                if (bigModel == null)
                {
                    bigModel = new WXMyBillsInfo();
                }
                if (pageindex >= pageCount && bigModel.List != null)
                {
                    myBillModel.List.AddRange(bigModel.List);
                }

                totalcount += bigModel.TotalCount;                //加上大数据的近两个月总条数
                pageCount   = GetPageCount(totalcount, pagesize); //加上大数据的近两个月总页数

                if (myBillModel.List != null && myBillModel.List.Count > 0)
                {
                    sb.Append("{\"result\":\"1\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"" + pageCount +
                              "\",\"list\":[");
                    foreach (WXMyBillDetialInfo temp in myBillModel.List)
                    {
                        if (index == myBillModel.List.Count())
                        {
                            sb.Append("{\"Title\":\"" + my_bills.GetBillTitle(temp) + "\",\"BillDate\":\"" +
                                      Convert.ToDateTime(temp.BillDate).ToString("yyyyMM") + "\",\"OperateStr\":\"" +
                                      (temp.PayOutAmount > 0 ? "-" : "+")
                                      + "\",\"Amount\":\"" +
                                      Tool.MoneyHelper.ConvertDetailWanMoney((temp.PayOutAmount ?? 0) > 0
                                          ? temp.PayOutAmount
                                          : (temp.InAmount ?? 0))
                                      + "\",\"BillType\":\"" + my_bills.GetBillType(temp)
                                      + "\",\"Day\":\"" + temp.BillDate.ToString("MM-dd")
                                      + "\",\"Hour\":\"" + temp.BillDate.ToString("HH:mm:ss")
                                      + "\",\"Year\":\"" + temp.BillDate.ToString("yyyy")
                                      + "\",\"Month\":\"" + temp.BillDate.ToString("MM")
                                      + "\",\"Id\":\"" + temp.Id
                                      + "\"}]}");
                        }
                        else
                        {
                            sb.Append("{\"Title\":\"" + my_bills.GetBillTitle(temp) + "\",\"BillDate\":\"" +
                                      Convert.ToDateTime(temp.BillDate).ToString("yyyyMM") + "\",\"OperateStr\":\"" +
                                      (temp.PayOutAmount > 0 ? "-" : "+")
                                      + "\",\"Amount\":\"" +
                                      Tool.MoneyHelper.ConvertDetailWanMoney((temp.PayOutAmount ?? 0) > 0
                                          ? temp.PayOutAmount
                                          : (temp.InAmount ?? 0))
                                      + "\",\"BillType\":\"" + my_bills.GetBillType(temp)
                                      + "\",\"Day\":\"" + temp.BillDate.ToString("MM-dd")
                                      + "\",\"Hour\":\"" + temp.BillDate.ToString("HH:mm:ss")
                                      + "\",\"Year\":\"" + temp.BillDate.ToString("yyyy")
                                      + "\",\"Month\":\"" + temp.BillDate.ToString("MM")
                                      + "\",\"Id\":\"" + temp.Id
                                      + "\"},");
                        }
                        index++;
                    }
                }
                else
                {
                    sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"0\"}");
                }
            }
            else
            {
                sb.Append("{\"result\":\"0\",\"totalcount\":\"" + totalcount + "\",\"pagecount\":\"0\"}");
            }
            this.Context.Response.Write(sb.ToString());
            this.Context.Response.End();
        }