| | |
| | | // 非代理推代理,非代理上级拿的收益比例 |
| | | DataDictionaryCustom indirectPerDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.UNAGENT_TO_AGENT_PARENT.getType(), DataDictionaryEnum.UNAGENT_TO_AGENT_PARENT.getCode()); |
| | | |
| | | |
| | | // 非代理推代理,非代理上级拿的收益比例 |
| | | DataDictionaryCustom indirectPerTwoDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.UNAGENT_TO_AGENT_PARENT_TWO.getType(), DataDictionaryEnum.UNAGENT_TO_AGENT_PARENT_TWO.getCode()); |
| | | |
| | | |
| | | // 非代理推代理,非代理的直推收益比例 |
| | | DataDictionaryCustom unAgentDirectDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.UNAGENT_TO_AGENT.getType(), DataDictionaryEnum.UNAGENT_TO_AGENT.getCode()); |
| | | |
| | | // 父级会员直推人数 |
| | | Integer directCnt = mallMemberMapper.selectOwnCntByInviteIdAndAccountLevel(parentMember.getInviteId(), parentMember.getAccountLevel()); |
| | | // 父级需要拥有 此会员 对应级别的直推数量 |
| | | Integer directCnt = mallMemberMapper.selectOwnCntByInviteIdAndAccountLevel(parentMember.getInviteId(), member.getAccountLevel()); |
| | | List<DataDictionaryCustom> dataDices = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.DIRECT_BONUS_SETTING.getType()); |
| | | |
| | | directCnt = directCnt == null ? 0 : directCnt; |
| | |
| | | } else { |
| | | |
| | | // 判断上级是否与自己购买的套餐符合,若符合则走3级直推逻辑,若不符合则另外一个 |
| | | if (parentMember.getAccountLevel().equals(item.getGoodsLevel()) || AccountLevelEnums.VIP.getLevel().equals(parentMember.getAccountLevel())) { |
| | | |
| | | if (parentMember.getAccountLevel() >= item.getGoodsLevel()) { |
| | | for (DataDictionaryCustom dataDic : dataDices) { |
| | | JSONObject jsonObject = JSONObject.parseObject(dataDic.getValue()); |
| | | if (directCnt >= jsonObject.getInteger("pushCnt")) { |
| | |
| | | |
| | | // 直推奖 |
| | | BigDecimal profit = amount.multiply(profitPer.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)); |
| | | log.info("直推奖励:{}", profit); |
| | | changeScoreAndCommission(parentMember.getId(), profit, MoneyFlowTypeEnum.DIRECT_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | |
| | | // 非代理推代理 |
| | |
| | | continue; |
| | | } |
| | | |
| | | int index = 1; |
| | | for (MallMember mallMember : mallMembers) { |
| | | if (!item.getGoodsLevel().equals(mallMember.getAccountLevel())) { |
| | | break; |
| | | } |
| | | |
| | | if (index != 2) { |
| | | indirectPerDic = indirectPerTwoDic; |
| | | } |
| | | BigDecimal doubleParentProfit = profit.multiply(new BigDecimal(indirectPerDic.getValue())); |
| | | changeScoreAndCommission(mallMember.getId(), doubleParentProfit, MoneyFlowTypeEnum.DIRECT_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | index++; |
| | | } |
| | | } |
| | | // ----- 直推奖 end ------- |
| | |
| | | continue; |
| | | } |
| | | |
| | | walletService.add(direct, parent.getId(), "commission"); |
| | | moneyFlowService.addMoneyFlow(parent.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.COMMISSION.getValue()); |
| | | walletService.add(direct, parent.getId(), "balance"); |
| | | moneyFlowService.addMoneyFlow(parent.getId(), direct, MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); |
| | | moneyFlowService.addMoneyFlow(parent.getId(), direct.negate(), MoneyFlowTypeEnum.RECOMMEND_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); |
| | | } |
| | | // =======隔代奖== end ===== |
| | |
| | | } |
| | | |
| | | income = map.get("amount"); |
| | | walletService.add(income, memberId, "commission"); |
| | | moneyFlowService.addMoneyFlow(memberId, income, type, orderNo, FlowTypeEnum.COMMISSION.getValue()); |
| | | walletService.add(income, memberId, "balance"); |
| | | moneyFlowService.addMoneyFlow(memberId, income, type, orderNo, FlowTypeEnum.BALANCE.getValue()); |
| | | moneyFlowService.addMoneyFlow(memberId, income.negate(), type, orderNo, FlowTypeEnum.SCORE.getValue()); |
| | | return income; |
| | | } |
| | |
| | | } |
| | | |
| | | memberList.add(item); |
| | | levelMemberMap.put(item.getLevel(), memberList); |
| | | levelMemberMap.put(level, memberList); |
| | | }); |
| | | |
| | | if (levelMemberMap.isEmpty()) { |