| | |
| | | throw new FebsException("功能升级中"); |
| | | } |
| | | |
| | | DataDictionaryCustom startSymbolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.START_SYMBOL.getType(), |
| | | DataDictionaryEnum.START_SYMBOL.getCode() |
| | | ); |
| | | if("STOP".equals(startSymbolDic.getValue())){ |
| | | throw new FebsException("贡献暂未开启"); |
| | | } |
| | | |
| | | BigDecimal amount = transferDto.getAmount(); |
| | | if(BigDecimal.ZERO.compareTo(amount) >= 0){ |
| | | throw new FebsException("请输入正确的存储数量"); |
| | |
| | | throw new FebsException("存储数量必须是"+bigDecimal+"的整数倍"); |
| | | } |
| | | |
| | | DappStorage dappStorage = dappStorageMapper.selectAmountByAmountDesc(0, 1); |
| | | DappStorage dappStorage = dappStorageMapper.selectAmountByAmountDesc(member.getId(),0, 1); |
| | | if(ObjectUtil.isNotEmpty(dappStorage)){ |
| | | if(amount.compareTo(dappStorage.getAmount()) < 0){ |
| | | throw new FebsException("存储数量必须大于:"+dappStorage.getAmount()); |
| | |
| | | @Override |
| | | public List<ApiStorageInfoVo> storageIndex() { |
| | | List<ApiStorageInfoVo> apiStorageInfoVos = new ArrayList<>(); |
| | | List<DappStorage> dappStorages = dappStorageMapper.selectByAmountDesc(DateUtil.offsetHour(new Date(), -1), 0, 10); |
| | | List<DappStorage> dappStorages = dappStorageMapper.selectSumByAmountDesc(DateUtil.offsetHour(new Date(), -1), 0, 10); |
| | | if(CollUtil.isNotEmpty(dappStorages)){ |
| | | for(DappStorage dappStorage : dappStorages){ |
| | | ApiStorageInfoVo apiStorageInfoVo = new ApiStorageInfoVo(); |
| | |
| | | return apiStorageInfoVos; |
| | | } |
| | | |
| | | @Override |
| | | public List<ApiDirectInfoVo> directNumIndex() { |
| | | List<ApiDirectInfoVo> apiDirectInfoVos = new ArrayList<>(); |
| | | /** |
| | | * 存放直推人数<上级的memberId,直推人数> |
| | | */ |
| | | HashMap<Long, BigDecimal> map = new HashMap<>(); |
| | | |
| | | List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date()); |
| | | if(CollUtil.isNotEmpty(dappMemberEntityList)){ |
| | | for(DappMemberEntity member : dappMemberEntityList){ |
| | | if(StrUtil.isEmpty(member.getRefererId())){ |
| | | continue; |
| | | } |
| | | DappMemberEntity memberRef = dappMemberDao.selectMemberInfoByInviteId(member.getRefererId()); |
| | | if(ObjectUtil.isEmpty(memberRef)){ |
| | | continue; |
| | | } |
| | | Long id = memberRef.getId(); |
| | | if(map.containsKey(id)){ |
| | | BigDecimal bigDecimal = map.get(id); |
| | | BigDecimal add = bigDecimal.add(new BigDecimal("1")); |
| | | map.put(id,add); |
| | | }else{ |
| | | map.put(id,new BigDecimal("1")); |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 获取这个map的直推人数前十,分发奖励 |
| | | */ |
| | | if(!map.isEmpty()){ |
| | | // 使用Stream API按照BigDecimal从大到小排序 |
| | | List<Map.Entry<Long, BigDecimal>> topTenEntries = map.entrySet().stream() |
| | | .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) |
| | | .limit(10) |
| | | .collect(Collectors.toList()); |
| | | for (Map.Entry<Long, BigDecimal> entry : topTenEntries) { |
| | | |
| | | Long memberId = entry.getKey(); |
| | | BigDecimal directCnt = entry.getValue(); |
| | | ApiDirectInfoVo apiDirectInfoVo = new ApiDirectInfoVo(); |
| | | apiDirectInfoVo.setAddress(dappMemberDao.selectById(memberId).getAddress()); |
| | | apiDirectInfoVo.setAmount(directCnt); |
| | | |
| | | apiDirectInfoVos.add(apiDirectInfoVo); |
| | | } |
| | | } |
| | | |
| | | |
| | | return apiDirectInfoVos; |
| | | } |
| | | |
| | | public MemberNodeVo buildTeamMatrix(DbMemberNode dbMemberNode) { |
| | | Long id = dbMemberNode.getId(); |
| | | |