[toc]
Overall Architecture: I tried to use the idea of MVC, the data structure is stored in the Model, the display system is stored in the View, and all the information communicated with the database is stored in the Controller.
Validity of order: In each order, status = 1 means the order is valid, status = 0 means the order is invalid (may be expired or cancelled), canceling the order means With set status = 0;
ID assignment: The assignment of customer and stuff id is: id <10000 is the stuff id, id> 10000 is the customer id.
Order management process: There is a daemon Book.bookd()
which is used to monitor the status of the room, check whether the room is occupied or expired, and whether the food order is valid.
After the user enters the system, choose identity is a stuff or a customer, and you can choose to log in or sign up.
The employees' functions are:
- According to the type of room to find the status of the room (is there a check-in, or a vacancy).
- Check the room status according to the room ID,
- Check all the rooms that have been checked in now,
- View all rooms that are now empty,
- View all scheduled food,
- Check all the reserved rooms,
- View all existing food.
The customer's functions are:
- Book a room according to the room type,
- Book a room according to the room ID,
- Order food within 3 days from today,
- Modify private information,
- Cancel a room that has not been checked in,
- Cancel the food that has not arrived,
- View your room order information,
- View your own food order information,
Select the corresponding serial number for the corresponding function according to the system prompt. It should be noted that when ordering food, you need to enter the name of the dish instead of the serial number.
There are 6 tables in total, namely:
-
stuff: stuff information form
- id:
- name
- password
- telenumber
- UPDATED_TIME: the time when the stuff registered
-
guest: customer information table
- id
- name
- real name
- password
- telenumber
- passportId
- UPDATED_TIME: the time when the customer registered
-
room: Room information table
- id: room id, the last two indicate the room type, the first two indicate the room floor
- type: Room type
- status: The current status of this room.
-
food: Food information form
- id: food id
- name: food name
- food_time: is a collection, from 1 to 7, representing the day of the week
- chef: chef name
-
book_room: room order
- id: order id
- room_id: room id
- guest_id: guest id
- start_time: the start time of the room
- duration: the duration of the room
- status: indicates the status of this order, 0 indicates that it has expired, 1 indicates that it is in progress.
- order_time: current time.
-
book_food: Food order
- id: order id
- food_name: food name
- guest_id: guest id
- food_time: Food supply time
- status: indicates the status of this order, 0 indicates that it has expired, 1 indicates that it is in progress.
- order_time: current time.
Guest books room / food will generate raw information in book_room / book_food. Stuff can check book_room / book_food to know every room / food information.
Initial stuff account:
username
: "init_stuff",
password
: "init_stuff".
Initial customer account:
username
: "init_guest",
password
: "init_guest".
Fill in the userName
, passWord
, DataBaseURL
of the local database in Controller.ENV
, the system will automatically initialize the database.
Main function is in the /Model/Main.java