Tải bản đầy đủ (.pdf) (231 trang)

detailed design document hcr hola cuisine restaurant

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.93 MB, 231 trang )

<span class="text_page_counter">Trang 1</span><div class="page_container" data-page="1">

<b>MINISTRY OF EDUCATION ANDTRAINING</b>

<b>FPT UNIVERSITYDETAILED DESIGN DOCUMENT</b>

<b>HCR- Hola Cuisine Restaurant</b>

Group Member

HE163299- Vũ Trường VũHE163051 - Lê Nam Tuấn

HS160723 - Kim Thị Hồng QuyênHE163515 - Nguyễn Đình MạnhHE161926 - Chu Hữu Long

Ext. Supervisor

Hanoi, 10/2023

</div><span class="text_page_counter">Trang 6</span><div class="page_container" data-page="6">

<b>1DETAILED DESIGN1.1 Common Design</b>

<b>1.1.1UC01 - Login1.1.2Screen Design</b>

<b>Figure 1.1.1: Login page</b>

# Object/ControlName

1 Username <input>Username </input> Y N/A Account’s username2 Password <input>Password </input> Y N/A Account’s password3 Login <button>Login </button> N/A N/A Confirm login4 N/A <a href="/service/security">I

forgot my password. Clickhere to start</a>

N/A N/A This hyperlink links toForgot password screen5 LoginEmail <button>Login with email

</button> <sup>N/A</sup> <sup>N/A</sup> <sup>Confirm login with email</sup>6 Register <a href="/register">Register

new account</a> <sup>N/A</sup> <sup>N/A</sup> <sup>This hyperlink links to</sup>register screen

</div><span class="text_page_counter">Trang 7</span><div class="page_container" data-page="7">

7 Home <a href="/home">Home</a> N/A N/A This hyperlink links tohome page screen

<b>Table 1.1.1: Login Description</b>

<b>1.1.2.1Class Diagram</b>

<b>1.1.2.2Class Description</b>

1.1.2.2.1 JwtAuthenticationController

<b>Description</b> Responsible for controlling the way that a user interacts with the login page

<b>Base Class</b> N/A

<b>Constructor</b> N/A

<b>Prototype</b> N/A

</div><span class="text_page_counter">Trang 8</span><div class="page_container" data-page="8">

<b>Source File</b> /project/src/main/java/com/hcr/swd392g3/project/jwt/jwtAuthenticationController.java

nManager <sup>Deals with identifying the user</sup>

jwtTokenUtil JwtTokenUtil <sup>Responsible for performing JWT operations</sup>like creation and validation

userDetailsService <sup>JwtUserDetail</sup>sService

Deals with managing and handlingoperations related to user in spring securitypersonConverter <sup>PersonConver</sup>

name: Stringpassword:String

Using to receive the user’saccount by logging

sendEmail email: String <sup>RespondEntity<</sup>?>

using to send email to getthe password

</div><span class="text_page_counter">Trang 9</span><div class="page_container" data-page="9">

Using to set role andreceive the user’s accountby username

1.1.2.2.3 PersonRepository

<b>ClassPersonRepository</b>

</div><span class="text_page_counter">Trang 10</span><div class="page_container" data-page="10">

<b>Description</b> Crucial component of the Person’s data access or persistence layer in a softwareapplication

<b>Base Class</b> N/A

Using to find the user’saccount by username andpassword

findByEmail Email: String Person <sup>Using to find the user’s</sup>account by email

Store or update an personobject in a data store usingnormal methodfindByUserName <sup>username:</sup>

Using to find the user’saccount by username1.1.2.2.4 JwtTokenUtil

<b>Description</b> Responsible for performing JWT operations like creation and validation

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 11</span><div class="page_container" data-page="11">

Define claims of the token,like Issuer, Expiration,Subject, and the ID

1.1.2.2.5 Person

<b>Description</b> Define attributes for Person entity and set/get method for these attributes

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 12</span><div class="page_container" data-page="12">

