xiaoyong931011
2022-12-01 9b3a67db63c2a51c1e97501b9e73f792a5f55bf8
20221130
15 files modified
1 files added
247 ■■■■ changed files
src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java 1 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/controller/ApiDappMemberController.java 19 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/DappMemberService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java 63 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 22 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/ApiRunListInfoVo.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/TeamListVo.java 14 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/WalletInfoVo.java 15 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappFundFlowDao.xml 7 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappMemberDao.xml 13 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappSystemProfitDao.xml 24 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/dapp/money-change-flow.html 35 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -26,6 +26,7 @@
        InterceptorRegistration registration = registry.addInterceptor(new DappInterceptor());
        registration.addPathPatterns("/dapi/**");
        registration.excludePathPatterns("/dapi/common/**");
        registration.excludePathPatterns("/dapi/member/runListInfo");
    }
    /**
src/main/java/cc/mrbird/febs/dapp/controller/ApiDappMemberController.java
@@ -12,6 +12,7 @@
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.dapp.service.DappWalletService;
import cc.mrbird.febs.dapp.vo.ActiveNftListVo;
import cc.mrbird.febs.dapp.vo.ApiRunListInfoVo;
import cc.mrbird.febs.dapp.vo.TeamListVo;
import cc.mrbird.febs.dapp.vo.WalletInfoVo;
import io.swagger.annotations.Api;
@@ -80,6 +81,24 @@
        return new FebsResponse().success().data(dappMemberService.findTeamList());
    }
    @ApiOperation(value = "动能信息", notes = "动能信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = ApiRunListInfoVo.class)
    })
    @PostMapping(value = "/runListInfo")
    public FebsResponse runListInfo() {
        return new FebsResponse().success().data(dappMemberService.findRunListInfo());
    }
//    @ApiOperation(value = "我的团队", notes = "我的团队")
//    @ApiResponses({
//            @ApiResponse(code = 200, message = "success", response = TeamListVo.class)
//    })
//    @PostMapping(value = "/team")
//    public FebsResponse team() {
//        return new FebsResponse().success().data(dappMemberService.findTeamList());
//    }
    @PostMapping(value = "/logout")
    public FebsResponse logout() {
        DappMemberEntity member = LoginUserUtil.getAppUser();
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -26,4 +26,6 @@
    BigDecimal selectProfitAmountByMemberId(@Param("memberId") Long memberId);
    DappFundFlowEntity selectNewestFundFlow(@Param("memberId") Long memberId, @Param("type") Integer type);
    BigDecimal selectSumAmountByMemberIdAndTypeAndStatus(@Param("memberId") Long memberId,@Param("type")int type, @Param("status")int status);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java
@@ -46,4 +46,8 @@
    List<DappMemberEntity> selectMemberListNeedProfit();
    void updateMemberAccountType(@Param("accountType")String code, @Param("id")Long id);
    void updateMemberActiveStatus(@Param("accountStatus")int i, @Param("id")Long id);
    List<DappMemberEntity> selectMemberInfoByRefererId(@Param("refererId")String inviteId);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java
@@ -13,4 +13,10 @@
    void updateLevelProfitById(@Param("levelProfit") int levelProfit,@Param("id")Long id);
    void updateStateById(@Param("state") int stateOut,@Param("id")Long id);
    DappSystemProfit selectByMemberIdAndState(@Param("memberId")Long id, @Param("state")int stateIn);
    DappSystemProfit selectSystemProfitOutByState(@Param("state")int stateOut);
    DappSystemProfit selectSystemProfitInByState(@Param("state")int stateIn);
}
src/main/java/cc/mrbird/febs/dapp/service/DappMemberService.java
@@ -8,6 +8,7 @@
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
import cc.mrbird.febs.dapp.entity.DappTransferRecordEntity;
import cc.mrbird.febs.dapp.vo.AdminSystemFeeVo;
import cc.mrbird.febs.dapp.vo.ApiRunListInfoVo;
import cc.mrbird.febs.dapp.vo.TeamListVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -46,4 +47,6 @@
    TeamListVo findTeamList();
    void setSystemFee(AdminSystemFeeVo adminSystemFeeVo);
    ApiRunListInfoVo findRunListInfo();
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java
@@ -20,10 +20,13 @@
import cc.mrbird.febs.dapp.mapper.*;
import cc.mrbird.febs.dapp.service.DappMemberService;
import cc.mrbird.febs.dapp.vo.AdminSystemFeeVo;
import cc.mrbird.febs.dapp.vo.ApiRunListInfoVo;
import cc.mrbird.febs.dapp.vo.TeamListVo;
import cc.mrbird.febs.system.entity.User;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -54,6 +57,7 @@
    private final DappAchieveMemberTreeDao dappAchieveMemberTreeDao;
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
    private final DappSystemProfitDao dappSystemProfitDao;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -340,12 +344,12 @@
    @Override
    public TeamListVo findTeamList() {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappAchieveMemberTreeEntity topNode = dappAchieveMemberTreeDao.selectNodeByDeep(member.getId(), 1);
        if (topNode == null) {
        //如果没有加入动能即返回null
        DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectByMemberIdAndState(member.getId(), DappSystemProfit.STATE_IN);
        if(ObjectUtil.isEmpty(dappSystemProfit)){
            return null;
        }
        return buildTeamMatrix(topNode);
        return buildTeamMatrix(member.getId());
    }
    @Override
@@ -371,20 +375,57 @@
        dataDictionaryCustomMapper.updateById(symbolPriceDic);
    }
    public TeamListVo buildTeamMatrix(DappAchieveMemberTreeEntity node) {
        List<DappAchieveMemberTreeEntity> childNodes = dappAchieveMemberTreeDao.selectMatrixChildNode(node.getTopNode(), node.getTreeNode());
    @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);
        //实际投资人数小于出局条件人数
        //符合则出局 实际投资人数等于出局条件人数
        DappSystemProfit dappSystemProfitIn = dappSystemProfitDao.selectSystemProfitInByState(DappSystemProfit.STATE_IN);
        apiRunListInfoVo.setLuckyMemberNext(dappSystemProfitIn.getId());
        DappSystemProfit dappSystemProfitOut = dappSystemProfitDao.selectSystemProfitOutByState(DappSystemProfit.STATE_OUT);
        apiRunListInfoVo.setLuckyMember(dappSystemProfitOut.getId());
        return apiRunListInfoVo;
    }
    public TeamListVo buildTeamMatrix(Long memberId) {
        DappMemberEntity member = dappMemberDao.selectById(memberId);
        TeamListVo teamListVo = new TeamListVo();
        teamListVo.setName(node.getInviteId());
        teamListVo.setHasMoney(node.getHasMoney());
        teamListVo.setAddress(member.getAddress());
        teamListVo.setAccountType(member.getAccountType());
        teamListVo.setActiveStatus(member.getActiveStatus());
        List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        teamListVo.setDirectCnt(dappMemberEntities.size());
        if (CollUtil.isEmpty(childNodes)) {
        if (CollUtil.isEmpty(dappMemberEntities)) {
            return teamListVo;
        }
        List<TeamListVo> list = new ArrayList<>();
        for (DappAchieveMemberTreeEntity childNode : childNodes) {
            list.add(buildTeamMatrix(childNode));
        for (DappMemberEntity childNode : dappMemberEntities) {
            list.add(buildTeamMatrix(childNode.getId()));
        }
        teamListVo.setChildren(list);
        return teamListVo;
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -82,6 +82,16 @@
        walletInfo.setProfit(dappFundFlowDao.selectProfitAmountByMemberId(member.getId()));
        walletInfo.setTfcBalance(walletMine.getAvailableAmount());
        walletInfo.setSafePool(mineData.getSafePool());
        walletInfo.setAccountType(memberInfo.getAccountType());
        DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectByMemberIdAndState(memberInfo.getId(),DappSystemProfit.STATE_IN);
        walletInfo.setSystemProfitId(dappSystemProfit.getId());
        BigDecimal directProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberInfo.getId(),3,2);
        walletInfo.setDirectProfit(directProfit);
        BigDecimal levelProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberInfo.getId(),4,2);
        walletInfo.setLevelProfit(levelProfit);
        BigDecimal luckyProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberInfo.getId(),7,2);
        walletInfo.setLuckyProfit(luckyProfit);
        return walletInfo;
    }
@@ -176,6 +186,12 @@
                if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){
                    return null;
                }
                //是否已经加入动能
                DappSystemProfit dappSystemProfitIng = dappSystemProfitDao.selectByMemberIdAndState(member.getId(), DappSystemProfit.STATE_IN);
                if(ObjectUtil.isNotEmpty(dappSystemProfitIng)){
                    return null;
                }
                //插入一条会员入列记录,即加入动能队列
                DappSystemProfit dappSystemProfit = new DappSystemProfit(member.getId(), transferDto.getAmount());
                dappSystemProfitDao.insert(dappSystemProfit);
@@ -186,6 +202,7 @@
                dappFundFlowDao.updateById(flow);
                //升级成为Agent
                dappMemberDao.updateMemberAccountType(DataDictionaryEnum.AGENT.getCode(),member.getId());
                dappMemberDao.updateMemberActiveStatus(1,member.getId());
                //直接拿走0.05个BNB放入技术方
                DataDictionaryCustom systemProfit = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SYSTEM_PROFIT.getType(), DataDictionaryEnum.SYSTEM_PROFIT.getCode());
@@ -392,6 +409,11 @@
            throw new FebsException("功能升级中");
        }
        if ("success".equals(transferDto.getFlag())) {
            //是否已经加入动能
            DappSystemProfit dappSystemProfitIng = dappSystemProfitDao.selectByMemberIdAndState(member.getId(), DappSystemProfit.STATE_IN);
            if(ObjectUtil.isNotEmpty(dappSystemProfitIng)){
                return;
            }
            //插入一条会员入列记录,即加入动能队列
            DappSystemProfit dappSystemProfit = new DappSystemProfit(member.getId(), transferDto.getAmount());
            dappSystemProfitDao.insert(dappSystemProfit);
src/main/java/cc/mrbird/febs/dapp/vo/ApiRunListInfoVo.java
New file
@@ -0,0 +1,17 @@
package cc.mrbird.febs.dapp.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ApiRunListInfoVo {
    @ApiModelProperty(value = "动能")
    private String runPercent;
    @ApiModelProperty(value = "当前幸运儿")
    private Long luckyMember;
    @ApiModelProperty(value = "下一个幸运儿")
    private Long luckyMemberNext;
}
src/main/java/cc/mrbird/febs/dapp/vo/TeamListVo.java
@@ -17,11 +17,17 @@
@ApiModel(value = "TeamLIstVo", description = "团队列表接口返回参数类")
public class TeamListVo {
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "地址")
    private String address;
    @ApiModelProperty(value = "是否认购")
    private int hasMoney;
    @ApiModelProperty(value = "等级")
    private String accountType;
    @ApiModelProperty(value = "是否加入动能")
    private Integer activeStatus;
    @ApiModelProperty(value = "直推人数")
    private int directCnt;
    @ApiModelProperty(value = "子节点")
    private List<TeamListVo> children = new ArrayList<>();
src/main/java/cc/mrbird/febs/dapp/vo/WalletInfoVo.java
@@ -17,6 +17,21 @@
    @ApiModelProperty(value = "邀请码")
    private String inviteId;
    @ApiModelProperty(value = "代理身份")
    private String accountType;
    @ApiModelProperty(value = "编号")
    private Long systemProfitId;
    @ApiModelProperty(value = "直推奖金(直推收益)")
    private BigDecimal directProfit;
    @ApiModelProperty(value = "平级奖金(层级收益)")
    private BigDecimal levelProfit;
    @ApiModelProperty(value = "幸运奖金(动能收益)")
    private BigDecimal luckyProfit;
    @ApiModelProperty(value = "直推数量")
    private Integer directCnt;
src/main/resources/application.yml
@@ -5,7 +5,7 @@
spring:
  profiles:
    active: prod
    active: dev
  thymeleaf:
    cache: false
src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -75,4 +75,11 @@
        order by id desc
        limit 1
    </select>
    <select id="selectSumAmountByMemberIdAndTypeAndStatus" resultType="java.math.BigDecimal">
        select ifnull(sum(amount), 0) from dapp_fund_flow
        where member_id = #{memberId}
          and type = #{type}
        and status = #{status}
    </select>
</mapper>
src/main/resources/mapper/dapp/DappMemberDao.xml
@@ -152,4 +152,17 @@
        set account_type = #{accountType}
        where id = #{id}
    </update>
    <update id="updateMemberActiveStatus">
        update dapp_member
        set active_status = #{accountStatus}
        where id = #{id}
    </update>
    <select id="selectMemberInfoByRefererId" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select
            *
        from dapp_member a
        where referer_id = #{refererId}
    </select>
</mapper>
src/main/resources/mapper/dapp/DappSystemProfitDao.xml
@@ -31,4 +31,28 @@
        where id = #{id}
    </update>
    <select id="selectByMemberIdAndState" resultType="cc.mrbird.febs.dapp.entity.DappSystemProfit">
        select a.*
        from dapp_system_profit a
        where state = #{state}
        and member_id = #{memberId}
            limit 1
    </select>
    <select id="selectSystemProfitOutByState" resultType="cc.mrbird.febs.dapp.entity.DappSystemProfit">
        select a.*
        from dapp_system_profit a
        where state = #{state}
        order by id desc
            limit 1
    </select>
    <select id="selectSystemProfitInByState" resultType="cc.mrbird.febs.dapp.entity.DappSystemProfit">
        select a.*
        from dapp_system_profit a
        where state = #{state}
        order by id ASC
            limit 1
    </select>
</mapper>
src/main/resources/templates/febs/views/dapp/money-change-flow.html
@@ -16,19 +16,15 @@
                                        <label class="layui-form-label layui-form-label-sm">类型</label>
                                        <div class="layui-input-inline">
                                            <select name="type">
<!--                                                1-加入动能 2-技术方收益 3-直推收益 4-层级收益 5-剩余层级收益给系统 6-复投动能 7-动能收益-->
                                                <option value=""></option>
                                                <option value="1">买入</option>
                                                <option value="2">矩阵收益</option>
                                                <option value="1">加入动能</option>
                                                <option value="2">技术方收益</option>
                                                <option value="3">直推收益</option>
                                                <option value="4">保险池</option>
                                                <option value="5">提现</option>
                                                <option value="6">手续费充值</option>
                                                <option value="7">手续费扣除</option>
                                                <option value="8">结算</option>
                                                <option value="9">冻结</option>
                                                <option value="10">冻结释放</option>
                                                <option value="11">产矿</option>
                                                <option value="12">手续费返利</option>
                                                <option value="4">层级收益</option>
                                                <option value="5">剩余层级收益</option>
                                                <option value="6">复投动能</option>
                                                <option value="7">动能收益</option>
                                            </select>
                                        </div>
                                    </div>
@@ -88,18 +84,13 @@
<script type="text/html" id="flow-type">
    {{#
    var type = {
    1: {title: '买入'},
    2: {title: '矩阵收益'},
    1: {title: '加入动能'},
    2: {title: '技术方收益'},
    3: {title: '直推收益'},
    4: {title: '保险池'},
    5: {title: '提现'},
    6: {title: '手续费充值'},
    7: {title: '手续费扣除'},
    8: {title: '结算'},
    9: {title: '冻结'},
    10: {title: '冻结释放'},
    11: {title: '产矿'},
    12: {title: '手续费返利'},
    4: {title: '层级收益'},
    5: {title: '剩余层级收益'},
    6: {title: '复投动能'},
    7: {title: '动能收益'},
    }[d.type];
    }}
    <span>{{ type.title }}</span>