Exemplo n.º 1
0
        protected override EmptyResponseData ProcessRequest(APIRequest <MultiCheckRP> pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            if (loggingSessionInfo == null)
            {
                throw new APIException("用户未登录")
                      {
                          ErrorCode = ERROR_CODES.INVALID_REQUEST
                      }
            }
            ;

            VipWithdrawDepositApplyBLL bll = new VipWithdrawDepositApplyBLL(CurrentUserInfo);
            var result = bll.MultiCheck(pRequest.Parameters.Ids, pRequest.Parameters.Type, pRequest.Parameters.Remark);

            if (!result)
            {
                throw new APIException(ERROR_CODES.INVALID_BUSINESS, "审核失败");
            }
            else
            {
                return(new EmptyResponseData());
            }
            //throw new NotImplementedException();
        }
    }
        /// <summary>
        /// 提现确认/完成操作
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string UpdateWDApply(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <UpdateWDApplyRP> >();
            //var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var vipWDApplyBll      = new VipWithdrawDepositApplyBLL(loggingSessionInfo); //提现申请BLL实例化

            string[] applyIdArray = rp.Parameters.ApplyID.Split(',');
            if (applyIdArray.Length > 0)
            {
                foreach (var applyId in applyIdArray)
                {
                    var vipWDApplyEntity = vipWDApplyBll.GetByID(applyId);     //获取提现申请对象
                    if (vipWDApplyEntity != null)
                    {
                        switch (rp.Parameters.Status)
                        {
                        case 1:    //已确认
                            vipWDApplyEntity.Status      = 1;
                            vipWDApplyEntity.ConfirmDate = DateTime.Now;
                            break;

                        case 2:    //已完成
                            vipWDApplyEntity.Status       = 2;
                            vipWDApplyEntity.CompleteDate = DateTime.Now;
                            break;
                        }
                        vipWDApplyBll.Update(vipWDApplyEntity); //修改
                    }
                }
            }
            var rsp = new SuccessResponse <IAPIResponseData>();

            return(rsp.ToJSON());
        }
        /// <summary>
        /// 提现记录列表
        /// </summary>
        /// <returns></returns>
        public string GetWithdrawDeposit(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetWDRP> >();
            //var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var vipWDApplyBll      = new VipWithdrawDepositApplyBLL(loggingSessionInfo); //提现申请BLL实例化

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

            if (!string.IsNullOrEmpty(rp.Parameters.WithdrawNo))  //提现申请编号
            {
                complexCondition.Add(new LikeCondition()
                {
                    FieldName = "a.WithdrawNo", Value = "%" + rp.Parameters.WithdrawNo + "%"
                });
            }

            //下面要加上对分销商的兼容性*****
            if (rp.Parameters.IsVip == 1)//会员
            {
                if (!string.IsNullOrEmpty(rp.Parameters.VipName))
                {
                    complexCondition.Add(new LikeCondition()
                    {
                        FieldName = "v.VipName", Value = "%" + rp.Parameters.VipName + "%"
                    });
                }
                else if (rp.Parameters.IsVip == 2)//店员
                {
                    if (!string.IsNullOrEmpty(rp.Parameters.VipName))
                    {
                        complexCondition.Add(new LikeCondition()
                        {
                            FieldName = "u.user_name", Value = "%" + rp.Parameters.VipName + "%"
                        });
                    }
                }
            }
            //else if (rp.Parameters.IsVip == 3)//分销商
            //    complexCondition.Add(new LikeCondition() { FieldName = "u.RetailTraderName", Value = "%" + rp.Parameters.VipName + "%" });

            if (!string.IsNullOrEmpty(rp.Parameters.Status))//判断状态
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "a.Status", Value = rp.Parameters.Status
                });
            }
            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.CustomerID", Value = loggingSessionInfo.ClientID
            });
            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };

            lstOrder.Add(new OrderBy()
            {
                FieldName = "a.ApplyDate", Direction = OrderByDirections.Desc
            });
            //根据rp.Parameters.IsVip查询不同的数据源
            var wdApplyList = vipWDApplyBll.PagedQuery(complexCondition.ToArray(), lstOrder.ToArray(), rp.Parameters.PageSize, rp.Parameters.PageIndex + 1, rp.Parameters.IsVip);

            var rd = new WDManageInfoRD();

            rd.TotalPageCount      = wdApplyList.PageCount;
            rd.TotalCount          = wdApplyList.RowCount;
            rd.WithdrawDepositList = wdApplyList.Entities.Select(t => new WDManageInfo()
            {
                AccountName = t.AccountName, ApplyID = t.ApplyID, WithdrawNo = t.WithdrawNo, ApplyDate = t.ApplyDate, VipName = t.VipName, VipId = t.VipID, Amount = t.Amount, Status = t.Status, CompleteDate = t.CompleteDate, BankName = t.BankName, CardNo = t.CardNo
            }).ToArray();

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
            //return "{\"ResultCode\":0,\"Message\":\"OK\",\"IsSuccess\":true,\"Data\":{\"WithdrawDepositList\":[{\"ApplyID\":\"2E0AB4E2-53ED-4E19-90FE-8E1A56B324AB\",\"WithdrawNo\":\"2014123124030003\",\"ApplyDate\":\"2014-12-31\",\"Amount\":10,\"Status\":0,\"CompleteDate\":\"\",\"VipName\":\"demo1\",\"VipID\":\"0184281DFCAA41B5A5677FBC44BC12AA\"}],\"TotalPageCount\":1}}";
        }
