/// <summary>
 /// 骑士提现功能检查数据合法性,判断是否满足提现要求 add by caoheyang 20150509
 /// </summary>
 /// <param name="withdrawCpm">参数实体</param>
 /// <param name="clienter">骑士</param>
 /// <param name="clienterFinanceAccount">骑士金融账号信息</param>
 /// <returns></returns>
 private FinanceWithdrawC CheckWithdrawC(WithdrawCPM withdrawCpm, ref clienter clienter,
                                         ref ClienterFinanceAccount clienterFinanceAccount)
 {
     if (withdrawCpm == null)
     {
         return(FinanceWithdrawC.NoPara);
     }
     if (withdrawCpm.WithdrawPrice % 100 != 0 || withdrawCpm.WithdrawPrice < 100 ||
         withdrawCpm.WithdrawPrice > 3000)   //提现金额小于500 加2手续费
     {
         return(FinanceWithdrawC.MoneyDoubleError);
     }
     clienter = _clienterDao.GetById(withdrawCpm.ClienterId);    //获取超人信息
     if (clienter == null || clienter.Status == null ||
         clienter.Status != ClienteStatus.Status1.GetHashCode()) //骑士状态为非 审核通过不允许 提现
     {
         return(FinanceWithdrawC.ClienterError);
     }
     else if (clienter.AllowWithdrawPrice < withdrawCpm.WithdrawPrice) //可提现金额小于提现金额,提现失败
     {
         return(FinanceWithdrawC.MoneyError);
     }
     else if (clienter.AccountBalance < clienter.AllowWithdrawPrice) //账户余额小于 可提现金额,提现失败 账号异常
     {
         return(FinanceWithdrawC.FinanceAccountError);
     }
     clienterFinanceAccount = _clienterFinanceAccountDao.GetById(withdrawCpm.FinanceAccountId);//获取超人金融账号信息
     if (clienterFinanceAccount == null || clienterFinanceAccount.ClienterId != withdrawCpm.ClienterId)
     {
         return(FinanceWithdrawC.FinanceAccountError);
     }
     return(FinanceWithdrawC.Success);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条记录
        /// <param name="clienterFinanceAccount"> 参数实体</param>
        /// </summary>
        public void Update(ClienterFinanceAccount clienterFinanceAccount)
        {
            const string  updateSql    = @"
update  ClienterFinanceAccount
set  TrueName=@TrueName,AccountNo=@AccountNo,BelongType=@BelongType,OpenBank=@OpenBank,
OpenSubBank=@OpenSubBank,UpdateBy=@UpdateBy
where  Id=@Id ";
            IDbParameters dbParameters = DbHelper.CreateDbParameters();

            dbParameters.AddWithValue("Id", clienterFinanceAccount.Id);
            dbParameters.AddWithValue("TrueName", clienterFinanceAccount.TrueName);
            dbParameters.AddWithValue("AccountNo", clienterFinanceAccount.AccountNo);
            dbParameters.AddWithValue("BelongType", clienterFinanceAccount.BelongType); //账号类别  0 个人账户 1 公司账户
            dbParameters.AddWithValue("OpenBank", clienterFinanceAccount.OpenBank);
            dbParameters.AddWithValue("OpenSubBank", clienterFinanceAccount.OpenSubBank);
            dbParameters.AddWithValue("UpdateBy", clienterFinanceAccount.UpdateBy);
            DbHelper.ExecuteNonQuery(SuperMan_Write, updateSql, dbParameters);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据ID获取对象
        /// </summary>
        public ClienterFinanceAccount GetById(int id)
        {
            ClienterFinanceAccount model        = null;
            const string           querysql     = @"
select  Id,ClienterId,TrueName,AccountNo,IsEnable,AccountType,BelongType,OpenBank,OpenSubBank,CreateBy,CreateTime,UpdateBy,UpdateTime
from  ClienterFinanceAccount(nolock)  
where  Id=@Id  and IsEnable=1";
            IDbParameters          dbParameters = DbHelper.CreateDbParameters();

            dbParameters.AddWithValue("Id", id);
            DataTable dt = DataTableHelper.GetTable(DbHelper.ExecuteDataset(SuperMan_Read, querysql, dbParameters));

            if (DataTableHelper.CheckDt(dt))
            {
                model = DataTableHelper.ConvertDataTableList <ClienterFinanceAccount>(dt)[0];
            }
            return(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条记录
        /// </summary>
        /// <param name="clienterFinanceAccount">参数实体</param>
        /// <returns></returns>
        public int Insert(ClienterFinanceAccount clienterFinanceAccount)
        {
            const string  insertSql    = @"
insert into ClienterFinanceAccount(ClienterId,TrueName,AccountNo,IsEnable,AccountType,BelongType,OpenBank,OpenSubBank,CreateBy,UpdateBy)
values(@ClienterId,@TrueName,@AccountNo,@IsEnable,@AccountType,@BelongType,@OpenBank,@OpenSubBank,@CreateBy,@UpdateBy)
select @@IDENTITY";
            IDbParameters dbParameters = DbHelper.CreateDbParameters();

            dbParameters.AddWithValue("ClienterId", clienterFinanceAccount.ClienterId);   //骑士ID
            dbParameters.AddWithValue("TrueName", clienterFinanceAccount.TrueName);       //户名
            dbParameters.AddWithValue("AccountNo", clienterFinanceAccount.AccountNo);     //卡号(DES加密)
            dbParameters.AddWithValue("IsEnable", clienterFinanceAccount.IsEnable);       //是否有效(1:有效 0:无效)
            dbParameters.AddWithValue("AccountType", clienterFinanceAccount.AccountType); //账号类型:(1网银 2支付宝 3微信 4财付通 5百度钱包)
            dbParameters.AddWithValue("BelongType", clienterFinanceAccount.BelongType);   //账号类别  0 个人账户 1 公司账户
            dbParameters.AddWithValue("OpenBank", clienterFinanceAccount.OpenBank);       //开户行
            dbParameters.AddWithValue("OpenSubBank", clienterFinanceAccount.OpenSubBank); //开户支行
            dbParameters.AddWithValue("CreateBy", clienterFinanceAccount.CreateBy);       //添加人
            dbParameters.AddWithValue("UpdateBy", clienterFinanceAccount.UpdateBy);       //最后更新人
            object result = DbHelper.ExecuteScalar(SuperMan_Write, insertSql, dbParameters);

            return(ParseHelper.ToInt(result));
        }
        /// <summary>
        /// 骑士提现功能 add by caoheyang 20150509
        /// </summary>
        /// <param name="withdrawCpm">参数实体</param>
        /// <returns></returns>
        public ResultModel <object> WithdrawC(WithdrawCPM withdrawCpm)
        {
            using (IUnitOfWork tran = EdsUtilOfWorkFactory.GetUnitOfWorkOfEDS())
            {
                clienter         clienter = new clienter();
                var              clienterFinanceAccount = new ClienterFinanceAccount(); //骑士金融账号信息
                FinanceWithdrawC checkbool = CheckWithdrawC(withdrawCpm, ref clienter, ref clienterFinanceAccount);
                if (checkbool != FinanceWithdrawC.Success)                              //验证失败 此次提款操作无效 直接返回相关错误信息
                {
                    return(ResultModel <object> .Conclude(checkbool));
                }
                else
                {
                    _clienterDao.UpdateForWithdrawC(new UpdateForWithdrawPM
                    {
                        Id    = withdrawCpm.ClienterId,
                        Money = -withdrawCpm.WithdrawPrice
                    }); //更新骑士表的余额,可提现余额
                    string withwardNo = Helper.generateOrderCode(withdrawCpm.ClienterId);
                    #region 骑士提现
                    long withwardId = _clienterWithdrawFormDao.Insert(new ClienterWithdrawForm()
                    {
                        WithwardNo         = withwardNo,                                          //单号 规则待定
                        ClienterId         = withdrawCpm.ClienterId,                              //骑士Id(Clienter表)
                        BalancePrice       = clienter.AccountBalance,                             //提现前骑士余额
                        AllowWithdrawPrice = clienter.AllowWithdrawPrice,                         //提现前骑士可提现金额
                        Status             = (int)ClienterWithdrawFormStatus.WaitAllow,           //待审核
                        Amount             = withdrawCpm.WithdrawPrice,                           //提现金额
                        Balance            = clienter.AccountBalance - withdrawCpm.WithdrawPrice, //提现后余额
                        TrueName           = clienterFinanceAccount.TrueName,                     //骑士收款户名
                        AccountNo          = clienterFinanceAccount.AccountNo,                    //卡号(DES加密)
                        AccountType        = clienterFinanceAccount.AccountType,                  //账号类型:
                        BelongType         = clienterFinanceAccount.BelongType,                   //账号类别  0 个人账户 1 公司账户
                        OpenBank           = clienterFinanceAccount.OpenBank,                     //开户行
                        OpenSubBank        = clienterFinanceAccount.OpenSubBank                   //开户支行
                    });
                    #endregion

                    #region 骑士余额流水操作 更新骑士表的余额,可提现余额
                    _clienterBalanceRecordDao.Insert(new ClienterBalanceRecord()
                    {
                        ClienterId = withdrawCpm.ClienterId,                    //骑士Id(Clienter表)
                        Amount     = -withdrawCpm.WithdrawPrice,                //流水金额
                        Status     = (int)ClienterBalanceRecordStatus.Tradeing, //流水状态(1、交易成功 2、交易中)
                        RecordType = (int)ClienterBalanceRecordRecordType.WithdrawApply,
                        Operator   = clienter.TrueName,
                        WithwardId = withwardId,
                        RelationNo = withwardNo,
                        Remark     = "骑士提现"
                    });
                    #endregion

                    #region 骑士提现记录

                    _clienterWithdrawLogDao.Insert(new ClienterWithdrawLog()
                    {
                        WithwardId = withwardId,
                        Status     = (int)ClienterWithdrawFormStatus.WaitAllow,//待审核
                        Remark     = "骑士发起提现操作",
                        Operator   = clienter.TrueName
                    }); //更新骑士表的余额,可提现余额
                    #endregion
                    tran.Complete();
                }
                return(ResultModel <object> .Conclude(FinanceWithdrawC.Success));;
            }
        }
 /// <summary>
 /// 修改一条记录
 ///<param name="clienterFinanceAccount">要修改的对象</param>
 /// </summary>
 public void Modify(ClienterFinanceAccount clienterFinanceAccount)
 {
     _clienterFinanceAccountDao.Update(clienterFinanceAccount);
 }
 /// <summary>
 /// 新增一条记录
 ///<param name="clienterFinanceAccount">要新增的对象</param>
 /// </summary>
 public int Create(ClienterFinanceAccount clienterFinanceAccount)
 {
     return(_clienterFinanceAccountDao.Insert(clienterFinanceAccount));
 }