diff --git a/.gitignore b/.gitignore index e750817..59dd348 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,4 @@ server/*.war # IntelliJ IDEA .idea/ -.history/ - -*.xlsx \ No newline at end of file +.history/ \ No newline at end of file diff --git a/README.md b/README.md index 9c1541b..3afcd02 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Sale Dock + [![build](https://github.com/hardingadonis/saledock/actions/workflows/build.yml/badge.svg)](https://github.com/hardingadonis/saledock/actions/workflows/build.yml) [![publish](https://github.com/hardingadonis/saledock/actions/workflows/publish.yml/badge.svg)](https://github.com/hardingadonis/saledock/actions/workflows/publish.yml) [![release](https://github.com/hardingadonis/saledock/actions/workflows/release.yml/badge.svg)](https://github.com/hardingadonis/saledock/actions/workflows/release.yml) @@ -7,17 +8,18 @@ ![GitHub top language](https://img.shields.io/github/languages/top/hardingadonis/saledock) ![GitHub repo size](https://img.shields.io/github/repo-size/hardingadonis/saledock) ![GitHub License](https://img.shields.io/github/license/hardingadonis/saledock) -> SWP391 project, ERP system, Sales module +> SWP391 project, ERP system, Sales module ## Requirements + - JDK 17 - MySQL 8.2.0 - Tomcat 10 - Maven 3+ - ## Database +
Database @@ -28,37 +30,33 @@
- ## Development + - You need to install the requirements above. + #### 1. Clone `Sale Dock`: + ```bash git clone https://github.com/hardingadonis/saledock.git ``` + #### 2. Open `Sale Dock`: + - You can open `Sale Dock` with your favorite IDE: - [IntelliJ IDEA](https://www.jetbrains.com/idea/) - [Eclipse](https://www.eclipse.org/) - [NetBeans](https://netbeans.apache.org/) + #### 3. Build `Sale Dock` with `Maven` (Optional): + ```bash cd saledock mvn verify ``` - ## Deployment -#### 1. Download `docker-compose.yml`: -```bash -curl -O https://raw.githubusercontent.com/hardingadonis/saledock/main/docker-compose.yml -``` -#### 2. Run `docker-copmose`: -```bash -docker-compose up -d -``` -#### 3. Access `Sale Dock`: -- Open `http://localhost:8080/saledock` in your browser. +- Open Installation Guide: [Installation Guide](docs/INSTALLATION_GUIDE.md) ## Contributors @@ -93,7 +91,7 @@ docker-compose up -d - ## Licenses: + - [Sale Dock](https://github.com/hardingadonis/saledock) is under the [Apache-2.0 license](https://github.com/hardingadonis/saledock/blob/main/LICENSE). -- [favicon](https://github.com/hardingadonis/saledock/blob/main/src/main/webapp/assets/images/favicon/favicon.png) is under the [flaticon](https://www.flaticon.com/free-icon/sale_791968). \ No newline at end of file +- [favicon](https://github.com/hardingadonis/saledock/blob/main/src/main/webapp/assets/images/favicon/favicon.png) is under the [flaticon](https://www.flaticon.com/free-icon/sale_791968). diff --git a/database/setup.sql b/database/setup.sql index 972c405..dba2051 100644 --- a/database/setup.sql +++ b/database/setup.sql @@ -2,10 +2,10 @@ -- version 5.2.1 -- https://www.phpmyadmin.net/ -- --- Host: 127.0.0.1 --- Generation Time: Jan 23, 2024 at 10:16 AM --- Server version: 10.4.32-MariaDB --- PHP Version: 8.2.12 +-- Máy chủ: 127.0.0.1 +-- Thời gian đã tạo: Th3 17, 2024 lúc 11:47 AM +-- Phiên bản máy phục vụ: 10.4.28-MariaDB +-- Phiên bản PHP: 8.2.4 SET FOREIGN_KEY_CHECKS = 0; @@ -20,7 +20,7 @@ SET time_zone = "+00:00"; /*!40101 SET NAMES utf8mb4 */; -- --- Database: `saledock` +-- Cơ sở dữ liệu: `saledock` -- CREATE DATABASE IF NOT EXISTS `saledock` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; USE `saledock`; @@ -28,7 +28,7 @@ USE `saledock`; -- -------------------------------------------------------- -- --- Table structure for table `category` +-- Cấu trúc bảng cho bảng `category` -- CREATE TABLE `category` ( @@ -38,7 +38,7 @@ CREATE TABLE `category` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- --- Dumping data for table `category` +-- Đang đổ dữ liệu cho bảng `category` -- INSERT INTO `category` (`id`, `created_at`, `name`) VALUES @@ -49,7 +49,7 @@ INSERT INTO `category` (`id`, `created_at`, `name`) VALUES -- -------------------------------------------------------- -- --- Table structure for table `customer` +-- Cấu trúc bảng cho bảng `customer` -- CREATE TABLE `customer` ( @@ -63,18 +63,35 @@ CREATE TABLE `customer` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- --- Dumping data for table `customer` +-- Đang đổ dữ liệu cho bảng `customer` -- INSERT INTO `customer` (`id`, `address`, `code`, `created_at`, `email`, `name`, `updated_at`) VALUES (1, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00001', '2024-01-19 18:10:16.000000', 'kh00001@gmail.com', 'Công ty TNHH A', '2024-01-19 18:10:16.000000'), (2, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00002', '2024-01-19 18:10:16.000000', 'kh00002@gmail.com', 'Công ty TNHH B', NULL), -(3, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00003', '2024-01-19 18:10:16.000000', 'kh00003@gmail.com', 'Công ty TNHH C', '2024-01-19 18:10:16.000000'); +(3, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00003', '2024-01-19 18:10:16.000000', 'kh00003@gmail.com', 'Công ty TNHH C', '2024-01-19 18:10:16.000000'), +(4, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00004', NULL, 'kh00004@gmail.com', 'Công ty TNHH D', NULL), +(5, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00005', NULL, 'kh00005@gmail.com', 'Công ty TNHH E', NULL), +(6, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00006', NULL, 'kh00006@gmail.com', 'Công ty TNHH F', NULL), +(7, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00007', NULL, 'kh00007@gmail.com', 'Công ty TNHH G', NULL), +(8, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00008', NULL, 'kh00008@gmail.com', 'Công ty TNHH H', NULL), +(9, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00009', NULL, 'kh00009@gmail.com', 'Công ty TNHH I', NULL), +(10, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00010', NULL, 'kh00010@gmail.com', 'Công ty TNHH K', NULL), +(11, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00011', NULL, 'kh00011@gmail.com', 'Công ty TNHH L', NULL), +(12, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00012', NULL, 'kh00012@gmail.com', 'Công ty TNHH M', NULL), +(13, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00013', NULL, 'kh00013@gmail.com', 'Công ty TNHH J', NULL), +(14, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00014', NULL, 'kh00014@gmail.com', 'Công ty TNHH O', NULL), +(15, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00015', NULL, 'kh00015@gmail.com', 'Công ty TNHH P', NULL), +(16, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00016', NULL, 'kh00016@gmail.com', 'Công ty TNHH T', NULL), +(17, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00017', NULL, 'kh00017@gmail.com', 'Công ty TNHH R', NULL), +(18, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00018', NULL, 'kh00018@gmail.com', 'Công ty TNHH Y', NULL), +(19, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00019', NULL, 'kh00019@gmail.com', 'Công ty TNHH X', NULL), +(20, 'Phường Nhơn Bình, Thành phố Quy Nhơn, Tỉnh Bình Định', 'KH00020', NULL, 'kh00020@gmail.com', 'Công ty TNHH Z', NULL); -- -------------------------------------------------------- -- --- Table structure for table `employee` +-- Cấu trúc bảng cho bảng `employee` -- CREATE TABLE `employee` ( @@ -88,7 +105,7 @@ CREATE TABLE `employee` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- --- Dumping data for table `employee` +-- Đang đổ dữ liệu cho bảng `employee` -- INSERT INTO `employee` (`id`, `code`, `created_at`, `email`, `name`, `password`, `updated_at`) VALUES @@ -102,7 +119,7 @@ INSERT INTO `employee` (`id`, `code`, `created_at`, `email`, `name`, `password`, -- -------------------------------------------------------- -- --- Table structure for table `order` +-- Cấu trúc bảng cho bảng `order` -- CREATE TABLE `order` ( @@ -118,17 +135,35 @@ CREATE TABLE `order` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- --- Dumping data for table `order` +-- Đang đổ dữ liệu cho bảng `order` -- INSERT INTO `order` (`id`, `code`, `created_at`, `note`, `status`, `total`, `updated_at`, `customer_id`, `employee_id`) VALUES (1, '9423198AE8A44E7', '2024-01-19 18:10:16.000000', NULL, 'PENDING', 7078000, NULL, 3, 1), -(2, '21BD4E4E65094E6', '2024-01-19 18:10:16.000000', NULL, 'PENDING', 10290000, NULL, 1, 1); +(2, '21BD4E4E65094E6', '2024-01-19 18:10:16.000000', NULL, 'PENDING', 10290000, NULL, 1, 1), +(3, '2E31F002600A46B', '2024-03-17 17:11:26.000000', '', 'PENDING', 6275000, NULL, 5, 3), +(4, '40791F5BDA8D477', '2024-03-17 17:12:46.000000', '', 'PENDING', 4500000, NULL, 7, 3), +(5, 'E9E2BA0E17B3491', '2024-03-17 17:13:32.000000', '', 'PENDING', 50000000, NULL, 13, 3), +(6, 'BDFBD5BDD4F44FC', '2024-03-17 17:14:23.000000', '', 'PENDING', 13600000, NULL, 9, 3), +(7, '6A0EEACDE04F46B', '2024-03-17 17:15:44.000000', '', 'PENDING', 48000000, NULL, 19, 3), +(8, '7B944844ED034B4', '2024-03-17 17:16:39.000000', '', 'PENDING', 2300000, NULL, 16, 3), +(9, '7C0475BF262D457', '2024-03-17 17:17:04.000000', '', 'PENDING', 8000000, NULL, 20, 3), +(10, '2D74DAFD29F0426', '2024-03-17 17:17:29.000000', '', 'PENDING', 15450000, NULL, 11, 3), +(11, '4AA4F4893B09469', '2024-03-17 17:18:25.000000', '', 'PENDING', 4000000, NULL, 12, 3), +(12, '064487392A5740D', '2024-03-17 17:18:59.000000', '', 'PENDING', 3800000, NULL, 14, 3), +(13, 'E0388B304752421', '2024-03-17 17:19:28.000000', '', 'PENDING', 7242000, NULL, 15, 3), +(14, '4905E8ABB1DE4CC', '2024-03-17 17:19:47.000000', '', 'PENDING', 180000, NULL, 10, 3), +(15, '6D9756D62915488', '2024-03-17 17:20:06.000000', '', 'PENDING', 52000, NULL, 9, 3), +(16, 'BE5A672076CB427', '2024-03-17 17:20:29.000000', '', 'PENDING', 150000, NULL, 17, 3), +(17, 'AB8D2051AF10462', '2024-03-17 17:20:53.000000', '', 'PENDING', 110000, NULL, 8, 3), +(18, '14B5D3DC5D01484', '2024-03-17 17:21:31.000000', '', 'PENDING', 65000, NULL, 6, 3), +(19, 'AFEAD2D8D1D846A', '2024-03-17 17:21:49.000000', '', 'PENDING', 45000, NULL, 11, 3), +(20, 'B39D0AD14321471', '2024-03-17 17:22:41.000000', '', 'PENDING', 151800000000000, NULL, 3, 3); -- -------------------------------------------------------- -- --- Table structure for table `order_detail` +-- Cấu trúc bảng cho bảng `order_detail` -- CREATE TABLE `order_detail` ( @@ -138,7 +173,7 @@ CREATE TABLE `order_detail` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- --- Dumping data for table `order_detail` +-- Đang đổ dữ liệu cho bảng `order_detail` -- INSERT INTO `order_detail` (`quantity`, `order_id`, `product_id`) VALUES @@ -146,12 +181,59 @@ INSERT INTO `order_detail` (`quantity`, `order_id`, `product_id`) VALUES (145, 1, 9), (34, 2, 2), (16, 2, 3), -(334, 2, 8); +(334, 2, 8), +(20, 3, 13), +(20, 3, 16), +(11, 3, 17), +(4, 3, 20), +(100, 4, 11), +(200, 4, 12), +(100, 5, 15), +(100, 5, 16), +(100, 5, 20), +(50, 6, 10), +(50, 6, 14), +(50, 6, 15), +(100, 7, 5), +(100, 7, 6), +(100, 7, 13), +(100, 7, 15), +(100, 7, 17), +(100, 8, 4), +(100, 8, 11), +(100, 9, 3), +(100, 9, 7), +(100, 10, 6), +(10, 10, 17), +(100, 11, 12), +(100, 11, 13), +(10, 12, 2), +(10, 12, 6), +(10, 12, 15), +(11, 13, 10), +(100, 13, 20), +(1, 14, 6), +(2, 14, 12), +(1, 15, 10), +(1, 15, 11), +(1, 15, 12), +(1, 16, 5), +(1, 16, 14), +(1, 17, 5), +(1, 17, 11), +(1, 17, 12), +(1, 18, 3), +(2, 18, 13), +(1, 19, 4), +(1, 19, 10), +(1, 19, 12), +(1000000000, 20, 6), +(10000000, 20, 15); -- -------------------------------------------------------- -- --- Table structure for table `product` +-- Cấu trúc bảng cho bảng `product` -- CREATE TABLE `product` ( @@ -167,32 +249,43 @@ CREATE TABLE `product` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- --- Dumping data for table `product` +-- Đang đổ dữ liệu cho bảng `product` -- INSERT INTO `product` (`id`, `code`, `created_at`, `description`, `image_url`, `name`, `price`, `updated_at`, `category_id`) VALUES -(1, 'P001', '2024-01-19 18:10:16.000000', 'Bún gạo trắng và mềm, dùng để nấu các món phở và mì Quảng', NULL, 'Bún gạo đóng gói', 20000, NULL, 1), -(2, 'C002', '2024-01-19 18:10:16.000000', 'Thịt heo hấp nhẹ, đóng gói sẵn để sử dụng trong các món ăn nhanh', NULL, 'Thịt hộp hấp', 50000, NULL, 1), -(3, 'S003', '2024-01-19 18:10:16.000000', 'Sốt cà chua chín đỏ, thích hợp để làm nền cho các món pasta hoặc pizza', NULL, 'Sốt cà chua hộp', 15000, NULL, 1), -(4, 'V004', '2024-01-19 18:10:16.000000', 'Rau mầm cải xanh tươi ngon, giàu dinh dưỡng, thích hợp để thêm vào salad hoặc làm rau sống', NULL, 'Rau mầm cải xanh', 8000, NULL, 2), -(5, 'T005', '2024-01-19 18:10:16.000000', 'Gà tươi ngon, có thể chế biến thành nhiều món ăn khác nhau', NULL, 'Thịt gà tươi sống', 80000, NULL, 2), -(6, 'H006', '2024-01-19 18:10:16.000000', 'Fillet cá hồi tươi ngon, giàu axit béo omega-3', NULL, 'Cá hồi tươi sống', 150000, NULL, 2), -(7, 'F007', '2024-01-19 18:10:16.000000', 'Pizza với hải sản tươi sống, hỗn hợp phô mai, và sốt cà chua', NULL, 'Pizza hải sản đóng gói', 65000, NULL, 3), -(8, 'M008', '2024-01-19 18:10:16.000000', 'Mì ý tươi ngon, đóng gói sẵn để nấu chín nhanh chóng', NULL, 'Mì ý đóng gói', 25000, NULL, 3), -(9, 'I009', '2024-01-19 18:10:16.000000', 'Kem vani hảo hạng, đóng gói tiện lợi để thưởng thức ngay lập tức', NULL, 'Kem vani đóng gói', 30000, NULL, 3); - --- --- Indexes for dumped tables --- - --- --- Indexes for table `category` +(1, 'P001', '2024-01-19 18:10:16.000000', 'Bún gạo trắng và mềm, dùng để nấu các món phở và mì Quảng', 'product_img/bun-gao.jpg', 'Bún gạo đóng gói', 20000, '2024-03-17 16:50:17.000000', 1), +(2, 'C002', '2024-01-19 18:10:16.000000', 'Thịt heo hấp nhẹ, đóng gói sẵn để sử dụng trong các món ăn nhanh', 'product_img/thit-hop-hap.jpg', 'Thịt hộp hấp', 50000, '2024-03-17 17:39:25.000000', 1), +(3, 'S003', '2024-01-19 18:10:16.000000', 'Sốt cà chua chín đỏ, thích hợp để làm nền cho các món pasta hoặc pizza', 'product_img/sot-ca-chua.jpg', 'Sốt cà chua hộp', 15000, '2024-03-17 16:51:44.000000', 1), +(4, 'V004', '2024-01-19 18:10:16.000000', 'Rau mầm cải xanh tươi ngon, giàu dinh dưỡng, thích hợp để thêm vào salad hoặc làm rau sống', 'product_img/rau-cai-xanh.jpg', 'Rau mầm cải xanh', 8000, '2024-03-17 16:52:50.000000', 2), +(5, 'T005', '2024-01-19 18:10:16.000000', 'Gà tươi ngon, có thể chế biến thành nhiều món ăn khác nhau', 'product_img/thit-ga.jpg', 'Thịt gà tươi sống', 80000, '2024-03-17 16:53:30.000000', 2), +(6, 'H006', '2024-01-19 18:10:16.000000', 'Fillet cá hồi tươi ngon, giàu axit béo omega-3', 'product_img/ca-hoi-tuoi.png', 'Cá hồi tươi sống', 150000, '2024-03-17 16:55:04.000000', 2), +(7, 'F007', '2024-01-19 18:10:16.000000', 'Pizza với hải sản tươi sống, hỗn hợp phô mai, và sốt cà chua', 'product_img/pizza.png', 'Pizza hải sản đóng gói', 65000, '2024-03-17 16:56:45.000000', 3), +(8, 'M008', '2024-01-19 18:10:16.000000', 'Mì ý tươi ngon, đóng gói sẵn để nấu chín nhanh chóng', 'product_img/my-y.jpg', 'Mì ý đóng gói', 25000, '2024-03-17 16:57:47.000000', 3), +(9, 'I009', '2024-01-19 18:10:16.000000', 'Kem vani hảo hạng, đóng gói tiện lợi để thưởng thức ngay lập tức', 'product_img/kem.jpg', 'Kem vani đóng gói', 30000, '2024-03-17 16:58:32.000000', 3), +(10, 'Q312', '2024-03-17 17:00:20.000000', '', 'product_img/chao-ca-hoi.jpg', 'Cháo Fun Cá Hồi Phô Mai', 22000, NULL, 1), +(11, 'N954', '2024-03-17 17:01:14.000000', '', 'product_img/mi-xao.jpg', 'Mì Xào Táo Quân Thập Cẩm', 15000, NULL, 1), +(12, 'Q527', '2024-03-17 17:02:03.000000', '', 'product_img/mi-omachi.jpg', 'Mì Omachi Xốt Bò Hầm Ly', 15000, NULL, 1), +(13, 'H629', '2024-03-17 17:02:42.000000', '', 'product_img/pate.jpg', 'Pate Gan Hạ Long', 25000, NULL, 1), +(14, 'C573', '2024-03-17 17:03:32.000000', '', 'product_img/cu-kieu.jpg', 'Củ Kiệu Chua Ngọt ', 70000, NULL, 1), +(15, 'G018', '2024-03-17 17:05:16.000000', '', 'product_img/heo-ba-roi.png', 'BA RỌI HEO KHÔNG DA VIETGAP 1KG', 180000, NULL, 2), +(16, 'T199', '2024-03-17 17:06:05.000000', '', 'product_img/thit-bo.png', 'NẠM BÒ ÚC 1KG', 250000, NULL, 2), +(17, 'G747', '2024-03-17 17:06:57.000000', '', 'product_img/nam.jpg', 'COMBO NẤM THỦY TIÊN MALAYSIA HỘP 200GR', 45000, NULL, 2), +(18, 'H533', '2024-03-17 17:07:42.000000', '', 'product_img/dao.jpg', 'ĐÀO ĐỎ 500G', 55000, NULL, 2), +(19, 'B617', '2024-03-17 17:09:02.000000', '', 'product_img/bo-vien-fuji.jpg', 'Bò viên Fuji', 100000, '2024-03-17 17:42:24.000000', 3), +(20, 'P387', '2024-03-17 17:09:59.000000', '', 'product_img/thanh-cua-mayumi.jpg', 'Thanh cua truyền thống Mayumi', 70000, '2024-03-17 17:45:23.000000', 3); + +-- +-- Chỉ mục cho các bảng đã đổ +-- + +-- +-- Chỉ mục cho bảng `category` -- ALTER TABLE `category` ADD PRIMARY KEY (`id`); -- --- Indexes for table `customer` +-- Chỉ mục cho bảng `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`id`), @@ -200,14 +293,14 @@ ALTER TABLE `customer` ADD UNIQUE KEY `UK_dwk6cx0afu8bs9o4t536v1j5v` (`email`); -- --- Indexes for table `employee` +-- Chỉ mục cho bảng `employee` -- ALTER TABLE `employee` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `UK_nbyivu8qgmx0r7wtbplf01gf8` (`code`); -- --- Indexes for table `order` +-- Chỉ mục cho bảng `order` -- ALTER TABLE `order` ADD PRIMARY KEY (`id`), @@ -216,14 +309,14 @@ ALTER TABLE `order` ADD KEY `FKkkkmw7q1tbeqtet9uxw2v0r1` (`employee_id`); -- --- Indexes for table `order_detail` +-- Chỉ mục cho bảng `order_detail` -- ALTER TABLE `order_detail` ADD PRIMARY KEY (`order_id`,`product_id`), ADD KEY `FK3dy42byw9inbi11108wxlpl36` (`product_id`); -- --- Indexes for table `product` +-- Chỉ mục cho bảng `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`id`), @@ -231,59 +324,59 @@ ALTER TABLE `product` ADD KEY `FK7l29ekt1x29jup80y2iigimyy` (`category_id`); -- --- AUTO_INCREMENT for dumped tables +-- AUTO_INCREMENT cho các bảng đã đổ -- -- --- AUTO_INCREMENT for table `category` +-- AUTO_INCREMENT cho bảng `category` -- ALTER TABLE `category` MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- --- AUTO_INCREMENT for table `customer` +-- AUTO_INCREMENT cho bảng `customer` -- ALTER TABLE `customer` - MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- --- AUTO_INCREMENT for table `employee` +-- AUTO_INCREMENT cho bảng `employee` -- ALTER TABLE `employee` MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- --- AUTO_INCREMENT for table `order` +-- AUTO_INCREMENT cho bảng `order` -- ALTER TABLE `order` - MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; + MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- --- AUTO_INCREMENT for table `product` +-- AUTO_INCREMENT cho bảng `product` -- ALTER TABLE `product` - MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; + MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- --- Constraints for dumped tables +-- Các ràng buộc cho các bảng đã đổ -- -- --- Constraints for table `order` +-- Các ràng buộc cho bảng `order` -- ALTER TABLE `order` ADD CONSTRAINT `FKk1m6gjs4m7rtgb5lw01g35yca` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`), ADD CONSTRAINT `FKkkkmw7q1tbeqtet9uxw2v0r1` FOREIGN KEY (`employee_id`) REFERENCES `employee` (`id`); -- --- Constraints for table `order_detail` +-- Các ràng buộc cho bảng `order_detail` -- ALTER TABLE `order_detail` ADD CONSTRAINT `FK3dy42byw9inbi11108wxlpl36` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`), ADD CONSTRAINT `FK68mf7v62attypi34kgadriu28` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`); -- --- Constraints for table `product` +-- Các ràng buộc cho bảng `product` -- ALTER TABLE `product` ADD CONSTRAINT `FK7l29ekt1x29jup80y2iigimyy` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`); @@ -293,4 +386,4 @@ SET FOREIGN_KEY_CHECKS = 0; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; \ No newline at end of file +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/docs/INSTALLATION_GUIDE.md b/docs/INSTALLATION_GUIDE.md new file mode 100644 index 0000000..e30a47e --- /dev/null +++ b/docs/INSTALLATION_GUIDE.md @@ -0,0 +1,48 @@ +# Sale Dock - Installation Guide + +## I. Install via Docker + +### 1. Requirements + +- OS: Linux, Windows, macOS +- Docker Desktop: [Install Docker Desktop](https://www.docker.com/products/docker-desktop) + +### 2. Installation + +- Step 1: Open Docker Desktop + + | ![Docker Desktop](../imgs/1.png) | + | :------------------------------: | + | _Image 1: Open Docker Desktop_ | + +- Step 2: Open your terminal + + | ![Terminal](../imgs/2.png) | + | :---------------------------: | + | _Image 2: Open your terminal_ | + +- Step 3: Download `docker-compose.yml` via `curl` + + ```bash + curl -O https://raw.githubusercontent.com/hardingadonis/saledock/main/docker-compose.yml + ``` + + | ![Download docker compose file](../imgs/3.png) | + | :-------------------------------------------------: | + | _Image 3: Download `docker-compose.yml` via `curl`_ | + +- Step 4: Run `docker-compose up -d` and wait for the installation to complete + + ```bash + docker-compose up -d + ``` + + | ![Run docker compose](../imgs/4.png) | + | :-----------------------------------: | + | _Image 4: Run `docker-compose up -d`_ | + +- Step 5: Open your browser and navigate to `http://localhost:8080/saledock` + + | ![Open browser](../imgs/5.png) | + | :----------------------------: | + | _Image 5: Open your browser_ | diff --git a/docs/SWP391 - Final Release.pdf b/docs/SWP391 - Final Release.pdf new file mode 100644 index 0000000..debbd27 Binary files /dev/null and b/docs/SWP391 - Final Release.pdf differ diff --git a/docs/SWP391 - Issues Report.xlsx b/docs/SWP391 - Issues Report.xlsx new file mode 100644 index 0000000..d3b158e Binary files /dev/null and b/docs/SWP391 - Issues Report.xlsx differ diff --git a/docs/SWP391 - Project Tracking.xlsx b/docs/SWP391 - Project Tracking.xlsx new file mode 100644 index 0000000..8aa569f Binary files /dev/null and b/docs/SWP391 - Project Tracking.xlsx differ diff --git a/docs/SWP391 - Software Design Specification.pdf b/docs/SWP391 - Software Design Specification.pdf new file mode 100644 index 0000000..88ac03b Binary files /dev/null and b/docs/SWP391 - Software Design Specification.pdf differ diff --git a/docs/SWP391 - System Test.xlsx b/docs/SWP391 - System Test.xlsx new file mode 100644 index 0000000..df63f88 Binary files /dev/null and b/docs/SWP391 - System Test.xlsx differ diff --git a/docs/SaleDock_SRS_v1.0.pdf b/docs/SaleDock_SRS_v1.0.pdf new file mode 100644 index 0000000..eb7e810 Binary files /dev/null and b/docs/SaleDock_SRS_v1.0.pdf differ diff --git a/get_version.sh b/get_version.sh index b682fcb..2a2ef97 100644 --- a/get_version.sh +++ b/get_version.sh @@ -1,7 +1,7 @@ #!/bin/bash -major_version=0 -minor_version=9 +major_version=1 +minor_version=0 path_version=0 echo "$major_version.$minor_version.$path_version" diff --git a/imgs/1.png b/imgs/1.png new file mode 100644 index 0000000..f0f9606 Binary files /dev/null and b/imgs/1.png differ diff --git a/imgs/2.png b/imgs/2.png new file mode 100644 index 0000000..3e9fdb7 Binary files /dev/null and b/imgs/2.png differ diff --git a/imgs/3.png b/imgs/3.png new file mode 100644 index 0000000..b2c7a7c Binary files /dev/null and b/imgs/3.png differ diff --git a/imgs/4.png b/imgs/4.png new file mode 100644 index 0000000..0ca5f5b Binary files /dev/null and b/imgs/4.png differ diff --git a/imgs/5.png b/imgs/5.png new file mode 100644 index 0000000..38c650f Binary files /dev/null and b/imgs/5.png differ diff --git a/pom.xml b/pom.xml index b5a6894..92da73e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.hardingadonis saledock - 0.9.0 + 1.0.0 war Sale Dock - v${project.version} diff --git a/src/main/java/io/hardingadonis/saledock/controller/management/order/AddOrderServlet.java b/src/main/java/io/hardingadonis/saledock/controller/management/order/AddOrderServlet.java index 51bccc9..0c03a89 100644 --- a/src/main/java/io/hardingadonis/saledock/controller/management/order/AddOrderServlet.java +++ b/src/main/java/io/hardingadonis/saledock/controller/management/order/AddOrderServlet.java @@ -103,7 +103,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) } } Order saveOrder = Singleton.orderDAO.save(order); - SendEmailUtil.sendOrderMessage(customer.get().getEmail(), "Slae Dock - Đặt hàng thành công", saveOrder); + SendEmailUtil.sendOrderMessage(customer.get().getEmail(), "Sale Dock - Đặt hàng thành công", saveOrder); SessionUtil.getInstance().removeValue(request, "productMap"); response.sendRedirect("./order?message=orderSuccess"); } else { diff --git a/src/main/java/io/hardingadonis/saledock/controller/others/download/DownloadServlet.java b/src/main/java/io/hardingadonis/saledock/controller/others/download/DownloadServlet.java index 7496ad2..bd75fb2 100644 --- a/src/main/java/io/hardingadonis/saledock/controller/others/download/DownloadServlet.java +++ b/src/main/java/io/hardingadonis/saledock/controller/others/download/DownloadServlet.java @@ -30,6 +30,13 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) break; } + case "order": { + Integer ID = Integer.parseInt(request.getParameter("id")); + + path = ExcelUtil.generateOrderDetailExcel(getServletContext().getRealPath("/"), ID); + break; + } + default: { response.sendError(404); return; diff --git a/src/main/java/io/hardingadonis/saledock/controller/others/login/ForgotPasswordServlet.java b/src/main/java/io/hardingadonis/saledock/controller/others/login/ForgotPasswordServlet.java index 72a19aa..8b2d91c 100644 --- a/src/main/java/io/hardingadonis/saledock/controller/others/login/ForgotPasswordServlet.java +++ b/src/main/java/io/hardingadonis/saledock/controller/others/login/ForgotPasswordServlet.java @@ -44,7 +44,7 @@ private void checkEmail(HttpServletRequest request, HttpServletResponse response if (employee.isPresent()) { request.setAttribute("message", "success"); String newOtp = OtpUtil.generateRandomOTP(); - SendEmailUtil.sendGetOTPMessage(email, "New OTP", newOtp); + SendEmailUtil.sendGetOTPMessage(email, "Sale Dock - Quên mật khẩu?", newOtp); SessionUtil.getInstance().putValue(request, "otp", newOtp); SessionUtil.getInstance().putValue(request, "email", email); request.getRequestDispatcher("/view/jsp/others/login/otp.jsp").forward(request, response); diff --git a/src/main/java/io/hardingadonis/saledock/utils/ExcelUtil.java b/src/main/java/io/hardingadonis/saledock/utils/ExcelUtil.java index c20d217..0e70b53 100644 --- a/src/main/java/io/hardingadonis/saledock/utils/ExcelUtil.java +++ b/src/main/java/io/hardingadonis/saledock/utils/ExcelUtil.java @@ -1,5 +1,8 @@ package io.hardingadonis.saledock.utils; +import io.hardingadonis.saledock.model.Order; +import io.hardingadonis.saledock.model.OrderDetail; +import org.apache.poi.ss.formula.functions.Column; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.*; @@ -73,4 +76,71 @@ public static String generateProductsExcel(String path) { return pathSave; } + + public static String generateOrderDetailExcel(String path, Integer ID) { + final String pathSave = path + "order.xlsx"; + + try (XSSFWorkbook workbook = new XSSFWorkbook()) { + XSSFSheet sheet = workbook.createSheet("Đơn hàng"); + + var orderBox = Singleton.orderDAO.getByID(ID); + + if (orderBox.isPresent()) { + var order = orderBox.get(); + + var row = sheet.createRow(0); + row.createCell(0).setCellValue("Mã đơn hàng"); + row.createCell(1).setCellValue(order.getCode()); + + row = sheet.createRow(1); + row.createCell(0).setCellValue("Khách hàng"); + row.createCell(1).setCellValue(order.getCustomer().getName()); + + row = sheet.createRow(2); + row.createCell(0).setCellValue("Nhân viên"); + row.createCell(1).setCellValue(order.getEmployee().getFullName()); + + row = sheet.createRow(3); + row.createCell(0).setCellValue("Ngày tạo"); + row.createCell(1).setCellValue(order.getCreatedAt()); + + row = sheet.createRow(4); + row.createCell(0).setCellValue("Trạng thái"); + row.createCell(1).setCellValue(order.getStatus().toString()); + + row = sheet.createRow(5); + row.createCell(0).setCellValue("Tổng số tiền"); + row.createCell(1).setCellValue(order.getTotal()); + + String[] header = {"Code", "Tên sản phẩm", "Đơn giá", "Số lượng", "Tổng tiền"}; + + Row headerRow = sheet.createRow(7); + for (int i = 0; i < header.length; i++) { + Cell cell = headerRow.createCell(i); + cell.setCellValue(header[i]); + } + + var detail = order.getOrderDetails().toArray(); + + for (int i = 0; i < detail.length; i++) { + row = sheet.createRow(i + 8); + + var d = (OrderDetail) detail[i]; + + row.createCell(0).setCellValue(d.getID().getProductID()); + row.createCell(1).setCellValue(d.getProduct().getName()); + row.createCell(2).setCellValue(d.getProduct().getPrice()); + row.createCell(3).setCellValue(d.getQuantity()); + row.createCell(4).setCellValue(d.getQuantity() * d.getProduct().getPrice()); + } + + workbook.write(new FileOutputStream(pathSave)); + } + + } catch (Exception ex) { + System.err.println(ex.getMessage()); + } + + return pathSave; + } } diff --git a/src/main/java/io/hardingadonis/saledock/utils/SendEmailUtil.java b/src/main/java/io/hardingadonis/saledock/utils/SendEmailUtil.java index 195f7ed..6fa9371 100644 --- a/src/main/java/io/hardingadonis/saledock/utils/SendEmailUtil.java +++ b/src/main/java/io/hardingadonis/saledock/utils/SendEmailUtil.java @@ -73,12 +73,12 @@ public static void sendGetOTPMessage(String to, String title, String otp) { + "\n" + " \n" + " \n" - + " Get OTP\n" + + " Lấy mã OTP\n" + "\n" + "\n" - + "

Welcome to Sale Dock

\n" - + "

Your OTP to change your account password is: " + otp + "

\n" - + "

Please usse this OTP to change your old password.

\n" + + "

Chào mừng đến với Sale Dock

\n" + + "

Mã OTP của bạn là: " + otp + "

\n" + + "

Vui lòng sử dụng mã trên để thực hiện quá trình thay đổi mật khẩu.

\n" + " \n" + "\n" + ""; diff --git a/src/main/webapp/view/assets/images/product_img/bo-vien-fuji.jpg b/src/main/webapp/view/assets/images/product_img/bo-vien-fuji.jpg new file mode 100644 index 0000000..9059a54 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/bo-vien-fuji.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/bun-gao.jpg b/src/main/webapp/view/assets/images/product_img/bun-gao.jpg new file mode 100644 index 0000000..dc6f40d Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/bun-gao.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/ca-hoi-tuoi.png b/src/main/webapp/view/assets/images/product_img/ca-hoi-tuoi.png new file mode 100644 index 0000000..ebb4137 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/ca-hoi-tuoi.png differ diff --git a/src/main/webapp/view/assets/images/product_img/chao-ca-hoi.jpg b/src/main/webapp/view/assets/images/product_img/chao-ca-hoi.jpg new file mode 100644 index 0000000..42a55a1 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/chao-ca-hoi.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/cu-kieu.jpg b/src/main/webapp/view/assets/images/product_img/cu-kieu.jpg new file mode 100644 index 0000000..616b963 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/cu-kieu.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/dao.jpg b/src/main/webapp/view/assets/images/product_img/dao.jpg new file mode 100644 index 0000000..6092282 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/dao.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/heo-ba-roi.png b/src/main/webapp/view/assets/images/product_img/heo-ba-roi.png new file mode 100644 index 0000000..2990f8d Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/heo-ba-roi.png differ diff --git a/src/main/webapp/view/assets/images/product_img/kem.jpg b/src/main/webapp/view/assets/images/product_img/kem.jpg new file mode 100644 index 0000000..9337476 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/kem.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/mi-omachi.jpg b/src/main/webapp/view/assets/images/product_img/mi-omachi.jpg new file mode 100644 index 0000000..f42dce0 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/mi-omachi.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/mi-xao.jpg b/src/main/webapp/view/assets/images/product_img/mi-xao.jpg new file mode 100644 index 0000000..29cf967 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/mi-xao.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/my-y.jpg b/src/main/webapp/view/assets/images/product_img/my-y.jpg new file mode 100644 index 0000000..245c494 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/my-y.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/nam.jpg b/src/main/webapp/view/assets/images/product_img/nam.jpg new file mode 100644 index 0000000..8a57527 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/nam.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/pate.jpg b/src/main/webapp/view/assets/images/product_img/pate.jpg new file mode 100644 index 0000000..8088cd1 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/pate.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/pizza.png b/src/main/webapp/view/assets/images/product_img/pizza.png new file mode 100644 index 0000000..e5ad14f Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/pizza.png differ diff --git a/src/main/webapp/view/assets/images/product_img/rau-cai-xanh.jpg b/src/main/webapp/view/assets/images/product_img/rau-cai-xanh.jpg new file mode 100644 index 0000000..4144c28 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/rau-cai-xanh.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/sot-ca-chua.jpg b/src/main/webapp/view/assets/images/product_img/sot-ca-chua.jpg new file mode 100644 index 0000000..18c76eb Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/sot-ca-chua.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/thanh-cua-mayumi.jpg b/src/main/webapp/view/assets/images/product_img/thanh-cua-mayumi.jpg new file mode 100644 index 0000000..7d367b3 Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/thanh-cua-mayumi.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/thit-bo.png b/src/main/webapp/view/assets/images/product_img/thit-bo.png new file mode 100644 index 0000000..3fd31ab Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/thit-bo.png differ diff --git a/src/main/webapp/view/assets/images/product_img/thit-ga.jpg b/src/main/webapp/view/assets/images/product_img/thit-ga.jpg new file mode 100644 index 0000000..9bf292e Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/thit-ga.jpg differ diff --git a/src/main/webapp/view/assets/images/product_img/thit-hop-hap.jpg b/src/main/webapp/view/assets/images/product_img/thit-hop-hap.jpg new file mode 100644 index 0000000..e0b193c Binary files /dev/null and b/src/main/webapp/view/assets/images/product_img/thit-hop-hap.jpg differ diff --git a/src/main/webapp/view/jsp/management/order/order-detail.jsp b/src/main/webapp/view/jsp/management/order/order-detail.jsp index d8ed993..1f13c52 100644 --- a/src/main/webapp/view/jsp/management/order/order-detail.jsp +++ b/src/main/webapp/view/jsp/management/order/order-detail.jsp @@ -133,6 +133,9 @@ Quay lại + + Tải xuống + diff --git a/src/main/webapp/view/jsp/management/product/product-detail.jsp b/src/main/webapp/view/jsp/management/product/product-detail.jsp index 34cedb7..85a8be8 100644 --- a/src/main/webapp/view/jsp/management/product/product-detail.jsp +++ b/src/main/webapp/view/jsp/management/product/product-detail.jsp @@ -98,7 +98,7 @@
Quên mật khẩu +
diff --git a/src/main/webapp/view/jsp/others/login/new-password.jsp b/src/main/webapp/view/jsp/others/login/new-password.jsp index 2b48516..a833b22 100644 --- a/src/main/webapp/view/jsp/others/login/new-password.jsp +++ b/src/main/webapp/view/jsp/others/login/new-password.jsp @@ -60,6 +60,7 @@ +
Quay lại
diff --git a/src/main/webapp/view/jsp/others/login/otp.jsp b/src/main/webapp/view/jsp/others/login/otp.jsp index 3d993ea..bb39d80 100644 --- a/src/main/webapp/view/jsp/others/login/otp.jsp +++ b/src/main/webapp/view/jsp/others/login/otp.jsp @@ -47,6 +47,7 @@ +
Quay Lại