PersonID int Id of user

Status boolean User’s status (ban or publish)

status(ban or publish)

</div><span class="text_page_counter">Trang 13</span><div class="page_container" data-page="13">

getUsername() N/A String <sup>Using to get person’s</sup>username

<b>1.1.2.3Sequence Diagram</b>

</div><span class="text_page_counter">Trang 14</span><div class="page_container" data-page="14">

<b>1.1.1UC02 - Register1.1.1.1Screen Design</b>

<b>Figure 1.1.2: Register page</b>

3 Email <input>Email </input> Y N/A Account’s email4 Address <input>Address </input> N/A Account’s address

number6 Password <input>Password </input> Y N/A Account’s password7 Username <input>Re-Password

8 Create <button>Create account

href="/service/login">Already have an account?Login</a>

N/A N/A This hyperlink links tologin screen

</div><span class="text_page_counter">Trang 15</span><div class="page_container" data-page="15">

<b>Description</b> Responsible for controlling the way that a user interacts with the login page

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 16</span><div class="page_container" data-page="16">

Crucial component of the Person’s dataaccess or persistence layer in a softwareapplication

Using to register newaccount into database

userForgotPassword email: String N/A

Using to get the user’spassword back to theuser

1.1.2.3.2 PersonServiceImpl

<b>Description</b> Deals with managing and handling operations related to Person

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 17</span><div class="page_container" data-page="17">

personRepo <sup>PersonReposi</sup>tory

Crucial component of the Person’s dataaccess or persistence layer in a softwareapplication

Using to register newaccount into databaseforgotPassword email: String N/A <sup>Using to get the user’s</sup>

password back to the user1.1.2.3.3 PersonRepository

Using to find the user’saccount by username andpassword

</div><span class="text_page_counter">Trang 18</span><div class="page_container" data-page="18">

findByEmail Email: String Person <sup>Using to find the user’s</sup>account by email

Store or update an personobject in a data store usingnormal methodfindByUserName <sup>username:</sup>

<b>Description</b> Define attributes for Person entity and set/get method for these attributes

<b>Base Class</b> N/A

Status boolean User’s status (ban or publish)

</div><span class="text_page_counter">Trang 19</span><div class="page_container" data-page="19">

Username String User’s username

number

</div><span class="text_page_counter">Trang 20</span><div class="page_container" data-page="20">

<b>Base Class</b> N/A

Status boolean User’s status (ban or publish)

<b>Methods</b>

</div><span class="text_page_counter">Trang 131</span><div class="page_container" data-page="131">

getEmployeeID int <sup>Using to get employee’s</sup>ID of a instancesetEmployeeID employeeID: int <sup>Using to set employee’s</sup>

of a instance

of a instancesetDepartment department : string <sup>Using to set department</sup>

of a instance

<b>1.14.3.6 Person</b>

<b>Description</b> Define attributes for Person entity and set/get method for these attributes

<b>Base Class</b> N/A

Person(), Person(PersonID: int, FirstName: string, LastName: string, Email:string, PhoneNumber: string, Address: string, Status:boolean, Username:string, Password: string,Gender:int)

<b>Prototype</b> N/A

<b>Source File</b> /project/src/main/java/com/hcr/swd392g3/project/entity/Person.java

<b>Namespace</b> entity

</div><span class="text_page_counter">Trang 132</span><div class="page_container" data-page="132">

Status boolean User’s status (ban or publish)

ID of a instance

first name of a instance

last name of a instance

</div><span class="text_page_counter">Trang 133</span><div class="page_container" data-page="133">

getRole() int <sup>Using to get person’s</sup>role

</div><span class="text_page_counter">Trang 134</span><div class="page_container" data-page="134">

<b>1.15 UC17 - Add Employees</b>

2 Phone <input>Phone</input> Y 20 <sup>Enter Employee Phone</sup><sub>number</sub>3 Date Of birth <sup><input>Date Of</sup>

