| | |
| | | parents = new ArrayList<>(); |
| | | } else { |
| | | List<String> inviteIds = StrUtil.split(member.getRefererId(), ','); |
| | | parents = dappMemberDao.selectParentsList(inviteIds, 6);; |
| | | parents = dappMemberDao.selectParentsList(inviteIds, 6); |
| | | ; |
| | | } |
| | | |
| | | DataDictionaryCustom miniHoldCoin = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(AppContants.DIC_TYPE_SYSTEM_SETTING, AppContants.DIC_VALUE_MINI_HOLD_COIN_LIMIT); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void idoBuy(DappMemberEntity member, BigDecimal amount) { |
| | | DappIdoAssetsEntity idoAssets = dappIdoAssetsDao.selectByMemberId(member.getId()); |
| | | boolean isFirst = false; |
| | | if (idoAssets.getCoinAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | isFirst = true; |
| | | } |
| | | |
| | | BigDecimal count = amount.divide(new BigDecimal(50), 0, RoundingMode.HALF_UP); |
| | | BigDecimal coinAmount = new BigDecimal(1000).multiply(count); |
| | | idoAssets.setCoinAmount(idoAssets.getCoinAmount().add(coinAmount)); |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | int box = 0; |
| | | // 需要第一次购买,才在推荐中加1 |
| | | if (isFirst) { |
| | | Object parentRecommend = redisUtils.hget(AppContants.IDO_MEMBER_RECOMMEND_CNT, parent.getAddress()); |
| | | if (parentRecommend == null) { |
| | | redisUtils.hset(AppContants.IDO_MEMBER_RECOMMEND_CNT, parent.getAddress(), 1); |
| | |
| | | int i = (int) parentRecommend; |
| | | |
| | | // 如果超过10个,则新增一个盲盒,并重置推荐人数 |
| | | if (++i == 10) { |
| | | if (++i == 3) { |
| | | box = 1; |
| | | redisUtils.hset(AppContants.IDO_MEMBER_RECOMMEND_CNT, parent.getAddress(), 1); |
| | | } else { |
| | |
| | | DappFundFlowEntity boxFundFlow = new DappFundFlowEntity(parent.getId(), new BigDecimal(box), 5, 2, BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(boxFundFlow); |
| | | } |
| | | } |
| | | |
| | | BigDecimal returnCoin = coinAmount.multiply(new BigDecimal(5).divide(new BigDecimal(100), 2, RoundingMode.UP)); |
| | | DappIdoAssetsEntity parentIdoAssets = dappIdoAssetsDao.selectById(parent.getId()); |
| | | DappIdoAssetsEntity parentIdoAssets = dappIdoAssetsDao.selectByMemberId(parent.getId()); |
| | | parentIdoAssets.setBoxCnt(parentIdoAssets.getBoxCnt() + box); |
| | | parentIdoAssets.setCoinAmount(parentIdoAssets.getCoinAmount().add(returnCoin)); |
| | | dappIdoAssetsDao.updateById(parentIdoAssets); |