src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Map; @@ -19,6 +18,8 @@ DappFundFlowEntity selectByFromHash(@Param("txHash") String txHash, @Param("status") Integer status); DappFundFlowEntity selectByFromHashAndAndMemberId(@Param("txHash") String txHash, @Param("status") Integer status,@Param("memberId") Long memberId); List<DappFundFlowEntity> selectFundFlowListByAddress(@Param("address") String address, @Param("status") Integer status); Map<String, BigDecimal> selectAmountTotalByType(@Param("memberId") Long memberId); src/main/java/cc/mrbird/febs/dapp/service/impl/BscUsdtContractEvent.java
@@ -155,11 +155,16 @@ if (e.from.equals("0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3")) { return; } String toAddress = e.to; DappMemberEntity fromMember = dappMemberDao.selectByAddress(toAddress, null); if(ObjectUtil.isEmpty(fromMember)){ return; } BigInteger tokens = e.tokens; BigDecimal amount = new BigDecimal(tokens.toString()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); DappFundFlowEntity fundFlow = dappFundFlowDao.selectByFromHash(e.log.getTransactionHash(), null); DappFundFlowEntity fundFlow = dappFundFlowDao.selectByFromHashAndAndMemberId(e.log.getTransactionHash(), null,fromMember.getId()); if(ObjectUtil.isNotEmpty(fundFlow) && 1 == fundFlow.getStatus()){ log.info("触发USDT合约监听事件-买入贡献值,金额:{}",amount); if(1 == fundFlow.getType()){//认购贡献值 1 @@ -186,7 +191,7 @@ return; } fundFlow.setAmount(fundFlow.getAmount().negate()); // fundFlow.setAmount(fundFlow.getAmount().negate()); // 更改状态为已同步 fundFlow.setStatus(2); dappFundFlowDao.updateById(fundFlow); src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -42,6 +42,14 @@ </if> </select> <select id="selectByFromHashAndAndMemberId" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity"> select * from dapp_fund_flow where from_hash=#{txHash} and member_id = #{memberId} <if test="status != null"> and status=#{status} </if> </select> <select id="selectFundFlowListByAddress" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity"> select * from dapp_fund_flow a, dapp_member b where b.address=#{address}