</div><span class="text_page_counter">Trang 135</span><div class="page_container" data-page="135">

<b>1.15.2 Class Diagram</b>

<b>1.15.3 Class Description1.15.3.1 ManagerController</b>

<b>Description</b> Define attributes and methods for ManagerController

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 136</span><div class="page_container" data-page="136">

addEmployee(Employee emp) Employee int

searchByName(string name) string List<> <sup>get all emp by</sup>name

<b>1.15.3.2 ManagerServiceImpl</b>

<b>Description</b> Define attributes and methods for ManagerServiceImpl

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 137</span><div class="page_container" data-page="137">

updateEmployee <sup>emp:EmployeeDT</sup>

get listEmployee byname

getEmployeeByName name:string <sup>List<Emplo</sup>yee>

get Allemployeehave samename as input1.15.3.3

<b>1.15.3.4 ManagerRepository</b>

<b>Description</b> Define attributes and methods for ManagerRepository

<b>Base Class</b> JpaRepository<Employee, UUID>

</div><span class="text_page_counter">Trang 138</span><div class="page_container" data-page="138">

getByID <sup>EmployeeI</sup>

get Employee byEmployeeID

<b>1.15.3.5 Employee</b>

<b>Class</b> Employee

<b>Description</b> Define attributes for Employee entity and set/get method for these attributes

<b>Base Class</b> Person

<b>Constructor</b> Employee(), Employee(EmployeeID : int, Contract: string, HiredDate: date,Department: string)

<b>Prototype</b> N/A

<b>Source File</b> \project\src\main\java\com\hcr\swd392g3\project\entity\Employee.java

<b>Namespace</b> entity

Using to getemployee’s ID of ainstance

setEmployeeID employeeID: int

Using to setemployee’s ID of ainstance

</div><span class="text_page_counter">Trang 139</span><div class="page_container" data-page="139">

getContract string <sup>Using to get contract</sup>of a instancesetContract contract: string <sup>Using to set contract of</sup>

a instance

of a instancesetHiredDate hiredDate: date <sup>Using to set hired date</sup>

of a instance

Using to getdepartment of ainstance

setDepartment department : string

Using to setdepartment of ainstance

<b>1.15.3.6 EmployeeDTO</b>

<b>Class</b> EmployeeDTO

<b>Description</b> Define attributes for EmployeeDTO set/get method for these attributes

<b>Base Class</b> Person

<b>Constructor</b> EmployeeDTO(), EmployeeDTO(Employee)

<b>Prototype</b> N/A

<b>Source File</b> \project\src\main\java\com\hcr\swd392g3\project\dto\EmployeeDTO.java

<b>Namespace</b> dto

<b>Attributes</b>

</div><span class="text_page_counter">Trang 140</span><div class="page_container" data-page="140">

HiredDate Date hired date of employee

Using to getemployee’s ID of ainstance

setEmployeeID employeeID: int

Using to setemployee’s ID of ainstance

of a instancesetContract contract: string <sup>Using to set contract of</sup>

a instance

of a instancesetHiredDate hiredDate: date <sup>Using to set hired date</sup>

of a instance

Using to getdepartment of ainstance

setDepartment department : string

Using to setdepartment of ainstance

<b>1.15.3.7 Person</b>

<b>Description</b> Define attributes for Person entity and set/get method for these attributes

</div><span class="text_page_counter">Trang 141</span><div class="page_container" data-page="141">

<b>Base Class</b> N/A

Person(), Person(PersonID: int, FirstName: string, LastName: string, Email:string, PhoneNumber: string, Address: string, Status:boolean, Username:string, Password: string,Gender:int)

<b>Prototype</b> N/A

<b>Source File</b> /project/src/main/java/com/hcr/swd392g3/project/entity/Person.java

<b>Namespace</b> entity

Status boolean User’s status (ban or publish)

ID of a instance

first name of a instance

</div><span class="text_page_counter">Trang 142</span><div class="page_container" data-page="142">

