| | |
| | | import cc.mrbird.febs.common.enumerates.MallMoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.chain.constants.ChainConstants; |
| | | import cc.mrbird.febs.mall.chain.enums.ChainEnum; |
| | | import cc.mrbird.febs.mall.chain.enums.CoinTypeEnum; |
| | | import cc.mrbird.febs.mall.entity.MallMemberWallet; |
| | |
| | | import cc.mrbird.febs.mall.mapper.MemberCoinAddressDao; |
| | | import cc.mrbird.febs.mall.mapper.MemberCoinChargeDao; |
| | | import cc.mrbird.febs.mall.service.IMallMoneyFlowService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | |
| | | String address = e.to; |
| | | String hash = e.log.getTransactionHash(); |
| | | MemberCoinAddressEntity coinAddressEntity = memberCoinAddressDao.selectCoinAddressByAddressAndSymbol(address, CoinTypeEnum.USDT.toString()); |
| | | if (coinAddressEntity == null) { |
| | | return; |
| | | } |
| | | |
| | | Set<Object> addressList = redisUtils.sGet(ChainConstants.REDIS_KEY_SYSTEM_ADDRESS); |
| | | // 判断对方打款地址是否为源池地址 |
| | | if(ObjectUtil.isNotEmpty(coinAddressEntity)){ |
| | | // if (ChainEnum.BSC_USDT.getAddress().toLowerCase().equals(e.to)) { |
| | | if(CollUtil.isNotEmpty(addressList) && addressList.contains(address)){ |
| | | log.info("触发USDT合约监听事件"); |
| | | redisUtils.set(AppContants.REDIS_KEY_BLOCK_ETH_INCREMENT_NUM, e.log.getBlockNumber()); |
| | | // hash没有用过 |
| | |
| | | return; |
| | | } |
| | | |
| | | // MemberCoinAddressEntity coinAddressEntity = memberCoinAddressDao.selectCoinAddressByAddressAndSymbol(address, CoinTypeEnum.USDT.toString()); |
| | | // if (coinAddressEntity == null) { |
| | | // return; |
| | | // } |
| | | MemberCoinAddressEntity coinAddressEntity = memberCoinAddressDao.selectCoinAddressByAddressAndSymbol(address, CoinTypeEnum.USDT.toString()); |
| | | if (coinAddressEntity == null) { |
| | | return; |
| | | } |
| | | Long memberId = coinAddressEntity.getMemberId(); |
| | | ContractChainService sourceUsdtInstance = ChainService.getInstance(ChainEnum.BSC_USDT.name()); |
| | | int decimals = sourceUsdtInstance.decimals(); |
| | |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | MallMoneyFlowTypeEnum.CHARGE.getName() |
| | | ); |
| | | // 同步 |
| | | // BigDecimal bigDecimal = ChainService.getInstance(ChainEnum.BSC_USDT.name()).balanceOf(e.to); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | public String insertCoinCharge(String address, Long memberId, BigDecimal newBalance, String symbol, String tag, BigDecimal lastAmount, String hash) { |
| | | MemberCoinChargeEntity memberCoinChargeEntity = new MemberCoinChargeEntity(); |
| | | memberCoinChargeEntity.setAddress(address); |