@author 黄云明
Part1. Requirements analysis 2 System Overview 2 Instructions 2 Tasks 2 Requirements 2 Flow chart 3 Part2. System design 4 Basic Design 4 Functional Analysis 4 Detailed Design 5 Database table 5 API Design 6 Part3. Test Case 9 Available accounts 9 Part4. Appendix 10
The car rental system provides users with vehicle rental services, and users can quickly reserve vehicles and return vehicles through the platform. Tasks
- Car management services: including car entry, management, query
- Car booking service: including car reservations Requirements
- Car management
- Query car list
- Car booking order
- Add new booking order
- Finish booking order
- Get bill of booking order
- User management
- Login
- Logout Flow chart
Database: mysql5.7 Language: java、vue.js Proxy: nginx Deployment: docker Others: springboot、mybatis、pagehelper、shiro、.etc
- Car management The car needs to contain id, name, brand, license plate number, daily price, entry time, current status (available or under maintenance),and the brand should be separate from the car, contain id and name; Car management contains functions such as adding new cars (only api now), updating cars (only api now), and querying car lists;
- Car booking order Add new booking order
- To add a car booking order, you need to provide order number, car id, user id, expected start date, expected end date, actual end date, and current order status.
- When add a car booking order, show check if the vehicle is available on the expected date range. Finish booking order 1. Check if the expected end date is less than the current date, if so, take the current date, otherwise take the expected date as the actual end date Get bill of booking order 1. Calculate car rental days multiplied by unit price
- User management
User management need user info which contains id, name, phone, password, role, status; and token info to maintains login status, contains token, expire time, update time;
Login
- Login with user id and password, and check legality, after login success redirect to the orders page Logout 1.Logout
CREATE TABLE `car` (
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) NOT NULL COMMENT '车名',
`brand_id` int(10) NOT NULL COMMENT '品牌id',
`price` decimal(10,2) NOT NULL COMMENT '单日价格',
`plate_number` varchar(255) NOT NULL COMMENT '车牌',
`created_at` timestamp NULL DEFAULT NULL,
`status` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_brand_id` (`brand_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
CREATE TABLE `car_booking_order` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`car_id` int(10) NOT NULL,
`user_id` int(10) NOT NULL,
`start_time` date DEFAULT NULL,
`estimated_end_time` date DEFAULT NULL,
`actual_end_time` date DEFAULT NULL,
`status` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_car_id` (`car_id`) USING BTREE,
KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='car booking order';
CREATE TABLE `car_brand` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
CREATE TABLE `user` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`phone_number` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`role` tinyint(1) NOT NULL DEFAULT '0' COMMENT '角色(0-普通用户 1-管理员 2-超级管理)',
`status` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10011 DEFAULT CHARSET=utf8mb4;
CREATE TABLE `user_token` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(10) DEFAULT NULL,
`token` varchar(255) DEFAULT NULL,
`expire_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_user_id` (`user_id`) USING BTREE,
KEY `idx_token` (`token`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
Available in swagger: http://113.31.117.118:8848/car-booking/swagger-ui.html
Available accounts ID PASSWORD 10001 123456 10002 123456 10003 123456 10004 123456 10005 123456 10006 123456 10007 123456 10008 123456 10009 123456 10010 123456
System web address : http://carbooking.riding4.fun or https:// carbooking.riding4.fun Swgger api address: http://113.31.117.118:8848/car-booking/swagger-ui.html
Time is limited, there are deficiencies in design and implementation, please correct me.