Exemplo n.º 4
0
        protected override GetWithdrawDepositApplyListRD ProcessRequest(DTO.Base.APIRequest <GetWithdrawDepositApplyListRP> pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            if (loggingSessionInfo == null)
            {
                throw new APIException("用户未登录")
                      {
                          ErrorCode = ERROR_CODES.INVALID_REQUEST
                      }
            }
            ;

            var parameter = pRequest.Parameters;
            //排序参数
            List <OrderBy> orderList = new List <OrderBy> {
            };

            orderList.Add(new OrderBy()
            {
                FieldName = "ApplyDate", Direction = OrderByDirections.Desc
            });
            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.WithdrawNo))
            {
                complexCondition.Add(new LikeCondition()
                {
                    FieldName = "WithdrawNo", Value = "%" + parameter.WithdrawNo + "%"
                });
            }
            if (pRequest.Parameters.VipType != null && pRequest.Parameters.VipType != -1)
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "VipType", Value = parameter.VipType
                });
            }

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.Name))
            {
                complexCondition.Add(new LikeCondition()
                {
                    FieldName = "Name", Value = "%" + parameter.Name + "%"
                });
            }
            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.Phone))
            {
                complexCondition.Add(new LikeCondition()
                {
                    FieldName = "Phone", Value = "%" + parameter.Phone + "%"
                });
            }

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ApplyStartDate))
            {
                complexCondition.Add(new DirectCondition()
                {
                    Expression = "ApplyDate>='" + parameter.ApplyStartDate + "'"
                });
            }
            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ApplyEndDate))
            {
                if (parameter.ApplyStartDate == parameter.ApplyEndDate)
                {
                    parameter.ApplyEndDate = parameter.ApplyEndDate + " 23:59";
                }
                complexCondition.Add(new DirectCondition {
                    Expression = "ApplyDate<='" + parameter.ApplyEndDate + "'"
                });
            }


            if (parameter.Status != null && parameter.Status != -1)
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "Status", Value = parameter.Status
                });
            }
            if (!string.IsNullOrWhiteSpace(parameter.CompleteStartDate))
            {
                complexCondition.Add(new DirectCondition()
                {
                    Expression = "CompleteDate>='" + parameter.CompleteStartDate + "'"
                });
            }
            if (!string.IsNullOrWhiteSpace(parameter.CompleteEndDate))
            {
                if (parameter.CompleteEndDate == parameter.CompleteStartDate)
                {
                    parameter.CompleteEndDate = parameter.CompleteEndDate + ": 23:59";
                }
                complexCondition.Add(new DirectCondition {
                    Expression = "CompleteDate<='" + parameter.CompleteEndDate + "'"
                });
            }
            VipWithdrawDepositApplyBLL bll = new VipWithdrawDepositApplyBLL(CurrentUserInfo);
            int rowCount  = 0;
            int pageCount = 0;
            var dbSet     = bll.PagedQueryDbSet(complexCondition.ToArray(), orderList.ToArray(), parameter.PageSize, parameter.PageIndex, out rowCount, out pageCount);
            var dbList    = DataTableToObject.ConvertToList <WithdrawDepositApplyInfo>(dbSet.Tables[0]);

            foreach (var m in dbList)
            {
                m.ApplyDate    = string.IsNullOrWhiteSpace(m.ApplyDate) ? string.Empty : Convert.ToDateTime(m.ApplyDate).ToString("yyyy-MM-dd");
                m.CompleteDate = string.IsNullOrWhiteSpace(m.CompleteDate) ? string.Empty : Convert.ToDateTime(m.CompleteDate).ToString("yyyy-MM-dd");
            }
            var result = new GetWithdrawDepositApplyListRD();

            result.List       = dbList;
            result.TotalCount = rowCount;
            result.TotalPage  = pageCount;

            return(result);
        }
    }
