Пример #1
0
 /**
  * [创建财富账户]
  *
  * @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;
 }