| | |
| | | package cc.mrbird.febs.dapp.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.ShareCodeUtil; |
| | | import cc.mrbird.febs.dapp.dto.ApproveDto; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | |
| | | import cc.mrbird.febs.dapp.mapper.DappWalletMineDao; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | |
| | | private final DappWalletMineDao dappWalletMineDao; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void approve(ApproveDto approveDto) { |
| | | DappMemberEntity member = new DappMemberEntity(); |
| | | member.setAddress(approveDto.getAddress()); |
| | |
| | | } |
| | | } |
| | | member.setRefererIds(ids); |
| | | dappMemberDao.updateById(member); |
| | | } |
| | | dappMemberDao.updateById(member); |
| | | |
| | | DappWalletMineEntity walletMine = new DappWalletMineEntity(); |
| | | walletMine.setMemberId(member.getId()); |
| | | walletMine.setTotalAmount(BigDecimal.ZERO); |
| | | walletMine.setAvailableAmount(BigDecimal.ZERO); |
| | | walletMine.setFrozenAmount(BigDecimal.ZERO); |
| | | dappWalletMineDao.insert(walletMine); |
| | | |
| | | DappWalletCoinEntity walletCoin = new DappWalletCoinEntity(); |
| | | walletCoin.setMemberId(member.getId()); |
| | | walletCoin.setTotalAmount(BigDecimal.ZERO); |
| | | walletCoin.setAvailableAmount(BigDecimal.ZERO); |
| | | walletCoin.setFrozenAmount(BigDecimal.ZERO); |
| | | dappWalletCoinDao.insert(walletCoin); |
| | | } |
| | | |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<DappMemberEntity> selectInPage(DappMemberEntity member, QueryRequest request) { |
| | | Page<DappMemberEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return dappMemberDao.selectInPage(member, page); |
| | | } |
| | | |
| | | @Override |
| | | public DappMemberEntity findByAddress(String address) { |
| | | return dappMemberDao.selectByAddress(address); |
| | | } |
| | | |
| | | @Override |
| | | public void accountStatus(Long id) { |
| | | DappMemberEntity member = dappMemberDao.selectById(id); |
| | | if (member == null) { |
| | | throw new FebsException("用户不存在"); |
| | | } |
| | | |
| | | if (member.getAccountStatus() == AppContants.INT_FLAG_Y) { |
| | | member.setAccountStatus(AppContants.INT_FLAG_N); |
| | | } else { |
| | | member.setAccountStatus(AppContants.INT_FLAG_Y); |
| | | } |
| | | dappMemberDao.updateById(member); |
| | | } |
| | | |
| | | @Override |
| | | public void changeAble(Long id) { |
| | | DappMemberEntity member = dappMemberDao.selectById(id); |
| | | if (member == null) { |
| | | throw new FebsException("用户不存在"); |
| | | } |
| | | |
| | | if (member.getChangeAble() == AppContants.INT_FLAG_Y) { |
| | | member.setChangeAble(AppContants.INT_FLAG_N); |
| | | } else { |
| | | member.setChangeAble(AppContants.INT_FLAG_Y); |
| | | } |
| | | dappMemberDao.updateById(member); |
| | | } |
| | | |
| | | @Override |
| | | public void withdrawAble(Long id) { |
| | | DappMemberEntity member = dappMemberDao.selectById(id); |
| | | if (member == null) { |
| | | throw new FebsException("用户不存在"); |
| | | } |
| | | |
| | | if (member.getWithdrawAble() == AppContants.INT_FLAG_Y) { |
| | | member.setWithdrawAble(AppContants.INT_FLAG_N); |
| | | } else { |
| | | member.setWithdrawAble(AppContants.INT_FLAG_Y); |
| | | } |
| | | dappMemberDao.updateById(member); |
| | | } |
| | | } |