| | |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.ScoreFlowTypeEnum; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.mall.dto.ApiMallActListDto; |
| | | import cc.mrbird.febs.mall.dto.ApiMallActWinDetailsDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | |
| | | BigDecimal prizeScore = wallet.getPrizeScore(); |
| | | Integer actScoreCnt = mallActSet.getActScoreCnt(); |
| | | if(prizeScore.compareTo(new BigDecimal(actScoreCnt))<0){ |
| | | throw new FebsException("竞猜积分不足"); |
| | | throw new FebsException("积分不足"); |
| | | } |
| | | /** |
| | | * 中奖概率 20% |
| | |
| | | // 消耗积分 |
| | | BigDecimal useScore = new BigDecimal(actScoreCnt); |
| | | mallMemberWalletService.reduce(useScore, wallet.getMemberId(), "prizeScore"); |
| | | mallMoneyFlowService.addMoneyFlow(wallet.getMemberId(), useScore.negate(), MoneyFlowTypeEnum.PRIZE.getValue(), null, FlowTypeEnum.PRIZE_SCORE.getValue()); |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | wallet.getMemberId(), |
| | | useScore.negate(), |
| | | ScoreFlowTypeEnum.LUCKY_DRAW.getValue(), |
| | | MallUtils.getOrderNum(), |
| | | FlowTypeEnum.PRIZE_SCORE.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.LUCKY_DRAW.getDesc(),useScore), |
| | | 2 |
| | | ); |
| | | |
| | | if (apiMallAwardDetailsVo.getAwardType() != 3) { |
| | | BigDecimal prize = new BigDecimal(apiMallAwardDetailsVo.getAwardValue()); |
| | | if (apiMallAwardDetailsVo.getAwardType() == 1) { |
| | | mallMemberWalletService.add(prize, wallet.getMemberId(), "prizeScore"); |
| | | mallMoneyFlowService.addMoneyFlow(wallet.getMemberId(), prize, MoneyFlowTypeEnum.PRIZE.getValue(), null, FlowTypeEnum.PRIZE_SCORE.getValue()); |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | wallet.getMemberId(), |
| | | prize, |
| | | ScoreFlowTypeEnum.LUCKY_DRAW.getValue(), |
| | | MallUtils.getOrderNum(), |
| | | FlowTypeEnum.PRIZE_SCORE.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.LUCKY_DRAW.getDesc(),prize), |
| | | 2 |
| | | ); |
| | | } else if (apiMallAwardDetailsVo.getAwardType() == 2) { |
| | | mallMemberWalletService.add(prize, wallet.getMemberId(), "commission"); |
| | | mallMoneyFlowService.addMoneyFlow(wallet.getMemberId(), prize, MoneyFlowTypeEnum.PRIZE.getValue(), null, FlowTypeEnum.COMMISSION.getValue()); |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | wallet.getMemberId(), |
| | | prize, |
| | | ScoreFlowTypeEnum.LUCKY_DRAW_COMMISSION.getValue(), |
| | | MallUtils.getOrderNum(), |
| | | FlowTypeEnum.COMMISSION.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.LUCKY_DRAW_COMMISSION.getDesc(),prize), |
| | | 2 |
| | | ); |
| | | } |
| | | } |
| | | return apiMallAwardDetailsVo; |