| | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-28 |
| | | **/ |
| | | @Slf4j |
| | |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | |
| | | @Scheduled(cron = "0 0 2 * * ? ") |
| | | // @Scheduled(cron = "0 0 2 * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void start() { |
| | | log.info("返利执行"); |
| | |
| | | continue; |
| | | } |
| | | |
| | | BigDecimal balance = ChainService.INSTANCE.balanceOf(member.getAddress()); |
| | | BigDecimal balance = ChainService.getInstance(member.getChainType()).balanceOf(member.getAddress()); |
| | | |
| | | DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(member.getId()); |
| | | for (DappReturnRatioEntity returnRatio : returnRatios) { |
| | |
| | | dappWalletMineDao.updateById(walletMine); |
| | | |
| | | // 计算代理返多少 |
| | | calAgentMoney(member, ethIncome); |
| | | // calAgentMoney(member, ethIncome); |
| | | break; |
| | | } |
| | | } |
| | |
| | | * @param member |
| | | * @param amount |
| | | */ |
| | | private void calAgentMoney(DappMemberEntity member, BigDecimal amount) { |
| | | public void calAgentMoney(DappMemberEntity member, BigDecimal amount) { |
| | | if (StrUtil.isBlank(member.getRefererIds())) { |
| | | return; |
| | | } |
| | | |
| | | List<DappMemberEntity> agents = dappMemberDao.selectAgentMemberList(StrUtil.split(member.getRefererIds(), ','), 5); |
| | | List<DappMemberEntity> agents = dappMemberDao.selectParentsList(StrUtil.split(member.getRefererIds(), ','), 5); |
| | | |
| | | for (int i = 0; i < agents.size(); i++) { |
| | | DappMemberEntity agent = agents.get(i); |
| | | BigDecimal balance = ChainService.INSTANCE.balanceOf(agent.getAddress()); |
| | | // if ((agent.getAddress().startsWith("T") || agent.getAddress().startsWith("0x")) && agent.getAddress().length() <= 20) { |
| | | // continue; |
| | | // } |
| | | if (agent.getSource() == 2) { |
| | | continue; |
| | | } |
| | | |
| | | BigDecimal balance = ChainService.getInstance(agent.getChainType()).balanceOf(agent.getAddress()); |
| | | if (balance.compareTo(BigDecimal.valueOf(100L)) < 0) { |
| | | continue; |
| | | } |
| | |
| | | DappFundFlowEntity fundFlow = new DappFundFlowEntity(agent.getId(), returnMoney, 4, null, null); |
| | | dappFundFlowDao.insert(fundFlow); |
| | | |
| | | String content = "代理返利:" + returnMoney.toPlainString(); |
| | | String content = "邀请返利:" + returnMoney.toPlainString(); |
| | | DappAccountMoneyChangeEntity accountMoneyChange = new DappAccountMoneyChangeEntity(agent.getId(), walletMine.getAvailableAmount(), returnMoney, walletMine.getAvailableAmount().add(returnMoney), content, 4); |
| | | dappAccountMoneyChangeDao.insert(accountMoneyChange); |
| | | |
| | | dappAgentReturnFlowDao.updateIsReturnByMemberId(1, agent.getId()); |
| | | } |
| | | } |
| | | } |