| | |
| | | log.info("积分订单无返利"); |
| | | return; |
| | | } |
| | | BigDecimal indirectPer = BigDecimal.valueOf(0.25); |
| | | BigDecimal indirectPer2 = BigDecimal.valueOf(0.15); |
| | | |
| | | MallMember member = mallMemberMapper.selectById(orderInfo.getMemberId()); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | // 非代理推代理,非代理上级拿的收益比例 |
| | | DataDictionaryCustom indirectPerDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.UNAGENT_TO_AGENT_PARENT.getType(), DataDictionaryEnum.UNAGENT_TO_AGENT_PARENT.getCode()); |
| | | |
| | | // 非代理推代理,非代理的直推收益比例 |
| | | DataDictionaryCustom unAgentDirectDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.UNAGENT_TO_AGENT.getType(), DataDictionaryEnum.UNAGENT_TO_AGENT.getCode()); |
| | | |
| | | // 父级会员直推人数 |
| | | Integer directCnt = mallMemberMapper.selectOwnCntByInviteIdAndAccountLevel(parentMember.getInviteId(), parentMember.getAccountLevel()); |
| | | List<DataDictionaryCustom> dataDices = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.DIRECT_BONUS_SETTING.getType()); |
| | |
| | | if (CollUtil.isEmpty(items)) { |
| | | return; |
| | | } |
| | | |
| | | // 推荐奖比例 |
| | | DataDictionaryCustom indrectDicPropDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RECOMMEND_BONUS.getType(), DataDictionaryEnum.RECOMMEND_BONUS.getCode()); |
| | | |
| | | for (MallOrderItem item : items) { |
| | | // 减去成本后算收益 |
| | |
| | | isSameLevel = 1; |
| | | // 非代理推代理/非股东推股东 |
| | | } else { |
| | | profitPer = BigDecimal.valueOf(10); |
| | | profitPer = new BigDecimal(unAgentDirectDic.getValue()); |
| | | isSameLevel = 2; |
| | | } |
| | | } |
| | |
| | | // 直推奖 |
| | | BigDecimal profit = amount.multiply(profitPer.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)); |
| | | changeScoreAndCommission(parentMember.getId(), profit, MoneyFlowTypeEnum.DIRECT_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | |
| | | // 代理推代理 |
| | | // if (isSameLevel == 1) { |
| | | // MallMember doubleParentMember = mallMemberMapper.selectInfoByInviteId(parentMember.getReferrerId()); |
| | | // if (doubleParentMember == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // BigDecimal doubleParentProfit = profit.multiply(indirectPer); |
| | | // changeScoreAndCommission(doubleParentMember.getId(), doubleParentProfit, MoneyFlowTypeEnum.DIRECT_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | // } |
| | | |
| | | // 非代理推代理 |
| | | if (isSameLevel == 2) { |
| | |
| | | break; |
| | | } |
| | | |
| | | BigDecimal doubleParentProfit = profit.multiply(indirectPer2); |
| | | BigDecimal doubleParentProfit = profit.multiply(new BigDecimal(indirectPerDic.getValue())); |
| | | changeScoreAndCommission(mallMember.getId(), doubleParentProfit, MoneyFlowTypeEnum.DIRECT_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | // 隔代比例 |
| | | BigDecimal indrectDicProp = new BigDecimal(20); |
| | | BigDecimal indrectDicProp = new BigDecimal(indrectDicPropDic.getValue()); |
| | | |
| | | // 隔代推荐奖 收益 |
| | | direct = direct.multiply(indrectDicProp.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP)); |
| | |
| | | walletService.add(direct, parent.getId(), "commission"); |
| | | moneyFlowService.addMoneyFlow(parent.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.COMMISSION.getValue()); |
| | | moneyFlowService.addMoneyFlow(parent.getId(), direct.negate(), MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); |
| | | changeScoreAndCommission(parent.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | } |
| | | // =======隔代奖== end ===== |
| | | } |