xiaoyong931011
2023-02-13 7b0429b26473970a6829cfc84aaab4ce82b6227e
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -66,6 +66,7 @@
    private final MallRegisterAppealMapper mallRegisterAppealMapper;
    private final MallTeamLeaderMapper mallTeamLeaderMapper;
    private final SpringContextHolder springContextHolder;
    private final MallAgentRecordMapper mallAgentRecordMapper;
    @Value("${spring.profiles.active}")
@@ -254,13 +255,18 @@
        mallMemberVo.setPrizeScore(wallet.getPrizeScore());
        mallMemberVo.setTotalCost(mallOrderInfoMapper.selectTotalAmount(id));
        //用户是否是团长
        List<MallTeamLeader> mallTeamLeaders = mallTeamLeaderMapper.selectListByMemberIdAndState(mallMember.getId(), MallTeamLeader.STATE_YES);
        if(CollUtil.isNotEmpty(mallTeamLeaders)){
            mallMemberVo.setIsTeamLeader(1);
        }else{
            mallMemberVo.setIsTeamLeader(2);
        //代理状态
        MallAgentRecord mallAgentRecordIng = mallAgentRecordMapper.selectByMemberIdAndState(id, MallAgentRecord.APPLY_ING);
        MallAgentRecord mallAgentRecordAgree = mallAgentRecordMapper.selectByMemberIdAndState(id, MallAgentRecord.APPLY_AGREE);
        MallAgentRecord mallAgentRecordDisagree = mallAgentRecordMapper.selectByMemberIdAndState(id, MallAgentRecord.APPLY_DISAGREE);
        if(ObjectUtil.isNotEmpty(mallAgentRecordIng)){
            mallMemberVo.setIsAgent(1);
        }else if(ObjectUtil.isNotEmpty(mallAgentRecordAgree)){
            mallMemberVo.setIsAgent(2);
        }else if(ObjectUtil.isNotEmpty(mallAgentRecordDisagree)){
            mallMemberVo.setIsAgent(3);
        }
        return new FebsResponse().success().data(mallMemberVo);
    }
@@ -735,6 +741,18 @@
        if(BigDecimal.ZERO.compareTo(amount)>0){
            return new FebsResponse().fail().message("请输入正确的充值金额");
        }
        Integer type = apiRechargeWalletDto.getType();
        if(2 == type){
            //成为合伙人的充值金额
            DataDictionaryCustom agentPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.PRICE_AMOUNT.getType(),
                    DataDictionaryEnum.PRICE_AMOUNT.getCode());
            String agentPrice = agentPriceDic.getValue();
            BigDecimal price = new BigDecimal(agentPrice);
            if(price.compareTo(amount) != 0){
                return new FebsResponse().fail().message("成为合伙人的金额为"+agentPrice);
            }
        }
        apiRechargeWalletDto.setMemberId(memberId);
        BrandWCPayRequestData brandWCPayRequestData = null;
        try {
@@ -750,6 +768,16 @@
        return new FebsResponse().success().data(map).message("充值即将到账");
    }
    @Override
    public void updateMemberAgent(Long memberId) {
        mallAgentRecordMapper.updateStateByMemberId(memberId);
        //更新用户表中的LEVEL
        MallMember mallMember = this.baseMapper.selectById(memberId);
        mallMember.setLevel(AgentLevelEnum.FIRST_LEVEL.name());
        this.baseMapper.updateById(mallMember);
    }
    private  String getXcxLoginUrl(String code) {
        String wechatLoginUrl =xcxProperties.getWecharLoginUrl();
        return String.format(wechatLoginUrl, xcxProperties.getXcxAppid(), xcxProperties.getXcxSecret(), code);