| | |
| | | private final DappOnHookAwardDao dappOnHookAwardDao; |
| | | private final DappWalletService dappWalletService; |
| | | private final DappOnHookDoneDao dappOnHookDoneDao; |
| | | private final MemberCoinWithdrawDao memberCoinWithdrawDao; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | |
| | | // BigDecimal totalProfit = igtOnHookPlanOrder.getProfit(); |
| | | BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | // BigDecimal avaAmount = igtOnHookPlanOrder.getAvaAmount(); |
| | | //更新用户表是否正在挂机状态字段为否 |
| | | //更新用户表是否正在挂机状态字段为结算中 |
| | | DappMemberEntity dappMember = dappMemberDao.selectById(memberId); |
| | | dappMember.setIsOnHook(3); |
| | | dappMemberDao.updateById(dappMember); |
| | |
| | | long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE); |
| | | //获得总收益 |
| | | BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)); |
| | | if(multiply.compareTo(totalProfit) < 0){ |
| | | totalProfit = multiply; |
| | | } |
| | | |
| | | String refererIds = dappMemberEntity.getRefererIds(); |
| | | List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | |
| | | Date date = dappOnHookAwardNow.getAwardTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String yyyyMMddHHMM = sdf.format(date); |
| | | List<DappOnHookAward> dappOnHookAwards = dappOnHookAwardDao.selectInfoByByAwardTime(yyyyMMddHHMM); |
| | | // List<DappOnHookAward> dappOnHookAwards = dappOnHookAwardDao.selectInfoByByAwardTime(yyyyMMddHHMM); |
| | | List<DappOnHookAward> dappOnHookAwards = dappOnHookAwardDao.selectByIdLimitTT(Long.parseLong(onHookAwardRedisId)); |
| | | if(CollUtil.isNotEmpty(dappOnHookAwards)){ |
| | | for(DappOnHookAward dappOnHookAward : dappOnHookAwards){ |
| | | ApiAwardInfoVo apiAwardInfoVo = new ApiAwardInfoVo(); |
| | |
| | | .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()); |
| | | //挂机总时长(分钟) |
| | |
| | | long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE); |
| | | //获得总收益 |
| | | BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | if(multiply.compareTo(totalProfit) < 0){ |
| | | totalProfit = multiply; |
| | | } |
| | | |
| | | // BigDecimal totalProfit = planAmount.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN); |
| | | |
| | | String refererIds = dappMemberEntity.getRefererIds(); |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void memberCoinInsideMessage(Long orderId) { |
| | | MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectById(orderId); |
| | | memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_YES); |
| | | memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity); |
| | | //转出账户,总额减少,冻结减少 |
| | | BigDecimal amount = memberCoinWithdrawEntity.getAmount().setScale(4,BigDecimal.ROUND_DOWN); |
| | | Long memberIdOut = memberCoinWithdrawEntity.getMemberId(); |
| | | DappWalletCoinEntity dappWalletCoinEntityOut = dappWalletCoinDao.selectByMemberId(memberIdOut); |
| | | dappWalletCoinDao.delTotalAndDelFrozenById(dappWalletCoinEntityOut.getId(),amount); |
| | | |
| | | String content = "内部转账"; |
| | | Integer type = 4; |
| | | //转出账户生成一条账户资金变化记录 |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityOut = new DappAccountMoneyChangeEntity(memberIdOut, |
| | | dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN), |
| | | amount.negate(), |
| | | dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).subtract(amount), |
| | | content, |
| | | type); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityOut); |
| | | |
| | | //转入账户,总额增加,余额增加 |
| | | //转账 |
| | | String addressIn = memberCoinWithdrawEntity.getAddress(); |
| | | DappMemberEntity dappMemberEntityIn = dappMemberDao.selectMemberInfoByInviteId(addressIn); |
| | | DappWalletCoinEntity dappWalletCoinEntityIn = dappWalletCoinDao.selectByMemberId(dappMemberEntityIn.getId()); |
| | | Integer countIn = dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntityIn.getId(), memberCoinWithdrawEntity.getAmount()); |
| | | //生成流水记录 |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityIn = new DappAccountMoneyChangeEntity(dappMemberEntityIn.getId(), |
| | | dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN), |
| | | amount, |
| | | dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).add(amount), |
| | | "转账", |
| | | 4); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityIn); |
| | | } |
| | | |
| | | private String getProfitCase(String identity,BigDecimal balance){ |
| | | //匹配会员等级获取对应的收益率 |
| | | List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.LEVEL_MB.getType()); |