getLastName() String <sup>Using to get person’s</sup>last name of a instance

</div><span class="text_page_counter">Trang 144</span><div class="page_container" data-page="144">

2 Last Name <input>LastName</input> Y 50 <sup>Enter Employee last</sup><sub>Name</sub>3 Phone <input>Phone</input> Y 20 <sup>Enter Employee</sup><sub>Phone number</sub>4 Address <input>Address</input> Y 10 <sup>Enter Employee</sup><sub>Address</sub>

6 Gender <sup><RadioButton>Male</Radio</sup><sub>Button></sub> Y 100 Choose Gender7 Salary <input>Salary</input> Y 100 Enter Salary8 Department <input>Department</input> Y 100 Enter Department9 Update <button>Update</button> N/A N/A Update Employee10 Cancel <button>Cancel</button> N/A N/A Cancel Update

<b>1.16.2 Class Diagram</b>

<b>1.16.3 Class Description1.16.3.1 ManagerController</b>

<b>Description</b> Define attributes and methods for ManagerController

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 145</span><div class="page_container" data-page="145">

employeeService <sup>Employee</sup><sub>Service</sub> Employee Service

addEmployee(Employee emp) Employee int

searchByName(string name) string List<> <sup>get all emp by</sup>name

<b>1.16.3.2 ManagerServiceImpl</b>

<b>Description</b> Define attributes and methods for ManagerServiceImpl

<b>Base Class</b> N/A

<b>Constructor</b> N/a

<b>Prototype</b> N/a

</div><span class="text_page_counter">Trang 146</span><div class="page_container" data-page="146">

<b>Source File</b> \project\src\main\java\com\hcr\swd392g3\project\service\IService\ManagerServiceImpl.java

getEmployeeByName name:string <sup>List<Emplo</sup>yee>

get Allemployee havesame name asinput

<b>1.16.3.3 ManagerRepository</b>

<b>Description</b> Define attributes and methods for ManagerRepository

<b>Base Class</b> JpaRepository<Employee, UUID>

<b>Constructor</b> N/A

</div><span class="text_page_counter">Trang 147</span><div class="page_container" data-page="147">

<b>Prototype</b> N/a

<b>Source File</b> \project\src\main\java\com\hcr\swd392g3\project\repository\ManagerRepository.java

<b>Namespace</b> repository

<b>1.16.3.4 Employee</b>

<b>Class</b> Employee

<b>Description</b> Define attributes for Employee entity and set/get method for these attributes

<b>Base Class</b> Person

<b>Constructor</b> Employee(), Employee(EmployeeID : int, Contract: string, HiredDate: date,Department: string)

<b>Prototype</b> N/A

<b>Source File</b> \project\src\main\java\com\hcr\swd392g3\project\entity\Employee.java

<b>Namespace</b> entity

<b>Attributes</b>

</div><span class="text_page_counter">Trang 148</span><div class="page_container" data-page="148">

HiredDate Date hired date of employee

ID of a instancesetEmployeeID employeeID: int N/A Using to set employee’s

of a instance

<b>1.16.3.5 EmployeeDTO</b>

<b>Class</b> EmployeeDTO

<b>Description</b> Define attributes for EmployeeDTO set/get method for these attributes

<b>Base Class</b> Person

<b>Constructor</b> EmployeeDTO(), EmployeeDTO(Employee)

<b>Prototype</b> N/A

</div><span class="text_page_counter">Trang 149</span><div class="page_container" data-page="149">

<b>Source File</b> \project\src\main\java\com\hcr\swd392g3\project\dto\EmployeeDTO.java

<b>Namespace</b> dto

ID of a instancesetEmployeeID employeeID: int N/A Using to set employee’s

of a instance

</div><span class="text_page_counter">Trang 150</span><div class="page_container" data-page="150">

<b>1.16.3.6 Person</b>

<b>Description</b> Define attributes for Person entity and set/get method for these attributes

