KKSU
2024-08-06 609d2e5f259aeb07b9579fb0ea0c01dd36b482d0
src/main/java/cc/mrbird/febs/job/ProfitDailyJob.java
@@ -11,6 +11,7 @@
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;
@@ -105,6 +106,8 @@
        if(2 == Integer.parseInt(symbolDic.getValue())){
            return;
        }
        symbolDic.setValue("2");
        dataDictionaryCustomMapper.updateById(symbolDic);
        DataDictionaryCustom buChangChiDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.BUCAHNG_CHI.getType(),
@@ -154,9 +157,6 @@
        }
        buChangChiDic.setValue(buChangAmountTotal.subtract(surplusAmount).setScale(2,BigDecimal.ROUND_DOWN).toString());
        dataDictionaryCustomMapper.updateById(buChangChiDic);
        symbolDic.setValue("2");
        dataDictionaryCustomMapper.updateById(symbolDic);
    }
    /**
@@ -280,10 +280,16 @@
        HashMap<Long, BigDecimal> map = new HashMap<>();
        DateTime startTime = DateUtil.offsetHour(new Date(), -24);
        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime);
//        DateTime startTime = DateUtil.parseDateTime(startTimeStr);
//        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime);
        if(CollUtil.isNotEmpty(dappMemberEntityList)){
            for(DappMemberEntity member : dappMemberEntityList){
        List<DappStorage> dappStorages = dappStorageMapper.selectListByDateFiveToFiver(startTime);
        Set<Long> collect = dappStorages.stream().map(DappStorage::getMemberId).collect(Collectors.toSet());
//        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date());
        if(CollUtil.isNotEmpty(collect)){
            for(Long memberId : collect){
                DappMemberEntity member = dappMemberDao.selectById(memberId);
                if(StrUtil.isEmpty(member.getRefererId())){
                    continue;
                }
@@ -314,11 +320,36 @@
                    .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);