From e29bb239dc2a5d4d0eee765d870522ad877e03e4 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 07 一月 2025 20:53:16 +0800
Subject: [PATCH] 二期司机提现

---
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/TWithdrawalController.java                  |  123 +++++++++++++++++
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TWithdrawalMapper.java               |   13 +
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TWithdrawalServiceImpl.java |   37 +++++
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TWithdrawal.java                   |  180 +++++++++++++++++++++++++
 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITWithdrawalService.java         |   35 +++++
 5 files changed, 388 insertions(+), 0 deletions(-)

diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/TWithdrawalController.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/TWithdrawalController.java
new file mode 100644
index 0000000..c934b9e
--- /dev/null
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/TWithdrawalController.java
@@ -0,0 +1,123 @@
+package com.stylefeng.guns.modular.api;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.stylefeng.guns.core.base.controller.BaseController;
+import com.stylefeng.guns.core.common.constant.factory.PageFactory;
+import com.stylefeng.guns.modular.system.model.LoginLog;
+import com.stylefeng.guns.modular.system.model.TWithdrawal;
+import com.stylefeng.guns.modular.system.service.ICarService;
+import com.stylefeng.guns.modular.system.service.IDriverService;
+import com.stylefeng.guns.modular.system.service.ITWithdrawalService;
+import com.stylefeng.guns.modular.system.util.ResultUtil;
+import com.stylefeng.guns.modular.system.warpper.LogWarpper;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 车辆相关控制器
+ */
+@RestController
+@RequestMapping("/api/withdrawal")
+public class TWithdrawalController  extends BaseController {
+
+    @Autowired
+    private IDriverService driverService;
+    @Autowired
+    private ITWithdrawalService withdrawalService;
+    /**
+     * 司机提现
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/addWithdrawal")
+    @ApiOperation(value = "司机提现", tags = {"司机端-个人中心"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "收款人姓名", name = "receivePaymentName", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "收款账号", name = "receivePaymentAccount", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "提现方式 1=支付宝 2=银行卡", name = "withdrawalType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "开户行", name = "openBank", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "提现金额", name = "withdrawalMoney", required = true, dataType = "BigDecimal"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil addWithdrawal(String receivePaymentName, String receivePaymentAccount, Integer withdrawalType,
+                                    String openBank, BigDecimal withdrawalMoney, HttpServletRequest request){
+        try {
+            Integer uid = driverService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            withdrawalService.addWithdrawal(receivePaymentName, receivePaymentAccount, withdrawalType, openBank, withdrawalMoney, uid);
+            return ResultUtil.success();
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+    /**
+     * 提现查看详情
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/queryDetailById")
+    @ApiOperation(value = "提现查看详情", tags = {"司机端-个人中心"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "提现id", name = "id", required = true, dataType = "int"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil queryDetailById(Integer id,HttpServletRequest request){
+        try {
+            Integer uid = driverService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            TWithdrawal tWithdrawal = withdrawalService.selectById(id);
+            return ResultUtil.success(tWithdrawal);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+    /**
+     * 提现查看分页列表
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/queryList")
+    @ApiOperation(value = "提现查看分页列表", tags = {"司机端-个人中心"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil queryList(Integer pageNum,Integer size,HttpServletRequest request){
+        try {
+            Integer uid = driverService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+//            Page<TWithdrawal> page = new PageFactory<TWithdrawal>().defaultPage();
+//            List<Map<String, Object>> result = withdrawalService.queryList(page, uid);
+//            page.setRecords((List<TWithdrawal>) new LogWarpper(result).warp());
+//            return super.packForBT(page);
+            List<TWithdrawal> list = withdrawalService.selectList(new EntityWrapper<TWithdrawal>().eq("driverId", uid));
+            return ResultUtil.success(list);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+}
diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TWithdrawalMapper.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TWithdrawalMapper.java
new file mode 100644
index 0000000..104a210
--- /dev/null
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TWithdrawalMapper.java
@@ -0,0 +1,13 @@
+package com.stylefeng.guns.modular.system.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.stylefeng.guns.modular.system.model.Car;
+import com.stylefeng.guns.modular.system.model.TWithdrawal;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface TWithdrawalMapper extends BaseMapper<TWithdrawal> {
+
+}
diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TWithdrawal.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TWithdrawal.java
new file mode 100644
index 0000000..88e7c7a
--- /dev/null
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TWithdrawal.java
@@ -0,0 +1,180 @@
+package com.stylefeng.guns.modular.system.model;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 提现
+ */
+@TableName("t_withdrawal")
+public class TWithdrawal {
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    @TableField("id")
+    private Integer id;
+    /**
+     * 司机id
+     */
+    @TableField("driverId")
+    private Integer driverId;
+    /**
+     * 收款人姓名
+     */
+    @TableField("receivePaymentName")
+    private String receivePaymentName;
+    /**
+     * 收款账号
+     */
+    @TableField("receivePaymentAccount")
+    private String receivePaymentAccount;
+    /**
+     * 提现方式 1=支付宝 2=银行卡
+     */
+    @TableField("withdrawalType")
+    private Integer withdrawalType;
+
+
+    /**
+     * 提现金额
+     */
+    @TableField("withdrawalMoney")
+    private BigDecimal withdrawalMoney;
+    /**
+     * 提现时间
+     */
+    @TableField("withdrawalTime")
+    private Date withdrawalTime;
+    /**
+     * 提现状态 1=待处理 2=成功 3=失败
+     */
+    @TableField("status")
+    private Integer status;
+
+    /**
+     * 开户行
+     */
+    @TableField("openBank")
+    private String openBank;
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+    /**
+     * 到帐凭证
+     */
+    @TableField("receiptVoucher")
+    private String receiptVoucher;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getDriverId() {
+        return driverId;
+    }
+
+    public void setDriverId(Integer driverId) {
+        this.driverId = driverId;
+    }
+
+    public String getReceivePaymentName() {
+        return receivePaymentName;
+    }
+
+    public void setReceivePaymentName(String receivePaymentName) {
+        this.receivePaymentName = receivePaymentName;
+    }
+
+    public String getReceivePaymentAccount() {
+        return receivePaymentAccount;
+    }
+
+    public void setReceivePaymentAccount(String receivePaymentAccount) {
+        this.receivePaymentAccount = receivePaymentAccount;
+    }
+
+    public Integer getWithdrawalType() {
+        return withdrawalType;
+    }
+
+    public void setWithdrawalType(Integer withdrawalType) {
+        this.withdrawalType = withdrawalType;
+    }
+
+    public BigDecimal getWithdrawalMoney() {
+        return withdrawalMoney;
+    }
+
+    public void setWithdrawalMoney(BigDecimal withdrawalMoney) {
+        this.withdrawalMoney = withdrawalMoney;
+    }
+
+    public Date getWithdrawalTime() {
+        return withdrawalTime;
+    }
+
+    public void setWithdrawalTime(Date withdrawalTime) {
+        this.withdrawalTime = withdrawalTime;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getOpenBank() {
+        return openBank;
+    }
+
+    public void setOpenBank(String openBank) {
+        this.openBank = openBank;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getReceiptVoucher() {
+        return receiptVoucher;
+    }
+
+    public void setReceiptVoucher(String receiptVoucher) {
+        this.receiptVoucher = receiptVoucher;
+    }
+
+    @Override
+    public String toString() {
+        return "TWithdrawal{" +
+                "id=" + id +
+                ", driverId=" + driverId +
+                ", receivePaymentName='" + receivePaymentName + '\'' +
+                ", receivePaymentAccount='" + receivePaymentAccount + '\'' +
+                ", withdrawalType=" + withdrawalType +
+                ", withdrawalMoney=" + withdrawalMoney +
+                ", withdrawalTime=" + withdrawalTime +
+                ", status=" + status +
+                ", openBank='" + openBank + '\'' +
+                ", remark='" + remark + '\'' +
+                ", receiptVoucher='" + receiptVoucher + '\'' +
+                '}';
+    }
+}
diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITWithdrawalService.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITWithdrawalService.java
new file mode 100644
index 0000000..4ff3d96
--- /dev/null
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITWithdrawalService.java
@@ -0,0 +1,35 @@
+package com.stylefeng.guns.modular.system.service;
+
+import com.baomidou.mybatisplus.service.IService;
+import com.stylefeng.guns.modular.system.model.Car;
+import com.stylefeng.guns.modular.system.model.TWithdrawal;
+import com.stylefeng.guns.modular.system.util.ResultUtil;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public interface ITWithdrawalService extends IService<TWithdrawal> {
+
+
+    /**
+     * 添加提现记录
+     * @param receivePaymentName
+     * @param receivePaymentAccount
+     * @param withdrawalType
+     * @param openBank
+     * @param withdrawalMoney
+     * @param uid
+     */
+    void addWithdrawal(String receivePaymentName, String receivePaymentAccount, Integer withdrawalType, String openBank, BigDecimal withdrawalMoney, Integer uid);
+
+    /**
+     * 查询提现记录
+     * @param pageNum
+     * @param size
+     * @param uid
+     * @return
+     */
+//    List<TWithdrawal> queryList(Integer pageNum, Integer size, Integer uid);
+}
diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TWithdrawalServiceImpl.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TWithdrawalServiceImpl.java
new file mode 100644
index 0000000..9920d02
--- /dev/null
+++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TWithdrawalServiceImpl.java
@@ -0,0 +1,37 @@
+package com.stylefeng.guns.modular.system.service.impl;
+
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.stylefeng.guns.modular.system.dao.*;
+import com.stylefeng.guns.modular.system.model.*;
+import com.stylefeng.guns.modular.system.service.ICarService;
+import com.stylefeng.guns.modular.system.service.IDriverService;
+import com.stylefeng.guns.modular.system.service.ITWithdrawalService;
+import com.stylefeng.guns.modular.system.util.ResultUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@Service
+public class TWithdrawalServiceImpl extends ServiceImpl<TWithdrawalMapper, TWithdrawal> implements ITWithdrawalService {
+
+    @Override
+    public void addWithdrawal(String receivePaymentName, String receivePaymentAccount, Integer withdrawalType, String openBank, BigDecimal withdrawalMoney, Integer uid) {
+        TWithdrawal tWithdrawal = new TWithdrawal();
+        tWithdrawal.setDriverId(uid);
+        tWithdrawal.setReceivePaymentName(receivePaymentName);
+        tWithdrawal.setReceivePaymentAccount(receivePaymentAccount);
+        tWithdrawal.setWithdrawalType(withdrawalType);
+        tWithdrawal.setWithdrawalMoney(withdrawalMoney);
+        tWithdrawal.setWithdrawalTime(new Date());
+        tWithdrawal.setStatus(1);
+        tWithdrawal.setOpenBank(openBank);
+        this.insert(tWithdrawal);
+    }
+}

--
Gitblit v1.7.1