Helius
2022-06-13 8b854ff5dfae5bb3066380a461b6e972b9fa502d
fix maker distrib
4 files modified
51 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java 32 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/SlipSettingVo.java 12 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappMemberDao.xml 5 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java
@@ -38,4 +38,6 @@
    BigDecimal selectChildHoldAmount(@Param("inviteId") String inviteId);
    IPage<TeamListVo> selectTeamListInPage(@Param("record") TeamListDto teamListDto, Page<TeamListDto> page);
    List<DappMemberEntity> selectMakerAddress();
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -196,7 +196,6 @@
                }
                BigDecimal total = distrbAmount.multiply(new BigDecimal(distribDic.getValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
                OnlineTransferUtil.addTransfer(parent.getAddress(), total, fundflow.getType(), 1, ChainEnum.BSC_TFC_SOURCE.name(), AppContants.SYMBOL_COIN, batchNo);
                DappFundFlowEntity distribFlow = new DappFundFlowEntity(parent.getId(), total, 4, 2, BigDecimal.ZERO);
@@ -207,9 +206,38 @@
            }
        }
        // 铸池滑点金额
        BigDecimal makerAmount = distrbAmount.multiply(slipSetting.getMakeProp().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
        log.info("铸池滑点金额:{}", makerAmount);
        if (makerAmount.compareTo(BigDecimal.ZERO) > 0) {
            List<DappMemberEntity> makerAddress = dappMemberDao.selectMakerAddress();
            if (CollUtil.isNotEmpty(makerAddress)) {
                BigDecimal totalMaker = BigDecimal.ZERO;
                Map<String, BigDecimal> map = new HashMap<>();
                Map<String, Long> addressAndId = new HashMap<>();
                for (DappMemberEntity maker : makerAddress) {
                    BigDecimal balance = instance.balanceOf(maker.getAddress());
                    map.put(maker.getAddress(), balance);
                    addressAndId.put(maker.getAddress(), maker.getId());
                    totalMaker = totalMaker.add(balance);
                }
                for (Map.Entry<String, BigDecimal> entry : map.entrySet()) {
                    BigDecimal target = makerAmount.multiply(entry.getValue().divide(totalMaker, 2, RoundingMode.HALF_UP));
                    OnlineTransferUtil.addTransfer(entry.getKey(), target, fundflow.getType(), 1, ChainEnum.BSC_TFC_SOURCE.name(), AppContants.SYMBOL_COIN, batchNo);
                    DappFundFlowEntity distribFlow = new DappFundFlowEntity(addressAndId.get(entry.getKey()), target, 4, 2, BigDecimal.ZERO);
                    dappFundFlowDao.insert(distribFlow);
                }
            }
        }
        // 若节点金额还有剩余,则进入技术金额
        techAmount = techAmount.add(nodeAmount);
        OnlineTransferUtil.addTransfer(ChainEnum.BSC_TFC_TECH.getAddress(), techAmount, fundflow.getType(), 2, ChainEnum.BSC_TFC_SOURCE.name(), AppContants.SYMBOL_COIN, batchNo);
        OnlineTransferUtil.addTransfer(ChainEnum.BSC_TFC_TECH.getAddress(), techAmount, fundflow.getType(), 3, ChainEnum.BSC_TFC_SOURCE.name(), AppContants.SYMBOL_COIN, batchNo);
        Map<String, String> map = new HashMap<>();
        map.put("batchNo", batchNo);
src/main/java/cc/mrbird/febs/dapp/vo/SlipSettingVo.java
@@ -12,24 +12,28 @@
public class SlipSettingVo {
    /**
     * 交易滑点 8%
     * 交易滑点 10%
     */
    private BigDecimal allPoint;
    /**
     * 销毁滑点 8% 中 的八分之一
     * 销毁滑点 10% 中 的2
     */
    private BigDecimal destroyPoint;
    /**
     * 分发滑点 8% 中的 八分之七
     * 分发滑点 10% 中的 8
     */
    private BigDecimal distrbPoint;
    /**
     * 技术比例 分发滑点中的 20%
     * 技术比例 分发滑点中的 10%
     */
    private BigDecimal techProp;
    /**
     * 铸池用户滑点 分发滑点中的 10%
     */
    private BigDecimal makeProp;
    /**
     * 创始方比例 分发滑点中的 80%
src/main/resources/mapper/dapp/DappMemberDao.xml
@@ -120,4 +120,9 @@
        from dapp_member a
        where find_in_set(#{record.inviteId}, a.fee_profit_ids)
    </select>
    <select id="selectMakerAddress" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select * from dapp_member
        where maker_type=2 and account_type='normal'
    </select>
</mapper>