| | |
| | | import cc.mrbird.febs.dapp.mapper.DappStorageMapper; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.vo.ApidirectNumVo; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | |
| | | .limit(10) |
| | | .collect(Collectors.toList()); |
| | | |
| | | int startNum = 1; |
| | | List<ApidirectNumVo> apiDirectInfoVos = new ArrayList<>(); |
| | | for (Map.Entry<Long, BigDecimal> entry : topTenEntries) { |
| | | |
| | | Long memberId = entry.getKey(); |
| | | BigDecimal directAchieve = entry.getValue(); |
| | | BigDecimal directCnt = entry.getValue(); |
| | | ApidirectNumVo apiDirectInfoVo = new ApidirectNumVo(); |
| | | apiDirectInfoVo.setMemberId(memberId); |
| | | apiDirectInfoVo.setDirectCnt(directCnt); |
| | | DappStorage dappStorage = dappStorageMapper.selectNewRecordByRefMemberId(memberId); |
| | | apiDirectInfoVo.setCreateTime(dappStorage.getCreateTime()); |
| | | apiDirectInfoVos.add(apiDirectInfoVo); |
| | | } |
| | | |
| | | if(CollUtil.isNotEmpty(apiDirectInfoVos)){ |
| | | apiDirectInfoVos = apiDirectInfoVos.stream() |
| | | .sorted((a, b) -> { |
| | | // 先按照amount从大到小排序 |
| | | int compare = b.getDirectCnt().compareTo(a.getDirectCnt()); |
| | | if (compare != 0) { |
| | | return compare; |
| | | } |
| | | // 如果amount相同,则按照createTime从小到大排序 |
| | | return a.getCreateTime().compareTo(b.getCreateTime()); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | int startNum = 1; |
| | | for (ApidirectNumVo numVo : apiDirectInfoVos) { |
| | | Long memberId = numVo.getMemberId(); |
| | | BigDecimal directAchieve = numVo.getDirectCnt(); |
| | | //第一名 |
| | | if(startNum == 1){ |
| | | BigDecimal bigDecimal = directTotal.multiply(new BigDecimal("0.4")).setScale(2, BigDecimal.ROUND_DOWN); |