SPRING_STORE Software Design Specification Mentor - Quách Luyl Đa Trần Trọng Nguyễn - CE170134 Hồng Bảo Bảo - CE170912 Đoàn Quốc Kiệt – CE171400 –CanTho, January 2022 – RECORD OF CHANGES Date A* In charge Change Description M, D *A - Added M - Modified D - Deleted Page | 2 Table of Contents I. Login for user. Login for staff. Add Product By Staff.
Update Product By Staff. Add An Order.List Product category by Users.Delete list product in cart.Login for admin. Register for user. View user profile.
Update user profile. Update Product By Staff. List staff management.List comment in product detail.Add comment in product detail.View list user.Delete staff for admin.Update information staff.Add new staff.Change user password.Show Detail Product. Delete product by staff.
Show list product. Monthly Revenue Manager a.Show list order history a.List product on management page by staff .Class Specifications Product Controller.Load list product in cart. Add product into cart from product details. Code Packages Package descriptions No Package Description 01 View This package include font-end source with: jsp page, css, javascript, images, icon, font, bootstrap and jquery library 02 Models This package contains entities(classes) Product, Cart, Order, User, Staff, etc that can be accessed and used by other classes DAO.
03 DAOs Includes class ProductDAO, CartDAO, OrderDAO, UserDAO, and 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 data collected 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 email, random new password, and interacting with users by email.
Table Description No 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 Page | 9 05 Comment Stores user comments on products. - 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 11 ImportDetail Stores detailed information about products in each import. -Primary keys: importID, productID -Foreign keys: importID , productID 12 Payment Stores information about payments for orders.
- Primary keys: paymentID Page | 10 - Foreign keys: orderID II. Login for user a. Class Specifications LoginController No Method Description 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 Page | 11 No Method Description 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. User No Method Description 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.
+ Output: user (User) DBContext No Method Description 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.
Sequence Diagram(s) Figure 1. Sequence diagram login for user d. Database Queries String query: Select * from [User] where userEmail = ? and userPassword=? Page | 13 2. Login for staff a.
Class Specifications LoginController No Method Description 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 verify the username and password against the stored data. StaffDAO No Method Description 01 login() First, Establish a connection to the database. Page | 14 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 getStaff() After login into the system successfully, save user session information. Staff No Method Description 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. + Output: staff (Staff) DBContext No Method Description 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. Sequence Diagram(s) Figure 1. Sequence diagram login for staff d.
Database Queries String query: Select * from [Staff] where staffEmail = ? and staffPassword=? 3. Add Product By Staff Page | 16 a.Class Specifications Product Controller No Method Description Get parameter in form add product then pass into 1 doPost addProduct() in ProductDAO class Product DAO No Method Description Add new product addProduct(in + Input: name(String),Price(string), description(String), 01 product:Product):void Quantity(String),img(string), category(string). + Output: true/false Page | 17 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. Update Product By Staff a.Class Specifications Product Controller No Method Description 01 doGet() Call getProductByID() in ProductDAO then load on web Get parameter in form update product then pass into 02 doPost updateProduct() in ProductDAO class Product DAO No Method Description Method that take sanintegerproduct Idasaparameter. Inside getProductByI 01 themethod,youwouldtypicallyhavecodeto locateand D() updatetheproductinyourdatastore,such as a database. + Update product by parameter updateProduct( 02 +productId(int),productName(String),productPrice(double),productQuantity(int), ) productImg(string),productCategory(string),productDis(string).
Page | 19 Product No Method Description After loading 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), 01 Product() productName(String),productPrice(double),productQuantity(int),productImg(strin g),productCategory(string),productDis(string) - passed data is validated format. Sequence Diagram(s) Page | 20 d.Database queries SELECT P.productQuantity " + "FROM [Product] P " + "LEFT JOIN [Size] S OSN P. Add An Order a.
Class Specifications AddAnOrderController No Method Description 01 doPost() Call addNewOrder() in OrderDAO class then upload to web orderDAO No Method Description 01 addNewOrder() Add new order into the database. 02 getUser(email) First, this method calls the DBcontext class to create a connection to the database. Page | 22 Second, it checks to see if the email account already exists. If so, it 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. + Output: None Order No Method Description 01 Order() 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: orderId(int), userID(int), PurchaseDate(String), productName(String), totalPrice(float) + Ouput : None DBContext No Method Description 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. Sequence Diagram(s) Figure 1.
Sequence diagram register for user d. Database Queries String query: INSERT INTO ORDER VALUES (UserID,TotalPrice,purchaseDate); 6 .List Product category by Users Class Diagram Page | 24 b. Class Specifications Produc Controller No Method Description 1 doGet Get parameter in form getproduct() in ProductDAO class Product DAO No Method Description Get product + Input: name(String),Price(string), description(String), 01 Getproduct() Quantity(String),img(string), category(string). + Output: true/false Page | 25 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 c. Database queries select * from [Product] p where p.productName like ? and [productCategory] like ? 7.Search Product Class diagram Page | 26 Class Specifications Produc Controller No Method Description This method extends HttpServlet with responsibility to handle and transfer requests from users. It gets txtSearch entered by the 01 doGet() user in jsp page then call function in ProductDAO to process data and respond to the result to home page lists products matched with keywords and messages not found otherwise.
Product DAO No Method Description This function is responsible for searching for information about a product based on the provided product ID. The The search process can be related to queries in gadatabaseor searchProduct(in 01 keyword:String): List The system stores product data and returns details Product information about the respective product product code. This information may include the product name, price, description, images and other related details. Product No Method Description 01 Product() After loading data to a result table to have the data for adding to the list collection we need to add them into a Product entity with each attribute by passing Page | 27 parameter to constructor sequentially.passed data is validated format.
Sequence Diagram(s) Database queries select * from Product where userId like '%?%' 8.Delete list product in cart Page | 28 a.Class Specifications DeleteListProductInCartController No. Method Description 01 +DelateProductFormCart() +Delete product by ID of product Product No. Method Description - After loading data to a result table to have the data for adding to list collection we need to add them into a Product(): Product entity with each attribute by passing parameters to the constructor sequentially Dbconnection No. Method Description getconnection so that when adding a product it will be put into the getconnection() dboCart field c.Sequence Diagram(s) Page | 29