| | |
| | | |
| | | @Override |
| | | public void updateEos() { |
| | | // 获取上次读取的序号 |
| | | int pos = 0; |
| | | //每次获取的条数 |
| | | int offset = 10; |
| | | |
| | | String eosSeq = redisUtils.getString(EOS_SEQ_KEY); |
| | | if (StringUtils.isNotBlank(eosSeq)) { |
| | | pos = Integer.valueOf(eosSeq); |
| | | } |
| | | // 记录最大的seq |
| | | int seq = pos; |
| | | List<EosResult> actions = EosService.getActions(pos, offset); |
| | | if (CollectionUtils.isNotEmpty(actions)) { |
| | | for (EosResult eosResult : actions) { |
| | | String to = eosResult.getTo(); |
| | | Integer accountActionSeq = eosResult.getAccountActionSeq(); |
| | | if (accountActionSeq > seq) { |
| | | seq = accountActionSeq; |
| | | } |
| | | if (!EosService.ACCOUNT.equals(to)) { |
| | | // 判断是否是收款 |
| | | continue; |
| | | } |
| | | // 处理收款 |
| | | String quantity = eosResult.getQuantity(); |
| | | String memo = eosResult.getMemo(); |
| | | if (StringUtils.isBlank(memo)) { |
| | | // 没有标记的跳过 |
| | | continue; |
| | | } |
| | | if (StringUtils.isNotBlank(quantity)) { |
| | | // 转账额 |
| | | String amountStr = quantity.split("")[0]; |
| | | BigDecimal amount = new BigDecimal(amountStr); |
| | | List<MemberCoinAddressEntity> memberCoinAddress = memberCoinAddressDao.selectAllBlockAddressBySymbolAndTag(CoinTypeEnum.EOS.name(), memo); |
| | | if (CollectionUtils.isNotEmpty(memberCoinAddress)) { |
| | | MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddress.get(0); |
| | | // 用户ID |
| | | Long memberId = memberCoinAddressEntity.getMemberId(); |
| | | MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.EOS.name()); |
| | | if (memberCoinAddressEntity != null) { |
| | | memberWalletCoinDao.updateBlockBalance(memberWalletCoinEntity.getId(), amount, BigDecimal.ZERO, 0); |
| | | // 添加冲币记录 |
| | | String orderNo = insertCoinCharge(EosService.ACCOUNT, memberId, amount, CoinTypeEnum.EOS.name(), memo, BigDecimal.ZERO, null); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", amount, CoinTypeEnum.EOS.name(), 1, 1); |
| | | |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | //String amountEos = amountStr + "EOS"; |
| | | Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } else { |
| | | SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 最后更新seq 即下次查询的起始位置 在本次最大的基础上加一 |
| | | if (seq > 0 && seq > pos) { |
| | | redisUtils.set(EOS_SEQ_KEY, seq + 1); |
| | | } |
| | | // // 获取上次读取的序号 |
| | | // int pos = 0; |
| | | // //每次获取的条数 |
| | | // int offset = 10; |
| | | // |
| | | // String eosSeq = redisUtils.getString(EOS_SEQ_KEY); |
| | | // if (StringUtils.isNotBlank(eosSeq)) { |
| | | // pos = Integer.valueOf(eosSeq); |
| | | // } |
| | | // // 记录最大的seq |
| | | // int seq = pos; |
| | | // List<EosResult> actions = EosService.getActions(pos, offset); |
| | | // if (CollectionUtils.isNotEmpty(actions)) { |
| | | // for (EosResult eosResult : actions) { |
| | | // String to = eosResult.getTo(); |
| | | // Integer accountActionSeq = eosResult.getAccountActionSeq(); |
| | | // if (accountActionSeq > seq) { |
| | | // seq = accountActionSeq; |
| | | // } |
| | | // if (!EosService.ACCOUNT.equals(to)) { |
| | | // // 判断是否是收款 |
| | | // continue; |
| | | // } |
| | | // // 处理收款 |
| | | // String quantity = eosResult.getQuantity(); |
| | | // String memo = eosResult.getMemo(); |
| | | // if (StringUtils.isBlank(memo)) { |
| | | // // 没有标记的跳过 |
| | | // continue; |
| | | // } |
| | | // if (StringUtils.isNotBlank(quantity)) { |
| | | // // 转账额 |
| | | // String amountStr = quantity.split("")[0]; |
| | | // BigDecimal amount = new BigDecimal(amountStr); |
| | | // List<MemberCoinAddressEntity> memberCoinAddress = memberCoinAddressDao.selectAllBlockAddressBySymbolAndTag(CoinTypeEnum.EOS.name(), memo); |
| | | // if (CollectionUtils.isNotEmpty(memberCoinAddress)) { |
| | | // MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddress.get(0); |
| | | // // 用户ID |
| | | // Long memberId = memberCoinAddressEntity.getMemberId(); |
| | | // MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.EOS.name()); |
| | | // if (memberCoinAddressEntity != null) { |
| | | // memberWalletCoinDao.updateBlockBalance(memberWalletCoinEntity.getId(), amount, BigDecimal.ZERO, 0); |
| | | // // 添加冲币记录 |
| | | // String orderNo = insertCoinCharge(EosService.ACCOUNT, memberId, amount, CoinTypeEnum.EOS.name(), memo, BigDecimal.ZERO, null); |
| | | // LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", amount, CoinTypeEnum.EOS.name(), 1, 1); |
| | | // |
| | | // ThreadPoolUtils.sendDingTalk(5); |
| | | // MemberEntity member = memberDao.selectById(memberId); |
| | | // if (StrUtil.isNotBlank(member.getPhone())) { |
| | | // //String amountEos = amountStr + "EOS"; |
| | | // Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | // } else { |
| | | // SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // // 最后更新seq 即下次查询的起始位置 在本次最大的基础上加一 |
| | | // if (seq > 0 && seq > pos) { |
| | | // redisUtils.set(EOS_SEQ_KEY, seq + 1); |
| | | // } |
| | | } |
| | | |
| | | @Override |
| | | public void updateXrp() { |
| | | // 首先去查redis上的上次同步时间 |
| | | Object lastUpdateTime = redisUtils.get(xrp_update_key); |