Files
ecom-dmb/ecom-dmb-backend/README.md
T

90 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ecom-dmb-backend
电商 DMB 后端服务
## 技术栈
- Java 17 + Spring Boot 3.2
- MyBatis-Plus + MySQL
- Redis(导入任务队列 + 缓存)
- MongoDB(BI 聚合统计)
- RabbitMQ(业务消息队列)
- JWT 认证(HS512)
- Lombok + MapStruct
## 环境要求
- JDK 17+
- MySQL 8.0+
- Redis 6.0+
- MongoDB 6.0+
- RabbitMQ 3.12+
- Maven 3.9+
## 快速启动
### 1. 配置环境变量(生产环境必须)
```bash
export DB_URL="jdbc:mysql://<host>:3306/ecom_dmb_dev?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true"
export DB_USERNAME="ecom_dmb_dev"
export DB_PASSWORD="<your-db-password>"
export REDIS_HOST="<your-redis-host>"
export REDIS_PORT="6379"
export REDIS_PASSWORD="<your-redis-password>"
export JWT_SECRET="<your-64-byte-secret-key>"
```
### 2. 启动
```bash
cd ecom-dmb-backend
./mvnw spring-boot:run
```
或指定端口:
```bash
./mvnw spring-boot:run -Dspring-boot.run.arguments="--server.port=8080"
```
## 项目结构
```
ecom-dmb-backend/src/main/java/top/xyquan/ecomdmbbackend/
├── common/ # 通用组件(异常、响应、注解、过滤器)
├── modules/
│ ├── ecom/ # 电商核心模块
│ │ ├── overview/ # 概览统计(含导出)
│ │ ├── order/ # 订单管理
│ │ ├── product/ # 商品管理
│ │ ├── shop/ # 店铺管理
│ │ ├── promotion/ # 推广费管理
│ │ ├── Brushorder/ # 刷单管理
│ │ └── importtask/ # 导入任务(Redis 队列)
│ └── sys/ # 系统模块(用户、菜单、权限)
└── utils/ # 工具类
```
## 核心接口
| 模块 | 路径 | 说明 |
|------|------|------|
| 工作台 | /api/bi/workbench/* | 经营工作台 |
| 店铺概览 | POST /api/bi/shop/overview | 单店铺统计 |
| 店铺按商品汇总导出 | POST /api/bi/shop/export/summary-by-product | Excel |
| 店铺按品类汇总导出 | POST /api/bi/shop/export/summary-by-category | Excel |
| 商品概览 | POST /api/bi/product/overview | 单商品统计 |
| 订单 | /ec/order/* | CRUD |
| 广告费 | /ec/shop/ad-fee/* | CRUD |
| 刷单 | /ec/shop/fake-orders-fee/* | CRUD |
| 商品 | /ec/product/* | CRUD |
## 数据库
连接信息通过环境变量配置,参考 application.yml 中的 `DB_*` 前缀。
## 数据备份
参见项目根目录 `scripts/backup.sh`