Exemplo n.º 5
0
        private void DownLoadTXExcel(HttpContext pContext)
        {
            var req = pContext.Request["req"];

            if (string.IsNullOrWhiteSpace(req))
            {
                return;
            }
            var pRequest = JsonConvert.DeserializeObject <DTO.Base.APIRequest <GetWithdrawDepositApplyListRP> >(req);

            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            if (loggingSessionInfo == null)
            {
                //throw new APIException("用户未登录") { ErrorCode = ERROR_CODES.INVALID_REQUEST };
                return;
            }

            #region 获取数据
            //排序参数
            List <OrderBy> orderList = new List <OrderBy> {
            };
            orderList.Add(new OrderBy()
            {
                FieldName = "ApplyDate", Direction = OrderByDirections.Desc
            });
            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };
            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.WithdrawNo))
            {
                complexCondition.Add(new LikeCondition()
                {
                    FieldName = "WithdrawNo", Value = "%" + pRequest.Parameters.WithdrawNo + "%"
                });
            }
            if (pRequest.Parameters.VipType != null && pRequest.Parameters.VipType != -1)
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "VipType", Value = pRequest.Parameters.VipType
                });
            }

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.Name))
            {
                complexCondition.Add(new JIT.Utility.DataAccess.Query.LikeCondition()
                {
                    FieldName = "Name", Value = "%" + pRequest.Parameters.Name + "%"
                });
            }
            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.Phone))
            {
                complexCondition.Add(new JIT.Utility.DataAccess.Query.LikeCondition()
                {
                    FieldName = "Phone", Value = "%" + pRequest.Parameters.Phone + "%"
                });
            }

            //if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ApplyStartDate))
            //    complexCondition.Add(new JIT.Utility.DataAccess.Query.MoreThanCondition() { FieldName = "ApplyDate", Value = Convert.ToDateTime(pRequest.Parameters.ApplyStartDate) });
            //if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ApplyEndDate))
            //    complexCondition.Add(new JIT.Utility.DataAccess.Query.LessThanCondition() { FieldName = "ApplyDate", Value = Convert.ToDateTime(pRequest.Parameters.ApplyEndDate) });


            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ApplyStartDate))
            {
                complexCondition.Add(new DirectCondition()
                {
                    Expression = "ApplyDate>='" + pRequest.Parameters.ApplyStartDate + "'"
                });
            }
            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.ApplyEndDate))
            {
                if (pRequest.Parameters.ApplyStartDate == pRequest.Parameters.ApplyEndDate)
                {
                    pRequest.Parameters.ApplyEndDate = pRequest.Parameters.ApplyEndDate + " 23:59";
                }
                complexCondition.Add(new DirectCondition {
                    Expression = "ApplyDate<='" + pRequest.Parameters.ApplyEndDate + "'"
                });
            }

            if (pRequest.Parameters.Status != null && pRequest.Parameters.Status != -1)
            {
                complexCondition.Add(new JIT.Utility.DataAccess.Query.EqualsCondition()
                {
                    FieldName = "Status", Value = pRequest.Parameters.Status
                });
            }
            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.CompleteStartDate))
            {
                complexCondition.Add(new DirectCondition()
                {
                    Expression = "CompleteDate >='" + pRequest.Parameters.CompleteStartDate + "'"
                });
            }

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.CompleteEndDate))
            {
                if (pRequest.Parameters.CompleteEndDate == pRequest.Parameters.CompleteEndDate)
                {
                    pRequest.Parameters.CompleteEndDate = pRequest.Parameters.CompleteEndDate + " 23:59";
                }
                complexCondition.Add(new DirectCondition {
                    Expression = "CompleteDate<='" + pRequest.Parameters.CompleteEndDate + "'"
                });
            }

            VipWithdrawDepositApplyBLL bll = new VipWithdrawDepositApplyBLL(loggingSessionInfo);
            int rowCount  = 0;
            int pageCount = 0;
            var dbSet     = bll.PagedQueryDbSet(complexCondition.ToArray(), orderList.ToArray(), 10000, pRequest.Parameters.PageIndex, out rowCount, out pageCount);
            var dbList    = DataTableToObject.ConvertToList <WithdrawDepositApplyInfo>(dbSet.Tables[0]);
            foreach (var m in dbList)
            {
                m.ApplyDate    = m.ApplyDate + "" == "" ? "" : Convert.ToDateTime(m.ApplyDate).ToString("yyyy-MM-dd");
                m.CompleteDate = m.CompleteDate + "" == "" ? "" : Convert.ToDateTime(m.CompleteDate).ToString("yyyy-MM-dd");
            }

            #endregion
            //var dt = ToDataTable<WithdrawDepositApplyInfo>(dbList);
            DataTable dt = new DataTable("dt");
            dt.Columns.Add("提现单号");
            dt.Columns.Add("姓名");
            dt.Columns.Add("类别");
            dt.Columns.Add("手机号");
            dt.Columns.Add("提现金额(元)");
            dt.Columns.Add("银行名称");
            dt.Columns.Add("银行卡号");
            dt.Columns.Add("开户人姓名");
            dt.Columns.Add("状态");
            dt.Columns.Add("申请时间");
            dt.Columns.Add("完成时间");
            foreach (var m in dbList)
            {
                DataRow row = dt.NewRow();
                row["提现单号"] = m.WithdrawNo;
                row["姓名"]   = m.Name;
                switch (m.VipType)
                {
                case 1:
                    row["类别"] = "会员";
                    break;

                case 2:
                    row["类别"] = "员工";
                    break;

                case 3:
                    row["类别"] = "旧分销商";
                    break;

                case 4:
                    row["类别"] = "分销商";
                    break;

                default:
                    row["类别"] = "";
                    break;
                }
                row["手机号"]     = m.Phone;
                row["提现金额(元)"] = m.Amount;
                row["银行名称"]    = m.BankName;
                row["银行卡号"]    = m.CardNo;
                row["开户人姓名"]   = m.AccountName;
                switch (m.Status)
                {
                case 1:
                    row["状态"] = "待审核";
                    break;

                case 2:
                    row["状态"] = "已审核";
                    break;

                case 3:
                    row["状态"] = "已完成";
                    break;

                case 4:
                    row["状态"] = "审核不通过";
                    break;

                default:
                    break;
                }

                row["申请时间"] = m.ApplyDate;
                row["完成时间"] = m.CompleteDate;

                dt.Rows.Add(row);
            }

            ExcelHelper excel = new ExcelHelper();
            //上传目录
            string directory = "~/Framework/Upload/";
            //判断目录是否存在
            if (!System.IO.Directory.Exists(pContext.Server.MapPath(directory)))
            {
                System.IO.Directory.CreateDirectory(pContext.Server.MapPath(directory));
            }
            string fileName = DateTime.Now.Ticks + ".xls";
            string MapUrl   = pContext.Server.MapPath(directory + fileName);
            //string MapUrl = pContext.Server.MapPath(DateTime.Now.Ticks + ".xls");
            excel.RenderToExcel(dt, MapUrl);
            Utils.OutputExcel(pContext, MapUrl);//输出Excel文件
        }