| | |
| | | |
| | | import cc.mrbird.febs.common.configure.i18n.MessageSourceUtils; |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.ShareCodeUtil; |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | |
| | | // System.out.println(s); |
| | | // } |
| | | |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | @Autowired |
| | | private DappOnHookAwardDao dappOnHookAwardDao; |
| | | @Test |
| | | public void getmember(){//获取下一个开奖 |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(64L); |
| | | IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(824L); |
| | | BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | //获取收益 |
| | | //获取收益率 |
| | | DataDictionaryCustom identityDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), dappMemberEntity.getIdentity()); |
| | | String identityDicValue = identityDic.getValue(); |
| | | JSONObject identityDicValueParse = JSONUtil.parseObj(identityDicValue); |
| | | BigDecimal hangingRevenueLevel = new BigDecimal(identityDicValueParse.get("hangingRevenue").toString()) |
| | | .multiply(new BigDecimal(0.01)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //获取当前用户每分钟应该获取的收益 |
| | | BigDecimal multiply = hangingRevenueLevel.multiply(planAmount); |
| | | DataDictionaryCustom maxHoursDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | //挂机总时长(分钟) |
| | | BigDecimal maxHours = new BigDecimal(maxHoursDic.getValue()).multiply(new BigDecimal(60)); |
| | | //得到每分钟的收益 |
| | | BigDecimal minuteProfit = multiply.divide(maxHours, 4, BigDecimal.ROUND_DOWN); |
| | | //获取挂机开始时间到现在的总时长(分钟数) |
| | | Date startTime = igtOnHookPlanOrder.getStartTime(); |
| | | long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE); |
| | | //获得总收益 |
| | | BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | System.out.println(totalProfit); |
| | | } |
| | | // @Autowired |
| | | // private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | // @Autowired |
| | | // private RedisUtils redisUtils; |
| | | // @Autowired |
| | | // private DappOnHookAwardDao dappOnHookAwardDao; |
| | | // @Autowired |
| | | // private DappOnHookDoneDao dappOnHookDoneDao; |
| | | // @Autowired |
| | | // private DappWalletService dappWalletService; |
| | | // @Autowired |
| | | // private DappAccountMoneyChangeDao dappAccountMoneyChangeDao; |
| | | // @Test |
| | | // public void getmember(){ |
| | | // IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(826L); |
| | | // |
| | | // Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | // //判断系统是否已经结算过了 |
| | | // QueryWrapper<DappOnHookDone> objectQueryWrapper = new QueryWrapper<>(); |
| | | // objectQueryWrapper.eq("order_id",826L); |
| | | // List<DappOnHookDone> dappOnHookDones = dappOnHookDoneDao.selectList(objectQueryWrapper); |
| | | // if(CollUtil.isNotEmpty(dappOnHookDones)){ |
| | | // new FebsResponse().fail().message(MessageSourceUtils.getString("Operation_003")); |
| | | // } |
| | | // //更新主表为结束状态 |
| | | // igtOnHookPlanOrder.setState(2); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // |
| | | //// BigDecimal totalProfit = igtOnHookPlanOrder.getProfit(); |
| | | // BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | //// BigDecimal avaAmount = igtOnHookPlanOrder.getAvaAmount(); |
| | | // //更新用户表是否正在挂机状态字段为否 |
| | | // DappMemberEntity dappMember = dappMemberDao.selectById(memberId); |
| | | // dappMember.setIsOnHook(3); |
| | | // dappMemberDao.updateById(dappMember); |
| | | // |
| | | // //获取当前用户每分钟应该获取的收益 |
| | | // String identity = dappMember.getIdentity(); |
| | | // //当前用户的挂机收益率 |
| | | // BigDecimal hangingRevenue = getHangingRevenue(identity); |
| | | // BigDecimal multiply = hangingRevenue.multiply(planAmount); |
| | | // DataDictionaryCustom maxHoursDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | // //挂机总时长(分钟) |
| | | // BigDecimal maxHours = new BigDecimal(maxHoursDic.getValue()).multiply(new BigDecimal(60)); |
| | | // //得到每分钟的收益 |
| | | // BigDecimal minuteProfit = multiply.divide(maxHours, 4, BigDecimal.ROUND_DOWN); |
| | | // //获取挂机开始时间到现在的总时长(分钟数) |
| | | // Date startTime = igtOnHookPlanOrder.getStartTime(); |
| | | // long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE); |
| | | // //获得总收益 |
| | | // BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)); |
| | | // |
| | | // String refererIds = dappMember.getRefererIds(); |
| | | // List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | // //生成流水佣金和盈利分成和流水记录,返回盈利分成和流水佣金总共分成 |
| | | // BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit,igtOnHookPlanOrder.getId()); |
| | | // //平台分成 |
| | | // //平台拿走35%盈利分成和流水佣金剩下的全部 |
| | | // BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal); |
| | | // BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,systemAdd,igtOnHookPlanOrder.getId()); |
| | | // //个人固定拿走60% |
| | | // totalProfit = totalProfit.multiply(new BigDecimal(0.6)); |
| | | // igtOnHookPlanOrder.setProfit(totalProfit); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // |
| | | // BigDecimal totalMoney = planAmount.add(totalProfit); |
| | | // DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | // dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney); |
| | | // |
| | | // BigDecimal add = dappWalletCoinEntity.getAvailableAmount().add(totalMoney); |
| | | // BigDecimal subtract = add.subtract(totalProfit); |
| | | // DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberId, subtract, totalProfit, add, "投注盈利", 5,igtOnHookPlanOrder.getId()); |
| | | // dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | // |
| | | // DappOnHookDone dappOnHookDone = new DappOnHookDone(memberId, igtOnHookPlanOrder.getId()); |
| | | // dappOnHookDoneDao.insert(dappOnHookDone); |
| | | // } |
| | | |
| | | |
| | | // private BigDecimal getHangingRevenue(String identity){ |
| | | // DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), identity); |
| | | // String dataDictionaryCustomValue = dataDictionaryCustom.getValue(); |
| | | // cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(dataDictionaryCustomValue); |
| | | // String runningCommission = jsonObject.get("hangingRevenue").toString(); |
| | | // return new BigDecimal(runningCommission).multiply(new BigDecimal(0.01)); |
| | | // } |
| | | |
| | | // @Autowired |
| | | // private DappMemberDao dappMemberDao; |