| | |
| | | package cc.mrbird.febs.mall.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; |
| | | import cc.mrbird.febs.common.enumerates.RunVipDataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.YesOrNoEnum; |
| | | import cc.mrbird.febs.common.enumerates.*; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.mall.dto.ApiMemberChargeFailDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.AsyncService; |
| | | import cc.mrbird.febs.mall.service.IAgentService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.*; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | |
| | | private final RunNodeSetMapper runNodeSetMapper; |
| | | private final AsyncService asyncService; |
| | | private final RunVipGrowMapper runVipGrowMapper; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | RunVip runVipNow = runVipMap.get(mallMember.getLevel()); |
| | | RunVip runVipNext = runVips.stream().filter(runVip -> runVip.getOrderNumber() == runVipNow.getOrderNumber() + 1).findFirst().orElse(null); |
| | | if(null != runVipNext){ |
| | | BigDecimal add = runVipNow.getPresentPrice().add(amount); |
| | | |
| | | runVipGrow = new RunVipGrow(); |
| | | runVipGrow.setMemberId(memberId); |
| | | runVipGrow.setLevelNow(mallMember.getLevel()); |
| | | runVipGrow.setLevelNext(runVipNext.getVipCode()); |
| | | runVipGrow.setAmountAll(runVipNext.getPresentPrice()); |
| | | runVipGrow.setAmount(amount); |
| | | runVipGrow.setAmountNow(amount); |
| | | runVipGrow.setAmount(add); |
| | | runVipGrow.setAmountNow(add); |
| | | runVipGrowMapper.insert(runVipGrow); |
| | | } |
| | | } |
| | | } |
| | | //更新会员的等级和会员升级的时间 |
| | | mallMemberMapper.updateVipLevelTimeAndLevel(memberId,DateUtil.date(),vipCode); |
| | | |
| | | //直推权益 |
| | | asyncService.directCoin(mallCharge.getAmount(),memberId); |
| | | |
| | | agentProducer.sendNodeUpMsg(memberId); |
| | | } |
| | |
| | | MallMember graMember = mallMemberMapper.selectInfoByInviteId(parentMember.getReferrerId()); |
| | | NodeUp(graMember.getId(),directCnt,teamCnt,achieveCnt); |
| | | } |
| | | |
| | | @Override |
| | | public void chargeSuccessMsg(Long chargeId) { |
| | | |
| | | MallCharge mallCharge = mallChargeMapper.selectById(chargeId); |
| | | if(null == mallCharge){ |
| | | return; |
| | | } |
| | | Long memberId = mallCharge.getMemberId(); |
| | | BigDecimal amount = mallCharge.getAmount(); |
| | | |
| | | walletService.addCommission(amount, memberId); |
| | | String orderNo = MallUtils.getOrderNum("C"); |
| | | mallMoneyFlowService.runVipMoneyFlowAdd( |
| | | memberId, |
| | | memberId, |
| | | orderNo, |
| | | FlowTypeEnum.COMMISSION.getValue(), |
| | | RunVipMoneyFlowTypeEnum.COMMISSION_PAY_CHARGE.getValue(), |
| | | amount, |
| | | StrUtil.format(RunVipMoneyFlowTypeEnum.COMMISSION_PAY_CHARGE.getDescription(),amount), |
| | | YesOrNoEnum.YES.getValue() |
| | | ); |
| | | } |
| | | } |