/**
  * [创建一个提现纪录信息]
  *
  * @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;
 }
 /**
  * [获取财富账户明细列表-支持分页]
  *
  * @param financeAccountDetailCriteria [财富账户明细查询条件封装实例]
  * @return
  * @throws Exception
  */
 public EasyUiPagerResult getFinanceAccountDetailWithPage(
     FinanceAccountDetailCriteria financeAccountDetailCriteria) throws Exception {
   // 申明变量
   EasyUiPagerResult result = null;
   List<FinanceAccountDetail> list = null;
   Integer num = 0;
   // 判断参数合法性
   if (null == financeAccountDetailCriteria) {
     throw new ParamErrorException(ServiceErrorCodeConstant.E0042);
   } else {
     result = new EasyUiPagerResult();
     list = this.financeDao.selectFinanceAccountDetailWithPage(financeAccountDetailCriteria);
     num = this.financeDao.countFinanceAccountDetailWithPage(financeAccountDetailCriteria);
     result.setTotal(num);
     result.setRows(list);
     // 如果需要加载用户信息
     if (YesOrNoEnum.YES.getCode().equals(financeAccountDetailCriteria.getRequirePassport())) {
       for (int i = 0; i < list.size(); i++) {
         Passport passport = null;
         passport = this.hibernateTemplate.get(Passport.class, list.get(i).getPassportId());
         list.get(i).setPassport(passport);
       }
     }
   }
   return result;
 }
 /**
  * [创建一个充值纪录信息]
  *
  * @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;
 }
 /**
  * [审核充值记录]
  *
  * @param financeAccountDetailId [充值记录实例]
  * @param flag [是否通过标志]
  * @return
  * @throws Exception
  */
 public boolean judgeFinanceAccountDetail(Integer financeAccountDetailId, boolean flag)
     throws Exception {
   // 申明变量
   FinanceAccountDetail detail = null;
   boolean result = false;
   // 判断参数合法性
   if (NumberUtil.isEmptyOrZero(financeAccountDetailId)) {
     throw new ParamErrorException(ServiceErrorCodeConstant.E0044);
   } else {
     // 获取指定的账户和明细信息
     detail = this.hibernateTemplate.load(FinanceAccountDetail.class, financeAccountDetailId);
     if (YesOrNoEnum.YES.getCode().equals(detail.getRequireJudgement())) {
       if (FinanceAccountDetailTypeEnum.RECHARGE.getCode().equals(detail.getType())) { // 如果是审核记录
         if (flag) { // 如果审核通过
           detail.setStatus(FinanceAccountDetailStatusEnum.PASS_JUDGEMENT.getCode());
           this.changeFinanceAccountMoney(
               detail.getAccountId(),
               true,
               FinanceAccountMoneyTypeEnum.CANUSE.getCode(),
               detail.getPrice());
           this.changeFinanceAccountMoney(
               detail.getAccountId(),
               false,
               FinanceAccountMoneyTypeEnum.FROZEN.getCode(),
               detail.getPrice());
         } else { // 如果审核未通过
           detail.setStatus(FinanceAccountDetailStatusEnum.REFUSE_JUDGEMENT.getCode());
           this.changeFinanceAccountMoney(
               detail.getAccountId(),
               false,
               FinanceAccountMoneyTypeEnum.FROZEN.getCode(),
               detail.getPrice());
         }
         result = true;
       } else if (FinanceAccountDetailTypeEnum.WITHDRAW.getCode().equals(detail.getType())) {
         if (flag) { // 如果审核通过
           detail.setStatus(FinanceAccountDetailStatusEnum.PASS_JUDGEMENT.getCode());
           this.changeFinanceAccountMoney(
               detail.getAccountId(),
               false,
               FinanceAccountMoneyTypeEnum.FROZEN.getCode(),
               detail.getPrice());
         } else { // 如果审核未通过
           detail.setStatus(FinanceAccountDetailStatusEnum.REFUSE_JUDGEMENT.getCode());
           this.changeFinanceAccountMoney(
               detail.getAccountId(),
               true,
               FinanceAccountMoneyTypeEnum.CANUSE.getCode(),
               detail.getPrice());
           this.changeFinanceAccountMoney(
               detail.getAccountId(),
               false,
               FinanceAccountMoneyTypeEnum.FROZEN.getCode(),
               detail.getPrice());
         }
         result = true;
       }
     }
   }
   return result;
 }