日期:2026-07-29 | 优先级:P1
实现操作员交接班管理和收入报表查询。交接班记录当班现金出入、自动统计收款并计算差异。收入报表按日/停车场汇总收入。
新增 shift_record 表:
| 字段 | 类型 | 说明 |
|---|---|---|
| id | uint | 主键 |
| operator_id | uint | 操作员 |
| start_time | datetime | 接班时间 |
| end_time | datetime | 交班时间 |
| starting_cash | float64 | 接班现金(手动录入) |
| collected_cash | float64 | 当班收现金(自动统计) |
| expected_total | float64 | start + collected |
| actual_total | float64 | 实交现金(交班时录入) |
| difference | float64 | actual - expected |
| status | string | active / closed |
| remark | string | 备注 |
接班 → 输入当前现金余额 → INSERT (status=active) → 显示"当班中"
交班 → 系统统计当班收款 → 操作员输入实交现金 → 计算差异 → UPDATE (status=closed)
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /shift/start | 接班 |
| POST | /shift/end | 交班 |
| GET | /shift/current | 当前当班状态 |
| GET | /shift/list | 历史记录 |
查询 payment_record,按日 + 停车场 GROUP BY。
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /report/revenue | 按日/停车场汇总 |
参数:start_date, end_date, parking_lot_id
返回:
[
{ "date": "2026-07-29", "parking_lot": "停车场A", "cash": 280, "free": 50, "total": 330, "count": 8 }
]
| 文件 | 操作 |
|---|---|
internal/dao/shift_record.go |
新建 |
internal/modules/shift/api.go |
新建 |
internal/modules/shift/service/service.go |
新建 |
internal/modules/shift/repository/repo.go |
新建 |
internal/modules/report/api.go |
新建 |
internal/modules/report/service/service.go |
新建 |
internal/initialize/gorm.go |
修改 |
internal/initialize/router.go |
修改 |
internal/initialize/seed.go |
修改 |
frontend/src/view/parking/shiftRecord.vue |
新建 |
frontend/src/view/report/revenue.vue |
新建 |
frontend/src/api/shift.js |
新建 |
frontend/src/api/report.js |
新建 |
frontend/src/lang/zh-CN.js, en.js |
修改 |