├── .gitignore ├── .idea ├── .gitignore ├── artifacts │ └── rikky_takeaway_Web_exploded.xml ├── compiler.xml ├── dataSources.xml ├── easyCodeTableSetting.xml ├── encodings.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── jpa-buddy.xml ├── jsLibraryMappings.xml ├── libraries │ └── element_ui.xml ├── misc.xml ├── remote-targets.xml ├── uiDesigner.xml ├── vcs.xml └── webContexts.xml ├── LICENSE ├── README.md ├── img ├── 00874a5e-0df2-446b-8f69-a30eb7d88ee8.png ├── 057dd338-e487-4bbc-a74c-0384c44a9ca3.jpg ├── 0a3b3288-3446-4420-bbff-f263d0c02d8e.jpg ├── 0d4ed00e-f6e9-448e-acbf-c4251e06562a.jpg ├── 0f252364-a561-4e8d-8065-9a6797a6b1d3.jpg ├── 0f4bd884-dc9c-4cf9-b59e-7d5958fec3dd.jpg ├── 1405081e-f545-42e1-86a2-f7559ae2e276.jpeg ├── 1fdbfbf3-1d86-4b29-a3fc-46345852f2f8.jpg ├── 211d4248-a67c-404b-9def-7d55f32d1943.jpg ├── 2a2e9d66-b41d-4645-87bd-95f2cfeed218.jpg ├── 2a50628e-7758-4c51-9fbb-d37c61cdacad.jpg ├── 2e96a7e3-affb-438e-b7c3-e1430df425c9.jpeg ├── 3a6a37e1-de51-4987-a61a-8e52541364a1.jpg ├── 3fabb83a-1c09-4fd9-892b-4ef7457daafa.jpeg ├── 4544de06-a939-453b-bf64-bd00b9147908.jpg ├── 4d88f8d0-503b-40b3-8c1d-5973e627f2e2.jpg ├── 51cc53ea-2d57-4ec0-9299-a8058e7ea694.jpg ├── 583df4b7-a159-4cfc-9543-4f666120b25f.jpeg ├── 5b8d2da3-3744-4bb3-acdc-329056b8259d.jpeg ├── 740c79ce-af29-41b8-b78d-5f49c96e38c4.jpg ├── 785c5cbe-afcc-4afa-b56d-a54bff938044.jpg ├── 7b7b9481-602e-45ee-ae36-1e70c6b5551b.jpg ├── 8dcfda14-5712-4d28-82f7-ae905b3c2308.jpg ├── 8fd99731-5a26-4e8d-a9ed-25b64722b7d2.jpg ├── 9ec6fc2d-50d2-422e-b954-de87dcd04198.jpeg ├── a53a4e6a-3b83-4044-87f9-9d49b30a8fdc.jpg ├── b5590aa6-de72-4e36-b954-dbf73cb18eb5.jpg ├── c99e0aab-3cb7-4eaa-80fd-f47d4ffea694.png ├── choose.png ├── d2f61d70-ac85-4529-9b74-6d9a2255c6d7.jpg ├── dishes.png ├── e400affe-fb80-4505-99c7-22a0b9232f3a.jpg ├── e476f679-5c15-436b-87fa-8c4e9644bf33.jpeg ├── ee04a05a-1230-46b6-8ad5-1a95b140fff3.png ├── ef2b73f2-75d1-4d3a-beea-22da0e1421bd.jpg ├── f966a38e-0780-40be-bb52-5699d13cb3d9.jpg ├── login1.png └── login2.png ├── pom.xml ├── sql └── db.sql └── src ├── main ├── java │ └── com │ │ └── fubukiss │ │ └── rikky │ │ ├── RikkyApplication.java │ │ ├── common │ │ ├── BaseContext.java │ │ ├── CustomException.java │ │ ├── GlobalExceptionHandler.java │ │ ├── JacksonObjectMapper.java │ │ ├── MyMetaObjectHandler.java │ │ └── R.java │ │ ├── config │ │ ├── MybatisPlusConfig.java │ │ ├── RedisConfig.java │ │ └── WebMvcConfig.java │ │ ├── controller │ │ ├── AddressBookController.java │ │ ├── CategoryController.java │ │ ├── CommonController.java │ │ ├── DishController.java │ │ ├── EmployeeController.java │ │ ├── OrdersController.java │ │ ├── SetmealController.java │ │ ├── ShoppingCartController.java │ │ └── UserController.java │ │ ├── dto │ │ ├── DishDto.java │ │ ├── OrdersDto.java │ │ └── SetmealDto.java │ │ ├── entity │ │ ├── AddressBook.java │ │ ├── Category.java │ │ ├── Dish.java │ │ ├── DishFlavor.java │ │ ├── Employee.java │ │ ├── OrderDetail.java │ │ ├── Orders.java │ │ ├── Setmeal.java │ │ ├── SetmealDish.java │ │ ├── ShoppingCart.java │ │ └── User.java │ │ ├── filter │ │ └── LoginCheckFilter.java │ │ ├── mapper │ │ ├── AddressBookMapper.java │ │ ├── CategoryMapper.java │ │ ├── DishFlavorMapper.java │ │ ├── DishMapper.java │ │ ├── EmployeeMapper.java │ │ ├── OrderDetailMapper.java │ │ ├── OrdersMapper.java │ │ ├── SetmealDishMapper.java │ │ ├── SetmealMapper.java │ │ ├── ShoppingCartMapper.java │ │ └── UserMapper.java │ │ ├── service │ │ ├── AddressBookService.java │ │ ├── CategoryService.java │ │ ├── DishFlavorService.java │ │ ├── DishService.java │ │ ├── EmployeeService.java │ │ ├── OrderDetailService.java │ │ ├── OrdersService.java │ │ ├── SetmealDishService.java │ │ ├── SetmealService.java │ │ ├── ShoppingCartService.java │ │ ├── UserService.java │ │ └── impl │ │ │ ├── AddressBookServiceImpl.java │ │ │ ├── CategoryServiceImpl.java │ │ │ ├── DishFlavorServiceImpl.java │ │ │ ├── DishServiceImpl.java │ │ │ ├── EmployeeServiceImpl.java │ │ │ ├── OrderDetailServiceImpl.java │ │ │ ├── OrdersServiceImpl.java │ │ │ ├── SetmealDishServiceImpl.java │ │ │ ├── SetmealServiceImpl.java │ │ │ ├── ShoppingCartServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ └── util │ │ └── ValidateCodeUtils.java └── resources │ ├── application.yml │ ├── backend │ ├── api │ │ ├── category.js │ │ ├── combo.js │ │ ├── food.js │ │ ├── login.js │ │ ├── member.js │ │ └── order.js │ ├── favicon.ico │ ├── images │ │ ├── 404-images │ │ │ ├── 404-cloud.png │ │ │ └── 404.png │ │ ├── icons │ │ │ ├── btn_back@2x.png │ │ │ ├── btn_clean@2x.png │ │ │ ├── btn_close@2x.png │ │ │ ├── icon_index.png │ │ │ ├── icon_upload@2x.png │ │ │ ├── jine_m-2@2x.png │ │ │ ├── renshu@2x.png │ │ │ └── xiangmujine@2x.png │ │ ├── img_brand01@2x.png │ │ ├── img_denglu_bj.jpg │ │ ├── login │ │ │ ├── login-l.png │ │ │ ├── login-logo.png │ │ │ └── logo.png │ │ ├── logo.png │ │ └── noImg.png │ ├── index.html │ ├── js │ │ ├── common.js │ │ ├── index.js │ │ ├── request.js │ │ └── validate.js │ ├── page │ │ ├── category │ │ │ └── list.html │ │ ├── combo │ │ │ ├── add.html │ │ │ └── list.html │ │ ├── demo │ │ │ └── upload.html │ │ ├── food │ │ │ ├── add.html │ │ │ └── list.html │ │ ├── login │ │ │ └── login.html │ │ ├── member │ │ │ ├── add.html │ │ │ └── list.html │ │ └── order │ │ │ └── list.html │ ├── plugins │ │ ├── axios │ │ │ └── axios.min.js │ │ ├── element-ui │ │ │ ├── fonts │ │ │ │ ├── element-icons.ttf │ │ │ │ └── element-icons.woff │ │ │ ├── index.css │ │ │ └── index.js │ │ └── vue │ │ │ └── vue.js │ └── styles │ │ ├── common.css │ │ ├── fonts │ │ ├── element-icons.ttf │ │ └── element-icons.woff │ │ ├── icon │ │ ├── demo.css │ │ ├── demo_index.html │ │ ├── iconfont.css │ │ ├── iconfont.js │ │ ├── iconfont.json │ │ ├── iconfont.ttf │ │ ├── iconfont.woff │ │ └── iconfont.woff2 │ │ ├── index.css │ │ ├── login.css │ │ └── page.css │ ├── banner.txt │ └── front │ ├── api │ ├── address.js │ ├── login.js │ ├── main.js │ └── order.js │ ├── fonts │ ├── DIN-Bold.otf │ ├── DIN-Medium.otf │ ├── PingFangSC-Medium.ttf │ ├── PingFangSC-Regular.ttf │ └── PingFangSC-Semibold.ttf │ ├── images │ ├── add.png │ ├── cart.png │ ├── cart_active.png │ ├── checked_false.png │ ├── checked_true.png │ ├── close.png │ ├── demo1.png │ ├── demo2.png │ ├── demo3.png │ ├── demo4.png │ ├── edit.png │ ├── favico.ico │ ├── headPage.png │ ├── home.png │ ├── location.png │ ├── locations.png │ ├── logo.png │ ├── mainBg.png │ ├── money.png │ ├── noImg.png │ ├── no_order.png │ ├── no_wifi.png │ ├── orders.png │ ├── subtract.png │ ├── success.png │ ├── time.png │ ├── user.png │ └── women.png │ ├── index.html │ ├── js │ ├── base.js │ ├── common.js │ ├── request.js │ └── vant.min.js │ ├── page │ ├── add-order.html │ ├── address-edit.html │ ├── address.html │ ├── login.html │ ├── no-wify.html │ ├── order.html │ ├── pay-success.html │ └── user.html │ └── styles │ ├── add-order.css │ ├── address-edit.css │ ├── address.css │ ├── index.css │ ├── login.css │ ├── main.css │ ├── no-wify.css │ ├── order.css │ ├── pay-success.css │ ├── user.css │ └── vant.min.css └── test └── java └── com └── fubukiss └── test ├── MailSendTest.java └── UploadFileTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | /target/ 25 | /img/ 26 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/artifacts/rikky_takeaway_Web_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/rikky_takeaway_Web_exploded 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql.8 6 | true 7 | com.mysql.cj.jdbc.Driver 8 | jdbc:mysql://fubukiss.com:3306 9 | $ProjectFileDir$ 10 | 11 | 12 | redis 13 | true 14 | jdbc.RedisDriver 15 | jdbc:redis://localhost:6379/0 16 | $ProjectFileDir$ 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 64 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /.idea/jpa-buddy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/element_ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | -------------------------------------------------------------------------------- /.idea/remote-targets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/webContexts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /img/00874a5e-0df2-446b-8f69-a30eb7d88ee8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/00874a5e-0df2-446b-8f69-a30eb7d88ee8.png -------------------------------------------------------------------------------- /img/057dd338-e487-4bbc-a74c-0384c44a9ca3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/057dd338-e487-4bbc-a74c-0384c44a9ca3.jpg -------------------------------------------------------------------------------- /img/0a3b3288-3446-4420-bbff-f263d0c02d8e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/0a3b3288-3446-4420-bbff-f263d0c02d8e.jpg -------------------------------------------------------------------------------- /img/0d4ed00e-f6e9-448e-acbf-c4251e06562a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/0d4ed00e-f6e9-448e-acbf-c4251e06562a.jpg -------------------------------------------------------------------------------- /img/0f252364-a561-4e8d-8065-9a6797a6b1d3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/0f252364-a561-4e8d-8065-9a6797a6b1d3.jpg -------------------------------------------------------------------------------- /img/0f4bd884-dc9c-4cf9-b59e-7d5958fec3dd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/0f4bd884-dc9c-4cf9-b59e-7d5958fec3dd.jpg -------------------------------------------------------------------------------- /img/1405081e-f545-42e1-86a2-f7559ae2e276.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/1405081e-f545-42e1-86a2-f7559ae2e276.jpeg -------------------------------------------------------------------------------- /img/1fdbfbf3-1d86-4b29-a3fc-46345852f2f8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/1fdbfbf3-1d86-4b29-a3fc-46345852f2f8.jpg -------------------------------------------------------------------------------- /img/211d4248-a67c-404b-9def-7d55f32d1943.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/211d4248-a67c-404b-9def-7d55f32d1943.jpg -------------------------------------------------------------------------------- /img/2a2e9d66-b41d-4645-87bd-95f2cfeed218.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/2a2e9d66-b41d-4645-87bd-95f2cfeed218.jpg -------------------------------------------------------------------------------- /img/2a50628e-7758-4c51-9fbb-d37c61cdacad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/2a50628e-7758-4c51-9fbb-d37c61cdacad.jpg -------------------------------------------------------------------------------- /img/2e96a7e3-affb-438e-b7c3-e1430df425c9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/2e96a7e3-affb-438e-b7c3-e1430df425c9.jpeg -------------------------------------------------------------------------------- /img/3a6a37e1-de51-4987-a61a-8e52541364a1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/3a6a37e1-de51-4987-a61a-8e52541364a1.jpg -------------------------------------------------------------------------------- /img/3fabb83a-1c09-4fd9-892b-4ef7457daafa.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/3fabb83a-1c09-4fd9-892b-4ef7457daafa.jpeg -------------------------------------------------------------------------------- /img/4544de06-a939-453b-bf64-bd00b9147908.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/4544de06-a939-453b-bf64-bd00b9147908.jpg -------------------------------------------------------------------------------- /img/4d88f8d0-503b-40b3-8c1d-5973e627f2e2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/4d88f8d0-503b-40b3-8c1d-5973e627f2e2.jpg -------------------------------------------------------------------------------- /img/51cc53ea-2d57-4ec0-9299-a8058e7ea694.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/51cc53ea-2d57-4ec0-9299-a8058e7ea694.jpg -------------------------------------------------------------------------------- /img/583df4b7-a159-4cfc-9543-4f666120b25f.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/583df4b7-a159-4cfc-9543-4f666120b25f.jpeg -------------------------------------------------------------------------------- /img/5b8d2da3-3744-4bb3-acdc-329056b8259d.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/5b8d2da3-3744-4bb3-acdc-329056b8259d.jpeg -------------------------------------------------------------------------------- /img/740c79ce-af29-41b8-b78d-5f49c96e38c4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/740c79ce-af29-41b8-b78d-5f49c96e38c4.jpg -------------------------------------------------------------------------------- /img/785c5cbe-afcc-4afa-b56d-a54bff938044.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/785c5cbe-afcc-4afa-b56d-a54bff938044.jpg -------------------------------------------------------------------------------- /img/7b7b9481-602e-45ee-ae36-1e70c6b5551b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/7b7b9481-602e-45ee-ae36-1e70c6b5551b.jpg -------------------------------------------------------------------------------- /img/8dcfda14-5712-4d28-82f7-ae905b3c2308.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/8dcfda14-5712-4d28-82f7-ae905b3c2308.jpg -------------------------------------------------------------------------------- /img/8fd99731-5a26-4e8d-a9ed-25b64722b7d2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/8fd99731-5a26-4e8d-a9ed-25b64722b7d2.jpg -------------------------------------------------------------------------------- /img/9ec6fc2d-50d2-422e-b954-de87dcd04198.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/9ec6fc2d-50d2-422e-b954-de87dcd04198.jpeg -------------------------------------------------------------------------------- /img/a53a4e6a-3b83-4044-87f9-9d49b30a8fdc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/a53a4e6a-3b83-4044-87f9-9d49b30a8fdc.jpg -------------------------------------------------------------------------------- /img/b5590aa6-de72-4e36-b954-dbf73cb18eb5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/b5590aa6-de72-4e36-b954-dbf73cb18eb5.jpg -------------------------------------------------------------------------------- /img/c99e0aab-3cb7-4eaa-80fd-f47d4ffea694.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/c99e0aab-3cb7-4eaa-80fd-f47d4ffea694.png -------------------------------------------------------------------------------- /img/choose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/choose.png -------------------------------------------------------------------------------- /img/d2f61d70-ac85-4529-9b74-6d9a2255c6d7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/d2f61d70-ac85-4529-9b74-6d9a2255c6d7.jpg -------------------------------------------------------------------------------- /img/dishes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/dishes.png -------------------------------------------------------------------------------- /img/e400affe-fb80-4505-99c7-22a0b9232f3a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/e400affe-fb80-4505-99c7-22a0b9232f3a.jpg -------------------------------------------------------------------------------- /img/e476f679-5c15-436b-87fa-8c4e9644bf33.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/e476f679-5c15-436b-87fa-8c4e9644bf33.jpeg -------------------------------------------------------------------------------- /img/ee04a05a-1230-46b6-8ad5-1a95b140fff3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/ee04a05a-1230-46b6-8ad5-1a95b140fff3.png -------------------------------------------------------------------------------- /img/ef2b73f2-75d1-4d3a-beea-22da0e1421bd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/ef2b73f2-75d1-4d3a-beea-22da0e1421bd.jpg -------------------------------------------------------------------------------- /img/f966a38e-0780-40be-bb52-5699d13cb3d9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/f966a38e-0780-40be-bb52-5699d13cb3d9.jpg -------------------------------------------------------------------------------- /img/login1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/login1.png -------------------------------------------------------------------------------- /img/login2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/img/login2.png -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.springframework.boot 8 | spring-boot-starter-parent 9 | 2.4.5 10 | 11 | 12 | com.fubukiss 13 | rikky-takeaway 14 | 1.0-SNAPSHOT 15 | 16 | 1.8 17 | 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-web 34 | compile 35 | 36 | 37 | 38 | com.baomidou 39 | mybatis-plus-boot-starter 40 | 3.4.2 41 | 42 | 43 | 44 | org.projectlombok 45 | lombok 46 | 1.18.20 47 | 48 | 49 | 50 | com.alibaba 51 | fastjson 52 | 1.2.76 53 | 54 | 55 | 56 | commons-lang 57 | commons-lang 58 | 2.6 59 | 60 | 61 | 62 | mysql 63 | mysql-connector-java 64 | runtime 65 | 66 | 67 | 68 | com.alibaba 69 | druid-spring-boot-starter 70 | 1.1.23 71 | 72 | 73 | 74 | 75 | org.springframework.boot 76 | spring-boot-starter-mail 77 | 78 | 79 | 80 | 81 | redis.clients 82 | jedis 83 | 2.8.0 84 | 85 | 86 | 87 | 88 | org.springframework.boot 89 | spring-boot-starter-data-redis 90 | 91 | 92 | 93 | 94 | org.springframework.boot 95 | spring-boot-starter-cache 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | org.springframework.boot 104 | spring-boot-maven-plugin 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/RikkyApplication.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.web.servlet.ServletComponentScan; 7 | 8 | /** 9 | *

Project: rikky-takeaway - RikkyApplication 10 | *

Powered by Riverify On 12-14-2022 23:28:13 11 | *

该项目的github仓库 12 | * 13 | * @author Riverify 14 | * @version 1.0 15 | * @since JDK8 16 | */ 17 | @Slf4j 18 | @SpringBootApplication 19 | @ServletComponentScan // 扫描 Servlet、Filter、Listener 确保过滤器生效 20 | public class RikkyApplication { 21 | public static void main(String[] args) { 22 | SpringApplication.run(RikkyApplication.class, args); 23 | log.info("项目启动成功! [悦刻外卖 version: 1.1.2] https://github.com/Riverify/rikky-takeaway"); 24 | log.info("后台管理系统默认链接: http://localhost:8080/backend/index.html"); 25 | log.info("前台管理系统默认链接: http://localhost:8080/front/index.html"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/common/BaseContext.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.common; 2 | 3 | /** 4 | *

Project: rikky-takeaway - BaseContext 基于ThreadLocal封装的工具类,用于获取当前线程的用户信息 5 | *

