规范:删除03-API接口设计.md中所有返回数据结构定义(10个模块),03只保留URL和Method,数据结构由各页面文件§9定义

main
haoliang 1 week ago
parent 293e1cf233
commit 2887568c5f

@ -120,19 +120,6 @@
|---|---------|--------|----------|------|------|
| 1 | `/api/admin/login` | POST | `/mock-api/admin/login` | 管理员登录 | 否 |
**POST /api/admin/login**
```
Request:
{ "username": "admin", "password": "admin123", "rememberMe": true }
Response 200:
{ "code": 0, "data": { "token": "eyJhbGciOiJIUzI1NiJ9...", "expiresIn": 604800 } }
Response 400:
{ "code": 40001, "message": "用户名或密码错误", "data": null }
```
---
### 3.2 仪表盘模块
@ -155,51 +142,6 @@ Response 400:
| 10 | `/api/admin/collector/stop` | POST | `/mock-api/admin/collector/stop` | 停止采集服务 |
| 11 | `/api/admin/collector/refresh` | POST | `/mock-api/admin/collector/refresh` | 刷新采集配置 |
**GET /api/admin/dashboard/summary**
```
Query: 无
Response:
{ "code": 0, "data": {
"onlineCount": 142, "totalMachines": 160,
"todayProduction": 2847, "activeAlerts": 3,
"collectSuccessRate": 99.2, "todayCuttingTime": 580,
"runningMachines": 128, "dataMissingMachines": 3
}}
```
**GET /api/admin/dashboard/workshop-production**
```
Query: startDate=2026-04-28&endDate=2026-04-28
Response:
{ "code": 0, "data": { "items": [
{ "workshopName": "A栋", "quantity": 1280, "machineCount": 80, "avgQuantity": 16.0 },
{ "workshopName": "B栋", "quantity": 860, "machineCount": 45, "avgQuantity": 19.1 }
]}}
说明:多天范围时 avgQuantity = 总产量÷天数÷机床数(日均单机产量)
```
**GET /api/admin/dashboard/machine-rank**
```
Query: startDate=2026-04-28&endDate=2026-04-28
Response:
{ "code": 0, "data": { "items": [
{ "rank": 1, "machineId": 1, "machineName": "西-1.8", "program": "1566.NC", "quantity": 580, "status": 1 }
]}}
```
**GET /api/admin/dashboard/worker-rank**
```
Query: startDate=2026-04-28&endDate=2026-04-28
Response:
{ "code": 0, "data": { "items": [
{ "rank": 1, "workerId": 1, "workerName": "张三", "machineCount": 3, "totalQuantity": 1240 }
]}}
```
---
### 3.3 设备管理模块
@ -221,35 +163,6 @@ Response:
| 9 | `/api/admin/machine/{id}/production/trend` | GET | `/mock-api/admin/machine/production/trend` | 产量趋势 |
| 10 | `/api/admin/machine/{id}/collect-records` | GET | `/mock-api/admin/machine/collect-records` | 近期采集记录 |
**GET /api/admin/machine**
```
Query: page=1&pageSize=20&keyword=&workshopId=1&isOnline=&brandId=1
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "deviceCode": "fanake_1.8", "name": "西-1.8",
"workshopId": 1, "workshopName": "A栋",
"collectAddressId": 1, "brandId": 1, "brandName": "FANUC",
"ipAddress": "10.1.1.8", "isEnabled": 1, "isOnline": 1,
"workerId": 1, "workerName": "张三",
"lastProgramName": "1566.NC", "lastCollectTime": "2026-04-28T10:30:00" }
], "total": 160, "page": 1, "pageSize": 20 }}
```
**POST /api/admin/machine**
```
Request:
{ "deviceCode": "fanake_1.8", "name": "西-1.8", "workshopId": 1,
"collectAddressId": 1, "ipAddress": "10.1.1.8", "brandId": 1 }
Response 200:
{ "code": 0, "data": { "id": 161 } }
Response 400:
{ "code": 40003, "message": "设备编码已存在", "data": null }
```
---
### 3.4 品牌模板模块
@ -269,30 +182,6 @@ Response 400:
| 7 | `/api/admin/brand/{id}/toggle` | PUT | `/mock-api/admin/brand/toggle` | 启停品牌 |
| 8 | `/api/admin/brand/standard-fields` | GET | `/mock-api/admin/brand/standard-fields` | 标准字段列表 |
**GET /api/admin/brand**
```
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "brandName": "FANUC", "deviceField": "device", "tagsPath": "tags",
"isEnabled": 1, "fieldCount": 16 }
]}}
```
**GET /api/admin/brand/{id}**
```
Response:
{ "code": 0, "data": {
"id": 1, "brandName": "FANUC", "deviceField": "device", "tagsPath": "tags",
"isEnabled": 1, "fieldCount": 16,
"mappings": [
{ "id": 1, "standardField": "program_name", "fieldName": "Tag5",
"matchBy": "id", "dataType": "string", "isRequired": 1 }
]
}}
```
---
### 3.5 采集地址模块
@ -313,18 +202,6 @@ Response:
| 8 | `/api/admin/collect-address/{id}/collect-records` | GET | `/mock-api/admin/collect-address/collect-records` | 近期采集记录 |
| 9 | `/api/admin/collect-address/{id}/raw-json` | GET | `/mock-api/admin/collect-address/raw-json` | 最新原始JSON |
**GET /api/admin/collect-address**
```
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "name": "FANUC-A栋", "url": "http://10.1.1.1/",
"brandId": 1, "brandName": "FANUC", "collectInterval": 30,
"isEnabled": 1, "lastCollectTime": "2026-04-28T10:30:00",
"failCount": 0, "machineCount": 32 }
]}}
```
---
### 3.6 员工管理模块
@ -346,17 +223,6 @@ Response:
| 9 | `/api/admin/worker/{id}/production/trend` | GET | `/mock-api/admin/worker/production/trend` | 产量趋势 |
| 10 | `/api/admin/worker/available-machines` | GET | `/mock-api/admin/worker/available-machines` | 可绑定机床(未绑定) |
**GET /api/admin/worker**
```
Query: page=1&pageSize=20&keyword=&isEnabled=
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "code": "W001", "name": "张三", "isEnabled": 1,
"machineCount": 2, "machineNames": "西-1.8,西-2.0" }
], "total": 50, "page": 1, "pageSize": 20 }}
```
---
### 3.7 产量报表模块
@ -373,29 +239,6 @@ Response:
| 4 | `/api/admin/production/{recordId}/adjustment-history` | GET | `/mock-api/admin/production/adjustment-history` | 修正历史 |
| 5 | `/api/admin/production/export` | GET | `/mock-api/admin/production/export` | 导出报表 |
**GET /api/admin/production/daily**
```
Query: page=1&pageSize=20&date=2026-04-28&workshopId=&machineId=&workerId=&dataStatus=
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "date": "2026-04-28", "machineName": "西-1.8", "programName": "1566.NC",
"quantity": 580, "runTime": "4h20m", "cuttingTime": "3h50m",
"dataStatus": "normal", "isAdjusted": 0, "adjustedQuantity": null }
], "total": 1200, "page": 1, "pageSize": 20 }}
```
**POST /api/admin/production/adjust**
```
Request:
{ "targetTable": "daily_production", "targetId": 3,
"fieldName": "total_quantity", "newValue": 320, "reason": "传感器计数偏差,手工校准" }
Response 200:
{ "code": 0, "message": "success", "data": null }
```
---
### 3.8 告警中心模块
@ -411,27 +254,6 @@ Response 200:
| 3 | `/api/admin/alert/{id}/resolve` | PUT | `/mock-api/admin/alert/resolve` | 处理单条告警 |
| 4 | `/api/admin/alert/batch-resolve` | POST | `/mock-api/admin/alert/batch-resolve` | 批量处理告警 |
**GET /api/admin/alert**
```
Query: page=1&pageSize=20&alertType=&isResolved=&machineId=&startDate=&endDate=
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "createdAt": "2026-04-28T17:30:00", "alertType": "collect_fail",
"title": "采集请求失败", "machineName": "西-1.8",
"detail": "HTTP超时(30s)连续失败3次", "isResolved": 0, "resolvedAt": null }
], "total": 320, "page": 1, "pageSize": 20 }}
```
**GET /api/admin/alert/statistics**
```
Response:
{ "code": 0, "data": {
"unresolved": 15, "collectFail": 5, "deviceOffline": 6,
"productionAnomaly": 2, "unknownDevice": 2, "serviceError": 0 }}
```
---
### 3.9 系统设置模块
@ -452,29 +274,6 @@ Response:
| 8 | `/api/admin/workshop/{id}/toggle` | PUT | `/mock-api/admin/workshop/toggle` | 启停车间 |
| 9 | `/api/admin/change-password` | POST | `/mock-api/admin/change-password` | 修改密码 |
**GET /api/admin/sys-config**
```
Query: keyword=
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "configKey": "ping_interval", "configValue": "60",
"valueType": "number", "description": "Ping检测间隔(秒)" },
{ "id": 8, "configKey": "api_token", "configValue": "********",
"valueType": "string", "description": "前端API Token" }
]}}
说明敏感字段api_token/collector_api_key返回时值显示为 "********"
```
**GET /api/admin/workshop**
```
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "name": "A栋", "sortOrder": 1, "isEnabled": 1, "machineCount": 32 }
]}}
```
---
### 3.10 操作日志模块
@ -489,30 +288,6 @@ Response:
| 2 | `/api/admin/log/adjustment/export` | GET | `/mock-api/admin/log/adjustment/export` | 导出修正日志 |
| 3 | `/api/admin/log/system` | GET | `/mock-api/admin/log/system` | 系统运行日志(分页) |
**GET /api/admin/log/adjustment**
```
Query: page=1&pageSize=20&startDate=&endDate=&targetTable=&keyword=
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "createdAt": "2026-04-28T15:30:00", "targetTable": "daily_production",
"targetId": 3, "oldValue": 310, "newValue": 320,
"reason": "传感器计数偏差,手工校准", "operatorIp": "192.168.1.5" }
], "total": 80, "page": 1, "pageSize": 20 }}
```
**GET /api/admin/log/system**
```
Query: page=1&pageSize=20&startDate=&endDate=&logLevel=&source=&keyword=
Response:
{ "code": 0, "data": { "items": [
{ "id": 1, "createdAt": "2026-04-28T17:36:38", "logLevel": "INFO",
"source": "CncCollector", "message": "采集完成: 32台成功, 0台失败",
"stackTrace": null, "extraData": null }
], "total": 5600, "page": 1, "pageSize": 20 }}
```
---
### 3.11 大屏配置模块

Loading…
Cancel
Save