From b4aa242d1b818a8ad3a285166caedb699bbcb460 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期三, 23 十月 2024 10:51:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-v4' into master-v4

---
 src/main/java/com/mzl/flower/service/wallet/WalletBillRecordService.java              |    2 
 src/main/java/com/mzl/flower/service/supplier/SupplierService.java                    |    4 
 src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java               |   61 ++++++++++
 src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java          |    4 
 src/main/java/com/mzl/flower/constant/Constants.java                                  |   28 ++++
 src/main/java/com/mzl/flower/entity/wallet/WalletDO.java                              |    2 
 src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java |   42 +++++++
 src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletBillRecordDTO.java        |   52 ++++++++
 src/main/java/com/mzl/flower/service/wallet/WalletService.java                        |    1 
 src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java        |   25 ++++
 src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletWithdrawRecordDTO.java    |   76 ++++++++++++
 src/main/java/com/mzl/flower/web/v2/wallet/WalletController.java                      |   20 +++
 src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java     |   15 ++
 src/main/java/com/mzl/flower/web/v2/wallet/WalletBillRecordController.java            |   28 +++-
 14 files changed, 346 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/mzl/flower/constant/Constants.java b/src/main/java/com/mzl/flower/constant/Constants.java
index ed5b090..49fe759 100644
--- a/src/main/java/com/mzl/flower/constant/Constants.java
+++ b/src/main/java/com/mzl/flower/constant/Constants.java
@@ -603,4 +603,32 @@
         }
     }
 
+    public enum WALLET_WITHDRAW_STATE {
+        WAITING("待审核"), APPROVE("已通过"),REJECT("已拒绝");
+
+        WALLET_WITHDRAW_STATE(String desc) {
+            this.desc = desc;
+        }
+
+        private String desc;
+
+        public String getDesc() {
+            return desc;
+        }
+    }
+
+    public enum WALLET_WITHDRAW_METHOD {
+        WEIXIN("微信");
+
+        WALLET_WITHDRAW_METHOD(String desc) {
+            this.desc = desc;
+        }
+
+        private String desc;
+
+        public String getDesc() {
+            return desc;
+        }
+    }
+
 }
