protected override GetVipAmountDetailRD ProcessRequest(DTO.Base.APIRequest <GetVipAmountDetailRP> pRequest)
        {
            var                rd                 = new GetVipAmountDetailRD();
            var                para               = pRequest.Parameters;
            VipAmountBLL       vipAmountBLL       = new VipAmountBLL(CurrentUserInfo);
            var                vipAmountDetailBLL = new VipAmountDetailBLL(CurrentUserInfo);
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            //商户条件
            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.VipID", Value = CurrentUserInfo.UserID
            });
            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.VipCardCode", Value = para.VipCardCode
            });
            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.CustomerId", Value = loggingSessionInfo.ClientID
            });

            if (para.Type == 1) //余额
            {
                complexCondition.Add(new DirectCondition(" a.AmountSourceId NOT IN (36,35,20) "));
                complexCondition.Add(new DirectCondition(" a.AmountSourceId > 0 "));
            }
            else if (para.Type == 2) //返现
            {
                complexCondition.Add(new DirectCondition(" a.AmountSourceId in (2,3,13,16,22,24)"));
            }

            #region 正常余额
            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };
            lstOrder.Add(new OrderBy()
            {
                FieldName = "a.CreateTime", Direction = OrderByDirections.Desc
            });

            var tempList = vipAmountDetailBLL.GetVipAmountDetailList(complexCondition.ToArray(), lstOrder.ToArray(), para.PageSize, para.PageIndex + 1);
            rd.TotalCount          = tempList.RowCount;
            rd.TotalPageCount      = tempList.PageCount;
            rd.VipAmountDetailList = tempList.Entities.Select(t => new VipAmountDetailInfo()
            {
                AmountSourceName = t.AmountSourceName,
                Amount           = t.Amount.Value,
                CreateTime       = t.CreateTime.Value.ToString("yyyy-MM-dd")
            }).ToArray();
            #endregion

            #region 统计信息
            //查询当前余额/返现
            rd.CurrentAmount = 0; //当前余额/返现(默认值)
            var vipAmountInfo = vipAmountBLL.QueryByEntity(new VipAmountEntity()
            {
                VipId = pRequest.UserID, VipCardCode = para.VipCardCode
            }, null).FirstOrDefault();

            if (vipAmountInfo != null)
            {
                if (para.Type == 1) //当前余额
                {
                    rd.CurrentAmount = vipAmountInfo.EndAmount.Value;
                }
                else if (para.Type == 2) //返现
                {
                    rd.CurrentAmount = vipAmountInfo.ValidReturnAmount.Value;
                }

                decimal[] array = vipAmountBLL.GetVipSumAmountByCondition(pRequest.UserID, CurrentUserInfo.ClientID, false);
                rd.OutAmount = -Convert.ToDecimal(array[2]); //支出余额
            }
            #endregion
            return(rd);
        }
        protected override GetVipAmountDetailRD ProcessRequest(DTO.Base.APIRequest <GetVipAmountDetailRP> pRequest)
        {
            var rd   = new GetVipAmountDetailRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; //登录状态信息
            var vipAmountBLL       = new VipAmountBLL(loggingSessionInfo);
            var vipAmountDetailBLL = new VipAmountDetailBLL(loggingSessionInfo);

            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            //商户条件
            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.VipID", Value = para.VipId
            });
            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.VipCardCode", Value = para.VipCardCode
            });

            if (para.Type == 1) //余额
            {
                complexCondition.Add(new DirectCondition(" a.AmountSourceId in (1,4,6,10,17,20,21,23) "));
            }
            else if (para.Type == 2) //返现
            {
                complexCondition.Add(new DirectCondition(" a.AmountSourceId in (2,3,13,16,22,24)"));
            }



            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };

            lstOrder.Add(new OrderBy()
            {
                FieldName = "a.CreateTime", Direction = OrderByDirections.Desc
            });

            var tempList = vipAmountDetailBLL.GetVipAmountDetailList(complexCondition.ToArray(), lstOrder.ToArray(), para.PageSize, para.PageIndex);

            rd.TotalCount          = tempList.RowCount;
            rd.TotalPageCount      = tempList.PageCount;
            rd.VipAmountDetailList = tempList.Entities.Select(t => new VipAmountDetailInfo()
            {
                UnitName         = t.UnitName,
                AmountSourceName = t.AmountSourceName,
                Amount           = t.Amount.Value,
                CreateTime       = t.CreateTime.Value.ToString("yyyy-MM-dd HH:mm"),
                Reason           = t.Reason == null ? "" : t.Reason,
                Remark           = t.Remark == null ? "" : t.Remark,
                ImageUrl         = t.ImageUrl,
                CreateByName     = t.CreateByName,
            }).ToArray();

            //查询当前余额/返现
            rd.CurrentAmount = 0; //当前余额/返现(默认值)
            var vipAmountInfo = vipAmountBLL.QueryByEntity(new VipAmountEntity()
            {
                VipId = para.VipId, VipCardCode = para.VipCardCode
            }, null).FirstOrDefault();

            if (vipAmountInfo != null)
            {
                if (para.Type == 1) //余额
                {
                    rd.CurrentAmount = vipAmountInfo.EndAmount.Value;
                }
                else
                {
                    rd.CurrentAmount = vipAmountInfo.ValidReturnAmount.Value;
                }
            }
            return(rd);
        }