xiaoyong931011
2022-12-05 19b525873d0e740d6ea31e939eb921bb711c8db6
20221130
8 files modified
123 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java 50 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 47 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/ApiRunListInfoVo.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/WalletInfoVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappSystemProfitDao.xml 9 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/dapp/member.html 2 ●●● patch | view | raw | blame | history
src/test/java/cc/mrbird/febs/TreeTest.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java
@@ -8,6 +8,8 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DappSystemProfitDao extends BaseMapper<DappSystemProfit> {
    DappSystemProfit selectSystemProfitByState(@Param("state") int stateOut);
@@ -27,4 +29,6 @@
    IPage<AdminDappSystemProfitVo> selectSystemProfitInPage(@Param("record")DappSystemProfit dappSystemProfit, Page<AdminDappSystemProfitVo> page);
    IPage<AdminSystemProfitFlowListVo> selectSystemProfitFlowListInPage(@Param("record")DappSystemProfit dappSystemProfit, Page<AdminSystemProfitFlowListVo> page);
    List<DappSystemProfit> selectDappSysstemProfitByState(@Param("state")int stateIn);
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java
@@ -398,31 +398,31 @@
    @Override
    public ApiRunListInfoVo findRunListInfo() {
        ApiRunListInfoVo apiRunListInfoVo = new ApiRunListInfoVo();
        //获取当前是第几轮队列
        String redisKey = "QUEUE_COUNT";
        String memberOutCount = redisUtils.getString(redisKey);
        DataDictionaryCustom queueCountSet = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.QUEUE_COUNT.getType(), DataDictionaryEnum.QUEUE_COUNT.getCode());
        String queueCount = queueCountSet.getValue();
        if(StrUtil.isBlank(memberOutCount)){
            redisUtils.set(redisKey,queueCount,0L);
            memberOutCount = queueCount;
        }
        //出局条件的人数
        /**
         * 初始大小 5+4*0
         * 1  1,2,3,4,5  1出局 5+4*0
         * 2  2,3,4,5,1(复投),7,8,9,10  2出局 5+4*1
         * 3  3,4,5,1(复投),7,8,9,10,2(复投),12,13,14,15 3出局 5+4*2
         * 4  4,5,1(复投),7,8,9,10,2(复投),12,13,14,15,3(复投),17,18,19,20  4出局 5+4*3
         */
        Integer memberCount = Integer.parseInt(memberOutCount) * 4 + 5;
        //判断当前是否符合出局条件
        QueryWrapper<DappSystemProfit> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("state",DappSystemProfit.STATE_IN);
        //实际投资人数
        Integer selectCount = dappSystemProfitDao.selectCount(objectQueryWrapper);
        BigDecimal runPercent = new BigDecimal(selectCount).divide(new BigDecimal(memberCount), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
        apiRunListInfoVo.setRunPercent(runPercent);
//        //获取当前是第几轮队列
//        String redisKey = "QUEUE_COUNT";
//        String memberOutCount = redisUtils.getString(redisKey);
//        DataDictionaryCustom queueCountSet = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.QUEUE_COUNT.getType(), DataDictionaryEnum.QUEUE_COUNT.getCode());
//        String queueCount = queueCountSet.getValue();
//        if(StrUtil.isBlank(memberOutCount)){
//            redisUtils.set(redisKey,queueCount,0L);
//            memberOutCount = queueCount;
//        }
//        //出局条件的人数
//        /**
//         * 初始大小 5+4*0
//         * 1  1,2,3,4,5  1出局 5+4*0
//         * 2  2,3,4,5,1(复投),7,8,9,10  2出局 5+4*1
//         * 3  3,4,5,1(复投),7,8,9,10,2(复投),12,13,14,15 3出局 5+4*2
//         * 4  4,5,1(复投),7,8,9,10,2(复投),12,13,14,15,3(复投),17,18,19,20  4出局 5+4*3
//         */
//        Integer memberCount = Integer.parseInt(memberOutCount) * 4 + 5;
//        //判断当前是否符合出局条件
//        QueryWrapper<DappSystemProfit> objectQueryWrapper = new QueryWrapper<>();
//        objectQueryWrapper.eq("state",DappSystemProfit.STATE_IN);
//        //实际投资人数
//        Integer selectCount = dappSystemProfitDao.selectCount(objectQueryWrapper);
//        BigDecimal runPercent = new BigDecimal(selectCount).divide(new BigDecimal(memberCount), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
//        apiRunListInfoVo.setRunPercent(runPercent);
        //实际投资人数小于出局条件人数
        //符合则出局 实际投资人数等于出局条件人数
        DappSystemProfit dappSystemProfitIn = dappSystemProfitDao.selectSystemProfitInByState(DappSystemProfit.STATE_IN);
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -92,6 +92,49 @@
        walletInfo.setLevelProfit(levelProfit);
        BigDecimal luckyProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberInfo.getId(),7,2);
        walletInfo.setLuckyProfit(luckyProfit);
//        //获取当前是第几轮队列
//        String redisKey = "QUEUE_COUNT";
//        String memberOutCount = redisUtils.getString(redisKey);
//        DataDictionaryCustom queueCountSet = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.QUEUE_COUNT.getType(), DataDictionaryEnum.QUEUE_COUNT.getCode());
//        String queueCount = queueCountSet.getValue();
//        if(StrUtil.isBlank(memberOutCount)){
//            redisUtils.set(redisKey,queueCount,0L);
//            memberOutCount = queueCount;
//        }
//        //出局条件的人数
//        /**
//         * 初始大小 5+4*0
//         * 1  1,2,3,4,5  1出局 5+4*0
//         * 2  2,3,4,5,1(复投),7,8,9,10  2出局 5+4*1
//         * 3  3,4,5,1(复投),7,8,9,10,2(复投),12,13,14,15 3出局 5+4*2
//         * 4  4,5,1(复投),7,8,9,10,2(复投),12,13,14,15,3(复投),17,18,19,20  4出局 5+4*3
//         */
//        Integer memberCount = Integer.parseInt(memberOutCount) * 4 + 5;
//        //判断当前是否符合出局条件
//        QueryWrapper<DappSystemProfit> objectQueryWrapper = new QueryWrapper<>();
//        objectQueryWrapper.eq("state",DappSystemProfit.STATE_IN);
//        //实际投资人数
//        Integer selectCount = dappSystemProfitDao.selectCount(objectQueryWrapper);
//        BigDecimal memberRunPercent = BigDecimal.ZERO;
//        List<DappSystemProfit> dappSystemProfits = dappSystemProfitDao.selectDappSysstemProfitByState(DappSystemProfit.STATE_IN);
//        if(CollUtil.isEmpty(dappSystemProfits)){
//            walletInfo.setRunPercent(memberRunPercent);
//        }
//
//        for(int i=0;i<dappSystemProfits.size();i++){
//            DappSystemProfit systemProfit = dappSystemProfits.get(i);
//            if(memberInfo.getId() == systemProfit.getMemberId()){
//                BigDecimal size = new  BigDecimal(dappSystemProfits.size());
//                memberRunPercent = size.subtract(new BigDecimal(i+1));
//            }
//        }
//        BigDecimal runPercent = memberRunPercent.divide(new BigDecimal(memberCount), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
//        walletInfo.setRunPercent(runPercent);
        if(DataDictionaryEnum.BIG_BOSS.getCode().equals(memberInfo.getAccountType())){
            walletInfo.setRunPercent(new BigDecimal(100));
        }else{
            walletInfo.setRunPercent(new BigDecimal(90));
        }
        return walletInfo;
    }
