| | |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | private final MallSystemSettingMapper mallSystemSettingMapper; |
| | | private final IAdminMallMemberService adminMallMemberService; |
| | | |
| | | /** |
| | | * 直推收益 |
| | |
| | | |
| | | // 非代理推代理,非代理上级拿的收益比例 |
| | | 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()); |
| | |
| | | } else { |
| | | |
| | | // 判断上级是否与自己购买的套餐符合,若符合则走3级直推逻辑,若不符合则另外一个 |
| | | if (parentMember.getAccountLevel() >= item.getGoodsLevel()) { |
| | | if (parentMember.getAccountLevel() == 1 && item.getGoodsLevel() != 1) { |
| | | for (DataDictionaryCustom dataDic : dataDices) { |
| | | JSONObject jsonObject = JSONObject.parseObject(dataDic.getValue()); |
| | | if (directCnt >= jsonObject.getInteger("pushCnt")) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | List<MallMember> mallMembers = mallMemberMapper.selectParentMemberList(StrUtil.split(parentMember.getReferrerIds(), ','), parentMember.getReferrerId(), 2); |
| | | List<MallMember> mallMembers = adminMallMemberService.findParentMemberList(StrUtil.split(parentMember.getReferrerIds(), ','), 2, true); |
| | | if (CollUtil.isEmpty(mallMembers)) { |
| | | continue; |
| | | } |
| | | |
| | | int index = 1; |
| | | for (MallMember mallMember : mallMembers) { |
| | | if (!item.getGoodsLevel().equals(mallMember.getAccountLevel())) { |
| | | break; |
| | | if (mallMember.getAccountLevel() == 1) { |
| | | continue; |
| | | } |
| | | |
| | | BigDecimal doubleParentProfit = profit.multiply(new BigDecimal(indirectPerDic.getValue())); |
| | | if (index == 2) { |
| | | indirectPerDic = indirectPerTwoDic; |
| | | } |
| | | BigDecimal doubleParentProfit = amount.multiply(new BigDecimal(indirectPerDic.getValue()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)); |
| | | changeScoreAndCommission(mallMember.getId(), doubleParentProfit, MoneyFlowTypeEnum.DIRECT_BONUS.getValue(), orderInfo.getOrderNo()); |
| | | index++; |
| | | } |
| | | } |
| | | // ----- 直推奖 end ------- |
| | |
| | | } |
| | | |
| | | List<String> parents = StrUtil.split(parentMember.getReferrerIds(), ','); |
| | | List<MallMember> members = mallMemberMapper.selectByInviteIds(parents); |
| | | List<MallMember> members = adminMallMemberService.findParentMemberList(parents, null, true); |
| | | if (CollUtil.isEmpty(members)) { |
| | | return; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | BigDecimal bonus = BigDecimal.ZERO; |
| | | if (AccountLevelEnums.VVIP.getLevel().equals(type)) { |
| | | bonus = systemSetting.getAgentBonus(); |
| | | } else { |
| | | bonus = systemSetting.getPartnerBonus(); |
| | | } |
| | | |
| | | // 代理 |
| | | BigDecimal waitToBonus = systemSetting.getAgentBonus().multiply(new BigDecimal(dic.getValue()).divide(hundred, 2, RoundingMode.HALF_UP)); |
| | | BigDecimal waitToBonus = bonus.multiply(new BigDecimal(dic.getValue()).divide(hundred, 2, RoundingMode.HALF_UP)); |
| | | |
| | | // 代理 |
| | | List<MallMember> mallMembers = mallMemberMapper.selectAgentOrPartnetMemberList(type); |
| | |
| | | }); |
| | | |
| | | if (type.equals(AccountLevelEnums.VVIP.getLevel())) { |
| | | changeSystemBonus(null, waitToBonus,null); |
| | | changeSystemBonus(null, waitToBonus.negate(),null); |
| | | } else { |
| | | changeSystemBonus(null, null, waitToBonus); |
| | | changeSystemBonus(null, null, waitToBonus.negate()); |
| | | } |
| | | |
| | | bonusRecord(waitToBonus, type, null, null); |
| | |
| | | } |
| | | |
| | | memberList.add(item); |
| | | levelMemberMap.put(item.getLevel(), memberList); |
| | | levelMemberMap.put(level, memberList); |
| | | }); |
| | | |
| | | if (levelMemberMap.isEmpty()) { |
| | |
| | | totalBonus = totalBonus.add(levelBonus); |
| | | } |
| | | |
| | | changeSystemBonus(totalBonus, null, null); |
| | | changeSystemBonus(totalBonus.negate(), null, null); |
| | | |
| | | bonusRecord(totalBonus, 1, null, null); |
| | | log.info("###全网分红执行--end--###"); |
| | | } |
| | | |