diff --git a/src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletBillRecordDTO.java b/src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletBillRecordDTO.java
new file mode 100644
index 0000000..2bb0973
--- /dev/null
+++ b/src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletBillRecordDTO.java
@@ -0,0 +1,52 @@
+package com.mzl.flower.dto.request.wallet;
+
+import com.mzl.flower.entity.wallet.WalletBillRecordDO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@Data
+public class CreateWalletBillRecordDTO {
+
+    @ApiModelProperty(value = "供应商Id")
+    @NotEmpty(message = "供应商Id不能为空")
+    private String supplierId;
+
+    @ApiModelProperty(value = "钱包Id")
+    @NotNull(message = "钱包Id不能为空")
+    private Long walletId;
+
+    @ApiModelProperty(value = "账单变动类型(提现,结算)")
+    @NotEmpty(message = "账单变动类型不能为空")
+    private String type;
+
+    @ApiModelProperty(value = "类型明细")
+    @NotEmpty(message = "类型明细不能为空")
+    private String typeDetail;
+
+//    @ApiModelProperty(value = "转账Id")
+//    @NotEmpty(message = "转账Id不能为空")
+//    private String transferId;
+
+//    @ApiModelProperty(value = "变动方式(增加、减少)")
+//    @NotEmpty(message = "变动方式(增加、减少)不能为空")
+//    private String method;
+
+    @ApiModelProperty(value = "原金额")
+    @NotNull(message = "原金额")
+    @DecimalMin(value = "0.0", message = "原金额不能小于0")
+    private BigDecimal originalAmount;
+
+    @ApiModelProperty(value = "变动金额")
+    @DecimalMin(value = "0.0", message = "变动金额不能小于0")
+    private BigDecimal changeAmount;
+
+    @ApiModelProperty(value = "余额")
+    @DecimalMin(value = "0.0", message = "余额不能小于0")
+    private BigDecimal balance;
+
+}
diff --git a/src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletWithdrawRecordDTO.java b/src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletWithdrawRecordDTO.java
new file mode 100644
index 0000000..f6ea18a
--- /dev/null
+++ b/src/main/java/com/mzl/flower/dto/request/wallet/CreateWalletWithdrawRecordDTO.java
@@ -0,0 +1,76 @@
+package com.mzl.flower.dto.request.wallet;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @description:  提现记录创建请求
+ *
+ */
+@Data
+public class CreateWalletWithdrawRecordDTO {
+
+//    /**
+//     * 供应商ID
+//     */
+//    @ApiModelProperty(value = "供应商Id")
+//    private String supplierId;
+
+    /**
+     * 提现金额
+     */
+    @ApiModelProperty(value = "钱包Id")
+    @NotNull(message = "提现金额不能为空")
+    @DecimalMin(value = "0.0", message = "提现金额不能小于0")
+    private BigDecimal amount;
+
+    /**
+     * 单次可提现金额
+     */
+//    @ApiModelProperty(value = "提现金额")
+//    private BigDecimal onceWithdrawAmount;
+
+//    /**
+//     * 提现状态
+//     */
+//    @ApiModelProperty(value = "提现状态(提现中、提现成功、提现失败)")
+//    private Integer withdrawState;
+//
+//    /**
+//     * 提现方式
+//     */
+//    @ApiModelProperty(value = "提现方式(微信)")
+//    private String method;
+//
+//    /**
+//     * 审核人
+//     */
+//    @ApiModelProperty(value = "审核人")
+//    private String approveBy;
+//
+//    /**
+//     * 审核时间
+//     */
+//    @ApiModelProperty(value = "审核时间")
+//    private LocalDateTime approveTime;
+//
+//    /**
+//     * 审核状态
+//     */
+//    @ApiModelProperty(value = "审核状态(待审核、审核通过、审核不通过)")
+//    private Integer approveState;
+//
+//    /**
+//     * 不通过原因
+//     */
+//    @ApiModelProperty(value = "不通过原因")
+//    private String rejectReason;
+
+
+
+}
diff --git a/src/main/java/com/mzl/flower/entity/wallet/WalletDO.java b/src/main/java/com/mzl/flower/entity/wallet/WalletDO.java
index 2f240e0..50d4011 100644
--- a/src/main/java/com/mzl/flower/entity/wallet/WalletDO.java
+++ b/src/main/java/com/mzl/flower/entity/wallet/WalletDO.java
@@ -72,7 +72,7 @@
      * 总交易金额
      */
     @ApiModelProperty(value = "总交易金额")
-    private String totalTransactionAmount;
+    private BigDecimal totalTransactionAmount;
 
 
 }
diff --git a/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
index 13125aa..13ffa86 100644
--- a/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
@@ -1,9 +1,18 @@
 package com.mzl.flower.service.impl.wallet;
 
+import com.mzl.flower.config.exception.ValidationException;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.constant.Constants;
+import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO;
+import com.mzl.flower.dto.response.supplier.SupplierDTO;
 import com.mzl.flower.entity.wallet.WalletBillRecordDO;
+import com.mzl.flower.entity.wallet.WalletDO;
 import com.mzl.flower.mapper.wallet.WalletBillRecordMapper;
+import com.mzl.flower.service.supplier.SupplierService;
 import com.mzl.flower.service.wallet.WalletBillRecordService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mzl.flower.service.wallet.WalletService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +26,10 @@
 @Service
 public class WalletBillRecordServiceImpl extends ServiceImpl<WalletBillRecordMapper, WalletBillRecordDO> implements WalletBillRecordService {
 
+
+    @Override
+    public void create(CreateWalletBillRecordDTO dto) {
+
+
+    }
 }
diff --git a/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
index d32bf77..0d6a144 100644
--- a/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/wallet/WalletServiceImpl.java
@@ -1,10 +1,21 @@
 package com.mzl.flower.service.impl.wallet;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.dto.response.supplier.SupplierDTO;
+import com.mzl.flower.entity.coupon.CouponTemplateDO;
 import com.mzl.flower.entity.wallet.WalletDO;
+import com.mzl.flower.enums.TrueOrFalseEnum;
 import com.mzl.flower.mapper.wallet.WalletMapper;
