From 13ee403d72e85bf16bc0d3c38984e5b0272fb963 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期三, 23 十月 2024 09:46:47 +0800
Subject: [PATCH] add:提现记录查询、审批

---
 src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
index 1115c0a..c9c1cf8 100644
--- a/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
@@ -1,10 +1,23 @@
 package com.mzl.flower.service.impl.wallet;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mzl.flower.config.exception.ValidationException;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.dto.request.wallet.QueryWalletDTO;
+import com.mzl.flower.dto.request.wallet.WalletWithdrawRecordDTO;
+import com.mzl.flower.dto.response.wallet.WalletWithdrawRecordVO;
 import com.mzl.flower.entity.wallet.WalletWithdrawRecordDO;
 import com.mzl.flower.mapper.wallet.WalletWithdrawRecordMapper;
 import com.mzl.flower.service.wallet.WalletWithdrawRecordService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * <p>
@@ -15,6 +28,32 @@
  * @since 2024-10-22
  */
 @Service
+@Transactional
+@RequiredArgsConstructor
 public class WalletWithdrawRecordServiceImpl extends ServiceImpl<WalletWithdrawRecordMapper, WalletWithdrawRecordDO> implements WalletWithdrawRecordService {
 
+
+    private final WalletWithdrawRecordMapper walletWithdrawRecordMapper;
+    @Override
+    public Page<WalletWithdrawRecordVO> queryPage(QueryWalletDTO queryWalletDTO, Page page) {
+        List<WalletWithdrawRecordVO> list = walletWithdrawRecordMapper.queryPage(queryWalletDTO, page);
+        page.setRecords(list);
+        return page;
+    }
+
+    @Override
+    public void updateWallet(WalletWithdrawRecordDTO walletWithdrawRecordDTO) {
+        WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletWithdrawRecordDTO.getId());
+        if (withdrawRecordDO == null) {
+            throw new ValidationException("提现记录信息不存在");
+        }
+        if (StringUtils.isEmpty(walletWithdrawRecordDTO.getApproveState())) {
+            throw new ValidationException("审批状态不能为空");
+        }
+        BeanUtils.copyProperties(walletWithdrawRecordDTO, withdrawRecordDO);
+        withdrawRecordDO.update(SecurityUtils.getUserId());
+        withdrawRecordDO.setApproveBy(SecurityUtils.getUserId());
+        withdrawRecordDO.setApproveTime(LocalDateTime.now());
+        walletWithdrawRecordMapper.updateById(withdrawRecordDO);
+    }
 }

--
Gitblit v1.9.3