<b>Base Class</b> N/A

Person(), Person(PersonID: int, FirstName: string, LastName: string, Email:string, PhoneNumber: string, Address: string, Status:boolean, Username: string,Password: string,Gender:int)

<b>Prototype</b> N/A

<b>Source File</b> /project/src/main/java/com/hcr/swd392g3/project/entity/Person.java

<b>Namespace</b> entity

Status boolean User’s status (ban or publish)

</div><span class="text_page_counter">Trang 151</span><div class="page_container" data-page="151">

getPersonID() N/A int <sup>Using to get person’s ID</sup>of a instance

first name of a instance

</div><span class="text_page_counter">Trang 161</span><div class="page_container" data-page="161">

getPersonID() int <sup>Using to get person’s</sup>ID of a instance

first name of a instance

last name of a instance

</div><span class="text_page_counter">Trang 162</span><div class="page_container" data-page="162">

<b>1.17.4 Sequence Diagram</b>

<b>1.18 UC20 - View Cart</b>

<b>1.18.1 Screen Design</b>

</div><span class="text_page_counter">Trang 163</span><div class="page_container" data-page="163">

<b>Figure 1.18.1: Cart page</b>

<b>#<sup>Object/Contr</sup><sub>ol Name</sub>TypeRequiredLengthDescription</b>

1 nameOfRestaurant

<h1>Hola CuisineRestaurant</h1>

name ofRestaurant2 account <sup><a href =</sup><sub>“#”>profile</a></sub> profile of user3 IconCart <a href =”#”></a> <sup>redirect</sup><sub>shopping cart</sub>

<b>Table 1.18.1: Cart page’s elements description</b>

<b>1.18.2 Class Diagram</b>

</div><span class="text_page_counter">Trang 164</span><div class="page_container" data-page="164">

<b>1.18.3 Class Description1.18.3.1Cart Controller</b>

<b>Description</b> Handle request to CRUD data concern with Receipt in restaurant

<b>Base Class</b> N/A

Load cart detailwith their info torespond FE

</div><span class="text_page_counter">Trang 165</span><div class="page_container" data-page="165">

<b>Description</b> Handle request to CRUD data concern with Receipt in restaurant

<b>Base Class</b> N/A

<b>Constructor</b> N/A

<b>Prototype</b> N/A

add product toCart with it’s infoID

change quantity ofproduct in cart

delete product incart

<b>1.18.3.2 CartServiceImpl</b>

<b>Description</b> Responsible for controlling the way that a user interacts with service

</div><span class="text_page_counter">Trang 166</span><div class="page_container" data-page="166">

<b>Base Class</b> N/A

add product to Cart withit’s info ID

+UpdateCart ProductIDCustomerIDQuantityCart

change quantity ofproduct in cart

delete product in cart

</div><span class="text_page_counter">Trang 167</span><div class="page_container" data-page="167">

<b>1.18.4 Sequence Diagram</b>

</div><span class="text_page_counter">Trang 168</span><div class="page_container" data-page="168">

<b>1.19 UC21 - Add To Cart</b>

<b>1.19.1 Screen Design</b>

<b>Figure 1.19.1: Add to cart page</b>

2 productName <h3>product name </h3> name of product

4 description <p>description<p>

6 quantity <input>Quantity </input> <sup>number of</sup><sub>product</sub>7 AddToCard <sup><a href = “”>Add to</sup><sub>cart</a></sub> <sup>Confirm add to</sup><sub>cart</sub>

<b>Table 1.19.1: Add to cart page’s elements description</b>

</div><span class="text_page_counter">Trang 169</span><div class="page_container" data-page="169">

<b>1.19.2 Class Diagram</b>

<b>1.19.3 Class Description1.19.3.1 CartController</b>

<b>Description</b> Handle request to CRUD data concern with Receipt in restaurant

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 170</span><div class="page_container" data-page="170">

cartServiceImpl CartServiceImpl

