コード例 #1
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;
 }
コード例 #2
0
 /**
  * [审核充值记录]
  *
  * @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;
 }