KKSU
2024-07-09 a9f98642c8ec0d92cdb2aa3500377c97b89dbc71
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -18,6 +18,7 @@
import cc.mrbird.febs.dapp.vo.*;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -245,14 +246,18 @@
        if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){
            throw new FebsException("额度不足");
        }
        if(BigDecimal.ZERO.compareTo(withdrawDto.getAmount()) >= 0){
            throw new FebsException("请输入正确的数量");
        }
        if(withdrawDto.getAmount().compareTo(usdtBalance) > 0){
            throw new FebsException("额度不足");
        }
        List<MemberCoinWithdrawEntity> memberCoinWithdrawEntities = memberCoinWithdrawDao.selectListByDate(member.getId(),new Date());
        if(CollUtil.isNotEmpty(memberCoinWithdrawEntities)){
            throw new FebsException("今日已提现");
        }
//        List<MemberCoinWithdrawEntity> memberCoinWithdrawEntities = memberCoinWithdrawDao.selectListByDate(member.getId(),new Date());
//        if(CollUtil.isNotEmpty(memberCoinWithdrawEntities)){
//            throw new FebsException("今日已提现");
//        }
        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
        if (walletCoin.getAvailableAmount().compareTo(withdrawDto.getAmount()) < 0) {
@@ -408,6 +413,19 @@
        String upgrade = redisUtils.getString("APP_UPGRADE");
        if ("upgrade".equals(upgrade)) {
            throw new FebsException("功能升级中");
        }
        DataDictionaryCustom startSymbolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.START_SYMBOL.getType(),
                DataDictionaryEnum.START_SYMBOL.getCode()
        );
        if("STOP".equals(startSymbolDic.getValue())){
            throw new FebsException("贡献暂未开启");
        }
        DateTime startTime = DateUtil.parseDateTime("2024-07-09 17:00:00");
        if(DateUtil.compare(DateUtil.date(), startTime) < 0){
            throw new FebsException("贡献暂未开启");
        }
        BigDecimal amount = transferDto.getAmount();
@@ -677,10 +695,14 @@
                DataDictionaryEnum.BUCAHNG_CHI.getType(),
                DataDictionaryEnum.BUCAHNG_CHI.getCode()
        ).getValue());
        apiIndexInfoVo.setJiedianChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.JIE_DIAN_CHI.getType(),
                DataDictionaryEnum.JIE_DIAN_CHI.getCode()
        ).getValue());
        List<DappStorage> dappStorages = dappStorageMapper.selectList(null);
        BigDecimal reduce = dappStorages.stream().map(DappStorage::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2,BigDecimal.ROUND_DOWN);
        apiIndexInfoVo.setJiedianChi(reduce.toString());
//        apiIndexInfoVo.setJiedianChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                DataDictionaryEnum.JIE_DIAN_CHI.getType(),
//                DataDictionaryEnum.JIE_DIAN_CHI.getCode()
//        ).getValue());
        apiIndexInfoVo.setJijinghuiChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.JI_JING_HUI_CHI.getType(),
                DataDictionaryEnum.JI_JING_HUI_CHI.getCode()
@@ -695,7 +717,19 @@
    @Override
    public List<ApiStorageInfoVo> storageIndex() {
        List<ApiStorageInfoVo> apiStorageInfoVos = new ArrayList<>();
        List<DappStorage> dappStorages = dappStorageMapper.selectSumByAmountDesc(DateUtil.offsetHour(new Date(), -1), 0, 10);
        DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(new Date()));
        DateTime perkTime = DateUtil.parseTime("17:00:00");
        String startTimeStr = null;
        if(DateUtil.compare(nowTime,perkTime) >= 0){
            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), 0)) + " 17:00:00";
        }else{
            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), -1)) + " 17:00:00";
        }
        DateTime startTime = DateUtil.parseDateTime(startTimeStr);
        List<DappStorage> dappStorages = dappStorageMapper.selectSumByAmountDescFiveToFive(startTime, 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();
@@ -769,12 +803,27 @@
         */
        HashMap<Long, BigDecimal> map = new HashMap<>();
        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date());
        DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(new Date()));
        DateTime perkTime = DateUtil.parseTime("17:00:00");
        String startTimeStr = null;
        if(DateUtil.compare(nowTime,perkTime) >= 0){
            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), 0)) + " 17:00:00";
        }else{
            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), -1)) + " 17:00:00";
        }
        DateTime startTime = DateUtil.parseDateTime(startTimeStr);
        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime);
//        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date());
        if(CollUtil.isNotEmpty(dappMemberEntityList)){
            for(DappMemberEntity member : dappMemberEntityList){
                if(StrUtil.isEmpty(member.getRefererId())){
                    continue;
                }
                if(2 == member.getActiveStatus()){
                    continue;
                }
                DappMemberEntity memberRef = dappMemberDao.selectMemberInfoByInviteId(member.getRefererId());
                if(ObjectUtil.isEmpty(memberRef)){
                    continue;