| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.dto.AgentDto; |
| | | import cc.mrbird.febs.mall.dto.MoneyChargeListDto; |
| | | import cc.mrbird.febs.mall.dto.MoneyFlowListDto; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | |
| | | import cc.mrbird.febs.mall.mapper.MallMemberPaymentMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallMemberService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | private final MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | |
| | | private final MallMemberPaymentMapper mallMemberPaymentMapper; |
| | | |
| | | private final IApiMallMemberWalletService iApiMallMemberWalletService; |
| | | |
| | | @Override |
| | | public IPage<MallMember> getMallMemberList(MallMember mallMember, QueryRequest request) { |
| | |
| | | if(ObjectUtil.isEmpty(mallMoneyFlow)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新后重试"); |
| | | } |
| | | if(1 != mallMoneyFlow.getStatus()){ |
| | | return new FebsResponse().fail().message("当前状态不是提现中"); |
| | | } |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.insert(mallMoneyFlow); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | if(ObjectUtil.isEmpty(mallMoneyFlow)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新后重试"); |
| | | } |
| | | if(1 != mallMoneyFlow.getStatus()){ |
| | | return new FebsResponse().fail().message("当前状态不是提现中"); |
| | | } |
| | | mallMoneyFlow.setStatus(3); |
| | | mallMoneyFlowMapper.insert(mallMoneyFlow); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | |
| | | //用户钱包增加对应的余额 |
| | | iApiMallMemberWalletService.addBalance(mallMoneyFlow.getAmount().negate(),mallMoneyFlow.getMemberId()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public AdminMallMemberPaymentVo getMallMemberPaymentInfoByFlowId(long id) { |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVo = new AdminMallMemberPaymentVo(); |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id); |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVo = mallMemberPaymentMapper.getMallMemberPaymentInfoByMemberId(mallMoneyFlow.getMemberId()); |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVoa = mallMemberPaymentMapper.getMallMemberPaymentInfoByMemberId(mallMoneyFlow.getMemberId()); |
| | | if(ObjectUtil.isNotEmpty(adminMallMemberPaymentVoa)){ |
| | | adminMallMemberPaymentVo = adminMallMemberPaymentVoa; |
| | | } |
| | | return adminMallMemberPaymentVo; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminAgentVo> getAgentList(AgentDto agentDto, QueryRequest request) { |
| | | Page<AdminAgentVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminAgentVo> adminAgentVos = this.baseMapper.getAgentListInPage(page, agentDto); |
| | | List<AdminAgentVo> records = adminAgentVos.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminAgentVo adminAgentVo : records){ |
| | | String inviteId = adminAgentVo.getInviteId(); |
| | | //直接下级 |
| | | List<MallMember> mallMembers = mallMemberMapper.selectChildAgentListByInviteId(inviteId); |
| | | adminAgentVo.setMemberNum(CollUtil.isEmpty(mallMembers) ? 0 : mallMembers.size()); |
| | | |
| | | //获取总数 |
| | | List<MallMember> allMallMembers =mallMemberMapper.selectAllChildAgentListByInviteId(inviteId); |
| | | adminAgentVo.setAllMemberNum(CollUtil.isEmpty(allMallMembers) ? 0 : allMallMembers.size()); |
| | | } |
| | | } |
| | | return adminAgentVos; |
| | | } |
| | | |
| | | } |