+import com.mzl.flower.service.supplier.SupplierService;
 import com.mzl.flower.service.wallet.WalletService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +28,54 @@
 @Service
 public class WalletServiceImpl extends ServiceImpl<WalletMapper, WalletDO> implements WalletService {
 
+    @Autowired
+    private SupplierService supplierService;
+
+    @Override
+    public WalletDO getBySupplierId() {
+        final SupplierDTO currentSupplier = supplierService.getCurrentSupplier();
+        // 根据供应商ID获取钱包信息
+
+            // 查询的条件的deleted的字段得为0
+            // 下面的单独封装成一个方法
+            WalletDO walletDO = getBySupplierId(currentSupplier.getId());
+
+            if(null==walletDO){
+                // 先创建一个钱包
+                walletDO=new WalletDO();
+                walletDO.setUserId(SecurityUtils.getUserId());
+                walletDO.setSupplierId(currentSupplier.getId());
+                walletDO.setTotalAmount(BigDecimal.ZERO);
+                walletDO.setWithdrawableAmount(BigDecimal.ZERO);
+                //把所有涉及BigDecimal的金额都设置为0
+                walletDO.setWithdrawingAmount(BigDecimal.ZERO);
+                walletDO.setWithdrawnAmount(BigDecimal.ZERO);
+                walletDO.setSettlingAmount(BigDecimal.ZERO);
+                walletDO.setTotalDeduction(BigDecimal.ZERO);
+                walletDO.setTotalTransactionAmount(BigDecimal.ZERO);
+                walletDO.create(SecurityUtils.getUserId());
+                baseMapper.insert(walletDO);
+                // 将再次查询的结果返回
+                walletDO=getBySupplierId(currentSupplier.getId());
+            }
+
+
+        return walletDO;
+    }
+
+
+    public WalletDO getBySupplierId(Long supplierId){
+        // 不用getOne,用获取list的第一个元素
+
+        List<WalletDO> walletDOS = baseMapper.selectList(new LambdaQueryWrapper<WalletDO>()
+                .eq(WalletDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag())
+                .eq(WalletDO::getSupplierId, supplierId));
+        if(!CollectionUtils.isEmpty(walletDOS)){
+            return walletDOS.get(0);
+        }else return null;
+    }
+
+
+
+
 }
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 c9c1cf8..543c152 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,5 +1,11 @@
 package com.mzl.flower.service.impl.wallet;
 
+import com.mzl.flower.config.exception.ValidationException;
+import com.mzl.flower.config.security.SecurityUtils;
+import com.mzl.flower.constant.Constants;
+import com.mzl.flower.dto.request.wallet.CreateWalletWithdrawRecordDTO;
+import com.mzl.flower.dto.response.supplier.SupplierDTO;
+import com.mzl.flower.entity.wallet.WalletDO;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.mzl.flower.config.exception.ValidationException;
 import com.mzl.flower.config.security.SecurityUtils;
@@ -8,16 +14,20 @@
 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.supplier.SupplierService;
+import com.mzl.flower.service.wallet.WalletService;
 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.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
 import java.time.LocalDateTime;
 import java.util.List;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * <p>
@@ -31,6 +41,35 @@
 @Transactional
 @RequiredArgsConstructor
 public class WalletWithdrawRecordServiceImpl extends ServiceImpl<WalletWithdrawRecordMapper, WalletWithdrawRecordDO> implements WalletWithdrawRecordService {
+    @Autowired
+    private WalletService walletService;
+
+    @Autowired
+    private SupplierService supplierService;
+
+    @Transactional
+    @Override
+    public boolean create(CreateWalletWithdrawRecordDTO dto) {
+        SupplierDTO supplierDTO=supplierService.getCurrentSupplier();
+        if(null==supplierDTO){
+            throw new ValidationException("供应商不能为空");
+        }
+
+        final WalletDO walletDO = walletService.getBySupplierId();
+        if(null==walletDO){
+            throw new ValidationException("钱包不能为空");
+        }
+        // 查看钱包的金额是不是大于要提现的金额
+        if(null!=walletDO.getWithdrawableAmount() && null!=dto.getAmount()
+                && walletDO.getWithdrawableAmount().compareTo(dto.getAmount())<0){
+            throw new ValidationException("钱包金额不足");
+        }
+        WalletWithdrawRecordDO withdrawRecordDO=new WalletWithdrawRecordDO();
+        withdrawRecordDO.setAmount(dto.getAmount());
+        withdrawRecordDO.setSupplierId(supplierDTO.getId());
+        withdrawRecordDO.setWithdrawState(Constants.WALLET_WITHDRAW_STATE.WAITING.name());
+        withdrawRecordDO.setMethod(Constants.WALLET_WITHDRAW_METHOD.WEIXIN.name());
+        withdrawRecordDO.create(SecurityUtils.getUserId());
 
 
     private final WalletWithdrawRecordMapper walletWithdrawRecordMapper;
@@ -56,4 +95,7 @@
         withdrawRecordDO.setApproveTime(LocalDateTime.now());
         walletWithdrawRecordMapper.updateById(withdrawRecordDO);
     }
+        return save(withdrawRecordDO);
+
+    }
 }