@@ -142,8 +185,8 @@
     */
    @Override
    public Long transfer(TransferDto transferDto) {
        DappMemberEntity member = LoginUserUtil.getAppUser();
//        DappMemberEntity member = dappMemberDao.selectById(transferDto.getMemberId());
//        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappMemberEntity member = dappMemberDao.selectById(transferDto.getMemberId());
        String upgrade = redisUtils.getString("APP_UPGRADE");
        if ("upgrade".equals(upgrade)) {
src/main/java/cc/mrbird/febs/dapp/vo/ApiRunListInfoVo.java
@@ -8,8 +8,8 @@
@Data
public class ApiRunListInfoVo {
    @ApiModelProperty(value = "动能")
    private BigDecimal runPercent;
//    @ApiModelProperty(value = "动能")
//    private BigDecimal runPercent;
    @ApiModelProperty(value = "当前幸运儿")
    private Long luckyMember;
src/main/java/cc/mrbird/febs/dapp/vo/WalletInfoVo.java
@@ -32,6 +32,9 @@
    @ApiModelProperty(value = "幸运奖金(动能收益)")
    private BigDecimal luckyProfit;
    @ApiModelProperty(value = "动能")
    private BigDecimal runPercent;
    @ApiModelProperty(value = "直推数量")
    private Integer directCnt;
src/main/resources/mapper/dapp/DappSystemProfitDao.xml
@@ -94,4 +94,13 @@
        order by a.create_time asc
    </select>
    <select id="selectDappSysstemProfitByState" resultType="cc.mrbird.febs.dapp.entity.DappSystemProfit">
        select
            a.*
        from
            dapp_system_profit a
        where a.state = #{state}
        order by a.id asc
    </select>
</mapper>
src/main/resources/templates/febs/views/dapp/member.html
@@ -273,7 +273,7 @@
                        }, minWidth: 80,align:'center'},
                    {field: 'directProfit', title: '直推收益', minWidth: 100, totalRow: true},
                    {field: 'levelProfit', title: '层级收益', minWidth: 100, totalRow: true},
                    {field: 'luckyProfit', title: '动能收益', minWidth: 100, totalRow: true},
                    {field: 'luckyProfit', title: '出局收益', minWidth: 100, totalRow: true},
                    {field: 'inviteId', title: '邀请码', minWidth: 100},
                    {field: 'refererId', title: '上级邀请码', minWidth: 100},
                    {field: 'createTime', title: '创建时间', minWidth: 180}
src/test/java/cc/mrbird/febs/TreeTest.java
@@ -65,9 +65,9 @@
        transferDto.setFee(BigDecimal.ZERO);
        transferDto.setType(1);
        transferDto.setBuyType(2);
        transferDto.setMemberId(139L);
        transferDto.setMemberId(140L);
        Long transfer = dappWalletService.transfer(transferDto);
        transferDto.setTxHash("ceshi"+ DateUtil.now());
        transferDto.setTxHash("0x4c26f944d469219030512907bc3fd3d825d40d1ace7108dd3923a67d95b81094");
        transferDto.setId(transfer);
        transferDto.setFlag("success");
        dappWalletService.transfer(transferDto);