| | |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.ApiIgtOnHookPlanService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jline.utils.Log; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired |
| | | private DappWalletService dappWalletService; |
| | | |
| | | @Autowired |
| | | private ApiIgtOnHookPlanService apiIgtOnHookPlanService; |
| | | |
| | | /** |
| | | * 五分钟更新一次数据 |
| | | * 让挂机字表的状态为1:已生效 |
| | |
| | | @Scheduled(cron = "0 0/5 * * * ? ") |
| | | public void updatePlanOrderItem(){ |
| | | Log.info("开始更新挂机子表状态"); |
| | | List<IgtOnHookPlanOrder> igtOnHookPlanOrders = igtOnHookPlanOrderDao.selectByState(1); |
| | | if(CollUtil.isEmpty(igtOnHookPlanOrders)){ |
| | | return; |
| | | } |
| | | for(IgtOnHookPlanOrder igtOnHookPlanOrder : igtOnHookPlanOrders){ |
| | | //让挂机子表的状态为1:已生效 |
| | | Long orderId = igtOnHookPlanOrder.getId(); |
| | | Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = igtOnHookPlanOrderItemDao.selectByOrderIdAndMemberIdAndState(orderId,memberId,2); |
| | | if(ObjectUtil.isNotEmpty(igtOnHookPlanOrderItem)){ |
| | | igtOnHookPlanOrderItem.setState(1); |
| | | igtOnHookPlanOrderItemDao.updateById(igtOnHookPlanOrderItem); |
| | | if(2 == igtOnHookPlanOrderItem.getIsGoal()){ |
| | | //如果中奖,增加挂机主表的挂机总收益 |
| | | Integer updateCount = igtOnHookPlanOrderDao.AddProfitById(igtOnHookPlanOrder.getId() |
| | | ,igtOnHookPlanOrderItem.getProfit()); |
| | | }else{ |
| | | //如果不中奖,减少挂机剩余金额即减少本金 |
| | | Integer updateCount = igtOnHookPlanOrderDao.updateAvaAmountById(igtOnHookPlanOrder.getId() |
| | | ,igtOnHookPlanOrderItem.getAmount()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | apiIgtOnHookPlanService.updatePlanOrderItem(); |
| | | // List<IgtOnHookPlanOrder> igtOnHookPlanOrders = igtOnHookPlanOrderDao.selectByState(1); |
| | | // if(CollUtil.isEmpty(igtOnHookPlanOrders)){ |
| | | // return; |
| | | // } |
| | | // String redisKey = ""; |
| | | // if("prod".equals(active)){ |
| | | // redisKey = "on_hook_award_id"; |
| | | // }else{ |
| | | // redisKey = "on_hook_award_id_test"; |
| | | // } |
| | | // String onHookAwardRedisId = redisUtils.getString(redisKey); |
| | | // DappOnHookAward dappOnHookAward = dappOnHookAwardDao.selectById(Long.parseLong(onHookAwardRedisId)); |
| | | // Date awardTime = dappOnHookAward.getAwardTime(); |
| | | // DateTime dateTime = DateUtil.offsetMinute(awardTime, 5); |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // String yyyyMMddHHMM = sdf.format(dateTime); |
| | | // DappOnHookAward dappOnHookAwardNext = dappOnHookAwardDao.selectByByAwardTime(yyyyMMddHHMM); |
| | | // |
| | | // //系统挂机总次数 = 时长 * 60 / 5 |
| | | // DataDictionaryCustom maxHoursDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | // Float maxHours = Float.parseFloat(maxHoursDic.getValue()); |
| | | // maxHours = maxHours * 60 / 5; |
| | | // |
| | | // for(IgtOnHookPlanOrder igtOnHookPlanOrder : igtOnHookPlanOrders){ |
| | | // BigDecimal avaAmount = igtOnHookPlanOrder.getAvaAmount(); |
| | | // if(avaAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | // /** |
| | | // * 获取下一个开奖记录 |
| | | // * 生成一条开奖字表记录 |
| | | // * 计算收益 |
| | | // */ |
| | | // |
| | | // List<IgtOnHookPlanOrderItem> igtOnHookPlanOrderItemsOld = igtOnHookPlanOrderItemDao.selectByIgtIdAndMemberId(igtOnHookPlanOrder.getId(),igtOnHookPlanOrder.getMemberId()); |
| | | // //如果没有中奖记录则是新增一条1挂机方案的挂机子表记录 |
| | | // if(CollUtil.isEmpty(igtOnHookPlanOrderItemsOld)){ |
| | | // |
| | | // IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = new IgtOnHookPlanOrderItem(); |
| | | // igtOnHookPlanOrderItem.setMemberId(igtOnHookPlanOrder.getMemberId()); |
| | | // igtOnHookPlanOrderItem.setOrderId(igtOnHookPlanOrder.getId()); |
| | | // //获取挂机方案 |
| | | // DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.PLAN_A.getType(), DataDictionaryEnum.PLAN_A.getCode()); |
| | | // String dataDictionaryCustomValue = dataDictionaryCustom.getValue(); |
| | | // JSONObject levelMemberValueParse = JSONUtil.parseObj(dataDictionaryCustomValue); |
| | | // BigDecimal amountPlanA = new BigDecimal(levelMemberValueParse.get("amount").toString()) |
| | | // .multiply(new BigDecimal(igtOnHookPlanOrder.getPlanCode())).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // igtOnHookPlanOrderItem.setAmount(amountPlanA); |
| | | // //获取收益率 |
| | | // DappMemberEntity dappMemberEntity = dappMemberDao.selectById(igtOnHookPlanOrder.getMemberId()); |
| | | // 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 profit = amountPlanA.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // igtOnHookPlanOrderItem.setProfit(profit.setScale(4,BigDecimal.ROUND_DOWN)); |
| | | // |
| | | // igtOnHookPlanOrderItem.setState(1); |
| | | // igtOnHookPlanOrderItem.setPlanCode(igtOnHookPlanOrder.getPlanCode()); |
| | | // |
| | | // Integer isGoal = dappWalletService.isGoal(dappOnHookAwardNext.getAwardNum()); |
| | | // igtOnHookPlanOrderItem.setIsGoal(isGoal); |
| | | // igtOnHookPlanOrderItem.setBelongNum(dappOnHookAwardNext.getRecordNum()); |
| | | // igtOnHookPlanOrderItem.setOrderNum(1); |
| | | // igtOnHookPlanOrderItem.setPlan(dataDictionaryCustom.getDescription()); |
| | | // igtOnHookPlanOrderItemDao.insert(igtOnHookPlanOrderItem); |
| | | // |
| | | // if(2 == igtOnHookPlanOrderItem.getIsGoal()){ |
| | | // //如果中奖,增加挂机主表的挂机总收益 |
| | | // Integer updateCount = igtOnHookPlanOrderDao.AddProfitById(igtOnHookPlanOrder.getId() |
| | | // ,igtOnHookPlanOrderItem.getProfit()); |
| | | // }else{ |
| | | // //如果不中奖,减少挂机剩余金额即减少本金 |
| | | // Integer updateCount = igtOnHookPlanOrderDao.updateAvaAmountById(igtOnHookPlanOrder.getId() |
| | | // ,igtOnHookPlanOrderItem.getAmount()); |
| | | // } |
| | | // }else if(2 == igtOnHookPlanOrderItemsOld.get(0).getIsGoal()){ |
| | | // //第一条中奖记录为中奖则是新增一条1挂机方案的挂机子表记录 |
| | | // IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = new IgtOnHookPlanOrderItem(); |
| | | // igtOnHookPlanOrderItem.setMemberId(igtOnHookPlanOrder.getMemberId()); |
| | | // igtOnHookPlanOrderItem.setOrderId(igtOnHookPlanOrder.getId()); |
| | | // //获取挂机方案 |
| | | // DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.PLAN_A.getType(), DataDictionaryEnum.PLAN_A.getCode()); |
| | | // String dataDictionaryCustomValue = dataDictionaryCustom.getValue(); |
| | | // JSONObject levelMemberValueParse = JSONUtil.parseObj(dataDictionaryCustomValue); |
| | | // BigDecimal amountPlanA = new BigDecimal(levelMemberValueParse.get("amount").toString()) |
| | | // .multiply(new BigDecimal(igtOnHookPlanOrder.getPlanCode())).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // //此次下注金额不足,则更新主表信息为结算中 |
| | | // //挂机次数超过系统规定的时间,则更新主表信息为结算中 |
| | | // if(avaAmount.compareTo(amountPlanA) < 0 || igtOnHookPlanOrderItemsOld.get(0).getOrderNum() >= maxHours){ |
| | | // igtOnHookPlanOrder.setState(3); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // }else{ |
| | | // igtOnHookPlanOrderItem.setAmount(amountPlanA); |
| | | // //获取收益率 |
| | | // DappMemberEntity dappMemberEntity = dappMemberDao.selectById(igtOnHookPlanOrder.getMemberId()); |
| | | // 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 profit = amountPlanA.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // igtOnHookPlanOrderItem.setProfit(profit.setScale(4,BigDecimal.ROUND_DOWN)); |
| | | // |
| | | // igtOnHookPlanOrderItem.setState(1); |
| | | // igtOnHookPlanOrderItem.setPlanCode(igtOnHookPlanOrder.getPlanCode()); |
| | | // |
| | | // Integer isGoal = dappWalletService.isGoal(dappOnHookAwardNext.getAwardNum()); |
| | | // igtOnHookPlanOrderItem.setIsGoal(isGoal); |
| | | // igtOnHookPlanOrderItem.setBelongNum(dappOnHookAwardNext.getRecordNum()); |
| | | // igtOnHookPlanOrderItem.setOrderNum(igtOnHookPlanOrderItemsOld.get(0).getOrderNum() + 1); |
| | | // igtOnHookPlanOrderItem.setPlan(dataDictionaryCustom.getDescription()); |
| | | // igtOnHookPlanOrderItemDao.insert(igtOnHookPlanOrderItem); |
| | | // |
| | | // if(2 == igtOnHookPlanOrderItem.getIsGoal()){ |
| | | // |
| | | // //如果中奖,增加挂机主表的挂机总收益 |
| | | // Integer updateCount = igtOnHookPlanOrderDao.AddProfitById(igtOnHookPlanOrder.getId() |
| | | // ,igtOnHookPlanOrderItem.getProfit()); |
| | | // }else{ |
| | | // //如果不中奖,减少挂机剩余金额即减少本金 |
| | | // Integer updateCount = igtOnHookPlanOrderDao.updateAvaAmountById(igtOnHookPlanOrder.getId() |
| | | // ,igtOnHookPlanOrderItem.getAmount()); |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // //第一条没中奖则是新增一条n+1挂机方案的挂机子表记录 |
| | | // String plan = igtOnHookPlanOrderItemsOld.get(0).getPlan(); |
| | | // IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = new IgtOnHookPlanOrderItem(); |
| | | // igtOnHookPlanOrderItem.setMemberId(igtOnHookPlanOrder.getMemberId()); |
| | | // igtOnHookPlanOrderItem.setOrderId(igtOnHookPlanOrder.getId()); |
| | | // //获取挂机方案 |
| | | // DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCodeAndDesc( |
| | | // DataDictionaryEnum.PLAN_A.getType(), |
| | | // Integer.toString(Integer.parseInt(plan)+1)); |
| | | // if(ObjectUtil.isEmpty(dataDictionaryCustom)){ |
| | | // igtOnHookPlanOrder.setState(3); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // return; |
| | | // } |
| | | // String dataDictionaryCustomValue = dataDictionaryCustom.getValue(); |
| | | // JSONObject levelMemberValueParse = JSONUtil.parseObj(dataDictionaryCustomValue); |
| | | // BigDecimal amountPlanA = new BigDecimal(levelMemberValueParse.get("amount").toString()) |
| | | // .multiply(new BigDecimal(igtOnHookPlanOrder.getPlanCode())).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // igtOnHookPlanOrderItem.setAmount(amountPlanA); |
| | | // //此次下注金额不足,则更新主表信息为结算中 |
| | | // if(avaAmount.compareTo(amountPlanA) < 0 || igtOnHookPlanOrderItemsOld.get(0).getOrderNum() >= maxHours){ |
| | | // igtOnHookPlanOrder.setState(3); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // }else{ |
| | | //获取收益率 |
| | | // DappMemberEntity dappMemberEntity = dappMemberDao.selectById(igtOnHookPlanOrder.getMemberId()); |
| | | // 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 profit = amountPlanA.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // igtOnHookPlanOrderItem.setProfit(profit.setScale(4,BigDecimal.ROUND_DOWN)); |
| | | // |
| | | // igtOnHookPlanOrderItem.setState(1); |
| | | // igtOnHookPlanOrderItem.setPlanCode(igtOnHookPlanOrder.getPlanCode()); |
| | | // |
| | | // Integer isGoal = dappWalletService.isGoal(dappOnHookAwardNext.getAwardNum()); |
| | | // igtOnHookPlanOrderItem.setIsGoal(isGoal); |
| | | // igtOnHookPlanOrderItem.setBelongNum(dappOnHookAwardNext.getRecordNum()); |
| | | // igtOnHookPlanOrderItem.setOrderNum(igtOnHookPlanOrderItemsOld.get(0).getOrderNum() + 1); |
| | | // igtOnHookPlanOrderItem.setPlan(dataDictionaryCustom.getDescription()); |
| | | // igtOnHookPlanOrderItemDao.insert(igtOnHookPlanOrderItem); |
| | | // |
| | | // if(2 == igtOnHookPlanOrderItem.getIsGoal()){ |
| | | // //返还两次中奖之间的本金 |
| | | // Date endTime = igtOnHookPlanOrderItem.getCreateTime(); |
| | | // Date startTime = null; |
| | | // //返回上次中奖的记录 |
| | | // IgtOnHookPlanOrderItem igtOld = igtOnHookPlanOrderItemDao.selectByCreateTimeAndIsgoaAndOrderId(endTime,2,igtOnHookPlanOrder.getId()); |
| | | // if(ObjectUtil.isNotEmpty(igtOld)){ |
| | | // startTime = igtOld.getCreateTime(); |
| | | // } |
| | | // BigDecimal totalAmount = igtOnHookPlanOrderItemDao.selectTotalAmountByCreateTimeAndOrderId(startTime,endTime,igtOnHookPlanOrderItem.getOrderId()); |
| | | // //如果中奖,增加挂机主表的挂机总收益,返还两次中奖之间的本金 |
| | | // igtOnHookPlanOrderDao.AddProfitById(igtOnHookPlanOrder.getId() |
| | | // ,igtOnHookPlanOrderItem.getProfit()); |
| | | // igtOnHookPlanOrderDao.addAvaAmountById(igtOnHookPlanOrder.getId() |
| | | // ,totalAmount); |
| | | // }else{ |
| | | // //如果不中奖,减少挂机剩余金额即减少本金 |
| | | // Integer updateCount = igtOnHookPlanOrderDao.updateAvaAmountById(igtOnHookPlanOrder.getId() |
| | | // ,igtOnHookPlanOrderItem.getAmount()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 根据订单主表获取订单主表中还在开始状态的订单 |
| | | * 查询相关关联的子表 |
| | | * 如果子表中的关联数据都已经 生效状态 1:已生效,则 |
| | | * 1、更新主表状态为结束 |
| | | * 2、计算总盈利 |
| | | * 3、更新用户的余额和总额 |
| | | * 4、生成一条资金流水记录 |
| | | * 5、TODO |
| | | * 根据会员等级计算其他的流水,比如分佣金这类操作 |
| | | */ |
| | | |
| | | |
| | | // @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0 0/1 * * * ? ") |
| | | public void updatePlanOrder(){ |
| | | Log.info("开始更新挂机主表状态"); |
| | | |
| | | List<IgtOnHookPlanOrder> igtOnHookPlanOrders = igtOnHookPlanOrderDao.selectByState(1); |
| | | if(CollUtil.isEmpty(igtOnHookPlanOrders)){ |
| | | return; |
| | | } |
| | | for(IgtOnHookPlanOrder igtOnHookPlanOrder : igtOnHookPlanOrders){ |
| | | Long orderId = igtOnHookPlanOrder.getId(); |
| | | Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | BigDecimal avaAmount = igtOnHookPlanOrder.getAvaAmount(); |
| | | IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = igtOnHookPlanOrderItemDao.selectByOrderIdAndMemberIdAndState(orderId,memberId,2); |
| | | if(ObjectUtil.isEmpty(igtOnHookPlanOrderItem)){ |
| | | BigDecimal totalProfit = igtOnHookPlanOrderItemDao.selectTotalProfitByByOrderIdAndMemberIdAndState(orderId,memberId,1,2); |
| | | List<IgtOnHookPlanOrder> igtOnHookPlanOrders = igtOnHookPlanOrderDao.selectByState(3); |
| | | if(CollUtil.isNotEmpty(igtOnHookPlanOrders)){ |
| | | List<Long> ids = igtOnHookPlanOrderDao.selectIdsByState(3); |
| | | //更新状态避免重复查询 |
| | | igtOnHookPlanOrderDao.updateByIds(ids); |
| | | for(IgtOnHookPlanOrder igtOnHookPlanOrder : igtOnHookPlanOrders){ |
| | | Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | //获取收益率 |
| | | 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 totalProfit = planAmount.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN); |
| | | |
| | | String refererIds = dappMemberEntity.getRefererIds(); |
| | | List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | //生成流水佣金和盈利分成和流水记录,返回剩余盈利 |
| | |
| | | BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,totalProfit); |
| | | totalProfit = totalProfit.subtract(profitSharingTotal).subtract(systemTotal); |
| | | |
| | | //获取用户信息的是否盈利字段 |
| | | DappMemberEntity dappMember = dappMemberDao.selectById(memberId); |
| | | Integer isProfit = dappMember.getIsProfit() == null ? 1 : dappMember.getIsProfit(); |
| | | |
| | | BigDecimal totalAmount = igtOnHookPlanOrderItemDao.selectTotalAmountByByOrderIdAndMemberIdAndState(orderId,memberId,1,1); |
| | | igtOnHookPlanOrder.setState(2); |
| | | //一次挂机剩余的全部金额 |
| | | BigDecimal totalMoney = BigDecimal.ZERO; |
| | | if(isProfit == 2){ |
| | | //设置成不盈利,只返回收益加剩余挂机总金额 |
| | | totalMoney = totalProfit.add(avaAmount); |
| | | }else{ |
| | | //设置成盈利,如果中奖,返回收益,如果没中奖,则返回本金,最后加上剩余总挂机金额 |
| | | totalMoney = totalProfit.add(totalAmount).add(avaAmount); |
| | | } |
| | | if(totalMoney.compareTo(planAmount)<=0){ |
| | | igtOnHookPlanOrder.setProfitState(2); |
| | | }else{ |
| | | igtOnHookPlanOrder.setProfitState(1); |
| | | } |
| | | BigDecimal totalMoney = totalProfit.add(planAmount); |
| | | |
| | | igtOnHookPlanOrder.setProfit(totalProfit); |
| | | igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | dappMemberEntity.setIsOnHook(3); |
| | |
| | | |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | if(isProfit == 2){ |
| | | //设置成不盈利,只返回收益加剩余挂机总金额 |
| | | total = totalProfit.add(igtOnHookPlanOrder.getAvaAmount()).setScale(4, BigDecimal.ROUND_DOWN); |
| | | }else{ |
| | | //设置成盈利,如果中奖,返回收益,如果没中奖,则返回本金,最后加上剩余总挂机金额 |
| | | total = totalProfit.add(totalAmount).add(igtOnHookPlanOrder.getAvaAmount()).setScale(4, BigDecimal.ROUND_DOWN); |
| | | } |
| | | dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),total); |
| | | dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney); |
| | | |
| | | BigDecimal add = availableAmount.add(total); |
| | | BigDecimal add = availableAmount.add(totalMoney); |
| | | BigDecimal subtract = add.subtract(totalProfit); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberId, subtract, totalProfit, add, "投注盈利", 5); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | | |
| | | @Scheduled(cron = "0 0/5 * * * ? ") |
| | | public void updateAwardInfo(){ |
| | | Log.info("更新挂架开奖记录"); |
| | |
| | | DappOnHookAward dappOnHookAward = dappOnHookAwardDao.selectByByAwardTime(yyyyMMddHHMM); |
| | | dappOnHookAward.setState(1); |
| | | dappOnHookAwardDao.updateById(dappOnHookAward); |
| | | String redisKey = "on_hook_award_id"; |
| | | String redisKey = ""; |
| | | if("prod".equals(active)){ |
| | | redisKey = "on_hook_award_id"; |
| | | }else{ |
| | | redisKey = "on_hook_award_id_test"; |
| | | } |
| | | String onHookAwardRedisId = redisUtils.getString(redisKey); |
| | | if(StrUtil.isBlank(onHookAwardRedisId)){ |
| | | redisUtils.set(redisKey,dappOnHookAward.getId().toString(),0L); |