diff --git a/src/main/java/com/mzl/flower/service/supplier/SupplierService.java b/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
index 225c894..83d1588 100644
--- a/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
+++ b/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
@@ -213,4 +213,8 @@
         supplier.update(SecurityUtils.getUserId());
         supplierMapper.updateById(supplier);
     }
+
+    public Supplier getSupplierById(String supplierId) {
+        return supplierMapper.selectById(supplierId);
+    }
 }
diff --git a/src/main/java/com/mzl/flower/service/wallet/WalletBillRecordService.java b/src/main/java/com/mzl/flower/service/wallet/WalletBillRecordService.java
index 2cef140..0ab4c6f 100644
--- a/src/main/java/com/mzl/flower/service/wallet/WalletBillRecordService.java
+++ b/src/main/java/com/mzl/flower/service/wallet/WalletBillRecordService.java
@@ -1,5 +1,6 @@
 package com.mzl.flower.service.wallet;
 
+import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO;
 import com.mzl.flower.entity.wallet.WalletBillRecordDO;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -13,4 +14,5 @@
  */
 public interface WalletBillRecordService extends IService<WalletBillRecordDO> {
 
+    void create(CreateWalletBillRecordDTO dto);
 }
diff --git a/src/main/java/com/mzl/flower/service/wallet/WalletService.java b/src/main/java/com/mzl/flower/service/wallet/WalletService.java
index 4cc72c9..f7d4035 100644
--- a/src/main/java/com/mzl/flower/service/wallet/WalletService.java
+++ b/src/main/java/com/mzl/flower/service/wallet/WalletService.java
@@ -13,4 +13,5 @@
  */
 public interface WalletService extends IService<WalletDO> {
 
+    WalletDO getBySupplierId();
 }
diff --git a/src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java b/src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java
index 9b0b26e..9425fbf 100644
--- a/src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java
+++ b/src/main/java/com/mzl/flower/service/wallet/WalletWithdrawRecordService.java
@@ -4,6 +4,7 @@
 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.dto.request.wallet.CreateWalletWithdrawRecordDTO;
 import com.mzl.flower.entity.wallet.WalletWithdrawRecordDO;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -11,7 +12,7 @@
  * <p>
  *  服务类
  * </p>
- *S
+ *
  * @author @TaoJie
  * @since 2024-10-22
  */
@@ -20,4 +21,5 @@
 
     void updateWallet(WalletWithdrawRecordDTO walletWithdrawRecordDTO);
 
+    boolean create(CreateWalletWithdrawRecordDTO walletWithdrawRecordDTO);
 }
diff --git a/src/main/java/com/mzl/flower/web/v2/wallet/WalletBillRecordController.java b/src/main/java/com/mzl/flower/web/v2/wallet/WalletBillRecordController.java
index b3a36ca..8cf66b4 100644
--- a/src/main/java/com/mzl/flower/web/v2/wallet/WalletBillRecordController.java
+++ b/src/main/java/com/mzl/flower/web/v2/wallet/WalletBillRecordController.java
@@ -6,22 +6,24 @@
 import com.mzl.flower.base.R;
 import com.mzl.flower.base.ReturnDataDTO;
 
+import com.mzl.flower.config.exception.ValidationException;
+import com.mzl.flower.dto.request.wallet.CreateWalletBillRecordDTO;
+import com.mzl.flower.entity.supplier.Supplier;
+import com.mzl.flower.entity.wallet.WalletDO;
+import com.mzl.flower.mapper.supplier.SupplierMapper;
+import com.mzl.flower.service.supplier.SupplierService;
+import com.mzl.flower.service.wallet.WalletBillRecordService;
+import com.mzl.flower.service.wallet.WalletService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 import com.mzl.flower.entity.wallet.WalletBillRecordDO;
 
 
 import javax.validation.constraints.Min;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Positive;
