Ejemplo n.º 1
0
 /**
  * [创建一个提现纪录信息]
  *
  * @param financeAccountDetail [需要创建的充值纪录实例]
  * @return
  * @throws Exception
  */
 public Integer createWithdrawDetail(FinanceAccountDetail financeAccountDetail) throws Exception {
   // 申明变量
   Integer id = 0;
   FinanceAccount financeAccount = null;
   // 检查参数合法性
   if (null == financeAccountDetail) {
     throw new ParamErrorException(ServiceErrorCodeConstant.E0038);
   } else {
     // 获取对应的账户信息
     financeAccount =
         this.hibernateTemplate.load(FinanceAccount.class, financeAccountDetail.getAccountId());
     // 判断提现金额
     if (financeAccount.getCanUseMoney() >= financeAccountDetail.getPrice()) {
       // 预设信息
       financeAccountDetail.setType(FinanceAccountDetailTypeEnum.WITHDRAW.getCode());
       financeAccountDetail.setStatus(FinanceAccountDetailStatusEnum.WAIT_JUDGEMENT.getCode());
       financeAccountDetail.setDstatus(DataStatusEnum.NORMAL.getCode());
       financeAccountDetail.setRequireJudgement(YesOrNoEnum.YES.getCode());
       // 执行保存操作
       id = (Integer) this.createFinanceAccountDetail(financeAccountDetail);
       // 冻结金额
       financeAccount.setCanUseMoney(
           financeAccount.getCanUseMoney() - financeAccountDetail.getPrice());
       financeAccount.setFrozenMoney(
           financeAccount.getFrozenMoney() + financeAccountDetail.getPrice());
     } else {
       throw new ProcessErrorException(ServiceErrorCodeConstant.E0089);
     }
   }
   return id;
 }
Ejemplo n.º 2
0
 /**
  * [创建一个充值纪录信息]
  *
  * @param financeAccountDetail [需要创建的充值纪录实例]
  * @return
  * @throws Exception
  */
 public Integer createTempRechargeDetail(FinanceAccountDetail financeAccountDetail)
     throws Exception {
   // 申明变量
   Integer id = null;
   // 检查参数合法性
   if (null == financeAccountDetail) {
     throw new ParamErrorException(ServiceErrorCodeConstant.E0038);
   } else {
     // 预设信息
     financeAccountDetail.setType(FinanceAccountDetailTypeEnum.RECHARGE.getCode());
     financeAccountDetail.setStatus(FinanceAccountDetailStatusEnum.WAIT_JUDGEMENT.getCode());
     // 默认删除状态
     financeAccountDetail.setDstatus(DataStatusEnum.TEMP.getCode());
     financeAccountDetail.setRequireJudgement(YesOrNoEnum.YES.getCode());
     // 执行保存操作
     id = (Integer) this.createFinanceAccountDetail(financeAccountDetail);
   }
   return id;
 }