KKSU
2024-06-14 4bcedc984948c3c757d6b155e019174ef2fe9a0a
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -52,6 +52,7 @@
    private final ChainProducer chainProducer;
    private final DappSystemDao dappSystemDao;
    private final DbMemberNodeMapper dbMemberNodeMapper;
    private final DappWalletService dappWalletService;
    @Override
    public WalletInfoVo walletInfo() {
@@ -543,6 +544,55 @@
        return null;
    }
    @Override
    public FebsResponse agreeWithdraw(Long id) {
        MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectById(id);
        if(ObjectUtil.isEmpty(memberCoinWithdrawEntity)){
            throw new FebsException("刷新页面重试");
        }
        if (MemberCoinWithdrawEntity.STATUS_DOING != memberCoinWithdrawEntity.getStatus()) {
            throw new FebsException("非可审核状态");
        }
        memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_YES);
        memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity);
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(memberCoinWithdrawEntity.getFlowId());
        dappFundFlowEntity.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE);
        dappFundFlowDao.updateById(dappFundFlowEntity);
        return new FebsResponse().success();
    }
    @Override
    public FebsResponse disagreeWithdraw(Long id) {
        MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectById(id);
        if(ObjectUtil.isEmpty(memberCoinWithdrawEntity)){
            throw new FebsException("刷新页面重试");
        }
        if (MemberCoinWithdrawEntity.STATUS_DOING != memberCoinWithdrawEntity.getStatus()) {
            throw new FebsException("非可审核状态");
        }
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(memberCoinWithdrawEntity.getFlowId());
        if (dappFundFlowEntity == null) {
            throw new FebsException("审核失败,联系管理员");
        }
        memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_NO);
        memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity);
        dappFundFlowEntity.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_DISAGREE);
        dappFundFlowDao.updateById(dappFundFlowEntity);
        dappWalletService.updateWalletCoinWithLock(memberCoinWithdrawEntity.getAmount(), memberCoinWithdrawEntity.getMemberId(), 1);
        dappWalletService.updateWalletMineWithLock(memberCoinWithdrawEntity.getFeeAmount(), memberCoinWithdrawEntity.getMemberId(), 1);
        DappFundFlowEntity feeFlow = new DappFundFlowEntity(memberCoinWithdrawEntity.getMemberId(), memberCoinWithdrawEntity.getFeeAmount(), 22, 2, null, null);
        dappFundFlowDao.insert(feeFlow);
        return new FebsResponse().success();
    }
    public MemberNodeVo buildTeamMatrix(DbMemberNode dbMemberNode) {
        Long id = dbMemberNode.getId();