/**
  * [修改财富账户金额]
  *
  * @param accountId [财富账户标识]
  * @param flag [加值、减值标志]
  * @param moneyType [需要影响的金额类型]
  * @param price [具体金额]
  * @return
  * @throws Exception
  */
 public boolean changeFinanceAccountMoney(
     Integer accountId, boolean flag, String moneyType, Double price) throws Exception {
   // 申明变量
   boolean result = false;
   FinanceAccount financeAccount = null;
   // 判断参数合法性
   if (NumberUtil.isEmptyOrZero(accountId) || StringUtil.isEmpty(moneyType)) {
     throw new ParamErrorException(ServiceErrorCodeConstant.E0039);
   } else {
     // 获取财富账户、持久化状态
     financeAccount = this.hibernateTemplate.load(FinanceAccount.class, accountId);
     // 判断金额类型-并根据加减标志进行更改
     if (FinanceAccountMoneyTypeEnum.CANUSE.getCode().equals(moneyType)) {
       if (flag) {
         financeAccount.setCanUseMoney(financeAccount.getCanUseMoney() + price);
       } else {
         financeAccount.setCanUseMoney(financeAccount.getCanUseMoney() - price);
       }
     }
     if (FinanceAccountMoneyTypeEnum.FROZEN.getCode().equals(moneyType)) {
       if (flag) {
         financeAccount.setFrozenMoney(financeAccount.getFrozenMoney() + price);
       } else {
         financeAccount.setFrozenMoney(financeAccount.getFrozenMoney() - price);
       }
     }
     result = true;
   }
   return result;
 }
 /**
  * [创建财富账户]
  *
  * @param financeAccount [需要创建的财富账户实例]
  * @return
  * @throws Exception
  */
 public boolean createFinanceAcount(FinanceAccount financeAccount) throws Exception {
   // 申明变量
   boolean flag = false;
   boolean isExist = false;
   // 验证参数是否合法
   if (null == financeAccount || !financeAccount.validate()) {
     throw new ParamErrorException(ServiceErrorCodeConstant.E0035);
   } else {
     // 首先判断财富账户是否已经存在
     isExist = this.isFinanceAccountExist(financeAccount);
     if (isExist) { // 如果已经存在
       throw new ProcessErrorException(ServiceErrorCodeConstant.E0036);
     } else { // 如果不存在
       // 设定默认参数
       financeAccount.setDstatus(DataStatusEnum.NORMAL.getCode());
       // 默认账户没钱
       financeAccount.setCanUseMoney(0.0);
       financeAccount.setFrozenMoney(0.0);
       // 执行创建
       this.hibernateTemplate.save(financeAccount);
       flag = true;
     }
   }
   return flag;
 }
 /**
  * [创建一个提现纪录信息]
  *
  * @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;
 }