@Override public int validator(String numbers) throws CoreException { if (StringUtil.isEmpty(numbers)) { throw new CoreException(ErrCode.E2026, ErrCode.codeToMsg(ErrCode.E2026)); } String[] items = numbers.split(";"); for (int i = 0; i < items.length; i++) { String item = items[i]; if (!item.matches("^\\d{2},\\d{2},\\d{2}$")) { throw new CoreException(ErrCode.E2033, ErrCode.codeToMsg(ErrCode.E2033) + item); } getCount(item); } return items.length; }
@Override public int validator(String numbers) throws CoreException { if (!numbers.matches("^\\d{1,2}(,\\d{1,2}){0,13}$")) { throw new CoreException(ErrCode.E2033, ErrCode.codeToMsg(ErrCode.E2033)); } String[] numArray = numbers.split(LotteryUtil.FUSHI_REG_SEP); int[] numIntArray = LotteryUtil.getIntArrayFromStrArray(numArray); LotteryUtil.checkSortFromMinToMax(numIntArray); LotteryUtil.checkMargin(numIntArray, KtConstants.HEZHI_MAX, KtConstants.HEZHI_MIN); return numArray.length; }
@Override public MoneyLog handle( Object user, String fromEntityId, String fromFlag, String toEntityId, String toFlag, long amount, String orderId, AccountOperatorType type) throws CoreException { String userId = AccountConstants.SYSTEM_USER_ID; String fromAccountCode = "RU02"; String toAccountCode = ""; int status = ConstantValues.MoneyLog_Status_FINISHED.getCode(); if (type.getType().equals("RU0210001")) { // 彩金转投注金 toAccountCode = "RU00"; } else if (type.getType().equals("RU0210000")) { // 提现,则设置账户记录为处理中 status = ConstantValues.MoneyLog_Status_HANDLING.getCode(); } CustomerAccount ca = customerAccountDao.findOne(fromEntityId); if (ca.getPrize() < amount) { throw new NoMoneyException( ErrCode.E1007, ErrCode.codeToMsg(ErrCode.E1007), ca.getRecharge(), amount); } customerAccountDao.decrPrizeById(amount, fromEntityId); long stateBefore = ca.getPrize(); long stateAfter = ca.getPrize() - amount; MoneyLog log = super.generateLog( userId, fromAccountCode, fromEntityId, toAccountCode, toEntityId, amount, orderId, type, stateBefore, stateAfter); log.setStatus(status); return moneyLogDao.save(log); }