fix
Hentua
2023-05-09 0b0ce2eb06961c3670f687e2274d982004dfde41
src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
@@ -74,6 +74,11 @@
        // 非代理推代理,非代理上级拿的收益比例
        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());
@@ -127,6 +132,7 @@
            // 直推奖
            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());
            // 非代理推代理
@@ -140,13 +146,18 @@
                    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 -------
@@ -182,8 +193,8 @@
                    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 =====
@@ -364,8 +375,8 @@
        }
        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;
    }
@@ -421,7 +432,7 @@
            }
            memberList.add(item);
            levelMemberMap.put(item.getLevel(), memberList);
            levelMemberMap.put(level, memberList);
        });
        if (levelMemberMap.isEmpty()) {