1. Trang chủ
  2. » Luận Văn - Báo Cáo

spring store software design specification mentor quách luyl đa

92 0 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

Table Description01 Admin Stores information about administrators in the system.- Primary keys: adminID- Foreign keys: None02 User Stores information about registered users.- Primary key

Trang 1

SPRING_STORESoftware Design SpecificationMentor - Quách Luyl Đa

Trần Trọng Nguyễn - CE170134Hồng Bảo Bảo - CE170912Đoàn Quốc Kiệt – CE171400

–CanTho, January 2022 –

Trang 2

RECORD OF CHANGES

M, D

In chargeChange Description

*A - Added M - Modified D - Deleted

Trang 3

II Code Designs 11

1 Login for user 11

Trang 6

c Sequence diagram(s)

d Database queries 26 Show list product

a Class diagram b Class specification 69

c Sequence diagrams(s) d Database queries 27 Monthly Revenue Manager a Class diagram b Class Specification 71

C Sequence Diagram(s) d Database queries 28 Order Approval a Class diagram b Class Specification 74

Trang 8

I Overview1 Code Packages

etc with detailed functions that can interact directly with the database for data processing to which the Controller can load data for the user.

04 Controller Includes Servlets with a responsibility to process, transfer the datacollected by user on web page(view) to DAO and Model in the database to JSP pages.

05 DBContext This package helps connect database.

06 Ultis This package contains Helper class with functions for sending

Trang 9

2 Database Designa Database Schema

b Table Description

01 Admin Stores information about administrators in the system.- Primary keys: adminID

- Foreign keys: None

02 User Stores information about registered users.- Primary keys: userID

- Foreign keys: None

03 Staff Stores information about staff members.- Primary keys: staffID

- Foreign keys: None

04 Product Stores information about products available in the system.- Primary keys: productID

- Foreign keys: None

Trang 10

- Primary keys: commentID

- Foreign keys: productID (references Product), userID (references User)

06 Cart Stores information about user shopping carts.- Primary keys: cartID

- Foreign keys: userID (references User), productID (references Product)

07 Order Stores information about user orders.- Primary keys: orderID

- Foreign keys: userID (references User)

08 OrderDetail Stores detailed information about products in each order.- Primary keys: orderID, productID

- Foreign keys: orderID , productID

09 Size Stores information about product sizes.- Primary keys: productSize, productID- Foreign keys: productID

10 Import Stores information about product imports.- Primary keys: importID

- Foreign keys: staffID

Trang 11

II Code Designs1 Login for user

a Class Diagram

b Class SpecificationsLoginController

01 doPost() After the user presses the "login" button and submits the necessary information to log in, this function processes and forwards the request from the user First, it checks if the person logging in has the "user" role, and if so, it calls the login() function in UserDAO to verify the username and password against the stored data.

UserDAO

Trang 12

01 login() First, Establish a connection to the database.

Second, it sends the email address and password to select an account in the database If the account is returned, it displays successful login information or incorrect login information.

+ Input:

email(String), password(String): verified data.query(string): to select data from the database.+ Output: acc(Account) or null.

02 getUser() After login into the system successfully, save user session information.

01 User () We must add the data to an Account entity with each attribute by progressively supplying arguments to the constructor after loading the data to a result table so that it can be added to the list collection.+Input: userID(int), userEmail(String), userPassword(String), userName(String), userDOB(date), userPhone(String), userAddress(String).

+ Output: user (User)

DBContext

Trang 14

2 Login for staff

a Class Diagram

b Class SpecificationsLoginController

01 doPost() After the user presses the "login" button and submits the necessary information to log in, this function processes and forwards the request from the user First, it checks if the person logging in has the "staff" role, and if so, it calls the login() function in StaffDAO to

Trang 15

in the database If the account is returned, it displays successful login information or incorrect login information.

+ Input:

email(String), password(String): verified data.query(string): to select data from the database.+ Output: acc(Account) or null.

02 getStaff() After login into the system successfully, save user session information.

01 Staff () We must add the data to an Account entity with each attribute by progressively supplying arguments to the constructor after loading the data to a result table so that it can be added to the list collection.+Input: staffID(int), staffEmail(String), staffsPassword(String), staffName(String), staffDOB(date), staffPhone(String), staffAddress(String).

+ Output: staff (Staff)

01 getConnection() Create a connection using a few of the provided parameters Next, establish a database connection to begin processing data + Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String)—passed data is formatted for validation.

