KKSU
2024-03-18 57ac3a35ac056f0a09d8a013e8f3da2ecfe8a7c6
src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
@@ -899,7 +899,7 @@
                        continue;
                    }
                    BigDecimal nftTotal = mallProductBuy.getNftTotal();
                    BigDecimal profit = nftTotal.multiply(profitPercent.multiply(new BigDecimal(0.01)));
                    BigDecimal profit = nftTotal.multiply(profitPercent.multiply(new BigDecimal(0.01))).setScale(2,BigDecimal.ROUND_DOWN);
                    if(totalPerk.compareTo(profit) <= 0){
                        profit = totalPerk;
@@ -1067,7 +1067,8 @@
         * 当前时间比结束时间大
         */
        if(nowTime.compareTo(endTime) >= 0){
            List<MallProductBuyRecord> mallProductBuyRecords = mallProductBuyRecordMapper.selectByState(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue());
            List<MallProductBuyRecord> mallProductBuyRecords = mallProductBuyRecordMapper.selectByState(
                    ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue());
            if(CollUtil.isNotEmpty(mallProductBuyRecords)){
                for(MallProductBuyRecord mallProductBuyRecord : mallProductBuyRecords){
                    /**
@@ -1200,7 +1201,7 @@
        queryMallMoneyFlow.eq("is_return",AppContants.MEMBER_FLOW_ING);
        queryMallMoneyFlow.eq("flow_type",FlowTypeNewEnum.NFT.getValue());
        List<MallMoneyFlow> mallMoneyFlows = mallMoneyFlowMapper.selectList(queryMallMoneyFlow);
        if(CollUtil.isNotEmpty(mallMoneyFlows)){
        if(CollUtil.isEmpty(mallMoneyFlows)){
            return;
        }
@@ -1267,7 +1268,7 @@
        queryMallMoneyFlow.eq("is_return",AppContants.MEMBER_FLOW_ING);
        queryMallMoneyFlow.eq("flow_type",FlowTypeNewEnum.NFT.getValue());
        List<MallMoneyFlow> mallMoneyFlows = mallMoneyFlowMapper.selectList(queryMallMoneyFlow);
        if(CollUtil.isNotEmpty(mallMoneyFlows)){
        if(CollUtil.isEmpty(mallMoneyFlows)){
            return;
        }
@@ -1334,7 +1335,7 @@
        queryMallMoneyFlow.eq("is_return",AppContants.MEMBER_FLOW_ING);
        queryMallMoneyFlow.eq("flow_type",FlowTypeNewEnum.NFT.getValue());
        List<MallMoneyFlow> mallMoneyFlows = mallMoneyFlowMapper.selectList(queryMallMoneyFlow);
        if(CollUtil.isNotEmpty(mallMoneyFlows)){
        if(CollUtil.isEmpty(mallMoneyFlows)){
            return;
        }
@@ -1419,8 +1420,13 @@
            //上级
            String referrerId = mallMember.getReferrerId();
            MallMember mallMemberRef = memberMapper.selectInfoByInviteId(referrerId);
            if(ObjectUtil.isEmpty(mallMemberRef)){
                continue;
            }
            List<MallMember> mallMembersAll = memberMapper.selectAllChildAgentListByInviteId(referrerId);
            if(ObjectUtil.isEmpty(mallMembersAll)){
                continue;
            }
            List<MallMember> mallMembers = memberMapper.selectByRefererId(referrerId);
            Set<Long> mallMembersSet = mallMembers.stream().map(MallMember::getId).collect(Collectors.toSet());
            mallMembersSet.retainAll(collect);
@@ -1445,18 +1451,23 @@
                TeamPerkDto teamPerkDto = JSONObject.parseObject(levelDic.getValue(), TeamPerkDto.class);
                Integer directCntLevel = teamPerkDto.getDirectCnt();
                Integer teamCnt = teamPerkDto.getTeamCnt();
                if(directCntLevel >= intersection.size() &&
                        teamCnt >= mallMembersAll.size()){
                    mallMemberRef.setLevel(level);
                    memberMapper.updateById(mallMemberRef);
                    flag = true;
                }
                String nextLevel = MemberLevelNewEnum.ZERO_LEVEL.getNextLevel(level);
                level = nextLevel;
                if(level.equals(MemberLevelNewEnum.WU_LEVEL.getType()) &&
                        nextLevel.equals(MemberLevelNewEnum.WU_LEVEL.getType()) ){
                    mallMemberRef.setLevel(level);
                    memberMapper.updateById(mallMemberRef);
                if(directCntLevel <= intersection.size()){
                    if(teamCnt <= mallMembersAll.size()){
                        mallMemberRef.setLevel(level);
                        memberMapper.updateById(mallMemberRef);
                        String nextLevel = MemberLevelNewEnum.ZERO_LEVEL.getNextLevel(level);
                        level = nextLevel;
                        if(level.equals(MemberLevelNewEnum.WU_LEVEL.getType()) &&
                                nextLevel.equals(MemberLevelNewEnum.WU_LEVEL.getType()) ){
                            mallMemberRef.setLevel(level);
                            memberMapper.updateById(mallMemberRef);
                            flag = true;
                        }
                    }else{
                        flag = true;
                    }
                }else{
                    flag = true;
                }
            }