feat(backend): 开发订单管理和供应商管理功能
- 新增订单管理页面,实现订单列表展示、搜索、分页等功能 - 新增供应商管理页面,实现供应商列表展示、搜索、分页等功能- 添加订单和供应商相关模型及数据库迁移 - 实现订单状态更新和供应商信息编辑功能 - 优化后端路由结构,移除不必要的代码
This commit is contained in:
511
docs/api/transports.yaml
Normal file
511
docs/api/transports.yaml
Normal file
@@ -0,0 +1,511 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: 运输管理API
|
||||
description: 运输管理模块的API接口文档
|
||||
version: 1.0.0
|
||||
|
||||
servers:
|
||||
- url: http://localhost:3000/api
|
||||
description: 本地开发服务器
|
||||
|
||||
paths:
|
||||
/transports:
|
||||
get:
|
||||
summary: 获取运输列表
|
||||
description: 获取所有运输记录的列表,支持分页和筛选
|
||||
parameters:
|
||||
- name: page
|
||||
in: query
|
||||
description: 页码
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
default: 1
|
||||
- name: limit
|
||||
in: query
|
||||
description: 每页记录数
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
default: 10
|
||||
- name: status
|
||||
in: query
|
||||
description: 运输状态筛选
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
enum: [scheduled, in_transit, completed, cancelled]
|
||||
responses:
|
||||
'200':
|
||||
description: 成功返回运输列表
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
example: 200
|
||||
data:
|
||||
type: object
|
||||
properties:
|
||||
transports:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Transport'
|
||||
pagination:
|
||||
type: object
|
||||
properties:
|
||||
page:
|
||||
type: integer
|
||||
limit:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
message:
|
||||
type: string
|
||||
example: "获取运输列表成功"
|
||||
'500':
|
||||
description: 服务器内部错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
post:
|
||||
summary: 创建新的运输记录
|
||||
description: 创建一个新的运输记录
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
order_id:
|
||||
type: integer
|
||||
description: 关联订单ID
|
||||
driver_id:
|
||||
type: integer
|
||||
description: 司机ID
|
||||
vehicle_id:
|
||||
type: integer
|
||||
description: 车辆ID
|
||||
start_location:
|
||||
type: string
|
||||
description: 起始地点
|
||||
end_location:
|
||||
type: string
|
||||
description: 目的地
|
||||
scheduled_start_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 计划开始时间
|
||||
scheduled_end_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 计划结束时间
|
||||
cattle_count:
|
||||
type: integer
|
||||
description: 运输牛只数量
|
||||
special_requirements:
|
||||
type: string
|
||||
description: 特殊要求
|
||||
required:
|
||||
- order_id
|
||||
- driver_id
|
||||
- vehicle_id
|
||||
- start_location
|
||||
- end_location
|
||||
- scheduled_start_time
|
||||
- scheduled_end_time
|
||||
- cattle_count
|
||||
responses:
|
||||
'201':
|
||||
description: 成功创建运输记录
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
example: 201
|
||||
data:
|
||||
$ref: '#/components/schemas/Transport'
|
||||
message:
|
||||
type: string
|
||||
example: "创建运输记录成功"
|
||||
'400':
|
||||
description: 请求参数错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: 服务器内部错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
/transports/{id}:
|
||||
get:
|
||||
summary: 获取运输详情
|
||||
description: 根据ID获取运输记录的详细信息
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
description: 运输记录ID
|
||||
responses:
|
||||
'200':
|
||||
description: 成功返回运输详情
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
example: 200
|
||||
data:
|
||||
$ref: '#/components/schemas/TransportDetail'
|
||||
message:
|
||||
type: string
|
||||
example: "获取运输详情成功"
|
||||
'404':
|
||||
description: 运输记录不存在
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: 服务器内部错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
put:
|
||||
summary: 更新运输记录
|
||||
description: 根据ID更新运输记录
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
description: 运输记录ID
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum: [scheduled, in_transit, completed, cancelled]
|
||||
description: 运输状态
|
||||
actual_start_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 实际开始时间
|
||||
actual_end_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 实际结束时间
|
||||
responses:
|
||||
'200':
|
||||
description: 成功更新运输记录
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
example: 200
|
||||
data:
|
||||
$ref: '#/components/schemas/Transport'
|
||||
message:
|
||||
type: string
|
||||
example: "更新运输记录成功"
|
||||
'400':
|
||||
description: 请求参数错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'404':
|
||||
description: 运输记录不存在
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: 服务器内部错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
delete:
|
||||
summary: 删除运输记录
|
||||
description: 根据ID删除运输记录
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
description: 运输记录ID
|
||||
responses:
|
||||
'200':
|
||||
description: 成功删除运输记录
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
example: 200
|
||||
message:
|
||||
type: string
|
||||
example: "删除运输记录成功"
|
||||
'404':
|
||||
description: 运输记录不存在
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: 服务器内部错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
/transports/{id}/tracks:
|
||||
get:
|
||||
summary: 获取运输跟踪信息
|
||||
description: 根据运输ID获取跟踪信息列表
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
description: 运输记录ID
|
||||
responses:
|
||||
'200':
|
||||
description: 成功返回运输跟踪信息列表
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
example: 200
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TransportTrack'
|
||||
message:
|
||||
type: string
|
||||
example: "获取运输跟踪信息成功"
|
||||
'404':
|
||||
description: 运输记录不存在
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'500':
|
||||
description: 服务器内部错误
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Transport:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: 运输记录ID
|
||||
order_id:
|
||||
type: integer
|
||||
description: 关联订单ID
|
||||
driver_id:
|
||||
type: integer
|
||||
description: 司机ID
|
||||
vehicle_id:
|
||||
type: integer
|
||||
description: 车辆ID
|
||||
start_location:
|
||||
type: string
|
||||
description: 起始地点
|
||||
end_location:
|
||||
type: string
|
||||
description: 目的地
|
||||
scheduled_start_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 计划开始时间
|
||||
actual_start_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 实际开始时间
|
||||
scheduled_end_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 计划结束时间
|
||||
actual_end_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 实际结束时间
|
||||
status:
|
||||
type: string
|
||||
enum: [scheduled, in_transit, completed, cancelled]
|
||||
description: 运输状态
|
||||
estimated_arrival_time:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 预计到达时间
|
||||
cattle_count:
|
||||
type: integer
|
||||
description: 运输牛只数量
|
||||
special_requirements:
|
||||
type: string
|
||||
description: 特殊要求
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 创建时间
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 更新时间
|
||||
|
||||
TransportDetail:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/Transport'
|
||||
- type: object
|
||||
properties:
|
||||
vehicle:
|
||||
$ref: '#/components/schemas/Vehicle'
|
||||
tracks:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TransportTrack'
|
||||
|
||||
Vehicle:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: 车辆ID
|
||||
license_plate:
|
||||
type: string
|
||||
description: 车牌号
|
||||
vehicle_type:
|
||||
type: string
|
||||
description: 车辆类型
|
||||
capacity:
|
||||
type: integer
|
||||
description: 载重能力(公斤)
|
||||
driver_id:
|
||||
type: integer
|
||||
description: 司机ID
|
||||
status:
|
||||
type: string
|
||||
enum: [available, in_use, maintenance, retired]
|
||||
description: 车辆状态
|
||||
last_maintenance_date:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 上次维护日期
|
||||
next_maintenance_date:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 下次维护日期
|
||||
insurance_expiry_date:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 保险到期日期
|
||||
registration_expiry_date:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 注册到期日期
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 创建时间
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 更新时间
|
||||
|
||||
TransportTrack:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: 跟踪记录ID
|
||||
transport_id:
|
||||
type: integer
|
||||
description: 运输记录ID
|
||||
latitude:
|
||||
type: number
|
||||
format: decimal
|
||||
description: 纬度
|
||||
longitude:
|
||||
type: number
|
||||
format: decimal
|
||||
description: 经度
|
||||
speed:
|
||||
type: number
|
||||
format: decimal
|
||||
description: 速度
|
||||
direction:
|
||||
type: number
|
||||
format: decimal
|
||||
description: 方向
|
||||
cattle_status:
|
||||
type: string
|
||||
description: 牛只状态
|
||||
temperature:
|
||||
type: number
|
||||
format: decimal
|
||||
description: 温度
|
||||
humidity:
|
||||
type: number
|
||||
format: decimal
|
||||
description: 湿度
|
||||
video_url:
|
||||
type: string
|
||||
description: 视频URL
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: 创建时间
|
||||
|
||||
Error:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
description: 错误代码
|
||||
message:
|
||||
type: string
|
||||
description: 错误信息
|
||||
required:
|
||||
- code
|
||||
- message
|
||||
Reference in New Issue
Block a user