+ Output: Conn (connection), which connects to the database.

Trang 16

c Sequence Diagram(s)

Figure 1 Sequence diagram login for staffd Database Queries

String query: Select * from [Staff] where staffEmail = ? and staffPassword=?

3 Add Product By Staff

Trang 17

a.Class Diagram

b.Class SpecificationsProduct Controller

Add new product

+ Input: name(String),Price(string), description(String),Quantity(String),img(string), category(string).+ Output: true/false

Trang 18

specific methods such as doGet, doPost, doHead, doTrace This class provide by Java Servlet framework.

c.Sequence Diagram(s)

4 Update Product By Staff

a.Class Diagram

Trang 19

b.Class SpecificationsProduct Controller

No Method Description

01 doGet() Call getProductByID() in ProductDAO then load on web

02 doPost Get parameter in form update product then pass intoupdateProduct() in ProductDAO class

Product DAO

No Method Description

01 getProductByID()

Method that take sanintegerproduct Idasaparameter Insidethemethod,youwouldtypicallyhavecodeto locateandupdatetheproductinyourdatastore,such as a database.

02 updateProduct()

+ Update product by parameter

+productId(int),productName(String),productPrice(double),productQuantity(int),productImg(string),productCategory(string),productDis(string).

Trang 20

No Method Description

01 Product()

After loading data to a result table to have the data for adding to list collection weneed to add them into a Product entity with each attribute by passing parametersto the constructor sequentially + Input:productId(int),

- passed data is validated format.+ Output: None

c Sequence Diagram(s)

Trang 22

WHERE productID = ?

5 Add An Order

a Class Diagram

b Class SpecificationsAddAnOrderController

Trang 23

will return to the registration interface and display a message indicating that the email already exists.

03 addNew(user) Firstly, this method calls the class DBcontext to create a connection with the database

Secondly, add new user account to database.

+Input:email(String),password(String),name(String), phone(String), address(String)

+ Ouput : NoneDBContext

01 getConnection() Create a connection using a few of the provided parameters Next, establish a database connection to begin processing data + Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String)—passed data is formatted for validation.

+ Output: Conn (connection), which connects to the database.

Trang 24

c Sequence Diagram(s)

Figure 1 Sequence diagram register for userd Database Queries

String query: INSERT INTO ORDER VALUES (UserID,TotalPrice,purchaseDate);

6 List Product category by Users

Class Diagram

Trang 26

specific methods such as doGet, doPost, doHead, doTrace This class provide by Java Servlet framework

Trang 27

Class SpecificationsProduc Controller

No Method Description

01 doGet()

This method extends HttpServlet with responsibility to handleand transfer requests from users It gets txtSearch entered by theuser in jsp page then call function in ProductDAO to process dataand respond to the result to home page lists products matchedwith keywords and messages not found otherwise.Product DAO

No Method Description

01

searchProduct(inkeyword:String): ListProduct

This function is responsible for searching for informationabout a product based on the provided product ID TheThe search process can be related to queries in gadatabaseorThe system stores product data and returns detailsinformation about the respective product

product code This information may include the productname, price, description, images and other related details.

No Method Description

01 Product() After loading data to a result table to have the data for adding to the list collectionwe need to add them into a Product entity with each attribute by passing

Trang 28

+ Input:productId(int), productName(String),product

Price(double),productQuantity(int),productImg(string),productCategory(string),productDis(string).passed data is validated format.

+ Output: Nonec Sequence Diagram(s)

Database queries

select * from Product where userId like '%?%'

8.Delete list product in cart

Trang 29

a.Class Diagramb.Class Specifications

01 +DelateProductFormCart() +Delete product by ID of product

No Method Description

getconnection() getconnection so that when adding a product it will be put into thedboCart field

c.Sequence Diagram(s)

Trang 60

to

the list collection we need to add them into a staff entity with each attribute by passing parameters to the constructor sequentially

+ Input: staffID(int), staffEmail(String), staffPassword(String), staffName(String), staffDOB(date),

staffPhone(String), staffAddress(String) – validated data + Output: none

01 getconnection() Create a connection with some of the passed parameters as below Then

create a connection with database for data processing + Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String) - passed data is

validated format

+ Output: conn(Connection) - to connect with database.

c.Sequence Diagram(s)

Trang 61

