| | |
| | | |
| | | 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; |
| | |
| | | import com.mzl.flower.utils.ExcelExportUtil; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | 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)) { |
| | |
| | | if (StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) { |
| | | WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletBillRecordDO.getWithdrawRecordId()); |
| | | withdrawRecordDO.setWithdrawState(Constants.WALLET_WITHDRAW_STATE.SUCCESS.name()); |
| | | walletBillRecordDO.setRemark("账户资金提现完成"); |
| | | walletWithdrawRecordMapper.updateById(withdrawRecordDO); |
| | | } |
| | | |
| | |
| | | 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)) { |
| | |
| | | if (StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) { |
| | | WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletBillRecordDO.getWithdrawRecordId()); |
| | | withdrawRecordDO.setWithdrawState(Constants.WALLET_WITHDRAW_STATE.FAILURE.name()); |
| | | walletBillRecordDO.setRemark("账户资金提现失败"); |
| | | walletWithdrawRecordMapper.updateById(withdrawRecordDO); |
| | | } |
| | | } |
| | |
| | | int a = 0; |
| | | objs[a++] = sn; // 序号 |
| | | objs[a++] = o.getSupplierName()+":"+o.getSupplierId(); // 供应商信息 |
| | | objs[a++] = o.getTypeStr(); // 变动类型 |
| | | objs[a++] = o.getTypeName(); // 变动类型 |
| | | objs[a++] = o.getOriginalAmount(); // 原金额 |
| | | objs[a++] = o.getChangeAmount(); // 变动金额 |
| | | objs[a++] = o.getBalance(); //现余额 |
| | |
| | | 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; |
| | | } |
| | | } |