feat(backend): 开发订单管理和供应商管理功能
- 新增订单管理页面,实现订单列表展示、搜索、分页等功能 - 新增供应商管理页面,实现供应商列表展示、搜索、分页等功能- 添加订单和供应商相关模型及数据库迁移 - 实现订单状态更新和供应商信息编辑功能 - 优化后端路由结构,移除不必要的代码
This commit is contained in:
374
backend/scripts/create_transport_tables.js
Normal file
374
backend/scripts/create_transport_tables.js
Normal file
@@ -0,0 +1,374 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../src/config/database');
|
||||
|
||||
// 运输管理模型
|
||||
const Transport = sequelize.define('Transport', {
|
||||
id: {
|
||||
type: DataTypes.BIGINT,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
order_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
comment: '关联订单ID'
|
||||
},
|
||||
driver_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
comment: '司机ID'
|
||||
},
|
||||
vehicle_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
comment: '车辆ID'
|
||||
},
|
||||
start_location: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
comment: '起始地点'
|
||||
},
|
||||
end_location: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
comment: '目的地'
|
||||
},
|
||||
scheduled_start_time: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
comment: '计划开始时间'
|
||||
},
|
||||
actual_start_time: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '实际开始时间'
|
||||
},
|
||||
scheduled_end_time: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
comment: '计划结束时间'
|
||||
},
|
||||
actual_end_time: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '实际结束时间'
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.ENUM('scheduled', 'in_transit', 'completed', 'cancelled'),
|
||||
defaultValue: 'scheduled',
|
||||
comment: '运输状态: scheduled(已安排), in_transit(运输中), completed(已完成), cancelled(已取消)'
|
||||
},
|
||||
estimated_arrival_time: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '预计到达时间'
|
||||
},
|
||||
cattle_count: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '运输牛只数量'
|
||||
},
|
||||
special_requirements: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '特殊要求'
|
||||
}
|
||||
}, {
|
||||
tableName: 'transports',
|
||||
timestamps: true,
|
||||
createdAt: 'created_at',
|
||||
updatedAt: 'updated_at'
|
||||
});
|
||||
|
||||
// 车辆管理模型
|
||||
const Vehicle = sequelize.define('Vehicle', {
|
||||
id: {
|
||||
type: DataTypes.BIGINT,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
license_plate: {
|
||||
type: DataTypes.STRING(20),
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
comment: '车牌号'
|
||||
},
|
||||
vehicle_type: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
comment: '车辆类型'
|
||||
},
|
||||
capacity: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
comment: '载重能力(公斤)'
|
||||
},
|
||||
driver_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
comment: '司机ID'
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.ENUM('available', 'in_use', 'maintenance', 'retired'),
|
||||
defaultValue: 'available',
|
||||
comment: '车辆状态: available(可用), in_use(使用中), maintenance(维护中), retired(已退役)'
|
||||
},
|
||||
last_maintenance_date: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '上次维护日期'
|
||||
},
|
||||
next_maintenance_date: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '下次维护日期'
|
||||
},
|
||||
insurance_expiry_date: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '保险到期日期'
|
||||
},
|
||||
registration_expiry_date: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '注册到期日期'
|
||||
}
|
||||
}, {
|
||||
tableName: 'vehicles',
|
||||
timestamps: true,
|
||||
createdAt: 'created_at',
|
||||
updatedAt: 'updated_at'
|
||||
});
|
||||
|
||||
// 运输跟踪模型
|
||||
const TransportTrack = sequelize.define('TransportTrack', {
|
||||
id: {
|
||||
type: DataTypes.BIGINT,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
transport_id: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false
|
||||
},
|
||||
latitude: {
|
||||
type: DataTypes.DECIMAL(10,8),
|
||||
allowNull: false
|
||||
},
|
||||
longitude: {
|
||||
type: DataTypes.DECIMAL(11,8),
|
||||
allowNull: false
|
||||
},
|
||||
speed: {
|
||||
type: DataTypes.DECIMAL(5,2),
|
||||
allowNull: true
|
||||
},
|
||||
direction: {
|
||||
type: DataTypes.DECIMAL(5,2),
|
||||
allowNull: true
|
||||
},
|
||||
cattle_status: {
|
||||
type: DataTypes.STRING(20),
|
||||
allowNull: true
|
||||
},
|
||||
temperature: {
|
||||
type: DataTypes.DECIMAL(5,2),
|
||||
allowNull: true
|
||||
},
|
||||
humidity: {
|
||||
type: DataTypes.DECIMAL(5,2),
|
||||
allowNull: true
|
||||
},
|
||||
video_url: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: true
|
||||
}
|
||||
}, {
|
||||
tableName: 'transport_tracks',
|
||||
timestamps: true,
|
||||
createdAt: 'created_at',
|
||||
updatedAt: false
|
||||
});
|
||||
|
||||
// 同步模型到数据库
|
||||
async function syncModels() {
|
||||
try {
|
||||
// 同步所有模型
|
||||
await Transport.sync({ alter: true });
|
||||
console.log('Transport table created/updated successfully');
|
||||
|
||||
await Vehicle.sync({ alter: true });
|
||||
console.log('Vehicle table created/updated successfully');
|
||||
|
||||
await TransportTrack.sync({ alter: true });
|
||||
console.log('TransportTrack table created/updated successfully');
|
||||
|
||||
console.log('All transport-related tables created/updated successfully');
|
||||
} catch (error) {
|
||||
console.error('Error creating transport tables:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入测试数据
|
||||
async function insertTestData() {
|
||||
try {
|
||||
// 先确保必要的外键数据存在(简化处理,实际项目中需要确保有真实的订单、司机、车辆数据)
|
||||
// 这里我们假设订单ID、司机ID、车辆ID分别为1,2,3
|
||||
|
||||
// 插入测试车辆数据
|
||||
const vehicles = await Vehicle.bulkCreate([
|
||||
{
|
||||
license_plate: '京A12345',
|
||||
vehicle_type: '厢式货车',
|
||||
capacity: 5000,
|
||||
driver_id: 1,
|
||||
status: 'available'
|
||||
},
|
||||
{
|
||||
license_plate: '沪B67890',
|
||||
vehicle_type: '专用运牛车',
|
||||
capacity: 8000,
|
||||
driver_id: 2,
|
||||
status: 'in_use'
|
||||
},
|
||||
{
|
||||
license_plate: '粤C11111',
|
||||
vehicle_type: '冷藏车',
|
||||
capacity: 6000,
|
||||
driver_id: 3,
|
||||
status: 'maintenance'
|
||||
}
|
||||
], { returning: true });
|
||||
|
||||
console.log('Test vehicles inserted:', vehicles.length);
|
||||
|
||||
// 插入测试运输数据
|
||||
const transports = await Transport.bulkCreate([
|
||||
{
|
||||
order_id: 1,
|
||||
driver_id: 1,
|
||||
vehicle_id: 1,
|
||||
start_location: '北京市朝阳区仓库',
|
||||
end_location: '天津市滨海新区屠宰场',
|
||||
scheduled_start_time: new Date('2024-01-15 08:00:00'),
|
||||
actual_start_time: new Date('2024-01-15 08:15:00'),
|
||||
scheduled_end_time: new Date('2024-01-15 18:00:00'),
|
||||
status: 'in_transit',
|
||||
estimated_arrival_time: new Date('2024-01-15 18:30:00'),
|
||||
cattle_count: 50,
|
||||
special_requirements: '保持通风'
|
||||
},
|
||||
{
|
||||
order_id: 2,
|
||||
driver_id: 2,
|
||||
vehicle_id: 2,
|
||||
start_location: '上海市浦东新区养殖场',
|
||||
end_location: '杭州市西湖区加工厂',
|
||||
scheduled_start_time: new Date('2024-01-16 06:00:00'),
|
||||
actual_start_time: new Date('2024-01-16 06:10:00'),
|
||||
scheduled_end_time: new Date('2024-01-16 20:00:00'),
|
||||
actual_end_time: new Date('2024-01-16 19:45:00'),
|
||||
status: 'completed',
|
||||
estimated_arrival_time: new Date('2024-01-16 20:30:00'),
|
||||
cattle_count: 80,
|
||||
special_requirements: '温度控制在15-20度'
|
||||
},
|
||||
{
|
||||
order_id: 3,
|
||||
driver_id: 3,
|
||||
vehicle_id: 3,
|
||||
start_location: '广州市天河区基地',
|
||||
end_location: '深圳市南山区配送中心',
|
||||
scheduled_start_time: new Date('2024-01-17 07:00:00'),
|
||||
scheduled_end_time: new Date('2024-01-17 19:00:00'),
|
||||
status: 'scheduled',
|
||||
estimated_arrival_time: new Date('2024-01-17 19:30:00'),
|
||||
cattle_count: 60,
|
||||
special_requirements: '避免急刹车'
|
||||
},
|
||||
{
|
||||
order_id: 4,
|
||||
driver_id: 1,
|
||||
vehicle_id: 1,
|
||||
start_location: '北京市大兴区农场',
|
||||
end_location: '石家庄市裕华区屠宰场',
|
||||
scheduled_start_time: new Date('2024-01-18 09:00:00'),
|
||||
actual_start_time: new Date('2024-01-18 09:20:00'),
|
||||
scheduled_end_time: new Date('2024-01-18 21:00:00'),
|
||||
status: 'in_transit',
|
||||
estimated_arrival_time: new Date('2024-01-18 21:30:00'),
|
||||
cattle_count: 45,
|
||||
special_requirements: '定时检查牛只状态'
|
||||
},
|
||||
{
|
||||
order_id: 5,
|
||||
driver_id: 2,
|
||||
vehicle_id: 2,
|
||||
start_location: '上海市闵行区基地',
|
||||
end_location: '南京市鼓楼区加工厂',
|
||||
scheduled_start_time: new Date('2024-01-19 05:00:00'),
|
||||
actual_start_time: new Date('2024-01-19 05:15:00'),
|
||||
scheduled_end_time: new Date('2024-01-19 19:00:00'),
|
||||
actual_end_time: new Date('2024-01-19 18:50:00'),
|
||||
status: 'completed',
|
||||
estimated_arrival_time: new Date('2024-01-19 19:30:00'),
|
||||
cattle_count: 70,
|
||||
special_requirements: '保持车厢清洁'
|
||||
}
|
||||
], { returning: true });
|
||||
|
||||
console.log('Test transports inserted:', transports.length);
|
||||
|
||||
// 插入测试运输跟踪数据
|
||||
const transportTracks = await TransportTrack.bulkCreate([
|
||||
{
|
||||
transport_id: 1,
|
||||
latitude: 39.9042,
|
||||
longitude: 116.4074,
|
||||
speed: 60.5,
|
||||
direction: 45.0,
|
||||
cattle_status: 'normal',
|
||||
temperature: 18.5,
|
||||
humidity: 65.0
|
||||
},
|
||||
{
|
||||
transport_id: 1,
|
||||
latitude: 39.1234,
|
||||
longitude: 117.5678,
|
||||
speed: 55.2,
|
||||
direction: 90.0,
|
||||
cattle_status: 'normal',
|
||||
temperature: 19.0,
|
||||
humidity: 63.5
|
||||
},
|
||||
{
|
||||
transport_id: 4,
|
||||
latitude: 39.7684,
|
||||
longitude: 116.3210,
|
||||
speed: 62.3,
|
||||
direction: 180.0,
|
||||
cattle_status: 'normal',
|
||||
temperature: 17.8,
|
||||
humidity: 67.2
|
||||
}
|
||||
], { returning: true });
|
||||
|
||||
console.log('Test transport tracks inserted:', transportTracks.length);
|
||||
|
||||
console.log('All test data inserted successfully');
|
||||
} catch (error) {
|
||||
console.error('Error inserting test data:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行脚本
|
||||
async function run() {
|
||||
await syncModels();
|
||||
await insertTestData();
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
run();
|
||||
}
|
||||
|
||||
module.exports = { Transport, Vehicle, TransportTrack, syncModels, insertTestData };
|
||||
52
backend/scripts/create_transport_tables.sql
Normal file
52
backend/scripts/create_transport_tables.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
-- 创建运输管理相关表的SQL脚本
|
||||
|
||||
-- 创建车辆表
|
||||
CREATE TABLE IF NOT EXISTS vehicles (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
license_plate VARCHAR(20) NOT NULL UNIQUE COMMENT '车牌号',
|
||||
vehicle_type VARCHAR(50) NOT NULL COMMENT '车辆类型',
|
||||
capacity INT NOT NULL COMMENT '载重能力(公斤)',
|
||||
driver_id BIGINT NOT NULL COMMENT '司机ID',
|
||||
status ENUM('available', 'in_use', 'maintenance', 'retired') DEFAULT 'available' COMMENT '车辆状态: available(可用), in_use(使用中), maintenance(维护中), retired(已退役)',
|
||||
last_maintenance_date DATETIME NULL COMMENT '上次维护日期',
|
||||
next_maintenance_date DATETIME NULL COMMENT '下次维护日期',
|
||||
insurance_expiry_date DATETIME NULL COMMENT '保险到期日期',
|
||||
registration_expiry_date DATETIME NULL COMMENT '注册到期日期',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='车辆管理表';
|
||||
|
||||
-- 创建运输表
|
||||
CREATE TABLE IF NOT EXISTS transports (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
order_id BIGINT NOT NULL COMMENT '关联订单ID',
|
||||
driver_id BIGINT NOT NULL COMMENT '司机ID',
|
||||
vehicle_id BIGINT NOT NULL COMMENT '车辆ID',
|
||||
start_location VARCHAR(255) NOT NULL COMMENT '起始地点',
|
||||
end_location VARCHAR(255) NOT NULL COMMENT '目的地',
|
||||
scheduled_start_time DATETIME NOT NULL COMMENT '计划开始时间',
|
||||
actual_start_time DATETIME NULL COMMENT '实际开始时间',
|
||||
scheduled_end_time DATETIME NOT NULL COMMENT '计划结束时间',
|
||||
actual_end_time DATETIME NULL COMMENT '实际结束时间',
|
||||
status ENUM('scheduled', 'in_transit', 'completed', 'cancelled') DEFAULT 'scheduled' COMMENT '运输状态: scheduled(已安排), in_transit(运输中), completed(已完成), cancelled(已取消)',
|
||||
estimated_arrival_time DATETIME NULL COMMENT '预计到达时间',
|
||||
cattle_count INT NOT NULL COMMENT '运输牛只数量',
|
||||
special_requirements TEXT NULL COMMENT '特殊要求',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运输管理表';
|
||||
|
||||
-- 创建运输跟踪表
|
||||
CREATE TABLE IF NOT EXISTS transport_tracks (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
transport_id BIGINT NOT NULL,
|
||||
latitude DECIMAL(10,8) NOT NULL,
|
||||
longitude DECIMAL(11,8) NOT NULL,
|
||||
speed DECIMAL(5,2) NULL,
|
||||
direction DECIMAL(5,2) NULL,
|
||||
cattle_status VARCHAR(20) NULL,
|
||||
temperature DECIMAL(5,2) NULL,
|
||||
humidity DECIMAL(5,2) NULL,
|
||||
video_url VARCHAR(255) NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运输跟踪表';
|
||||
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
|
||||
@@ -23,9 +23,10 @@
|
||||
},
|
||||
"address": {
|
||||
"@type": "PostalAddress",
|
||||
"streetAddress": "xxx街道xxx号",
|
||||
"addressLocality": "北京市",
|
||||
"postalCode": "100000",
|
||||
"streetAddress": "光谷软件园 F2栋",
|
||||
"addressLocality": "武汉市",
|
||||
"addressRegion": "湖北省",
|
||||
"postalCode": "430000",
|
||||
"addressCountry": "CN"
|
||||
}
|
||||
}
|
||||
@@ -175,7 +176,7 @@
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
</div>
|
||||
<h5 class="card-title">公司地址</h5>
|
||||
<p class="card-text">北京市朝阳区xxx街道xxx号<br>邮编:100000</p>
|
||||
<p class="card-text">武汉市东湖高新区光谷软件园 F2栋<br>邮编:430000</p>
|
||||
<a href="#map" class="btn btn-outline-primary btn-sm">查看地图</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -189,8 +190,8 @@
|
||||
<i class="fas fa-phone-alt"></i>
|
||||
</div>
|
||||
<h5 class="card-title">联系电话</h5>
|
||||
<p class="card-text">客服热线:400-xxx-xxxx<br>技术支持:010-xxxx-xxxx<br>商务合作:010-xxxx-xxxx</p>
|
||||
<a href="tel:400xxx xxxx" class="btn btn-outline-success btn-sm">立即拨打</a>
|
||||
<p class="card-text">客服热线:19971988959<br>技术支持:19971988959<br>商务合作:19971988959</p>
|
||||
<a href="tel:19971988959" class="btn btn-outline-success btn-sm">立即拨打</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -203,8 +204,8 @@
|
||||
<i class="fas fa-envelope"></i>
|
||||
</div>
|
||||
<h5 class="card-title">电子邮箱</h5>
|
||||
<p class="card-text">商务咨询:info@example.com<br>技术支持:support@example.com<br>媒体合作:media@example.com</p>
|
||||
<a href="mailto:info@example.com" class="btn btn-outline-info btn-sm">发送邮件</a>
|
||||
<p class="card-text">商务咨询:niumall@aiotagro.com<br>技术支持:niumall@aiotagro.com<br>媒体合作:niumall@aiotagro.com</p>
|
||||
<a href="mailto:niumall@aiotagro.com" class="btn btn-outline-info btn-sm">发送邮件</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -634,7 +635,7 @@
|
||||
<div class="card-body">
|
||||
<h5 class="card-title mb-4">公司位置</h5>
|
||||
<div class="ratio ratio-16x9">
|
||||
<iframe src="https://map.baidu.com/" title="公司位置" loading="lazy"></iframe>
|
||||
<iframe src="https://map.baidu.com/search/%E6%AD%A6%E6%B1%89%E5%B8%82%E4%B8%9C%E6%B9%96%E9%AB%98%E6%96%B0%E5%8C%BA%E5%85%89%E8%B0%B7%E8%BD%AF%E4%BB%B6%E5%9B%ADF2%E6%A0%8B/@114.411345,30.509844,12z?querytype=s&da_src=shareurl&wd=%E6%AD%A6%E6%B1%89%E5%B8%82%E4%B8%9C%E6%B9%96%E9%AB%98%E6%96%B0%E5%8C%BA%E5%85%89%E8%B0%B7%E8%BD%AF%E4%BB%B6%E5%9B%ADF2%E6%A0%8B&c=218&src=0&pn=0&sug=1&l=13&b=(11440175.899999999,3049683.0999999996;11442224.099999998,3052136.9000000004)&from=webmap&biz_forward=%7B%22scaler%22:1,%22styles%22:%22pl%22%7D&device_ratio=1" title="公司位置" loading="lazy"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -646,15 +647,15 @@
|
||||
<h5 class="card-title mb-4">交通信息</h5>
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary"><i class="fas fa-subway me-2"></i>地铁</h6>
|
||||
<p class="mb-0">地铁10号线,xxx站下车,A出口步行500米</p>
|
||||
<p class="mb-0">地铁2号线,光谷软件园站下车,C出口步行约800米</p>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary"><i class="fas fa-bus me-2"></i>公交</h6>
|
||||
<p class="mb-0">xxx路、xxx路、xxx路公交,xxx站下车</p>
|
||||
<p class="mb-0">756路、789路、913路公交,光谷软件园站下车</p>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary"><i class="fas fa-car me-2"></i>自驾</h6>
|
||||
<p class="mb-0">导航至北京市朝阳区xxx街道xxx号,附近有停车场</p>
|
||||
<p class="mb-0">导航至武汉市东湖高新区光谷软件园 F2栋,附近有停车场</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="text-primary"><i class="fas fa-clock me-2"></i>工作时间</h6>
|
||||
|
||||
@@ -2477,6 +2477,25 @@ img.lazy.loaded {
|
||||
top: 100vh;
|
||||
}
|
||||
|
||||
/* 页脚样式 */
|
||||
.footer {
|
||||
background-color: #000000; /* 黑色背景 */
|
||||
color: #ffffff; /* 白色字体 */
|
||||
padding: 2rem 0;
|
||||
}
|
||||
|
||||
.footer-title {
|
||||
color: #ffffff; /* 白色字体 */
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #ffffff; /* 白色字体 */
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
color: #f8f9fa; /* 浅灰色字体 */
|
||||
}
|
||||
|
||||
/* 新增分隔线样式 */
|
||||
.divider {
|
||||
position: relative;
|
||||
|
||||
Reference in New Issue
Block a user