d.Database queries UPDATE [dbo].[Staff]" + " SET [staffEmail] = ?" + " ,[staffPassword] = ?" + " ,[staffName] = ?" + " ,[staffDayOfBirth] = ?" + " ,[staffPhone] = ?" + " ,[staffAddress] = ?" + " WHERE staffID = ?

22.Add new staff

a.Class Diagram

Trang 62

b Class Specifications AddStaffController

01 doPost() +Call addStaff() and getStaff() in StaffDAO class then upload to web

StaffDAO

01 addStaff() +Add a new staff member to the database

02 getStaff() +Check to see if the imported email already exists in the database.

Trang 63

each attribute by passing parameters to the constructor sequentially

+ Input: id (int), email(String), password(String), staffID(int), staffName(String), staffPhone(String),staffAddress(String) - validated data

+ Output: None

01 getConnection() Create a connection with some of the passed parameters as below Then

create a connection with database for data processing + Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String) - passed data is

Trang 64

+ " ,[staffPassword]" + " ,[staffName]" + " ,[staffDayOfBirth]" + " ,[staffPhone]" + " ,[staffAddress])" + " VALUES" + " (?,?,?,?,?,?)

SELECT * from Staff where staffEmail=?

23.Change user password

a Class Diagram

Trang 65

in UserDAO class.

No Method Description

01 User() After loading data to a result table to have the data for adding to the list collection we need to add them into an Account entity with each attribute by passing parameters to the constructor sequentially

+ Input: userID (int), userEmail(String), userName(String),

userPassword(String), userDOB(Date), userPhone(String), userAddress(String) + Output: None

02 UpdatePassword(user)

+ Update user password

No Method Description

01 User() After loading data to a result table to have the data for adding to the list collection we need to add them into an Account entity with each attribute by passing parameters to the constructor sequentially

+ Input: id (int), userEmail(String), userPassword(String), userID(int),

userName(String), userDateOfBirth(date),

userPhone(String), userAddress(String) + Output: none

No Method Description

01 getConnection() Create a connection with some of the passed parameters as below Then create a connection with database for data processing

+ Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String) - passed data is validated format

+ Output: conn(Connection) - to connect with database.

Trang 66

c.Sequence Diagram(s)

d.Database queries

- String query: update [User] set userPassword=? where userID=?

24.Show Detail Product

a.Class Diagram

Trang 67

b Class Specifications Produc Controller

No Method Description

01 doGet() + doGet()is a method within the ClassSpecifications of the Product Controller,used to handle HTTP GET

requests from clients or web browsers This method is primarily associated with displaying detailed information abou ta specific product and relies on the GetProducbytId method from the Product DAO to access and retrieve product details from the database.

No Method Description

01 GetProductbyId It employs the productId parameter to invoke the

method of the Product DAO, facilitating access to the database and the retriev a lof comprehensive product information.

No Method Description

01 Product() After load data to a result table to have the data for adding to list collection we need to add them into a

Product entity with each attribute by passing parameters to the constructor sequentially

+ Input:productId(int), productName(String),product

Price(double),productQuantity(int),productImg(string),productCategory(string),productDis(string).passed data is validated format + Output: None

c Sequence Diagram(s)

Trang 69

ProductDAOs which calls the deleteProduct() function to proceed with deleting the productProductDAOs

1 deleteProduct() connection to database call delete method with productID then Set the value of the productID parameter in the SQL statement.

Trang 70

HTTPServlet: Extends the GenericServlet class and implements Serializable interface It provides http specific methods such as doGet, doPost, doHead, doTrace This class provide by Java Servlet framework.

Trang 71

b Class specificationProduct Controller

1 doGet() doGet()is a method within the ClassSpecifications of the Product Controller,used to handle HTTP GET requests from clients or web browsers.This method is primarily associated with displaying list product and relies on the getAllProducts(productId:int) method from the ProductDAOs To access and retrieve list products from the database.

1 getAllProduct() Firstly, this method calls class DBcontext to create a connection with a database then load data in the database to a result list of product in a collection list Java

+ Input: query(String) - for query data

+ Output: List Product - list all of product in database

1 Product() After load data to a result table to have the data for adding to list collection we need to add them into a Product entity with each attribute by passing parameters to the constructor sequentially

+ Input:productId(int), productName(String),product Price(double),productQuantity(int),productImg(string),productCategory(string),prod uctDis(string).passed data is validated format

+ Output: Non

Ngày đăng: 09/05/2024, 10:57

w