| | |
| | | List<DataDictionaryCustom> dataDices = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.INDIRECT_BONUS_SETTING.getType()); |
| | | |
| | | directCnt = directCnt == null ? 0 :directCnt; |
| | | // 隔代字典 |
| | | DataDictionaryCustom indrectDic = new DataDictionaryCustom(); |
| | | for (DataDictionaryCustom dataDic : dataDices) { |
| | | if (directCnt > Integer.parseInt(dataDic.getValue())) { |
| | | indrectDic = dataDic; |
| | | } |
| | | } |
| | | |
| | | // 隔代比例 |
| | | BigDecimal indrectDicProp = new BigDecimal(indrectDic.getValue()); |
| | | BigDecimal indrectDicProp = BigDecimal.ZERO; |
| | | for (DataDictionaryCustom dataDic : dataDices) { |
| | | JSONObject jsonObject = JSONObject.parseObject(dataDic.getValue()); |
| | | if (directCnt >= jsonObject.getInteger("pushCnt")) { |
| | | indrectDicProp = jsonObject.getBigDecimal("prop"); |
| | | } |
| | | } |
| | | |
| | | // 隔代推荐奖 收益 |
| | | direct = direct.divide(indrectDicProp, 2, RoundingMode.HALF_UP); |
| | |
| | | continue; |
| | | } |
| | | |
| | | BigDecimal preProfit = income.multiply(prop).divide(BigDecimal.valueOf(children.size()), 2, RoundingMode.HALF_DOWN); |
| | | |
| | | |
| | | int reduce = walletService.reduce(preProfit.negate(), mallMember.getId(), "commission"); |
| | | BigDecimal reduceProfit = income.multiply(prop); |
| | | int reduce = walletService.reduce(reduceProfit.negate(), mallMember.getId(), "commission"); |
| | | if (reduce == 2) { |
| | | continue; |
| | | } |
| | | |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), income.negate(), MoneyFlowTypeEnum.THANKFUL.getValue(), null, FlowTypeEnum.COMMISSION.getValue()); |
| | | |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), reduceProfit.negate(), MoneyFlowTypeEnum.THANKFUL.getValue(), null, FlowTypeEnum.COMMISSION.getValue()); |
| | | for (MallMember child : children) { |
| | | BigDecimal preProfit = income.multiply(prop).divide(BigDecimal.valueOf(children.size()), 2, RoundingMode.HALF_DOWN); |
| | | if (preProfit.compareTo(BigDecimal.ZERO) < 1) { |
| | | continue; |
| | | } |
| | | |
| | | int reduce1 = walletService.reduce(preProfit.negate(), child.getId(), "score"); |
| | | if (reduce1 == 2) { |
| | | continue; |