feat(config): 更新开发和生产环境配置

- 修改开发环境前端URL从localhost改为公网地址
- 更新PayPal Webhook URL使用公网地址配置
- 在生产环境配置中添加服务器端口和应用配置
- 添加PayPal支付配置的详细注释说明
- 简化ERP用户管理API文档格式,移除冗余说明
- 移除PayPal订单生命周期和Webhook指南文档
- 优化PayPal Webhook配置文档内容

fix(order): 修复订单创建和库存管理并发问题

- 实现SELECT FOR UPDATE锁定SKU记录防止超卖
- 添加库存扣减原子操作确保并发安全
- 简化日志输出,移除冗余调试信息
- 添加订单取消功能并恢复库存
- 优化订单查询和状态更新逻辑

feat(mapper): 添加库存扣减和恢复功能

- 实现deductStock方法用于扣减库存
- 添加restoreStock方法用于恢复库存
- 实现selectByIdForUpdate方法用于悲观锁
- 为Mapper接口添加必要的注解支持
This commit is contained in:
2025-12-26 10:54:01 +08:00
parent f8d116f9a3
commit 2d9a9c3668
19 changed files with 1379 additions and 1329 deletions

71
DEPLOYMENT_README.md Normal file
View File

@@ -0,0 +1,71 @@
# 部署说明
## 快速部署指南
### 后端部署
1. **配置文件已更新**
-`app.frontend.url` 已设置为 `http://175.178.252.59:3000`
-`paypal.webhook-url` 已设置为 `http://175.178.252.59:8082/api/paypal/webhook`
- ✅ 前端 `.env.production` 已创建API地址为 `http://175.178.252.59:8082/api`
2. **打包应用**
```bash
cd E:\MTKJPAY
mvn clean package -DskipTests
```
3. **上传并启动**
```bash
# 上传 jar 文件到服务器
# 启动应用
java -jar mt-pay-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev
# 或后台运行
nohup java -jar mt-pay-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev > app.log 2>&1 &
```
### 前端部署
1. **构建前端**
```bash
cd E:\MTKJPAY-FRONT
npm run build
```
2. **本地测试打包结果(验证打包是否正确)**
```bash
cd dist
python -m http.server 3000
# 或
npx http-server -p 3000
# 访问 http://localhost:3000应该能看到页面不是空白
```
3. **API地址配置**
- ✅ `.env.production` 文件已创建
- ✅ API地址已设置为 `http://175.178.252.59:8082/api`
- 如果没有该文件,构建时会使用默认值 `/api`(相对路径)
4. **上传到服务器**
```bash
# 上传dist目录下的所有文件到服务器
scp -r dist/* root@175.178.252.59:/path/to/web/root/
```
5. **服务器配置**
- 如果服务器已有Web服务器将dist内容放到Web根目录
- 确保支持Vue Router的history模式配置 `try_files`
## 配置检查清单
部署前请检查以下配置:
- [x] 后端 `app.frontend.url` 已设置为 `http://175.178.252.59:3000`
- [x] 后端 `paypal.webhook-url` 已设置为 `http://175.178.252.59:8082/api/paypal/webhook`
- [x] 前端API地址已配置为 `http://175.178.252.59:8082/api`
- [ ] 数据库连接信息正确
- [ ] 服务器防火墙已开放必要端口8082、3000等
- [ ] PayPal控制台Webhook URL已更新为 `http://175.178.252.59:8082/api/paypal/webhook`