cloudroam
2024-10-28 617cac9aab814b33a4a0947d7222eae1098028ca
src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
@@ -2,11 +2,14 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mzl.flower.constant.Constants;
import com.mzl.flower.constant.LockConstants;
import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO;
import com.mzl.flower.dto.request.wallet.QueryWalletBillRecordDTO;
import com.mzl.flower.dto.response.wallet.WalletBillRecordVO;
import com.mzl.flower.dto.request.wallet.QueryWalletBillDTO;
import com.mzl.flower.dto.response.wallet.WalletBillRecordVO;
import com.mzl.flower.entity.payment.Transfer;
import com.mzl.flower.entity.payment.TransferDetail;
@@ -35,6 +38,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.List;
/**
 * <p>
@@ -94,7 +98,7 @@
                walletBillRecordDO.update("sys");
                walletBillRecordMapper.updateById(walletBillRecordDO);
                //更新钱包
                WalletDO walletDO = walletService.getBySupplierId(walletBillRecordDO.getWalletId());
                WalletDO walletDO = walletService.getOrCreateBySupplierId(walletBillRecordDO.getWalletId());
                RLock lock = redissonClient.getLock(String.format(LockConstants.WALLET_ID_KEY, walletDO.getId()));
                try {
                    if (lock.tryLock(10, 30, TimeUnit.SECONDS)) {
@@ -124,7 +128,7 @@
                walletBillRecordDO.setTransferState(Constants.SETTLEMENT_STATUS.FAILED.name());
                walletBillRecordDO.update("sys");
                walletBillRecordMapper.updateById(walletBillRecordDO);
                WalletDO walletDO = walletService.getBySupplierId(walletBillRecordDO.getWalletId());
                WalletDO walletDO = walletService.getOrCreateBySupplierId(walletBillRecordDO.getWalletId());
                RLock lock = redissonClient.getLock(String.format(LockConstants.WALLET_ID_KEY, walletDO.getId()));
                try {
                    if (lock.tryLock(10, 30, TimeUnit.SECONDS)) {
@@ -192,4 +196,11 @@
            log.error(e.getMessage(), e);
        }
    }
    @Override
    public Page<WalletBillRecordVO> getPage(Page page, QueryWalletBillDTO dto) {
        List<WalletBillRecordVO> list = walletBillRecordMapper.getPage(page,dto);
        page.setRecords(list);
        return page;
    }
}