| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateEthUsdtNew(EthUsdtChargeDto ethUsdtChargeDto) { |
| | | String address = ethUsdtChargeDto.getAddress(); |
| | | String hash = ethUsdtChargeDto.getHash(); |
| | | // hash没有用过 |
| | | Map<String,Object> param = new HashMap<>(); |
| | | param.put("hash",hash); |
| | | param.put("address",address); |
| | | List<MemberCoinChargeEntity> memberCoinChargeEntities = memberCoinChargeDao.selectByMap(param); |
| | | if(CollectionUtils.isNotEmpty(memberCoinChargeEntities)){ |
| | | return; |
| | | } |
| | | MemberCoinAddressEntity coinAddressEntity = memberCoinAddressDao.selectBlockAddressWithTag(null, CoinTypeEnum.USDT.toString(), "ERC20"); |
| | | if (coinAddressEntity == null) { |
| | | return; |
| | | } |
| | | Long memberId = coinAddressEntity.getMemberId(); |
| | | BigDecimal balance = ethUsdtChargeDto.getBalance(); |
| | | if (balance != null && balance.compareTo(new BigDecimal("0.1")) > 0) { |
| | | balance = balance.setScale(8, RoundingMode.CEILING); |
| | | BigDecimal early = BigDecimal.ZERO; |
| | | |
| | | MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.USDT.name()); |
| | | if (walletCoinEntity == null) { |
| | | return; |
| | | } |
| | | BigDecimal newBalance = balance.subtract(early); |
| | | memberWalletCoinDao.updateBlockBalance(walletCoinEntity.getId(), newBalance, balance, 0); |
| | | String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "ERC20", balance, ethUsdtChargeDto.getHash()); |
| | | // 插入财务记录 |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.USDT.name(), 1, 1); |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | String amount = newBalance.toPlainString() + "USDT-ERC20"; |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | private String generateNo() { |
| | | // 生成订单号 |
| | | Long timestamp = System.currentTimeMillis(); |