| | |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | private final MallMemberClassMapper mallMemberClassMapper; |
| | | private final MallMemberHouseMapper mallMemberHouseMapper; |
| | | private final MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | String referrerId = mallMember.getReferrerId(); |
| | | MallMember mallMemberParent = memberMapper.selectInfoByInviteId(referrerId); |
| | | Long id = mallMemberParent.getId(); |
| | | DataDictionaryCustom returnPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.MEMBER_RETURN_PERCENT.getType(), |
| | | DataDictionaryEnum.MEMBER_RETURN_PERCENT.getCode() |
| | | ); |
| | | String returnPercentStr = StrUtil.isNotEmpty(returnPercentDic.getValue()) ? "1" : returnPercentDic.getValue(); |
| | | BigDecimal returnPercent = new BigDecimal(returnPercentStr).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal amountActual = amountBigDecimal.multiply(returnPercent).setScale(2, BigDecimal.ROUND_DOWN); |
| | | memberWalletService.add(amountActual, id, "balance"); |
| | | mallMoneyFlowService.addMoneyFlow(id, amountActual, MoneyFlowTypeEnum.DYNAMIC_ACHIEVE.getValue(), |
| | | mallOrderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); |
| | | |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOneByOrderNoAndMemberIdAndRtMemberId(mallOrderInfo.getOrderNo(), memberId, id); |
| | | if(ObjectUtil.isEmpty(mallMoneyFlow)){ |
| | | DataDictionaryCustom returnPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.MEMBER_RETURN_PERCENT.getType(), |
| | | DataDictionaryEnum.MEMBER_RETURN_PERCENT.getCode() |
| | | ); |
| | | String returnPercentStr = StrUtil.isNotEmpty(returnPercentDic.getValue()) ? "1" : returnPercentDic.getValue(); |
| | | BigDecimal returnPercent = new BigDecimal(returnPercentStr).divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal amountActual = amountBigDecimal.multiply(returnPercent).setScale(2, BigDecimal.ROUND_DOWN); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | id, |
| | | amountActual, |
| | | MoneyFlowTypeEnum.DYNAMIC_ACHIEVE.getValue(), |
| | | mallOrderInfo.getOrderNo(), |
| | | "直推奖", |
| | | "直推奖", |
| | | mallMember.getId(), |
| | | 1, |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | 2); |
| | | } |
| | | } |
| | | } |
| | | for(MallOrderItem mallOrderItem : mallOrderItemList){ |
| | |
| | | if(ObjectUtil.isNotEmpty(mallGoods.getIsUnreal()) && 1 == mallGoods.getIsUnreal()){ |
| | | mallOrderInfo.setStatus(OrderStatusEnum.FINISH.getValue()); |
| | | mallOrderInfoMapper.updateById(mallOrderInfo); |
| | | } |
| | | //是否送券 1:是 2:否 |
| | | BigDecimal levelTwoPrice = mallGoods.getLevelTwoPrice(); |
| | | if(BigDecimal.ONE.compareTo(levelTwoPrice) == 0){ |
| | | MallRollPerk mallRollPerk = new MallRollPerk(); |
| | | mallRollPerk.setMemberId(memberId); |
| | | mallRollPerk.setState(1); |
| | | mallRollPerk.setRollId(mallGoods.getLevelThreePrice().longValue()); |
| | | mallRollPerkMapper.insert(mallRollPerk); |
| | | } |
| | | //赠送积分 |
| | | BigDecimal levelOnePrice = mallGoods.getLevelOnePrice(); |
| | | if(BigDecimal.ZERO.compareTo(levelOnePrice) <= 0){ |
| | | memberWalletService.add(levelOnePrice, memberId, "score"); |
| | | //是否送券 1:是 2:否 |
| | | BigDecimal levelTwoPrice = mallGoods.getLevelTwoPrice(); |
| | | if(BigDecimal.ONE.compareTo(levelTwoPrice) == 0){ |
| | | MallRollPerk mallRollPerk = new MallRollPerk(); |
| | | mallRollPerk.setMemberId(memberId); |
| | | mallRollPerk.setState(1); |
| | | mallRollPerk.setRollId(mallGoods.getLevelThreePrice().longValue()); |
| | | mallRollPerkMapper.insert(mallRollPerk); |
| | | } |
| | | //赠送积分 |
| | | BigDecimal levelOnePrice = mallGoods.getLevelOnePrice(); |
| | | if(BigDecimal.ZERO.compareTo(levelOnePrice) <= 0){ |
| | | memberWalletService.add(levelOnePrice, memberId, "score"); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow(memberId, levelOnePrice, MoneyFlowTypeEnum.STATIC_BONUS.getValue(), |
| | | mallOrderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue(),"赠送积分",2); |
| | | mallMoneyFlowService.addMoneyFlow(memberId, levelOnePrice, MoneyFlowTypeEnum.STATIC_BONUS.getValue(), |
| | | mallOrderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue(),"赠送积分",2); |
| | | } |
| | | } |
| | | } |
| | | } |