├── vue ├── .env.production ├── .env.development ├── src │ ├── App.vue │ ├── assets │ │ ├── imgs │ │ │ ├── bg.jpg │ │ │ ├── bg1.jpg │ │ │ ├── logo.png │ │ │ ├── title.jpg │ │ │ ├── icon-1.png │ │ │ ├── icon-2.png │ │ │ ├── icon-3.png │ │ │ ├── background.jpg │ │ │ ├── carousel.jpg │ │ │ ├── background2.jpg │ │ │ └── background3.jpg │ │ └── css │ │ │ ├── theme │ │ │ └── fonts │ │ │ │ ├── element-icons.ttf │ │ │ │ └── element-icons.woff │ │ │ ├── global.css │ │ │ ├── front.css │ │ │ └── manager.css │ ├── views │ │ ├── 404.vue │ │ ├── manager │ │ │ ├── 403.vue │ │ │ ├── Home.vue │ │ │ ├── Password.vue │ │ │ ├── AdminPerson.vue │ │ │ ├── HotelPerson.vue │ │ │ ├── Comment.vue │ │ │ ├── Orders.vue │ │ │ ├── Notice.vue │ │ │ ├── User.vue │ │ │ ├── Room.vue │ │ │ ├── Type.vue │ │ │ ├── Admin.vue │ │ │ ├── Checkin.vue │ │ │ └── Hotel.vue │ │ ├── front │ │ │ ├── Search.vue │ │ │ ├── Collect.vue │ │ │ ├── History.vue │ │ │ ├── Hotel.vue │ │ │ ├── Orders.vue │ │ │ ├── Home.vue │ │ │ └── Person.vue │ │ ├── Login.vue │ │ ├── Register.vue │ │ ├── Front.vue │ │ └── Manager.vue │ ├── main.js │ ├── utils │ │ └── request.js │ └── router │ │ └── index.js ├── babel.config.js ├── public │ ├── favicon.ico │ └── index.html ├── jsconfig.json ├── vue.config.js └── package.json ├── screenshot ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 16.png ├── 17.png ├── 18.png ├── 19.png ├── 20.png ├── 21.png ├── 22.png ├── 23.png ├── 24.png ├── 25.png ├── 26.png ├── 27.png ├── 28.png ├── 29.png └── 30.png ├── files ├── 1713338392038-樱兰.jpg ├── 1698155465247-柴犬.jpeg ├── 1698155543709-柴犬.jpeg ├── 1698306441777-维也纳酒店.jpg ├── 1698306804301-维也纳酒店.jpg ├── 1698306835737-如家酒店.jpg ├── 1698310493050-柯基.jpeg ├── 1698392674124-汉庭酒店.jpg ├── 1698392695016-全季酒店.jpg ├── 1712759663862-大床房.png ├── 1712925067890-test3.jpg ├── 1697438073596-avatar.png ├── 1715501027909-profile.jpg ├── 1698396014715-如家酒店-大床房.jpg ├── 1698396757530-如家酒店-标准间.jpg ├── 1698396801645-如家酒店-双人床.jpg ├── 1698396813533-如家酒店-豪华间.jpg ├── 1698397114105-汉庭酒店-标准间.jpg ├── 1698397153744-汉庭酒店-双人间.jpg ├── 1698397174977-汉庭酒店-大床房.jpg ├── 1698397191401-汉庭酒店-豪华间.jpg ├── 1698397244139-维也纳酒店-标准间.jpg ├── 1698397290398-维也纳酒店-双人间.jpg ├── 1698397313773-维也纳酒店-大床房.jpg ├── 1698397337708-维也纳酒店-豪华间.jpg ├── 1698397408639-全季酒店-标准间.jpg ├── 1698397469587-全季酒店-双人间.jpg ├── 1698397500771-全季酒店-大床房.jpg ├── 1698397526335-全季酒店-豪华间.jpg ├── 1712759688764-weiyena1.png ├── 1713338999932-微信图片_20230426134209.jpg └── 1713339030408-微信图片_20230426134209.jpg ├── springboot ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ ├── common │ │ │ ├── Constants.java │ │ │ ├── enums │ │ │ │ ├── RoleEnum.java │ │ │ │ ├── RoomEnum.java │ │ │ │ ├── OrdersEnum.java │ │ │ │ ├── StatusEnum.java │ │ │ │ └── ResultCodeEnum.java │ │ │ ├── config │ │ │ │ ├── WebConfig.java │ │ │ │ ├── CorsConfig.java │ │ │ │ └── JwtInterceptor.java │ │ │ └── Result.java │ │ │ ├── SpringbootApplication.java │ │ │ ├── mapper │ │ │ ├── NoticeMapper.java │ │ │ ├── CheckinMapper.java │ │ │ ├── UserMapper.java │ │ │ ├── AdminMapper.java │ │ │ ├── RoomMapper.java │ │ │ ├── TypeMapper.java │ │ │ ├── HotelMapper.java │ │ │ ├── OrdersMapper.java │ │ │ ├── CollectMapper.java │ │ │ └── CommentMapper.java │ │ │ ├── exception │ │ │ ├── CustomException.java │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── controller │ │ │ ├── CollectController.java │ │ │ ├── UserController.java │ │ │ ├── AdminController.java │ │ │ ├── NoticeController.java │ │ │ ├── RoomController.java │ │ │ ├── HotelController.java │ │ │ ├── CommentController.java │ │ │ ├── CheckinController.java │ │ │ ├── TypeController.java │ │ │ ├── OrdersController.java │ │ │ ├── FileController.java │ │ │ └── WebController.java │ │ │ └── utils │ │ │ ├── UserCF.java │ │ │ ├── TokenUtils.java │ │ │ └── CoreMath.java │ │ └── resources │ │ └── application.yml └── pom.xml ├── .gitignore └── README.md /vue/.env.production: -------------------------------------------------------------------------------- 1 | VUE_APP_BASEURL='http://:9090' -------------------------------------------------------------------------------- /vue/.env.development: -------------------------------------------------------------------------------- 1 | VUE_APP_BASEURL='http://localhost:9091' -------------------------------------------------------------------------------- /vue/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /vue/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/8.png -------------------------------------------------------------------------------- /screenshot/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/9.png -------------------------------------------------------------------------------- /screenshot/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/10.png -------------------------------------------------------------------------------- /screenshot/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/11.png -------------------------------------------------------------------------------- /screenshot/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/12.png -------------------------------------------------------------------------------- /screenshot/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/13.png -------------------------------------------------------------------------------- /screenshot/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/14.png -------------------------------------------------------------------------------- /screenshot/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/15.png -------------------------------------------------------------------------------- /screenshot/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/16.png -------------------------------------------------------------------------------- /screenshot/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/17.png -------------------------------------------------------------------------------- /screenshot/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/18.png -------------------------------------------------------------------------------- /screenshot/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/19.png -------------------------------------------------------------------------------- /screenshot/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/20.png -------------------------------------------------------------------------------- /screenshot/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/21.png -------------------------------------------------------------------------------- /screenshot/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/22.png -------------------------------------------------------------------------------- /screenshot/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/23.png -------------------------------------------------------------------------------- /screenshot/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/24.png -------------------------------------------------------------------------------- /screenshot/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/25.png -------------------------------------------------------------------------------- /screenshot/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/26.png -------------------------------------------------------------------------------- /screenshot/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/27.png -------------------------------------------------------------------------------- /screenshot/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/28.png -------------------------------------------------------------------------------- /screenshot/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/29.png -------------------------------------------------------------------------------- /screenshot/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/screenshot/30.png -------------------------------------------------------------------------------- /vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/public/favicon.ico -------------------------------------------------------------------------------- /files/1713338392038-樱兰.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1713338392038-樱兰.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/bg.jpg -------------------------------------------------------------------------------- /files/1698155465247-柴犬.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698155465247-柴犬.jpeg -------------------------------------------------------------------------------- /files/1698155543709-柴犬.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698155543709-柴犬.jpeg -------------------------------------------------------------------------------- /files/1698306441777-维也纳酒店.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698306441777-维也纳酒店.jpg -------------------------------------------------------------------------------- /files/1698306804301-维也纳酒店.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698306804301-维也纳酒店.jpg -------------------------------------------------------------------------------- /files/1698306835737-如家酒店.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698306835737-如家酒店.jpg -------------------------------------------------------------------------------- /files/1698310493050-柯基.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698310493050-柯基.jpeg -------------------------------------------------------------------------------- /files/1698392674124-汉庭酒店.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698392674124-汉庭酒店.jpg -------------------------------------------------------------------------------- /files/1698392695016-全季酒店.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698392695016-全季酒店.jpg -------------------------------------------------------------------------------- /files/1712759663862-大床房.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1712759663862-大床房.png -------------------------------------------------------------------------------- /files/1712925067890-test3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1712925067890-test3.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/bg1.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/logo.png -------------------------------------------------------------------------------- /vue/src/assets/imgs/title.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/title.jpg -------------------------------------------------------------------------------- /files/1697438073596-avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1697438073596-avatar.png -------------------------------------------------------------------------------- /files/1715501027909-profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1715501027909-profile.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/icon-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/icon-1.png -------------------------------------------------------------------------------- /vue/src/assets/imgs/icon-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/icon-2.png -------------------------------------------------------------------------------- /vue/src/assets/imgs/icon-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/icon-3.png -------------------------------------------------------------------------------- /files/1698396014715-如家酒店-大床房.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698396014715-如家酒店-大床房.jpg -------------------------------------------------------------------------------- /files/1698396757530-如家酒店-标准间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698396757530-如家酒店-标准间.jpg -------------------------------------------------------------------------------- /files/1698396801645-如家酒店-双人床.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698396801645-如家酒店-双人床.jpg -------------------------------------------------------------------------------- /files/1698396813533-如家酒店-豪华间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698396813533-如家酒店-豪华间.jpg -------------------------------------------------------------------------------- /files/1698397114105-汉庭酒店-标准间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397114105-汉庭酒店-标准间.jpg -------------------------------------------------------------------------------- /files/1698397153744-汉庭酒店-双人间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397153744-汉庭酒店-双人间.jpg -------------------------------------------------------------------------------- /files/1698397174977-汉庭酒店-大床房.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397174977-汉庭酒店-大床房.jpg -------------------------------------------------------------------------------- /files/1698397191401-汉庭酒店-豪华间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397191401-汉庭酒店-豪华间.jpg -------------------------------------------------------------------------------- /files/1698397244139-维也纳酒店-标准间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397244139-维也纳酒店-标准间.jpg -------------------------------------------------------------------------------- /files/1698397290398-维也纳酒店-双人间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397290398-维也纳酒店-双人间.jpg -------------------------------------------------------------------------------- /files/1698397313773-维也纳酒店-大床房.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397313773-维也纳酒店-大床房.jpg -------------------------------------------------------------------------------- /files/1698397337708-维也纳酒店-豪华间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397337708-维也纳酒店-豪华间.jpg -------------------------------------------------------------------------------- /files/1698397408639-全季酒店-标准间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397408639-全季酒店-标准间.jpg -------------------------------------------------------------------------------- /files/1698397469587-全季酒店-双人间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397469587-全季酒店-双人间.jpg -------------------------------------------------------------------------------- /files/1698397500771-全季酒店-大床房.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397500771-全季酒店-大床房.jpg -------------------------------------------------------------------------------- /files/1698397526335-全季酒店-豪华间.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1698397526335-全季酒店-豪华间.jpg -------------------------------------------------------------------------------- /files/1712759688764-weiyena1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1712759688764-weiyena1.png -------------------------------------------------------------------------------- /vue/src/assets/imgs/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/background.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/carousel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/carousel.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/background2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/background2.jpg -------------------------------------------------------------------------------- /vue/src/assets/imgs/background3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/imgs/background3.jpg -------------------------------------------------------------------------------- /files/1713338999932-微信图片_20230426134209.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1713338999932-微信图片_20230426134209.jpg -------------------------------------------------------------------------------- /files/1713339030408-微信图片_20230426134209.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/files/1713339030408-微信图片_20230426134209.jpg -------------------------------------------------------------------------------- /vue/src/assets/css/theme/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/css/theme/fonts/element-icons.ttf -------------------------------------------------------------------------------- /vue/src/assets/css/theme/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Descartes007/no035_HotelManagementandRecommendationSys/HEAD/vue/src/assets/css/theme/fonts/element-icons.woff -------------------------------------------------------------------------------- /vue/src/assets/css/global.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | body { 7 | font-size: 14px; 8 | } 9 | a { 10 | text-decoration: none; 11 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/Constants.java: -------------------------------------------------------------------------------- 1 | package com.example.common; 2 | 3 | public interface Constants { 4 | 5 | String TOKEN = "token"; 6 | 7 | String USER_DEFAULT_PASSWORD = "123"; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/enums/RoleEnum.java: -------------------------------------------------------------------------------- 1 | package com.example.common.enums; 2 | 3 | public enum RoleEnum { 4 | // 管理员 5 | ADMIN, 6 | // 酒店 7 | HOTEL, 8 | // 用户 9 | USER, 10 | } 11 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/enums/RoomEnum.java: -------------------------------------------------------------------------------- 1 | package com.example.common.enums; 2 | 3 | public enum RoomEnum { 4 | STATUS_NO("占用"), 5 | STATUS_OK("空闲"), 6 | ; 7 | 8 | public String status; 9 | 10 | RoomEnum(String status) { 11 | this.status = status; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/enums/OrdersEnum.java: -------------------------------------------------------------------------------- 1 | package com.example.common.enums; 2 | 3 | public enum OrdersEnum { 4 | STATUS_CHECKING("待入住"), 5 | STATUS_IN("已入住"), 6 | STATUS_OUT("已退房"), 7 | ; 8 | 9 | public String status; 10 | 11 | OrdersEnum(String status) { 12 | this.status = status; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/enums/StatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.example.common.enums; 2 | 3 | public enum StatusEnum { 4 | CHECKING("待审核"), 5 | CHECK_OK("审核通过"), 6 | CHECK_NO("审核不通过"), 7 | 8 | ; 9 | 10 | public String status; 11 | 12 | StatusEnum(String status) { 13 | this.status = status; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vue/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "esnext", 5 | "baseUrl": "./", 6 | "moduleResolution": "node", 7 | "paths": { 8 | "@/*": [ 9 | "src/*" 10 | ] 11 | }, 12 | "lib": [ 13 | "esnext", 14 | "dom", 15 | "dom.iterable", 16 | "scripthost" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vue/vue.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('@vue/cli-service') 2 | module.exports = defineConfig({ 3 | transpileDependencies: true, 4 | devServer: { 5 | port: 8080 6 | }, 7 | chainWebpack: config =>{ 8 | config.plugin('html') 9 | .tap(args => { 10 | args[0].title = "管理系统"; 11 | return args; 12 | }) 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /vue/src/views/404.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 22 | 23 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/SpringbootApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.example.mapper") 9 | public class SpringbootApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringbootApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vue/src/views/manager/403.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | 22 | -------------------------------------------------------------------------------- /vue/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import ElementUI from 'element-ui' 5 | import 'element-ui/lib/theme-chalk/index.css' 6 | import '@/assets/css/global.css' 7 | import '@/assets/css/theme/index.css' 8 | import request from "@/utils/request"; 9 | 10 | Vue.config.productionTip = false 11 | 12 | Vue.prototype.$request = request 13 | Vue.prototype.$baseUrl = process.env.VUE_APP_BASEURL 14 | 15 | Vue.use(ElementUI, {size: "small"}) 16 | 17 | new Vue({ 18 | router, 19 | render: h => h(App) 20 | }).$mount('#app') 21 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/NoticeMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Notice; 4 | import java.util.List; 5 | 6 | /** 7 | * 操作notice相关数据接口 8 | */ 9 | public interface NoticeMapper { 10 | 11 | /** 12 | * 新增 13 | */ 14 | int insert(Notice notice); 15 | 16 | /** 17 | * 删除 18 | */ 19 | int deleteById(Integer id); 20 | 21 | /** 22 | * 修改 23 | */ 24 | int updateById(Notice notice); 25 | 26 | /** 27 | * 根据ID查询 28 | */ 29 | Notice selectById(Integer id); 30 | 31 | /** 32 | * 查询所有 33 | */ 34 | List selectAll(Notice notice); 35 | 36 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/CheckinMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Checkin; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 操作入住相关数据接口 9 | */ 10 | public interface CheckinMapper { 11 | 12 | /** 13 | * 新增 14 | */ 15 | int insert(Checkin checkin); 16 | 17 | /** 18 | * 删除 19 | */ 20 | int deleteById(Integer id); 21 | 22 | /** 23 | * 修改 24 | */ 25 | int updateById(Checkin checkin); 26 | 27 | /** 28 | * 根据ID查询 29 | */ 30 | Checkin selectById(Integer id); 31 | 32 | /** 33 | * 查询所有 34 | */ 35 | List selectAll(Checkin checkin); 36 | 37 | } -------------------------------------------------------------------------------- /vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "axios": "^1.5.1", 11 | "core-js": "^3.8.3", 12 | "element-ui": "^2.15.14", 13 | "vue": "^2.6.14", 14 | "vue-router": "^3.5.1" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "~5.0.0", 18 | "@vue/cli-plugin-router": "~5.0.0", 19 | "@vue/cli-service": "~5.0.0", 20 | "vue-template-compiler": "^2.6.14" 21 | }, 22 | "browserslist": [ 23 | "> 1%", 24 | "last 2 versions", 25 | "not dead" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /vue/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | 4 | import com.example.entity.User; 5 | import org.apache.ibatis.annotations.Delete; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 操作user相关数据接口 12 | */ 13 | public interface UserMapper { 14 | 15 | 16 | void insert(User user); 17 | 18 | @Select("select * from user where username = #{username}") 19 | User selectByUsername(String username); 20 | 21 | List selectAll(User user); 22 | 23 | void updateById(User user); 24 | 25 | @Delete("delete from user where id = #{id}") 26 | void deleteById(Integer id); 27 | 28 | @Select("select * from user where id = #{id}") 29 | User selectById(Integer id); 30 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Admin; 4 | import org.apache.ibatis.annotations.Select; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 操作admin相关数据接口 10 | */ 11 | public interface AdminMapper { 12 | 13 | /** 14 | * 新增 15 | */ 16 | int insert(Admin admin); 17 | 18 | /** 19 | * 删除 20 | */ 21 | int deleteById(Integer id); 22 | 23 | /** 24 | * 修改 25 | */ 26 | int updateById(Admin admin); 27 | 28 | /** 29 | * 根据ID查询 30 | */ 31 | Admin selectById(Integer id); 32 | 33 | /** 34 | * 查询所有 35 | */ 36 | List selectAll(Admin admin); 37 | 38 | @Select("select * from admin where username = #{username}") 39 | Admin selectByUsername(String username); 40 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/RoomMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Room; 4 | import org.apache.ibatis.annotations.Select; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 操作room相关数据接口 10 | */ 11 | public interface RoomMapper { 12 | 13 | /** 14 | * 新增 15 | */ 16 | int insert(Room room); 17 | 18 | /** 19 | * 删除 20 | */ 21 | int deleteById(Integer id); 22 | 23 | /** 24 | * 修改 25 | */ 26 | int updateById(Room room); 27 | 28 | /** 29 | * 根据ID查询 30 | */ 31 | Room selectById(Integer id); 32 | 33 | /** 34 | * 查询所有 35 | */ 36 | List selectAll(Room room); 37 | 38 | @Select("select * from room where type_id = #{id} and status = '空闲'") 39 | List selectByTypeId(Integer id); 40 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/TypeMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Type; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 操作type相关数据接口 11 | */ 12 | public interface TypeMapper { 13 | 14 | /** 15 | * 新增 16 | */ 17 | int insert(Type type); 18 | 19 | /** 20 | * 删除 21 | */ 22 | int deleteById(Integer id); 23 | 24 | /** 25 | * 修改 26 | */ 27 | int updateById(Type type); 28 | 29 | /** 30 | * 根据ID查询 31 | */ 32 | Type selectById(Integer id); 33 | 34 | /** 35 | * 查询所有 36 | */ 37 | List selectAll(Type type); 38 | 39 | @Select("select * from type where hotel_id = #{hotelId}") 40 | List selectByHotelId(Integer hotelId); 41 | 42 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | # Project exclude paths 48 | /vue/node_modules/ -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/HotelMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | 4 | import com.example.entity.Hotel; 5 | import org.apache.ibatis.annotations.Delete; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 操作hotel相关数据接口 12 | */ 13 | public interface HotelMapper { 14 | 15 | 16 | void insert(Hotel hotel); 17 | 18 | @Select("select * from hotel where username = #{username}") 19 | Hotel selectByUsername(String username); 20 | 21 | List selectAll(Hotel hotel); 22 | 23 | void updateById(Hotel hotel); 24 | 25 | @Delete("delete from hotel where id = #{id}") 26 | void deleteById(Integer id); 27 | 28 | @Select("select * from hotel where id = #{id}") 29 | Hotel selectById(Integer id); 30 | 31 | @Select("select * from hotel where status = '审核通过'") 32 | List selectAllOK(); 33 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | package com.example.exception; 2 | 3 | import com.example.common.enums.ResultCodeEnum; 4 | 5 | public class CustomException extends RuntimeException { 6 | private String code; 7 | private String msg; 8 | 9 | public CustomException(ResultCodeEnum resultCodeEnum) { 10 | this.code = resultCodeEnum.code; 11 | this.msg = resultCodeEnum.msg; 12 | } 13 | 14 | public CustomException(String code, String msg) { 15 | this.code = code; 16 | this.msg = msg; 17 | } 18 | 19 | 20 | public String getCode() { 21 | return code; 22 | } 23 | 24 | public void setCode(String code) { 25 | this.code = code; 26 | } 27 | 28 | public String getMsg() { 29 | return msg; 30 | } 31 | 32 | public void setMsg(String msg) { 33 | this.msg = msg; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/enums/ResultCodeEnum.java: -------------------------------------------------------------------------------- 1 | package com.example.common.enums; 2 | 3 | public enum ResultCodeEnum { 4 | SUCCESS("200", "成功"), 5 | 6 | PARAM_ERROR("400", "参数异常"), 7 | TOKEN_INVALID_ERROR("401", "无效的token"), 8 | TOKEN_CHECK_ERROR("401", "token验证失败,请重新登录"), 9 | PARAM_LOST_ERROR("4001", "参数缺失"), 10 | 11 | SYSTEM_ERROR("500", "系统异常"), 12 | USER_EXIST_ERROR("5001", "用户名已存在"), 13 | USER_NOT_LOGIN("5002", "用户未登录"), 14 | USER_ACCOUNT_ERROR("5003", "账号或密码错误"), 15 | USER_NOT_EXIST_ERROR("5004", "用户不存在"), 16 | PARAM_PASSWORD_ERROR("5005", "原密码输入错误"), 17 | COLLECTED_ALREADY_ERROR("5006", "您已经收藏过该房间"), 18 | TIME_CHECK_ERROR("5007", "您选择的时间不合理"), 19 | ; 20 | 21 | public String code; 22 | public String msg; 23 | 24 | ResultCodeEnum(String code, String msg) { 25 | this.code = code; 26 | this.msg = msg; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.common.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | import javax.annotation.Resource; 8 | 9 | @Configuration 10 | public class WebConfig implements WebMvcConfigurer { 11 | 12 | @Resource 13 | private JwtInterceptor jwtInterceptor; 14 | 15 | // 加自定义拦截器JwtInterceptor,设置拦截规则 16 | @Override 17 | public void addInterceptors(InterceptorRegistry registry) { 18 | registry.addInterceptor(jwtInterceptor).addPathPatterns("/**") 19 | .excludePathPatterns("/") 20 | .excludePathPatterns("/login") 21 | .excludePathPatterns("/register") 22 | .excludePathPatterns("/files/**"); 23 | } 24 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/OrdersMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Orders; 4 | import org.apache.ibatis.annotations.Select; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 操作orders相关数据接口 10 | */ 11 | public interface OrdersMapper { 12 | 13 | /** 14 | * 新增 15 | */ 16 | int insert(Orders orders); 17 | 18 | /** 19 | * 删除 20 | */ 21 | int deleteById(Integer id); 22 | 23 | /** 24 | * 修改 25 | */ 26 | int updateById(Orders orders); 27 | 28 | /** 29 | * 根据ID查询 30 | */ 31 | Orders selectById(Integer id); 32 | 33 | /** 34 | * 查询所有 35 | */ 36 | List selectAll(Orders orders); 37 | 38 | @Select("select * from orders where order_id = #{orderId}") 39 | Orders selectByOrderId(String orderId); 40 | 41 | @Select("select * from orders where status = '已退房'") 42 | List selectAllOKOrders(); 43 | } -------------------------------------------------------------------------------- /springboot/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9091 3 | 4 | # 数据库配置 5 | spring: 6 | datasource: 7 | driver-class-name: com.mysql.cj.jdbc.Driver 8 | username: root #你本地的数据库用户名 9 | password: 1025 #你本地的数据库密码 10 | url: jdbc:mysql://localhost:3306/no035_hotel?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8&allowPublicKeyRetrieval=true 11 | servlet: 12 | multipart: 13 | max-file-size: 100MB 14 | max-request-size: 100MB 15 | 16 | # 配置mybatis实体和xml映射 17 | mybatis: 18 | mapper-locations: classpath:mapper/*.xml 19 | type-aliases-package: com.example.entity 20 | configuration: 21 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 22 | map-underscore-to-camel-case: true 23 | 24 | # 分页 25 | pagehelper: 26 | helper-dialect: mysql 27 | reasonable: true 28 | support-methods-arguments: true 29 | params: count=countSql 30 | 31 | ip: localhost 32 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/CollectMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Collect; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 操作collect相关数据接口 12 | */ 13 | public interface CollectMapper { 14 | 15 | /** 16 | * 新增 17 | */ 18 | int insert(Collect collect); 19 | 20 | @Select("select * from collect where user_id = #{id}") 21 | List selectByUserId(Integer id); 22 | 23 | @Select("select * from collect where user_id = #{userId} and type_id = #{typeId} ") 24 | Collect selectByUserIdAndType(@Param("userId") Integer userId, @Param("typeId") Integer typeId); 25 | 26 | @Delete("delete from collect where type_id = #{typeId}") 27 | void deleteByTypeId(Integer typeId); 28 | 29 | List selectAll(Collect collect); 30 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/mapper/CommentMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.entity.Comment; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 操作comment相关数据接口 11 | */ 12 | public interface CommentMapper { 13 | 14 | /** 15 | * 新增 16 | */ 17 | int insert(Comment comment); 18 | 19 | /** 20 | * 删除 21 | */ 22 | int deleteById(Integer id); 23 | 24 | /** 25 | * 修改 26 | */ 27 | int updateById(Comment comment); 28 | 29 | /** 30 | * 根据ID查询 31 | */ 32 | Comment selectById(Integer id); 33 | 34 | /** 35 | * 查询所有 36 | */ 37 | List selectAll(Comment comment); 38 | 39 | @Select("select * from comment where type_id = #{typeId} and parent_id = #{parentId}") 40 | List selectByTypeIdAndParentId(@Param("typeId") Integer typeId, @Param("parentId") Integer parentId); 41 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.common.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | 9 | /** 10 | * 跨域配置 11 | */ 12 | @Configuration 13 | public class CorsConfig { 14 | 15 | @Bean 16 | public CorsFilter corsFilter() { 17 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 18 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 19 | corsConfiguration.addAllowedOrigin("*"); // 1 设置访问源地址 20 | corsConfiguration.addAllowedHeader("*"); // 2 设置访问源请求头 21 | corsConfiguration.addAllowedMethod("*"); // 3 设置访问源请求方法 22 | source.registerCorsConfiguration("/**", corsConfiguration); // 4 对接口配置跨域设置 23 | return new CorsFilter(source); 24 | } 25 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/exception/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.example.exception; 2 | 3 | import cn.hutool.log.Log; 4 | import cn.hutool.log.LogFactory; 5 | import com.example.common.Result; 6 | import org.springframework.web.bind.annotation.ControllerAdvice; 7 | import org.springframework.web.bind.annotation.ExceptionHandler; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | @ControllerAdvice(basePackages="com.example.controller") 13 | public class GlobalExceptionHandler { 14 | 15 | private static final Log log = LogFactory.get(); 16 | 17 | 18 | //统一异常处理@ExceptionHandler,主要用于Exception 19 | @ExceptionHandler(Exception.class) 20 | @ResponseBody//返回json串 21 | public Result error(HttpServletRequest request, Exception e){ 22 | log.error("异常信息:",e); 23 | return Result.error(); 24 | } 25 | 26 | @ExceptionHandler(CustomException.class) 27 | @ResponseBody//返回json串 28 | public Result customError(HttpServletRequest request, CustomException e){ 29 | return Result.error(e.getCode(), e.getMsg()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/CollectController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Collect; 5 | import com.example.entity.Type; 6 | import com.example.service.CollectService; 7 | import com.github.pagehelper.PageInfo; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import javax.annotation.Resource; 11 | import java.util.List; 12 | 13 | /** 14 | * 收藏信息表前端操作接口 15 | **/ 16 | @RestController 17 | @RequestMapping("/collect") 18 | public class CollectController { 19 | 20 | @Resource 21 | private CollectService collectService; 22 | 23 | /** 24 | * 新增 25 | */ 26 | @PostMapping("/add") 27 | public Result add(@RequestBody Collect collect) { 28 | collectService.add(collect); 29 | return Result.success(); 30 | } 31 | 32 | /** 33 | * 取消收藏 34 | */ 35 | @DeleteMapping("/deleteByTypeId") 36 | public Result deleteByTypeId(@RequestParam Integer id) { 37 | collectService.deleteByTypeId(id); 38 | return Result.success(); 39 | } 40 | 41 | @GetMapping("/selectOwn") 42 | public Result selectOwn(@RequestParam Integer id) { 43 | List list = collectService.selectOwn(id); 44 | return Result.success(list); 45 | } 46 | } -------------------------------------------------------------------------------- /vue/src/views/manager/Home.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 45 | -------------------------------------------------------------------------------- /vue/src/assets/css/front.css: -------------------------------------------------------------------------------- 1 | .front-notice { 2 | padding: 5px 20px; 3 | color: #666; 4 | font-size: 12px 5 | } 6 | .front-header { 7 | display: flex; 8 | height: 60px; 9 | line-height: 60px; 10 | border-bottom: 1px solid #eee; 11 | background: white; 12 | } 13 | .front-header-left { 14 | width: 350px; 15 | display: flex; 16 | align-items: center; 17 | padding-left: 30px; 18 | } 19 | .front-header-left img, .front-header-dropdown img { 20 | width: 40px; 21 | height: 40px; 22 | border-radius: 50% 23 | } 24 | .front-header-left .title { 25 | flex: 1; 26 | color: #355476; 27 | cursor: pointer; 28 | margin-left: 10px; 29 | font-size: 20px; 30 | font-weight: bold; 31 | } 32 | .front-header-center { 33 | flex: 1; 34 | } 35 | .front-header-right { 36 | width: 200px; 37 | padding-right: 20px; 38 | text-align: right; 39 | } 40 | .front-header-dropdown { 41 | display: flex; 42 | align-items: center; 43 | justify-content: right; 44 | } 45 | .el-dropdown-menu { 46 | width: 100px !important; 47 | text-align: center !important; 48 | } 49 | 50 | /*页面具体样式自定义*/ 51 | .main-content { 52 | width: 100%; 53 | margin: 5px auto; 54 | } 55 | /* ElementUI 样式覆盖 */ 56 | .el-menu.el-menu--horizontal { 57 | border: none !important; 58 | height: 59px; 59 | } -------------------------------------------------------------------------------- /vue/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import router from "@/router"; 3 | 4 | // 创建可一个新的axios对象 5 | const request = axios.create({ 6 | baseURL: process.env.VUE_APP_BASEURL, // 后端的接口地址 ip:port 7 | timeout: 30000 // 30s请求超时 8 | }) 9 | 10 | // request 拦截器 11 | // 可以自请求发送前对请求做一些处理 12 | // 比如统一加token,对请求参数统一加密 13 | request.interceptors.request.use(config => { 14 | config.headers['Content-Type'] = 'application/json;charset=utf-8'; // 设置请求头格式 15 | let user = JSON.parse(localStorage.getItem("xm-user") || '{}') // 获取缓存的用户信息 16 | config.headers['token'] = user.token // 设置请求头 17 | 18 | return config 19 | }, error => { 20 | console.error('request error: ' + error) // for debug 21 | return Promise.reject(error) 22 | }); 23 | 24 | // response 拦截器 25 | // 可以在接口响应后统一处理结果 26 | request.interceptors.response.use( 27 | response => { 28 | let res = response.data; 29 | 30 | // 兼容服务端返回的字符串数据 31 | if (typeof res === 'string') { 32 | res = res ? JSON.parse(res) : res 33 | } 34 | if (res.code === '401') { 35 | router.push('/login') 36 | } 37 | return res; 38 | }, 39 | error => { 40 | console.error('response error: ' + error) // for debug 41 | return Promise.reject(error) 42 | } 43 | ) 44 | 45 | 46 | export default request -------------------------------------------------------------------------------- /vue/src/views/front/Search.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 51 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.User; 5 | import com.example.service.UserService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * 用户前端操作接口 14 | **/ 15 | @RestController 16 | @RequestMapping("/user") 17 | public class UserController { 18 | 19 | @Resource 20 | private UserService userService; 21 | 22 | /** 23 | * 新增 24 | */ 25 | @PostMapping("/add") 26 | public Result add(@RequestBody User user) { 27 | userService.add(user); 28 | return Result.success(); 29 | } 30 | 31 | @PutMapping("/update") 32 | public Result update(@RequestBody User user) { 33 | userService.update(user); 34 | return Result.success(); 35 | } 36 | 37 | @DeleteMapping("/delete/{id}") 38 | public Result delete(@PathVariable Integer id) { 39 | userService.deleteById(id); 40 | return Result.success(); 41 | } 42 | 43 | @DeleteMapping("/delete/batch") 44 | public Result deleteBatch(@RequestBody List ids) { 45 | userService.deleteBatch(ids); 46 | return Result.success(); 47 | } 48 | 49 | /** 50 | * 分页查询 51 | */ 52 | @GetMapping("/selectPage") 53 | public Result selectPage(User user, 54 | @RequestParam(defaultValue = "1") Integer pageNum, 55 | @RequestParam(defaultValue = "10") Integer pageSize) { 56 | PageInfo page = userService.selectPage(user, pageNum, pageSize); 57 | return Result.success(page); 58 | } 59 | } -------------------------------------------------------------------------------- /vue/src/views/front/Collect.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 61 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/Result.java: -------------------------------------------------------------------------------- 1 | package com.example.common; 2 | 3 | import com.example.common.enums.ResultCodeEnum; 4 | 5 | public class Result { 6 | private String code; 7 | private String msg; 8 | private Object data; 9 | 10 | private Result(Object data) { 11 | this.data = data; 12 | } 13 | 14 | public Result() { 15 | } 16 | 17 | public static Result success() { 18 | Result tResult = new Result(); 19 | tResult.setCode(ResultCodeEnum.SUCCESS.code); 20 | tResult.setMsg(ResultCodeEnum.SUCCESS.msg); 21 | return tResult; 22 | } 23 | 24 | public static Result success(Object data) { 25 | Result tResult = new Result (data); 26 | tResult.setCode(ResultCodeEnum.SUCCESS.code); 27 | tResult.setMsg(ResultCodeEnum.SUCCESS.msg); 28 | return tResult; 29 | } 30 | 31 | public static Result error() { 32 | Result tResult = new Result(); 33 | tResult.setCode(ResultCodeEnum.SYSTEM_ERROR.code); 34 | tResult.setMsg(ResultCodeEnum.SYSTEM_ERROR.msg); 35 | return tResult; 36 | } 37 | 38 | public static Result error(String code, String msg) { 39 | Result tResult = new Result(); 40 | tResult.setCode(code); 41 | tResult.setMsg(msg); 42 | return tResult; 43 | } 44 | 45 | public static Result error(ResultCodeEnum resultCodeEnum) { 46 | Result tResult = new Result(); 47 | tResult.setCode(resultCodeEnum.code); 48 | tResult.setMsg(resultCodeEnum.msg); 49 | return tResult; 50 | } 51 | 52 | public String getCode() { 53 | return code; 54 | } 55 | 56 | public void setCode(String code) { 57 | this.code = code; 58 | } 59 | 60 | public String getMsg() { 61 | return msg; 62 | } 63 | 64 | public void setMsg(String msg) { 65 | this.msg = msg; 66 | } 67 | 68 | public Object getData() { 69 | return data; 70 | } 71 | 72 | public void setData(Object data) { 73 | this.data = data; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

基于SSM的酒店管理及推荐系统(由评论+收藏+订单推荐)

2 | 3 |

完整代码获取地址:从戎源码网(https://armycodes.com/)

4 |

作者微信:19941326836 QQ:605739993 QQ群:655392706

5 |

承接计算机毕设、Java毕业设计、Python毕业设计、深度学习、机器学习

6 |

选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务

7 |

毕业设计所有选题地址:(https://github.com/Descartes007/allProject)

8 | 9 | ## 一、项目介绍 10 | 11 | 基于SSM的酒店管理及推荐系统(由评论+收藏+订单推荐):前端 Vue、ElementUI,后端 SpringBoot、Mybatis,系统角色分为:管理员、员工和用户,管理员在管理后台管理酒店品类,对公告进行发布,添加新酒店房间信息,酒店订单进行管理,对入住进行登记等;酒店员工对房间进行分类,对客房信息进行更新,对入住进行登记和评论;用户根据酒店进行选择,根据由个人偏好生成的酒店列表选择酒店下单等。主要功能如下: 12 | 13 | ### 1、管理员: 14 | 15 | - 基本操作:登录、修改密码、修改个人信息、上传图片、获取个人信息 16 | - 房间分类管理:获取房间分类列表、筛选房间分类信息、删除房间分类信息、编辑房间分类信息、查看房间分类信息详情 17 | - 客房信息管理:获取客房信息列表、筛选客房信息、删除客房信息、编辑客房信息、查看客房信息详情 18 | - 订单管理:获取订单信息列表、筛选订单信息、删除订单信息、查看订单信息详情 19 | - 入住登记管理:获取入住登记列表、查看入住登记详情、筛选入住登记信息、删除入住登记信息、退房 20 | - 评论管理:获取评论列表、查看评论信息详情、删除评论信息 21 | - 公告管理:获取公告列表、筛选公告信息、删除公告信息、发布公告、修改公告内容、删除公告信息 22 | - 管理员管理:获取管理员列表、筛选管理员信息、修改管理员信息、删除管理员信息、添加管理员信息、查看管理员信息详情 23 | - 酒店员工管理:获取酒店员工列表、筛选酒店员工信息、修改酒店员工信息、删除酒店员工信息、添加酒店员工信息、查看酒店员工信息详情 24 | - 用户管理:获取用户列表、筛选用户信息、修改用户信息、删除用户信息、添加用户信息、查看用户信息详情 25 | 26 | ### 2、员工: 27 | 28 | - 基本操作:登录、修改密码、修改个人信息、上传图片、获取个人信息、注册 29 | - 房间分类管理:获取房间分类列表、筛选房间分类信息、删除房间分类信息、编辑房间分类信息、查看房间分类信息详情 30 | - 客房信息管理:获取客房信息列表、筛选客房信息、删除客房信息、编辑客房信息、查看客房信息详情、新增客房信息 31 | - 订单管理:获取订单信息列表、筛选订单信息、删除订单信息、查看订单信息详情 32 | - 入住登记管理:获取入住登记列表、查看入住登记详情、筛选入住登记信息、删除入住登记信息、退房、入住登记 33 | - 评论管理:获取评论列表、查看评论信息详情、删除评论信息 34 | 35 | ### 3、用户: 36 | 37 | - 基本操作:登录、注册、修改个人信息、上传图片、获取个人信息、留言、回复留言、修改密码、收藏、注册 38 | - 热门景点模块:获取景点列表、收藏景点信息、查看景点信息详情、评论景点、点赞、拉踩、筛选景点信息、购票 39 | - 旅游路线模块:获取旅游路线列表、收藏旅游路线信息、查看旅游路线信息详情、评论旅游路线、筛选旅游路线信息 40 | - 酒店模块:获取酒店列表、收藏酒店信息、查看酒店信息详情、评论酒店、筛选酒店信息、预订 41 | - 机票模块:获取机票列表、查看机票信息详情、筛选机票信息、预订 42 | - 交流模块:获取交流列表、筛选交流信息、发布帖子、评论帖子、删除帖子 43 | - 资讯模块:获取资讯列表、筛选资讯信息、查看资讯详情 44 | - 订单模块:获取订单列表、删除订单、下单、支付、查看订单详情、筛选订单信息 45 | 46 | ## 二、环境 47 | 48 | - IntelliJ IDEA 2020.3 49 | 50 | - Mysql 5.7.26 51 | 52 | - NodeJs 14.17.3 53 | 54 | - Maven 3.6.3 55 | 56 | - JDK 1.8 57 | 58 | 59 | ## 三、运行截图 60 | 61 | ![](screenshot/1.png) 62 | 63 | ![](screenshot/2.png) 64 | 65 | ![](screenshot/3.png) 66 | 67 | ![](screenshot/4.png) 68 | 69 | ![](screenshot/5.png) 70 | 71 | ![](screenshot/6.png) 72 | 73 | ![](screenshot/7.png) 74 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Admin; 5 | import com.example.service.AdminService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * 管理员前端操作接口 13 | **/ 14 | @RestController 15 | @RequestMapping("/admin") 16 | public class AdminController { 17 | 18 | @Resource 19 | private AdminService adminService; 20 | 21 | /** 22 | * 新增 23 | */ 24 | @PostMapping("/add") 25 | public Result add(@RequestBody Admin admin) { 26 | adminService.add(admin); 27 | return Result.success(); 28 | } 29 | 30 | /** 31 | * 删除 32 | */ 33 | @DeleteMapping("/delete/{id}") 34 | public Result deleteById(@PathVariable Integer id) { 35 | adminService.deleteById(id); 36 | return Result.success(); 37 | } 38 | 39 | /** 40 | * 批量删除 41 | */ 42 | @DeleteMapping("/delete/batch") 43 | public Result deleteBatch(@RequestBody List ids) { 44 | adminService.deleteBatch(ids); 45 | return Result.success(); 46 | } 47 | 48 | /** 49 | * 修改 50 | */ 51 | @PutMapping("/update") 52 | public Result updateById(@RequestBody Admin admin) { 53 | adminService.updateById(admin); 54 | return Result.success(); 55 | } 56 | 57 | /** 58 | * 根据ID查询 59 | */ 60 | @GetMapping("/selectById/{id}") 61 | public Result selectById(@PathVariable Integer id) { 62 | Admin admin = adminService.selectById(id); 63 | return Result.success(admin); 64 | } 65 | 66 | /** 67 | * 查询所有 68 | */ 69 | @GetMapping("/selectAll") 70 | public Result selectAll(Admin admin ) { 71 | List list = adminService.selectAll(admin); 72 | return Result.success(list); 73 | } 74 | 75 | /** 76 | * 分页查询 77 | */ 78 | @GetMapping("/selectPage") 79 | public Result selectPage(Admin admin, 80 | @RequestParam(defaultValue = "1") Integer pageNum, 81 | @RequestParam(defaultValue = "10") Integer pageSize) { 82 | PageInfo page = adminService.selectPage(admin, pageNum, pageSize); 83 | return Result.success(page); 84 | } 85 | 86 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/NoticeController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Notice; 5 | import com.example.service.NoticeService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * 公告信息表前端操作接口 13 | **/ 14 | @RestController 15 | @RequestMapping("/notice") 16 | public class NoticeController { 17 | 18 | @Resource 19 | private NoticeService noticeService; 20 | 21 | /** 22 | * 新增 23 | */ 24 | @PostMapping("/add") 25 | public Result add(@RequestBody Notice notice) { 26 | noticeService.add(notice); 27 | return Result.success(); 28 | } 29 | 30 | /** 31 | * 删除 32 | */ 33 | @DeleteMapping("/delete/{id}") 34 | public Result deleteById(@PathVariable Integer id) { 35 | noticeService.deleteById(id); 36 | return Result.success(); 37 | } 38 | 39 | /** 40 | * 批量删除 41 | */ 42 | @DeleteMapping("/delete/batch") 43 | public Result deleteBatch(@RequestBody List ids) { 44 | noticeService.deleteBatch(ids); 45 | return Result.success(); 46 | } 47 | 48 | /** 49 | * 修改 50 | */ 51 | @PutMapping("/update") 52 | public Result updateById(@RequestBody Notice notice) { 53 | noticeService.updateById(notice); 54 | return Result.success(); 55 | } 56 | 57 | /** 58 | * 根据ID查询 59 | */ 60 | @GetMapping("/selectById/{id}") 61 | public Result selectById(@PathVariable Integer id) { 62 | Notice notice = noticeService.selectById(id); 63 | return Result.success(notice); 64 | } 65 | 66 | /** 67 | * 查询所有 68 | */ 69 | @GetMapping("/selectAll") 70 | public Result selectAll(Notice notice ) { 71 | List list = noticeService.selectAll(notice); 72 | return Result.success(list); 73 | } 74 | 75 | /** 76 | * 分页查询 77 | */ 78 | @GetMapping("/selectPage") 79 | public Result selectPage(Notice notice, 80 | @RequestParam(defaultValue = "1") Integer pageNum, 81 | @RequestParam(defaultValue = "10") Integer pageSize) { 82 | PageInfo page = noticeService.selectPage(notice, pageNum, pageSize); 83 | return Result.success(page); 84 | } 85 | 86 | } -------------------------------------------------------------------------------- /vue/src/views/manager/Password.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 73 | 74 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/utils/UserCF.java: -------------------------------------------------------------------------------- 1 | package com.example.utils; 2 | 3 | import cn.hutool.core.collection.CollectionUtil; 4 | import cn.hutool.core.date.DateUtil; 5 | import cn.hutool.core.util.ObjectUtil; 6 | import com.auth0.jwt.JWT; 7 | import com.auth0.jwt.algorithms.Algorithm; 8 | import com.example.common.Constants; 9 | import com.example.common.enums.RoleEnum; 10 | import com.example.entity.Account; 11 | import com.example.entity.RelateDTO; 12 | import com.example.service.AdminService; 13 | import com.example.service.HotelService; 14 | import com.example.service.UserService; 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | import org.springframework.stereotype.Component; 18 | import org.springframework.web.context.request.RequestContextHolder; 19 | import org.springframework.web.context.request.ServletRequestAttributes; 20 | 21 | import javax.annotation.PostConstruct; 22 | import javax.annotation.Resource; 23 | import javax.servlet.http.HttpServletRequest; 24 | import java.util.*; 25 | import java.util.stream.Collectors; 26 | 27 | //推荐 28 | public class UserCF { 29 | 30 | /** 31 | * 方法描述: 推荐商品id列表 32 | * 33 | * @param userId 当前用户 34 | * @param list 用户商品评分数据 35 | * @return {@link List } 36 | */ 37 | public static List recommend(Integer userId, List list) { 38 | // 按用户分组 39 | Map> userMap = list.stream().collect(Collectors.groupingBy(RelateDTO::getUseId)); 40 | // 获取其他用户与当前用户的关系值 41 | Map userDisMap = CoreMath.computeNeighbor(userId, userMap, 0); 42 | if (CollectionUtil.isEmpty(userDisMap)) { 43 | return Collections.emptyList(); 44 | } 45 | // 获取关系最近的用户 46 | double maxValue = Collections.max(userDisMap.values()); 47 | Set userIds = userDisMap.entrySet().stream().filter(e -> e.getValue() == maxValue).map(Map.Entry::getKey).collect(Collectors.toSet()); 48 | // 取关系最近的用户 49 | Integer nearestUserId = userIds.stream().findAny().orElse(null); 50 | if (nearestUserId == null) { 51 | return Collections.emptyList(); 52 | } 53 | // 最近邻用户看过商品列表 54 | List neighborItems = userMap.get(nearestUserId).stream().map(RelateDTO::getTypeId).collect(Collectors.toList()); 55 | // 指定用户看过商品列表 56 | List userItems = userMap.get(userId).stream().map(RelateDTO::getTypeId).collect(Collectors.toList()); 57 | // 找到最近邻看过,但是该用户没看过的商品 58 | neighborItems.removeAll(userItems); 59 | return neighborItems; 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/RoomController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Room; 5 | import com.example.service.RoomService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * 客房信息表前端操作接口 14 | **/ 15 | @RestController 16 | @RequestMapping("/room") 17 | public class RoomController { 18 | 19 | @Resource 20 | private RoomService roomService; 21 | 22 | /** 23 | * 新增 24 | */ 25 | @PostMapping("/add") 26 | public Result add(@RequestBody Room room) { 27 | roomService.add(room); 28 | return Result.success(); 29 | } 30 | 31 | /** 32 | * 删除 33 | */ 34 | @DeleteMapping("/delete/{id}") 35 | public Result deleteById(@PathVariable Integer id) { 36 | roomService.deleteById(id); 37 | return Result.success(); 38 | } 39 | 40 | /** 41 | * 批量删除 42 | */ 43 | @DeleteMapping("/delete/batch") 44 | public Result deleteBatch(@RequestBody List ids) { 45 | roomService.deleteBatch(ids); 46 | return Result.success(); 47 | } 48 | 49 | /** 50 | * 修改 51 | */ 52 | @PutMapping("/update") 53 | public Result updateById(@RequestBody Room room) { 54 | roomService.updateById(room); 55 | return Result.success(); 56 | } 57 | 58 | /** 59 | * 根据ID查询 60 | */ 61 | @GetMapping("/selectById/{id}") 62 | public Result selectById(@PathVariable Integer id) { 63 | Room room = roomService.selectById(id); 64 | return Result.success(room); 65 | } 66 | 67 | @GetMapping("/selectByTypeId") 68 | public Result selectByTypeId(@RequestParam String orderId) { 69 | List room = roomService.selectByTypeId(orderId); 70 | return Result.success(room); 71 | } 72 | 73 | /** 74 | * 查询所有 75 | */ 76 | @GetMapping("/selectAll") 77 | public Result selectAll(Room room ) { 78 | List list = roomService.selectAll(room); 79 | return Result.success(list); 80 | } 81 | 82 | /** 83 | * 分页查询 84 | */ 85 | @GetMapping("/selectPage") 86 | public Result selectPage(Room room, 87 | @RequestParam(defaultValue = "1") Integer pageNum, 88 | @RequestParam(defaultValue = "10") Integer pageSize) { 89 | PageInfo page = roomService.selectPage(room, pageNum, pageSize); 90 | return Result.success(page); 91 | } 92 | 93 | 94 | 95 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/HotelController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Admin; 5 | import com.example.entity.Hotel; 6 | import com.example.service.HotelService; 7 | import com.github.pagehelper.PageInfo; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import javax.annotation.Resource; 11 | import java.util.List; 12 | 13 | /** 14 | * 酒店前端操作接口 15 | **/ 16 | @RestController 17 | @RequestMapping("/hotel") 18 | public class HotelController { 19 | 20 | @Resource 21 | private HotelService hotelService; 22 | 23 | /** 24 | * 新增 25 | */ 26 | @PostMapping("/add") 27 | public Result add(@RequestBody Hotel hotel) { 28 | hotelService.add(hotel); 29 | return Result.success(); 30 | } 31 | 32 | @PutMapping("/update") 33 | public Result update(@RequestBody Hotel hotel) { 34 | hotelService.update(hotel); 35 | return Result.success(); 36 | } 37 | 38 | @DeleteMapping("/delete/{id}") 39 | public Result delete(@PathVariable Integer id) { 40 | hotelService.deleteById(id); 41 | return Result.success(); 42 | } 43 | 44 | @GetMapping("/selectById") 45 | public Result selectById(@RequestParam Integer id) { 46 | Hotel hotel = hotelService.selectById(id); 47 | return Result.success(hotel); 48 | } 49 | 50 | @DeleteMapping("/delete/batch") 51 | public Result deleteBatch(@RequestBody List ids) { 52 | hotelService.deleteBatch(ids); 53 | return Result.success(); 54 | } 55 | 56 | @GetMapping("/selectByName") 57 | public Result selectByName(@RequestParam String name) { 58 | List list = hotelService.selectByName(name); 59 | return Result.success(list); 60 | } 61 | 62 | @GetMapping("/selectAll") 63 | public Result selectAll(Hotel hotel) { 64 | List list = hotelService.selectAll(hotel); 65 | return Result.success(list); 66 | } 67 | @GetMapping("/selectAllOK") 68 | public Result selectAllOK() { 69 | List list = hotelService.selectAllOK(); 70 | return Result.success(list); 71 | } 72 | 73 | 74 | /** 75 | * 分页查询 76 | */ 77 | @GetMapping("/selectPage") 78 | public Result selectPage(Hotel hotel, 79 | @RequestParam(defaultValue = "1") Integer pageNum, 80 | @RequestParam(defaultValue = "10") Integer pageSize) { 81 | PageInfo page = hotelService.selectPage(hotel, pageNum, pageSize); 82 | return Result.success(page); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/CommentController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Comment; 5 | import com.example.service.CommentService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * 评论信息表前端操作接口 14 | **/ 15 | @RestController 16 | @RequestMapping("/comment") 17 | public class CommentController { 18 | 19 | @Resource 20 | private CommentService commentService; 21 | 22 | /** 23 | * 新增 24 | */ 25 | @PostMapping("/add") 26 | public Result add(@RequestBody Comment comment) { 27 | commentService.add(comment); 28 | return Result.success(); 29 | } 30 | 31 | /** 32 | * 删除 33 | */ 34 | @DeleteMapping("/delete/{id}") 35 | public Result deleteById(@PathVariable Integer id) { 36 | commentService.deleteById(id); 37 | return Result.success(); 38 | } 39 | 40 | /** 41 | * 批量删除 42 | */ 43 | @DeleteMapping("/delete/batch") 44 | public Result deleteBatch(@RequestBody List ids) { 45 | commentService.deleteBatch(ids); 46 | return Result.success(); 47 | } 48 | 49 | /** 50 | * 修改 51 | */ 52 | @PutMapping("/update") 53 | public Result updateById(@RequestBody Comment comment) { 54 | commentService.updateById(comment); 55 | return Result.success(); 56 | } 57 | 58 | /** 59 | * 根据ID查询 60 | */ 61 | @GetMapping("/selectById/{id}") 62 | public Result selectById(@PathVariable Integer id) { 63 | Comment comment = commentService.selectById(id); 64 | return Result.success(comment); 65 | } 66 | 67 | /** 68 | * 查询所有 69 | */ 70 | @GetMapping("/selectAll") 71 | public Result selectAll(Comment comment ) { 72 | List list = commentService.selectAll(comment); 73 | return Result.success(list); 74 | } 75 | 76 | @GetMapping("/selectByTypeId") 77 | public Result selectByTypeId(@RequestParam Integer id) { 78 | List list = commentService.selectByTypeId(id); 79 | return Result.success(list); 80 | } 81 | 82 | /** 83 | * 分页查询 84 | */ 85 | @GetMapping("/selectPage") 86 | public Result selectPage(Comment comment, 87 | @RequestParam(defaultValue = "1") Integer pageNum, 88 | @RequestParam(defaultValue = "10") Integer pageSize) { 89 | PageInfo page = commentService.selectPage(comment, pageNum, pageSize); 90 | return Result.success(page); 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/CheckinController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Checkin; 5 | import com.example.service.CheckinService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * 入住信息表前端操作接口 14 | **/ 15 | @RestController 16 | @RequestMapping("/checkin") 17 | public class CheckinController { 18 | 19 | @Resource 20 | private CheckinService checkinService; 21 | 22 | /** 23 | * 新增 24 | */ 25 | @PostMapping("/add") 26 | public Result add(@RequestBody Checkin checkin) { 27 | checkinService.add(checkin); 28 | return Result.success(); 29 | } 30 | 31 | /** 32 | * 删除 33 | */ 34 | @DeleteMapping("/delete/{id}") 35 | public Result deleteById(@PathVariable Integer id) { 36 | checkinService.deleteById(id); 37 | return Result.success(); 38 | } 39 | 40 | /** 41 | * 批量删除 42 | */ 43 | @DeleteMapping("/delete/batch") 44 | public Result deleteBatch(@RequestBody List ids) { 45 | checkinService.deleteBatch(ids); 46 | return Result.success(); 47 | } 48 | 49 | /** 50 | * 修改 51 | */ 52 | @PutMapping("/update") 53 | public Result updateById(@RequestBody Checkin checkin) { 54 | checkinService.updateById(checkin); 55 | return Result.success(); 56 | } 57 | 58 | /** 59 | * 根据ID查询 60 | */ 61 | @GetMapping("/selectById/{id}") 62 | public Result selectById(@PathVariable Integer id) { 63 | Checkin checkin = checkinService.selectById(id); 64 | return Result.success(checkin); 65 | } 66 | 67 | @GetMapping("/tuifang/{id}") 68 | public Result tuifang(@PathVariable Integer id) { 69 | checkinService.tuifang(id); 70 | return Result.success(); 71 | } 72 | 73 | @GetMapping("/selectByUserId") 74 | public Result selectByUserId(@RequestParam Integer id) { 75 | List checkin = checkinService.selectByUserId(id); 76 | return Result.success(checkin); 77 | } 78 | 79 | /** 80 | * 查询所有 81 | */ 82 | @GetMapping("/selectAll") 83 | public Result selectAll(Checkin checkin ) { 84 | List list = checkinService.selectAll(checkin); 85 | return Result.success(list); 86 | } 87 | 88 | /** 89 | * 分页查询 90 | */ 91 | @GetMapping("/selectPage") 92 | public Result selectPage(Checkin checkin, 93 | @RequestParam(defaultValue = "1") Integer pageNum, 94 | @RequestParam(defaultValue = "10") Integer pageSize) { 95 | PageInfo page = checkinService.selectPage(checkin, pageNum, pageSize); 96 | return Result.success(page); 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/TypeController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Room; 5 | import com.example.entity.Type; 6 | import com.example.service.TypeService; 7 | import com.github.pagehelper.PageInfo; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import javax.annotation.Resource; 11 | import java.util.List; 12 | 13 | /** 14 | * 公告信息表前端操作接口 15 | **/ 16 | @RestController 17 | @RequestMapping("/type") 18 | public class TypeController { 19 | 20 | @Resource 21 | private TypeService typeService; 22 | 23 | /** 24 | * 新增 25 | */ 26 | @PostMapping("/add") 27 | public Result add(@RequestBody Type type) { 28 | typeService.add(type); 29 | return Result.success(); 30 | } 31 | 32 | /** 33 | * 删除 34 | */ 35 | @DeleteMapping("/delete/{id}") 36 | public Result deleteById(@PathVariable Integer id) { 37 | typeService.deleteById(id); 38 | return Result.success(); 39 | } 40 | 41 | /** 42 | * 批量删除 43 | */ 44 | @DeleteMapping("/delete/batch") 45 | public Result deleteBatch(@RequestBody List ids) { 46 | typeService.deleteBatch(ids); 47 | return Result.success(); 48 | } 49 | 50 | /** 51 | * 修改 52 | */ 53 | @PutMapping("/update") 54 | public Result updateById(@RequestBody Type type) { 55 | typeService.updateById(type); 56 | return Result.success(); 57 | } 58 | 59 | /** 60 | * 根据ID查询 61 | */ 62 | @GetMapping("/selectById") 63 | public Result selectById(@RequestParam Integer id) { 64 | Type type = typeService.selectById(id); 65 | return Result.success(type); 66 | } 67 | 68 | @GetMapping("/selectByHotelId") 69 | public Result selectByHotelId(@RequestParam Integer id) { 70 | List list = typeService.selectByHotelId(id); 71 | return Result.success(list); 72 | } 73 | 74 | /** 75 | * 查询所有 76 | */ 77 | @GetMapping("/selectAll") 78 | public Result selectAll(Type type ) { 79 | List list = typeService.selectAll(type); 80 | return Result.success(list); 81 | } 82 | 83 | /** 84 | * 分页查询 85 | */ 86 | @GetMapping("/selectPage") 87 | public Result selectPage(Type type, 88 | @RequestParam(defaultValue = "1") Integer pageNum, 89 | @RequestParam(defaultValue = "10") Integer pageSize) { 90 | PageInfo page = typeService.selectPage(type, pageNum, pageSize); 91 | return Result.success(page); 92 | } 93 | 94 | @GetMapping("/recommend") 95 | public Result recommend() { 96 | List list = typeService.recommend(); 97 | return Result.success(list); 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/OrdersController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.common.Result; 4 | import com.example.entity.Orders; 5 | import com.example.service.OrdersService; 6 | import com.github.pagehelper.PageInfo; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * 订单信息表前端操作接口 14 | **/ 15 | @RestController 16 | @RequestMapping("/orders") 17 | public class OrdersController { 18 | 19 | @Resource 20 | private OrdersService ordersService; 21 | 22 | /** 23 | * 新增 24 | */ 25 | @PostMapping("/add") 26 | public Result add(@RequestBody Orders orders) { 27 | ordersService.add(orders); 28 | return Result.success(); 29 | } 30 | 31 | /** 32 | * 删除 33 | */ 34 | @DeleteMapping("/delete/{id}") 35 | public Result deleteById(@PathVariable Integer id) { 36 | ordersService.deleteById(id); 37 | return Result.success(); 38 | } 39 | 40 | /** 41 | * 批量删除 42 | */ 43 | @DeleteMapping("/delete/batch") 44 | public Result deleteBatch(@RequestBody List ids) { 45 | ordersService.deleteBatch(ids); 46 | return Result.success(); 47 | } 48 | 49 | /** 50 | * 修改 51 | */ 52 | @PutMapping("/update") 53 | public Result updateById(@RequestBody Orders orders) { 54 | ordersService.updateById(orders); 55 | return Result.success(); 56 | } 57 | 58 | /** 59 | * 根据ID查询 60 | */ 61 | @GetMapping("/selectById/{id}") 62 | public Result selectById(@PathVariable Integer id) { 63 | Orders orders = ordersService.selectById(id); 64 | return Result.success(orders); 65 | } 66 | 67 | @GetMapping("/selectByUserId") 68 | public Result selectByUserId(@RequestParam Integer id) { 69 | List orders = ordersService.selectByUserId(id); 70 | return Result.success(orders); 71 | } 72 | 73 | /** 74 | * 查询所有 75 | */ 76 | @GetMapping("/selectAll") 77 | public Result selectAll(Orders orders ) { 78 | List list = ordersService.selectAll(orders); 79 | return Result.success(list); 80 | } 81 | 82 | /** 83 | * 分页查询 84 | */ 85 | @GetMapping("/selectPage") 86 | public Result selectPage(Orders orders, 87 | @RequestParam(defaultValue = "1") Integer pageNum, 88 | @RequestParam(defaultValue = "10") Integer pageSize) { 89 | PageInfo page = ordersService.selectPage(orders, pageNum, pageSize); 90 | return Result.success(page); 91 | } 92 | 93 | @GetMapping("/selectChecking") 94 | public Result selectChecking(@RequestParam Integer id) { 95 | List orders = ordersService.selectByCheckingAndHotelId(id); 96 | return Result.success(orders); 97 | } 98 | 99 | 100 | } -------------------------------------------------------------------------------- /vue/src/views/Login.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 78 | 79 | -------------------------------------------------------------------------------- /vue/src/views/manager/AdminPerson.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 72 | 73 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/FileController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import cn.hutool.core.io.FileUtil; 4 | import cn.hutool.core.thread.ThreadUtil; 5 | import cn.hutool.core.util.StrUtil; 6 | import com.example.common.Result; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.web.bind.annotation.*; 9 | import org.springframework.web.multipart.MultipartFile; 10 | 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.OutputStream; 13 | import java.net.URLEncoder; 14 | import java.util.List; 15 | 16 | /** 17 | * 文件接口 18 | */ 19 | @RestController 20 | @RequestMapping("/files") 21 | public class FileController { 22 | 23 | // 文件上传存储路径 24 | private static final String filePath = System.getProperty("user.dir") + "/files/"; 25 | 26 | @Value("${server.port:9090}") 27 | private String port; 28 | 29 | @Value("${ip:localhost}") 30 | private String ip; 31 | 32 | /** 33 | * 文件上传 34 | */ 35 | @PostMapping("/upload") 36 | public Result upload(MultipartFile file) { 37 | String flag; 38 | synchronized (FileController.class) { 39 | flag = System.currentTimeMillis() + ""; 40 | ThreadUtil.sleep(1L); 41 | } 42 | String fileName = file.getOriginalFilename(); 43 | try { 44 | if (!FileUtil.isDirectory(filePath)) { 45 | FileUtil.mkdir(filePath); 46 | } 47 | // 文件存储形式:时间戳-文件名 48 | FileUtil.writeBytes(file.getBytes(), filePath + flag + "-" + fileName); // ***/manager/files/1697438073596-avatar.png 49 | System.out.println(fileName + "--上传成功"); 50 | 51 | } catch (Exception e) { 52 | System.err.println(fileName + "--文件上传失败"); 53 | } 54 | String http = "http://" + ip + ":" + port + "/files/"; 55 | return Result.success(http + flag + "-" + fileName); // http://localhost:9090/files/1697438073596-avatar.png 56 | } 57 | 58 | 59 | /** 60 | * 获取文件 61 | * 62 | * @param flag 63 | * @param response 64 | */ 65 | @GetMapping("/{flag}") // 1697438073596-avatar.png 66 | public void avatarPath(@PathVariable String flag, HttpServletResponse response) { 67 | OutputStream os; 68 | try { 69 | if (StrUtil.isNotEmpty(flag)) { 70 | response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(flag, "UTF-8")); 71 | response.setContentType("application/octet-stream"); 72 | byte[] bytes = FileUtil.readBytes(filePath + flag); 73 | os = response.getOutputStream(); 74 | os.write(bytes); 75 | os.flush(); 76 | os.close(); 77 | } 78 | } catch (Exception e) { 79 | System.out.println("文件下载失败"); 80 | } 81 | } 82 | 83 | /** 84 | * 删除文件 85 | * 86 | * @param flag 87 | */ 88 | @DeleteMapping("/{flag}") 89 | public void delFile(@PathVariable String flag) { 90 | List fileNames = FileUtil.listFileNames(filePath); 91 | FileUtil.del(filePath + flag); 92 | System.out.println("删除文件" + flag + "成功"); 93 | } 94 | 95 | 96 | } 97 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/utils/TokenUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.utils; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import cn.hutool.core.util.ObjectUtil; 5 | import com.auth0.jwt.JWT; 6 | import com.auth0.jwt.algorithms.Algorithm; 7 | import com.example.common.Constants; 8 | import com.example.common.enums.RoleEnum; 9 | import com.example.entity.Account; 10 | import com.example.service.AdminService; 11 | import com.example.service.HotelService; 12 | import com.example.service.UserService; 13 | import org.slf4j.Logger; 14 | import org.slf4j.LoggerFactory; 15 | import org.springframework.stereotype.Component; 16 | import org.springframework.web.context.request.RequestContextHolder; 17 | import org.springframework.web.context.request.ServletRequestAttributes; 18 | 19 | import javax.annotation.PostConstruct; 20 | import javax.annotation.Resource; 21 | import javax.servlet.http.HttpServletRequest; 22 | import java.util.Date; 23 | 24 | /** 25 | * Token工具类 26 | */ 27 | @Component 28 | public class TokenUtils { 29 | 30 | private static final Logger log = LoggerFactory.getLogger(TokenUtils.class); 31 | 32 | private static AdminService staticAdminService; 33 | private static HotelService staticHotelService; 34 | private static UserService staticUserService; 35 | 36 | @Resource 37 | AdminService adminService; 38 | @Resource 39 | HotelService hotelService; 40 | @Resource 41 | UserService userService; 42 | 43 | @PostConstruct 44 | public void setUserService() { 45 | staticAdminService = adminService; 46 | staticHotelService = hotelService; 47 | staticUserService = userService; 48 | } 49 | 50 | /** 51 | * 生成token 52 | */ 53 | public static String createToken(String data, String sign) { 54 | return JWT.create().withAudience(data) // 将 userId-role 保存到 token 里面,作为载荷 55 | .withExpiresAt(DateUtil.offsetHour(new Date(), 2)) // 2小时后token过期 56 | .sign(Algorithm.HMAC256(sign)); // 以 password 作为 token 的密钥 57 | } 58 | 59 | /** 60 | * 获取当前登录的用户信息 61 | */ 62 | public static Account getCurrentUser() { 63 | try { 64 | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); 65 | String token = request.getHeader(Constants.TOKEN); 66 | if (ObjectUtil.isNotEmpty(token)) { 67 | String userRole = JWT.decode(token).getAudience().get(0); 68 | String userId = userRole.split("-")[0]; // 获取用户id 69 | String role = userRole.split("-")[1]; // 获取角色 70 | if (RoleEnum.ADMIN.name().equals(role)) { 71 | return staticAdminService.selectById(Integer.valueOf(userId)); 72 | } 73 | if (RoleEnum.HOTEL.name().equals(role)) { 74 | return staticHotelService.selectById(Integer.valueOf(userId)); 75 | } 76 | if (RoleEnum.USER.name().equals(role)) { 77 | return staticUserService.selectById(Integer.valueOf(userId)); 78 | } 79 | } 80 | } catch (Exception e) { 81 | log.error("获取当前用户信息出错", e); 82 | } 83 | return new Account(); // 返回空的账号对象 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /springboot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.example 8 | springboot 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 2.5.9 15 | 16 | 17 | 18 | UTF-8 19 | UTF-8 20 | 1.8 21 | 22 | 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | 30 | 31 | mysql 32 | mysql-connector-java 33 | 34 | 35 | 36 | org.mybatis.spring.boot 37 | mybatis-spring-boot-starter 38 | 2.2.1 39 | 40 | 41 | 42 | com.github.pagehelper 43 | pagehelper-spring-boot-starter 44 | 1.4.6 45 | 46 | 47 | org.mybatis 48 | mybatis 49 | 50 | 51 | 52 | 53 | 54 | 55 | cn.hutool 56 | hutool-all 57 | 5.8.18 58 | 59 | 60 | 61 | com.auth0 62 | java-jwt 63 | 4.3.0 64 | 65 | 66 | org.springframework.boot 67 | spring-boot-starter-actuator 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | org.springframework.boot 76 | spring-boot-maven-plugin 77 | 78 | true 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | public 87 | aliyun nexus 88 | http://maven.aliyun.com/nexus/content/groups/public/ 89 | 90 | true 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/common/config/JwtInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.example.common.config; 2 | 3 | import cn.hutool.core.util.ObjectUtil; 4 | import com.auth0.jwt.JWT; 5 | import com.auth0.jwt.JWTVerifier; 6 | import com.auth0.jwt.algorithms.Algorithm; 7 | import com.auth0.jwt.exceptions.JWTVerificationException; 8 | import com.example.common.Constants; 9 | import com.example.common.enums.ResultCodeEnum; 10 | import com.example.common.enums.RoleEnum; 11 | import com.example.entity.Account; 12 | import com.example.exception.CustomException; 13 | import com.example.service.AdminService; 14 | import com.example.service.HotelService; 15 | import com.example.service.UserService; 16 | import org.slf4j.Logger; 17 | import org.slf4j.LoggerFactory; 18 | import org.springframework.stereotype.Component; 19 | import org.springframework.web.servlet.HandlerInterceptor; 20 | 21 | import javax.annotation.Resource; 22 | import javax.servlet.http.HttpServletRequest; 23 | import javax.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * jwt拦截器 27 | */ 28 | @Component 29 | public class JwtInterceptor implements HandlerInterceptor { 30 | 31 | private static final Logger log = LoggerFactory.getLogger(JwtInterceptor.class); 32 | 33 | @Resource 34 | private AdminService adminService; 35 | @Resource 36 | private HotelService hotelService; 37 | @Resource 38 | private UserService userService; 39 | 40 | @Override 41 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { 42 | // 1. 从http请求的header中获取token 43 | String token = request.getHeader(Constants.TOKEN); 44 | if (ObjectUtil.isEmpty(token)) { 45 | // 如果没拿到,从参数里再拿一次 46 | token = request.getParameter(Constants.TOKEN); 47 | } 48 | // 2. 开始执行认证 49 | if (ObjectUtil.isEmpty(token)) { 50 | throw new CustomException(ResultCodeEnum.TOKEN_INVALID_ERROR); 51 | } 52 | Account account = null; 53 | try { 54 | // 解析token获取存储的数据 55 | String userRole = JWT.decode(token).getAudience().get(0); 56 | String userId = userRole.split("-")[0]; 57 | String role = userRole.split("-")[1]; 58 | // 根据userId查询数据库 59 | if (RoleEnum.ADMIN.name().equals(role)) { 60 | account = adminService.selectById(Integer.valueOf(userId)); 61 | } 62 | if (RoleEnum.HOTEL.name().equals(role)) { 63 | account = hotelService.selectById(Integer.valueOf(userId)); 64 | } 65 | if (RoleEnum.USER.name().equals(role)) { 66 | account = userService.selectById(Integer.valueOf(userId)); 67 | } 68 | } catch (Exception e) { 69 | throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR); 70 | } 71 | if (ObjectUtil.isNull(account)) { 72 | throw new CustomException(ResultCodeEnum.USER_NOT_EXIST_ERROR); 73 | } 74 | try { 75 | // 用户密码加签验证 token 76 | JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(account.getPassword())).build(); 77 | jwtVerifier.verify(token); // 验证token 78 | } catch (JWTVerificationException e) { 79 | throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR); 80 | } 81 | return true; 82 | } 83 | } -------------------------------------------------------------------------------- /vue/src/views/Register.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 86 | 87 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/controller/WebController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import cn.hutool.core.util.ObjectUtil; 4 | import cn.hutool.core.util.StrUtil; 5 | import com.example.common.Result; 6 | import com.example.common.enums.ResultCodeEnum; 7 | import com.example.common.enums.RoleEnum; 8 | import com.example.entity.Account; 9 | import com.example.service.AdminService; 10 | import com.example.service.HotelService; 11 | import com.example.service.UserService; 12 | import org.apache.catalina.session.StandardSession; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.annotation.Resource; 16 | 17 | /** 18 | * 基础前端接口 19 | */ 20 | @RestController 21 | public class WebController { 22 | 23 | @Resource 24 | private AdminService adminService; 25 | @Resource 26 | private HotelService hotelService; 27 | @Resource 28 | private UserService userService; 29 | 30 | @GetMapping("/") 31 | public Result hello() { 32 | return Result.success("访问成功"); 33 | } 34 | 35 | /** 36 | * 登录 37 | */ 38 | @PostMapping("/login") 39 | public Result login(@RequestBody Account account) { 40 | if (ObjectUtil.isEmpty(account.getUsername()) || ObjectUtil.isEmpty(account.getPassword()) 41 | || ObjectUtil.isEmpty(account.getRole())) { 42 | return Result.error(ResultCodeEnum.PARAM_LOST_ERROR); 43 | } 44 | if (RoleEnum.ADMIN.name().equals(account.getRole())) { 45 | account = adminService.login(account); 46 | } 47 | if (RoleEnum.HOTEL.name().equals(account.getRole())) { 48 | account = hotelService.login(account); 49 | } 50 | if (RoleEnum.USER.name().equals(account.getRole())) { 51 | account = userService.login(account); 52 | } 53 | return Result.success(account); 54 | } 55 | 56 | /** 57 | * 注册 58 | */ 59 | @PostMapping("/register") 60 | public Result register(@RequestBody Account account) { 61 | if (StrUtil.isBlank(account.getUsername()) || StrUtil.isBlank(account.getPassword()) 62 | || ObjectUtil.isEmpty(account.getRole())) { 63 | return Result.error(ResultCodeEnum.PARAM_LOST_ERROR); 64 | } 65 | // if (RoleEnum.ADMIN.name().equals(account.getRole())) { 66 | // adminService.register(account); 67 | // } 68 | if (RoleEnum.HOTEL.name().equals(account.getRole())) { 69 | hotelService.register(account); 70 | } 71 | if (RoleEnum.USER.name().equals(account.getRole())) { 72 | userService.register(account); 73 | } 74 | return Result.success(); 75 | } 76 | 77 | /** 78 | * 修改密码 79 | */ 80 | @PutMapping("/updatePassword") 81 | public Result updatePassword(@RequestBody Account account) { 82 | if (StrUtil.isBlank(account.getUsername()) || StrUtil.isBlank(account.getPassword()) 83 | || ObjectUtil.isEmpty(account.getNewPassword())) { 84 | return Result.error(ResultCodeEnum.PARAM_LOST_ERROR); 85 | } 86 | if (RoleEnum.ADMIN.name().equals(account.getRole())) { 87 | adminService.updatePassword(account); 88 | } 89 | if (RoleEnum.HOTEL.name().equals(account.getRole())) { 90 | hotelService.updatePassword(account); 91 | } 92 | if (RoleEnum.USER.name().equals(account.getRole())) { 93 | userService.updatePassword(account); 94 | } 95 | return Result.success(); 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /vue/src/views/Front.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 105 | 106 | -------------------------------------------------------------------------------- /vue/src/views/manager/HotelPerson.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 81 | 82 | -------------------------------------------------------------------------------- /vue/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | Vue.use(VueRouter) 5 | 6 | // 解决导航栏或者底部导航tabBar中的vue-router在3.0版本以上频繁点击菜单报错的问题。 7 | const originalPush = VueRouter.prototype.push 8 | VueRouter.prototype.push = function push (location) { 9 | return originalPush.call(this, location).catch(err => err) 10 | } 11 | 12 | const routes = [ 13 | { 14 | path: '/', 15 | name: 'Manager', 16 | redirect: '/login', 17 | component: () => import('../views/Manager.vue'), 18 | children: [ 19 | { path: '403', name: 'NoAuth', meta: { name: '无权限' }, component: () => import('../views/manager/403') }, 20 | { path: 'home', name: 'Home', meta: { name: '系统首页' }, component: () => import('../views/manager/Home') }, 21 | { path: 'admin', name: 'Admin', meta: { name: '管理员信息' }, component: () => import('../views/manager/Admin') }, 22 | { path: 'adminPerson', name: 'AdminPerson', meta: { name: '个人信息' }, component: () => import('../views/manager/AdminPerson') }, 23 | { path: 'hotelPerson', name: 'HotelPerson', meta: { name: '个人信息' }, component: () => import('../views/manager/HotelPerson') }, 24 | { path: 'password', name: 'Password', meta: { name: '修改密码' }, component: () => import('../views/manager/Password') }, 25 | { path: 'notice', name: 'Notice', meta: { name: '公告信息' }, component: () => import('../views/manager/Notice') }, 26 | { path: 'hotel', name: 'Hotel', meta: { name: '酒店信息' }, component: () => import('../views/manager/Hotel') }, 27 | { path: 'user', name: 'User', meta: { name: '用户信息' }, component: () => import('../views/manager/User') }, 28 | { path: 'type', name: 'Type', meta: { name: '分类信息' }, component: () => import('../views/manager/Type') }, 29 | { path: 'room', name: 'Room', meta: { name: '客房信息' }, component: () => import('../views/manager/Room') }, 30 | { path: 'orders', name: 'Orders', meta: { name: '订单信息' }, component: () => import('../views/manager/Orders') }, 31 | { path: 'checkin', name: 'Checkin', meta: { name: '入住登记' }, component: () => import('../views/manager/Checkin') }, 32 | { path: 'comment', name: 'Comment', meta: { name: '评论管理' }, component: () => import('../views/manager/Comment') }, 33 | ] 34 | }, 35 | { 36 | path: '/front', 37 | name: 'Front', 38 | component: () => import('../views/Front.vue'), 39 | children: [ 40 | { path: 'home', name: 'Home', meta: { name: '系统首页' }, component: () => import('../views/front/Home') }, 41 | { path: 'person', name: 'Person', meta: { name: '个人信息' }, component: () => import('../views/front/Person') }, 42 | { path: 'hotel', name: 'Hotel', meta: { name: '酒店信息' }, component: () => import('../views/front/Hotel') }, 43 | { path: 'detail', name: 'Detail', meta: { name: '客房信息' }, component: () => import('../views/front/Detail') }, 44 | { path: 'collect', name: 'Collect', meta: { name: '收藏信息' }, component: () => import('../views/front/Collect') }, 45 | { path: 'orders', name: 'Orders', meta: { name: '订单信息' }, component: () => import('../views/front/Orders') }, 46 | { path: 'history', name: 'History', meta: { name: '历史入住' }, component: () => import('../views/front/History') }, 47 | { path: 'search', name: 'Search', meta: { name: '搜索页面' }, component: () => import('../views/front/Search') }, 48 | ] 49 | }, 50 | { path: '/login', name: 'Login', meta: { name: '登录' }, component: () => import('../views/Login.vue') }, 51 | { path: '/register', name: 'Register', meta: { name: '注册' }, component: () => import('../views/Register.vue') }, 52 | { path: '*', name: 'NotFound', meta: { name: '无法访问' }, component: () => import('../views/404.vue') }, 53 | ] 54 | 55 | const router = new VueRouter({ 56 | mode: 'history', 57 | base: process.env.BASE_URL, 58 | routes 59 | }) 60 | 61 | export default router 62 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/utils/CoreMath.java: -------------------------------------------------------------------------------- 1 | package com.example.utils; 2 | 3 | import cn.hutool.core.collection.CollectionUtil; 4 | import cn.hutool.core.date.DateUtil; 5 | import cn.hutool.core.util.ObjectUtil; 6 | import com.auth0.jwt.JWT; 7 | import com.auth0.jwt.algorithms.Algorithm; 8 | import com.example.common.Constants; 9 | import com.example.common.enums.RoleEnum; 10 | import com.example.entity.Account; 11 | import com.example.entity.RelateDTO; 12 | import com.example.service.AdminService; 13 | import com.example.service.HotelService; 14 | import com.example.service.UserService; 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | import org.springframework.stereotype.Component; 18 | import org.springframework.web.context.request.RequestContextHolder; 19 | import org.springframework.web.context.request.ServletRequestAttributes; 20 | 21 | import javax.annotation.PostConstruct; 22 | import javax.annotation.Resource; 23 | import javax.servlet.http.HttpServletRequest; 24 | import java.util.*; 25 | import java.util.stream.IntStream; 26 | 27 | /** 28 | * 推荐核心算法 29 | */ 30 | public class CoreMath { 31 | 32 | 33 | /** 34 | * 计算相关系数并排序 35 | */ 36 | public static Map computeNeighbor(Integer key, Map> map, int type) { 37 | Map distMap = new TreeMap<>(); 38 | List userItems = map.get(key); 39 | if (CollectionUtil.isNotEmpty(userItems)) { 40 | map.forEach((k, v) -> { 41 | //排除此用户 42 | if (!k.equals(key)) { 43 | //关系系数 44 | double coefficient = relateDist(v, userItems, type); 45 | //关系距离 46 | double distance = Math.abs(coefficient); 47 | distMap.put(k, distance); 48 | } 49 | }); 50 | } 51 | return distMap; 52 | } 53 | 54 | 55 | /** 56 | * 计算两个序列间的相关系数 57 | */ 58 | private static double relateDist(List xList, List yList, int type) { 59 | List xs = new ArrayList<>(); 60 | List ys = new ArrayList<>(); 61 | xList.forEach(x -> yList.forEach(y -> { 62 | if (type == 0) { 63 | if (x.getTypeId().equals(y.getTypeId())) { 64 | xs.add(x.getIndex()); 65 | ys.add(y.getIndex()); 66 | } 67 | } else { 68 | if (x.getUseId().equals(y.getUseId())) { 69 | xs.add(x.getIndex()); 70 | ys.add(y.getIndex()); 71 | } 72 | } 73 | })); 74 | return getRelate(xs, ys); 75 | } 76 | 77 | /** 78 | * 方法描述: 皮尔森(pearson)相关系数计算 79 | * @param xs x集合 80 | * @param ys y集合 81 | * @Return {@link double} 82 | */ 83 | public static double getRelate(List xs, List ys) { 84 | int n = xs.size(); 85 | //至少有两个元素 86 | if (n < 2) { 87 | return 0D; 88 | } 89 | double Ex = xs.stream().mapToDouble(x -> x).sum(); 90 | double Ey = ys.stream().mapToDouble(y -> y).sum(); 91 | double Ex2 = xs.stream().mapToDouble(x -> Math.pow(x, 2)).sum(); 92 | double Ey2 = ys.stream().mapToDouble(y -> Math.pow(y, 2)).sum(); 93 | double Exy = IntStream.range(0, n).mapToDouble(i -> xs.get(i) * ys.get(i)).sum(); 94 | double numerator = Exy - Ex * Ey / n; 95 | double denominator = Math.sqrt((Ex2 - Math.pow(Ex, 2) / n) * (Ey2 - Math.pow(Ey, 2) / n)); 96 | if (denominator == 0) { 97 | return 0D; 98 | } 99 | return numerator / denominator; 100 | } 101 | 102 | } -------------------------------------------------------------------------------- /vue/src/assets/css/manager.css: -------------------------------------------------------------------------------- 1 | .manager-container { 2 | background-color: #f8f8ff; 3 | min-height: 100vh; 4 | } 5 | 6 | .manager-header { 7 | display: flex; 8 | background-color: #2c334c; 9 | } 10 | 11 | .manager-header-left { 12 | width: 200px; 13 | height: 60px; 14 | padding-left: 10px; 15 | display: flex; 16 | align-items: center 17 | } 18 | 19 | .manager-header-left img { 20 | width: 40px; 21 | height: 40px; 22 | } 23 | 24 | .manager-header-left .title { 25 | flex: 1; 26 | margin-left: 5px; 27 | font-size: 20px; 28 | font-weight: bold; 29 | color: #ddd 30 | } 31 | 32 | .manager-header-center { 33 | flex: 1; 34 | width: 0; 35 | display: flex; 36 | align-items: center 37 | } 38 | 39 | .manager-header-right { 40 | width: 200px; 41 | display: flex; 42 | align-items: center; 43 | justify-content: flex-end; 44 | } 45 | 46 | .manager-header-right .avatar { 47 | display: flex; 48 | align-items: center; 49 | padding-right: 10px; 50 | color: #ccc; 51 | cursor: default 52 | } 53 | 54 | .manager-header-right .avatar img { 55 | width: 40px; 56 | height: 40px; 57 | border-radius: 50%; 58 | margin-right: 5px 59 | } 60 | 61 | .manager-main { 62 | display: flex; 63 | } 64 | 65 | .manager-main-left { 66 | width: 200px; 67 | min-height: calc(100vh - 60px); 68 | box-shadow: 0 0 6px rgba(0, 21, 41, .35); 69 | } 70 | 71 | .manager-main-right { 72 | flex: 1; 73 | width: 0; 74 | padding: 10px; 75 | } 76 | 77 | .manager-main-right .search { 78 | padding: 10px; 79 | background-color: #fff; 80 | border-radius: 5px; 81 | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1); 82 | } 83 | 84 | .manager-main-right .operation { 85 | margin-top: 5px; 86 | padding: 10px; 87 | background-color: #fff; 88 | border-radius: 5px; 89 | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1) 90 | } 91 | 92 | .manager-main-right .table { 93 | margin-top: 5px; 94 | padding: 15px 10px; 95 | background-color: #fff; 96 | border-radius: 5px; 97 | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1) 98 | } 99 | 100 | .manager-main-right .table .pagination { 101 | margin-top: 10px; 102 | } 103 | 104 | .card { 105 | padding: 20px; 106 | background-color: #fff; 107 | border-radius: 5px; 108 | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1); 109 | } 110 | 111 | /* ElementUI */ 112 | .el-menu { 113 | width: 200px; 114 | height: 100%; 115 | background-color: #222b40; 116 | } 117 | 118 | .el-submenu__title { 119 | color: #ccc; 120 | height: 50px; 121 | line-height: 50px; 122 | } 123 | 124 | .el-menu-item { 125 | color: #ccc; 126 | height: 50px; 127 | line-height: 50px; 128 | background-color: #222b40 !important; /* 必须加上这个背景色,否则鼠标离开会出现白色 */ 129 | } 130 | 131 | .el-menu-item.is-active { 132 | /*background-color: #2bb7e5 !important;*/ 133 | /*color: #fff;*/ 134 | } 135 | 136 | .el-menu--inline .el-menu-item { 137 | padding-left: 50px !important; 138 | } 139 | 140 | .el-menu .is-active { 141 | color: #3399ff !important; 142 | } 143 | 144 | .el-submenu__title:hover { 145 | background-color: #222 !important; 146 | } 147 | 148 | .el-menu-item:not(.is-active):hover { 149 | /*background-color: #0376bf !important;*/ 150 | /*color: #fff;*/ 151 | } 152 | 153 | .el-menu-item:hover { 154 | background-color: #222 !important; 155 | } 156 | 157 | .el-submenu__icon-arrow { 158 | margin-top: -5px; 159 | } 160 | 161 | .el-breadcrumb__inner { 162 | color: #ccc !important; 163 | } 164 | 165 | .el-dropdown-menu { 166 | margin-top: 20px !important; 167 | } 168 | 169 | .el-breadcrumb { 170 | margin-left: 10px; 171 | } 172 | 173 | th.el-table__cell { 174 | background-color: #f8f8f8 !important; 175 | color: #666; 176 | } -------------------------------------------------------------------------------- /vue/src/views/Manager.vue: -------------------------------------------------------------------------------- 1 | 72 | 73 | 105 | 106 | -------------------------------------------------------------------------------- /vue/src/views/front/History.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 117 | -------------------------------------------------------------------------------- /vue/src/views/manager/Comment.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 124 | 125 | 128 | -------------------------------------------------------------------------------- /vue/src/views/front/Hotel.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 107 | -------------------------------------------------------------------------------- /vue/src/views/front/Orders.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | 129 | -------------------------------------------------------------------------------- /vue/src/views/front/Home.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 129 | -------------------------------------------------------------------------------- /vue/src/views/front/Person.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 131 | 132 | -------------------------------------------------------------------------------- /vue/src/views/manager/Orders.vue: -------------------------------------------------------------------------------- 1 | 56 | 57 | 167 | 168 | 171 | -------------------------------------------------------------------------------- /vue/src/views/manager/Notice.vue: -------------------------------------------------------------------------------- 1 | 63 | 64 | 175 | 176 | 179 | -------------------------------------------------------------------------------- /vue/src/views/manager/User.vue: -------------------------------------------------------------------------------- 1 | 78 | 79 | 195 | 196 | -------------------------------------------------------------------------------- /vue/src/views/manager/Room.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 199 | 200 | 203 | -------------------------------------------------------------------------------- /vue/src/views/manager/Type.vue: -------------------------------------------------------------------------------- 1 | 85 | 86 | 203 | -------------------------------------------------------------------------------- /vue/src/views/manager/Admin.vue: -------------------------------------------------------------------------------- 1 | 90 | 91 | 203 | 204 | -------------------------------------------------------------------------------- /vue/src/views/manager/Checkin.vue: -------------------------------------------------------------------------------- 1 | 69 | 70 | 205 | 206 | 209 | -------------------------------------------------------------------------------- /vue/src/views/manager/Hotel.vue: -------------------------------------------------------------------------------- 1 | 98 | 99 | 215 | 216 | --------------------------------------------------------------------------------