KKSU
2024-04-01 9471f6e4286ce7e9f2d879951603d14c578d839f
每人每日质押设置
6 files modified
76 ■■■■■ changed files
src/main/java/cc/mrbird/febs/common/enumerates/DataDicEnum.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/controller/ViewBannerController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 30 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/CoinSetVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/banner/coinSet.html 19 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/enumerates/DataDicEnum.java
@@ -10,6 +10,8 @@
 */
@Getter
public enum DataDicEnum {
    MEMBER_ZHIYA_AMOUNT("MEMBER_ZHIYA_AMOUNT","每日DAPP质押金额"),//1
    MEMBER_ZHIYA_TIME("MEMBER_ZHIYA_TIME","每日DAPP质押次数"),//1
    GFA_DAYS("GFA_DAYS","每日DAPP质押额度"),//4
    /**
     * 5%滑奖分配:
src/main/java/cc/mrbird/febs/dapp/controller/AdminBannerController.java
@@ -219,6 +219,16 @@
                DataDicEnum.GFA_DAYS.getValue(),
                coinSetVo.getGfaDays()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
                DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
                coinSetVo.getZhiyaTime()
        );
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue(),
                DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue(),
                coinSetVo.getZhiyaAmount()
        );
        return new FebsResponse().success();
    }
}
src/main/java/cc/mrbird/febs/dapp/controller/ViewBannerController.java
@@ -161,6 +161,18 @@
                        DataDicEnum.GFA_DAYS.getValue()
                ).getValue()
        );
        coinSetVo.setZhiyaTime(
                dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                        DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
                        DataDicEnum.MEMBER_ZHIYA_TIME.getValue()
                ).getValue()
        );
        coinSetVo.setZhiyaAmount(
                dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                        DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
                        DataDicEnum.MEMBER_ZHIYA_TIME.getValue()
                ).getValue()
        );
        model.addAttribute("coinSetVo", coinSetVo);
        asyncCjService.updateDataDicEnumRedis(DataDicEnum.GFA_ACHIEVE_OUT.getNameList());
        return FebsUtil.view("modules/banner/coinSet");
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -17,6 +17,7 @@
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
@@ -235,6 +236,23 @@
    @Transactional(rollbackFor = Exception.class)
    public Long transfer(TransferDto transferDto) {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        QueryWrapper<DappFundFlowEntity> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("type" ,FlowTypeEnum.ZHI_YA.getValue());
        objectQueryWrapper.eq("status" ,DappFundFlowEntity.WITHDRAW_STATUS_AGREE);
        List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectList(objectQueryWrapper);
        BigDecimal zhiyaAmount = new BigDecimal(redisUtils.getString(DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue()));
        Integer zhiyaTime = Integer.parseInt(redisUtils.getString(DataDicEnum.MEMBER_ZHIYA_TIME.getValue()));
        if(CollUtil.isNotEmpty(dappFundFlowEntities)){
            if(dappFundFlowEntities.size() >= zhiyaTime){
                throw new FebsException("今日暂停质押");
            }
            BigDecimal teamAchieveMemberSum = dappFundFlowEntities.stream().map(DappFundFlowEntity::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).negate();
            if(zhiyaAmount.compareTo(teamAchieveMemberSum.add(transferDto.getAmount())) < 0){
                throw new FebsException("今日最多质押"+zhiyaAmount.subtract(teamAchieveMemberSum).setScale(4,BigDecimal.ROUND_DOWN));
            }
        }
        String hasStart = redisUtils.getString(DataDicEnum.SYSTEM_START_FLAG.getValue());
        BigDecimal minAmount = new BigDecimal(redisUtils.getString(DataDicEnum.GFA_BUY_MIN_AMOUNT.getValue()));
@@ -253,12 +271,12 @@
                    if (transferDto.getAmount().compareTo(minAmount) < 0) {
                        throw new FebsException("超过购买限制");
                    }
                    if (BigDecimal.ZERO.compareTo(gfaDays) >= 0) {
                        throw new FebsException("今日暂停质押");
                    }
                    if (transferDto.getAmount().compareTo(gfaDays) > 0) {
                        throw new FebsException("今日最多质押"+gfaDays);
                    }
//                    if (BigDecimal.ZERO.compareTo(gfaDays) >= 0) {
//                        throw new FebsException("今日暂停质押");
//                    }
//                    if (transferDto.getAmount().compareTo(gfaDays) > 0) {
//                        throw new FebsException("今日最多质押"+gfaDays);
//                    }
                } else {
                    throw new FebsException("暂停质押");
                }
src/main/java/cc/mrbird/febs/dapp/vo/CoinSetVo.java
@@ -27,6 +27,9 @@
    private String coinAmount;
    private String usdtAmount;
    private String zhiyaTime;
    private String zhiyaAmount;
    private String hdLevel;
    private String hdWork;
    private String hdTeam;
src/main/resources/templates/febs/views/modules/banner/coinSet.html
@@ -6,6 +6,22 @@
                    <blockquote class="layui-elem-quote blue-border">质押金额范围</blockquote>
                    <div class="layui-row layui-col-space10 layui-form-item">
                        <div class="layui-col-lg6">
                            <label class="layui-form-label febs-form-item-require">质押次数:</label>
                            <div class="layui-input-block">
                                <input type="text" name="zhiyaTime" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-word-aux" style="margin-left: 150px;">每日质押次数</div>
                        </div>
                        <div class="layui-col-lg6">
                            <label class="layui-form-label febs-form-item-require">质押总额:</label>
                            <div class="layui-input-block">
                                <input type="text" name="zhiyaAmount" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-word-aux" style="margin-left: 150px;">每日质押总额</div>
                        </div>
                    </div>
                    <div class="layui-row layui-col-space10 layui-form-item">
                        <div class="layui-col-lg6">
                            <label class="layui-form-label febs-form-item-require">最小值:</label>
                            <div class="layui-input-block">
                                <input type="text" name="minAmount" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
@@ -221,6 +237,9 @@
                "hdTeam": coinSetVo.hdTeam,
                "hdSelf": coinSetVo.hdSelf,
                "zhiyaTime": coinSetVo.zhiyaTime,
                "zhiyaAmount": coinSetVo.zhiyaAmount,
                "coinAmount": coinSetVo.coinAmount,
                "usdtAmount": coinSetVo.usdtAmount,