| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | |
| | | @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); |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | */ |
| | | @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)) { |
| | |
| | | @Data |
| | | public class ApiRunListInfoVo { |
| | | |
| | | @ApiModelProperty(value = "动能") |
| | | private BigDecimal runPercent; |
| | | // @ApiModelProperty(value = "动能") |
| | | // private BigDecimal runPercent; |
| | | |
| | | @ApiModelProperty(value = "当前幸运儿") |
| | | private Long luckyMember; |
| | |
| | | @ApiModelProperty(value = "幸运奖金(动能收益)") |
| | | private BigDecimal luckyProfit; |
| | | |
| | | @ApiModelProperty(value = "动能") |
| | | private BigDecimal runPercent; |
| | | |
| | | @ApiModelProperty(value = "直推数量") |
| | | private Integer directCnt; |
| | | |
| | |
| | | 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> |
| | |
| | | }, 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} |
| | |
| | | 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); |