本模块提供商户快速提现功能,与普通提现(需审核)不同,此接口创建的提现记录直接标记为"已通过"状态(paymentStatus=3),无需人工审核,与app端 applyCashOut 接口保持一致。
POST /incomeManage/applyFastCashOut| 项目 | 普通提现 (/cashOut) | 快速提现 (/applyFastCashOut) |
|---|---|---|
| 提现状态 | paymentStatus = 1(待审核) | paymentStatus = 3(已通过) |
| 审核流程 | 需要人工审核 | 免审核,直接通过 |
| 账户扣款 | 提交时扣款 | 提交时不扣款 |
| 适用场景 | Web端常规提现 | 与app端保持一致的快速提现 |
| 后续流程 | 需管理员审核后打款 | 可直接进入打款流程 |
使用 CashOutDTO 对象作为请求体(JSON格式):
| 参数名 | 类型 | 必填 | 说明 | 示例值 |
|---|---|---|---|---|
| payPassword | String | 是 | 支付密码 | 123456 |
| withdrawalMoney | Integer | 是 | 提现金额(单位:分) | 50000 |
withdrawalMoney = 10000withdrawalMoney = 5000withdrawalMoney = 10注意: storeId 从登录用户的 JWT Token 中自动获取,不需要在请求中传递。
POST /incomeManage/applyFastCashOut
Content-Type: application/json
Authorization: Bearer YOUR_JWT_TOKEN
{
"payPassword": "123456",
"withdrawalMoney": 50000
}
curl -X POST "http://localhost:8080/incomeManage/applyFastCashOut" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"payPassword": "123456",
"withdrawalMoney": 50000
}'
假设账户余额为1000元(100000分):
POST /incomeManage/applyFastCashOut
Content-Type: application/json
Authorization: Bearer YOUR_JWT_TOKEN
{
"payPassword": "123456",
"withdrawalMoney": 100000
}
{
"code": 200,
"success": true,
"data": {
"id": 1001,
"storeId": 103,
"storeUserId": 114,
"money": 50000,
"commission": null,
"cashOutType": 0,
"paymentStatus": 3,
"orderNo": null,
"aliOrderNo": null,
"paymentDate": null,
"payDate": null,
"failReason": null,
"incomeStartTime": "2025-11-20 14:30:00",
"incomeEndTime": "2025-11-20 14:30:00",
"deleteFlag": 0,
"createdTime": "2025-11-20 14:30:00",
"updatedTime": "2025-11-20 14:30:00"
},
"msg": "操作成功"
}
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 状态码(200-成功) |
| success | Boolean | 是否成功 |
| data | Object | 提现记录对象(StoreCashOutRecord) |
| msg | String | 提示信息 |
| 字段名 | 类型 | 说明 |
|---|---|---|
| id | Long | 提现记录ID |
| storeId | Integer | 门店ID |
| storeUserId | Integer | 用户ID |
| money | Integer | 提现金额(单位:分) |
| commission | Integer | 手续费(单位:分,可为null) |
| cashOutType | Integer | 提现类型(0-全部提现) |
| paymentStatus | Integer | ⚠️ 提现状态(3-已通过) |
| orderNo | String | 提现订单号(初始为null) |
| aliOrderNo | String | 支付宝订单号(初始为null) |
| paymentDate | Date | 申请时间(初始为null) |
| payDate | Date | 打款时间(初始为null) |
| failReason | String | 失败原因(初始为null) |
| incomeStartTime | Date | 收入开始时间 |
| incomeEndTime | Date | 收入结束时间 |
| deleteFlag | Integer | 删除标识(0-未删除) |
| createdTime | Date | 创建时间 |
| updatedTime | Date | 更新时间 |
重要说明:
paymentStatus = 3 表示"已通过",区别于普通提现的"待审核"{
"code": 500,
"success": false,
"data": null,
"msg": "支付密码错误"
}
{
"code": 500,
"success": false,
"data": null,
"msg": "余额不足"
}
{
"code": 500,
"success": false,
"data": null,
"msg": "金额不能小于0.1元"
}
{
"code": 500,
"success": false,
"data": null,
"msg": "请先登录"
}
{
"code": 500,
"success": false,
"data": null,
"msg": "快速提现失败:{异常信息}"
}
┌─────────────────────────────────────────────┐
│ 1. 接收请求(从DTO获取参数) │
│ - payPassword (必填,从DTO) │
│ - withdrawalMoney (必填,单位:分,从DTO) │
│ - JWT token (自动获取storeId) │
└─────────────────┬───────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 2. 从 JWT token 中解析门店ID │
│ storeId = LoginUserUtil.getCurrentStoreId()│
└─────────────────┬───────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 3. 验证支付密码 │
│ SELECT * FROM store_user │
│ WHERE store_id = ? AND pay_password = ? │
│ IF user == null │
│ 返回错误: "支付密码错误" │
└─────────────────┬───────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 4. 验证账户余额 │
│ IF user.money <= withdrawalMoney │
│ 返回错误: "余额不足" │
└─────────────────┬───────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 5. 验证提现金额 │
│ amountInYuan = withdrawalMoney ÷ 100 │
│ IF amountInYuan < 0.1 │
│ 返回错误: "金额不能小于0.1元" │
└─────────────────┬───────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 6. 创建提现记录 │
│ StoreCashOutRecord record = new ... │
│ record.paymentStatus = 3 // 已通过 │
│ INSERT INTO store_cash_out_record │
└─────────────────┬───────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 7. 返回结果 │
│ 返回 StoreCashOutRecord 对象 │
└─────────────────────────────────────────────┘
@GetMapping("/applyCashOut")
public R applyCashOut(Integer storeId, String payPassword, Integer withdrawalMoney)
/storeIncomeDetailsRecord/applyCashOut?storeId=103&payPassword=123456&withdrawalMoney=50000@PostMapping("/applyFastCashOut")
public R<?> applyFastCashOut(@RequestBody CashOutDTO cashOutDTO)
/incomeManage/applyFastCashOut核心逻辑一致性:
money <= withdrawalMoney)SELECT * FROM store_user
WHERE store_id = ?
AND pay_password = ?
LIMIT 1
INSERT INTO store_cash_out_record (
store_id,
money,
cash_out_type,
payment_status,
delete_flag,
income_start_time,
income_end_time,
store_user_id,
created_time,
updated_time
) VALUES (
?, -- storeId
?, -- withdrawalMoney
0, -- cashOutType (0-全部提现)
3, -- paymentStatus (3-已通过)
0, -- deleteFlag
NOW(), -- incomeStartTime
NOW(), -- incomeEndTime
?, -- storeUserId
NOW(), -- createdTime
NOW() -- updatedTime
)
前置条件:
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
Authorization: Bearer VALID_TOKEN
{
"payPassword": "123456",
"withdrawalMoney": 50000
}
响应:
{
"code": 200,
"success": true,
"data": {
"id": 1001,
"storeId": 103,
"money": 50000,
"paymentStatus": 3,
...
},
"msg": "操作成功"
}
数据库变化:
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "wrong_password",
"withdrawalMoney": 50000
}
响应:
{
"code": 500,
"success": false,
"data": null,
"msg": "支付密码错误"
}
前置条件: 账户余额 100元(10000分)
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "123456",
"withdrawalMoney": 20000
}
响应:
{
"code": 500,
"success": false,
"data": null,
"msg": "余额不足"
}
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "123456",
"withdrawalMoney": 5
}
响应:
{
"code": 500,
"success": false,
"data": null,
"msg": "金额不能小于0.1元"
}
export default {
data() {
return {
payPassword: '',
withdrawalMoney: '', // 用户输入的元金额
loading: false
};
},
methods: {
async applyFastCashOut() {
// 1. 验证输入
if (!this.payPassword) {
this.$message.error('请输入支付密码');
return;
}
if (!this.withdrawalMoney || this.withdrawalMoney < 0.1) {
this.$message.error('提现金额不能小于0.1元');
return;
}
// 2. 转换金额单位(元转分)
const withdrawalMoneyInCents = Math.floor(this.withdrawalMoney * 100);
// 3. 发送请求(使用JSON Body)
this.loading = true;
try {
const response = await this.$axios.post('/incomeManage/applyFastCashOut', {
payPassword: this.payPassword,
withdrawalMoney: withdrawalMoneyInCents
});
if (response.data.success) {
const cashOutRecord = response.data.data;
this.$message.success('快速提现申请成功');
console.log('提现记录ID:', cashOutRecord.id);
console.log('提现状态:', cashOutRecord.paymentStatus); // 3-已通过
// 刷新列表或跳转
this.$router.push('/cashout-list');
} else {
this.$message.error(response.data.msg);
}
} catch (error) {
console.error('快速提现失败:', error);
this.$message.error('快速提现失败,请稍后重试');
} finally {
this.loading = false;
}
}
}
}
import { useState } from 'react';
import axios from 'axios';
function FastCashOut() {
const [payPassword, setPayPassword] = useState('');
const [withdrawalMoney, setWithdrawalMoney] = useState('');
const [loading, setLoading] = useState(false);
const handleSubmit = async () => {
// 1. 验证输入
if (!payPassword) {
alert('请输入支付密码');
return;
}
const amount = parseFloat(withdrawalMoney);
if (!amount || amount < 0.1) {
alert('提现金额不能小于0.1元');
return;
}
// 2. 转换金额单位(元转分)
const withdrawalMoneyInCents = Math.floor(amount * 100);
// 3. 发送请求(使用JSON Body)
setLoading(true);
try {
const response = await axios.post('/incomeManage/applyFastCashOut', {
payPassword,
withdrawalMoney: withdrawalMoneyInCents
});
if (response.data.success) {
const cashOutRecord = response.data.data;
alert('快速提现申请成功');
console.log('提现记录:', cashOutRecord);
// 跳转或刷新
} else {
alert(response.data.msg);
}
} catch (error) {
console.error('快速提现失败:', error);
alert('快速提现失败,请稍后重试');
} finally {
setLoading(false);
}
};
return (
<div>
<h2>快速提现(免审核)</h2>
<div>
<label>支付密码:</label>
<input
type="password"
value={payPassword}
onChange={(e) => setPayPassword(e.target.value)}
/>
</div>
<div>
<label>提现金额(元):</label>
<input
type="number"
min="0.1"
step="0.01"
value={withdrawalMoney}
onChange={(e) => setWithdrawalMoney(e.target.value)}
/>
</div>
<button onClick={handleSubmit} disabled={loading}>
{loading ? '提交中...' : '确认提现'}
</button>
<p className="tip">
⚠️ 快速提现无需审核,提现记录将直接标记为"已通过"状态
</p>
</div>
);
}
前置条件:
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
Authorization: Bearer VALID_TOKEN
{
"payPassword": "123456",
"withdrawalMoney": 50000
}
预期结果:
data.paymentStatus = 3(已通过)请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "wrong",
"withdrawalMoney": 50000
}
预期结果:
前置条件: 账户余额 100元
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "123456",
"withdrawalMoney": 20000
}
预期结果:
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "123456",
"withdrawalMoney": 5
}
预期结果:
请求:
POST /incomeManage/applyFastCashOut
Content-Type: application/json
{
"payPassword": "123456",
"withdrawalMoney": 10
}
预期结果:
答案:
/applyFastCashOut):
/cashOut):
答案: 不会。快速提现只创建提现记录,不扣减账户余额。实际扣款在管理员审批打款时进行。
答案:
paymentStatus = 3 表示"已通过审核"1 - 待审核2 - 审核不通过4 - 已打款5 - 打款失败答案:
withdrawalMoney=10000答案:
答案:
@Transactional 注解money <= withdrawalMoney 会失败***@Transactional 保证原子性alien-store/alienStore/storeIncomeDetailsRecord/applyCashOutStoreIncomeDetailsRecordControllerStoreIncomeDetailsRecordService.applyCashOut()storeId, payPassword, withdrawalMoneyalien-store-platform/incomeManage/applyFastCashOutIncomeManageControllerIncomeManageService.applyFastCashOut()payPassword, withdrawalMoney(storeId从token获取)| 项目 | app端 | web端 | 说明 |
|---|---|---|---|
| 请求方式 | GET | POST | POST更安全 |
| 请求参数 | @RequestParam | @RequestBody(DTO) | 使用DTO更规范 |
| storeId来源 | 参数 | JWT token | 防伪造 |
| 账户扣款 | 不扣款 | 不扣款 | 保持一致 |
| 提现状态 | paymentStatus=3 | paymentStatus=3 | 保持一致 |
| 返回值 | StoreCashOutRecord | StoreCashOutRecord | 保持一致 |
| 事务管理 | @Transactional | @Transactional | 保持一致 |
money <= withdrawalMoney)修改内容:
CashOutDTO)@RequestBody 接收 JSON 请求体@ApiImplicitParams 注解涉及文件:
IncomeManageController.java - 更新28-快速提现申请接口.md - 更新文档新增接口:
POST /incomeManage/applyFastCashOut - 快速提现申请(免审核)核心功能:
money <= withdrawalMoney)与app端一致性:
涉及文件:
IncomeManageController.java - 新增 applyFastCashOut 接口IncomeManageService.java - 新增方法定义IncomeManageServiceImpl.java - 新增方法实现代码质量:
开发人员: ssk
文档版本: v1.0
最后更新: 2025-11-20
维护人员: ssk