Powered by Riverify On 12-28-2022 22:00:30 6 | * 7 | * @author Riverify 8 | * @version 1.0 9 | * @since JDK8 10 | */ 11 | public class BaseContext { 12 | private static final ThreadLocal threadLocal = new ThreadLocal<>(); 13 | 14 | public static void setCurrentId(Long id) { 15 | threadLocal.set(id); 16 | } 17 | 18 | public static long getCurrentId() { 19 | return threadLocal.get(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/common/CustomException.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.common; 2 | 3 | /** 4 | *

Project: rikky-takeaway - CustomException 自定义异常类 5 | *

Powered by river On 2023/01/08 8:52 PM 6 | * 7 | * @author Riverify 8 | * @version 1.0 9 | * @since JDK8 10 | */ 11 | public class CustomException extends RuntimeException { 12 | /** 13 | * 这个异常将会被{@link GlobalExceptionHandler}捕获,然后返回给前端。 14 | * 15 | * @param message 异常信息 16 | */ 17 | public CustomException(String message) { 18 | super(message); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/common/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.common; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.sql.SQLIntegrityConstraintViolationException; 11 | 12 | /** 13 | *

Project: rikky-takeaway - GlobalExceptionHandler 全局异常处理 14 | *

Powered by Riverify On 12-17-2022 23:21:42 15 | * 16 | *

通过 @ControllerAdvice注解声明一个控制器建言,对有 @RestController和 @Controller注解的控制器的方法加一些公共的操作 17 | *

通过 @ResponseBody注解将返回的数据转换成 JSON 格式 18 | *

通过 @Slf4j注解声明一个日志对象 19 | * 20 | * @author Riverify 21 | * @version 1.0 22 | * @since JDK8 23 | */ 24 | 25 | @ControllerAdvice(annotations = {RestController.class, Controller.class}) 26 | @ResponseBody 27 | @Slf4j 28 | public class GlobalExceptionHandler { 29 | 30 | /** 31 | * 处理异常{@link SQLIntegrityConstraintViolationException},本项目中主要处理注册时输入重复数据的异常 32 | *

SQL报错的错误信息进行切片处理,返回特定的错误信息,即某个账号已存在。 33 | *

通过 @ExceptionHandler注解声明该方法是一个异常处理方法,可以处理的异常类型为 {@link SQLIntegrityConstraintViolationException}。 34 | * 35 | * @param exception 异常,example:com.mysql.cj.jdbc.exceptions.SQLIntegrityConstraintViolationException: Duplicate entry 'riverify' for key 'username' 36 | * @return 返回一个通用的结果对象 37 | */ 38 | @ExceptionHandler(SQLIntegrityConstraintViolationException.class) 39 | public R exceptionHandler(SQLIntegrityConstraintViolationException exception) { 40 | log.error("SQLIntegrityConstraintViolationException异常: {}", exception.getMessage()); 41 | // 当异常信息中包含“Duplicate entry”时,说明是主键冲突异常,返回数据重复的错误信息 42 | if (exception.getMessage().contains("Duplicate entry")) { 43 | // 提取出错误的具体情况,并返回给前端 44 | String[] split = exception.getMessage().split("'"); // Duplicate entry 'riverify' for key 'employee.idx_username' 以单引号切片 45 | return R.error(split[1] + " 已存在"); // 返回数据重复的账号, 如 riverify已存在 46 | } 47 | // 其他异常,返回未知错误 48 | return R.error("操作失败,未知错误"); 49 | } 50 | 51 | /** 52 | * 处理自定义异常{@link CustomException},通过在程序中使用如:throw new CustomException("xxx")抛出异常后,在这里被捕获并返回给前端(使用R对象包装) 53 | *

通过 @ExceptionHandler注解声明该方法是一个异常处理方法,可以处理的异常类型为 {@link CustomException}。 54 | * 55 | * @param exception 自定义异常 56 | * @return 返回一个通用的结果对象,用于前端错误内容的展示 57 | */ 58 | @ExceptionHandler(CustomException.class) 59 | public R exceptionHandler(CustomException exception) { 60 | log.error("发生自定义异常: {}", exception.getMessage()); 61 | // 其他异常,返回未知错误 62 | return R.error(exception.getMessage()); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/common/JacksonObjectMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.common; 2 | 3 | import com.fasterxml.jackson.databind.DeserializationFeature; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.fasterxml.jackson.databind.module.SimpleModule; 6 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 7 | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; 8 | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; 9 | import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; 10 | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; 11 | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; 12 | import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; 13 | 14 | import java.math.BigInteger; 15 | import java.time.LocalDate; 16 | import java.time.LocalDateTime; 17 | import java.time.LocalTime; 18 | import java.time.format.DateTimeFormatter; 19 | 20 | import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; 21 | 22 | /** 23 | * 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象 24 | * 将JSON解析为Java对象的过程称为 [从JSON反序列化Java对象] 25 | * 从Java对象生成JSON的过程称为 [序列化Java对象到JSON] 26 | */ 27 | public class JacksonObjectMapper extends ObjectMapper { 28 | 29 | public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; 30 | public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; 31 | public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss"; 32 | 33 | public JacksonObjectMapper() { 34 | super(); 35 | //收到未知属性时不报异常 36 | this.configure(FAIL_ON_UNKNOWN_PROPERTIES, false); 37 | 38 | //反序列化时,属性不存在的兼容处理 39 | this.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); 40 | 41 | 42 | SimpleModule simpleModule = new SimpleModule() 43 | .addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))) 44 | .addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT))) 45 | .addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT))) 46 | 47 | .addSerializer(BigInteger.class, ToStringSerializer.instance) 48 | .addSerializer(Long.class, ToStringSerializer.instance) // Long类型转String,避免js精度丢失 49 | .addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))) 50 | .addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT))) 51 | .addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT))); 52 | 53 | //注册功能模块 例如,可以添加自定义序列化器和反序列化器 54 | this.registerModule(simpleModule); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/common/MyMetaObjectHandler.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.common; 2 | 3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.apache.ibatis.reflection.MetaObject; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | *

Project: rikky-takeaway - MetaObjectHandler 数据库相应字段的自动填充,自定义元数据对象处理器 12 | *

Powered by Riverify On 12-27-2022 20:05:51 13 | * 14 | * @author Riverify 15 | * @version 1.0 16 | * @since JDK8 17 | */ 18 | @Slf4j 19 | @Component 20 | public class MyMetaObjectHandler implements MetaObjectHandler { 21 | 22 | /** 23 | * 插入时自动填充 24 | * 25 | * @param metaObject 26 | */ 27 | @Override 28 | public void insertFill(MetaObject metaObject) { 29 | log.info("公共字段自动填充[insert]..."); 30 | log.info(metaObject.toString()); 31 | metaObject.setValue("createTime", LocalDateTime.now()); 32 | metaObject.setValue("updateTime", LocalDateTime.now()); 33 | metaObject.setValue("createUser", BaseContext.getCurrentId()); // 从 ThreadLocal 中获取当前用户的 id 34 | metaObject.setValue("updateUser", BaseContext.getCurrentId()); // 从 ThreadLocal 中获取当前用户的 id 35 | } 36 | 37 | 38 | /** 39 | * 更新时自动填充 40 | * 41 | * @param metaObject 42 | */ 43 | @Override 44 | public void updateFill(MetaObject metaObject) { 45 | log.info("公共字段自动填充[update]..."); 46 | log.info(metaObject.toString()); 47 | 48 | long id = Thread.currentThread().getId(); // 获取当前线程的id 49 | log.info("当前线程id={}", id); // Slf4j的日志输出 50 | 51 | metaObject.setValue("updateTime", LocalDateTime.now()); 52 | metaObject.setValue("updateUser", BaseContext.getCurrentId()); // 从ThreadLocal中获取当前线程的用户id 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/common/R.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.common; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | 9 | /** 10 | * 通用返回结果类 11 | *

服务端相应的数据最终都会封装成此对象 12 | * 13 | * @param 14 | */ 15 | @Data 16 | public class R { 17 | 18 | /** 19 | * 编码:1成功,0和其它数字为失败 20 | */ 21 | private Integer code; 22 | 23 | /** 24 | * 错误信息 25 | */ 26 | private String msg; 27 | 28 | /** 29 | * 具体数据 30 | */ 31 | private T data; 32 | 33 | /** 34 | * 动态数据 35 | */ 36 | private Map map = new HashMap(); 37 | 38 | 39 | /** 40 | * 成功即返回数据和成功代码 41 | * 42 | * @param object 成功的信息对象 43 | * @param 44 | * @return 返回该类的泛型的结果R对象,包含有成功代码和数据 45 | */ 46 | public static R success(T object) { 47 | R r = new R(); 48 | r.data = object; 49 | r.code = 1; 50 | return r; 51 | } 52 | 53 | /** 54 | * 失败 55 | * 56 | * @param msg 错误信息 57 | * @param 58 | * @return 返回该类的泛型的结果R对象,包含有失败代码和错误信息 59 | */ 60 | public static R error(String msg) { 61 | R r = new R(); 62 | r.msg = msg; 63 | r.code = 0; 64 | return r; 65 | } 66 | 67 | public R add(String key, Object value) { 68 | this.map.put(key, value); 69 | return this; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 4 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | *

Project: rikky-takeaway - MybatisPlusConfig 配置MP分页插件 10 | *

Powered by Riverify On 12-20-2022 16:25:03 11 | * 12 | * @author Riverify 13 | * @version 1.0 14 | * @since JDK8 15 | */ 16 | @Configuration 17 | public class MybatisPlusConfig { 18 | 19 | @Bean 20 | public MybatisPlusInterceptor mybatisPlusInterceptor() { 21 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); 22 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); // PaginationInnerInterceptor MP提供的分页插件 23 | return interceptor; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/config/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.config; 2 | 3 | import org.springframework.cache.annotation.CachingConfigurerSupport; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.redis.connection.RedisConnectionFactory; 7 | import org.springframework.data.redis.core.RedisTemplate; 8 | import org.springframework.data.redis.serializer.StringRedisSerializer; 9 | 10 | /** 11 | *

Project: rikky-takeaway - RedisConfig 12 | *

Powered by river On 2023/02/04 9:12 PM 13 | * 14 | * @author Riverify 15 | * @version 1.0 16 | * @since JDK8 17 | */ 18 | @Configuration 19 | public class RedisConfig extends CachingConfigurerSupport { 20 | 21 | @Bean 22 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) { 23 | RedisTemplate redisTemplate = new RedisTemplate<>(); 24 | redisTemplate.setConnectionFactory(factory); 25 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 26 | return redisTemplate; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.config; 2 | 3 | import com.fubukiss.rikky.common.JacksonObjectMapper; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.http.converter.HttpMessageConverter; 7 | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; 8 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | *

Project: rikky-takeaway - WebMvcConfig 用于静态资源映射 15 | *

Powered by Riverify On 12-14-2022 23:52:20 16 | * 17 | * @author Riverify 18 | * @version 1.0 19 | * @since JDK8 20 | */ 21 | @Slf4j 22 | @Configuration 23 | public class WebMvcConfig extends WebMvcConfigurationSupport { 24 | 25 | 26 | /** 27 | * 设置静态资源映射 28 | */ 29 | @Override 30 | protected void addResourceHandlers(ResourceHandlerRegistry registry) { 31 | // 用于设置静态资源映射 32 | log.info("开始进行静态资源映射..."); 33 | long l = System.currentTimeMillis(); 34 | registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/"); 35 | registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/"); 36 | log.info("静态资源映射完毕 [用时" + (System.currentTimeMillis() - l) + "ms]"); 37 | } 38 | 39 | /** 40 | * 扩展mvc消息转换器 41 | *

由于原本的自带消息转换器不能够处理好前端js数据丢失的问题,例如19位的id会被转换成18位,所以需要自定义消息转换器,这个转换器在common的JacksonConfig中已经定义好了, 42 | * 可以将long类型的数据转换成String类型的数据传到前端,这样前端就不会丢失数据了。 43 | * 44 | * @param converters 消息转换器列表 45 | */ 46 | @Override 47 | protected void extendMessageConverters(List> converters) { 48 | // 创建消息转换器对象 49 | MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); 50 | // 设置对象转换器,底层使用Jackson将对象转换成json字符串 51 | converter.setObjectMapper(new JacksonObjectMapper()); 52 | // 将自定义的消息转换器添加到消息转换器列表中 53 | converters.add(0, converter); // 0表示将自定义的消息转换器放在第一个位置 54 | 55 | log.info("自定义消息转换器已经添加到消息转换器列表中"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/controller/AddressBookController.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 5 | import com.fubukiss.rikky.common.BaseContext; 6 | import com.fubukiss.rikky.common.R; 7 | import com.fubukiss.rikky.entity.AddressBook; 8 | import com.fubukiss.rikky.service.AddressBookService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 地址簿管理 17 | */ 18 | @Slf4j 19 | @RestController 20 | @RequestMapping("/addressBook") 21 | public class AddressBookController { 22 | 23 | @Autowired 24 | private AddressBookService addressBookService; 25 | 26 | /** 27 | *

新增地址

28 | * 29 | * @param addressBook 地址簿,@RequestBody注解表示接收json格式的数据 30 | * @return {@link R} 31 | */ 32 | @PostMapping 33 | public R save(@RequestBody AddressBook addressBook) { 34 | addressBook.setUserId(BaseContext.getCurrentId()); 35 | log.info("addressBook:{}", addressBook); 36 | addressBookService.save(addressBook); 37 | return R.success(addressBook); 38 | } 39 | 40 | /** 41 | *

设置默认地址

42 | * 43 | * @param addressBook 地址簿,@RequestBody注解表示接收json格式的数据 44 | * @return {@link R} 45 | */ 46 | @PutMapping("default") 47 | public R setDefault(@RequestBody AddressBook addressBook) { 48 | log.info("addressBook:{}", addressBook); 49 | LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); 50 | wrapper.eq(AddressBook::getUserId, BaseContext.getCurrentId()); 51 | wrapper.set(AddressBook::getIsDefault, 0); 52 | //SQL:update address_book set is_default = 0 where user_id = ? 53 | addressBookService.update(wrapper); 54 | 55 | addressBook.setIsDefault(1); 56 | //SQL:update address_book set is_default = 1 where id = ? 57 | addressBookService.updateById(addressBook); 58 | return R.success(addressBook); 59 | } 60 | 61 | /** 62 | *

根据id查询地址

63 | * 64 | * @param id 地址id,@PathVariable注解表示从url中?之前的参数中获取 65 | * @return {@link R} 66 | */ 67 | @GetMapping("/{id}") 68 | public R get(@PathVariable Long id) { 69 | AddressBook addressBook = addressBookService.getById(id); 70 | if (addressBook != null) { 71 | return R.success(addressBook); // fixme: 回传到前端的数据中,label字段没法对应到前端的label的选中状态 72 | } else { 73 | return R.error("没有找到该对象"); 74 | } 75 | } 76 | 77 | /** 78 | *

查询默认地址

79 | * 80 | * @return {@link R} 81 | */ 82 | @GetMapping("default") 83 | public R getDefault() { 84 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 85 | queryWrapper.eq(AddressBook::getUserId, BaseContext.getCurrentId()); 86 | queryWrapper.eq(AddressBook::getIsDefault, 1); 87 | 88 | //SQL:select * from address_book where user_id = ? and is_default = 1 89 | AddressBook addressBook = addressBookService.getOne(queryWrapper); 90 | 91 | if (null == addressBook) { 92 | return R.error("没有找到该对象"); 93 | } else { 94 | return R.success(addressBook); 95 | } 96 | } 97 | 98 | /** 99 | *

查询指定用户的全部地址

100 | * 101 | * @param addressBook 地址簿,@RequestBody注解表示接收json格式的数据 102 | * @return {@link R} 103 | */ 104 | @GetMapping("/list") 105 | public R> list(AddressBook addressBook) { 106 | addressBook.setUserId(BaseContext.getCurrentId()); 107 | log.info("addressBook:{}", addressBook); 108 | 109 | //条件构造器 110 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 111 | queryWrapper.eq(null != addressBook.getUserId(), AddressBook::getUserId, addressBook.getUserId()); 112 | queryWrapper.orderByDesc(AddressBook::getUpdateTime); 113 | 114 | //SQL:select * from address_book where user_id = ? order by update_time desc 115 | return R.success(addressBookService.list(queryWrapper)); 116 | } 117 | 118 | 119 | /** 120 | *

修改地址本

121 | * 122 | * @param addressBook 地址簿,@RequestBody注解表示接收json格式的数据 123 | * @return {@link R} 124 | */ 125 | @PutMapping 126 | public R update(@RequestBody AddressBook addressBook) { 127 | log.info("修改后的addressBook:{}", addressBook); 128 | // SQL: update address_book set name = ?, phone = ?, address = ?, is_default = ?, update_time = ? where id = ? 129 | addressBookService.updateById(addressBook); 130 | 131 | return R.success(addressBook); 132 | } 133 | 134 | 135 | /** 136 | *

根据id删除地址本

137 | * 138 | * @param ids 地址id 139 | * @return {@link R} 140 | */ 141 | @DeleteMapping 142 | public R delete(Long ids) { 143 | log.info("删除的id:{}", ids); 144 | addressBookService.removeById(ids); 145 | 146 | return R.success("删除成功"); 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/controller/CategoryController.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.controller; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.fubukiss.rikky.common.CustomException; 6 | import com.fubukiss.rikky.common.R; 7 | import com.fubukiss.rikky.entity.Category; 8 | import com.fubukiss.rikky.service.CategoryService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | *

Project: rikky-takeaway - CategoryController 分类管理的Controller类 17 | *

Powered by Riverify On 01-02-2023 21:48:43 18 | * 19 | * @author Riverify 20 | * @version 1.0 21 | * @since JDK8 22 | */ 23 | @Slf4j 24 | @RestController 25 | @RequestMapping("/category") 26 | public class CategoryController { 27 | 28 | @Autowired 29 | private CategoryService categoryService; 30 | 31 | 32 | /** 33 | *

新增菜品分类

34 | * 35 | * @param category 菜品分类实体类,@RequestBody注解用于接收前端传递的json数据 36 | * @return 返回R对象,R对象为自定义的返回对象,用于统一返回数据格式 37 | */ 38 | @PostMapping 39 | public R save(@RequestBody Category category) { 40 | log.info("新增菜品分类,category={}", category); 41 | categoryService.save(category); // 调用Service层的save方法,将category保存到数据库 42 | 43 | return R.success("新增成功"); 44 | } 45 | 46 | 47 | /** 48 | *

显示菜品分类列表

49 | * 50 | * @param page 前端传递的分页参数 51 | * @param pageSize 前端传递的分页参数 52 | * @return 返回R对象,R对象为自定义的返回对象,用于统一返回数据格式,这里返回的是分页对象,在前端页面中,我们需要将分页对象中的数据进行展示 53 | */ 54 | @GetMapping("/page") 55 | public R page(int page, int pageSize) { 56 | // 构造分页构造器 57 | Page pageInfo = new Page<>(); 58 | // 构造条件构造器 -- 由于要根据Category的sort字段进行排序,所以需要使用LambdaQueryWrapper 59 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 60 | // 添加排序条件 使用sort字段进行排序,asc为升序,desc为降序 61 | queryWrapper.orderByAsc(Category::getSort); // Category::getSort 为Lambda表达式,等价于Category::getSort(),即调用Category的getSort()方法 62 | // 调用Service层的page方法,将分页构造器和条件构造器传入,返回分页数据 63 | categoryService.page(pageInfo, queryWrapper); // 调用Service层的page方法,将分页构造器和条件构造器传入,返回分页数据,得到的数据会自动填充到pageInfo中 64 | 65 | return R.success(pageInfo); // 返回分页数据 66 | } 67 | 68 | 69 | /** 70 | *

根据id删除菜品分类

71 | *

如果分类或套餐中仍有菜品,则不允许删除,抛出{@link CustomException}异常 72 | * 73 | * @param id 菜品分类id 74 | * @return 返回结果 75 | */ 76 | @DeleteMapping 77 | public R delete(Long id) { 78 | log.info("删除菜品分类,id={}", id); 79 | categoryService.remove(id); // 调用Service层的remove方法,根据id删除菜品分类,这里的remove为非MP自带的方法,是自己在Service层中添加的方法 80 | 81 | return R.success("分类信息删除成功"); 82 | } 83 | 84 | 85 | /** 86 | *

修改菜品分类信息

87 | * 88 | * @param category 菜品分类实体类,@RequestBody注解用于接收前端传递的json数据 89 | * @return 返回通用返回结果类 90 | */ 91 | @PutMapping 92 | public R update(@RequestBody Category category) { 93 | log.info("修改菜品分类信息:{}", category); 94 | categoryService.updateById(category); // 调用Service层的updateById方法,根据id修改菜品分类信息 95 | 96 | return R.success("修改信息成功"); 97 | } 98 | 99 | 100 | /** 101 | *

根据type获取菜品分类列表或套餐分类列表

102 | * 103 | * @param category 实体类,用于接收前端传递的参数。在前端需要获取分类信息列表以添加菜品时,实体类内的参数为type = 1(1为菜品,2为套餐)。 104 | * 同时本方法也能有其他类似功能,返回为List。由于前段传入的不是json数据,所以不需要使用@RequestBody注解。 105 | * @return 返回分类的List 106 | */ 107 | @GetMapping("/list") 108 | public R> list(Category category) { 109 | // 条件构造器 type = ? 110 | LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); 111 | // 添加条件 type = ? 112 | lambdaQueryWrapper.eq(category.getType() != null, Category::getType, category.getType()); // 第一个参数为条件,如果为true,则添加条件,否则不添加 113 | // 添加排序条件 sort asc by 'sort', and then desc by 'update_time' 114 | lambdaQueryWrapper.orderByAsc(Category::getSort).orderByDesc(Category::getUpdateTime); 115 | // 调用Service层的list方法,将条件构造器传入,返回分类的List 116 | List list = categoryService.list(lambdaQueryWrapper); 117 | 118 | // 返回分类的List 119 | return R.success(list); 120 | } 121 | 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/controller/CommonController.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.controller; 2 | 3 | import com.fubukiss.rikky.common.R; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | import org.springframework.web.multipart.MultipartFile; 11 | 12 | import javax.servlet.ServletOutputStream; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.File; 15 | import java.io.FileInputStream; 16 | import java.io.FileNotFoundException; 17 | import java.io.IOException; 18 | import java.util.UUID; 19 | 20 | /** 21 | *

Project: rikky-takeaway - CommonController 公共Controller类 22 | *

Powered by river On 2023/01/09 7:56 PM 23 | * 24 | * @author Riverify 25 | * @version 1.0 26 | * @since JDK8 27 | */ 28 | @RestController 29 | @Slf4j 30 | @RequestMapping("/common") 31 | public class CommonController { 32 | 33 | /** 34 | * file将会存放的位置,通过@Value注解获取配置文件中的值 35 | */ 36 | @Value("${rikky.linux-path}") 37 | private String basePath; 38 | 39 | 40 | /** 41 | * 文件上传 42 | * 43 | * @param file 文件,file是一个临时文件,需要将其转存到指定目录,否则会被删除 44 | * @return 通用返回对象 45 | */ 46 | @PostMapping("/upload") 47 | public R upload(MultipartFile file) { // !!!参数名必须为与前端的请求name保持一致 48 | log.info("文件上传:{}", file.toString()); 49 | 50 | // 获取原始文件名 51 | String originalFilename = file.getOriginalFilename(); 52 | // 获取文件后缀 53 | assert originalFilename != null; 54 | String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); 55 | // 使用UUID生成文件名 56 | String fileName = UUID.randomUUID() + suffix; 57 | // 创建一个目录,判断是否存在,不存在则创建 58 | File dir = new File(basePath); 59 | if (!dir.exists()) { 60 | dir.mkdirs(); 61 | } 62 | 63 | try { 64 | file.transferTo(new File(basePath + fileName)); // 将文件转存到指定目录 65 | } catch (IOException e) { 66 | e.printStackTrace(); 67 | } 68 | 69 | // 返回文件名 70 | return R.success(fileName); 71 | } 72 | 73 | 74 | /** 75 | * 文件下载 76 | * 77 | * @param name 文件名 78 | * @param response 存放文件的response 79 | */ 80 | @GetMapping("/download") 81 | public void download(String name, HttpServletResponse response) { 82 | FileInputStream fileInputStream = null; // 文件输入流 83 | ServletOutputStream outputStream = null; // 输出流 84 | 85 | try { 86 | // 输入流,通过输入读取文件内容 87 | fileInputStream = new FileInputStream(new File(basePath + name)); 88 | // 输出流,通过输出将文件写回浏览器,在浏览器展示图片 89 | outputStream = response.getOutputStream(); 90 | // 读取文件内容,写回浏览器 91 | byte[] bytes = new byte[1024]; // 1KB 92 | int length = 0; // 每次读取的长度 93 | while ((length = fileInputStream.read(bytes)) != -1) { // 读取文件内容 94 | outputStream.write(bytes, 0, length); // 将文件内容写回浏览器 95 | outputStream.flush(); // 刷新缓冲区 96 | } 97 | 98 | // 设置响应头,告诉浏览器以图片的形式打开 99 | response.setContentType("image/jpeg"); 100 | 101 | } catch (FileNotFoundException e) { 102 | e.printStackTrace(); 103 | } catch (IOException e) { 104 | throw new RuntimeException(e); 105 | } finally { 106 | // 关闭流 107 | try { 108 | if (fileInputStream != null) { 109 | fileInputStream.close(); 110 | } 111 | if (outputStream != null) { 112 | outputStream.close(); 113 | } 114 | } catch (IOException e) { 115 | e.printStackTrace(); 116 | } 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/controller/OrdersController.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.controller; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.fubukiss.rikky.common.R; 5 | import com.fubukiss.rikky.dto.OrdersDto; 6 | import com.fubukiss.rikky.entity.Orders; 7 | import com.fubukiss.rikky.service.OrdersService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.format.annotation.DateTimeFormat; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Date; 14 | 15 | /** 16 | * FileName: OrdersController 17 | * Date: 2023/01/21 18 | * Time: 11:07 19 | * Author: river 20 | */ 21 | @Slf4j 22 | @RestController 23 | @RequestMapping("/order") 24 | public class OrdersController { 25 | 26 | /** 27 | * 订单服务 28 | */ 29 | @Autowired 30 | private OrdersService ordersService; 31 | 32 | 33 | /** 34 | *

提交订单

35 | * 36 | * @param orders 订单信息 37 | * @return {@link R} 38 | */ 39 | @PostMapping("/submit") 40 | public R submit(@RequestBody Orders orders) { 41 | log.info("submit order: {}", orders); 42 | ordersService.submit(orders); 43 | return R.success("订单提交成功"); 44 | } 45 | 46 | 47 | /** 48 | *

分页查询用户的订单详情

49 | * 50 | * @param page 页码 51 | * @param pageSize 每页数量 52 | * @return {@link R} 53 | */ 54 | @GetMapping("/userPage") 55 | public R> userPage(int page, int pageSize) { 56 | // 获取用户订单分页 57 | Page userPage = ordersService.getUserPage(page, pageSize); 58 | 59 | return R.success(userPage); 60 | } 61 | 62 | 63 | /** 64 | *

分页查询总订单,如果有订单号或者日期,则同时考虑订单号和日期

65 | * 66 | * @param page 页码 67 | * @param pageSize 每页数量 68 | * @param number 订单号 69 | * @param beginTime 开始时间 70 | * @param endTime 结束时间 71 | * @return {@link R} 72 | */ 73 | @GetMapping("/page") 74 | public R> page( 75 | int page, 76 | int pageSize, 77 | String number, 78 | @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") Date beginTime, 79 | @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") Date endTime) { 80 | log.info( 81 | "订单分页查询:page={},pageSize={},number={},beginTime={},endTime={}", 82 | page, 83 | pageSize, 84 | number, 85 | beginTime, 86 | endTime); 87 | // 根据以上信息进行分页查询。 88 | // 创建分页对象 89 | Page pageInfo = ordersService.getPage(page, pageSize, number, beginTime, endTime); 90 | 91 | return R.success(pageInfo); 92 | } 93 | 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/controller/ShoppingCartController.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.controller; 2 | 3 | 4 | import com.fubukiss.rikky.common.R; 5 | import com.fubukiss.rikky.entity.ShoppingCart; 6 | import com.fubukiss.rikky.service.ShoppingCartService; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * FileName: ShoppingCartController 15 | * Date: 2023/01/19 16 | * Time: 21:19 17 | * Author: river 18 | */ 19 | @RestController 20 | @Slf4j 21 | @RequestMapping("/shoppingCart") 22 | public class ShoppingCartController { 23 | 24 | /** 25 | * 购物车服务 26 | */ 27 | @Autowired 28 | private ShoppingCartService shoppingCartService; 29 | 30 | 31 | /** 32 | *

查看购物车

33 | * 34 | * @return 购物车列表 35 | */ 36 | @GetMapping("/list") 37 | public R> list() { 38 | log.info("查看购物车"); 39 | List shoppingCarts = shoppingCartService.showCart(); 40 | 41 | return R.success(shoppingCarts); 42 | } 43 | 44 | 45 | /** 46 | *

添加某个菜品或套餐到购物车

47 | * 48 | * @param shoppingCart 要添加到购物车的菜品,@RequestBody是从json中获取数据 49 | * @return 购物车类 50 | */ 51 | @PostMapping("/add") 52 | public R add(@RequestBody ShoppingCart shoppingCart) { 53 | log.info("添加购物车:{}", shoppingCart); // 打印日志 54 | ShoppingCart shoppingCartOne = shoppingCartService.addToCart(shoppingCart);// 添加到购物车 55 | 56 | return R.success(shoppingCartOne); 57 | } 58 | 59 | /** 60 | *

减少某个菜品或套餐到购物车

61 | * 62 | * @param shoppingCart 要减少的菜品,@RequestBody是从json中获取数据 63 | * @return 购物车类 64 | */ 65 | @PostMapping("/sub") 66 | public R sub(@RequestBody ShoppingCart shoppingCart) { 67 | log.info("购物车:{}", shoppingCart); // 打印日志 68 | ShoppingCart shoppingCartOne = shoppingCartService.subInCart(shoppingCart);// 添加到购物车 69 | 70 | return R.success(shoppingCartOne); 71 | } 72 | 73 | 74 | /** 75 | *

清空购物车

76 | * 77 | * @return 消息 78 | */ 79 | @DeleteMapping("/clean") 80 | public R clean() { 81 | log.info("清空购物车"); 82 | shoppingCartService.cleanCart(); 83 | 84 | return R.success("清空购物车成功"); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.controller; 2 | 3 | import com.alibaba.druid.util.StringUtils; 4 | import com.fubukiss.rikky.common.R; 5 | import com.fubukiss.rikky.entity.User; 6 | import com.fubukiss.rikky.service.UserService; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.servlet.http.HttpSession; 15 | import java.util.Map; 16 | 17 | /** 18 | * FileName: UserController 用户控制器 19 | * Date: 2023/01/16 20 | * Time: 20:27 21 | * Author: river 22 | */ 23 | @Slf4j 24 | @RestController 25 | @RequestMapping("/user") 26 | public class UserController { 27 | 28 | /** 29 | * 用户服务 30 | */ 31 | @Autowired 32 | private UserService userService; 33 | 34 | /** 35 | *

发送验证码

36 | * 37 | * @param user 前端传来的用户实体类,主要是邮箱地址 38 | * @param session 会话 39 | * @return 通用返回类 40 | */ 41 | @PostMapping("/sendMsg") 42 | public R sendMsg(@RequestBody User user, HttpSession session) { 43 | log.info("发送验证码,用户信息:{},session:{}", user, session); 44 | // 获得前端登陆邮箱地址 45 | String email = user.getEmail(); 46 | // 判断邮箱地址是否为空 47 | if (!StringUtils.isEmpty(email)) { 48 | // 发送验证码 49 | userService.sendCode(email, session); // 通过工具类发送验证码,sendCode方法在UserService接口中 50 | return R.success("发送成功,请及时查看邮箱"); 51 | } 52 | return R.error("发送失败"); 53 | } 54 | 55 | 56 | /** 57 | *

验证码登陆账号

58 | *

如果为新用户,则自动注册 59 | * 60 | * @param map 前端传来的用户实体类,主要是邮箱地址和验证码 61 | * @param session 会话 62 | * @return 返回User实体类,以在浏览器保存该信息 63 | */ 64 | @PostMapping("/login") 65 | public R login(@RequestBody Map map, HttpSession session) { 66 | log.info("用户登陆,用户信息:{},session:{}", map.toString(), session); 67 | // 从map里获取邮箱地址和验证码 68 | String email = (String) map.get("email"); 69 | String code = (String) map.get("code"); 70 | // 判断邮箱地址和验证码是否为空 71 | if (!StringUtils.isEmpty(email) && !StringUtils.isEmpty(code)) { 72 | // 验证码登陆 73 | User user = userService.loginByVerificationCode(email, code, session);// 通过工具类发送验证码,login方法在UserService接口中 74 | return R.success(user); 75 | } 76 | return R.error("登陆失败,请检查邮箱地址和验证码"); 77 | } 78 | 79 | 80 | /** 81 | *

退出登陆

82 | * 83 | * @param session 会话 84 | * @return 通用返回类 85 | */ 86 | @PostMapping("/loginout") 87 | public R logout(HttpSession session) { 88 | log.info("用户登出,session:{}", session); 89 | // 清除session 90 | session.invalidate(); // 通过session.invalidate()方法清除本次会话 91 | return R.success("登出成功"); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/dto/DishDto.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.dto; 2 | 3 | import com.fubukiss.rikky.entity.Dish; 4 | import com.fubukiss.rikky.entity.DishFlavor; 5 | import lombok.Data; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | 11 | /** 12 | *

Project: rikky-takeaway - DishDto 菜品数据传输对象 13 | *

Powered by river On 2023/01/12 5:32 PM 14 | *

15 | *


16 | * dto: data transfer object,主要用于多表查询时,将查询结果封装成一个对象,方便前端使用,如在本项目的菜品新增中,前端需要传入菜品的基本信息, 17 | * 以及菜品的口味信息,而菜品和菜品口味是两张表,在后端拥有两个实体类,所以需要将这两个实体类封装成一个对象。 18 | *
19 | * 20 | * @author Riverify 21 | * @version 1.0 22 | * @since JDK8 23 | */ 24 | @Data 25 | public class DishDto extends Dish { // 这里继承了Dish实体类,所以DishDto对象中拥有Dish实体类中的所有属性 26 | 27 | /** 28 | * 风味 29 | */ 30 | private List flavors = new ArrayList<>(); // 同一个食材可以有多个风味选项,故这里使用List 31 | 32 | /** 33 | * 分类名 34 | */ 35 | private String categoryName; 36 | 37 | private Integer copies; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/dto/OrdersDto.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.dto; 2 | 3 | import com.fubukiss.rikky.entity.OrderDetail; 4 | import com.fubukiss.rikky.entity.Orders; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | public class OrdersDto extends Orders { 11 | 12 | private String userName; 13 | 14 | private String email; 15 | 16 | private String address; 17 | 18 | private String consignee; 19 | 20 | private List orderDetails; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/dto/SetmealDto.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.dto; 2 | 3 | import com.fubukiss.rikky.entity.Setmeal; 4 | import com.fubukiss.rikky.entity.SetmealDish; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | *

Project: rikky-takeaway - SetmealDto 套餐数据传输对象 12 | *

Powered by river On 2023/01/14 5:23 PM 13 | *

14 | *


15 | * dto: data transfer object,主要用于多表查询时,将查询结果封装成一个对象,方便前端使用。 16 | *
17 | * 18 | * @author Riverify 19 | * @version 1.0 20 | * @since JDK8 21 | */ 22 | @Data 23 | public class SetmealDto extends Setmeal { 24 | 25 | private List setmealDishes; 26 | 27 | private String categoryName; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/AddressBook.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableLogic; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.time.LocalDateTime; 10 | 11 | /** 12 | * 地址簿 13 | */ 14 | @Data 15 | public class AddressBook implements Serializable { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | private Long id; 20 | 21 | 22 | //用户id 23 | private Long userId; 24 | 25 | 26 | //收货人 27 | private String consignee; 28 | 29 | 30 | //手机号 31 | private String phone; 32 | 33 | 34 | //性别 0 女 1 男 35 | private String sex; 36 | 37 | 38 | //省级区划编号 39 | private String provinceCode; 40 | 41 | 42 | //省级名称 43 | private String provinceName; 44 | 45 | 46 | //市级区划编号 47 | private String cityCode; 48 | 49 | 50 | //市级名称 51 | private String cityName; 52 | 53 | 54 | //区级区划编号 55 | private String districtCode; 56 | 57 | 58 | //区级名称 59 | private String districtName; 60 | 61 | 62 | //详细地址 63 | private String detail; 64 | 65 | 66 | //标签 67 | private String label; 68 | 69 | //是否默认 0 否 1是 70 | private Integer isDefault; 71 | 72 | //创建时间 73 | @TableField(fill = FieldFill.INSERT) 74 | private LocalDateTime createTime; 75 | 76 | 77 | //更新时间 78 | @TableField(fill = FieldFill.INSERT_UPDATE) 79 | private LocalDateTime updateTime; 80 | 81 | 82 | //创建人 83 | @TableField(fill = FieldFill.INSERT) 84 | private Long createUser; 85 | 86 | 87 | //修改人 88 | @TableField(fill = FieldFill.INSERT_UPDATE) 89 | private Long updateUser; 90 | 91 | 92 | //是否删除 93 | @TableLogic(value = "0", delval = "1") // 逻辑删除注解,value为未删除的值,delval为删除的值 94 | private Integer isDeleted; 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/Category.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 分类 12 | */ 13 | @Data 14 | public class Category implements Serializable { 15 | 16 | private static final long serialVersionUID = 1L; 17 | 18 | private Long id; 19 | 20 | 21 | //类型 1 菜品分类 2 套餐分类 22 | private Integer type; 23 | 24 | 25 | //分类名称 26 | private String name; 27 | 28 | 29 | //顺序 30 | private Integer sort; 31 | 32 | 33 | //创建时间 34 | @TableField(fill = FieldFill.INSERT) 35 | private LocalDateTime createTime; 36 | 37 | 38 | //更新时间 39 | @TableField(fill = FieldFill.INSERT_UPDATE) 40 | private LocalDateTime updateTime; 41 | 42 | 43 | //创建人 44 | @TableField(fill = FieldFill.INSERT) 45 | private Long createUser; 46 | 47 | 48 | //修改人 49 | @TableField(fill = FieldFill.INSERT_UPDATE) 50 | private Long updateUser; 51 | 52 | 53 | //是否删除 54 | // private Integer isDeleted; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/Dish.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableLogic; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.math.BigDecimal; 10 | import java.time.LocalDateTime; 11 | 12 | /** 13 | * 菜品 14 | */ 15 | @Data 16 | public class Dish implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | private Long id; 21 | 22 | 23 | //菜品名称 24 | private String name; 25 | 26 | 27 | //菜品分类id 28 | private Long categoryId; 29 | 30 | 31 | //菜品价格 32 | private BigDecimal price; 33 | 34 | 35 | //商品码 36 | private String code; 37 | 38 | 39 | //图片 40 | private String image; 41 | 42 | 43 | //描述信息 44 | private String description; 45 | 46 | 47 | //0 停售 1 起售 48 | private Integer status; 49 | 50 | 51 | //顺序 52 | private Integer sort; 53 | 54 | 55 | @TableField(fill = FieldFill.INSERT) 56 | private LocalDateTime createTime; 57 | 58 | 59 | @TableField(fill = FieldFill.INSERT_UPDATE) 60 | private LocalDateTime updateTime; 61 | 62 | 63 | @TableField(fill = FieldFill.INSERT) 64 | private Long createUser; 65 | 66 | 67 | @TableField(fill = FieldFill.INSERT_UPDATE) 68 | private Long updateUser; 69 | 70 | 71 | //是否删除 72 | @TableLogic(value = "0", delval = "1") // 逻辑删除注解,value为未删除的值,delval为删除的值 73 | private Integer isDeleted; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/DishFlavor.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 菜品口味 12 | */ 13 | @Data 14 | public class DishFlavor implements Serializable { 15 | 16 | private static final long serialVersionUID = 1L; 17 | 18 | private Long id; 19 | 20 | 21 | //菜品id 22 | private Long dishId; 23 | 24 | 25 | //口味名称 26 | private String name; 27 | 28 | 29 | //口味数据list 30 | private String value; 31 | 32 | 33 | @TableField(fill = FieldFill.INSERT) 34 | private LocalDateTime createTime; 35 | 36 | 37 | @TableField(fill = FieldFill.INSERT_UPDATE) 38 | private LocalDateTime updateTime; 39 | 40 | 41 | @TableField(fill = FieldFill.INSERT) 42 | private Long createUser; 43 | 44 | 45 | @TableField(fill = FieldFill.INSERT_UPDATE) 46 | private Long updateUser; 47 | 48 | 49 | //是否删除 50 | private Integer isDeleted; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/Employee.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 员工实体类 12 | */ 13 | @Data 14 | public class Employee implements Serializable { 15 | 16 | private static final long serialVersionUID = 1L; 17 | 18 | /** 19 | * 员工id 20 | */ 21 | private Long id; 22 | 23 | /** 用户名 */ 24 | private String username; 25 | 26 | /** 姓名 */ 27 | private String name; 28 | 29 | /** 密码 */ 30 | private String password; 31 | 32 | /** 手机号码 */ 33 | private String phone; 34 | 35 | /** 性别 */ 36 | private String sex; 37 | 38 | /** 39 | * 身份证号码 40 | *

使用了驼峰命名法,和数据库 employee 表中的 id_number 不同。 41 | *

通过在 application.yml 的 mybatis-plus.configuration.map-underscore-to-camel-case 属性设置为 true 42 | * Mybatis Plus 帮助我们自动实现驼峰命名向 underline 模式的转换。 43 | *

之后的几个变量亦是如此。 44 | */ 45 | private String idNumber; 46 | 47 | /** 员工状态:1为在职 */ 48 | private Integer status; 49 | 50 | /** 创建时间 */ 51 | @TableField(fill = FieldFill.INSERT) // 自动填充,插入时自动填充 Mybatis Plus功能 52 | private LocalDateTime createTime; 53 | 54 | /** 更新时间 */ 55 | @TableField(fill = FieldFill.INSERT_UPDATE) // 自动填充,插入和更新时自动填充 56 | private LocalDateTime updateTime; 57 | 58 | @TableField(fill = FieldFill.INSERT) // 自动填充,插入时自动填充 59 | private Long createUser; 60 | 61 | @TableField(fill = FieldFill.INSERT_UPDATE) // 自动填充,插入和更新时自动填充 62 | private Long updateUser; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.math.BigDecimal; 7 | 8 | /** 9 | * 订单明细 10 | */ 11 | @Data 12 | public class OrderDetail implements Serializable { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private Long id; 17 | 18 | //名称 19 | private String name; 20 | 21 | //订单id 22 | private Long orderId; 23 | 24 | 25 | //菜品id 26 | private Long dishId; 27 | 28 | 29 | //套餐id 30 | private Long setmealId; 31 | 32 | 33 | //口味 34 | private String dishFlavor; 35 | 36 | 37 | //数量 38 | private Integer number; 39 | 40 | //金额 41 | private BigDecimal amount; 42 | 43 | //图片 44 | private String image; 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/Orders.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.math.BigDecimal; 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | * 订单 11 | */ 12 | @Data 13 | public class Orders implements Serializable { 14 | 15 | private static final long serialVersionUID = 1L; 16 | 17 | private Long id; 18 | 19 | //订单号 20 | private String number; 21 | 22 | //订单状态 1待付款,2待派送,3已派送,4已完成,5已取消 23 | private Integer status; 24 | 25 | 26 | //下单用户id 27 | private Long userId; 28 | 29 | //地址id 30 | private Long addressBookId; 31 | 32 | 33 | //下单时间 34 | private LocalDateTime orderTime; 35 | 36 | 37 | //结账时间 38 | private LocalDateTime checkoutTime; 39 | 40 | 41 | //支付方式 1微信,2支付宝 42 | private Integer payMethod; 43 | 44 | 45 | //实收金额 46 | private BigDecimal amount; 47 | 48 | //备注 49 | private String remark; 50 | 51 | //用户名 52 | private String userName; 53 | 54 | //手机号 55 | private String phone; 56 | 57 | //地址 58 | private String address; 59 | 60 | //收货人 61 | private String consignee; 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/Setmeal.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableLogic; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.math.BigDecimal; 10 | import java.time.LocalDateTime; 11 | 12 | /** 13 | * 套餐 14 | */ 15 | @Data 16 | public class Setmeal implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | private Long id; 21 | 22 | 23 | //分类id 24 | private Long categoryId; 25 | 26 | 27 | //套餐名称 28 | private String name; 29 | 30 | 31 | //套餐价格 32 | private BigDecimal price; 33 | 34 | 35 | //状态 0:停用 1:启用 36 | private Integer status; 37 | 38 | 39 | //编码 40 | private String code; 41 | 42 | 43 | //描述信息 44 | private String description; 45 | 46 | 47 | //图片 48 | private String image; 49 | 50 | 51 | @TableField(fill = FieldFill.INSERT) 52 | private LocalDateTime createTime; 53 | 54 | 55 | @TableField(fill = FieldFill.INSERT_UPDATE) 56 | private LocalDateTime updateTime; 57 | 58 | 59 | @TableField(fill = FieldFill.INSERT) 60 | private Long createUser; 61 | 62 | 63 | @TableField(fill = FieldFill.INSERT_UPDATE) 64 | private Long updateUser; 65 | 66 | 67 | //是否删除 68 | @TableLogic(value = "0", delval = "1") // 逻辑删除注解,value为未删除的值,delval为删除的值 69 | private Integer isDeleted; 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/SetmealDish.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableLogic; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.math.BigDecimal; 10 | import java.time.LocalDateTime; 11 | 12 | /** 13 | * 套餐菜品关系 14 | */ 15 | @Data 16 | public class SetmealDish implements Serializable { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | private Long id; 21 | 22 | 23 | //套餐id 24 | private Long setmealId; 25 | 26 | 27 | //菜品id 28 | private Long dishId; 29 | 30 | 31 | //菜品名称 (冗余字段) 32 | private String name; 33 | 34 | //菜品原价 35 | private BigDecimal price; 36 | 37 | //份数 38 | private Integer copies; 39 | 40 | 41 | //排序 42 | private Integer sort; 43 | 44 | 45 | @TableField(fill = FieldFill.INSERT) 46 | private LocalDateTime createTime; 47 | 48 | 49 | @TableField(fill = FieldFill.INSERT_UPDATE) 50 | private LocalDateTime updateTime; 51 | 52 | 53 | @TableField(fill = FieldFill.INSERT) 54 | private Long createUser; 55 | 56 | 57 | @TableField(fill = FieldFill.INSERT_UPDATE) 58 | private Long updateUser; 59 | 60 | 61 | //是否删除 62 | @TableLogic(value = "0", delval = "1") // 逻辑删除注解,value为未删除的值,delval为删除的值 63 | private Integer isDeleted; 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/ShoppingCart.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.math.BigDecimal; 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | * 购物车 11 | */ 12 | @Data 13 | public class ShoppingCart implements Serializable { 14 | 15 | private static final long serialVersionUID = 1L; 16 | 17 | private Long id; 18 | 19 | //名称 20 | private String name; 21 | 22 | //用户id 23 | private Long userId; 24 | 25 | //菜品id 26 | private Long dishId; 27 | 28 | //套餐id 29 | private Long setmealId; 30 | 31 | //口味 32 | private String dishFlavor; 33 | 34 | //数量 35 | private Integer number; 36 | 37 | //金额 38 | private BigDecimal amount; 39 | 40 | //图片 41 | private String image; 42 | 43 | // @TableField(fill = FieldFill.INSERT) 44 | private LocalDateTime createTime; 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 用户信息 9 | */ 10 | @Data 11 | public class User implements Serializable { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | private Long id; 16 | 17 | 18 | //姓名 19 | private String name; 20 | 21 | 22 | //邮箱地址 23 | private String email; 24 | 25 | 26 | //性别 0 女 1 男 27 | private String sex; 28 | 29 | 30 | //身份证号 31 | private String idNumber; 32 | 33 | 34 | //头像 35 | private String avatar; 36 | 37 | 38 | //状态 0:禁用,1:正常 39 | private Integer status; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/filter/LoginCheckFilter.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.filter; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.fubukiss.rikky.common.BaseContext; 5 | import com.fubukiss.rikky.common.R; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.util.AntPathMatcher; 8 | 9 | import javax.servlet.*; 10 | import javax.servlet.annotation.WebFilter; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.io.IOException; 14 | 15 | /** 16 | *

Project: rikky-takeaway - LoginCheckFilter 自定义过滤器,检查用户是否登录 17 | *

Powered by Riverify On 12-16-2022 22:59:51 18 | * 19 | *

通过 @WebFilter 注解,将过滤器注册到 Servlet 容器中。 20 | *
urlPatterns 属性指定过滤器拦截的请求路径。"/*" 表示拦截所有请求。 21 | *
filterName 属性指定过滤器的名称。 22 | *

通过 @Slf4j 注解,自动注入日志对象。 23 | * 24 | *

该过滤器的处理逻辑:
25 | * 1.获取本次处理的url。
26 | * 2.判断本次请求是否需要处理。
27 | * 3.如果不需要处理,则直接放行。
28 | * 4.判断登陆状态,如果为已登录,则放行。
29 | * 5.如果未登录,则返回未登录结果。
30 | *

31 | * 32 | * @author Riverify 33 | * @version 1.0 34 | * @since JDK8 35 | */ 36 | @WebFilter(filterName = "loginCheckFilter", urlPatterns = "/*") // "/*"表示拦截所有请求 37 | @Slf4j 38 | public class LoginCheckFilter implements Filter { 39 | 40 | // 路径匹配器 41 | public static final AntPathMatcher PATH_MATCHER = new AntPathMatcher(); 42 | 43 | 44 | @Override 45 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 46 | 47 | // 将ServletRequest和ServletResponse转换成HttpServletRequest和HttpServletResponse 48 | HttpServletRequest request = (HttpServletRequest) servletRequest; 49 | HttpServletResponse response = (HttpServletResponse) servletResponse; 50 | 51 | // 1.获取本次处理的url 52 | String requestURI = request.getRequestURI(); 53 | log.info("请求路径:{}", requestURI); // Slf4j的日志输出 54 | 55 | // 2.判断本次请求是否需要处理 56 | String[] urls = new String[]{ 57 | "/employee/login", 58 | "/employee/logout", 59 | "/backend/**", 60 | "/front/**", 61 | "/user/login", 62 | "/user/sendMsg" 63 | }; // 不需要处理的url 64 | 65 | boolean needProcess = check(urls, requestURI); // 判断本次请求是否需要处理 66 | 67 | // 3.如果不需要处理,则直接放行 68 | if (needProcess) { 69 | log.info("本次请求{}不需要处理,直接放行", requestURI); // Slf4j的日志输出 70 | filterChain.doFilter(request, response); // 直接放行 71 | return; // 结束方法 72 | } 73 | 74 | // 4-1.判断员工登陆状态,如果为已登录,则放行 75 | Object employeeId = request.getSession().getAttribute("employee"); // 获取session中的employee对象 76 | if (employeeId != null) { 77 | log.info("本次请求{},用户id={},已登录,直接放行", requestURI, employeeId); // Slf4j的日志输出 78 | 79 | // 在该线程中保存当前用户的id,BaseContext为common包中的工具类,用于保存当前线程的数据 80 | BaseContext.setCurrentId((Long) employeeId); 81 | 82 | filterChain.doFilter(request, response); // 放行 83 | return; // 结束方法 84 | } 85 | 86 | // 4-2.判断用户登陆状态,如果为已登录,则放行 87 | if (request.getSession().getAttribute("user") != null) { 88 | log.info("本次请求{},用户id={},已登录,直接放行", requestURI, request.getSession().getAttribute("user")); // Slf4j的日志输出 89 | 90 | Long userId = (Long) request.getSession().getAttribute("user"); 91 | // 在该线程中保存当前用户的id,BaseContext为common包中的工具类,用于保存当前线程的数据 92 | BaseContext.setCurrentId(userId); 93 | 94 | filterChain.doFilter(request, response); // 放行 95 | return; // 结束方法 96 | } 97 | 98 | // 5.如果未登录,则返回未登录结果 99 | // 由于前端代码中引入了js/request.js,相应拦截器会帮我们跳转到登录页面,所以这里不需要跳转,只需要返回未登录结果即可 100 | // 即只要通过输出流,包装通用返回结果类,返回未登录结果即可 101 | response.getWriter().write(JSON.toJSONString(R.error("NOTLOGIN"))); // 通过输出流,返回未登录结果 102 | log.info("本次请求{}用户未登录,返回未登录结果", requestURI); // Slf4j的日志输出 103 | 104 | } 105 | 106 | 107 | /** 108 | * 路径匹配
109 | * 判断本次请求是否需要处理。 110 | * 111 | * @param urls 不需要处理的url 112 | * @param requestURI 本次请求的url 113 | * @return true:本次请求的url匹配其中一个不需要处理的urls,不处理;false:否则需要处理 114 | */ 115 | public boolean check(String[] urls, String requestURI) { 116 | for (String url : urls) { 117 | if (PATH_MATCHER.match(url, requestURI)) { 118 | return true; 119 | } 120 | } 121 | return false; 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/AddressBookMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.AddressBook; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - AddressBookMapper 9 | *

Powered by river On 2023/01/19 1:40 AM 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface AddressBookMapper extends BaseMapper { 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.Category; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - CategoryMapper 分类Mapper接口 9 | *

Powered by Riverify On 01-02-2023 21:42:06 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface CategoryMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/DishFlavorMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.DishFlavor; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - DishFlavorMapper 菜品口味Mapper 9 | *

Powered by river On 2023/01/12 2:43 PM 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface DishFlavorMapper extends BaseMapper { 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/DishMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.Dish; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - DishMapper 菜品Mapper 9 | *

Powered by river On 2023/01/06 11:07 PM 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface DishMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/EmployeeMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.Employee; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - EmployeeMapper 9 | *

Powered by Riverify On 12-15-2022 18:37:54 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface EmployeeMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/OrderDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.OrderDetail; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * FileName: OrderDetailMapper 9 | * Date: 2023/01/20 10 | * Time: 23:51 11 | * Author: river 12 | */ 13 | @Mapper 14 | public interface OrderDetailMapper extends BaseMapper { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/OrdersMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.Orders; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * FileName: OrdersMapper 9 | * Date: 2023/01/20 10 | * Time: 23:49 11 | * Author: river 12 | */ 13 | @Mapper 14 | public interface OrdersMapper extends BaseMapper { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/SetmealDishMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.SetmealDish; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - SetmealDishMapper 套餐菜品关联Mapper 9 | *

Powered by river On 2023/01/14 5:30 PM 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface SetmealDishMapper extends BaseMapper { 17 | // 这里不需要写任何方法,因为BaseMapper中已经包含了常用的增删改查方法 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/SetmealMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.Setmeal; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

Project: rikky-takeaway - SetmealMapper 套餐Mapper 9 | *

Powered by river On 2023/01/06 11:09 PM 10 | * 11 | * @author Riverify 12 | * @version 1.0 13 | * @since JDK8 14 | */ 15 | @Mapper 16 | public interface SetmealMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/ShoppingCartMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.ShoppingCart; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * FileName: ShoppingCartMapper 9 | * Date: 2023/01/19 10 | * Time: 21:12 11 | * Author: river 12 | */ 13 | @Mapper 14 | public interface ShoppingCartMapper extends BaseMapper { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.fubukiss.rikky.entity.User; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * FileName: UserMapper 9 | * Date: 2023/01/16 10 | * Time: 20:18 11 | * Author: river 12 | */ 13 | @Mapper 14 | public interface UserMapper extends BaseMapper { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/AddressBookService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.AddressBook; 5 | 6 | /** 7 | *

Project: rikky-takeaway - AddressBookService 8 | *

Powered by river On 2023/01/19 1:41 AM 9 | * 10 | * @author Riverify 11 | * @version 1.0 12 | * @since JDK8 13 | */ 14 | public interface AddressBookService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.Category; 5 | 6 | /** 7 | *

Project: rikky-takeaway - CategoryService 分类Service接口 8 | *

Powered by Riverify On 01-02-2023 21:43:56 9 | * 10 | * @author Riverify 11 | * @version 1.0 12 | * @since JDK8 13 | */ 14 | public interface CategoryService extends IService { 15 | 16 | /** 17 | * 删除分类 18 | * 19 | * @param id 分类id 20 | */ 21 | void remove(Long id); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/DishFlavorService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.DishFlavor; 5 | 6 | /** 7 | *

Project: rikky-takeaway - DishFlavorService 菜品口味Service 8 | *

Powered by river On 2023/01/12 2:45 PM 9 | * 10 | * @author Riverify 11 | * @version 1.0 12 | * @since JDK8 13 | */ 14 | public interface DishFlavorService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/DishService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.fubukiss.rikky.controller.CommonController; 6 | import com.fubukiss.rikky.dto.DishDto; 7 | import com.fubukiss.rikky.entity.Dish; 8 | 9 | import java.util.List; 10 | 11 | 12 | /** 13 | *

Project: rikky-takeaway - DishService 菜品Service 14 | *

Powered by river On 2023/01/06 11:10 PM 15 | * 16 | * @author Riverify 17 | * @version 1.0 18 | * @since JDK8 19 | */ 20 | public interface DishService extends IService { 21 | 22 | /** 23 | * 添加菜品,同时插入口味的数据 24 | * 25 | * @param dishDto 菜品数据 26 | */ 27 | void saveWithFlavors(DishDto dishDto); 28 | 29 | 30 | /** 31 | * 更新菜品,同时更新口味的数据 32 | * 33 | * @param dishDto 菜品数据 34 | */ 35 | void updateWithFlavors(DishDto dishDto); 36 | 37 | /** 38 | * 根据id获得菜品和口味的数据 39 | * 40 | * @param id 菜品id 41 | * @return 菜品数据(包含口味数据) 42 | */ 43 | DishDto getByIdWithFlavors(Long id); 44 | 45 | /** 46 | * 获得所有菜品和口味的数据 47 | * 48 | * @return 菜品数据List(包含口味数据) 49 | */ 50 | List listWithFlavors(Dish dish); 51 | 52 | 53 | /** 54 | * 修改菜品状态,如果是在售状态则修改为下架,如果是下架状态则修改为在售 55 | * 56 | * @param ids 菜品id 57 | * @param status 需要修改成的状态 58 | */ 59 | void updateDishStatus(String ids, Integer status); 60 | 61 | 62 | /** 63 | * 删除菜品(逻辑删除) 64 | * 65 | * @param ids 前端传入的菜品id,可能是一个,也可能是多个,多个数据是以逗号分隔的 66 | */ 67 | void deleteByIds(String ids); 68 | 69 | 70 | /** 71 | * 分页查询菜品 72 | *

其中菜品的图片由{@link CommonController}提供下载到页面的功能。 73 | * 74 | * @param page 前端传入的分页参数,一次性传入当前页码 75 | * @param pageSize 前端传入的分页参数,一次性传入每页显示的条数 76 | * @param name 查询条件,如果name为空,则查询所有菜品 77 | * @return Page对象,mybatis-plus提供的分页对象,包含了分页的所有信息 78 | */ 79 | Page page(int page, int pageSize, String name); 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/EmployeeService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.Employee; 5 | 6 | /** 7 | *

Project: rikky-takeaway - EmployeeService 8 | *

Powered by Riverify On 12-15-2022 18:47:37 9 | * 10 | * @author Riverify 11 | * @version 1.0 12 | * @since JDK8 13 | */ 14 | public interface EmployeeService extends IService { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/OrderDetailService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.OrderDetail; 5 | 6 | /** 7 | * FileName: OrderDetailService 8 | * Date: 2023/01/20 9 | * Time: 23:51 10 | * Author: river 11 | */ 12 | public interface OrderDetailService extends IService { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/OrdersService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.fubukiss.rikky.dto.OrdersDto; 6 | import com.fubukiss.rikky.entity.Orders; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import java.util.Date; 10 | 11 | /** 12 | * FileName: OrdersService 13 | * Date: 2023/01/20 14 | * Time: 23:51 15 | * Author: river 16 | */ 17 | public interface OrdersService extends IService { 18 | 19 | /** 20 | * 用户下单 21 | * 22 | * @param orders 订单信息 23 | */ 24 | void submit(Orders orders); 25 | 26 | 27 | /** 28 | * 获取用户订单分页 29 | * 30 | * @param page 页码 31 | * @param pageSize 每页数量 32 | * @return 分页数据 33 | */ 34 | Page getUserPage(int page, int pageSize); 35 | 36 | 37 | /** 38 | * 获取管理员订单详情 39 | * 40 | * @param page 页码 41 | * @param pageSize 每页数量 42 | * @param number 订单号 43 | * @param beginTime 开始时间 44 | * @param endTime 结束时间 45 | */ 46 | Page getPage(int page, 47 | int pageSize, 48 | String number, 49 | @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") Date beginTime, 50 | @DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss") Date endTime); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/SetmealDishService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.SetmealDish; 5 | 6 | /** 7 | *

Project: rikky-takeaway - SetmealDishService 套餐菜品关联Service 8 | *

Powered by river On 2023/01/14 5:31 PM 9 | * 10 | * @author Riverify 11 | * @version 1.0 12 | * @since JDK8 13 | */ 14 | public interface SetmealDishService extends IService { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/SetmealService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.fubukiss.rikky.dto.SetmealDto; 6 | import com.fubukiss.rikky.entity.Setmeal; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

Project: rikky-takeaway - SetmealService 12 | *

Powered by river On 2023/01/06 11:11 PM 13 | * 14 | * @author Riverify 15 | * @version 1.0 16 | * @since JDK8 17 | */ 18 | public interface SetmealService extends IService { 19 | 20 | /** 21 | * 新增套餐,同时需要保存套餐和菜品的关联关系 22 | * 23 | * @param setmealDto 套餐数据传输对象 24 | */ 25 | void saveWithDishes(SetmealDto setmealDto); 26 | 27 | /** 28 | * 删除套餐,同时需要删除套餐和菜品的关联数据 29 | * 30 | * @param ids 套餐id列表 31 | */ 32 | void removeWithDishes(List ids); 33 | 34 | /** 35 | * 修改套餐状态,如果是在售状态则修改为下架,如果是下架状态则修改为在售 36 | * 37 | * @param ids 套餐id列表 38 | * @param status 需要修改的状态 39 | */ 40 | void changeStatus(List ids, Integer status); 41 | 42 | /** 43 | * 根据id获取某套餐的基本信息和套餐所含菜品 44 | * 45 | * @param id 套餐id 46 | */ 47 | SetmealDto getByIdWithDishes(Long id); 48 | 49 | /** 50 | * 更新套餐信息,同时更新套餐和菜品的关联关系 51 | * 52 | * @param setmealDto 套餐数据传输对象 53 | */ 54 | void updateWithDishes(SetmealDto setmealDto); 55 | 56 | /** 57 | * 获取所有套餐的基本信息和套餐所含菜品 58 | * 59 | * @param setmeal 套餐查询条件 60 | */ 61 | List listWithDishes(Setmeal setmeal); 62 | 63 | /** 64 | * 分页查询套餐信息 65 | * 66 | * @param page 当前页 67 | * @param pageSize 每页显示条数 68 | * @param name 套餐名称 69 | */ 70 | Page page(int page, int pageSize, String name); 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/ShoppingCartService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.ShoppingCart; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * FileName: ShoppingCartService 10 | * Date: 2023/01/19 11 | * Time: 21:12 12 | * Author: river 13 | */ 14 | public interface ShoppingCartService extends IService { 15 | 16 | /** 17 | * 添加菜品或套餐到购物车,如果加入同一份,数量累加 18 | * 19 | * @param shoppingCart 要添加的菜品 20 | * @return 添加后的购物车 21 | */ 22 | ShoppingCart addToCart(ShoppingCart shoppingCart); 23 | 24 | /** 25 | * 减少菜品或套餐到购物车,如果是最后一份,取消该菜品或套餐 26 | * 27 | * @param shoppingCart 要减少的菜品 28 | * @return 减少后的购物车 29 | */ 30 | ShoppingCart subInCart(ShoppingCart shoppingCart); 31 | 32 | /** 33 | * 展示购物车 34 | * 35 | * @return 购物车列表 36 | */ 37 | List showCart(); 38 | 39 | /** 40 | * 清空购物车 41 | */ 42 | void cleanCart(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.fubukiss.rikky.entity.User; 5 | 6 | import javax.servlet.http.HttpSession; 7 | 8 | /** 9 | * FileName: UserService 10 | * Date: 2023/01/16 11 | * Time: 20:24 12 | * Author: river 13 | */ 14 | public interface UserService extends IService { 15 | 16 | /** 17 | * 发送验证码 18 | * 19 | * @param email 邮箱地址 20 | * @param session 会话 21 | */ 22 | void sendCode(String email, HttpSession session); 23 | 24 | 25 | /** 26 | * 验证码登陆账号,如果是新用户,则自动注册 27 | * 28 | * @param email 邮箱地址 29 | * @param code 验证码 30 | * @param session 会话 31 | * @return 用户信息 32 | */ 33 | User loginByVerificationCode(String email, String code, HttpSession session); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/AddressBookServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.fubukiss.rikky.entity.AddressBook; 5 | import com.fubukiss.rikky.mapper.AddressBookMapper; 6 | import com.fubukiss.rikky.service.AddressBookService; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

Project: rikky-takeaway - AddressBookServiceImpl 12 | *

Powered by river On 2023/01/19 1:42 AM 13 | * 14 | * @author Riverify 15 | * @version 1.0 16 | * @since JDK8 17 | */ 18 | @Service 19 | @Slf4j 20 | public class AddressBookServiceImpl extends ServiceImpl implements AddressBookService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.fubukiss.rikky.common.CustomException; 6 | import com.fubukiss.rikky.entity.Category; 7 | import com.fubukiss.rikky.entity.Dish; 8 | import com.fubukiss.rikky.entity.Setmeal; 9 | import com.fubukiss.rikky.mapper.CategoryMapper; 10 | import com.fubukiss.rikky.service.CategoryService; 11 | import com.fubukiss.rikky.service.DishService; 12 | import com.fubukiss.rikky.service.SetmealService; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | 16 | /** 17 | *

Project: rikky-takeaway - CategoryServiceImpl 18 | *

Powered by Riverify On 01-02-2023 21:44:52 19 | * 20 | * @author Riverify 21 | * @version 1.0 22 | * @since JDK8 23 | */ 24 | @Service 25 | public class CategoryServiceImpl extends ServiceImpl implements CategoryService { 26 | // ServiceImpl 为MyBatis-Plus提供的基础实现类, 为泛型,CategoryMapper为Mapper接口,Category为实体类 27 | 28 | 29 | // 注入菜品和套餐的Service,用于remove()中使用,判断分类下是否有菜品或套餐 30 | @Autowired 31 | private DishService dishService; 32 | @Autowired 33 | private SetmealService setmealService; 34 | 35 | 36 | /** 37 | * 自定义一个删除删除分类的服务满足特殊业务需求,即在删除之前需要判断该分类下是否有菜品(Dish)或者套餐(Setmeal),如果有则不能删除该分类 38 | * 39 | * @param id 分类id 40 | */ 41 | @Override 42 | public void remove(Long id) { 43 | // 构造Dish查询条件 44 | LambdaQueryWrapper dishLambdaQueryWrapper = new LambdaQueryWrapper<>(); 45 | dishLambdaQueryWrapper.eq(Dish::getCategoryId, id); // eq means : where "getCategoryId" = "id" 46 | int count = dishService.count(dishLambdaQueryWrapper); // count means : select count(*) from "Dish" 47 | // 查询当前分类是否关联了菜品,如果关联了则不能删除,抛出一个业务异常 48 | if (count > 0) { 49 | throw new CustomException("该分类下存在菜品,故不能删除"); 50 | } 51 | 52 | // 构造Setmeal查询条件(同上) 53 | LambdaQueryWrapper setmealLambdaQueryWrapper = new LambdaQueryWrapper<>(); 54 | setmealLambdaQueryWrapper.eq(Setmeal::getCategoryId, id); 55 | count = setmealService.count(setmealLambdaQueryWrapper); 56 | // 同理查询分类是否关联了套餐,如果关联了则不能删除,抛出一个业务异常 57 | if (count > 0) { 58 | throw new CustomException("该分类下存在套餐,故不能删除"); 59 | } 60 | 61 | // 正常删除分类 62 | super.removeById(id); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/DishFlavorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.fubukiss.rikky.entity.DishFlavor; 5 | import com.fubukiss.rikky.mapper.DishFlavorMapper; 6 | import com.fubukiss.rikky.service.DishFlavorService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

Project: rikky-takeaway - DishFlavorServiceImpl 11 | *

Powered by river On 2023/01/12 2:46 PM 12 | * 13 | * @author Riverify 14 | * @version 1.0 15 | * @since JDK8 16 | */ 17 | @Service 18 | public class DishFlavorServiceImpl extends ServiceImpl implements DishFlavorService { 19 | // ServiceImpl 为MyBatis-Plus提供的基础实现类, 为泛型,DishFlavorMapper为Mapper接口,DishFlavor为实体类 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/EmployeeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.fubukiss.rikky.entity.Employee; 5 | import com.fubukiss.rikky.mapper.EmployeeMapper; 6 | import com.fubukiss.rikky.service.EmployeeService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

Project: rikky-takeaway - EmployeeServiceImpl 11 | *

Powered by Riverify On 12-15-2022 18:48:58 12 | * 13 | * @author Riverify 14 | * @version 1.0 15 | * @since JDK8 16 | */ 17 | @Service 18 | public class EmployeeServiceImpl extends ServiceImpl implements EmployeeService { 19 | // ServiceImpl 为MyBatis-Plus提供的基础实现类,<>中的两个泛型分别为Mapper接口和Entity实体类 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/OrderDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.fubukiss.rikky.entity.OrderDetail; 5 | import com.fubukiss.rikky.mapper.OrderDetailMapper; 6 | import com.fubukiss.rikky.service.OrderDetailService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * FileName: OrderDetailServiceImpl 11 | * Date: 2023/01/20 12 | * Time: 23:58 13 | * Author: river 14 | */ 15 | @Service 16 | public class OrderDetailServiceImpl extends ServiceImpl implements OrderDetailService { 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/SetmealDishServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.fubukiss.rikky.entity.SetmealDish; 5 | import com.fubukiss.rikky.mapper.SetmealDishMapper; 6 | import com.fubukiss.rikky.service.SetmealDishService; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

Project: rikky-takeaway - SetmealDishServiceImpl 套餐菜品关联Service实现类 12 | *

Powered by river On 2023/01/14 5:32 PM 13 | * 14 | * @author Riverify 15 | * @version 1.0 16 | * @since JDK8 17 | */ 18 | @Slf4j 19 | @Service 20 | public class SetmealDishServiceImpl extends ServiceImpl implements SetmealDishService { 21 | // 代表了继承了BaseMapper中的方法,以及SetmealDish实体类 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/ShoppingCartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.fubukiss.rikky.common.BaseContext; 6 | import com.fubukiss.rikky.entity.ShoppingCart; 7 | import com.fubukiss.rikky.mapper.ShoppingCartMapper; 8 | import com.fubukiss.rikky.service.ShoppingCartService; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.time.LocalDateTime; 12 | import java.util.List; 13 | 14 | /** 15 | * FileName: ShoppingCartServiceImpl 购物车服务实现类 16 | * Date: 2023/01/19 17 | * Time: 21:13 18 | * Author: river 19 | */ 20 | @Service 21 | public class ShoppingCartServiceImpl extends ServiceImpl implements ShoppingCartService { 22 | 23 | /** 24 | * 添加菜品或套餐 到购物车,如果加入同一份,数量累加 25 | * 26 | * @param shoppingCart 要添加的菜品 27 | * @return 添加后的购物车 28 | */ 29 | public ShoppingCart addToCart(ShoppingCart shoppingCart) { 30 | 31 | // 设置用户id,指定当前是哪个用户的购物车 32 | long UserId = BaseContext.getCurrentId(); 33 | shoppingCart.setUserId(UserId); 34 | 35 | // 查询当前菜品或套餐是否在购物车中,菜品口味要相同 36 | Long dishId = shoppingCart.getDishId(); // 查询前端传来的菜品id 37 | 38 | // 构造查询条件 39 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 40 | queryWrapper.eq(ShoppingCart::getUserId, UserId); // where user_id = ? 41 | 42 | // 如果能查到dishId,说明购物车传来的是菜品,否则是套餐 43 | if (dishId != null) { 44 | queryWrapper.eq(ShoppingCart::getDishId, dishId); // where dish_id = ? 45 | // queryWrapper.eq(ShoppingCart::getDishFlavor, shoppingCart.getDishFlavor()); // where dish_flavor = ? 46 | } else { 47 | queryWrapper.eq(ShoppingCart::getSetmealId, shoppingCart.getSetmealId()); // where set_meal_id = ? 48 | } 49 | 50 | ShoppingCart one = this.getOne(queryWrapper); 51 | 52 | // 如果在购物车中,数量累加 53 | if (one != null) { 54 | Integer number = one.getNumber(); 55 | one.setNumber(number + 1); // 数量加一 56 | one.setCreateTime(LocalDateTime.now()); 57 | this.updateById(one); 58 | } else { 59 | // 如果不在购物车中,添加到购物车 60 | shoppingCart.setNumber(1); 61 | shoppingCart.setCreateTime(LocalDateTime.now()); 62 | this.save(shoppingCart); 63 | one = shoppingCart; // 保存后,one就是shoppingCart 64 | } 65 | 66 | return one; 67 | } 68 | 69 | 70 | /** 71 | * 减少菜品或套餐到购物车,如果是最后一份,取消该菜品或套餐 72 | * 73 | * @param shoppingCart 要减少的菜品 74 | * @return 减少后的购物车 75 | */ 76 | public ShoppingCart subInCart(ShoppingCart shoppingCart) { 77 | // 设置用户id,指定当前是哪个用户的购物车 78 | long UserId = BaseContext.getCurrentId(); 79 | shoppingCart.setUserId(UserId); 80 | 81 | // 查询当前菜品或套餐是否在购物车中,菜品口味要相同 82 | Long dishId = shoppingCart.getDishId(); // 查询前端传来的菜品id 83 | 84 | // 构造查询条件 85 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 86 | queryWrapper.eq(ShoppingCart::getUserId, UserId); // where user_id = ? 87 | 88 | // 如果能查到dishId,说明购物车传来的是菜品,否则是套餐 89 | if (dishId != null) { 90 | queryWrapper.eq(ShoppingCart::getDishId, dishId); // where dish_id = ? 91 | // queryWrapper.eq(ShoppingCart::getDishFlavor, shoppingCart.getDishFlavor()); // where dish_flavor = ? 92 | } else { 93 | queryWrapper.eq(ShoppingCart::getSetmealId, shoppingCart.getSetmealId()); // where set_meal_id = ? 94 | } 95 | 96 | ShoppingCart one = this.getOne(queryWrapper); 97 | 98 | // 如果在购物车中大于2,数量减少 99 | if (one.getNumber() >= 2) { 100 | Integer number = one.getNumber(); 101 | one.setNumber(number - 1); 102 | this.updateById(one); 103 | } else { 104 | one.setNumber(0); // 如果是最后一份,数量设置为0,这样前端展示的时候就不会显示了 105 | this.remove(queryWrapper); 106 | } 107 | 108 | return one; 109 | } 110 | 111 | 112 | /** 113 | * 查询购物车 114 | * 115 | * @return 购物车列表 116 | */ 117 | @Override 118 | public List showCart() { 119 | // 创建条件构造器 120 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 121 | // 设置查询条件 122 | queryWrapper.eq(ShoppingCart::getUserId, BaseContext.getCurrentId()); // BaseContext.getCurrentId()获取当前用户id 123 | queryWrapper.orderByAsc(ShoppingCart::getCreateTime); // 按照创建时间升序排列 124 | return this.list(queryWrapper); 125 | } 126 | 127 | 128 | /** 129 | * 清空购物车 130 | */ 131 | @Override 132 | public void cleanCart() { 133 | // 条件构造器 134 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 135 | queryWrapper.eq(ShoppingCart::getUserId, BaseContext.getCurrentId()); 136 | 137 | this.remove(queryWrapper); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.fubukiss.rikky.common.CustomException; 6 | import com.fubukiss.rikky.entity.User; 7 | import com.fubukiss.rikky.mapper.UserMapper; 8 | import com.fubukiss.rikky.service.UserService; 9 | import com.fubukiss.rikky.util.ValidateCodeUtils; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.beans.factory.annotation.Value; 13 | import org.springframework.data.redis.core.RedisTemplate; 14 | import org.springframework.mail.MailException; 15 | import org.springframework.mail.SimpleMailMessage; 16 | import org.springframework.mail.javamail.JavaMailSender; 17 | import org.springframework.stereotype.Service; 18 | 19 | import javax.servlet.http.HttpSession; 20 | 21 | /** 22 | * FileName: UserServiceImpl 用户服务实现类 23 | * Date: 2023/01/16 24 | * Time: 20:25 25 | * Author: river 26 | */ 27 | @Slf4j 28 | @Service 29 | public class UserServiceImpl extends ServiceImpl implements UserService { // 通过继承ServiceImpl,实现了基本的增删改查方法 30 | 31 | /** 32 | * 邮箱发送器 33 | */ 34 | @Autowired 35 | private JavaMailSender javaMailSender; 36 | 37 | 38 | /** 39 | * 发送验证码的邮箱地址 40 | */ 41 | @Value("${spring.mail.username}") 42 | private String FROM; 43 | 44 | /** 45 | * 失效时间 46 | */ 47 | @Value("${spring.mail.timeout}") 48 | private int TIME_OUT_MINUTES; 49 | 50 | /** 51 | * RedisTemplate redis操作模板 52 | */ 53 | @Autowired 54 | private RedisTemplate redisTemplate; 55 | 56 | 57 | /** 58 | * 发送验证码 59 | * 60 | * @param email 邮箱地址 61 | * @param session 会话 62 | */ 63 | public void sendCode(String email, HttpSession session) { 64 | // 生成4位验证码 65 | String code = ValidateCodeUtils.generateValidateCode(4).toString(); 66 | log.info("Session:{}, Code:{}, to {}", session, code, email); // Slf4j的日志输出 67 | // 发送邮件 68 | // 构建一个邮件对象 69 | SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); 70 | // 设置邮件发送者 71 | simpleMailMessage.setFrom(FROM); 72 | // 设置邮件接收者 73 | simpleMailMessage.setTo(email); 74 | // 设置邮件主题 75 | simpleMailMessage.setSubject("[悦刻外卖]登陆验证码"); 76 | // 设置邮件内容 77 | simpleMailMessage.setText("欢迎使用悦刻外卖平台\n您的验证码为:" + code + ",请在" + TIME_OUT_MINUTES + "分钟内使用!\n【该邮件为系统自动发送,请勿回复】"); 78 | // 将验证码存入redis,设置失效时间TIME_OUT_MINUTES分钟 79 | redisTemplate.opsForValue().set(email, code, TIME_OUT_MINUTES, java.util.concurrent.TimeUnit.MINUTES); 80 | // 发送邮件 81 | try { 82 | javaMailSender.send(simpleMailMessage); 83 | } catch (MailException e) { 84 | e.printStackTrace(); 85 | throw new CustomException("致命错误!"); 86 | } 87 | 88 | 89 | } 90 | 91 | 92 | /** 93 | * 验证码登陆账号,如果是新用户,则自动注册 94 | * 95 | * @param email 邮箱地址 96 | * @param code 验证码 97 | * @param session 会话 98 | */ 99 | @Override 100 | public User loginByVerificationCode(String email, String code, HttpSession session) { 101 | // 获取redis中的验证码 102 | Object verificationCodeInRedis = redisTemplate.opsForValue().get(email); 103 | // 验证码是否正确 104 | if (verificationCodeInRedis != null && verificationCodeInRedis.equals(code)) { 105 | // 验证码正确 106 | // 查询用户是否存在 107 | LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 108 | queryWrapper.eq(User::getEmail, email); 109 | User user = this.getOne(queryWrapper);// 查询用户 110 | // 用户不存在,自动注册 111 | if (user == null) { 112 | user = new User(); 113 | user.setEmail(email); 114 | user.setStatus(1); // 设置用户状态为正常 115 | this.save(user); 116 | } 117 | // 将用户信息存入session 118 | session.setAttribute("user", user.getId()); 119 | // 将redis中的验证码删除 120 | redisTemplate.delete(email); 121 | 122 | return user; 123 | } else { 124 | // 验证码错误 125 | throw new CustomException("验证码错误!"); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/fubukiss/rikky/util/ValidateCodeUtils.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.rikky.util; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * 随机生成验证码工具类 7 | */ 8 | public class ValidateCodeUtils { 9 | /** 10 | * 随机生成验证码 11 | * 12 | * @param length 长度为4位或者6位 13 | * @return 验证码 14 | */ 15 | public static Integer generateValidateCode(int length) { 16 | Integer code = null; 17 | if (length == 4) { 18 | code = new Random().nextInt(9999);//生成随机数,最大为9999 19 | if (code < 1000) { 20 | code = code + 1000;//保证随机数为4位数字 21 | } 22 | } else if (length == 6) { 23 | code = new Random().nextInt(999999);//生成随机数,最大为999999 24 | if (code < 100000) { 25 | code = code + 100000;//保证随机数为6位数字 26 | } 27 | } else { 28 | throw new RuntimeException("只能生成4位或6位数字验证码"); 29 | } 30 | return code; 31 | } 32 | 33 | /** 34 | * 随机生成指定长度字符串验证码 35 | * 36 | * @param length 长度 37 | * @return 验证码 38 | */ 39 | public static String generateValidateCode4String(int length) { 40 | Random rdm = new Random(); 41 | String hash1 = Integer.toHexString(rdm.nextInt()); 42 | String capstr = hash1.substring(0, length); 43 | return capstr; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 # default port 3 | 4 | 5 | spring: 6 | application: 7 | name: rikky_takeaway # 应用名称 8 | 9 | 10 | # 数据库信息|必填 11 | datasource: 12 | druid: 13 | driver-class-name: com.mysql.cj.jdbc.Driver 14 | # 本人将使用服务器启动项填写以下敏感信息 # 15 | # IDEA->Run->Edit Configurations->Environment Variables->添加以下变量 # 16 | url: # 请自行配置数据库url, e.g. jdbc:mysql://localhost:3306/rikkytakeaway?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC 17 | username: # 请自行配置数据库username 18 | password: # 本地测试时请自行添加password 19 | 20 | 21 | # 邮箱验证配置信息|必填 22 | mail: 23 | host: smtp.qq.com # 如果你需要使用非qq邮箱,请自行配置host 24 | username: # 请自行配置邮箱地址 25 | password: wddrbljraesbdhdg # 请自行配置邮箱smtp授权码 具体请看本项目根目录下的README.md 26 | port: 587 27 | default-encoding: UTF-8 28 | timeout: 10 # 验证码有效时间 单位:分钟 29 | properties: 30 | mail: 31 | smtp: 32 | socketFactoryClass: javax.net.ssl.SSLSocketFactory 33 | # 开启debug以后,邮件发送过程的日志会在控制台上打印出来 34 | debug: true 35 | 36 | 37 | # redis缓存相关配置|必填 38 | redis: 39 | host: localhost 40 | port: 6379 # 默认端口 41 | password: # 默认为空 42 | database: 0 # 默认使用0号数据库 43 | 44 | 45 | # mybatis-plus配置信息 46 | mybatis-plus: 47 | configuration: 48 | # 在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射 49 | map-underscore-to-camel-case: true 50 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 51 | global-config: 52 | db-config: 53 | id-type: ASSIGN_ID 54 | 55 | 56 | # 其它配置信息 57 | rikky: 58 | # 文件存储位置信息|必填 59 | linux-path: C:\Users\river\code\work\javaProjects\rikky-takeaway\img\ # 本地测试时,文件存储路径,img的绝对路径,img后需要加上斜杠 60 | # windows-path: # !!!暂不使用,即使你是非linux系统,也在上方linux-path里配置存储地址 61 | -------------------------------------------------------------------------------- /src/main/resources/backend/api/category.js: -------------------------------------------------------------------------------- 1 | // 查询列表接口 2 | const getCategoryPage = (params) => { 3 | return $axios({ 4 | url: '/category/page', 5 | method: 'get', 6 | params 7 | }) 8 | } 9 | 10 | // 编辑页面反查详情接口 11 | const queryCategoryById = (id) => { 12 | return $axios({ 13 | url: `/category/${id}`, 14 | method: 'get' 15 | }) 16 | } 17 | 18 | // 删除当前列的接口 19 | const deleCategory = (id) => { 20 | return $axios({ 21 | url: '/category', 22 | method: 'delete', 23 | params: {id} 24 | }) 25 | } 26 | 27 | // 修改接口 28 | const editCategory = (params) => { 29 | return $axios({ 30 | url: '/category', 31 | method: 'put', 32 | data: {...params} 33 | }) 34 | } 35 | 36 | // 新增接口 37 | const addCategory = (params) => { 38 | return $axios({ 39 | url: '/category', 40 | method: 'post', 41 | data: {...params} 42 | }) 43 | } -------------------------------------------------------------------------------- /src/main/resources/backend/api/combo.js: -------------------------------------------------------------------------------- 1 | // 查询列表数据 2 | const getSetmealPage = (params) => { 3 | return $axios({ 4 | url: '/setmeal/page', 5 | method: 'get', 6 | params 7 | }) 8 | } 9 | 10 | // 删除数据接口 11 | const deleteSetmeal = (ids) => { 12 | return $axios({ 13 | url: '/setmeal', 14 | method: 'delete', 15 | params: {ids} 16 | }) 17 | } 18 | 19 | // 修改数据接口 20 | const editSetmeal = (params) => { 21 | return $axios({ 22 | url: '/setmeal', 23 | method: 'put', 24 | data: {...params} 25 | }) 26 | } 27 | 28 | // 新增数据接口 29 | const addSetmeal = (params) => { 30 | return $axios({ 31 | url: '/setmeal', 32 | method: 'post', 33 | data: {...params} 34 | }) 35 | } 36 | 37 | // 查询详情接口 38 | const querySetmealById = (id) => { 39 | return $axios({ 40 | url: `/setmeal/${id}`, 41 | method: 'get' 42 | }) 43 | } 44 | 45 | // 批量起售禁售 46 | const setmealStatusByStatus = (params) => { 47 | return $axios({ 48 | url: `/setmeal/status/${params.status}`, 49 | method: 'post', 50 | params: {ids: params.ids} 51 | }) 52 | } 53 | -------------------------------------------------------------------------------- /src/main/resources/backend/api/food.js: -------------------------------------------------------------------------------- 1 | // 查询列表接口 2 | const getDishPage = (params) => { 3 | return $axios({ 4 | url: '/dish/page', 5 | method: 'get', 6 | params 7 | }) 8 | } 9 | 10 | // 删除接口 11 | const deleteDish = (ids) => { 12 | return $axios({ 13 | url: '/dish', 14 | method: 'delete', 15 | params: {ids} 16 | }) 17 | } 18 | 19 | // 修改接口 20 | const editDish = (params) => { 21 | return $axios({ 22 | url: '/dish', 23 | method: 'put', 24 | data: {...params} 25 | }) 26 | } 27 | 28 | // 新增接口 29 | const addDish = (params) => { 30 | return $axios({ 31 | url: '/dish', 32 | method: 'post', 33 | data: {...params} 34 | }) 35 | } 36 | 37 | // 查询详情 38 | const queryDishById = (id) => { 39 | return $axios({ 40 | url: `/dish/${id}`, 41 | method: 'get' 42 | }) 43 | } 44 | 45 | // 获取菜品分类列表 46 | const getCategoryList = (params) => { 47 | return $axios({ 48 | url: '/category/list', 49 | method: 'get', 50 | params 51 | }) 52 | } 53 | 54 | // 查菜品列表的接口 55 | const queryDishList = (params) => { 56 | return $axios({ 57 | url: '/dish/list', 58 | method: 'get', 59 | params 60 | }) 61 | } 62 | 63 | // 文件down预览 64 | const commonDownload = (params) => { 65 | return $axios({ 66 | headers: { 67 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' 68 | }, 69 | url: '/common/download', 70 | method: 'get', 71 | params 72 | }) 73 | } 74 | 75 | // 起售停售---批量起售停售接口 76 | const dishStatusByStatus = (params) => { 77 | return $axios({ 78 | url: `/dish/status/${params.status}`, 79 | method: 'post', 80 | params: {ids: params.id} 81 | }) 82 | } -------------------------------------------------------------------------------- /src/main/resources/backend/api/login.js: -------------------------------------------------------------------------------- 1 | function loginApi(data) { 2 | return $axios({ 3 | 'url': '/employee/login', 4 | 'method': 'post', 5 | data 6 | }) 7 | } 8 | 9 | function logoutApi() { 10 | return $axios({ 11 | 'url': '/employee/logout', 12 | 'method': 'post', 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/backend/api/member.js: -------------------------------------------------------------------------------- 1 | // 查询---加载员工列表 2 | function getMemberList(params) { 3 | return $axios({ 4 | url: '/employee/page', 5 | method: 'get', 6 | params 7 | }) 8 | } 9 | 10 | // 修改---启用禁用接口 11 | function enableOrDisableEmployee(params) { 12 | return $axios({ 13 | url: '/employee', 14 | method: 'put', 15 | data: {...params} 16 | }) 17 | } 18 | 19 | // 新增---添加员工 20 | function addEmployee(params) { 21 | return $axios({ 22 | url: '/employee', 23 | method: 'post', 24 | data: {...params} 25 | }) 26 | } 27 | 28 | // 修改---添加员工 29 | function editEmployee(params) { 30 | return $axios({ 31 | url: '/employee', 32 | method: 'put', 33 | data: {...params} 34 | }) 35 | } 36 | 37 | // 修改页面反查详情接口 38 | function queryEmployeeById(id) { 39 | return $axios({ 40 | url: `/employee/${id}`, 41 | method: 'get' 42 | }) 43 | } -------------------------------------------------------------------------------- /src/main/resources/backend/api/order.js: -------------------------------------------------------------------------------- 1 | // 查询列表页接口 2 | const getOrderDetailPage = (params) => { 3 | return $axios({ 4 | url: '/order/page', 5 | method: 'get', 6 | params 7 | }) 8 | } 9 | 10 | // 查看接口 11 | const queryOrderDetailById = (id) => { 12 | return $axios({ 13 | url: `/orderDetail/${id}`, 14 | method: 'get' 15 | }) 16 | } 17 | 18 | // 取消,派送,完成接口 19 | const editOrderDetail = (params) => { 20 | return $axios({ 21 | url: '/order', 22 | method: 'put', 23 | data: {...params} 24 | }) 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/backend/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/backend/images/404-images/404-cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/404-images/404-cloud.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/404-images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/404-images/404.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/btn_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/btn_back@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/btn_clean@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/btn_clean@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/btn_close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/btn_close@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/icon_index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/icon_index.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/icon_upload@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/icon_upload@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/jine_m-2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/jine_m-2@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/renshu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/renshu@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/icons/xiangmujine@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/icons/xiangmujine@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/img_brand01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/img_brand01@2x.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/img_denglu_bj.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/img_denglu_bj.jpg -------------------------------------------------------------------------------- /src/main/resources/backend/images/login/login-l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/login/login-l.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/login/login-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/login/login-logo.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/login/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/login/logo.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/logo.png -------------------------------------------------------------------------------- /src/main/resources/backend/images/noImg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/images/noImg.png -------------------------------------------------------------------------------- /src/main/resources/backend/js/common.js: -------------------------------------------------------------------------------- 1 | var web_prefix = '/backend' -------------------------------------------------------------------------------- /src/main/resources/backend/js/index.js: -------------------------------------------------------------------------------- 1 | /* 自定义trim */ 2 | function trim(str) { //删除左右两端的空格,自定义的trim()方法 3 | return str == undefined ? "" : str.replace(/(^\s*)|(\s*$)/g, "") 4 | } 5 | 6 | //获取url地址上面的参数 7 | function requestUrlParam(argname) { 8 | var url = location.href 9 | var arrStr = url.substring(url.indexOf("?") + 1).split("&") 10 | for (var i = 0; i < arrStr.length; i++) { 11 | var loc = arrStr[i].indexOf(argname + "=") 12 | if (loc != -1) { 13 | return arrStr[i].replace(argname + "=", "").replace("?", "") 14 | } 15 | } 16 | return "" 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/backend/js/request.js: -------------------------------------------------------------------------------- 1 | (function (win) { 2 | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' 3 | // 创建axios实例 4 | const service = axios.create({ 5 | // axios中请求配置有baseURL选项,表示请求URL公共部分 6 | baseURL: '/', 7 | // 超时 临时改为1000s 修改可能会不生效,需要在浏览器中清除缓存后重新访问 8 | // timeout: 10000 // 请求超时时间为10s 9 | timeout: 100000 // 请求超时时间为100s 10 | }) 11 | // request拦截器 12 | service.interceptors.request.use(config => { 13 | // 是否需要设置 token 14 | // const isToken = (config.headers || {}).isToken === false 15 | // if (getToken() && !isToken) { 16 | // config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 17 | // } 18 | // get请求映射params参数 19 | if (config.method === 'get' && config.params) { 20 | let url = config.url + '?'; 21 | for (const propName of Object.keys(config.params)) { 22 | const value = config.params[propName]; 23 | var part = encodeURIComponent(propName) + "="; 24 | if (value !== null && typeof (value) !== "undefined") { 25 | if (typeof value === 'object') { 26 | for (const key of Object.keys(value)) { 27 | let params = propName + '[' + key + ']'; 28 | var subPart = encodeURIComponent(params) + "="; 29 | url += subPart + encodeURIComponent(value[key]) + "&"; 30 | } 31 | } else { 32 | url += part + encodeURIComponent(value) + "&"; 33 | } 34 | } 35 | } 36 | url = url.slice(0, -1); 37 | config.params = {}; 38 | config.url = url; 39 | } 40 | return config 41 | }, error => { 42 | console.log(error) 43 | Promise.reject(error) 44 | }) 45 | 46 | // 响应拦截器 47 | service.interceptors.response.use(res => { 48 | if (res.data.code === 0 && res.data.msg === 'NOTLOGIN') {// 返回登录页面 49 | console.log('---/backend/page/login/login.html---') 50 | localStorage.removeItem('userInfo') 51 | window.top.location.href = '/backend/page/login/login.html' 52 | } else { 53 | return res.data 54 | } 55 | }, 56 | error => { 57 | console.log('err' + error) 58 | let {message} = error; 59 | if (message == "Network Error") { 60 | message = "后端接口连接异常"; 61 | } else if (message.includes("timeout")) { 62 | message = "系统接口请求超时"; 63 | } else if (message.includes("Request failed with status code")) { 64 | message = "系统接口" + message.substr(message.length - 3) + "异常"; 65 | } 66 | window.ELEMENT.Message({ 67 | message: message, 68 | type: 'error', 69 | duration: 5 * 1000 70 | }) 71 | return Promise.reject(error) 72 | } 73 | ) 74 | win.$axios = service 75 | })(window); 76 | -------------------------------------------------------------------------------- /src/main/resources/backend/js/validate.js: -------------------------------------------------------------------------------- 1 | function isValidUsername(str) { 2 | return ['admin', 'editor'].indexOf(str.trim()) >= 0; 3 | } 4 | 5 | function isExternal(path) { 6 | return /^(https?:|mailto:|tel:)/.test(path); 7 | } 8 | 9 | function isCellPhone(val) { 10 | if (!/^1(3|4|5|6|7|8)\d{9}$/.test(val)) { 11 | return false 12 | } else { 13 | return true 14 | } 15 | } 16 | 17 | //校验账号 18 | function checkUserName(rule, value, callback) { 19 | if (value == "") { 20 | callback(new Error("请输入账号")) 21 | } else if (value.length > 20 || value.length < 3) { 22 | callback(new Error("账号长度应是3-20")) 23 | } else { 24 | callback() 25 | } 26 | } 27 | 28 | //校验姓名 29 | function checkName(rule, value, callback) { 30 | if (value == "") { 31 | callback(new Error("请输入姓名")) 32 | } else if (value.length > 12) { 33 | callback(new Error("账号长度应是1-12")) 34 | } else { 35 | callback() 36 | } 37 | } 38 | 39 | function checkPhone(rule, value, callback) { 40 | // let phoneReg = /(^1[3|4|5|6|7|8|9]\d{9}$)|(^09\d{8}$)/; 41 | if (value == "") { 42 | callback(new Error("请输入手机号")) 43 | } else if (!isCellPhone(value)) {//引入methods中封装的检查手机格式的方法 44 | callback(new Error("请输入正确的手机号!")) 45 | } else { 46 | callback() 47 | } 48 | } 49 | 50 | 51 | function validID(rule, value, callback) { 52 | // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X 53 | let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/ 54 | if (value == '') { 55 | callback(new Error('请输入身份证号码')) 56 | } else if (reg.test(value)) { 57 | callback() 58 | } else { 59 | callback(new Error('身份证号码不正确')) 60 | } 61 | } -------------------------------------------------------------------------------- /src/main/resources/backend/page/demo/upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 文件上传 8 | 9 | 10 | 11 | 12 | 13 | 14 |

15 |
16 | 22 | 23 | 24 | 25 |
26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 65 | 66 | -------------------------------------------------------------------------------- /src/main/resources/backend/page/login/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 悦刻外卖管理端 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /src/main/resources/backend/plugins/element-ui/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/plugins/element-ui/fonts/element-icons.ttf -------------------------------------------------------------------------------- /src/main/resources/backend/plugins/element-ui/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/plugins/element-ui/fonts/element-icons.woff -------------------------------------------------------------------------------- /src/main/resources/backend/styles/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/styles/fonts/element-icons.ttf -------------------------------------------------------------------------------- /src/main/resources/backend/styles/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/styles/fonts/element-icons.woff -------------------------------------------------------------------------------- /src/main/resources/backend/styles/icon/iconfont.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "iconfont"; /* Project id 2552591 */ 3 | src: url('iconfont.woff2?t=1621231825060') format('woff2'), 4 | url('iconfont.woff?t=1621231825060') format('woff'), 5 | url('iconfont.ttf?t=1621231825060') format('truetype'); 6 | } 7 | 8 | .iconfont { 9 | font-family: "iconfont" !important; 10 | font-size: 16px; 11 | font-style: normal; 12 | -webkit-font-smoothing: antialiased; 13 | -moz-osx-font-smoothing: grayscale; 14 | } 15 | 16 | .icon-category:before { 17 | content: "\e606"; 18 | } 19 | 20 | .icon-member:before { 21 | content: "\e607"; 22 | } 23 | 24 | .icon-user:before { 25 | content: "\e608"; 26 | } 27 | 28 | .icon-order:before { 29 | content: "\e609"; 30 | } 31 | 32 | .icon-combo:before { 33 | content: "\e60a"; 34 | } 35 | 36 | .icon-lock:before { 37 | content: "\e60b"; 38 | } 39 | 40 | .icon-food:before { 41 | content: "\e60c"; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/backend/styles/icon/iconfont.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "2552591", 3 | "name": "rjwm", 4 | "font_family": "iconfont", 5 | "css_prefix_text": "icon-", 6 | "description": "", 7 | "glyphs": [ 8 | { 9 | "icon_id": "21641541", 10 | "name": "category", 11 | "font_class": "category", 12 | "unicode": "e606", 13 | "unicode_decimal": 58886 14 | }, 15 | { 16 | "icon_id": "21641542", 17 | "name": "member", 18 | "font_class": "member", 19 | "unicode": "e607", 20 | "unicode_decimal": 58887 21 | }, 22 | { 23 | "icon_id": "21641545", 24 | "name": "user", 25 | "font_class": "user", 26 | "unicode": "e608", 27 | "unicode_decimal": 58888 28 | }, 29 | { 30 | "icon_id": "21641546", 31 | "name": "order", 32 | "font_class": "order", 33 | "unicode": "e609", 34 | "unicode_decimal": 58889 35 | }, 36 | { 37 | "icon_id": "21641547", 38 | "name": "combo", 39 | "font_class": "combo", 40 | "unicode": "e60a", 41 | "unicode_decimal": 58890 42 | }, 43 | { 44 | "icon_id": "21641548", 45 | "name": "lock", 46 | "font_class": "lock", 47 | "unicode": "e60b", 48 | "unicode_decimal": 58891 49 | }, 50 | { 51 | "icon_id": "21641611", 52 | "name": "food", 53 | "font_class": "food", 54 | "unicode": "e60c", 55 | "unicode_decimal": 58892 56 | } 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /src/main/resources/backend/styles/icon/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/styles/icon/iconfont.ttf -------------------------------------------------------------------------------- /src/main/resources/backend/styles/icon/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/styles/icon/iconfont.woff -------------------------------------------------------------------------------- /src/main/resources/backend/styles/icon/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/backend/styles/icon/iconfont.woff2 -------------------------------------------------------------------------------- /src/main/resources/backend/styles/login.css: -------------------------------------------------------------------------------- 1 | .login { 2 | display: flex; 3 | justify-content: center; 4 | align-items: center; 5 | height: 100%; 6 | background-color: #333; 7 | } 8 | 9 | .login-box { 10 | width: 1000px; 11 | height: 474.38px; 12 | border-radius: 8px; 13 | display: flex; 14 | } 15 | 16 | .login-box img { 17 | width: 60%; 18 | height: auto; 19 | } 20 | 21 | .title { 22 | margin: 0px auto 30px auto; 23 | text-align: center; 24 | color: #707070; 25 | } 26 | 27 | .login-form { 28 | background: #ffffff; 29 | width: 40%; 30 | border-radius: 0px 8px 8px 0px; 31 | display: flex; 32 | justify-content: center; 33 | align-items: center; 34 | } 35 | 36 | .login-form .el-form { 37 | width: 214px; 38 | height: 307px; 39 | } 40 | 41 | .login-form .el-form-item { 42 | margin-bottom: 30px; 43 | } 44 | 45 | .login-form .el-form-item.is-error .el-input__inner { 46 | border: 0 !important; 47 | border-bottom: 1px solid #fd7065 !important; 48 | background: #fff !important; 49 | } 50 | 51 | .login-form .input-icon { 52 | height: 32px; 53 | width: 18px; 54 | margin-left: -2px; 55 | } 56 | 57 | .login-form .el-input__inner { 58 | border: 0; 59 | border-bottom: 1px solid #e9e9e8; 60 | border-radius: 0; 61 | font-size: 14px; 62 | font-weight: 400; 63 | color: #333333; 64 | height: 32px; 65 | line-height: 32px; 66 | } 67 | 68 | .login-form .el-input__prefix { 69 | left: 0; 70 | } 71 | 72 | .login-form .el-input--prefix .el-input__inner { 73 | padding-left: 26px; 74 | } 75 | 76 | .login-form .el-input__inner::placeholder { 77 | color: #aeb5c4; 78 | } 79 | 80 | .login-form .el-form-item--medium .el-form-item__content { 81 | line-height: 32px; 82 | } 83 | 84 | .login-form .el-input--medium .el-input__icon { 85 | line-height: 32px; 86 | } 87 | 88 | .login-btn { 89 | border-radius: 17px; 90 | padding: 11px 20px !important; 91 | margin-top: 10px; 92 | font-weight: 500; 93 | font-size: 14px; 94 | border: 0; 95 | background-color: #ffc200; 96 | } 97 | 98 | .login-btn:hover, 99 | .login-btn:focus { 100 | /* background: #FFC200; */ 101 | /* color: #ffffff; */ 102 | } 103 | 104 | .login-form-title { 105 | height: 36px; 106 | display: flex; 107 | justify-content: center; 108 | align-items: center; 109 | margin-bottom: 40px; 110 | } 111 | 112 | .login-form-title .title-label { 113 | font-weight: 500; 114 | font-size: 20px; 115 | color: #333333; 116 | margin-left: 10px; 117 | } 118 | -------------------------------------------------------------------------------- /src/main/resources/backend/styles/page.css: -------------------------------------------------------------------------------- 1 | .dashboard-container { 2 | padding: 20px; 3 | } 4 | 5 | .dashboard-container .container { 6 | background: #fff; 7 | position: relative; 8 | z-index: 1; 9 | padding: 30px 28px; 10 | border-radius: 4px; 11 | } 12 | 13 | .dashboard-container .container .tableBar { 14 | display: flex; 15 | margin-bottom: 20px; 16 | justify-content: space-between; 17 | } 18 | 19 | .dashboard-container .container .tableBox { 20 | width: 100%; 21 | border: solid 2px #f3f4f7; 22 | border-radius: 2px; 23 | } 24 | 25 | .dashboard-container .container .tableBox .el-image img { 26 | width: 40px; 27 | border-radius: 5px; 28 | } 29 | 30 | .dashboard-container .container .pageList { 31 | text-align: center; 32 | margin-top: 30px; 33 | } 34 | 35 | .dashboard-container .container .tableLab .span-btn { 36 | cursor: pointer; 37 | display: inline-block; 38 | font-size: 14px; 39 | padding: 0 20px; 40 | color: #818693; 41 | border-right: solid 1px #d8dde3; 42 | } 43 | 44 | .dashboard-container .container .tableLab .el-button { 45 | margin-left: 10px; 46 | } 47 | 48 | .el-table-column--selection .cell { 49 | padding-left: 10px; 50 | } 51 | 52 | /* 添加 */ 53 | .addBrand-container .avatar-uploader .el-upload { 54 | border: 1px dashed #d9d9d9; 55 | border-radius: 6px; 56 | cursor: pointer; 57 | position: relative; 58 | overflow: hidden; 59 | } 60 | 61 | .addBrand-container .avatar-uploader .el-upload:hover { 62 | border-color: #409eff; 63 | } 64 | 65 | .addBrand-container .avatar-uploader-icon { 66 | font-size: 28px; 67 | color: #8c939d; 68 | width: 200px; 69 | height: 160px; 70 | line-height: 160px; 71 | text-align: center; 72 | } 73 | 74 | .addBrand-container .avatar { 75 | width: 160px; 76 | height: 160px; 77 | display: block; 78 | } 79 | 80 | .addBrand-container .el-form--inline .el-form-item__content { 81 | width: 293px; 82 | } 83 | 84 | .addBrand-container .el-input { 85 | width: 293px; 86 | } 87 | 88 | .addBrand-container { 89 | margin: 30px; 90 | } 91 | 92 | .addBrand-container .container { 93 | position: relative; 94 | z-index: 1; 95 | background: #fff; 96 | padding: 30px; 97 | border-radius: 4px; 98 | min-height: 500px; 99 | } 100 | 101 | .addBrand-container .container .subBox { 102 | padding-top: 30px; 103 | text-align: center; 104 | border-top: solid 1px #f3f4f7; 105 | } 106 | 107 | .flavorBox { 108 | width: 777px; 109 | } 110 | 111 | .flavorBox .addBut { 112 | background: #ffc200; 113 | display: inline-block; 114 | padding: 0px 20px; 115 | border-radius: 3px; 116 | line-height: 40px; 117 | cursor: pointer; 118 | border-radius: 4px; 119 | color: #333333; 120 | font-weight: 500; 121 | } 122 | 123 | .flavorBox .flavor { 124 | border: solid 1px #dfe2e8; 125 | border-radius: 3px; 126 | padding: 15px; 127 | background: #fafafb; 128 | } 129 | 130 | .flavorBox .flavor .title { 131 | color: #606168; 132 | } 133 | 134 | .flavorBox .flavor .cont .items { 135 | display: flex; 136 | margin: 10px 0; 137 | } 138 | 139 | .flavorBox .flavor .cont .items .itTit { 140 | width: 150px; 141 | margin-right: 15px; 142 | } 143 | 144 | .flavorBox .flavor .cont .items .itTit input { 145 | width: 100%; 146 | line-height: 40px; 147 | border-radius: 3px; 148 | padding: 0 10px; 149 | } 150 | 151 | .flavorBox .flavor .cont .items .labItems { 152 | flex: 1; 153 | display: flex; 154 | flex-wrap: wrap; 155 | border-radius: 3px; 156 | min-height: 39px; 157 | border: solid 1px #d8dde3; 158 | background: #fff; 159 | padding: 0 5px; 160 | } 161 | 162 | .flavorBox .flavor .cont .items .labItems span { 163 | display: inline-block; 164 | color: #f19c59; 165 | margin: 5px; 166 | line-height: 26px; 167 | height: 26px; 168 | padding: 0 10px; 169 | background: #fdf4eb; 170 | border-radius: 3px; 171 | border: solid 1px #fae2cd; 172 | } 173 | 174 | .flavorBox .flavor .cont .items .labItems span i { 175 | cursor: pointer; 176 | font-style: normal; 177 | } 178 | 179 | .flavorBox .flavor .cont .items .labItems .inputBox { 180 | display: inline-block; 181 | width: 100%; 182 | height: 36px; 183 | line-height: 36px; 184 | overflow: hidden; 185 | } 186 | 187 | .flavorBox .flavor .cont .items .delFlavor { 188 | display: inline-block; 189 | padding: 0 10px; 190 | color: #f19c59; 191 | cursor: pointer; 192 | } 193 | 194 | .addBrand-container .address .el-form-item__content { 195 | width: 777px !important; 196 | } 197 | 198 | .el-button--text { 199 | font-weight: 400 !important; 200 | font-size: 13px !important; 201 | } 202 | 203 | .el-table td { 204 | font-size: 13px !important; 205 | } 206 | 207 | .el-table .cell, 208 | .el-table th div, 209 | .el-table--border td:first-child .cell, 210 | .el-table--border th:first-child .cell { 211 | padding-left: 12px; 212 | } 213 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////// 2 | // https://github.com/riverify // 3 | // ____ __ __ _ // 4 | // / __/_ __/ / __ __/ /__ (_)__ ___ // 5 | // / _// // / _ \/ // / '_// (_-<(_-< // 6 | // /_/ \_,_/_.__/\_,_/_/\_\/_/___/___/ // 7 | // _ooOoo_ // 8 | // o8888888o // 9 | // 88" . "88 // 10 | // (| ^_^ |) // 11 | // O\ = /O // 12 | // ____/`---'\____ // 13 | // .' \\| |// `. // 14 | // / \\||| : |||// \ // 15 | // / _||||| -:- |||||- \ // 16 | // | | \\\ - /// | | // 17 | // | \_| ''\---/'' | | // 18 | // \ .-\__ `-` ___/-. / // 19 | // ___`. .' /--.--\ `. . ___ // 20 | // ."" '< `.___\_<|>_/___.' >'"". // 21 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // 22 | // \ \ `-. \_ __\ /__ _/ .-` / / // 23 | // ========`-.____`-.___\_____/___.-`____.-'======== // 24 | // `=---=' // 25 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // 26 | // 佛祖保佑 永不宕机 永无BUG // 27 | //////////////////////////////////////////////////////////////////// 28 | 29 | 30 | 31 | _ 32 | |_) o | | _|_ _. | _ _. _. 33 | | \ | |< |< \/ |_ (_| |< (/_ (_| \/\/ (_| \/ 34 | / / 35 | 36 | 37 | o _ _ _ ._ _ o ._ _ 38 | | _> (_ (_) | | | | | | (_| 39 | _| 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/front/api/address.js: -------------------------------------------------------------------------------- 1 | //获取所有地址 2 | function addressListApi() { 3 | return $axios({ 4 | 'url': '/addressBook/list', 5 | 'method': 'get', 6 | }) 7 | } 8 | 9 | //获取最新地址 10 | function addressLastUpdateApi() { 11 | return $axios({ 12 | 'url': '/addressBook/lastUpdate', 13 | 'method': 'get', 14 | }) 15 | } 16 | 17 | //新增地址 18 | function addAddressApi(data) { 19 | return $axios({ 20 | 'url': '/addressBook', 21 | 'method': 'post', 22 | data 23 | }) 24 | } 25 | 26 | //修改地址 27 | function updateAddressApi(data) { 28 | return $axios({ 29 | 'url': '/addressBook', 30 | 'method': 'put', 31 | data 32 | }) 33 | } 34 | 35 | //删除地址 36 | function deleteAddressApi(params) { 37 | return $axios({ 38 | 'url': '/addressBook', 39 | 'method': 'delete', 40 | params 41 | }) 42 | } 43 | 44 | //查询单个地址 45 | function addressFindOneApi(id) { 46 | return $axios({ 47 | 'url': `/addressBook/${id}`, 48 | 'method': 'get', 49 | }) 50 | } 51 | 52 | //设置默认地址 53 | function setDefaultAddressApi(data) { 54 | return $axios({ 55 | 'url': '/addressBook/default', 56 | 'method': 'put', 57 | data 58 | }) 59 | } 60 | 61 | //获取默认地址 62 | function getDefaultAddressApi() { 63 | return $axios({ 64 | 'url': `/addressBook/default`, 65 | 'method': 'get', 66 | }) 67 | } -------------------------------------------------------------------------------- /src/main/resources/front/api/login.js: -------------------------------------------------------------------------------- 1 | function loginApi(data) { 2 | return $axios({ 3 | 'url': '/user/login', 4 | 'method': 'post', 5 | data 6 | }) 7 | } 8 | 9 | function sendMsgApi(data) { 10 | return $axios({ 11 | 'url': '/user/sendMsg', 12 | 'method': 'post', 13 | data 14 | }) 15 | } 16 | 17 | function loginoutApi() { 18 | return $axios({ 19 | 'url': '/user/loginout', 20 | 'method': 'post', 21 | }) 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/front/api/main.js: -------------------------------------------------------------------------------- 1 | //获取所有的菜品分类 2 | function categoryListApi() { 3 | return $axios({ 4 | 'url': '/category/list', 5 | 'method': 'get', 6 | }) 7 | } 8 | 9 | //获取菜品分类对应的菜品 10 | function dishListApi(data) { 11 | return $axios({ 12 | 'url': '/dish/list', 13 | 'method': 'get', 14 | params: {...data} 15 | }) 16 | } 17 | 18 | //获取菜品分类对应的套餐 19 | function setmealListApi(data) { 20 | return $axios({ 21 | 'url': '/setmeal/list', 22 | 'method': 'get', 23 | params: {...data} 24 | }) 25 | } 26 | 27 | //获取购物车内商品的集合 28 | function cartListApi(data) { 29 | return $axios({ 30 | 'url': '/shoppingCart/list', 31 | 'method': 'get', 32 | params: {...data} 33 | }) 34 | } 35 | 36 | //购物车中添加商品 37 | function addCartApi(data) { 38 | return $axios({ 39 | 'url': '/shoppingCart/add', 40 | 'method': 'post', 41 | data 42 | }) 43 | } 44 | 45 | //购物车中修改商品 46 | function updateCartApi(data) { 47 | return $axios({ 48 | 'url': '/shoppingCart/sub', 49 | 'method': 'post', 50 | data 51 | }) 52 | } 53 | 54 | //删除购物车的商品 55 | function clearCartApi() { 56 | return $axios({ 57 | 'url': '/shoppingCart/clean', 58 | 'method': 'delete', 59 | }) 60 | } 61 | 62 | //获取套餐的全部菜品 63 | function setMealDishDetailsApi(id) { 64 | return $axios({ 65 | 'url': `/setmeal/dish/${id}`, 66 | 'method': 'get', 67 | }) 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/main/resources/front/api/order.js: -------------------------------------------------------------------------------- 1 | //提交订单 2 | function addOrderApi(data) { 3 | return $axios({ 4 | 'url': '/order/submit', 5 | 'method': 'post', 6 | data 7 | }) 8 | } 9 | 10 | //查询所有订单 11 | function orderListApi() { 12 | return $axios({ 13 | 'url': '/order/list', 14 | 'method': 'get', 15 | }) 16 | } 17 | 18 | //分页查询订单 19 | function orderPagingApi(data) { 20 | return $axios({ 21 | 'url': '/order/userPage', 22 | 'method': 'get', 23 | params: {...data} 24 | }) 25 | } 26 | 27 | //再来一单 28 | function orderAgainApi(data) { 29 | return $axios({ 30 | 'url': '/order/again', 31 | 'method': 'post', 32 | data 33 | }) 34 | } -------------------------------------------------------------------------------- /src/main/resources/front/fonts/DIN-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/fonts/DIN-Bold.otf -------------------------------------------------------------------------------- /src/main/resources/front/fonts/DIN-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/fonts/DIN-Medium.otf -------------------------------------------------------------------------------- /src/main/resources/front/fonts/PingFangSC-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/fonts/PingFangSC-Medium.ttf -------------------------------------------------------------------------------- /src/main/resources/front/fonts/PingFangSC-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/fonts/PingFangSC-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/front/fonts/PingFangSC-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/fonts/PingFangSC-Semibold.ttf -------------------------------------------------------------------------------- /src/main/resources/front/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/add.png -------------------------------------------------------------------------------- /src/main/resources/front/images/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/cart.png -------------------------------------------------------------------------------- /src/main/resources/front/images/cart_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/cart_active.png -------------------------------------------------------------------------------- /src/main/resources/front/images/checked_false.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/checked_false.png -------------------------------------------------------------------------------- /src/main/resources/front/images/checked_true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/checked_true.png -------------------------------------------------------------------------------- /src/main/resources/front/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/close.png -------------------------------------------------------------------------------- /src/main/resources/front/images/demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/demo1.png -------------------------------------------------------------------------------- /src/main/resources/front/images/demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/demo2.png -------------------------------------------------------------------------------- /src/main/resources/front/images/demo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/demo3.png -------------------------------------------------------------------------------- /src/main/resources/front/images/demo4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/demo4.png -------------------------------------------------------------------------------- /src/main/resources/front/images/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/edit.png -------------------------------------------------------------------------------- /src/main/resources/front/images/favico.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/favico.ico -------------------------------------------------------------------------------- /src/main/resources/front/images/headPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/headPage.png -------------------------------------------------------------------------------- /src/main/resources/front/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/home.png -------------------------------------------------------------------------------- /src/main/resources/front/images/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/location.png -------------------------------------------------------------------------------- /src/main/resources/front/images/locations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/locations.png -------------------------------------------------------------------------------- /src/main/resources/front/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/logo.png -------------------------------------------------------------------------------- /src/main/resources/front/images/mainBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/mainBg.png -------------------------------------------------------------------------------- /src/main/resources/front/images/money.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/money.png -------------------------------------------------------------------------------- /src/main/resources/front/images/noImg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/noImg.png -------------------------------------------------------------------------------- /src/main/resources/front/images/no_order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/no_order.png -------------------------------------------------------------------------------- /src/main/resources/front/images/no_wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/no_wifi.png -------------------------------------------------------------------------------- /src/main/resources/front/images/orders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/orders.png -------------------------------------------------------------------------------- /src/main/resources/front/images/subtract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/subtract.png -------------------------------------------------------------------------------- /src/main/resources/front/images/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/success.png -------------------------------------------------------------------------------- /src/main/resources/front/images/time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/time.png -------------------------------------------------------------------------------- /src/main/resources/front/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/user.png -------------------------------------------------------------------------------- /src/main/resources/front/images/women.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riverify/rikky-takeaway/2ab86304b27743f9c701c7cbfdb89e873ebe2570/src/main/resources/front/images/women.png -------------------------------------------------------------------------------- /src/main/resources/front/js/base.js: -------------------------------------------------------------------------------- 1 | (function (doc, win) { 2 | var docEl = doc.documentElement, 3 | resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', 4 | recalc = function () { 5 | var clientWidth = docEl.clientWidth; 6 | if (!clientWidth) return; 7 | if (clientWidth > 750) { 8 | docEl.style.fontSize = '28px'; 9 | } else { 10 | docEl.style.fontSize = (clientWidth / 375) + 'px'; 11 | } 12 | }; 13 | 14 | if (!doc.addEventListener) return; 15 | win.addEventListener(resizeEvt, recalc, false); 16 | doc.addEventListener('DOMContentLoaded', recalc, false); 17 | })(document, window); -------------------------------------------------------------------------------- /src/main/resources/front/js/common.js: -------------------------------------------------------------------------------- 1 | var web_prefix = '/front' 2 | 3 | function imgPath(path) { 4 | return '/common/download?name=' + path 5 | } 6 | 7 | //将url传参转换为数组 8 | function parseUrl(url) { 9 | // 找到url中的第一个?号 10 | var parse = url.substring(url.indexOf("?") + 1), 11 | params = parse.split("&"), 12 | len = params.length, 13 | item = [], 14 | param = {}; 15 | 16 | for (var i = 0; i < len; i++) { 17 | item = params[i].split("="); 18 | param[item[0]] = item[1]; 19 | } 20 | 21 | return param; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/front/js/request.js: -------------------------------------------------------------------------------- 1 | (function (win) { 2 | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' 3 | // 创建axios实例 4 | const service = axios.create({ 5 | // axios中请求配置有baseURL选项,表示请求URL公共部分 6 | baseURL: '/', 7 | // 超时 8 | timeout: 10000 9 | }) 10 | // request拦截器 11 | service.interceptors.request.use(config => { 12 | // 是否需要设置 token 13 | // const isToken = (config.headers || {}).isToken === false 14 | // if (getToken() && !isToken) { 15 | // config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 16 | // } 17 | // get请求映射params参数 18 | if (config.method === 'get' && config.params) { 19 | let url = config.url + '?'; 20 | for (const propName of Object.keys(config.params)) { 21 | const value = config.params[propName]; 22 | var part = encodeURIComponent(propName) + "="; 23 | if (value !== null && typeof (value) !== "undefined") { 24 | if (typeof value === 'object') { 25 | for (const key of Object.keys(value)) { 26 | let params = propName + '[' + key + ']'; 27 | var subPart = encodeURIComponent(params) + "="; 28 | url += subPart + encodeURIComponent(value[key]) + "&"; 29 | } 30 | } else { 31 | url += part + encodeURIComponent(value) + "&"; 32 | } 33 | } 34 | } 35 | url = url.slice(0, -1); 36 | config.params = {}; 37 | config.url = url; 38 | } 39 | return config 40 | }, error => { 41 | Promise.reject(error) 42 | }) 43 | 44 | // 响应拦截器 45 | service.interceptors.response.use(res => { 46 | console.log('---响应拦截器---', res) 47 | if (res.data.code === 0 && res.data.msg === 'NOTLOGIN') {// 返回登录页面 48 | window.top.location.href = '/front/page/login.html' 49 | } else { 50 | return res.data 51 | } 52 | }, 53 | error => { 54 | let {message} = error; 55 | if (message == "Network Error") { 56 | message = "后端接口连接异常"; 57 | } else if (message.includes("timeout")) { 58 | message = "系统接口请求超时"; 59 | } else if (message.includes("Request failed with status code")) { 60 | message = "系统接口" + message.substr(message.length - 3) + "异常"; 61 | } 62 | window.vant.Notify({ 63 | message: message, 64 | type: 'warning', 65 | duration: 5 * 1000 66 | }) 67 | //window.top.location.href = '/front/page/no-wify.html' 68 | return Promise.reject(error) 69 | } 70 | ) 71 | win.$axios = service 72 | })(window); 73 | -------------------------------------------------------------------------------- /src/main/resources/front/page/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 会员制餐厅 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 |
登录
26 |
27 | 28 | 29 |
30 | 31 | 32 | 获取验证码 33 |
34 |
邮箱格式不正确,请重新输入
35 | 36 | 登录 37 | 38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 124 | -------------------------------------------------------------------------------- /src/main/resources/front/page/no-wify.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 会员制餐厅 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 |
23 | 菩提阁 24 |
25 |
26 |
27 | 28 |
网络连接异常
29 |
点击刷新
30 |
31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 61 | 62 | -------------------------------------------------------------------------------- /src/main/resources/front/page/pay-success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 会员制餐厅 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 |
23 | 24 | 菩提阁 25 | 26 |
27 |
28 |
29 | 30 |
下单成功
31 |
预计{{finishTime}}到达
32 |
后厨正在加紧制作中,请耐心等待~
33 |
查看订单
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 90 | 91 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/address-edit.css: -------------------------------------------------------------------------------- 1 | #address_edit { 2 | height: 100%; 3 | } 4 | 5 | #address_edit .divHead { 6 | width: 100%; 7 | height: 88rem; 8 | opacity: 1; 9 | background: #333333; 10 | position: relative; 11 | } 12 | 13 | #address_edit .divHead .divTitle { 14 | font-size: 18rem; 15 | font-family: PingFangSC, PingFangSC-Regular; 16 | font-weight: 500; 17 | text-align: center; 18 | color: #ffffff; 19 | line-height: 25rem; 20 | letter-spacing: 0; 21 | position: absolute; 22 | bottom: 13rem; 23 | width: 100%; 24 | } 25 | 26 | #address_edit .divHead .divTitle i { 27 | position: absolute; 28 | left: 16rem; 29 | top: 50%; 30 | transform: translate(0, -50%); 31 | } 32 | 33 | #address_edit .divContent { 34 | height: 100%; 35 | opacity: 1; 36 | background: #ffffff; 37 | padding-left: 9rem; 38 | padding-right: 9rem; 39 | } 40 | 41 | #address_edit .divContent .divItem { 42 | height: 55rem; 43 | line-height: 55rem; 44 | font-size: 14rem; 45 | font-family: PingFangSC, PingFangSC-Regular; 46 | font-weight: 500; 47 | text-align: left; 48 | color: #333333; 49 | line-height: 20rem; 50 | letter-spacing: 0rem; 51 | border-bottom: 1px solid #efefef; 52 | display: flex; 53 | align-items: center; 54 | } 55 | 56 | #address_edit .divContent .divItem .el-input { 57 | width: auto; 58 | } 59 | 60 | #address_edit .divContent .divItem input { 61 | border: 0; 62 | padding: 0; 63 | } 64 | 65 | #address_edit .divContent .divItem .inputUser { 66 | width: 150rem; 67 | } 68 | 69 | #address_edit .divContent .divItem span { 70 | display: block; 71 | } 72 | 73 | #address_edit .divContent .divItem span:first-child { 74 | margin-right: 12rem; 75 | white-space: nowrap; 76 | width: 69rem; 77 | } 78 | 79 | #address_edit .divContent .divItem .spanChecked { 80 | width: 50rem; 81 | } 82 | 83 | #address_edit .divContent .divItem span i { 84 | width: 16rem; 85 | height: 16rem; 86 | background: url(./../images/checked_false.png); 87 | display: inline-block; 88 | background-size: cover; 89 | vertical-align: sub; 90 | } 91 | 92 | #address_edit .divContent .divItem span .iActive { 93 | background: url(./../images/checked_true.png); 94 | background-size: cover; 95 | } 96 | 97 | #address_edit .divContent .divItem .spanItem { 98 | width: 34rem; 99 | height: 20rem; 100 | opacity: 1; 101 | border: 1px solid #e5e4e4; 102 | border-radius: 3rem; 103 | text-align: center; 104 | margin-right: 10rem; 105 | border-radius: 2px; 106 | font-family: PingFangSC, PingFangSC-Regular; 107 | font-weight: 400; 108 | color: #333333; 109 | } 110 | 111 | #address_edit .divContent .divItem .spanActiveCompany { 112 | background: #e1f1fe; 113 | } 114 | 115 | #address_edit .divContent .divItem .spanActiveHome { 116 | background: #fef8e7; 117 | } 118 | 119 | #address_edit .divContent .divItem .spanActiveSchool { 120 | background: #e7fef8; 121 | } 122 | 123 | #address_edit .divContent .divItem .el-input__inner { 124 | font-size: 13px; 125 | font-family: PingFangSC, PingFangSC-Regular; 126 | font-weight: 400; 127 | text-align: left; 128 | color: #333333; 129 | } 130 | 131 | #address_edit .divContent .divSave { 132 | height: 36rem; 133 | opacity: 1; 134 | background: #ffc200; 135 | border-radius: 18rem; 136 | font-size: 15rem; 137 | font-family: PingFangSC, PingFangSC-Regular; 138 | font-weight: 500; 139 | text-align: center; 140 | color: #333333; 141 | line-height: 36rem; 142 | margin-top: 20rem; 143 | } 144 | 145 | #address_edit .divContent .divDelete { 146 | height: 36rem; 147 | opacity: 1; 148 | background: #f6f6f6; 149 | border-radius: 18rem; 150 | font-size: 15rem; 151 | font-family: PingFangSC, PingFangSC-Regular; 152 | font-weight: 500; 153 | text-align: center; 154 | color: #333333; 155 | line-height: 36rem; 156 | margin-top: 20rem; 157 | } 158 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/address.css: -------------------------------------------------------------------------------- 1 | #address .divHead { 2 | width: 100%; 3 | height: 88rem; 4 | opacity: 1; 5 | background: #333333; 6 | position: relative; 7 | } 8 | 9 | #address .divHead .divTitle { 10 | font-size: 18rem; 11 | font-family: PingFangSC, PingFangSC-Regular; 12 | font-weight: 500; 13 | text-align: center; 14 | color: #ffffff; 15 | line-height: 25rem; 16 | letter-spacing: 0; 17 | position: absolute; 18 | bottom: 13rem; 19 | width: 100%; 20 | } 21 | 22 | #address .divHead .divTitle i { 23 | position: absolute; 24 | left: 16rem; 25 | top: 50%; 26 | transform: translate(0, -50%); 27 | } 28 | 29 | #address .divContent { 30 | height: calc(100vh - 157rem); 31 | overflow: auto; 32 | } 33 | 34 | #address .divContent .divItem { 35 | height: 128rem; 36 | opacity: 1; 37 | background: #ffffff; 38 | border-radius: 6rem; 39 | margin-top: 10rem; 40 | margin-left: 10rem; 41 | margin-right: 9rem; 42 | padding-left: 12rem; 43 | position: relative; 44 | } 45 | 46 | #address .divContent .divItem > img { 47 | width: 16rem; 48 | height: 16rem; 49 | position: absolute; 50 | top: 40rem; 51 | right: 24rem; 52 | } 53 | 54 | #address .divContent .divItem .divDefault img { 55 | width: 16rem; 56 | height: 16rem; 57 | opacity: 1; 58 | } 59 | 60 | #address .divContent .divItem .divAddress { 61 | font-size: 14rem; 62 | font-family: PingFangSC, PingFangSC-Regular; 63 | font-weight: 400; 64 | text-align: left; 65 | color: #333333; 66 | line-height: 20rem; 67 | letter-spacing: 0; 68 | padding-top: 21rem; 69 | overflow: hidden; 70 | text-overflow: ellipsis; 71 | white-space: nowrap; 72 | width: 280rem; 73 | } 74 | 75 | #address .divContent .divItem .divAddress span { 76 | width: 34rem; 77 | height: 20rem; 78 | opacity: 1; 79 | font-size: 12rem; 80 | display: inline-block; 81 | text-align: center; 82 | margin-right: 4rem; 83 | margin-bottom: 10rem; 84 | } 85 | 86 | #address .divContent .divItem .divUserPhone span { 87 | height: 20rem; 88 | opacity: 1; 89 | font-size: 14rem; 90 | font-family: PingFangSC, PingFangSC-Regular; 91 | font-weight: 400; 92 | text-align: left; 93 | color: #999999; 94 | line-height: 20rem; 95 | letter-spacing: 0; 96 | margin-right: 10rem; 97 | } 98 | 99 | #address .divContent .divItem .divUserPhone span:first-child { 100 | margin-right: 2rem; 101 | } 102 | 103 | #address .divContent .divItem .divAddress .spanCompany { 104 | background-color: #e1f1fe; 105 | } 106 | 107 | #address .divContent .divItem .divAddress .spanHome { 108 | background: #fef8e7; 109 | } 110 | 111 | #address .divContent .divItem .divAddress .spanSchool { 112 | background: #e7fef8; 113 | } 114 | 115 | #address .divContent .divItem .divSplit { 116 | height: 1px; 117 | opacity: 1; 118 | background: #efefef; 119 | border: 0; 120 | margin-top: 16rem; 121 | margin-bottom: 10rem; 122 | margin-right: 10rem; 123 | } 124 | 125 | #address .divContent .divItem .divDefault { 126 | height: 18rem; 127 | opacity: 1; 128 | font-size: 13rem; 129 | font-family: PingFangSC, PingFangSC-Regular; 130 | font-weight: 400; 131 | text-align: left; 132 | color: #333333; 133 | line-height: 18rem; 134 | letter-spacing: 0; 135 | } 136 | 137 | #address .divContent .divItem .divDefault img { 138 | height: 18rem; 139 | width: 18rem; 140 | margin-right: 5rem; 141 | vertical-align: bottom; 142 | } 143 | 144 | #address .divBottom { 145 | height: 36rem; 146 | opacity: 1; 147 | background: #ffc200; 148 | border-radius: 18rem; 149 | opacity: 1; 150 | font-size: 15rem; 151 | font-family: PingFangSC, PingFangSC-Regular; 152 | font-weight: 500; 153 | text-align: center; 154 | color: #333333; 155 | line-height: 36rem; 156 | letter-spacing: 0; 157 | position: absolute; 158 | bottom: 23rem; 159 | left: 50%; 160 | transform: translate(-50%, 0); 161 | width: 334rem; 162 | } 163 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/index.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | max-width: 750px; 4 | height: 100%; 5 | background: #f3f2f7; 6 | font-family: Helvetica; 7 | overflow: hidden; 8 | } 9 | 10 | html, 11 | body, 12 | h1, 13 | h2, 14 | h3, 15 | h4, 16 | h5, 17 | h6, 18 | p, 19 | ul, 20 | li { 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | ul, 26 | li { 27 | list-style: none; 28 | } 29 | 30 | h1, 31 | h2, 32 | h3, 33 | h4, 34 | h5, 35 | h6 { 36 | font-weight: normal; 37 | } 38 | 39 | h3 { 40 | font-size: 16px; 41 | } 42 | 43 | h4 { 44 | font-size: 14px; 45 | } 46 | 47 | p { 48 | font-size: 12px; 49 | } 50 | 51 | em, 52 | i { 53 | font-style: normal; 54 | } 55 | 56 | @font-face { 57 | font-family: "DIN-Medium"; 58 | src: url("../fonts/DIN-Medium.otf"); 59 | font-weight: normal; 60 | font-style: normal; 61 | } 62 | 63 | @font-face { 64 | font-family: "DIN"; 65 | src: url("../fonts/DIN-Bold.otf"); 66 | font-weight: normal; 67 | font-style: normal; 68 | } 69 | 70 | @font-face { 71 | font-family: "PingFangSC-Regular"; 72 | src: url("../fonts/PingFangSC-Regular.ttf"); 73 | font-weight: normal; 74 | font-style: normal; 75 | } 76 | 77 | @font-face { 78 | font-family: "PingFangSC-Regular"; 79 | src: url("../fonts/PingFangSC-Regular.ttf"); 80 | font-weight: normal; 81 | font-style: normal; 82 | } 83 | 84 | @font-face { 85 | font-family: "PingFangSC-Semibold"; 86 | src: url("../fonts/PingFangSC-Semibold.ttf"); 87 | font-weight: normal; 88 | font-style: normal; 89 | } 90 | 91 | .app { 92 | height: 100%; 93 | } 94 | 95 | .van-overlay { 96 | background-color: rgba(0, 0, 0, 0.3); 97 | } 98 | 99 | .van-dialog { 100 | overflow: inherit; 101 | } 102 | 103 | ::-webkit-input-placeholder { 104 | font-size: 13rem; 105 | font-family: PingFangSC, PingFangSC-Regular; 106 | font-weight: 400; 107 | text-align: left; 108 | color: #999999; 109 | } 110 | 111 | :-moz-placeholder { 112 | /* Firefox 18- */ 113 | font-size: 13rem; 114 | font-family: PingFangSC, PingFangSC-Regular; 115 | font-weight: 400; 116 | text-align: left; 117 | color: #999999; 118 | } 119 | 120 | ::-moz-placeholder { 121 | /* Firefox 19+ */ 122 | font-size: 13rem; 123 | font-family: PingFangSC, PingFangSC-Regular; 124 | font-weight: 400; 125 | text-align: left; 126 | color: #999999; 127 | } 128 | 129 | :-ms-input-placeholder { 130 | font-size: 13rem; 131 | font-family: PingFangSC, PingFangSC-Regular; 132 | font-weight: 400; 133 | text-align: left; 134 | color: #999999; 135 | } 136 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/login.css: -------------------------------------------------------------------------------- 1 | #login .divHead { 2 | opacity: 1; 3 | background: #333333; 4 | height: 88rem; 5 | width: 100%; 6 | font-size: 18rem; 7 | font-family: PingFangSC, PingFangSC-Regular; 8 | font-weight: 500; 9 | text-align: center; 10 | color: #ffffff; 11 | line-height: 88rem; 12 | } 13 | 14 | #login .divContainer { 15 | width: 356rem; 16 | height: 128rem; 17 | opacity: 1; 18 | background: #ffffff; 19 | border-radius: 6rem; 20 | margin: 0 auto; 21 | margin-top: 10rem; 22 | position: relative; 23 | } 24 | 25 | #login .divContainer input { 26 | border: 0; 27 | height: 63rem; 28 | } 29 | 30 | #login .divContainer .divSplit { 31 | height: 1px; 32 | background-color: #efefef; 33 | border: 0; 34 | margin-left: 10rem; 35 | margin-right: 10rem; 36 | } 37 | 38 | #login .divContainer span { 39 | position: absolute; 40 | right: 20rem; 41 | top: 20rem; 42 | cursor: pointer; 43 | opacity: 1; 44 | font-size: 12rem; 45 | font-family: PingFangSC, PingFangSC-Regular; 46 | font-weight: 400; 47 | text-align: left; 48 | color: #ffc200; 49 | letter-spacing: 0px; 50 | } 51 | 52 | #login .divMsg { 53 | width: 168px; 54 | height: 17px; 55 | opacity: 1; 56 | font-size: 12px; 57 | font-family: PingFangSC, PingFangSC-Regular; 58 | font-weight: 400; 59 | text-align: center; 60 | color: #e94e3c; 61 | line-height: 17px; 62 | margin-left: 26rem; 63 | margin-top: 10rem; 64 | } 65 | 66 | #login .btnSubmit { 67 | width: 356rem; 68 | height: 40rem; 69 | margin: 20rem 10rem 0 10rem; 70 | border-radius: 20px; 71 | border: 0; 72 | 73 | font-size: 15rem; 74 | font-family: PingFangSC, PingFangSC-Regular; 75 | font-weight: 500; 76 | text-align: center; 77 | } 78 | 79 | #login .btnNoPhone { 80 | color: #666666; 81 | background: #d8d8d8; 82 | } 83 | 84 | #login .btnNoPhone:active { 85 | background: #afafaf; 86 | } 87 | 88 | #login .btnPhone { 89 | background: #ffc200; 90 | color: #333333; 91 | } 92 | 93 | #login .btnPhone:active { 94 | background: rgba(255, 142, 0, 1); 95 | color: #333333; 96 | } 97 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/no-wify.css: -------------------------------------------------------------------------------- 1 | #no_wifi .divHead { 2 | width: 100%; 3 | height: 88rem; 4 | opacity: 1; 5 | background: #333333; 6 | position: relative; 7 | } 8 | 9 | #no_wifi .divHead .divTitle { 10 | font-size: 18rem; 11 | font-family: PingFangSC, PingFangSC-Regular; 12 | font-weight: 500; 13 | text-align: center; 14 | color: #ffffff; 15 | line-height: 25rem; 16 | letter-spacing: 0; 17 | position: absolute; 18 | bottom: 13rem; 19 | width: 100%; 20 | } 21 | 22 | #no_wifi .divHead .divTitle i { 23 | position: absolute; 24 | left: 16rem; 25 | top: 50%; 26 | transform: translate(0, -50%); 27 | } 28 | 29 | #no_wifi .divContent { 30 | height: calc(100vh - 88rem); 31 | width: 100%; 32 | background: #ffffff; 33 | display: flex; 34 | flex-direction: column; 35 | text-align: center; 36 | align-items: center; 37 | } 38 | 39 | #no_wifi .divContent img { 40 | width: 239rem; 41 | height: 130rem; 42 | margin-top: 104rem; 43 | margin-bottom: 19rem; 44 | } 45 | 46 | #no_wifi .divContent .divDesc { 47 | height: 33rem; 48 | opacity: 1; 49 | font-size: 24rem; 50 | font-family: PingFangSC, PingFangSC-Regular; 51 | font-weight: 500; 52 | text-align: center; 53 | color: #333333; 54 | line-height: 33rem; 55 | letter-spacing: 0; 56 | margin-bottom: 20rem; 57 | } 58 | 59 | #no_wifi .divContent .btnRefresh { 60 | width: 124rem; 61 | height: 36rem; 62 | opacity: 1; 63 | background: #ffc200; 64 | border-radius: 18px; 65 | opacity: 1; 66 | font-size: 15rem; 67 | font-family: PingFangSC, PingFangSC-Regular; 68 | font-weight: 500; 69 | text-align: center; 70 | color: #333333; 71 | line-height: 21rem; 72 | letter-spacing: 0; 73 | line-height: 36rem; 74 | } 75 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/order.css: -------------------------------------------------------------------------------- 1 | #order { 2 | height: 100%; 3 | } 4 | 5 | #order .divHead { 6 | width: 100%; 7 | height: 88rem; 8 | opacity: 1; 9 | background: #333333; 10 | position: relative; 11 | } 12 | 13 | #order .divHead .divTitle { 14 | font-size: 18rem; 15 | font-family: PingFangSC, PingFangSC-Regular; 16 | font-weight: 500; 17 | text-align: center; 18 | color: #ffffff; 19 | line-height: 25rem; 20 | letter-spacing: 0; 21 | position: absolute; 22 | bottom: 13rem; 23 | width: 100%; 24 | } 25 | 26 | #order .divHead .divTitle i { 27 | position: absolute; 28 | left: 16rem; 29 | top: 50%; 30 | transform: translate(0, -50%); 31 | } 32 | 33 | #order .divBody { 34 | margin: 10rem 12rem 10rem 12rem; 35 | background: #ffffff; 36 | border-radius: 6rem; 37 | padding-left: 10rem; 38 | padding-right: 10rem; 39 | height: calc(100% - 108rem); 40 | overflow-y: auto; 41 | } 42 | 43 | #order .divBody .van-list .van-cell::after { 44 | border: 0; 45 | } 46 | 47 | #order .divBody .item .timeStatus { 48 | height: 46rem; 49 | line-height: 16rem; 50 | font-size: 14rem; 51 | font-family: PingFangSC, PingFangSC-Regular; 52 | font-weight: 400; 53 | text-align: left; 54 | color: #666666; 55 | line-height: 20rem; 56 | letter-spacing: 0; 57 | display: flex; 58 | justify-content: space-between; 59 | align-items: center; 60 | border-bottom: 2rem dashed #efefef; 61 | border-top: 1px solid #efefef; 62 | } 63 | 64 | #order .divBody .item .timeStatus span:first-child { 65 | color: #333333; 66 | } 67 | 68 | #order .divBody .item .dishList { 69 | padding-top: 10rem; 70 | padding-bottom: 11rem; 71 | } 72 | 73 | #order .divBody .item .dishList .item { 74 | padding-top: 5rem; 75 | padding-bottom: 5rem; 76 | display: flex; 77 | justify-content: space-between; 78 | height: 20rem; 79 | opacity: 1; 80 | font-size: 14rem; 81 | font-family: PingFangSC, PingFangSC-Regular; 82 | font-weight: 400; 83 | text-align: left; 84 | color: #666666; 85 | line-height: 20rem; 86 | letter-spacing: 0; 87 | } 88 | 89 | #order .divBody .item .result { 90 | display: flex; 91 | justify-content: flex-end; 92 | height: 20rem; 93 | opacity: 1; 94 | font-size: 14rem; 95 | font-family: PingFangSC, PingFangSC-Regular; 96 | font-weight: 400; 97 | text-align: left; 98 | color: #666666; 99 | line-height: 20rem; 100 | } 101 | 102 | #order .divBody .item .result .price { 103 | color: #343434; 104 | } 105 | 106 | #order .divBody .item .btn { 107 | display: flex; 108 | justify-content: flex-end; 109 | margin-bottom: 17rem; 110 | margin-top: 20rem; 111 | } 112 | 113 | #order .divBody .btn .btnAgain { 114 | width: 124rem; 115 | height: 36rem; 116 | opacity: 1; 117 | border: 1px solid #e5e4e4; 118 | border-radius: 19rem; 119 | opacity: 1; 120 | font-size: 14rem; 121 | font-family: PingFangSC, PingFangSC-Regular; 122 | font-weight: 500; 123 | text-align: center; 124 | color: #333333; 125 | line-height: 36rem; 126 | letter-spacing: 0; 127 | position: relative; 128 | } 129 | 130 | #order .divNoData { 131 | width: 100%; 132 | height: calc(100% - 88rem); 133 | display: flex; 134 | flex-direction: column; 135 | align-items: center; 136 | justify-content: center; 137 | } 138 | 139 | #order .divNoData .divContainer img { 140 | width: 240rem; 141 | height: 129rem; 142 | } 143 | 144 | #order .divNoData .divContainer div { 145 | font-size: 24rem; 146 | font-family: PingFangSC, PingFangSC-Medium; 147 | font-weight: 500; 148 | text-align: center; 149 | color: #333333; 150 | line-height: 33rem; 151 | height: 33rem; 152 | margin-top: 20rem; 153 | } 154 | -------------------------------------------------------------------------------- /src/main/resources/front/styles/pay-success.css: -------------------------------------------------------------------------------- 1 | #pay_success .divHead { 2 | width: 100%; 3 | height: 88rem; 4 | opacity: 1; 5 | background: #333333; 6 | position: relative; 7 | } 8 | 9 | #pay_success .divHead .divTitle { 10 | font-size: 18rem; 11 | font-family: PingFangSC, PingFangSC-Regular; 12 | font-weight: 500; 13 | text-align: center; 14 | color: #ffffff; 15 | line-height: 25rem; 16 | letter-spacing: 0; 17 | position: absolute; 18 | bottom: 13rem; 19 | width: 100%; 20 | display: flex; 21 | justify-content: space-between; 22 | align-items: center; 23 | } 24 | 25 | #pay_success .divHead .divTitle i { 26 | margin-left: 16rem; 27 | } 28 | 29 | #pay_success .divHead .divTitle img { 30 | width: 18rem; 31 | height: 18rem; 32 | margin-right: 19rem; 33 | } 34 | 35 | #pay_success .divContent { 36 | height: calc(100vh - 88rem); 37 | width: 100%; 38 | background: #ffffff; 39 | display: flex; 40 | flex-direction: column; 41 | text-align: center; 42 | align-items: center; 43 | } 44 | 45 | #pay_success .divContent img { 46 | margin-top: 148rem; 47 | margin-bottom: 19rem; 48 | width: 90rem; 49 | height: 86rem; 50 | } 51 | 52 | #pay_success .divContent .divSuccess { 53 | height: 33rem; 54 | opacity: 1; 55 | font-size: 24rem; 56 | font-family: PingFangSC, PingFangSC-Regular; 57 | font-weight: 500; 58 | text-align: center; 59 | color: #333333; 60 | line-height: 33rem; 61 | margin-top: 19rem; 62 | margin-bottom: 10rem; 63 | } 64 | 65 | #pay_success .divContent .divDesc, 66 | .divDesc1 { 67 | height: 22rem; 68 | opacity: 1; 69 | font-size: 16rem; 70 | font-family: PingFangSC, PingFangSC-Regular; 71 | font-weight: 400; 72 | text-align: center; 73 | color: #666666; 74 | line-height: 22rem; 75 | } 76 | 77 | #pay_success .divContent .divDesc1 { 78 | margin-top: 7rem; 79 | margin-bottom: 20rem; 80 | } 81 | 82 | #pay_success .divContent .btnView { 83 | width: 124rem; 84 | height: 36rem; 85 | opacity: 1; 86 | background: #ffc200; 87 | border-radius: 18px; 88 | opacity: 1; 89 | font-size: 15rem; 90 | font-family: PingFangSC, PingFangSC-Regular; 91 | font-weight: 500; 92 | text-align: center; 93 | color: #333333; 94 | line-height: 21rem; 95 | letter-spacing: 0; 96 | line-height: 36rem; 97 | } 98 | -------------------------------------------------------------------------------- /src/test/java/com/fubukiss/test/MailSendTest.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.mail.SimpleMailMessage; 6 | import org.springframework.mail.javamail.JavaMailSender; 7 | import org.springframework.mail.javamail.JavaMailSenderImpl; 8 | import org.springframework.stereotype.Controller; 9 | 10 | /** 11 | * FileName: MailSendTest 12 | * Date: 2023/01/16 13 | * Time: 23:41 14 | * Author: river 15 | */ 16 | @Controller 17 | public class MailSendTest { 18 | @Autowired 19 | JavaMailSender javaMailSender; 20 | 21 | @Test 22 | public void sendMail() { 23 | javaMailSender = new JavaMailSenderImpl(); 24 | // 生成4位验证码 25 | String code = String.valueOf((int) ((Math.random() * 9 + 1) * 1000)); 26 | // 发送邮件 27 | // 构建一个邮件对象 28 | SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); 29 | // 设置邮件发送者 30 | simpleMailMessage.setFrom("no-reply-me@foxmail.com"); 31 | simpleMailMessage.setSubject("Test"); 32 | simpleMailMessage.setTo("1105799454@qq.com"); 33 | simpleMailMessage.setText("test111"); 34 | javaMailSender.send(simpleMailMessage); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/fubukiss/test/UploadFileTest.java: -------------------------------------------------------------------------------- 1 | package com.fubukiss.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | /** 6 | *

Project: rikky-takeaway - UploadFileTest 文件上传测试类 7 | *

Powered by river On 2023/01/10 9:53 PM 8 | * 9 | * @author Riverify 10 | * @version 1.0 11 | * @since JDK8 12 | */ 13 | public class UploadFileTest { 14 | 15 | @Test 16 | public void test1() { 17 | String fileName = "114514.jpg"; 18 | String suffix = fileName.substring(fileName.lastIndexOf(".")); 19 | System.out.println(suffix); 20 | } 21 | } 22 | --------------------------------------------------------------------------------