-
-import org.springframework.web.bind.annotation.RestController;
 
 /**
 * @author @TaoJie
@@ -31,8 +33,14 @@
 @RequestMapping("/v2/wallet-bill-record")
 public class WalletBillRecordController extends BaseController {
 
+    @Autowired
+    private WalletBillRecordService walletBillRecordService;
+
+
     @PostMapping("")
-    public ResponseEntity<ReturnDataDTO> create() {
+    public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateWalletBillRecordDTO dto) {
+
+
         return returnData(R.SUCCESS.getCode(), null);
     }
 
diff --git a/src/main/java/com/mzl/flower/web/v2/wallet/WalletController.java b/src/main/java/com/mzl/flower/web/v2/wallet/WalletController.java
index 5a545c3..ceee11d 100644
--- a/src/main/java/com/mzl/flower/web/v2/wallet/WalletController.java
+++ b/src/main/java/com/mzl/flower/web/v2/wallet/WalletController.java
@@ -5,9 +5,13 @@
 import com.mzl.flower.base.BaseController;
 import com.mzl.flower.base.R;
 import com.mzl.flower.base.ReturnDataDTO;
+import com.mzl.flower.config.exception.ValidationException;
 import com.mzl.flower.dto.request.wallet.QueryWalletDTO;
+import com.mzl.flower.dto.response.supplier.SupplierDTO;
 import com.mzl.flower.entity.wallet.WalletBillRecordDO;
+import com.mzl.flower.service.supplier.SupplierService;
 import com.mzl.flower.service.wallet.WalletService;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
@@ -27,6 +31,9 @@
 
     @Autowired
     private WalletService walletService;
+
+    @Autowired
+    private SupplierService supplierService;
 
     @PostMapping("")
     public ResponseEntity<ReturnDataDTO> create() {
@@ -50,10 +57,21 @@
         return null;
     }
 
+    @GetMapping("/supplier")
+    @ApiOperation(value = "获取供应商钱包", notes = "获取供应商钱包")
+    public WalletDO getWalletBySupplierId() {
+        // 判断供应商是否存在
+        final SupplierDTO currentSupplier = supplierService.getCurrentSupplier();
+        if(null==currentSupplier){
+            throw new ValidationException("供应商不能为空");
+        }
+
+        return walletService.getBySupplierId();
+    }
+
     @GetMapping("/page")
     public ResponseEntity<ReturnDataDTO<Page<WalletDO>>> page(@RequestBody QueryWalletDTO dto
     ) {
-        // 帮我写分页查询
 
         return null;
     }
diff --git a/src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java b/src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java
index a4d75b4..54061b1 100644
--- a/src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java
+++ b/src/main/java/com/mzl/flower/web/v2/wallet/WalletWithdrawRecordController.java
@@ -12,8 +12,21 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import com.mzl.flower.dto.request.wallet.CreateWalletWithdrawRecordDTO;
+import com.mzl.flower.service.supplier.SupplierService;
+import com.mzl.flower.service.wallet.WalletBillRecordService;
+import com.mzl.flower.service.wallet.WalletService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
 import com.mzl.flower.entity.wallet.WalletWithdrawRecordDO;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.Max;
@@ -30,6 +43,13 @@
 public class WalletWithdrawRecordController extends BaseController {
 
     private final WalletWithdrawRecordService walletWithdrawRecordService;
+
+    private final WalletBillRecordService walletBillRecordService;
+
+    private final SupplierService supplierService;
+    @Autowired
+    private WalletService walletService;
+   
     @GetMapping("/list")
     @ApiOperation(value = "查询提现记录", httpMethod = "GET")
     public ResponseEntity<ReturnDataDTO<Page<WalletWithdrawRecordVO>>> getMemberList(Page page, QueryWalletDTO dto) {
@@ -44,7 +64,10 @@
     }
 
     @PostMapping("")
-    public ResponseEntity<ReturnDataDTO> create() {
+    public ResponseEntity<ReturnDataDTO> create(@Validated CreateWalletWithdrawRecordDTO walletWithdrawRecordDTO) {
+
+        walletWithdrawRecordService.create(walletWithdrawRecordDTO);
+
         return returnData(R.SUCCESS.getCode(), null);
     }
 

--
Gitblit v1.9.3