# Tenant Service
租户服务 - 多租户管理、套餐管理

## 基本信息
- **服务端口**: 8083
- **服务名称**: tenant-service
- **模块分支**: 业务域/功能模块
- **数据库**: erp_db

## 功能清单
1. 租户管理
2. 多租户隔离
3. 租户配置

## API接口
| 方法 | 路径 | 描述 |
|------|------|------|
| GET | /api/admin/tenants/{id} | TenantAdminController接口 |
| GET | /api/admin/tenants/code/{code} | TenantAdminController接口 |
| GET | /api/admin/tenants/overview | TenantAdminController接口 |
| GET | /api/admin/tenants/packages | TenantAdminController接口 |
| GET | /api/admin/tenants/packages/active | TenantAdminController接口 |
| GET | /api/admin/tenants/packages/{id} | TenantAdminController接口 |
| POST | /api/admin/tenants/{id}/toggle-status | TenantAdminController接口 |
| POST | /api/admin/tenants/{id}/suspend | TenantAdminController接口 |
| POST | /api/admin/tenants/{id}/activate | TenantAdminController接口 |
| POST | /api/admin/tenants/batch-status | TenantAdminController接口 |
| POST | /api/admin/tenants/packages | TenantAdminController接口 |
| POST | /api/admin/tenants/packages/{id}/set-default | TenantAdminController接口 |
| POST | /api/admin/tenants/packages/{id}/toggle-status | TenantAdminController接口 |
| PUT | /api/admin/tenants/{id} | TenantAdminController接口 |
| PUT | /api/admin/tenants/packages/{id} | TenantAdminController接口 |
| DELETE | /api/admin/tenants/{id} | TenantAdminController接口 |
| DELETE | /api/admin/tenants/packages/{id} | TenantAdminController接口 |
| GET | /api/tenant/customers/{id} | CustomerController接口 |
| GET | /api/tenant/customers/stats | CustomerController接口 |
| POST | /api/tenant/customers/{id}/toggle-status | CustomerController接口 |
| PUT | /api/tenant/customers/{id} | CustomerController接口 |
| DELETE | /api/tenant/customers/{id} | CustomerController接口 |
| GET | /api/tenant/stocks/alerts | StockController接口 |
| GET | /api/tenant/stocks/alerts/summary | StockController接口 |
| GET | /api/tenant/stocks/{id} | StockController接口 |
| GET | /api/tenant/orders/{id} | OrderController接口 |
| GET | /api/tenant/orders/{id}/tracking | OrderController接口 |
| POST | /api/tenant/orders/{id}/approve | OrderController接口 |
| POST | /api/tenant/orders/{id}/reject | OrderController接口 |
| POST | /api/tenant/orders/{id}/push-warehouse | OrderController接口 |
| GET | /api/tenant/reports/orders | ReportController接口 |
| GET | /api/tenant/reports/sales | ReportController接口 |
| GET | /api/tenant/reports/stock | ReportController接口 |
| GET | /api/tenant/reports/api-usage | ReportController接口 |
| GET | /api/tenant/finance/records | FinanceController接口 |
| GET | /api/tenant/finance/summary | FinanceController接口 |
| GET | /api/tenant/finance/records/{id} | FinanceController接口 |
| GET | /api/tenant/finance/reconciliations | FinanceController接口 |
| POST | /api/tenant/finance/records/{id}/confirm | FinanceController接口 |
| POST | /api/tenant/finance/records/{id}/cancel | FinanceController接口 |
| GET | /api/tenant/dashboard/alerts | TenantDashboardController接口 |
| GET | /api/tenant/goods/{id} | GoodsController接口 |
| GET | /api/tenant/goods/stats | GoodsController接口 |
| POST | /api/tenant/goods/{id}/put-on-sale | GoodsController接口 |
| POST | /api/tenant/goods/{id}/put-off-sale | GoodsController接口 |
| POST | /api/tenant/goods/batch-put-on-sale | GoodsController接口 |
| POST | /api/tenant/goods/batch-put-off-sale | GoodsController接口 |

## 数据库表
| 表名 | 说明 |
|------|------|
| tenants | Tenant |
| packages | Package |
| customers | Customer |
| stocks | Stock |
| stock_alerts | StockAlert |
| suppliers | Supplier |
| order_items | OrderItem |
| orders | Order |
| reconciliations | Reconciliation |
| finance_records | FinanceRecord |
| goods_skus | GoodsSku |
| goods | Goods |

## 配置文件
- bootstrap.yml: Nacos配置
- application.yml: 应用配置

## 启动方式
```bash
mvn clean package
java -jar target/tenant-service.jar
```
