Notifications:- Order Notifications: Send notifications to users to confirm orders, provideupdates on order status, and notify them of delivery.... It’ll help us understand how online pl
Trang 1VIETNAM NATIONAL UNIVERSITY – HCM
INTERNATIONAL UNIVERSITY
SEMESTER 2 (2023-2024)
FINAL PROJECTCourse: Principles of Database Management Project name: Food Delivery Application
Date: 06/05/2024
Team members:
Nguyễn Đăng Khôi - ITCSIU22073 Phan Minh Ân - ITCSIU22006 Đoàn Phú Bình - ITCSIU22020 Nguyễn Huy Hoàng - ITCSIU21061
Trang 2TABLE OF CONTENTS
I - Introduction
1 Abstract
2 System overview
a User Management
b Menu Management:
c Order Management:
d Delivery Management:
e Restaurant Management:
f Feedback and Ratings:
g Notifications:
3 Goal
4 The Techniques & Tool Used
II - Project Planning
1 Project Timeline and Milestones
2 Roles & Responsibilities
3 Resource Allocation
4 Risk Assessment
III - Project Analysis
1 Requirement Analysis
a Description of Project Requirements
b User Stories
2 Approach Analysis
a Review Materials
b Research Analysis
3 System Analysis
a Database Design
b Database and Tables Creation
c Database Data Insertion
d Database Queries
4 Java Structure
a Project Structure
b Connection Implementation
c GUI & Buttons Design
IV Conclusion
Trang 3I - Introduction
1 Abstract
- The primary purpose of this application is to establish a connection betweenrestaurants and consumers Restaurant owners will have the capability toregister and showcase their food items along with their respective prices Userswill also have the ability to register, explore nearby restaurants, and place ordersfor food items from their preferred restaurants Once an order is placed, therestaurant will accept it and assign a delivery person to fulfill the order Theuser who placed the order will be able to view the location of the deliveryperson and the estimated time of arrival for their food Furthermore, the cart andpayment page will have a distinct design that remains consistent throughout theentire application
Trang 4- Modifiers: Handle optional add-ons or customizations for menu items (e.g.,toppings, sides).
- Delivery Addresses: Allow users to save multiple delivery addresses
- Delivery Partners: If working with third-party delivery services, storeinformation about delivery partners, their availability, and performance metrics
- Delivery Tracking: Implement features for users to track the status of theirdelivery in real-time along with dynamic ETA
f Feedback and Ratings:
- Customer Feedback: Enable users to leave reviews and ratings for orders andrestaurants
- Rating Aggregation: Calculate and display aggregate ratings for restaurantsbased on user feedback
g Notifications:
- Order Notifications: Send notifications to users to confirm orders, provideupdates on order status, and notify them of delivery
Trang 5- Promotional Notifications: Send promotional messages or discounts to usersvia email or push notifications.
3 Goal
- Using DBMS for a food delivery application will give us extensive experience
in this technology It’ll help us understand how online platforms use andinteract with databases
- Showcasing our knowledge of database management solutions while solving asignificant field of the modern economy
- Our developed DBMS-based solution would allow restaurants to save a lot oftime and resources; moreover, the user could see all the food information fromone menu and order it accordingly on a user-friendly interface
4 The Techniques & Tool Used
- Database: Microsoft SQL Server + SQL Server Management Studio 20
- Java: IntelliJ IDEA Community Edition 2023.2.2
Trang 6II - Project Planning
1 Project Timeline and Milestones
Planning Organizing and
selecting theproject topic
Research othersimilarapplications
All
Find learningoutcomes, goals AllAnalyze
approaches andmethodology forthe project
All
Findrequirements,tools
Design informations thatCollect
will be used forthe database
Design the ERdiagram
Khoi
Design relationalmodels
Khoi
Trang 7relationships,constraintscreationData insertion An, BinhData queries An, BinhInterface
developing
Hoang
Interface review All
2 Roles & Responsibilities
Phan Minh Ân Database Developer,
Trang 84 Risk Assessment
- Inefficiency of communication:
+ Mismatched use of communication tools
+ Failure to provide timely updates or feedback
+ Unfamiliar with the use of progress tracking platforms
- Technological Challenges (Data Management System): Limited experience orexposure to web development and project management
III - Project Analysis
1 Requirement Analysis
a Description of Project Requirements
- The project includes secure account login, password reset It will provide a list
of products, restaurants Users can find and order a product from there
b User Stories
- Customers:
+ Browse a list of products and choose a product that they want
+ Search for restaurants and view their detailed information (ratings,reviews, …) to pick the best decision
+ Add products to their cart
+ View the status of my order (confirmation, preparation, delivery, …) toknow when to receive the order
- Restaurants:
+ Receive orders from customers
+ Manage the menu, update status of each product
+ Communicate with delivery personnel
+ Access to customer ratings, reviews
Trang 9- Deliverer:
+ Receive the order and customer’s information
+ Have a map to find the best route to the customer’s location
+ Users: Who the users are, and what food cuisine they like
+ Application: The application must be family-friendly and easily usable bypeople from different generations
+ Product: Includes category
Trang 10Figure 1 ER diagram for the online food application
- Schema design using the SQL server:
+ Navigate to the “Database Diagrams” folder in the Food database.+ Right-click the folder and choose “New Database Diagram”
+ Add all the tables in the Food database
+ To create a relationship, click the PK of a table and hold, drag the mouse
to the FK of another table
Trang 11Figure 2 Schema design
- Our database has achieved the Boyce-Codd Normal Form (BCNF) because ofthe requirements:
+ First Normal Form (1NF): Each relation does not have any multivaluedtuples
+ Second Normal Form (2NF): Each relation is in 1NF and all non-keyattributes are functionally dependent on the primary key
+ Third Normal Form (3NF): Each relation is in 2NF and no transitivedependencies between non-key attributes exist
+ Boyce-Codd Normal Form (BCNF): Stronger than 3NF
b Database and Tables Creation
- From the ER diagram, this part will show how to create the database, schemasand tables using the Microsoft SQL Server Management Studio 20
Trang 12● Database Creation
- Open the Microsoft SQL Server Management Studio 20
- Choose “New Query”
- Create a database named “Food” using the syntax:
CREATE DATABASE Food
- Select the line, and click “Execute” A new database “Food” will be shown inthe Database folder after refreshing
Figure 3 Database structure
- Add a line to move to the database:
USE Food
● Schemas and Tables Creation
- Based on the ER diagram, we have a total of 6 entities:
Username varchar(50) NOT NULL,Email varchar(50) NOT NULL,Pass varchar(50) NOT NULL,Dob date NOT NULL,PhoneNo varchar(20) NOT NULL,Addr varchar(50) NOT NULL,Wallet int NULL,
Paymentid int NOT NULL FOREIGN KEY REFERENCES Payment(PaymentID)CREATE TABLE [Restaurant] RestaurantID int NOT NULL PRIMARY KEY,
RestaurantName varchar(50) NOT NULL,RestaurantAddr varchar(50) NOT NULL,ContactNumber varchar(20) NOT NULL,
Trang 13CREATE TABLE [Product] ProductID int NOT NULL PRIMARY KEY,
ProductName varchar(50) NOT NULL,Category varchar(50) NOT NULL,ProductDescription varchar(500) NOT NULL,Price int NOT NULL,
Restaurantid int NOT NULL FOREIGN KEY REFERENCES Restaurant(RestaurantID)CREATE TABLE [Deliverer] DelivererID int NOT NULL PRIMARY KEY,
DelivererName varchar(50) NOT NULL, DelivererPhone varchar(20) NOT NULL
Userid int NOT NULL FOREIGN KEY REFERENCES [User](UserID),Delivererid int NOT NULL FOREIGN KEY REFERENCES Deliverer(DelivererID),OrderDate date NOT NULL,
NumberProducts int NOT NULL,TotalPrice int NOT NULLCREATE TABLE [Payment] PaymentID int NOT NULL PRIMARY KEY,
PaymentName varchar(50) NOT NULL,PaymentType varchar(50) NOT NULLCREATE TABLE
OrderProduct Orderid INT NOT NULL FOREIGN KEY REFERENCES [Order](OrderID),
Productid INT NOT NULL FOREIGN KEY REFERENCES Product(ProductID)
- The User, Deliverer tables store the information of a customer, a deliverer inthe application
- The Restaurant table stores the information of restaurants that are available inthe application
- The Product table stores the information, price of food or drinks
- The Order table tracks the number of products chosen by the user
- The Payment table stores what payment method a user uses
c Database Data Insertion
- For the … tables, we have
Trang 14- For the … tables,
(1, 'Good Eats Cafe', '123 Main St, Cityville', '133-906-7290'),
(2, 'Tasty Bites Restaurant', '456 Oak Ave, Townsville', '907-614-3112'),
(3, 'Spicy Noodles Express', '789 Elm Rd, Village Town', '501-133-4173'),
(4, 'Pizza Palace', '321 Pine Blvd, Subnautica', '123-999-0281');
(2, 1, 'French Fries', 'Side Dish', 'Crispy golden fries served with ketchup', 50),
(3, 2, 'Margherita Pizza', 'Pizza', 'Classic pizza topped with tomato sauce, mozzarella, and basil', 150),
(4, 2, 'Pasta Carbonara', 'Pasta', 'Creamy pasta with bacon, egg, and Parmesan cheese', 120),
(5, 3, 'Chicken Curry', 'Main Course', 'Spicy chicken curry served with rice', 180), (6, 3, 'Spring Rolls', 'Appetizer', 'Crispy vegetable spring rolls served with dipping sauce', 80),
(7, 4, 'Chocolate Cake', 'Dessert', 'Rich and moist chocolate cake topped with chocolate ganache', 200),
(8, 4, 'Salad', 'Side Dish', 'Fresh mixed greens with cherry tomatoes and balsamic dressing', 90);
Trang 15(01, 'Credit Card', 'Online Banking'),
(02, 'MoMo', 'Online Banking'),
(03, 'Debit Card', 'Online Banking'),
(04, 'Cash', 'Directly');
d Database Queries
- Here are some queries and their functions that we have used for the project:
DROP DATABASE Commerce;
CREATE DATABASE Commerce;
CREATE TABLE table_name (
CREATE TABLE table_name (
column1 datatype NOT NULL ,
specify which column does not accept the null value when we insert a
Trang 16
);
value(row) in a table
CREATE TABLE table_name (
column1 datatype UNIQUE ,
The constraint PRIMARY KEY
suggests that entries should be neithernull nor duplicate corresponding to the specified column
CREATE TABLE Customer(
Customer_ID int NOT NULL ,
SELECT column1, column2,
FROM table_name
ORDER BY column1, column2,
ASC|DESC;
TheORDER BY keyword is used to
show the result in ascending or descending order By default, it is in ascending order
SELECT COUNT(Customer_ID) FROM
Customer GROUP BY Customer_ID; The GROUP BY keyword is used for
grouping the resultsSELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name =
table2.column_name;
The INNER JOIN keyword returns
all matching records from both the table
SELECT column1, column2,
The HAVING clause is similar to the
WHERE clause However, the HAVING clause is used to filter
Trang 17HAVING condition;
grouped rows instead of single rows These rows are grouped together by the GROUP BY clause, so, the
HAVING clause must always be
followed by the GROUP BY clauseUPDATE view_name
SET column1 = value1, column2 =
value2 , columnN = valueN
WHERE [condition];
The UPDATE statement makes use of locks on each row while modifying them in a table, and once the row is modified, the lock is releasedWhere [condition1] AND
[condition2];
The AND returns true or , if both its 1
operands evaluates to true We can use it to combine two conditions in the
WHERE clause of an SQL statement.
DELETE FROM table_name WHERE
[condition];
The DELETE Statement is used to delete the records from an existing table In order to filter the records to bedeleted (or, delete particular records),
we need to use the WHERE clause along with the DELETE statement
4 Java Structure
- For this part, we will use Intellij IDEA as an IDE to work on the application,
as this is one of the IDEs that all members in our team frequently use
a Project Structure
- To generate the structure of the project, we mainly use form file to define thedesign information of the application like the layout of buttons, menus, and textfields… and java file to contains the actual Java code that implements thefunctionality of the GUI elements
Trang 18b Connection Implementation
- Java code to connect to the SQL Server:
import com.microsoft.sqlserver.jdbc.SQLServerDataSource; import com.microsoft.sqlserver.jdbc.SQLServerException;
Trang 19import java.sql.SQLException;
public class TestConnection {
public static void main (String[] args) {
SQLServerDataSource ds = new SQLServerDataSource(); ds.setUser( "sa" );
try (Connection conn = ds.getConnection()) {
System.out.println("Connection successful!" ); System.out.println(conn.getCatalog());
} catch (SQLServerException throwables) {
Trang 20- In this phase, the users enter their account and password in order to gainaccess to the application
● Register Screen
Trang 21- If the users do not have an account available, they can register a new accountusing their Email and Phone number.
● User Screen
Trang 22- The user screen allows users to view and manage their personal information.
● Order Screen
Trang 23- This window allows you to enter the details of a product you want to add toyour order, including the type of deliverer and the total price
● Product Screen
Trang 24- In this window, we have more accurate information about the productsincluding names, quantities and prices we are about to buy.
● Deliverer Screen
Trang 25- This window displays the details of the delivery driver who will take the order,including their name and phone number for contact purposes.
Trang 26IV Conclusion
In conclusion, the development of a robust and scalable food deliveryapplication requires meticulous planning and execution across various technicaland operational facets By leveraging advanced database management systems,comprehensive menu and order management modules, secure userauthentication processes, and real-time delivery tracking, we can create aseamless and efficient experience for users, restaurant partners, and deliverypersonnel
The integration of analytics and reporting tools will enable continuousimprovement and adaptability in a dynamic market, while adherence to datasecurity and compliance standards will ensure the protection of userinformation As we move forward, the focus should remain on innovation, usersatisfaction, and operational excellence to sustain and grow the application’ssuccess in the competitive food delivery landscape
By prioritizing these elements, we not only meet current market demands butalso pave the way for future advancements and enhancements, ensuring ourfood delivery application remains at the forefront of the industry