This class provide for system senddata of the request to method ofCartServiceImpl in order to handlelogical process

Load cart detailwith their info torespond FE

add product to Cartwith it’s info ID

change quantity ofproduct in cart

delete product incart

</div><span class="text_page_counter">Trang 171</span><div class="page_container" data-page="171">

<b>1.19.3.2 CartServiceImpl</b>

<b>Description</b> Responsible for controlling the way that a user interacts with service

<b>Base Class</b> N/A

add product to Cart withit’s info ID

change quantity ofproduct in cart

</div><span class="text_page_counter">Trang 172</span><div class="page_container" data-page="172">

<b>1.19.4 Sequence Diagram</b>

Entity <sup>delete product in cart</sup>

</div><span class="text_page_counter">Trang 173</span><div class="page_container" data-page="173">

<b>1.20 UC22 - Update Cart</b>

<b>1.20.1 Screen Design</b>

<b>Figure 1.20.1: Cart page</b>

1 Cuisine <h2>Shopping cart</h2> cuisine cart title2 image <sup><img src =</sup><sub>“#”>Image</img></sub> Image of product3 productName <h3>product name </h3> name of product4 <sup>productDescriptio</sup><sub>n</sub> <sup><p>product description</sup><sub></p></sub>

5 <sup>decrease number</sup><sub>of product</sub> <sup><a name=”increase”</sup><sub>href=”#”>-</a></sub>

6 quantity <input>Quantity </input> number of product7 <sup>increase number</sup><sub>of product</sub> <sup><a name=”increase”</sup><sub>href=”#”>+</a></sub>

9 delete <sup><a href = “”>Delete</sup><sub>product </a></sub> delete product in cart

</div><span class="text_page_counter">Trang 174</span><div class="page_container" data-page="174">

13 Total Price <div>Total price</div> <sup>total price include</sup><sub>shipping</sub>

<b>Table 1.20.1: Cart page’s elements description</b>

<b>1.20.2 Class Diagram</b>

<b>1.20.3 Class Description1.20.3.1 CartController</b>

<b>Description</b> Handle request to CRUD data concern with Receipt in restaurant

</div><span class="text_page_counter">Trang 175</span><div class="page_container" data-page="175">

<b>Base Class</b> N/A

Load cart detailwith their info torespond FE

add product toCart with it’s infoID

</div><span class="text_page_counter">Trang 176</span><div class="page_container" data-page="176">

change quantity ofproduct in cart

delete product incart

<b>1.20.3.2 CartServiceImpl</b>

<b>Description</b> Responsible for controlling the way that a user interacts with service

<b>Base Class</b> N/A

</div><span class="text_page_counter">Trang 177</span><div class="page_container" data-page="177">

+ViewCart CustomerID ResponseEntity

Load a cart with theirinfo to respond FE

add product to Cart withit’s info ID

+UpdateCart ProductIDCustomerIDQuantityCart

change quantity ofproduct in cart

delete product in cart

</div><span class="text_page_counter">Trang 179</span><div class="page_container" data-page="179">

1 Cuisine <h2>Shopping cart</h2> cuisine cart title2 image <sup><img src =</sup><sub>“#”>Image</img></sub> Image of product3 productName <h3>product name </h3> name of product4 <sup>productDescriptio</sup><sub>n</sub> <sup><p>product description</sup><sub></p></sub>

5 <sup>decrease number</sup><sub>of product</sub> <sup><a name=”increase”</sup><sub>href=”#”>-</a></sub>

6 quantity <input>Quantity </input> number of product7 <sup>increase number</sup><sub>of product</sub> <sup><a name=”increase”</sup><sub>href=”#”>+</a></sub>

9 delete <sup><a href = “”>Delete</sup><sub>product </a></sub> delete product in cart

13 Total Price <div>Total price</div> <sup>total price include</sup><sub>shipping</sub>

<b>Table 1.21.1: Cart page’s elements description</b>

</div>

×