├── README.md ├── img ├── mobile.jpg └── web.jpg ├── train-user ├── .browserslistrc ├── .eslintrc.js ├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── App.vue │ ├── assets │ │ ├── QR.png │ │ ├── bac.jpg │ │ ├── back.png │ │ ├── indexicon │ │ │ ├── 1579093807378_MyOffice功能测试流程 (1).docx │ │ │ ├── all.png │ │ │ ├── grid1.jpg │ │ │ ├── grid2.png │ │ │ ├── grid3.jpg │ │ │ ├── grid4.jpg │ │ │ ├── lunch.jpg │ │ │ ├── restaurant.png │ │ │ ├── reverse.png │ │ │ ├── screen.png │ │ │ ├── serve.png │ │ │ ├── swiper1.jpg │ │ │ ├── swiper2.jpg │ │ │ └── swiper3.jpg │ │ ├── login.jpg │ │ ├── logo.png │ │ ├── mine.png │ │ ├── mineactive.png │ │ ├── mineicon │ │ │ └── head.jpg │ │ ├── order.png │ │ ├── order │ │ │ ├── arrive.png │ │ │ └── arrive1.png │ │ ├── orderactive.png │ │ ├── train.png │ │ └── trainactive.png │ ├── components │ │ └── HelloWorld.vue │ ├── main.js │ ├── router │ │ └── index.js │ └── views │ │ ├── ChangeTicket.vue │ │ ├── CityList.vue │ │ ├── ConfirmOrder.vue │ │ ├── DetailOrder.vue │ │ ├── Index.vue │ │ ├── Login.vue │ │ ├── Mine.vue │ │ ├── Order.vue │ │ ├── QueryTrain.vue │ │ ├── SelectUser.vue │ │ ├── register.vue │ │ └── tabbar.vue ├── vue.config.js └── yarn.lock ├── train.sql ├── train ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── lemon │ │ │ │ └── train │ │ │ │ ├── ServletInitializer.java │ │ │ │ ├── TrainApplication.java │ │ │ │ ├── common │ │ │ │ ├── AsyncTask.java │ │ │ │ ├── GloablExceptionHandler.java │ │ │ │ ├── ResponseResult.java │ │ │ │ └── TimeHandle.java │ │ │ │ ├── config │ │ │ │ └── InterceptorConfig.java │ │ │ │ ├── controller │ │ │ │ ├── OrderController.java │ │ │ │ ├── PriceManageController.java │ │ │ │ ├── TrainController.java │ │ │ │ └── UserController.java │ │ │ │ ├── entity │ │ │ │ ├── Holiday.java │ │ │ │ ├── HolidayExample.java │ │ │ │ ├── Orderinfo.java │ │ │ │ ├── OrderinfoExample.java │ │ │ │ ├── Orders.java │ │ │ │ ├── OrdersExample.java │ │ │ │ ├── Orderseat.java │ │ │ │ ├── OrderseatExample.java │ │ │ │ ├── Passenger.java │ │ │ │ ├── Pricemanage.java │ │ │ │ ├── Seatinfo.java │ │ │ │ ├── SeatinfoExample.java │ │ │ │ ├── Train.java │ │ │ │ ├── TrainExample.java │ │ │ │ ├── Traininfo.java │ │ │ │ ├── TraininfoExample.java │ │ │ │ ├── Traininfos.java │ │ │ │ ├── TraininfosExample.java │ │ │ │ ├── Trainseat.java │ │ │ │ ├── TrainseatExample.java │ │ │ │ ├── Trainstate.java │ │ │ │ ├── TrainstateExample.java │ │ │ │ ├── Trainticket.java │ │ │ │ ├── TrainticketExample.java │ │ │ │ ├── User.java │ │ │ │ └── UserExample.java │ │ │ │ ├── mapper │ │ │ │ ├── HolidayMapper.java │ │ │ │ ├── OrderinfoMapper.java │ │ │ │ ├── OrdersMapper.java │ │ │ │ ├── OrderseatMapper.java │ │ │ │ ├── SeatinfoMapper.java │ │ │ │ ├── TrainMapper.java │ │ │ │ ├── TraininfoMapper.java │ │ │ │ ├── TraininfosMapper.java │ │ │ │ ├── TrainseatMapper.java │ │ │ │ ├── TrainstateMapper.java │ │ │ │ ├── TrainticketMapper.java │ │ │ │ └── UserMapper.java │ │ │ │ └── service │ │ │ │ ├── OrderService.java │ │ │ │ ├── PriceManageService.java │ │ │ │ ├── TrainService.java │ │ │ │ ├── UserService.java │ │ │ │ └── impl │ │ │ │ ├── OrderServiceImpl.java │ │ │ │ ├── PriceManageServiceImpl.java │ │ │ │ ├── TrainServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ └── resources │ │ │ ├── 1.txt │ │ │ ├── application.yml │ │ │ ├── banner.txt │ │ │ ├── generator │ │ │ └── generatorConfig.xml │ │ │ ├── mapper │ │ │ ├── HolidayMapper.xml │ │ │ ├── OrderinfoMapper.xml │ │ │ ├── OrdersMapper.xml │ │ │ ├── OrderseatMapper.xml │ │ │ ├── SeatinfoMapper.xml │ │ │ ├── TrainMapper.xml │ │ │ ├── TraininfoMapper.xml │ │ │ ├── TraininfosMapper.xml │ │ │ ├── TrainseatMapper.xml │ │ │ ├── TrainstateMapper.xml │ │ │ ├── TrainticketMapper.xml │ │ │ └── UserMapper.xml │ │ │ └── train.sql │ └── test │ │ └── java │ │ └── com │ │ └── lemon │ │ └── train │ │ ├── DateTimeTest.java │ │ ├── TrainApplicationTests.java │ │ └── traintest.java └── train │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lemon │ │ │ └── train │ │ │ ├── ServletInitializer.java │ │ │ ├── TrainApplication.java │ │ │ ├── common │ │ │ ├── AsyncTask.java │ │ │ ├── GloablExceptionHandler.java │ │ │ ├── ResponseResult.java │ │ │ └── TimeHandle.java │ │ │ ├── config │ │ │ └── InterceptorConfig.java │ │ │ ├── controller │ │ │ ├── OrderController.java │ │ │ ├── PriceManageController.java │ │ │ ├── TrainController.java │ │ │ └── UserController.java │ │ │ ├── entity │ │ │ ├── Holiday.java │ │ │ ├── HolidayExample.java │ │ │ ├── Orderinfo.java │ │ │ ├── OrderinfoExample.java │ │ │ ├── Orders.java │ │ │ ├── OrdersExample.java │ │ │ ├── Orderseat.java │ │ │ ├── OrderseatExample.java │ │ │ ├── Passenger.java │ │ │ ├── Pricemanage.java │ │ │ ├── Seatinfo.java │ │ │ ├── SeatinfoExample.java │ │ │ ├── Train.java │ │ │ ├── TrainExample.java │ │ │ ├── Traininfo.java │ │ │ ├── TraininfoExample.java │ │ │ ├── Traininfos.java │ │ │ ├── TraininfosExample.java │ │ │ ├── Trainseat.java │ │ │ ├── TrainseatExample.java │ │ │ ├── Trainstate.java │ │ │ ├── TrainstateExample.java │ │ │ ├── Trainticket.java │ │ │ ├── TrainticketExample.java │ │ │ ├── User.java │ │ │ └── UserExample.java │ │ │ ├── mapper │ │ │ ├── HolidayMapper.java │ │ │ ├── OrderinfoMapper.java │ │ │ ├── OrdersMapper.java │ │ │ ├── OrderseatMapper.java │ │ │ ├── SeatinfoMapper.java │ │ │ ├── TrainMapper.java │ │ │ ├── TraininfoMapper.java │ │ │ ├── TraininfosMapper.java │ │ │ ├── TrainseatMapper.java │ │ │ ├── TrainstateMapper.java │ │ │ ├── TrainticketMapper.java │ │ │ └── UserMapper.java │ │ │ └── service │ │ │ ├── OrderService.java │ │ │ ├── PriceManageService.java │ │ │ ├── TrainService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ ├── OrderServiceImpl.java │ │ │ ├── PriceManageServiceImpl.java │ │ │ ├── TrainServiceImpl.java │ │ │ └── UserServiceImpl.java │ └── resources │ │ ├── 1.txt │ │ ├── application.yml │ │ ├── banner.txt │ │ ├── generator │ │ └── generatorConfig.xml │ │ ├── mapper │ │ ├── HolidayMapper.xml │ │ ├── OrderinfoMapper.xml │ │ ├── OrdersMapper.xml │ │ ├── OrderseatMapper.xml │ │ ├── SeatinfoMapper.xml │ │ ├── TrainMapper.xml │ │ ├── TraininfoMapper.xml │ │ ├── TraininfosMapper.xml │ │ ├── TrainseatMapper.xml │ │ ├── TrainstateMapper.xml │ │ ├── TrainticketMapper.xml │ │ └── UserMapper.xml │ │ └── train.sql │ └── test │ └── java │ └── com │ └── lemon │ └── train │ ├── DateTimeTest.java │ ├── TrainApplicationTests.java │ └── traintest.java └── vue-manage-system ├── .browserslistrc ├── .gitignore ├── .prettierrc ├── LICENSE ├── README_EN.md ├── babel.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── index.html └── table.json ├── screenshots ├── wms1.png ├── wms2.png └── wms3.png ├── src ├── App.vue ├── api │ └── index.js ├── assets │ ├── 404_images │ │ ├── 404.png │ │ └── 404_cloud.png │ ├── css │ │ ├── color-dark.css │ │ ├── icon.css │ │ ├── main.css │ │ └── theme-green │ │ │ ├── color-green.css │ │ │ ├── fonts │ │ │ ├── element-icons.ttf │ │ │ └── element-icons.woff │ │ │ └── index.css │ ├── img │ │ ├── img.jpg │ │ └── login-bg.jpg │ └── logo.png ├── components │ ├── common │ │ ├── Header.vue │ │ ├── Home.vue │ │ ├── Sidebar.vue │ │ ├── Tags.vue │ │ ├── bus.js │ │ ├── directives.js │ │ └── i18n.js │ └── page │ │ ├── 403.vue │ │ ├── 404.vue │ │ ├── AddTrain.vue │ │ ├── BaseCharts.vue │ │ ├── BaseForm.vue │ │ ├── BaseTable.vue │ │ ├── Dashboard.vue │ │ ├── DepartTrain.vue │ │ ├── Donate.vue │ │ ├── DragDialog.vue │ │ ├── DragList.vue │ │ ├── I18n.vue │ │ ├── Icon.vue │ │ ├── Login.vue │ │ ├── Markdown.vue │ │ ├── Permission.vue │ │ ├── PriceManage.vue │ │ ├── Tabs.vue │ │ ├── Upload.vue │ │ └── VueEditor.vue ├── main.js ├── router │ └── index.js └── utils │ └── request.js └── vue.config.js /README.md: -------------------------------------------------------------------------------- 1 | ## 火车售票系统 2 | 3 | :blush:本系统使用了Vue作为前端框架,Vant组件和element ui作为前端前端UI,后端使用了springboot和Mybatis,数据库使用了Mysql关系型数据库,具有用户移动端和web管理端两个终端。 4 | 5 | ---------- 6 | ##### :100: 模块介绍 7 | 8 | train模块为后端项目,支持用户前端和管理后台的api请求;train-user为前端用户项目;vue-manage-system为管理后台项目,使用[后台模板](https://github.com/lin-xin/vue-manage-system)魔改的。 9 | 10 | ---------- 11 | ##### :hammer:系统主要功能 12 | 13 | - [x] 火车票预订 14 | - [x] 火车票改签 15 | - [x] 火车票退票 16 | - [x] 车票节假日价格浮动 17 | - [x] 火车发布和新增 18 | 19 | _:wrench:这次项目只做了简单的售票业务,而且假设每辆火车只有起点和终点,为了方便移植和编写,项目只用了Mysql数据库,不过Mysql做了很多底层代码,创建了视图、存储过程和一些触发器,另外项目还有很多待优化的地方,管理员界面套用了vue后台管理模板,在基础业务外还可以添加很多功能。_ 20 | 21 | ----------- 22 | 23 | ##### 需要的环境和软件:rainbow:: 24 | 25 | > 1. node 26 | > 2. maven 27 | > 3. mysql8.0 28 | > 4. Vscode 29 | > 5. Intellij IDEA 30 | 31 | ##### 帮助过程:trophy: 32 | 33 | 1. 安装启动数据库Mysql8.0,打开可视化工具将train.sql数据库脚本文件导入(不要直接运行脚本,在Navicat右键运行SQL文件,或者在DBeaver新建train,如何右键train数据库>工具>Restore database)。 34 | 2. 启动服务端,安装打开Intellij IDEA软件,导入train项目文件夹,找到application.yml文件修改数据库连接配置(配置为自己环境的数据库连接配置),完成后启动项目。 35 | 3. 打开Vscode,导入vue-manage-system和train-user项目,代开vue.config.js文件可以进行端口号的修改,然后执行npm install安装依赖,最后执行npm run serve 运行程 36 | 4. 管理员默认账号密码admin和123456,用户端已存在测试账号密码 匿名用户和123456 37 | 5. 有些数据已经过期可以根据需求删减,火车查询列次是只能查询当前时间之后的火车班次 38 | 39 | ----- 40 | 41 | :black_nib:下面展示两个终端的主页​ 42 | 43 | 移动主页 44 | 45 | 46 | 47 | web主页 48 | -------------------------------------------------------------------------------- /img/mobile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/img/mobile.jpg -------------------------------------------------------------------------------- /img/web.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/img/web.jpg -------------------------------------------------------------------------------- /train-user/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /train-user/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | parserOptions: { 11 | parser: 'babel-eslint' 12 | }, 13 | rules: { 14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /train-user/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | -------------------------------------------------------------------------------- /train-user/README.md: -------------------------------------------------------------------------------- 1 | # train-user 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | yarn lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /train-user/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /train-user/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "train-user", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.19.2", 12 | "element-ui": "^2.13.2", 13 | "js-md5": "^0.7.3", 14 | "md5": "^2.2.1", 15 | "qs": "^6.9.4", 16 | "vant": "^2.8.5", 17 | "vue": "^2.6.11", 18 | "vue-router": "^3.2.0" 19 | }, 20 | "devDependencies": { 21 | "@vue/cli-plugin-babel": "~4.4.0", 22 | "@vue/cli-plugin-eslint": "~4.4.0", 23 | "@vue/cli-plugin-router": "~4.4.0", 24 | "@vue/cli-service": "~4.4.0", 25 | "babel-eslint": "^10.1.0", 26 | "babel-plugin-import": "^1.13.0", 27 | "core-js": "^3.6.5", 28 | "eslint": "^6.7.2", 29 | "eslint-plugin-vue": "^6.2.2", 30 | "less": "^3.11.2", 31 | "less-loader": "^6.1.0", 32 | "vue-template-compiler": "^2.6.11" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /train-user/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/public/favicon.ico -------------------------------------------------------------------------------- /train-user/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /train-user/src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 33 | -------------------------------------------------------------------------------- /train-user/src/assets/QR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/QR.png -------------------------------------------------------------------------------- /train-user/src/assets/bac.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/bac.jpg -------------------------------------------------------------------------------- /train-user/src/assets/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/back.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/1579093807378_MyOffice功能测试流程 (1).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/1579093807378_MyOffice功能测试流程 (1).docx -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/all.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/grid1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/grid1.jpg -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/grid2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/grid2.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/grid3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/grid3.jpg -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/grid4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/grid4.jpg -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/lunch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/lunch.jpg -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/restaurant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/restaurant.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/reverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/reverse.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/screen.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/serve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/serve.png -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/swiper1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/swiper1.jpg -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/swiper2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/swiper2.jpg -------------------------------------------------------------------------------- /train-user/src/assets/indexicon/swiper3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/indexicon/swiper3.jpg -------------------------------------------------------------------------------- /train-user/src/assets/login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/login.jpg -------------------------------------------------------------------------------- /train-user/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/logo.png -------------------------------------------------------------------------------- /train-user/src/assets/mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/mine.png -------------------------------------------------------------------------------- /train-user/src/assets/mineactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/mineactive.png -------------------------------------------------------------------------------- /train-user/src/assets/mineicon/head.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/mineicon/head.jpg -------------------------------------------------------------------------------- /train-user/src/assets/order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/order.png -------------------------------------------------------------------------------- /train-user/src/assets/order/arrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/order/arrive.png -------------------------------------------------------------------------------- /train-user/src/assets/order/arrive1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/order/arrive1.png -------------------------------------------------------------------------------- /train-user/src/assets/orderactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/orderactive.png -------------------------------------------------------------------------------- /train-user/src/assets/train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/train.png -------------------------------------------------------------------------------- /train-user/src/assets/trainactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train-user/src/assets/trainactive.png -------------------------------------------------------------------------------- /train-user/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 42 | 43 | 44 | 60 | -------------------------------------------------------------------------------- /train-user/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 Vant from 'vant'; 7 | import 'vant/lib/index.css'; 8 | import { Lazyload } from 'vant'; 9 | import axios from 'axios' 10 | import qs from 'qs' 11 | import md5 from 'js-md5' 12 | 13 | Vue.prototype.$md5 = md5; 14 | Vue.prototype.$qs = qs 15 | Vue.prototype.$axios = axios 16 | Vue.prototype.$axios.defaults.baseURL = 'http://localhost:8081/' 17 | //Lazyload 是 Vue 指令,使用前需要对指令进行注册 18 | Vue.use(Lazyload) 19 | Vue.use(Vant); 20 | 21 | Vue.config.productionTip = false 22 | Vue.use(ElementUI); 23 | 24 | new Vue({ 25 | router, 26 | render: h => h(App) 27 | }).$mount('#app') -------------------------------------------------------------------------------- /train-user/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Login from '../views/Login.vue' 4 | import Register from '../views/register.vue' 5 | import Tabbar from '../views/tabbar.vue' 6 | import Index from '../views/Index.vue' 7 | import Order from '../views/Order.vue' 8 | import Mine from '../views/Mine.vue' 9 | import Citylist from '../views/CityList.vue' 10 | import Querytrain from '../views/QueryTrain.vue' 11 | import ConfirmOrder from '../views/ConfirmOrder.vue' 12 | import SelectUser from '../views/SelectUser.vue' 13 | import DetailOrder from '../views/DetailOrder.vue' 14 | import ChangeTicket from '../views/ChangeTicket.vue' 15 | 16 | Vue.use(VueRouter) 17 | 18 | const routes = [{ 19 | path: '/', 20 | name: 'Login', 21 | component: Login 22 | }, 23 | { 24 | path: '/register', 25 | name: 'register', 26 | component: Register 27 | }, 28 | { 29 | path: '/citylist', 30 | name: 'citylist', 31 | component: Citylist 32 | }, 33 | { 34 | path: '/querytrain', 35 | name: 'querytrain', 36 | component: Querytrain 37 | }, 38 | { 39 | path: '/confirmorder', 40 | name: 'confirmorder', 41 | component: ConfirmOrder 42 | }, 43 | { 44 | path: '/selectuser', 45 | name: 'selectuser', 46 | component: SelectUser 47 | }, 48 | { 49 | path: '/detailorder', 50 | name: 'detailorder', 51 | component: DetailOrder 52 | }, 53 | { 54 | path: '/changeticket', 55 | name: 'changeticket', 56 | component: ChangeTicket 57 | }, 58 | { 59 | path: '/tabbar', 60 | name: 'tabbar', 61 | component: Tabbar, 62 | children: [{ 63 | path: '/index', 64 | name: 'index', 65 | component: Index, 66 | }, { 67 | path: '/order', 68 | name: 'order', 69 | component: Order, 70 | }, { 71 | path: '/mine', 72 | name: 'mine', 73 | component: Mine, 74 | }] 75 | } 76 | 77 | ] 78 | 79 | 80 | 81 | const router = new VueRouter({ 82 | mode: 'history', 83 | base: process.env.BASE_URL, 84 | routes 85 | }) 86 | 87 | export default router -------------------------------------------------------------------------------- /train-user/src/views/CityList.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 62 | 63 | -------------------------------------------------------------------------------- /train-user/src/views/Mine.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 54 | 55 | -------------------------------------------------------------------------------- /train-user/src/views/SelectUser.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 95 | 96 | -------------------------------------------------------------------------------- /train-user/src/views/tabbar.vue: -------------------------------------------------------------------------------- 1 | 17 | 64 | -------------------------------------------------------------------------------- /train-user/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | port: 8888, 4 | open: true 5 | }, 6 | // 基本路径 7 | publicPath: "./", // 可以设置成相对路径,这样所有的资源都会被链接为相对路径,打出来的包可以被部署在任意路径 8 | outputDir: "dist", //打包时生成的生产环境构建文件的目录 9 | assetsDir: 'public', // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录 10 | } -------------------------------------------------------------------------------- /train/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /train/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /train/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /train/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.8.RELEASE 9 | 10 | 11 | com.zstu 12 | demo 13 | 0.0.1-SNAPSHOT 14 | war 15 | demo 16 | Demo project for Spring Boot 17 | 18 | 19 | 1.8 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | org.mybatis.spring.boot 29 | mybatis-spring-boot-starter 30 | 2.1.3 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-devtools 36 | runtime 37 | true 38 | 39 | 40 | org.projectlombok 41 | lombok 42 | true 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter-tomcat 47 | provided 48 | 49 | 50 | org.springframework.boot 51 | spring-boot-starter-test 52 | test 53 | 54 | 55 | org.junit.vintage 56 | junit-vintage-engine 57 | 58 | 59 | 60 | 61 | mysql 62 | mysql-connector-java 63 | 64 | 65 | 66 | io.github.yedaxia 67 | japidocs 68 | 1.4 69 | 70 | 71 | 72 | 73 | com.github.pagehelper 74 | pagehelper-spring-boot-starter 75 | 1.2.5 76 | 77 | 78 | 79 | 80 | 81 | 82 | org.springframework.boot 83 | spring-boot-maven-plugin 84 | 85 | 86 | org.mybatis.generator 87 | mybatis-generator-maven-plugin 88 | 1.3.7 89 | 90 | true 91 | src/main/resources/generator/generatorConfig.xml 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/ServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | public class ServletInitializer extends SpringBootServletInitializer { 7 | 8 | @Override 9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 10 | return application.sources(TrainApplication.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/TrainApplication.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 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.lemon.train.mapper") 9 | public class TrainApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(TrainApplication.class, args); 13 | // DocsConfig config = new DocsConfig(); 14 | // config.setProjectPath("D:\\work\\intellij\\work\\train"); // 项目根目录 15 | // config.setProjectName("ProjectName"); // 项目名称 16 | // config.setApiVersion("V1.0"); // 声明该API的版本 17 | // config.setDocsPath("D:\\work\\intellij\\work\\train\\doc"); // 生成API 文档所在目录 18 | // config.setAutoGenerate(Boolean.TRUE); // 配置自动生成 19 | // Docs.buildHtmlDocs(config); // 执行生成文档 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/common/AsyncTask.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.common; 2 | 3 | import com.lemon.train.mapper.OrdersMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.scheduling.annotation.Async; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | @Async 10 | public class AsyncTask { 11 | 12 | @Autowired 13 | OrdersMapper ordersMapper; 14 | 15 | /** 16 | * 用户登录时判断 17 | * @param id 18 | */ 19 | public void updateOrderState(Integer id){ 20 | ordersMapper.updateOrderState(id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/common/GloablExceptionHandler.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train/src/main/java/com/lemon/train/common/GloablExceptionHandler.java -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/common/ResponseResult.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.common; 2 | 3 | public class ResponseResult { 4 | 5 | private String msg; 6 | private Integer code; 7 | private T data; 8 | 9 | public ResponseResult() { 10 | } 11 | 12 | public ResponseResult(Integer code, String msg, T data) { 13 | this.data = data; 14 | this.code = code; 15 | this.msg = msg; 16 | } 17 | 18 | public String getMsg() { 19 | return msg; 20 | } 21 | 22 | public void setMsg(String msg) { 23 | this.msg = msg; 24 | } 25 | 26 | public Integer getCode() { 27 | return code; 28 | } 29 | 30 | public void setCode(Integer code) { 31 | this.code = code; 32 | } 33 | 34 | public T getData() { 35 | return data; 36 | } 37 | 38 | public void setData(T data) { 39 | this.data = data; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "ResponseResult{" + 45 | ", msg='" + msg + '\'' + 46 | ", code=" + code + 47 | ", data=" + data + 48 | '}'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/common/TimeHandle.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.common; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | @Component 10 | public class TimeHandle { 11 | 12 | public static int getDayDiffer(Date startDate, Date endDate) throws ParseException { 13 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 14 | long startDateTime = dateFormat.parse(dateFormat.format(startDate)).getTime(); 15 | long endDateTime = dateFormat.parse(dateFormat.format(endDate)).getTime(); 16 | return (int) ((endDateTime - startDateTime) / (1000 * 3600 * 24)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/config/InterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | @Configuration 8 | public class InterceptorConfig implements WebMvcConfigurer { 9 | 10 | /** 11 | * 跨域支持 12 | * 13 | * @param registry 14 | */ 15 | @Override 16 | public void addCorsMappings(CorsRegistry registry) { 17 | registry.addMapping("/**") 18 | .allowedOrigins("*") 19 | .allowCredentials(true) 20 | .allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS", "HEAD") 21 | .maxAge(3600 * 24); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.entity.Orderinfo; 6 | import com.lemon.train.entity.Orders; 7 | import com.lemon.train.service.OrderService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.text.ParseException; 12 | import java.text.SimpleDateFormat; 13 | import java.util.Date; 14 | import java.util.Map; 15 | 16 | @RestController 17 | @RequestMapping("order") 18 | public class OrderController { 19 | 20 | 21 | @Autowired 22 | OrderService orderService; 23 | 24 | /** 25 | * 订单查询 26 | * @param orders 27 | * @return 28 | */ 29 | @PostMapping("/submitorder") 30 | public ResponseResult submitOrder(@RequestBody Orders orders){ 31 | return orderService.submitOrder(orders); 32 | } 33 | 34 | 35 | 36 | /** 37 | * 查询所有订单 38 | * @param orderId 39 | * @return 40 | */ 41 | @GetMapping("/queryorders") 42 | public ResponseResult queryOrders(Integer orderId){ 43 | return orderService.queryOrders(orderId); 44 | } 45 | 46 | 47 | /** 48 | * 查询单一订单 49 | * @param id 50 | * @return 51 | */ 52 | @GetMapping("/getdetailorder") 53 | public ResponseResult getDetailOrder(Integer id){ 54 | return orderService.getDetailOrder(id); 55 | } 56 | 57 | 58 | /** 59 | * 删除订单 60 | */ 61 | @PostMapping("/delorder") 62 | public ResponseResult delOrder(Integer id){ 63 | return orderService.delOrder(id); 64 | } 65 | 66 | /** 67 | * 订单退票 68 | */ 69 | @PostMapping("/deleteorder") 70 | public ResponseResult deleteOrder(@RequestBody Orderinfo orderinfo){ 71 | return orderService.deleteOrder(orderinfo); 72 | } 73 | 74 | /** 75 | * 订单改签 76 | */ 77 | @PostMapping("/changeticket") 78 | public ResponseResult changeTicket(@RequestBody Map map) throws ParseException { 79 | int trainid = (int) map.get("trainid"); 80 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 81 | Date date = formatter.parse((String) map.get("traindate")); 82 | int orderid=(int) map.get("orderid"); 83 | return orderService.changeTicket(trainid,date,orderid); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/controller/PriceManageController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.entity.Holiday; 6 | import com.lemon.train.entity.Pricemanage; 7 | import com.lemon.train.service.PriceManageService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.text.ParseException; 12 | import java.text.SimpleDateFormat; 13 | import java.util.Date; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | 18 | @RestController 19 | @RequestMapping("price") 20 | public class PriceManageController { 21 | 22 | @Autowired 23 | PriceManageService priceManageService; 24 | 25 | /** 26 | * 查询 27 | * @return 28 | */ 29 | @GetMapping("/getdiscount") 30 | public ResponseResult getDiscount(){ 31 | return priceManageService.getDiscount(); 32 | } 33 | 34 | /** 35 | * 更新折扣 36 | */ 37 | @PostMapping("/updatediscount") 38 | public ResponseResult updateDiscount(@RequestBody Pricemanage priceManage){ 39 | System.out.println(priceManage); 40 | return priceManageService.updateDiscount(priceManage); 41 | } 42 | 43 | /** 44 | * 发布单一节假日 45 | */ 46 | @PostMapping("/postsingleholiday") 47 | public ResponseResult postSingleHoliday(@RequestBody Holiday holiday){ 48 | System.out.println(holiday); 49 | return priceManageService.postSingleHoliday(holiday); 50 | } 51 | 52 | /** 53 | * 发布一段时间的节假日 54 | */ 55 | @PostMapping("/postmultipleholiday") 56 | public ResponseResult postMultipleHoliday(@RequestBody Map map) throws ParseException { 57 | 58 | int status = Integer.parseInt((String) map.get("status")); 59 | List vacation = (List) map.get("vacation"); 60 | SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" ); 61 | Date start = sdf.parse(vacation.get(0)); 62 | Date end = sdf.parse(vacation.get(1)); 63 | return priceManageService.postMultipleHoliday(start,end,status); 64 | } 65 | 66 | 67 | /** 68 | * 当天交易额 69 | */ 70 | @GetMapping("/gettodaytotalprice") 71 | public ResponseResult getTodayTotalPrice(String orderdate) throws ParseException { 72 | SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" ); 73 | Date odate = sdf.parse(orderdate); 74 | return priceManageService.getTodayTotalPrice(odate); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/controller/TrainController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Traininfos; 5 | import com.lemon.train.service.TrainService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.text.ParseException; 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | 16 | @RestController 17 | @RequestMapping("train") 18 | public class TrainController { 19 | 20 | @Autowired 21 | TrainService trainService; 22 | 23 | /** 24 | * 车票查询 25 | * @return 26 | */ 27 | @GetMapping("/trainticketquery") 28 | public ResponseResult trainTicketQuery(String startcity, String endcity, String traindate,Integer traintype) throws ParseException { 29 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 30 | Date date = formatter.parse(traindate); 31 | return trainService.trainTicketQuery(startcity, endcity, date,traintype); 32 | } 33 | 34 | 35 | /** 36 | * 节假日价格折扣查询 37 | */ 38 | @GetMapping("/holidaydiscount") 39 | public ResponseResult holidayDiscount(String traindate) throws ParseException { 40 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 41 | Date date = formatter.parse(traindate); 42 | return trainService.holidayDiscount(date); 43 | } 44 | 45 | 46 | 47 | 48 | 49 | 50 | /** 51 | * 管理员端 52 | * 火车新增 53 | */ 54 | @PostMapping("addtrain") 55 | public ResponseResult addTrain(@RequestBody Traininfos traininfos){ 56 | return trainService.addTrain(traininfos); 57 | } 58 | 59 | /** 60 | * 管理员火车信息查询 61 | */ 62 | @GetMapping("/querytrains") 63 | public ResponseResult queryTrains(){ 64 | return trainService.queryTrains(); 65 | 66 | } 67 | 68 | 69 | /** 70 | * 管理员单个火车发布或者全部发布 71 | */ 72 | @PostMapping("/departtrains") 73 | public ResponseResult departTrains(Integer id, String traindate) throws ParseException { 74 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 75 | Date date = formatter.parse(traindate); 76 | return trainService.departTrain(id,date); 77 | } 78 | 79 | /** 80 | * 管理多个火车表的发布 81 | */ 82 | @PostMapping("/departtrainsselective") 83 | public ResponseResult departTrainsSelective(@RequestBody Map map) throws ParseException { 84 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 85 | Date date = formatter.parse((String) map.get("traindate")); 86 | return trainService.departTrainsSelective((List)map.get("idlist"),date); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.entity.User; 6 | import com.lemon.train.service.UserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Qualifier; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | @RequestMapping("user") 12 | @RestController 13 | public class UserController { 14 | 15 | @Qualifier("user") 16 | @Autowired 17 | UserService userService; 18 | 19 | @PostMapping("/login") 20 | public ResponseResult userLogin(String username, String password){ 21 | return userService.userLogin(username,password); 22 | } 23 | 24 | @PostMapping("/register") 25 | public ResponseResult userRegister(@RequestBody User user){ 26 | return userService.userRegister(user); 27 | } 28 | 29 | @GetMapping("/querypassenger") 30 | public ResponseResult queryPassenger(String id){ 31 | return userService.queryPassenger(id); 32 | } 33 | 34 | 35 | /** 36 | * 管理员登录 37 | */ 38 | @PostMapping("/adminlogin") 39 | public ResponseResult adminLogin(String username,String password){ 40 | return userService.adminLogin(username,password); 41 | } 42 | 43 | /** 44 | * 管理员端 45 | * 根据条件查询 46 | */ 47 | @GetMapping("/queryalluser") 48 | public ResponseResult queryAllUser(Integer pagenum,String condition, Integer pagesize){ 49 | return userService.queryAllUser(pagenum,condition,pagesize); 50 | } 51 | 52 | /** 53 | * 用户的表更新 54 | */ 55 | @PutMapping("/putuser") 56 | public ResponseResult putUser(@RequestBody User user){ 57 | return userService.putUser(user); 58 | } 59 | 60 | /** 61 | * 根据真实姓名模糊查询 62 | */ 63 | @GetMapping("/vagueusers") 64 | public ResponseResult vagueUsers(String realname){ 65 | return userService.vagueUsers(realname); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Holiday.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class Holiday { 8 | 9 | 10 | private Date vacation; 11 | 12 | private Integer status; 13 | @JsonFormat(pattern = "yyyy-MM-dd") 14 | public Date getVacation() { 15 | return vacation; 16 | } 17 | 18 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 19 | public void setVacation(Date vacation) { 20 | this.vacation = vacation; 21 | } 22 | 23 | public Integer getStatus() { 24 | return status; 25 | } 26 | 27 | public void setStatus(Integer status) { 28 | this.status = status; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | StringBuilder sb = new StringBuilder(); 34 | sb.append(getClass().getSimpleName()); 35 | sb.append(" ["); 36 | sb.append("Hash = ").append(hashCode()); 37 | sb.append(", vacation=").append(vacation); 38 | sb.append(", status=").append(status); 39 | sb.append("]"); 40 | return sb.toString(); 41 | } 42 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Orders.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import org.springframework.format.annotation.DateTimeFormat; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.Date; 8 | 9 | public class Orders { 10 | private Integer id; 11 | 12 | private Integer status; 13 | 14 | private BigDecimal price; 15 | 16 | private Date traindate; 17 | 18 | private Date createtime; 19 | 20 | private Integer userId; 21 | 22 | private Integer trainId; 23 | 24 | private Integer seattype; 25 | 26 | private Integer carriage; 27 | 28 | private String seat; 29 | 30 | private Integer orderId; 31 | 32 | public Integer getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Integer id) { 37 | this.id = id; 38 | } 39 | 40 | public Integer getStatus() { 41 | return status; 42 | } 43 | 44 | public void setStatus(Integer status) { 45 | this.status = status; 46 | } 47 | 48 | public BigDecimal getPrice() { 49 | return price; 50 | } 51 | 52 | public void setPrice(BigDecimal price) { 53 | this.price = price; 54 | } 55 | 56 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 57 | public Date getTraindate() { 58 | return traindate; 59 | } 60 | 61 | @DateTimeFormat(pattern = "yyyy-MM-dd") 62 | public void setTraindate(Date traindate) { 63 | this.traindate = traindate; 64 | } 65 | 66 | public Date getCreatetime() { 67 | return createtime; 68 | } 69 | 70 | public void setCreatetime(Date createtime) { 71 | this.createtime = createtime; 72 | } 73 | 74 | public Integer getUserId() { 75 | return userId; 76 | } 77 | 78 | public void setUserId(Integer userId) { 79 | this.userId = userId; 80 | } 81 | 82 | public Integer getTrainId() { 83 | return trainId; 84 | } 85 | 86 | public void setTrainId(Integer trainId) { 87 | this.trainId = trainId; 88 | } 89 | 90 | public Integer getSeattype() { 91 | return seattype; 92 | } 93 | 94 | public void setSeattype(Integer seattype) { 95 | this.seattype = seattype; 96 | } 97 | 98 | public Integer getCarriage() { 99 | return carriage; 100 | } 101 | 102 | public void setCarriage(Integer carriage) { 103 | this.carriage = carriage; 104 | } 105 | 106 | public String getSeat() { 107 | return seat; 108 | } 109 | 110 | public void setSeat(String seat) { 111 | this.seat = seat == null ? null : seat.trim(); 112 | } 113 | 114 | public Integer getOrderId() { 115 | return orderId; 116 | } 117 | 118 | public void setOrderId(Integer orderId) { 119 | this.orderId = orderId; 120 | } 121 | 122 | @Override 123 | public String toString() { 124 | StringBuilder sb = new StringBuilder(); 125 | sb.append(getClass().getSimpleName()); 126 | sb.append(" ["); 127 | sb.append("Hash = ").append(hashCode()); 128 | sb.append(", id=").append(id); 129 | sb.append(", status=").append(status); 130 | sb.append(", price=").append(price); 131 | sb.append(", traindate=").append(traindate); 132 | sb.append(", createtime=").append(createtime); 133 | sb.append(", userId=").append(userId); 134 | sb.append(", trainId=").append(trainId); 135 | sb.append(", seattype=").append(seattype); 136 | sb.append(", carriage=").append(carriage); 137 | sb.append(", seat=").append(seat); 138 | sb.append(", orderId=").append(orderId); 139 | sb.append("]"); 140 | return sb.toString(); 141 | } 142 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Orderseat.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import java.util.Date; 4 | 5 | public class Orderseat { 6 | private Integer id; 7 | 8 | private Integer status; 9 | 10 | private Date orderdate; 11 | 12 | private Integer trainId; 13 | 14 | private Integer seatId; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public Integer getStatus() { 25 | return status; 26 | } 27 | 28 | public void setStatus(Integer status) { 29 | this.status = status; 30 | } 31 | 32 | public Date getOrderdate() { 33 | return orderdate; 34 | } 35 | 36 | public void setOrderdate(Date orderdate) { 37 | this.orderdate = orderdate; 38 | } 39 | 40 | public Integer getTrainId() { 41 | return trainId; 42 | } 43 | 44 | public void setTrainId(Integer trainId) { 45 | this.trainId = trainId; 46 | } 47 | 48 | public Integer getSeatId() { 49 | return seatId; 50 | } 51 | 52 | public void setSeatId(Integer seatId) { 53 | this.seatId = seatId; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | StringBuilder sb = new StringBuilder(); 59 | sb.append(getClass().getSimpleName()); 60 | sb.append(" ["); 61 | sb.append("Hash = ").append(hashCode()); 62 | sb.append(", id=").append(id); 63 | sb.append(", status=").append(status); 64 | sb.append(", orderdate=").append(orderdate); 65 | sb.append(", trainId=").append(trainId); 66 | sb.append(", seatId=").append(seatId); 67 | sb.append("]"); 68 | return sb.toString(); 69 | } 70 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Passenger.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Passenger { 7 | private Integer id; 8 | 9 | private String name; 10 | 11 | private String idcard; 12 | 13 | private Integer type; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Pricemanage.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Pricemanage { 4 | private Integer id; 5 | 6 | private Double returnprice; 7 | 8 | private Double discount1; 9 | 10 | private Double discount2; 11 | 12 | private Double discount3; 13 | 14 | public Integer getId() { 15 | return id; 16 | } 17 | 18 | public void setId(Integer id) { 19 | this.id = id; 20 | } 21 | 22 | public Double getReturnprice() { 23 | return returnprice; 24 | } 25 | 26 | public void setReturnprice(Double returnprice) { 27 | this.returnprice = returnprice; 28 | } 29 | 30 | public Double getDiscount1() { 31 | return discount1; 32 | } 33 | 34 | public void setDiscount1(Double discount1) { 35 | this.discount1 = discount1; 36 | } 37 | 38 | public Double getDiscount2() { 39 | return discount2; 40 | } 41 | 42 | public void setDiscount2(Double discount2) { 43 | this.discount2 = discount2; 44 | } 45 | 46 | public Double getDiscount3() { 47 | return discount3; 48 | } 49 | 50 | public void setDiscount3(Double discount3) { 51 | this.discount3 = discount3; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | StringBuilder sb = new StringBuilder(); 57 | sb.append(getClass().getSimpleName()); 58 | sb.append(" ["); 59 | sb.append("Hash = ").append(hashCode()); 60 | sb.append(", id=").append(id); 61 | sb.append(", returnprice=").append(returnprice); 62 | sb.append(", discount1=").append(discount1); 63 | sb.append(", discount2=").append(discount2); 64 | sb.append(", discount3=").append(discount3); 65 | sb.append("]"); 66 | return sb.toString(); 67 | } 68 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Seatinfo.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import java.util.Date; 4 | 5 | public class Seatinfo { 6 | private Integer id; 7 | 8 | private String name; 9 | 10 | private Integer traintype; 11 | 12 | private Integer carriage; 13 | 14 | private Integer seattype; 15 | 16 | private String seat; 17 | 18 | public Seatinfo(Integer id, Integer carriage, Integer seattype, String seat, Date orderdate) { 19 | this.id= id; 20 | this.carriage = carriage; 21 | this.seattype = seattype; 22 | this.seat = seat; 23 | this.orderdate = orderdate; 24 | } 25 | 26 | private Integer status; 27 | 28 | private Date orderdate; 29 | 30 | private Integer orderseatid; 31 | 32 | public Integer getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Integer id) { 37 | this.id = id; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name == null ? null : name.trim(); 46 | } 47 | 48 | public Integer getTraintype() { 49 | return traintype; 50 | } 51 | 52 | public void setTraintype(Integer traintype) { 53 | this.traintype = traintype; 54 | } 55 | 56 | public Integer getCarriage() { 57 | return carriage; 58 | } 59 | 60 | public void setCarriage(Integer carriage) { 61 | this.carriage = carriage; 62 | } 63 | 64 | public Integer getSeattype() { 65 | return seattype; 66 | } 67 | 68 | public void setSeattype(Integer seattype) { 69 | this.seattype = seattype; 70 | } 71 | 72 | public String getSeat() { 73 | return seat; 74 | } 75 | 76 | public void setSeat(String seat) { 77 | this.seat = seat == null ? null : seat.trim(); 78 | } 79 | 80 | public Integer getStatus() { 81 | return status; 82 | } 83 | 84 | public void setStatus(Integer status) { 85 | this.status = status; 86 | } 87 | 88 | public Date getOrderdate() { 89 | return orderdate; 90 | } 91 | 92 | public void setOrderdate(Date orderdate) { 93 | this.orderdate = orderdate; 94 | } 95 | 96 | public Integer getOrderseatid() { 97 | return orderseatid; 98 | } 99 | 100 | public void setOrderseatid(Integer orderseatid) { 101 | this.orderseatid = orderseatid; 102 | } 103 | 104 | @Override 105 | public String toString() { 106 | StringBuilder sb = new StringBuilder(); 107 | sb.append(getClass().getSimpleName()); 108 | sb.append(" ["); 109 | sb.append("Hash = ").append(hashCode()); 110 | sb.append(", id=").append(id); 111 | sb.append(", name=").append(name); 112 | sb.append(", traintype=").append(traintype); 113 | sb.append(", carriage=").append(carriage); 114 | sb.append(", seattype=").append(seattype); 115 | sb.append(", seat=").append(seat); 116 | sb.append(", status=").append(status); 117 | sb.append(", orderdate=").append(orderdate); 118 | sb.append(", orderseatid=").append(orderseatid); 119 | sb.append("]"); 120 | return sb.toString(); 121 | } 122 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Train.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Train { 4 | private Integer id; 5 | 6 | private String name; 7 | 8 | private Integer type; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name == null ? null : name.trim(); 24 | } 25 | 26 | public Integer getType() { 27 | return type; 28 | } 29 | 30 | public void setType(Integer type) { 31 | this.type = type; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | StringBuilder sb = new StringBuilder(); 37 | sb.append(getClass().getSimpleName()); 38 | sb.append(" ["); 39 | sb.append("Hash = ").append(hashCode()); 40 | sb.append(", id=").append(id); 41 | sb.append(", name=").append(name); 42 | sb.append(", type=").append(type); 43 | sb.append("]"); 44 | return sb.toString(); 45 | } 46 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Traininfo.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.math.BigDecimal; 6 | import java.util.Date; 7 | 8 | public class Traininfo { 9 | private Integer id; 10 | 11 | private String startcity; 12 | 13 | private Date starttime; 14 | 15 | private String endcity; 16 | 17 | private Date endtime; 18 | 19 | private BigDecimal fprice; 20 | 21 | private BigDecimal sprice; 22 | 23 | private Integer fnum; 24 | 25 | private Integer snum; 26 | 27 | private Integer trainId; 28 | 29 | private String duration; 30 | 31 | public Integer getId() { 32 | return id; 33 | } 34 | 35 | public void setId(Integer id) { 36 | this.id = id; 37 | } 38 | 39 | public String getStartcity() { 40 | return startcity; 41 | } 42 | 43 | public void setStartcity(String startcity) { 44 | this.startcity = startcity == null ? null : startcity.trim(); 45 | } 46 | 47 | @JsonFormat(pattern = "HH:mm:ss",timezone="GMT+8") 48 | public Date getStarttime() { 49 | return starttime; 50 | } 51 | 52 | public void setStarttime(Date starttime) { 53 | this.starttime = starttime; 54 | } 55 | 56 | public String getEndcity() { 57 | return endcity; 58 | } 59 | 60 | public void setEndcity(String endcity) { 61 | this.endcity = endcity == null ? null : endcity.trim(); 62 | } 63 | 64 | @JsonFormat(pattern = "HH:mm:ss",timezone="GMT+8") 65 | public Date getEndtime() { 66 | return endtime; 67 | } 68 | 69 | public void setEndtime(Date endtime) { 70 | this.endtime = endtime; 71 | } 72 | 73 | public BigDecimal getFprice() { 74 | return fprice; 75 | } 76 | 77 | public void setFprice(BigDecimal fprice) { 78 | this.fprice = fprice; 79 | } 80 | 81 | public BigDecimal getSprice() { 82 | return sprice; 83 | } 84 | 85 | public void setSprice(BigDecimal sprice) { 86 | this.sprice = sprice; 87 | } 88 | 89 | public Integer getFnum() { 90 | return fnum; 91 | } 92 | 93 | public void setFnum(Integer fnum) { 94 | this.fnum = fnum; 95 | } 96 | 97 | public Integer getSnum() { 98 | return snum; 99 | } 100 | 101 | public void setSnum(Integer snum) { 102 | this.snum = snum; 103 | } 104 | 105 | public Integer getTrainId() { 106 | return trainId; 107 | } 108 | 109 | public void setTrainId(Integer trainId) { 110 | this.trainId = trainId; 111 | } 112 | 113 | public String getDuration() { 114 | return duration; 115 | } 116 | 117 | public void setDuration(String duration) { 118 | this.duration = duration == null ? null : duration.trim(); 119 | } 120 | 121 | @Override 122 | public String toString() { 123 | StringBuilder sb = new StringBuilder(); 124 | sb.append(getClass().getSimpleName()); 125 | sb.append(" ["); 126 | sb.append("Hash = ").append(hashCode()); 127 | sb.append(", id=").append(id); 128 | sb.append(", startcity=").append(startcity); 129 | sb.append(", starttime=").append(starttime); 130 | sb.append(", endcity=").append(endcity); 131 | sb.append(", endtime=").append(endtime); 132 | sb.append(", fprice=").append(fprice); 133 | sb.append(", sprice=").append(sprice); 134 | sb.append(", fnum=").append(fnum); 135 | sb.append(", snum=").append(snum); 136 | sb.append(", trainId=").append(trainId); 137 | sb.append(", duration=").append(duration); 138 | sb.append("]"); 139 | return sb.toString(); 140 | } 141 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Trainseat.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Trainseat { 4 | private Integer id; 5 | 6 | private Integer carriage; 7 | 8 | private Integer type; 9 | 10 | private String seat; 11 | 12 | private Integer trainId; 13 | 14 | public Integer getId() { 15 | return id; 16 | } 17 | 18 | public void setId(Integer id) { 19 | this.id = id; 20 | } 21 | 22 | public Integer getCarriage() { 23 | return carriage; 24 | } 25 | 26 | public void setCarriage(Integer carriage) { 27 | this.carriage = carriage; 28 | } 29 | 30 | public Integer getType() { 31 | return type; 32 | } 33 | 34 | public void setType(Integer type) { 35 | this.type = type; 36 | } 37 | 38 | public String getSeat() { 39 | return seat; 40 | } 41 | 42 | public void setSeat(String seat) { 43 | this.seat = seat == null ? null : seat.trim(); 44 | } 45 | 46 | public Integer getTrainId() { 47 | return trainId; 48 | } 49 | 50 | public void setTrainId(Integer trainId) { 51 | this.trainId = trainId; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | StringBuilder sb = new StringBuilder(); 57 | sb.append(getClass().getSimpleName()); 58 | sb.append(" ["); 59 | sb.append("Hash = ").append(hashCode()); 60 | sb.append(", id=").append(id); 61 | sb.append(", carriage=").append(carriage); 62 | sb.append(", type=").append(type); 63 | sb.append(", seat=").append(seat); 64 | sb.append(", trainId=").append(trainId); 65 | sb.append("]"); 66 | return sb.toString(); 67 | } 68 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Trainstate.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Trainstate { 4 | private Integer id; 5 | 6 | private Integer status; 7 | 8 | private Integer trainId; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public Integer getStatus() { 19 | return status; 20 | } 21 | 22 | public void setStatus(Integer status) { 23 | this.status = status; 24 | } 25 | 26 | public Integer getTrainId() { 27 | return trainId; 28 | } 29 | 30 | public void setTrainId(Integer trainId) { 31 | this.trainId = trainId; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | StringBuilder sb = new StringBuilder(); 37 | sb.append(getClass().getSimpleName()); 38 | sb.append(" ["); 39 | sb.append("Hash = ").append(hashCode()); 40 | sb.append(", id=").append(id); 41 | sb.append(", status=").append(status); 42 | sb.append(", trainId=").append(trainId); 43 | sb.append("]"); 44 | return sb.toString(); 45 | } 46 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/Trainticket.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import java.util.Date; 4 | 5 | public class Trainticket { 6 | private Integer id; 7 | 8 | private Integer fnum; 9 | 10 | public Trainticket(Integer fnum, Integer snum, Date ticketdate, Integer trainId) { 11 | this.fnum = fnum; 12 | this.snum = snum; 13 | this.ticketdate = ticketdate; 14 | this.trainId = trainId; 15 | } 16 | 17 | private Integer snum; 18 | 19 | private Date ticketdate; 20 | 21 | private Integer trainId; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public Integer getFnum() { 32 | return fnum; 33 | } 34 | 35 | public void setFnum(Integer fnum) { 36 | this.fnum = fnum; 37 | } 38 | 39 | public Integer getSnum() { 40 | return snum; 41 | } 42 | 43 | public void setSnum(Integer snum) { 44 | this.snum = snum; 45 | } 46 | 47 | public Date getTicketdate() { 48 | return ticketdate; 49 | } 50 | 51 | public void setTicketdate(Date ticketdate) { 52 | this.ticketdate = ticketdate; 53 | } 54 | 55 | public Integer getTrainId() { 56 | return trainId; 57 | } 58 | 59 | public void setTrainId(Integer trainId) { 60 | this.trainId = trainId; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | StringBuilder sb = new StringBuilder(); 66 | sb.append(getClass().getSimpleName()); 67 | sb.append(" ["); 68 | sb.append("Hash = ").append(hashCode()); 69 | sb.append(", id=").append(id); 70 | sb.append(", fnum=").append(fnum); 71 | sb.append(", snum=").append(snum); 72 | sb.append(", ticketdate=").append(ticketdate); 73 | sb.append(", trainId=").append(trainId); 74 | sb.append("]"); 75 | return sb.toString(); 76 | } 77 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnore; 5 | 6 | import java.util.Date; 7 | 8 | public class User { 9 | private Integer id; 10 | 11 | private String username; 12 | 13 | private String realname; 14 | 15 | @JsonIgnore 16 | private String password; 17 | 18 | private Integer status; 19 | 20 | private String idcard; 21 | 22 | private String phone; 23 | 24 | private Integer type; 25 | 26 | private String country; 27 | 28 | private Date createdate; 29 | 30 | public Integer getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Integer id) { 35 | this.id = id; 36 | } 37 | 38 | public String getUsername() { 39 | return username; 40 | } 41 | 42 | public void setUsername(String username) { 43 | this.username = username == null ? null : username.trim(); 44 | } 45 | 46 | public String getRealname() { 47 | return realname; 48 | } 49 | 50 | public void setRealname(String realname) { 51 | this.realname = realname == null ? null : realname.trim(); 52 | } 53 | 54 | public String getPassword() { 55 | return password; 56 | } 57 | 58 | public void setPassword(String password) { 59 | this.password = password == null ? null : password.trim(); 60 | } 61 | 62 | public Integer getStatus() { 63 | return status; 64 | } 65 | 66 | public void setStatus(Integer status) { 67 | this.status = status; 68 | } 69 | 70 | public String getIdcard() { 71 | return idcard; 72 | } 73 | 74 | public void setIdcard(String idcard) { 75 | this.idcard = idcard == null ? null : idcard.trim(); 76 | } 77 | 78 | public String getPhone() { 79 | return phone; 80 | } 81 | 82 | public void setPhone(String phone) { 83 | this.phone = phone == null ? null : phone.trim(); 84 | } 85 | 86 | public Integer getType() { 87 | return type; 88 | } 89 | 90 | public void setType(Integer type) { 91 | this.type = type; 92 | } 93 | 94 | public String getCountry() { 95 | return country; 96 | } 97 | 98 | public void setCountry(String country) { 99 | this.country = country == null ? null : country.trim(); 100 | } 101 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 102 | public Date getCreatedate() { 103 | return createdate; 104 | } 105 | 106 | public void setCreatedate(Date createdate) { 107 | this.createdate = createdate; 108 | } 109 | 110 | @Override 111 | public String toString() { 112 | StringBuilder sb = new StringBuilder(); 113 | sb.append(getClass().getSimpleName()); 114 | sb.append(" ["); 115 | sb.append("Hash = ").append(hashCode()); 116 | sb.append(", id=").append(id); 117 | sb.append(", username=").append(username); 118 | sb.append(", realname=").append(realname); 119 | sb.append(", password=").append(password); 120 | sb.append(", status=").append(status); 121 | sb.append(", idcard=").append(idcard); 122 | sb.append(", phone=").append(phone); 123 | sb.append(", type=").append(type); 124 | sb.append(", country=").append(country); 125 | sb.append(", createdate=").append(createdate); 126 | sb.append("]"); 127 | return sb.toString(); 128 | } 129 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/HolidayMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Holiday; 4 | import com.lemon.train.entity.HolidayExample; 5 | import com.lemon.train.entity.Pricemanage; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public interface HolidayMapper { 14 | long countByExample(HolidayExample example); 15 | 16 | int deleteByExample(HolidayExample example); 17 | 18 | int deleteByPrimaryKey(Date vacation); 19 | 20 | int insert(Holiday record); 21 | 22 | int insertSelective(Holiday record); 23 | 24 | List selectByExample(HolidayExample example); 25 | 26 | Holiday selectByPrimaryKey(Date vacation); 27 | 28 | int updateByExampleSelective(@Param("record") Holiday record, @Param("example") HolidayExample example); 29 | 30 | int updateByExample(@Param("record") Holiday record, @Param("example") HolidayExample example); 31 | 32 | int updateByPrimaryKeySelective(Holiday record); 33 | 34 | int updateByPrimaryKey(Holiday record); 35 | 36 | // 通过状态获得 37 | double getSpecialDiscount(Map map); 38 | 39 | //更新折扣表 40 | int updateDiscountById(Pricemanage priceManage); 41 | 42 | @Select("select * from pricemanage where id=1 limit 1") 43 | Pricemanage getDiscount(); 44 | 45 | //获得当天交易额 46 | void getToalPrice(Map map); 47 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/OrderinfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Orderinfo; 4 | import com.lemon.train.entity.OrderinfoExample; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | public interface OrderinfoMapper { 11 | long countByExample(OrderinfoExample example); 12 | 13 | int deleteByExample(OrderinfoExample example); 14 | 15 | int insert(Orderinfo record); 16 | 17 | int insertSelective(Orderinfo record); 18 | 19 | List selectByExample(OrderinfoExample example); 20 | 21 | int updateByExampleSelective(@Param("record") Orderinfo record, @Param("example") OrderinfoExample example); 22 | 23 | int updateByExample(@Param("record") Orderinfo record, @Param("example") OrderinfoExample example); 24 | 25 | @Select("select * from orderinfo where id=#{id}") 26 | Orderinfo selectDetailOrder(Integer id); 27 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/OrdersMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Orders; 4 | import com.lemon.train.entity.OrdersExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | public interface OrdersMapper { 11 | long countByExample(OrdersExample example); 12 | 13 | int deleteByExample(OrdersExample example); 14 | 15 | int deleteByPrimaryKey(Integer id); 16 | 17 | int insert(Orders record); 18 | 19 | int insertSelective(Orders record); 20 | 21 | List selectByExample(OrdersExample example); 22 | 23 | Orders selectByPrimaryKey(Integer id); 24 | 25 | int updateByExampleSelective(@Param("record") Orders record, @Param("example") OrdersExample example); 26 | 27 | int updateByExample(@Param("record") Orders record, @Param("example") OrdersExample example); 28 | 29 | int updateByPrimaryKeySelective(Orders record); 30 | 31 | int updateByPrimaryKey(Orders record); 32 | 33 | 34 | /** 35 | * 修改火车的票数,后期可以集成到redis 36 | */ 37 | int decreaseTrainNum(Integer trainId, Date traindate,Integer type); 38 | 39 | int increaseTrainNum(Integer trainId, Date traindate,Integer type); 40 | 41 | int updateOrderState(Integer id); 42 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/OrderseatMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | 4 | import com.lemon.train.entity.Orderseat; 5 | import com.lemon.train.entity.OrderseatExample; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | public interface OrderseatMapper { 12 | long countByExample(OrderseatExample example); 13 | 14 | int deleteByExample(OrderseatExample example); 15 | 16 | int deleteByPrimaryKey(Integer id); 17 | 18 | int insert(Orderseat record); 19 | 20 | int insertSelective(Orderseat record); 21 | 22 | List selectByExample(OrderseatExample example); 23 | 24 | Orderseat selectByPrimaryKey(Integer id); 25 | 26 | int updateByExampleSelective(@Param("record") Orderseat record, @Param("example") OrderseatExample example); 27 | 28 | int updateByExample(@Param("record") Orderseat record, @Param("example") OrderseatExample example); 29 | 30 | int updateByPrimaryKeySelective(Orderseat record); 31 | 32 | int updateByPrimaryKey(Orderseat record); 33 | 34 | /** 35 | * 返回座位主键 36 | */ 37 | Orderseat selectSeatPrimaryKey(Date orderdate, Integer trainid,Integer type); 38 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/SeatinfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Seatinfo; 4 | import com.lemon.train.entity.SeatinfoExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface SeatinfoMapper { 10 | long countByExample(SeatinfoExample example); 11 | 12 | int deleteByExample(SeatinfoExample example); 13 | 14 | int insert(Seatinfo record); 15 | 16 | int insertSelective(Seatinfo record); 17 | 18 | List selectByExample(SeatinfoExample example); 19 | 20 | int updateByExampleSelective(@Param("record") Seatinfo record, @Param("example") SeatinfoExample example); 21 | 22 | int updateByExample(@Param("record") Seatinfo record, @Param("example") SeatinfoExample example); 23 | 24 | int selectBySelective(Seatinfo seatinfo); 25 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/TrainMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Train; 4 | import com.lemon.train.entity.TrainExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface TrainMapper { 9 | long countByExample(TrainExample example); 10 | 11 | int deleteByExample(TrainExample example); 12 | 13 | int deleteByPrimaryKey(Integer id); 14 | 15 | int insert(Train record); 16 | 17 | int insertSelective(Train record); 18 | 19 | List selectByExample(TrainExample example); 20 | 21 | Train selectByPrimaryKey(Integer id); 22 | 23 | int updateByExampleSelective(@Param("record") Train record, @Param("example") TrainExample example); 24 | 25 | int updateByExample(@Param("record") Train record, @Param("example") TrainExample example); 26 | 27 | int updateByPrimaryKeySelective(Train record); 28 | 29 | int updateByPrimaryKey(Train record); 30 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/TraininfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Traininfo; 4 | import com.lemon.train.entity.TraininfoExample; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | public interface TraininfoMapper { 12 | long countByExample(TraininfoExample example); 13 | 14 | int deleteByExample(TraininfoExample example); 15 | 16 | int deleteByPrimaryKey(Integer id); 17 | 18 | int insert(Traininfo record); 19 | 20 | int insertSelective(Traininfo record); 21 | 22 | List selectByExample(TraininfoExample example); 23 | 24 | Traininfo selectByPrimaryKey(Integer id); 25 | 26 | int updateByExampleSelective(@Param("record") Traininfo record, @Param("example") TraininfoExample example); 27 | 28 | int updateByExample(@Param("record") Traininfo record, @Param("example") TraininfoExample example); 29 | 30 | int updateByPrimaryKeySelective(Traininfo record); 31 | 32 | int updateByPrimaryKey(Traininfo record); 33 | 34 | List selectTrainInfo(); 35 | 36 | 37 | @Select("select fnum,snum from traininfo where train_id=#{id}") 38 | Traininfo selectSingleTrainInfo(Integer id); 39 | 40 | List selectTrainInfoByIdlist(List idlist); 41 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/TraininfosMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Traininfos; 4 | import com.lemon.train.entity.TraininfosExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TraininfosMapper { 10 | long countByExample(TraininfosExample example); 11 | 12 | int deleteByExample(TraininfosExample example); 13 | 14 | int insert(Traininfos record); 15 | 16 | int insertSelective(Traininfos record); 17 | 18 | List selectByExample(TraininfosExample example); 19 | 20 | int updateByExampleSelective(@Param("record") Traininfos record, @Param("example") TraininfosExample example); 21 | 22 | int updateByExample(@Param("record") Traininfos record, @Param("example") TraininfosExample example); 23 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/TrainseatMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Trainseat; 4 | import com.lemon.train.entity.TrainseatExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TrainseatMapper { 10 | long countByExample(TrainseatExample example); 11 | 12 | int deleteByExample(TrainseatExample example); 13 | 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | int insert(Trainseat record); 17 | 18 | int insertSelective(Trainseat record); 19 | 20 | List selectByExample(TrainseatExample example); 21 | 22 | Trainseat selectByPrimaryKey(Integer id); 23 | 24 | int updateByExampleSelective(@Param("record") Trainseat record, @Param("example") TrainseatExample example); 25 | 26 | int updateByExample(@Param("record") Trainseat record, @Param("example") TrainseatExample example); 27 | 28 | int updateByPrimaryKeySelective(Trainseat record); 29 | 30 | int updateByPrimaryKey(Trainseat record); 31 | 32 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/TrainstateMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Trainstate; 4 | import com.lemon.train.entity.TrainstateExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TrainstateMapper { 10 | long countByExample(TrainstateExample example); 11 | 12 | int deleteByExample(TrainstateExample example); 13 | 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | int insert(Trainstate record); 17 | 18 | int insertSelective(Trainstate record); 19 | 20 | List selectByExample(TrainstateExample example); 21 | 22 | Trainstate selectByPrimaryKey(Integer id); 23 | 24 | int updateByExampleSelective(@Param("record") Trainstate record, @Param("example") TrainstateExample example); 25 | 26 | int updateByExample(@Param("record") Trainstate record, @Param("example") TrainstateExample example); 27 | 28 | int updateByPrimaryKeySelective(Trainstate record); 29 | 30 | int updateByPrimaryKey(Trainstate record); 31 | 32 | 33 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/TrainticketMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Trainticket; 4 | import com.lemon.train.entity.TrainticketExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | public interface TrainticketMapper { 11 | long countByExample(TrainticketExample example); 12 | 13 | int deleteByExample(TrainticketExample example); 14 | 15 | int deleteByPrimaryKey(Integer id); 16 | 17 | int insert(Trainticket record); 18 | 19 | int insertSelective(Trainticket record); 20 | 21 | List selectByExample(TrainticketExample example); 22 | 23 | Trainticket selectByPrimaryKey(Integer id); 24 | 25 | int updateByExampleSelective(@Param("record") Trainticket record, @Param("example") TrainticketExample example); 26 | 27 | int updateByExample(@Param("record") Trainticket record, @Param("example") TrainticketExample example); 28 | 29 | int updateByPrimaryKeySelective(Trainticket record); 30 | 31 | int updateByPrimaryKey(Trainticket record); 32 | 33 | int insertDepartTrain(@Param("id") Integer id, @Param("traindate") Date traindate); 34 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Passenger; 4 | import com.lemon.train.entity.User; 5 | import com.lemon.train.entity.UserExample; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Result; 8 | import org.apache.ibatis.annotations.Results; 9 | import org.apache.ibatis.annotations.Select; 10 | 11 | import java.util.List; 12 | 13 | public interface UserMapper { 14 | long countByExample(UserExample example); 15 | 16 | int deleteByExample(UserExample example); 17 | 18 | int deleteByPrimaryKey(Integer id); 19 | 20 | int insert(User record); 21 | 22 | int insertSelective(User record); 23 | 24 | List selectByExample(UserExample example); 25 | 26 | User selectByPrimaryKey(Integer id); 27 | 28 | int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); 29 | 30 | int updateByExample(@Param("record") User record, @Param("example") UserExample example); 31 | 32 | int updateByPrimaryKeySelective(User record); 33 | 34 | int updateByPrimaryKey(User record); 35 | 36 | 37 | 38 | @Select("select * from user where username=#{username}") 39 | User queryByUsername(String username); 40 | 41 | @Select("select user_id,name,type,idcard from passenger where userrelation_id=#{userid}") 42 | @Results({ 43 | @Result(property = "id",column = "user_id") 44 | }) 45 | List queryPassenger(String userid); 46 | 47 | 48 | @Select("select * from user where status=#{condition}") 49 | List selectByCondition(String condition); 50 | 51 | @Select("select * from user where status<>#{condition}") 52 | List selectByCondition1(String condition); 53 | 54 | @Select("select * from user where idcard=#{idcard} limit 1") 55 | User selectUserByOtherCondition(String idcard); 56 | /** 57 | * 管理员登录 58 | * @param username 59 | * @return 60 | */ 61 | @Select("select password from admin where username=#{username} limit 1") 62 | String selectAdminPassword(String username); 63 | } -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Orderinfo; 5 | import com.lemon.train.entity.Orders; 6 | 7 | import java.util.Date; 8 | 9 | public interface OrderService { 10 | ResponseResult submitOrder(Orders orders); 11 | 12 | ResponseResult queryOrders(Integer orderId); 13 | 14 | ResponseResult getDetailOrder(Integer id); 15 | 16 | ResponseResult deleteOrder(Orderinfo orderinfo); 17 | 18 | ResponseResult delOrder(Integer id); 19 | 20 | ResponseResult changeTicket(int trainid, Date date, int orderid); 21 | } 22 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/service/PriceManageService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Holiday; 5 | import com.lemon.train.entity.Pricemanage; 6 | 7 | import java.text.ParseException; 8 | import java.util.Date; 9 | 10 | public interface PriceManageService { 11 | 12 | ResponseResult getDiscount(); 13 | 14 | ResponseResult updateDiscount(Pricemanage priceManage); 15 | 16 | ResponseResult postSingleHoliday(Holiday holiday); 17 | 18 | ResponseResult postMultipleHoliday(Date start, Date end, int status) throws ParseException; 19 | 20 | ResponseResult getTodayTotalPrice(Date odate); 21 | } 22 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/service/TrainService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Traininfos; 5 | 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | 10 | public interface TrainService { 11 | ResponseResult trainTicketQuery(String startcity, String endcity, Date traindate,Integer traintype); 12 | 13 | ResponseResult addTrain(Traininfos traininfos); 14 | 15 | ResponseResult queryTrains(); 16 | 17 | ResponseResult departTrain(Integer id,Date traindate); 18 | 19 | ResponseResult departTrainsSelective(List idlist, Date traindate); 20 | 21 | ResponseResult holidayDiscount(Date date); 22 | } 23 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.User; 5 | 6 | public interface UserService { 7 | 8 | ResponseResult userLogin(String username, String password); 9 | 10 | ResponseResult userRegister(User user); 11 | 12 | ResponseResult queryPassenger(String id); 13 | 14 | ResponseResult queryAllUser(Integer pagenum,String condition, Integer pagesize); 15 | 16 | ResponseResult putUser(User user); 17 | 18 | ResponseResult vagueUsers(String realname); 19 | 20 | ResponseResult adminLogin(String username, String password); 21 | } 22 | -------------------------------------------------------------------------------- /train/src/main/java/com/lemon/train/service/impl/PriceManageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service.impl; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.common.TimeHandle; 6 | import com.lemon.train.entity.Holiday; 7 | import com.lemon.train.entity.Pricemanage; 8 | import com.lemon.train.mapper.HolidayMapper; 9 | import com.lemon.train.service.PriceManageService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import java.text.ParseException; 15 | import java.util.*; 16 | 17 | @Service 18 | public class PriceManageServiceImpl implements PriceManageService { 19 | @Autowired 20 | HolidayMapper holidayMapper; 21 | 22 | @Override 23 | public ResponseResult getDiscount() { 24 | Pricemanage priceManage = holidayMapper.getDiscount(); 25 | return new ResponseResult(200,"sucess",priceManage); 26 | } 27 | 28 | @Override 29 | public ResponseResult updateDiscount(Pricemanage priceManage) { 30 | priceManage.setId(1); 31 | System.out.println(priceManage); 32 | holidayMapper.updateDiscountById(priceManage); 33 | return new ResponseResult(200,"suceess",null); 34 | } 35 | 36 | @Override 37 | public ResponseResult postSingleHoliday(Holiday holiday) { 38 | int i = holidayMapper.insert(holiday); 39 | if(i==0){ 40 | return new ResponseResult(400,"fail",400); 41 | } 42 | return new ResponseResult(200,"secuss",200); 43 | } 44 | 45 | @Override 46 | @Transactional 47 | public ResponseResult postMultipleHoliday(Date start, Date end, int status) throws ParseException { 48 | 49 | int interval = TimeHandle.getDayDiffer(start,end); 50 | Date date = start; 51 | Holiday holiday = new Holiday(); 52 | holiday.setStatus(status); 53 | holiday.setVacation(start); 54 | int result = holidayMapper.insert(holiday); 55 | Calendar calendar = new GregorianCalendar(); 56 | for (int i = 0; i < interval; i++) { 57 | calendar.setTime(date); 58 | calendar.add(Calendar.DATE,1); 59 | date=calendar.getTime(); 60 | holiday.setVacation(date); 61 | holidayMapper.insert(holiday); 62 | } 63 | 64 | return new ResponseResult(200,"success",null); 65 | } 66 | 67 | /** 68 | * 统计当天成交额 69 | * @param traindates 70 | * @return 71 | */ 72 | @Override 73 | public ResponseResult getTodayTotalPrice(Date traindates) { 74 | Map map = new HashMap<>(16); 75 | map.put("traindates",traindates); 76 | holidayMapper.getToalPrice(map); 77 | return new ResponseResult(200,"success",map.get("totalprice")); 78 | } 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /train/src/main/resources/1.txt: -------------------------------------------------------------------------------- 1 | 301登录失败 2 | 302已被注册 3 | 501票已卖完 4 | 303用户未审核 5 | 400失败 6 | 7 | 8 | 订单表 9 | status 10 | 1表示未付款 11 | 2表示待出行 12 | 3表示已出行 13 | 4表示已退款 14 | 5表示已改签 -------------------------------------------------------------------------------- /train/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | spring: 4 | #数据库连接配置 5 | datasource: 6 | driver-class-name: com.mysql.cj.jdbc.Driver 7 | url: jdbc:mysql://localhost:3306/train?serverTimezone=Asia/Shanghai 8 | username: root 9 | password: root 10 | #mybatis的相关配置 11 | jackson: 12 | time-zone: GMT+8 13 | mybatis: 14 | #mapper配置文件 15 | mapper-locations: classpath:mapper/*.xml 16 | type-aliases-package: com.zhg.demo.mybatis.entity 17 | #开启驼峰命名 18 | configuration: 19 | map-underscore-to-camel-case: true 20 | 21 | #pagehelper分页插件配置 22 | pagehelper: 23 | helperDialect: mysql 24 | -------------------------------------------------------------------------------- /train/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////// 2 | // _ooOoo_ // 3 | // o8888888o // 4 | // 88" . "88 // 5 | // (| ^_^ |) // 6 | // O\ = /O // 7 | // ____/`---'\____ // 8 | // .' \\| |// `. // 9 | // / \\||| : |||// \ // 10 | // / _||||| -:- |||||- \ // 11 | // | | \\\ - /// | | // 12 | // | \_| ''\---/'' | | // 13 | // \ .-\__ `-` ___/-. / // 14 | // ___`. .' /--.--\ `. . ___ // 15 | // ."" '< `.___\_<|>_/___.' >'"". // 16 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // 17 | // \ \ `-. \_ __\ /__ _/ .-` / / // 18 | // ========`-.____`-.___\_____/___.-`____.-'======== // 19 | // `=---=' // 20 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // 21 | // 佛祖保佑 永不宕机 永无BUG // 22 | //////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /train/src/test/java/com/lemon/train/DateTimeTest.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | 4 | import com.lemon.train.common.TimeHandle; 5 | import org.junit.jupiter.api.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | 9 | import java.text.SimpleDateFormat; 10 | import java.util.Calendar; 11 | import java.util.Date; 12 | import java.util.GregorianCalendar; 13 | 14 | @SpringBootTest 15 | public class DateTimeTest { 16 | 17 | @Autowired 18 | TimeHandle timeHandle; 19 | 20 | @Test 21 | public void test1(){ 22 | Date date = new Date(); 23 | SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 24 | System.out.println(dateFormat.format(date)); 25 | } 26 | 27 | @Test 28 | public void test2(){ 29 | Date date=new Date(); //取时间 30 | System.out.println(date); 31 | Calendar calendar = new GregorianCalendar(); 32 | calendar.setTime(date); 33 | calendar.add(calendar.DATE,1); //把日期往后增加一天,整数 往后推,负数往前移动 34 | date=calendar.getTime(); //这个时间就是日期往后推一天的结果 35 | System.out.println(date); 36 | } 37 | 38 | @Test 39 | public void test3(){ 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /train/src/test/java/com/lemon/train/TrainApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class TrainApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /train/src/test/java/com/lemon/train/traintest.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | import com.lemon.train.mapper.HolidayMapper; 4 | import com.lemon.train.service.TrainService; 5 | import org.junit.jupiter.api.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | 9 | import java.text.ParseException; 10 | import java.text.SimpleDateFormat; 11 | import java.util.Calendar; 12 | import java.util.Date; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | @SpringBootTest 17 | public class traintest { 18 | @Autowired 19 | TrainService trainService; 20 | @Autowired 21 | HolidayMapper holidayMapper; 22 | @Test 23 | public void trainTest1(){ 24 | trainService.queryTrains(); 25 | } 26 | 27 | @Test 28 | public void traintest2() throws ParseException { 29 | Map map = new HashMap(); 30 | map.put("status",3); 31 | //map.put("discount",2); 32 | double k = holidayMapper.getSpecialDiscount(map); 33 | System.out.println(k); 34 | String traindate = "2020-06-05"; 35 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 36 | Date date = formatter.parse(traindate); 37 | Calendar cal = Calendar.getInstance(); 38 | cal.setTime(date); 39 | System.out.println(cal.get(Calendar.DAY_OF_WEEK)); 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /train/train/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /train/train/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train/train/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /train/train/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /train/train/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.8.RELEASE 9 | 10 | 11 | com.zstu 12 | demo 13 | 0.0.1-SNAPSHOT 14 | war 15 | demo 16 | Demo project for Spring Boot 17 | 18 | 19 | 1.8 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | org.mybatis.spring.boot 29 | mybatis-spring-boot-starter 30 | 2.1.3 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-devtools 36 | runtime 37 | true 38 | 39 | 40 | org.projectlombok 41 | lombok 42 | true 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter-tomcat 47 | provided 48 | 49 | 50 | org.springframework.boot 51 | spring-boot-starter-test 52 | test 53 | 54 | 55 | org.junit.vintage 56 | junit-vintage-engine 57 | 58 | 59 | 60 | 61 | mysql 62 | mysql-connector-java 63 | 64 | 65 | 66 | io.github.yedaxia 67 | japidocs 68 | 1.4 69 | 70 | 71 | 72 | 73 | com.github.pagehelper 74 | pagehelper-spring-boot-starter 75 | 1.2.5 76 | 77 | 78 | 79 | 80 | 81 | 82 | org.springframework.boot 83 | spring-boot-maven-plugin 84 | 85 | 86 | org.mybatis.generator 87 | mybatis-generator-maven-plugin 88 | 1.3.7 89 | 90 | true 91 | src/main/resources/generator/generatorConfig.xml 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/ServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | public class ServletInitializer extends SpringBootServletInitializer { 7 | 8 | @Override 9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 10 | return application.sources(TrainApplication.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/TrainApplication.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 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.lemon.train.mapper") 9 | public class TrainApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(TrainApplication.class, args); 13 | // DocsConfig config = new DocsConfig(); 14 | // config.setProjectPath("D:\\work\\intellij\\work\\train"); // 项目根目录 15 | // config.setProjectName("ProjectName"); // 项目名称 16 | // config.setApiVersion("V1.0"); // 声明该API的版本 17 | // config.setDocsPath("D:\\work\\intellij\\work\\train\\doc"); // 生成API 文档所在目录 18 | // config.setAutoGenerate(Boolean.TRUE); // 配置自动生成 19 | // Docs.buildHtmlDocs(config); // 执行生成文档 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/common/AsyncTask.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.common; 2 | 3 | import com.lemon.train.mapper.OrdersMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.scheduling.annotation.Async; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | @Async 10 | public class AsyncTask { 11 | 12 | @Autowired 13 | OrdersMapper ordersMapper; 14 | 15 | /** 16 | * 用户登录时判断 17 | * @param id 18 | */ 19 | public void updateOrderState(Integer id){ 20 | ordersMapper.updateOrderState(id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/common/GloablExceptionHandler.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/train/train/src/main/java/com/lemon/train/common/GloablExceptionHandler.java -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/common/ResponseResult.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.common; 2 | 3 | public class ResponseResult { 4 | 5 | private String msg; 6 | private Integer code; 7 | private T data; 8 | 9 | public ResponseResult() { 10 | } 11 | 12 | public ResponseResult(Integer code, String msg, T data) { 13 | this.data = data; 14 | this.code = code; 15 | this.msg = msg; 16 | } 17 | 18 | public String getMsg() { 19 | return msg; 20 | } 21 | 22 | public void setMsg(String msg) { 23 | this.msg = msg; 24 | } 25 | 26 | public Integer getCode() { 27 | return code; 28 | } 29 | 30 | public void setCode(Integer code) { 31 | this.code = code; 32 | } 33 | 34 | public T getData() { 35 | return data; 36 | } 37 | 38 | public void setData(T data) { 39 | this.data = data; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "ResponseResult{" + 45 | ", msg='" + msg + '\'' + 46 | ", code=" + code + 47 | ", data=" + data + 48 | '}'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/common/TimeHandle.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.common; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | @Component 10 | public class TimeHandle { 11 | 12 | public static int getDayDiffer(Date startDate, Date endDate) throws ParseException { 13 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 14 | long startDateTime = dateFormat.parse(dateFormat.format(startDate)).getTime(); 15 | long endDateTime = dateFormat.parse(dateFormat.format(endDate)).getTime(); 16 | return (int) ((endDateTime - startDateTime) / (1000 * 3600 * 24)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/config/InterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | @Configuration 8 | public class InterceptorConfig implements WebMvcConfigurer { 9 | 10 | /** 11 | * 跨域支持 12 | * 13 | * @param registry 14 | */ 15 | @Override 16 | public void addCorsMappings(CorsRegistry registry) { 17 | registry.addMapping("/**") 18 | .allowedOrigins("*") 19 | .allowCredentials(true) 20 | .allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS", "HEAD") 21 | .maxAge(3600 * 24); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.entity.Orderinfo; 6 | import com.lemon.train.entity.Orders; 7 | import com.lemon.train.service.OrderService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.text.ParseException; 12 | import java.text.SimpleDateFormat; 13 | import java.util.Date; 14 | import java.util.Map; 15 | 16 | @RestController 17 | @RequestMapping("order") 18 | public class OrderController { 19 | 20 | 21 | @Autowired 22 | OrderService orderService; 23 | 24 | /** 25 | * 订单查询 26 | * @param orders 27 | * @return 28 | */ 29 | @PostMapping("/submitorder") 30 | public ResponseResult submitOrder(@RequestBody Orders orders){ 31 | return orderService.submitOrder(orders); 32 | } 33 | 34 | 35 | 36 | /** 37 | * 查询所有订单 38 | * @param orderId 39 | * @return 40 | */ 41 | @GetMapping("/queryorders") 42 | public ResponseResult queryOrders(Integer orderId){ 43 | return orderService.queryOrders(orderId); 44 | } 45 | 46 | 47 | /** 48 | * 查询单一订单 49 | * @param id 50 | * @return 51 | */ 52 | @GetMapping("/getdetailorder") 53 | public ResponseResult getDetailOrder(Integer id){ 54 | return orderService.getDetailOrder(id); 55 | } 56 | 57 | 58 | /** 59 | * 删除订单 60 | */ 61 | @PostMapping("/delorder") 62 | public ResponseResult delOrder(Integer id){ 63 | return orderService.delOrder(id); 64 | } 65 | 66 | /** 67 | * 订单退票 68 | */ 69 | @PostMapping("/deleteorder") 70 | public ResponseResult deleteOrder(@RequestBody Orderinfo orderinfo){ 71 | return orderService.deleteOrder(orderinfo); 72 | } 73 | 74 | /** 75 | * 订单改签 76 | */ 77 | @PostMapping("/changeticket") 78 | public ResponseResult changeTicket(@RequestBody Map map) throws ParseException { 79 | int trainid = (int) map.get("trainid"); 80 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 81 | Date date = formatter.parse((String) map.get("traindate")); 82 | int orderid=(int) map.get("orderid"); 83 | return orderService.changeTicket(trainid,date,orderid); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/controller/PriceManageController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.entity.Holiday; 6 | import com.lemon.train.entity.Pricemanage; 7 | import com.lemon.train.service.PriceManageService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.text.ParseException; 12 | import java.text.SimpleDateFormat; 13 | import java.util.Date; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | 18 | @RestController 19 | @RequestMapping("price") 20 | public class PriceManageController { 21 | 22 | @Autowired 23 | PriceManageService priceManageService; 24 | 25 | /** 26 | * 查询 27 | * @return 28 | */ 29 | @GetMapping("/getdiscount") 30 | public ResponseResult getDiscount(){ 31 | return priceManageService.getDiscount(); 32 | } 33 | 34 | /** 35 | * 更新折扣 36 | */ 37 | @PostMapping("/updatediscount") 38 | public ResponseResult updateDiscount(@RequestBody Pricemanage priceManage){ 39 | System.out.println(priceManage); 40 | return priceManageService.updateDiscount(priceManage); 41 | } 42 | 43 | /** 44 | * 发布单一节假日 45 | */ 46 | @PostMapping("/postsingleholiday") 47 | public ResponseResult postSingleHoliday(@RequestBody Holiday holiday){ 48 | System.out.println(holiday); 49 | return priceManageService.postSingleHoliday(holiday); 50 | } 51 | 52 | /** 53 | * 发布一段时间的节假日 54 | */ 55 | @PostMapping("/postmultipleholiday") 56 | public ResponseResult postMultipleHoliday(@RequestBody Map map) throws ParseException { 57 | 58 | int status = Integer.parseInt((String) map.get("status")); 59 | List vacation = (List) map.get("vacation"); 60 | SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" ); 61 | Date start = sdf.parse(vacation.get(0)); 62 | Date end = sdf.parse(vacation.get(1)); 63 | return priceManageService.postMultipleHoliday(start,end,status); 64 | } 65 | 66 | 67 | /** 68 | * 当天交易额 69 | */ 70 | @GetMapping("/gettodaytotalprice") 71 | public ResponseResult getTodayTotalPrice(String orderdate) throws ParseException { 72 | SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" ); 73 | Date odate = sdf.parse(orderdate); 74 | return priceManageService.getTodayTotalPrice(odate); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/controller/TrainController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Traininfos; 5 | import com.lemon.train.service.TrainService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.text.ParseException; 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | 16 | @RestController 17 | @RequestMapping("train") 18 | public class TrainController { 19 | 20 | @Autowired 21 | TrainService trainService; 22 | 23 | /** 24 | * 车票查询 25 | * @return 26 | */ 27 | @GetMapping("/trainticketquery") 28 | public ResponseResult trainTicketQuery(String startcity, String endcity, String traindate,Integer traintype) throws ParseException { 29 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 30 | Date date = formatter.parse(traindate); 31 | return trainService.trainTicketQuery(startcity, endcity, date,traintype); 32 | } 33 | 34 | 35 | /** 36 | * 节假日价格折扣查询 37 | */ 38 | @GetMapping("/holidaydiscount") 39 | public ResponseResult holidayDiscount(String traindate) throws ParseException { 40 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 41 | Date date = formatter.parse(traindate); 42 | return trainService.holidayDiscount(date); 43 | } 44 | 45 | 46 | 47 | 48 | 49 | 50 | /** 51 | * 管理员端 52 | * 火车新增 53 | */ 54 | @PostMapping("addtrain") 55 | public ResponseResult addTrain(@RequestBody Traininfos traininfos){ 56 | return trainService.addTrain(traininfos); 57 | } 58 | 59 | /** 60 | * 管理员火车信息查询 61 | */ 62 | @GetMapping("/querytrains") 63 | public ResponseResult queryTrains(){ 64 | return trainService.queryTrains(); 65 | 66 | } 67 | 68 | 69 | /** 70 | * 管理员单个火车发布或者全部发布 71 | */ 72 | @PostMapping("/departtrains") 73 | public ResponseResult departTrains(Integer id, String traindate) throws ParseException { 74 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 75 | Date date = formatter.parse(traindate); 76 | return trainService.departTrain(id,date); 77 | } 78 | 79 | /** 80 | * 管理多个火车表的发布 81 | */ 82 | @PostMapping("/departtrainsselective") 83 | public ResponseResult departTrainsSelective(@RequestBody Map map) throws ParseException { 84 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 85 | Date date = formatter.parse((String) map.get("traindate")); 86 | return trainService.departTrainsSelective((List)map.get("idlist"),date); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.controller; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.entity.User; 6 | import com.lemon.train.service.UserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Qualifier; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | @RequestMapping("user") 12 | @RestController 13 | public class UserController { 14 | 15 | @Qualifier("user") 16 | @Autowired 17 | UserService userService; 18 | 19 | @PostMapping("/login") 20 | public ResponseResult userLogin(String username, String password){ 21 | return userService.userLogin(username,password); 22 | } 23 | 24 | @PostMapping("/register") 25 | public ResponseResult userRegister(@RequestBody User user){ 26 | return userService.userRegister(user); 27 | } 28 | 29 | @GetMapping("/querypassenger") 30 | public ResponseResult queryPassenger(String id){ 31 | return userService.queryPassenger(id); 32 | } 33 | 34 | 35 | /** 36 | * 管理员登录 37 | */ 38 | @PostMapping("/adminlogin") 39 | public ResponseResult adminLogin(String username,String password){ 40 | return userService.adminLogin(username,password); 41 | } 42 | 43 | /** 44 | * 管理员端 45 | * 根据条件查询 46 | */ 47 | @GetMapping("/queryalluser") 48 | public ResponseResult queryAllUser(Integer pagenum,String condition, Integer pagesize){ 49 | return userService.queryAllUser(pagenum,condition,pagesize); 50 | } 51 | 52 | /** 53 | * 用户的表更新 54 | */ 55 | @PutMapping("/putuser") 56 | public ResponseResult putUser(@RequestBody User user){ 57 | return userService.putUser(user); 58 | } 59 | 60 | /** 61 | * 根据真实姓名模糊查询 62 | */ 63 | @GetMapping("/vagueusers") 64 | public ResponseResult vagueUsers(String realname){ 65 | return userService.vagueUsers(realname); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Holiday.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class Holiday { 8 | 9 | 10 | private Date vacation; 11 | 12 | private Integer status; 13 | @JsonFormat(pattern = "yyyy-MM-dd") 14 | public Date getVacation() { 15 | return vacation; 16 | } 17 | 18 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 19 | public void setVacation(Date vacation) { 20 | this.vacation = vacation; 21 | } 22 | 23 | public Integer getStatus() { 24 | return status; 25 | } 26 | 27 | public void setStatus(Integer status) { 28 | this.status = status; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | StringBuilder sb = new StringBuilder(); 34 | sb.append(getClass().getSimpleName()); 35 | sb.append(" ["); 36 | sb.append("Hash = ").append(hashCode()); 37 | sb.append(", vacation=").append(vacation); 38 | sb.append(", status=").append(status); 39 | sb.append("]"); 40 | return sb.toString(); 41 | } 42 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Orders.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import org.springframework.format.annotation.DateTimeFormat; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.Date; 8 | 9 | public class Orders { 10 | private Integer id; 11 | 12 | private Integer status; 13 | 14 | private BigDecimal price; 15 | 16 | private Date traindate; 17 | 18 | private Date createtime; 19 | 20 | private Integer userId; 21 | 22 | private Integer trainId; 23 | 24 | private Integer seattype; 25 | 26 | private Integer carriage; 27 | 28 | private String seat; 29 | 30 | private Integer orderId; 31 | 32 | public Integer getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Integer id) { 37 | this.id = id; 38 | } 39 | 40 | public Integer getStatus() { 41 | return status; 42 | } 43 | 44 | public void setStatus(Integer status) { 45 | this.status = status; 46 | } 47 | 48 | public BigDecimal getPrice() { 49 | return price; 50 | } 51 | 52 | public void setPrice(BigDecimal price) { 53 | this.price = price; 54 | } 55 | 56 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 57 | public Date getTraindate() { 58 | return traindate; 59 | } 60 | 61 | @DateTimeFormat(pattern = "yyyy-MM-dd") 62 | public void setTraindate(Date traindate) { 63 | this.traindate = traindate; 64 | } 65 | 66 | public Date getCreatetime() { 67 | return createtime; 68 | } 69 | 70 | public void setCreatetime(Date createtime) { 71 | this.createtime = createtime; 72 | } 73 | 74 | public Integer getUserId() { 75 | return userId; 76 | } 77 | 78 | public void setUserId(Integer userId) { 79 | this.userId = userId; 80 | } 81 | 82 | public Integer getTrainId() { 83 | return trainId; 84 | } 85 | 86 | public void setTrainId(Integer trainId) { 87 | this.trainId = trainId; 88 | } 89 | 90 | public Integer getSeattype() { 91 | return seattype; 92 | } 93 | 94 | public void setSeattype(Integer seattype) { 95 | this.seattype = seattype; 96 | } 97 | 98 | public Integer getCarriage() { 99 | return carriage; 100 | } 101 | 102 | public void setCarriage(Integer carriage) { 103 | this.carriage = carriage; 104 | } 105 | 106 | public String getSeat() { 107 | return seat; 108 | } 109 | 110 | public void setSeat(String seat) { 111 | this.seat = seat == null ? null : seat.trim(); 112 | } 113 | 114 | public Integer getOrderId() { 115 | return orderId; 116 | } 117 | 118 | public void setOrderId(Integer orderId) { 119 | this.orderId = orderId; 120 | } 121 | 122 | @Override 123 | public String toString() { 124 | StringBuilder sb = new StringBuilder(); 125 | sb.append(getClass().getSimpleName()); 126 | sb.append(" ["); 127 | sb.append("Hash = ").append(hashCode()); 128 | sb.append(", id=").append(id); 129 | sb.append(", status=").append(status); 130 | sb.append(", price=").append(price); 131 | sb.append(", traindate=").append(traindate); 132 | sb.append(", createtime=").append(createtime); 133 | sb.append(", userId=").append(userId); 134 | sb.append(", trainId=").append(trainId); 135 | sb.append(", seattype=").append(seattype); 136 | sb.append(", carriage=").append(carriage); 137 | sb.append(", seat=").append(seat); 138 | sb.append(", orderId=").append(orderId); 139 | sb.append("]"); 140 | return sb.toString(); 141 | } 142 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Orderseat.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import java.util.Date; 4 | 5 | public class Orderseat { 6 | private Integer id; 7 | 8 | private Integer status; 9 | 10 | private Date orderdate; 11 | 12 | private Integer trainId; 13 | 14 | private Integer seatId; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public Integer getStatus() { 25 | return status; 26 | } 27 | 28 | public void setStatus(Integer status) { 29 | this.status = status; 30 | } 31 | 32 | public Date getOrderdate() { 33 | return orderdate; 34 | } 35 | 36 | public void setOrderdate(Date orderdate) { 37 | this.orderdate = orderdate; 38 | } 39 | 40 | public Integer getTrainId() { 41 | return trainId; 42 | } 43 | 44 | public void setTrainId(Integer trainId) { 45 | this.trainId = trainId; 46 | } 47 | 48 | public Integer getSeatId() { 49 | return seatId; 50 | } 51 | 52 | public void setSeatId(Integer seatId) { 53 | this.seatId = seatId; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | StringBuilder sb = new StringBuilder(); 59 | sb.append(getClass().getSimpleName()); 60 | sb.append(" ["); 61 | sb.append("Hash = ").append(hashCode()); 62 | sb.append(", id=").append(id); 63 | sb.append(", status=").append(status); 64 | sb.append(", orderdate=").append(orderdate); 65 | sb.append(", trainId=").append(trainId); 66 | sb.append(", seatId=").append(seatId); 67 | sb.append("]"); 68 | return sb.toString(); 69 | } 70 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Passenger.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Passenger { 7 | private Integer id; 8 | 9 | private String name; 10 | 11 | private String idcard; 12 | 13 | private Integer type; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Pricemanage.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Pricemanage { 4 | private Integer id; 5 | 6 | private Double returnprice; 7 | 8 | private Double discount1; 9 | 10 | private Double discount2; 11 | 12 | private Double discount3; 13 | 14 | public Integer getId() { 15 | return id; 16 | } 17 | 18 | public void setId(Integer id) { 19 | this.id = id; 20 | } 21 | 22 | public Double getReturnprice() { 23 | return returnprice; 24 | } 25 | 26 | public void setReturnprice(Double returnprice) { 27 | this.returnprice = returnprice; 28 | } 29 | 30 | public Double getDiscount1() { 31 | return discount1; 32 | } 33 | 34 | public void setDiscount1(Double discount1) { 35 | this.discount1 = discount1; 36 | } 37 | 38 | public Double getDiscount2() { 39 | return discount2; 40 | } 41 | 42 | public void setDiscount2(Double discount2) { 43 | this.discount2 = discount2; 44 | } 45 | 46 | public Double getDiscount3() { 47 | return discount3; 48 | } 49 | 50 | public void setDiscount3(Double discount3) { 51 | this.discount3 = discount3; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | StringBuilder sb = new StringBuilder(); 57 | sb.append(getClass().getSimpleName()); 58 | sb.append(" ["); 59 | sb.append("Hash = ").append(hashCode()); 60 | sb.append(", id=").append(id); 61 | sb.append(", returnprice=").append(returnprice); 62 | sb.append(", discount1=").append(discount1); 63 | sb.append(", discount2=").append(discount2); 64 | sb.append(", discount3=").append(discount3); 65 | sb.append("]"); 66 | return sb.toString(); 67 | } 68 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Seatinfo.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import java.util.Date; 4 | 5 | public class Seatinfo { 6 | private Integer id; 7 | 8 | private String name; 9 | 10 | private Integer traintype; 11 | 12 | private Integer carriage; 13 | 14 | private Integer seattype; 15 | 16 | private String seat; 17 | 18 | public Seatinfo(Integer id, Integer carriage, Integer seattype, String seat, Date orderdate) { 19 | this.id= id; 20 | this.carriage = carriage; 21 | this.seattype = seattype; 22 | this.seat = seat; 23 | this.orderdate = orderdate; 24 | } 25 | 26 | private Integer status; 27 | 28 | private Date orderdate; 29 | 30 | private Integer orderseatid; 31 | 32 | public Integer getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Integer id) { 37 | this.id = id; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name == null ? null : name.trim(); 46 | } 47 | 48 | public Integer getTraintype() { 49 | return traintype; 50 | } 51 | 52 | public void setTraintype(Integer traintype) { 53 | this.traintype = traintype; 54 | } 55 | 56 | public Integer getCarriage() { 57 | return carriage; 58 | } 59 | 60 | public void setCarriage(Integer carriage) { 61 | this.carriage = carriage; 62 | } 63 | 64 | public Integer getSeattype() { 65 | return seattype; 66 | } 67 | 68 | public void setSeattype(Integer seattype) { 69 | this.seattype = seattype; 70 | } 71 | 72 | public String getSeat() { 73 | return seat; 74 | } 75 | 76 | public void setSeat(String seat) { 77 | this.seat = seat == null ? null : seat.trim(); 78 | } 79 | 80 | public Integer getStatus() { 81 | return status; 82 | } 83 | 84 | public void setStatus(Integer status) { 85 | this.status = status; 86 | } 87 | 88 | public Date getOrderdate() { 89 | return orderdate; 90 | } 91 | 92 | public void setOrderdate(Date orderdate) { 93 | this.orderdate = orderdate; 94 | } 95 | 96 | public Integer getOrderseatid() { 97 | return orderseatid; 98 | } 99 | 100 | public void setOrderseatid(Integer orderseatid) { 101 | this.orderseatid = orderseatid; 102 | } 103 | 104 | @Override 105 | public String toString() { 106 | StringBuilder sb = new StringBuilder(); 107 | sb.append(getClass().getSimpleName()); 108 | sb.append(" ["); 109 | sb.append("Hash = ").append(hashCode()); 110 | sb.append(", id=").append(id); 111 | sb.append(", name=").append(name); 112 | sb.append(", traintype=").append(traintype); 113 | sb.append(", carriage=").append(carriage); 114 | sb.append(", seattype=").append(seattype); 115 | sb.append(", seat=").append(seat); 116 | sb.append(", status=").append(status); 117 | sb.append(", orderdate=").append(orderdate); 118 | sb.append(", orderseatid=").append(orderseatid); 119 | sb.append("]"); 120 | return sb.toString(); 121 | } 122 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Train.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Train { 4 | private Integer id; 5 | 6 | private String name; 7 | 8 | private Integer type; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name == null ? null : name.trim(); 24 | } 25 | 26 | public Integer getType() { 27 | return type; 28 | } 29 | 30 | public void setType(Integer type) { 31 | this.type = type; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | StringBuilder sb = new StringBuilder(); 37 | sb.append(getClass().getSimpleName()); 38 | sb.append(" ["); 39 | sb.append("Hash = ").append(hashCode()); 40 | sb.append(", id=").append(id); 41 | sb.append(", name=").append(name); 42 | sb.append(", type=").append(type); 43 | sb.append("]"); 44 | return sb.toString(); 45 | } 46 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Traininfo.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.math.BigDecimal; 6 | import java.util.Date; 7 | 8 | public class Traininfo { 9 | private Integer id; 10 | 11 | private String startcity; 12 | 13 | private Date starttime; 14 | 15 | private String endcity; 16 | 17 | private Date endtime; 18 | 19 | private BigDecimal fprice; 20 | 21 | private BigDecimal sprice; 22 | 23 | private Integer fnum; 24 | 25 | private Integer snum; 26 | 27 | private Integer trainId; 28 | 29 | private String duration; 30 | 31 | public Integer getId() { 32 | return id; 33 | } 34 | 35 | public void setId(Integer id) { 36 | this.id = id; 37 | } 38 | 39 | public String getStartcity() { 40 | return startcity; 41 | } 42 | 43 | public void setStartcity(String startcity) { 44 | this.startcity = startcity == null ? null : startcity.trim(); 45 | } 46 | 47 | @JsonFormat(pattern = "HH:mm:ss",timezone="GMT+8") 48 | public Date getStarttime() { 49 | return starttime; 50 | } 51 | 52 | public void setStarttime(Date starttime) { 53 | this.starttime = starttime; 54 | } 55 | 56 | public String getEndcity() { 57 | return endcity; 58 | } 59 | 60 | public void setEndcity(String endcity) { 61 | this.endcity = endcity == null ? null : endcity.trim(); 62 | } 63 | 64 | @JsonFormat(pattern = "HH:mm:ss",timezone="GMT+8") 65 | public Date getEndtime() { 66 | return endtime; 67 | } 68 | 69 | public void setEndtime(Date endtime) { 70 | this.endtime = endtime; 71 | } 72 | 73 | public BigDecimal getFprice() { 74 | return fprice; 75 | } 76 | 77 | public void setFprice(BigDecimal fprice) { 78 | this.fprice = fprice; 79 | } 80 | 81 | public BigDecimal getSprice() { 82 | return sprice; 83 | } 84 | 85 | public void setSprice(BigDecimal sprice) { 86 | this.sprice = sprice; 87 | } 88 | 89 | public Integer getFnum() { 90 | return fnum; 91 | } 92 | 93 | public void setFnum(Integer fnum) { 94 | this.fnum = fnum; 95 | } 96 | 97 | public Integer getSnum() { 98 | return snum; 99 | } 100 | 101 | public void setSnum(Integer snum) { 102 | this.snum = snum; 103 | } 104 | 105 | public Integer getTrainId() { 106 | return trainId; 107 | } 108 | 109 | public void setTrainId(Integer trainId) { 110 | this.trainId = trainId; 111 | } 112 | 113 | public String getDuration() { 114 | return duration; 115 | } 116 | 117 | public void setDuration(String duration) { 118 | this.duration = duration == null ? null : duration.trim(); 119 | } 120 | 121 | @Override 122 | public String toString() { 123 | StringBuilder sb = new StringBuilder(); 124 | sb.append(getClass().getSimpleName()); 125 | sb.append(" ["); 126 | sb.append("Hash = ").append(hashCode()); 127 | sb.append(", id=").append(id); 128 | sb.append(", startcity=").append(startcity); 129 | sb.append(", starttime=").append(starttime); 130 | sb.append(", endcity=").append(endcity); 131 | sb.append(", endtime=").append(endtime); 132 | sb.append(", fprice=").append(fprice); 133 | sb.append(", sprice=").append(sprice); 134 | sb.append(", fnum=").append(fnum); 135 | sb.append(", snum=").append(snum); 136 | sb.append(", trainId=").append(trainId); 137 | sb.append(", duration=").append(duration); 138 | sb.append("]"); 139 | return sb.toString(); 140 | } 141 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Trainseat.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Trainseat { 4 | private Integer id; 5 | 6 | private Integer carriage; 7 | 8 | private Integer type; 9 | 10 | private String seat; 11 | 12 | private Integer trainId; 13 | 14 | public Integer getId() { 15 | return id; 16 | } 17 | 18 | public void setId(Integer id) { 19 | this.id = id; 20 | } 21 | 22 | public Integer getCarriage() { 23 | return carriage; 24 | } 25 | 26 | public void setCarriage(Integer carriage) { 27 | this.carriage = carriage; 28 | } 29 | 30 | public Integer getType() { 31 | return type; 32 | } 33 | 34 | public void setType(Integer type) { 35 | this.type = type; 36 | } 37 | 38 | public String getSeat() { 39 | return seat; 40 | } 41 | 42 | public void setSeat(String seat) { 43 | this.seat = seat == null ? null : seat.trim(); 44 | } 45 | 46 | public Integer getTrainId() { 47 | return trainId; 48 | } 49 | 50 | public void setTrainId(Integer trainId) { 51 | this.trainId = trainId; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | StringBuilder sb = new StringBuilder(); 57 | sb.append(getClass().getSimpleName()); 58 | sb.append(" ["); 59 | sb.append("Hash = ").append(hashCode()); 60 | sb.append(", id=").append(id); 61 | sb.append(", carriage=").append(carriage); 62 | sb.append(", type=").append(type); 63 | sb.append(", seat=").append(seat); 64 | sb.append(", trainId=").append(trainId); 65 | sb.append("]"); 66 | return sb.toString(); 67 | } 68 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Trainstate.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | public class Trainstate { 4 | private Integer id; 5 | 6 | private Integer status; 7 | 8 | private Integer trainId; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public Integer getStatus() { 19 | return status; 20 | } 21 | 22 | public void setStatus(Integer status) { 23 | this.status = status; 24 | } 25 | 26 | public Integer getTrainId() { 27 | return trainId; 28 | } 29 | 30 | public void setTrainId(Integer trainId) { 31 | this.trainId = trainId; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | StringBuilder sb = new StringBuilder(); 37 | sb.append(getClass().getSimpleName()); 38 | sb.append(" ["); 39 | sb.append("Hash = ").append(hashCode()); 40 | sb.append(", id=").append(id); 41 | sb.append(", status=").append(status); 42 | sb.append(", trainId=").append(trainId); 43 | sb.append("]"); 44 | return sb.toString(); 45 | } 46 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/Trainticket.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import java.util.Date; 4 | 5 | public class Trainticket { 6 | private Integer id; 7 | 8 | private Integer fnum; 9 | 10 | public Trainticket(Integer fnum, Integer snum, Date ticketdate, Integer trainId) { 11 | this.fnum = fnum; 12 | this.snum = snum; 13 | this.ticketdate = ticketdate; 14 | this.trainId = trainId; 15 | } 16 | 17 | private Integer snum; 18 | 19 | private Date ticketdate; 20 | 21 | private Integer trainId; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public Integer getFnum() { 32 | return fnum; 33 | } 34 | 35 | public void setFnum(Integer fnum) { 36 | this.fnum = fnum; 37 | } 38 | 39 | public Integer getSnum() { 40 | return snum; 41 | } 42 | 43 | public void setSnum(Integer snum) { 44 | this.snum = snum; 45 | } 46 | 47 | public Date getTicketdate() { 48 | return ticketdate; 49 | } 50 | 51 | public void setTicketdate(Date ticketdate) { 52 | this.ticketdate = ticketdate; 53 | } 54 | 55 | public Integer getTrainId() { 56 | return trainId; 57 | } 58 | 59 | public void setTrainId(Integer trainId) { 60 | this.trainId = trainId; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | StringBuilder sb = new StringBuilder(); 66 | sb.append(getClass().getSimpleName()); 67 | sb.append(" ["); 68 | sb.append("Hash = ").append(hashCode()); 69 | sb.append(", id=").append(id); 70 | sb.append(", fnum=").append(fnum); 71 | sb.append(", snum=").append(snum); 72 | sb.append(", ticketdate=").append(ticketdate); 73 | sb.append(", trainId=").append(trainId); 74 | sb.append("]"); 75 | return sb.toString(); 76 | } 77 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnore; 5 | 6 | import java.util.Date; 7 | 8 | public class User { 9 | private Integer id; 10 | 11 | private String username; 12 | 13 | private String realname; 14 | 15 | @JsonIgnore 16 | private String password; 17 | 18 | private Integer status; 19 | 20 | private String idcard; 21 | 22 | private String phone; 23 | 24 | private Integer type; 25 | 26 | private String country; 27 | 28 | private Date createdate; 29 | 30 | public Integer getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Integer id) { 35 | this.id = id; 36 | } 37 | 38 | public String getUsername() { 39 | return username; 40 | } 41 | 42 | public void setUsername(String username) { 43 | this.username = username == null ? null : username.trim(); 44 | } 45 | 46 | public String getRealname() { 47 | return realname; 48 | } 49 | 50 | public void setRealname(String realname) { 51 | this.realname = realname == null ? null : realname.trim(); 52 | } 53 | 54 | public String getPassword() { 55 | return password; 56 | } 57 | 58 | public void setPassword(String password) { 59 | this.password = password == null ? null : password.trim(); 60 | } 61 | 62 | public Integer getStatus() { 63 | return status; 64 | } 65 | 66 | public void setStatus(Integer status) { 67 | this.status = status; 68 | } 69 | 70 | public String getIdcard() { 71 | return idcard; 72 | } 73 | 74 | public void setIdcard(String idcard) { 75 | this.idcard = idcard == null ? null : idcard.trim(); 76 | } 77 | 78 | public String getPhone() { 79 | return phone; 80 | } 81 | 82 | public void setPhone(String phone) { 83 | this.phone = phone == null ? null : phone.trim(); 84 | } 85 | 86 | public Integer getType() { 87 | return type; 88 | } 89 | 90 | public void setType(Integer type) { 91 | this.type = type; 92 | } 93 | 94 | public String getCountry() { 95 | return country; 96 | } 97 | 98 | public void setCountry(String country) { 99 | this.country = country == null ? null : country.trim(); 100 | } 101 | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 102 | public Date getCreatedate() { 103 | return createdate; 104 | } 105 | 106 | public void setCreatedate(Date createdate) { 107 | this.createdate = createdate; 108 | } 109 | 110 | @Override 111 | public String toString() { 112 | StringBuilder sb = new StringBuilder(); 113 | sb.append(getClass().getSimpleName()); 114 | sb.append(" ["); 115 | sb.append("Hash = ").append(hashCode()); 116 | sb.append(", id=").append(id); 117 | sb.append(", username=").append(username); 118 | sb.append(", realname=").append(realname); 119 | sb.append(", password=").append(password); 120 | sb.append(", status=").append(status); 121 | sb.append(", idcard=").append(idcard); 122 | sb.append(", phone=").append(phone); 123 | sb.append(", type=").append(type); 124 | sb.append(", country=").append(country); 125 | sb.append(", createdate=").append(createdate); 126 | sb.append("]"); 127 | return sb.toString(); 128 | } 129 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/HolidayMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Holiday; 4 | import com.lemon.train.entity.HolidayExample; 5 | import com.lemon.train.entity.Pricemanage; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public interface HolidayMapper { 14 | long countByExample(HolidayExample example); 15 | 16 | int deleteByExample(HolidayExample example); 17 | 18 | int deleteByPrimaryKey(Date vacation); 19 | 20 | int insert(Holiday record); 21 | 22 | int insertSelective(Holiday record); 23 | 24 | List selectByExample(HolidayExample example); 25 | 26 | Holiday selectByPrimaryKey(Date vacation); 27 | 28 | int updateByExampleSelective(@Param("record") Holiday record, @Param("example") HolidayExample example); 29 | 30 | int updateByExample(@Param("record") Holiday record, @Param("example") HolidayExample example); 31 | 32 | int updateByPrimaryKeySelective(Holiday record); 33 | 34 | int updateByPrimaryKey(Holiday record); 35 | 36 | // 通过状态获得 37 | double getSpecialDiscount(Map map); 38 | 39 | //更新折扣表 40 | int updateDiscountById(Pricemanage priceManage); 41 | 42 | @Select("select * from pricemanage where id=1 limit 1") 43 | Pricemanage getDiscount(); 44 | 45 | //获得当天交易额 46 | void getToalPrice(Map map); 47 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/OrderinfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Orderinfo; 4 | import com.lemon.train.entity.OrderinfoExample; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | public interface OrderinfoMapper { 11 | long countByExample(OrderinfoExample example); 12 | 13 | int deleteByExample(OrderinfoExample example); 14 | 15 | int insert(Orderinfo record); 16 | 17 | int insertSelective(Orderinfo record); 18 | 19 | List selectByExample(OrderinfoExample example); 20 | 21 | int updateByExampleSelective(@Param("record") Orderinfo record, @Param("example") OrderinfoExample example); 22 | 23 | int updateByExample(@Param("record") Orderinfo record, @Param("example") OrderinfoExample example); 24 | 25 | @Select("select * from orderinfo where id=#{id}") 26 | Orderinfo selectDetailOrder(Integer id); 27 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/OrdersMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Orders; 4 | import com.lemon.train.entity.OrdersExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | public interface OrdersMapper { 11 | long countByExample(OrdersExample example); 12 | 13 | int deleteByExample(OrdersExample example); 14 | 15 | int deleteByPrimaryKey(Integer id); 16 | 17 | int insert(Orders record); 18 | 19 | int insertSelective(Orders record); 20 | 21 | List selectByExample(OrdersExample example); 22 | 23 | Orders selectByPrimaryKey(Integer id); 24 | 25 | int updateByExampleSelective(@Param("record") Orders record, @Param("example") OrdersExample example); 26 | 27 | int updateByExample(@Param("record") Orders record, @Param("example") OrdersExample example); 28 | 29 | int updateByPrimaryKeySelective(Orders record); 30 | 31 | int updateByPrimaryKey(Orders record); 32 | 33 | 34 | /** 35 | * 修改火车的票数,后期可以集成到redis 36 | */ 37 | int decreaseTrainNum(Integer trainId, Date traindate,Integer type); 38 | 39 | int increaseTrainNum(Integer trainId, Date traindate,Integer type); 40 | 41 | int updateOrderState(Integer id); 42 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/OrderseatMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | 4 | import com.lemon.train.entity.Orderseat; 5 | import com.lemon.train.entity.OrderseatExample; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | public interface OrderseatMapper { 12 | long countByExample(OrderseatExample example); 13 | 14 | int deleteByExample(OrderseatExample example); 15 | 16 | int deleteByPrimaryKey(Integer id); 17 | 18 | int insert(Orderseat record); 19 | 20 | int insertSelective(Orderseat record); 21 | 22 | List selectByExample(OrderseatExample example); 23 | 24 | Orderseat selectByPrimaryKey(Integer id); 25 | 26 | int updateByExampleSelective(@Param("record") Orderseat record, @Param("example") OrderseatExample example); 27 | 28 | int updateByExample(@Param("record") Orderseat record, @Param("example") OrderseatExample example); 29 | 30 | int updateByPrimaryKeySelective(Orderseat record); 31 | 32 | int updateByPrimaryKey(Orderseat record); 33 | 34 | /** 35 | * 返回座位主键 36 | */ 37 | Orderseat selectSeatPrimaryKey(Date orderdate, Integer trainid,Integer type); 38 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/SeatinfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Seatinfo; 4 | import com.lemon.train.entity.SeatinfoExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface SeatinfoMapper { 10 | long countByExample(SeatinfoExample example); 11 | 12 | int deleteByExample(SeatinfoExample example); 13 | 14 | int insert(Seatinfo record); 15 | 16 | int insertSelective(Seatinfo record); 17 | 18 | List selectByExample(SeatinfoExample example); 19 | 20 | int updateByExampleSelective(@Param("record") Seatinfo record, @Param("example") SeatinfoExample example); 21 | 22 | int updateByExample(@Param("record") Seatinfo record, @Param("example") SeatinfoExample example); 23 | 24 | int selectBySelective(Seatinfo seatinfo); 25 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/TrainMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Train; 4 | import com.lemon.train.entity.TrainExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface TrainMapper { 9 | long countByExample(TrainExample example); 10 | 11 | int deleteByExample(TrainExample example); 12 | 13 | int deleteByPrimaryKey(Integer id); 14 | 15 | int insert(Train record); 16 | 17 | int insertSelective(Train record); 18 | 19 | List selectByExample(TrainExample example); 20 | 21 | Train selectByPrimaryKey(Integer id); 22 | 23 | int updateByExampleSelective(@Param("record") Train record, @Param("example") TrainExample example); 24 | 25 | int updateByExample(@Param("record") Train record, @Param("example") TrainExample example); 26 | 27 | int updateByPrimaryKeySelective(Train record); 28 | 29 | int updateByPrimaryKey(Train record); 30 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/TraininfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Traininfo; 4 | import com.lemon.train.entity.TraininfoExample; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | public interface TraininfoMapper { 12 | long countByExample(TraininfoExample example); 13 | 14 | int deleteByExample(TraininfoExample example); 15 | 16 | int deleteByPrimaryKey(Integer id); 17 | 18 | int insert(Traininfo record); 19 | 20 | int insertSelective(Traininfo record); 21 | 22 | List selectByExample(TraininfoExample example); 23 | 24 | Traininfo selectByPrimaryKey(Integer id); 25 | 26 | int updateByExampleSelective(@Param("record") Traininfo record, @Param("example") TraininfoExample example); 27 | 28 | int updateByExample(@Param("record") Traininfo record, @Param("example") TraininfoExample example); 29 | 30 | int updateByPrimaryKeySelective(Traininfo record); 31 | 32 | int updateByPrimaryKey(Traininfo record); 33 | 34 | List selectTrainInfo(); 35 | 36 | 37 | @Select("select fnum,snum from traininfo where train_id=#{id}") 38 | Traininfo selectSingleTrainInfo(Integer id); 39 | 40 | List selectTrainInfoByIdlist(List idlist); 41 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/TraininfosMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Traininfos; 4 | import com.lemon.train.entity.TraininfosExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TraininfosMapper { 10 | long countByExample(TraininfosExample example); 11 | 12 | int deleteByExample(TraininfosExample example); 13 | 14 | int insert(Traininfos record); 15 | 16 | int insertSelective(Traininfos record); 17 | 18 | List selectByExample(TraininfosExample example); 19 | 20 | int updateByExampleSelective(@Param("record") Traininfos record, @Param("example") TraininfosExample example); 21 | 22 | int updateByExample(@Param("record") Traininfos record, @Param("example") TraininfosExample example); 23 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/TrainseatMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Trainseat; 4 | import com.lemon.train.entity.TrainseatExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TrainseatMapper { 10 | long countByExample(TrainseatExample example); 11 | 12 | int deleteByExample(TrainseatExample example); 13 | 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | int insert(Trainseat record); 17 | 18 | int insertSelective(Trainseat record); 19 | 20 | List selectByExample(TrainseatExample example); 21 | 22 | Trainseat selectByPrimaryKey(Integer id); 23 | 24 | int updateByExampleSelective(@Param("record") Trainseat record, @Param("example") TrainseatExample example); 25 | 26 | int updateByExample(@Param("record") Trainseat record, @Param("example") TrainseatExample example); 27 | 28 | int updateByPrimaryKeySelective(Trainseat record); 29 | 30 | int updateByPrimaryKey(Trainseat record); 31 | 32 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/TrainstateMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Trainstate; 4 | import com.lemon.train.entity.TrainstateExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface TrainstateMapper { 10 | long countByExample(TrainstateExample example); 11 | 12 | int deleteByExample(TrainstateExample example); 13 | 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | int insert(Trainstate record); 17 | 18 | int insertSelective(Trainstate record); 19 | 20 | List selectByExample(TrainstateExample example); 21 | 22 | Trainstate selectByPrimaryKey(Integer id); 23 | 24 | int updateByExampleSelective(@Param("record") Trainstate record, @Param("example") TrainstateExample example); 25 | 26 | int updateByExample(@Param("record") Trainstate record, @Param("example") TrainstateExample example); 27 | 28 | int updateByPrimaryKeySelective(Trainstate record); 29 | 30 | int updateByPrimaryKey(Trainstate record); 31 | 32 | 33 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/TrainticketMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Trainticket; 4 | import com.lemon.train.entity.TrainticketExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | public interface TrainticketMapper { 11 | long countByExample(TrainticketExample example); 12 | 13 | int deleteByExample(TrainticketExample example); 14 | 15 | int deleteByPrimaryKey(Integer id); 16 | 17 | int insert(Trainticket record); 18 | 19 | int insertSelective(Trainticket record); 20 | 21 | List selectByExample(TrainticketExample example); 22 | 23 | Trainticket selectByPrimaryKey(Integer id); 24 | 25 | int updateByExampleSelective(@Param("record") Trainticket record, @Param("example") TrainticketExample example); 26 | 27 | int updateByExample(@Param("record") Trainticket record, @Param("example") TrainticketExample example); 28 | 29 | int updateByPrimaryKeySelective(Trainticket record); 30 | 31 | int updateByPrimaryKey(Trainticket record); 32 | 33 | int insertDepartTrain(@Param("id") Integer id, @Param("traindate") Date traindate); 34 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.mapper; 2 | 3 | import com.lemon.train.entity.Passenger; 4 | import com.lemon.train.entity.User; 5 | import com.lemon.train.entity.UserExample; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Result; 8 | import org.apache.ibatis.annotations.Results; 9 | import org.apache.ibatis.annotations.Select; 10 | 11 | import java.util.List; 12 | 13 | public interface UserMapper { 14 | long countByExample(UserExample example); 15 | 16 | int deleteByExample(UserExample example); 17 | 18 | int deleteByPrimaryKey(Integer id); 19 | 20 | int insert(User record); 21 | 22 | int insertSelective(User record); 23 | 24 | List selectByExample(UserExample example); 25 | 26 | User selectByPrimaryKey(Integer id); 27 | 28 | int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); 29 | 30 | int updateByExample(@Param("record") User record, @Param("example") UserExample example); 31 | 32 | int updateByPrimaryKeySelective(User record); 33 | 34 | int updateByPrimaryKey(User record); 35 | 36 | 37 | 38 | @Select("select * from user where username=#{username}") 39 | User queryByUsername(String username); 40 | 41 | @Select("select user_id,name,type,idcard from passenger where userrelation_id=#{userid}") 42 | @Results({ 43 | @Result(property = "id",column = "user_id") 44 | }) 45 | List queryPassenger(String userid); 46 | 47 | 48 | @Select("select * from user where status=#{condition}") 49 | List selectByCondition(String condition); 50 | 51 | @Select("select * from user where status<>#{condition}") 52 | List selectByCondition1(String condition); 53 | 54 | @Select("select * from user where idcard=#{idcard} limit 1") 55 | User selectUserByOtherCondition(String idcard); 56 | /** 57 | * 管理员登录 58 | * @param username 59 | * @return 60 | */ 61 | @Select("select password from admin where username=#{username} limit 1") 62 | String selectAdminPassword(String username); 63 | } -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Orderinfo; 5 | import com.lemon.train.entity.Orders; 6 | 7 | import java.util.Date; 8 | 9 | public interface OrderService { 10 | ResponseResult submitOrder(Orders orders); 11 | 12 | ResponseResult queryOrders(Integer orderId); 13 | 14 | ResponseResult getDetailOrder(Integer id); 15 | 16 | ResponseResult deleteOrder(Orderinfo orderinfo); 17 | 18 | ResponseResult delOrder(Integer id); 19 | 20 | ResponseResult changeTicket(int trainid, Date date, int orderid); 21 | } 22 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/service/PriceManageService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Holiday; 5 | import com.lemon.train.entity.Pricemanage; 6 | 7 | import java.text.ParseException; 8 | import java.util.Date; 9 | 10 | public interface PriceManageService { 11 | 12 | ResponseResult getDiscount(); 13 | 14 | ResponseResult updateDiscount(Pricemanage priceManage); 15 | 16 | ResponseResult postSingleHoliday(Holiday holiday); 17 | 18 | ResponseResult postMultipleHoliday(Date start, Date end, int status) throws ParseException; 19 | 20 | ResponseResult getTodayTotalPrice(Date odate); 21 | } 22 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/service/TrainService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.Traininfos; 5 | 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | 10 | public interface TrainService { 11 | ResponseResult trainTicketQuery(String startcity, String endcity, Date traindate,Integer traintype); 12 | 13 | ResponseResult addTrain(Traininfos traininfos); 14 | 15 | ResponseResult queryTrains(); 16 | 17 | ResponseResult departTrain(Integer id,Date traindate); 18 | 19 | ResponseResult departTrainsSelective(List idlist, Date traindate); 20 | 21 | ResponseResult holidayDiscount(Date date); 22 | } 23 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service; 2 | 3 | import com.lemon.train.common.ResponseResult; 4 | import com.lemon.train.entity.User; 5 | 6 | public interface UserService { 7 | 8 | ResponseResult userLogin(String username, String password); 9 | 10 | ResponseResult userRegister(User user); 11 | 12 | ResponseResult queryPassenger(String id); 13 | 14 | ResponseResult queryAllUser(Integer pagenum,String condition, Integer pagesize); 15 | 16 | ResponseResult putUser(User user); 17 | 18 | ResponseResult vagueUsers(String realname); 19 | 20 | ResponseResult adminLogin(String username, String password); 21 | } 22 | -------------------------------------------------------------------------------- /train/train/src/main/java/com/lemon/train/service/impl/PriceManageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train.service.impl; 2 | 3 | 4 | import com.lemon.train.common.ResponseResult; 5 | import com.lemon.train.common.TimeHandle; 6 | import com.lemon.train.entity.Holiday; 7 | import com.lemon.train.entity.Pricemanage; 8 | import com.lemon.train.mapper.HolidayMapper; 9 | import com.lemon.train.service.PriceManageService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import java.text.ParseException; 15 | import java.util.*; 16 | 17 | @Service 18 | public class PriceManageServiceImpl implements PriceManageService { 19 | @Autowired 20 | HolidayMapper holidayMapper; 21 | 22 | @Override 23 | public ResponseResult getDiscount() { 24 | Pricemanage priceManage = holidayMapper.getDiscount(); 25 | return new ResponseResult(200,"sucess",priceManage); 26 | } 27 | 28 | @Override 29 | public ResponseResult updateDiscount(Pricemanage priceManage) { 30 | priceManage.setId(1); 31 | System.out.println(priceManage); 32 | holidayMapper.updateDiscountById(priceManage); 33 | return new ResponseResult(200,"suceess",null); 34 | } 35 | 36 | @Override 37 | public ResponseResult postSingleHoliday(Holiday holiday) { 38 | int i = holidayMapper.insert(holiday); 39 | if(i==0){ 40 | return new ResponseResult(400,"fail",400); 41 | } 42 | return new ResponseResult(200,"secuss",200); 43 | } 44 | 45 | @Override 46 | @Transactional 47 | public ResponseResult postMultipleHoliday(Date start, Date end, int status) throws ParseException { 48 | 49 | int interval = TimeHandle.getDayDiffer(start,end); 50 | Date date = start; 51 | Holiday holiday = new Holiday(); 52 | holiday.setStatus(status); 53 | holiday.setVacation(start); 54 | int result = holidayMapper.insert(holiday); 55 | Calendar calendar = new GregorianCalendar(); 56 | for (int i = 0; i < interval; i++) { 57 | calendar.setTime(date); 58 | calendar.add(Calendar.DATE,1); 59 | date=calendar.getTime(); 60 | holiday.setVacation(date); 61 | holidayMapper.insert(holiday); 62 | } 63 | 64 | return new ResponseResult(200,"success",null); 65 | } 66 | 67 | /** 68 | * 统计当天成交额 69 | * @param traindates 70 | * @return 71 | */ 72 | @Override 73 | public ResponseResult getTodayTotalPrice(Date traindates) { 74 | Map map = new HashMap<>(16); 75 | map.put("traindates",traindates); 76 | holidayMapper.getToalPrice(map); 77 | return new ResponseResult(200,"success",map.get("totalprice")); 78 | } 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /train/train/src/main/resources/1.txt: -------------------------------------------------------------------------------- 1 | 301登录失败 2 | 302已被注册 3 | 501票已卖完 4 | 303用户未审核 5 | 400失败 6 | 7 | 8 | 订单表 9 | status 10 | 1表示未付款 11 | 2表示待出行 12 | 3表示已出行 13 | 4表示已退款 14 | 5表示已改签 -------------------------------------------------------------------------------- /train/train/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | spring: 4 | #数据库连接配置 5 | datasource: 6 | driver-class-name: com.mysql.cj.jdbc.Driver 7 | url: jdbc:mysql://localhost:3306/train?serverTimezone=Asia/Shanghai 8 | username: root 9 | password: root 10 | #mybatis的相关配置 11 | jackson: 12 | time-zone: GMT+8 13 | mybatis: 14 | #mapper配置文件 15 | mapper-locations: classpath:mapper/*.xml 16 | type-aliases-package: com.zhg.demo.mybatis.entity 17 | #开启驼峰命名 18 | configuration: 19 | map-underscore-to-camel-case: true 20 | 21 | #pagehelper分页插件配置 22 | pagehelper: 23 | helperDialect: mysql 24 | -------------------------------------------------------------------------------- /train/train/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////// 2 | // _ooOoo_ // 3 | // o8888888o // 4 | // 88" . "88 // 5 | // (| ^_^ |) // 6 | // O\ = /O // 7 | // ____/`---'\____ // 8 | // .' \\| |// `. // 9 | // / \\||| : |||// \ // 10 | // / _||||| -:- |||||- \ // 11 | // | | \\\ - /// | | // 12 | // | \_| ''\---/'' | | // 13 | // \ .-\__ `-` ___/-. / // 14 | // ___`. .' /--.--\ `. . ___ // 15 | // ."" '< `.___\_<|>_/___.' >'"". // 16 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // 17 | // \ \ `-. \_ __\ /__ _/ .-` / / // 18 | // ========`-.____`-.___\_____/___.-`____.-'======== // 19 | // `=---=' // 20 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // 21 | // 佛祖保佑 永不宕机 永无BUG // 22 | //////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /train/train/src/test/java/com/lemon/train/DateTimeTest.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | 4 | import com.lemon.train.common.TimeHandle; 5 | import org.junit.jupiter.api.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | 9 | import java.text.SimpleDateFormat; 10 | import java.util.Calendar; 11 | import java.util.Date; 12 | import java.util.GregorianCalendar; 13 | 14 | @SpringBootTest 15 | public class DateTimeTest { 16 | 17 | @Autowired 18 | TimeHandle timeHandle; 19 | 20 | @Test 21 | public void test1(){ 22 | Date date = new Date(); 23 | SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 24 | System.out.println(dateFormat.format(date)); 25 | } 26 | 27 | @Test 28 | public void test2(){ 29 | Date date=new Date(); //取时间 30 | System.out.println(date); 31 | Calendar calendar = new GregorianCalendar(); 32 | calendar.setTime(date); 33 | calendar.add(calendar.DATE,1); //把日期往后增加一天,整数 往后推,负数往前移动 34 | date=calendar.getTime(); //这个时间就是日期往后推一天的结果 35 | System.out.println(date); 36 | } 37 | 38 | @Test 39 | public void test3(){ 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /train/train/src/test/java/com/lemon/train/TrainApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class TrainApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /train/train/src/test/java/com/lemon/train/traintest.java: -------------------------------------------------------------------------------- 1 | package com.lemon.train; 2 | 3 | import com.lemon.train.mapper.HolidayMapper; 4 | import com.lemon.train.service.TrainService; 5 | import org.junit.jupiter.api.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | 9 | import java.text.ParseException; 10 | import java.text.SimpleDateFormat; 11 | import java.util.Calendar; 12 | import java.util.Date; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | @SpringBootTest 17 | public class traintest { 18 | @Autowired 19 | TrainService trainService; 20 | @Autowired 21 | HolidayMapper holidayMapper; 22 | @Test 23 | public void trainTest1(){ 24 | trainService.queryTrains(); 25 | } 26 | 27 | @Test 28 | public void traintest2() throws ParseException { 29 | Map map = new HashMap(); 30 | map.put("status",3); 31 | //map.put("discount",2); 32 | double k = holidayMapper.getSpecialDiscount(map); 33 | System.out.println(k); 34 | String traindate = "2020-06-05"; 35 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd"); 36 | Date date = formatter.parse(traindate); 37 | Calendar cal = Calendar.getInstance(); 38 | cal.setTime(date); 39 | System.out.println(cal.get(Calendar.DAY_OF_WEEK)); 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /vue-manage-system/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 4 | -------------------------------------------------------------------------------- /vue-manage-system/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | example.html 5 | favicon.ico 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw* 23 | -------------------------------------------------------------------------------- /vue-manage-system/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "printWidth": 140 6 | } -------------------------------------------------------------------------------- /vue-manage-system/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2019 vue-manage-system 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vue-manage-system/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /vue-manage-system/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-manage-system", 3 | "version": "4.2.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "npm run serve", 7 | "serve": "vue-cli-service serve", 8 | "build": "vue-cli-service build" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.18.0", 12 | "babel-polyfill": "^6.26.0", 13 | "element-ui": "^2.11.0", 14 | "mavon-editor": "^2.6.17", 15 | "vue": "^2.6.10", 16 | "vue-cropperjs": "^3.0.0", 17 | "vue-i18n": "^8.10.0", 18 | "vue-quill-editor": "^3.0.6", 19 | "vue-router": "^3.0.3", 20 | "vue-schart": "^2.0.0", 21 | "vuedraggable": "^2.17.0" 22 | }, 23 | "devDependencies": { 24 | "@vue/cli-plugin-babel": "^3.9.0", 25 | "@vue/cli-service": "^3.9.0", 26 | "vue-template-compiler": "^2.6.10" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vue-manage-system/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /vue-manage-system/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-manage-system 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /vue-manage-system/public/table.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [{ 3 | "id": 1, 4 | "name": "张三", 5 | "money": 123, 6 | "address": "广东省东莞市长安镇", 7 | "state": "成功", 8 | "date": "2019-11-1", 9 | "thumb": "https://lin-xin.gitee.io/images/post/wms.png" 10 | }, 11 | { 12 | "id": 2, 13 | "name": "李四", 14 | "money": 456, 15 | "address": "广东省广州市白云区", 16 | "state": "成功", 17 | "date": "2019-10-11", 18 | "thumb": "https://lin-xin.gitee.io/images/post/node3.png" 19 | }, 20 | { 21 | "id": 3, 22 | "name": "王五", 23 | "money": 789, 24 | "address": "湖南省长沙市", 25 | "state": "失败", 26 | "date": "2019-11-11", 27 | "thumb": "https://lin-xin.gitee.io/images/post/parcel.png" 28 | }, 29 | { 30 | "id": 4, 31 | "name": "赵六", 32 | "money": 1011, 33 | "address": "福建省厦门市鼓浪屿", 34 | "state": "成功", 35 | "date": "2019-10-20", 36 | "thumb": "https://lin-xin.gitee.io/images/post/notice.png" 37 | } 38 | ], 39 | "pageTotal": 4 40 | } -------------------------------------------------------------------------------- /vue-manage-system/screenshots/wms1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/screenshots/wms1.png -------------------------------------------------------------------------------- /vue-manage-system/screenshots/wms2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/screenshots/wms2.png -------------------------------------------------------------------------------- /vue-manage-system/screenshots/wms3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/screenshots/wms3.png -------------------------------------------------------------------------------- /vue-manage-system/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /vue-manage-system/src/api/index.js: -------------------------------------------------------------------------------- 1 | import request from '../utils/request'; 2 | import service from '../utils/request'; 3 | import qs from 'qs' 4 | export const fetchData = query => { 5 | return request({ 6 | url: './table.json', 7 | method: 'get', 8 | params: query 9 | }); 10 | }; 11 | 12 | /** 13 | * 封装get方法 14 | * @param url 15 | * @param data 16 | * @returns {Promise} 17 | */ 18 | export function fetch(url, params = {}) { 19 | return new Promise((resolve, reject) => { 20 | request.get(url, { 21 | params: params 22 | }) 23 | .then(response => { 24 | resolve(response.data); 25 | }) 26 | .catch(err => { 27 | reject(err) 28 | }) 29 | }) 30 | } 31 | 32 | 33 | /** 34 | * 封装post请求 35 | * @param url 36 | * @param data 37 | * @returns {Promise} 38 | */ 39 | export function post(url, data = {}) { 40 | return new Promise((resolve, reject) => { 41 | service.post(url, data) 42 | .then(response => { 43 | resolve(response.data); 44 | }, err => { 45 | reject(err) 46 | }) 47 | }) 48 | } 49 | 50 | /** 51 | * 封装patch请求 52 | * @param url 53 | * @param data 54 | * @returns {Promise} 55 | */ 56 | export function patch(url, data = {}) { 57 | return new Promise((resolve, reject) => { 58 | axios.patch(url, data) 59 | .then(response => { 60 | resolve(response.data); 61 | }, err => { 62 | reject(err) 63 | }) 64 | }) 65 | } 66 | 67 | /** 68 | * 封装put请求 69 | * @param url 70 | * @param data 71 | * @returns {Promise} 72 | */ 73 | export function put(url, data = {}) { 74 | return new Promise((resolve, reject) => { 75 | service.put(url, data) 76 | .then(response => { 77 | resolve(response.data); 78 | }, err => { 79 | reject(err) 80 | }) 81 | }) 82 | } -------------------------------------------------------------------------------- /vue-manage-system/src/assets/404_images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/404_images/404.png -------------------------------------------------------------------------------- /vue-manage-system/src/assets/404_images/404_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/404_images/404_cloud.png -------------------------------------------------------------------------------- /vue-manage-system/src/assets/css/color-dark.css: -------------------------------------------------------------------------------- 1 | .header{ 2 | background-color: #242f42; 3 | } 4 | .login-wrap{ 5 | background: #324157; 6 | } 7 | .plugins-tips{ 8 | background: #eef1f6; 9 | } 10 | .plugins-tips a{ 11 | color: #20a0ff; 12 | } 13 | .el-upload--text em { 14 | color: #20a0ff; 15 | } 16 | .pure-button{ 17 | background: #20a0ff; 18 | } 19 | .tags-li.active { 20 | border: 1px solid #409EFF; 21 | background-color: #409EFF; 22 | } 23 | .message-title{ 24 | color: #20a0ff; 25 | } 26 | .collapse-btn:hover{ 27 | background: rgb(40,52,70); 28 | } -------------------------------------------------------------------------------- /vue-manage-system/src/assets/css/icon.css: -------------------------------------------------------------------------------- 1 | 2 | [class*=" el-icon-lx"], [class^=el-icon-lx] { 3 | font-family: lx-iconfont!important; 4 | } -------------------------------------------------------------------------------- /vue-manage-system/src/assets/css/main.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | html, 7 | body, 8 | #app, 9 | .wrapper { 10 | width: 100%; 11 | height: 100%; 12 | overflow: hidden; 13 | } 14 | 15 | body { 16 | font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif; 17 | } 18 | 19 | a { 20 | text-decoration: none 21 | } 22 | 23 | 24 | .content-box { 25 | position: absolute; 26 | left: 250px; 27 | right: 0; 28 | top: 70px; 29 | bottom: 0; 30 | padding-bottom: 30px; 31 | -webkit-transition: left .3s ease-in-out; 32 | transition: left .3s ease-in-out; 33 | background: #f0f0f0; 34 | } 35 | 36 | .content { 37 | width: auto; 38 | height: 100%; 39 | padding: 10px; 40 | overflow-y: scroll; 41 | box-sizing: border-box; 42 | } 43 | 44 | .content-collapse { 45 | left: 65px; 46 | } 47 | 48 | .container { 49 | padding: 30px; 50 | background: #fff; 51 | border: 1px solid #ddd; 52 | border-radius: 5px; 53 | } 54 | 55 | .crumbs { 56 | margin: 10px 0; 57 | } 58 | 59 | .el-table th { 60 | background-color: #f5f7fa !important; 61 | } 62 | 63 | .pagination { 64 | margin: 20px 0; 65 | text-align: right; 66 | } 67 | 68 | .plugins-tips { 69 | padding: 20px 10px; 70 | margin-bottom: 20px; 71 | } 72 | 73 | .el-button+.el-tooltip { 74 | margin-left: 10px; 75 | } 76 | 77 | .el-table tr:hover { 78 | background: #f6faff; 79 | } 80 | 81 | .mgb20 { 82 | margin-bottom: 20px; 83 | } 84 | 85 | .move-enter-active, 86 | .move-leave-active { 87 | transition: opacity .5s; 88 | } 89 | 90 | .move-enter, 91 | .move-leave { 92 | opacity: 0; 93 | } 94 | 95 | /*BaseForm*/ 96 | 97 | .form-box { 98 | width: 600px; 99 | } 100 | 101 | .form-box .line { 102 | text-align: center; 103 | } 104 | 105 | .el-time-panel__content::after, 106 | .el-time-panel__content::before { 107 | margin-top: -7px; 108 | } 109 | 110 | .el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) { 111 | padding-bottom: 0; 112 | } 113 | 114 | /*Upload*/ 115 | 116 | .pure-button { 117 | width: 150px; 118 | height: 40px; 119 | line-height: 40px; 120 | text-align: center; 121 | color: #fff; 122 | border-radius: 3px; 123 | } 124 | 125 | .g-core-image-corp-container .info-aside { 126 | height: 45px; 127 | } 128 | 129 | .el-upload--text { 130 | background-color: #fff; 131 | border: 1px dashed #d9d9d9; 132 | border-radius: 6px; 133 | box-sizing: border-box; 134 | width: 360px; 135 | height: 180px; 136 | text-align: center; 137 | cursor: pointer; 138 | position: relative; 139 | overflow: hidden; 140 | } 141 | 142 | .el-upload--text .el-icon-upload { 143 | font-size: 67px; 144 | color: #97a8be; 145 | margin: 40px 0 16px; 146 | line-height: 50px; 147 | } 148 | 149 | .el-upload--text { 150 | color: #97a8be; 151 | font-size: 14px; 152 | text-align: center; 153 | } 154 | 155 | .el-upload--text em { 156 | font-style: normal; 157 | } 158 | 159 | /*VueEditor*/ 160 | 161 | .ql-container { 162 | min-height: 400px; 163 | } 164 | 165 | .ql-snow .ql-tooltip { 166 | transform: translateX(117.5px) translateY(10px) !important; 167 | } 168 | 169 | .editor-btn { 170 | margin-top: 20px; 171 | } 172 | 173 | /*markdown*/ 174 | 175 | .v-note-wrapper .v-note-panel { 176 | min-height: 500px; 177 | } -------------------------------------------------------------------------------- /vue-manage-system/src/assets/css/theme-green/color-green.css: -------------------------------------------------------------------------------- 1 | .header{ 2 | background-color: #07c4a8; 3 | } 4 | .login-wrap{ 5 | background: rgba(56, 157, 170, 0.82);; 6 | } 7 | .plugins-tips{ 8 | background: #f2f2f2; 9 | } 10 | .plugins-tips a{ 11 | color: #00d1b2; 12 | } 13 | .el-upload--text em { 14 | color: #00d1b2; 15 | } 16 | .pure-button{ 17 | background: #00d1b2; 18 | } 19 | .pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus { 20 | background-color: #00d1b2 !important; 21 | border-color: #00d1b2 !important; 22 | } 23 | .tags-li.active { 24 | border: 1px solid #00d1b2; 25 | background-color: #00d1b2; 26 | } 27 | .collapse-btn:hover{ 28 | background: #00d1b2; 29 | } -------------------------------------------------------------------------------- /vue-manage-system/src/assets/css/theme-green/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/css/theme-green/fonts/element-icons.ttf -------------------------------------------------------------------------------- /vue-manage-system/src/assets/css/theme-green/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/css/theme-green/fonts/element-icons.woff -------------------------------------------------------------------------------- /vue-manage-system/src/assets/img/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/img/img.jpg -------------------------------------------------------------------------------- /vue-manage-system/src/assets/img/login-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/img/login-bg.jpg -------------------------------------------------------------------------------- /vue-manage-system/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LXT2017/TrainTicketSystem/f10e2cc84327d6779a505cbce6642a380f4f6bce/vue-manage-system/src/assets/logo.png -------------------------------------------------------------------------------- /vue-manage-system/src/components/common/Home.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 52 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/common/bus.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | // 使用 Event Bus 4 | const bus = new Vue(); 5 | 6 | export default bus; -------------------------------------------------------------------------------- /vue-manage-system/src/components/common/directives.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | // v-dialogDrag: 弹窗拖拽属性 4 | Vue.directive('dialogDrag', { 5 | bind(el, binding, vnode, oldVnode) { 6 | const dialogHeaderEl = el.querySelector('.el-dialog__header'); 7 | const dragDom = el.querySelector('.el-dialog'); 8 | 9 | dialogHeaderEl.style.cssText += ';cursor:move;' 10 | dragDom.style.cssText += ';top:0px;' 11 | 12 | // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); 13 | const sty = (() => { 14 | if (window.document.currentStyle) { 15 | return (dom, attr) => dom.currentStyle[attr]; 16 | } else { 17 | return (dom, attr) => getComputedStyle(dom, false)[attr]; 18 | } 19 | })() 20 | 21 | dialogHeaderEl.onmousedown = (e) => { 22 | // 鼠标按下,计算当前元素距离可视区的距离 23 | const disX = e.clientX - dialogHeaderEl.offsetLeft; 24 | const disY = e.clientY - dialogHeaderEl.offsetTop; 25 | 26 | const screenWidth = document.body.clientWidth; // body当前宽度 27 | const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取) 28 | 29 | const dragDomWidth = dragDom.offsetWidth; // 对话框宽度 30 | const dragDomheight = dragDom.offsetHeight; // 对话框高度 31 | 32 | const minDragDomLeft = dragDom.offsetLeft; 33 | const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth; 34 | 35 | const minDragDomTop = dragDom.offsetTop; 36 | const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight; 37 | 38 | 39 | // 获取到的值带px 正则匹配替换 40 | let styL = sty(dragDom, 'left'); 41 | let styT = sty(dragDom, 'top'); 42 | 43 | // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px 44 | if (styL.includes('%')) { 45 | styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100); 46 | styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100); 47 | } else { 48 | styL = +styL.replace(/\px/g, ''); 49 | styT = +styT.replace(/\px/g, ''); 50 | }; 51 | 52 | document.onmousemove = function (e) { 53 | // 通过事件委托,计算移动的距离 54 | let left = e.clientX - disX; 55 | let top = e.clientY - disY; 56 | 57 | // 边界处理 58 | if (-(left) > minDragDomLeft) { 59 | left = -(minDragDomLeft); 60 | } else if (left > maxDragDomLeft) { 61 | left = maxDragDomLeft; 62 | } 63 | 64 | if (-(top) > minDragDomTop) { 65 | top = -(minDragDomTop); 66 | } else if (top > maxDragDomTop) { 67 | top = maxDragDomTop; 68 | } 69 | 70 | // 移动当前元素 71 | dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`; 72 | }; 73 | 74 | document.onmouseup = function (e) { 75 | document.onmousemove = null; 76 | document.onmouseup = null; 77 | }; 78 | } 79 | } 80 | }) 81 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/common/i18n.js: -------------------------------------------------------------------------------- 1 | export const messages = { 2 | 'zh': { 3 | i18n: { 4 | breadcrumb: '国际化产品', 5 | tips: '通过切换语言按钮,来改变当前内容的语言。', 6 | btn: '切换英文', 7 | title1: '常用用法', 8 | p1: '要是你把你的秘密告诉了风,那就别怪风把它带给树。', 9 | p2: '没有什么比信念更能支撑我们度过艰难的时光了。', 10 | p3: '只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。', 11 | title2: '组件插值', 12 | info: 'Element组件需要国际化,请参考 {action}。', 13 | value: '文档' 14 | } 15 | }, 16 | 'en': { 17 | i18n: { 18 | breadcrumb: 'International Products', 19 | tips: 'Click on the button to change the current language. ', 20 | btn: 'Switch Chinese', 21 | title1: 'Common usage', 22 | p1: "If you reveal your secrets to the wind you should not blame the wind for revealing them to the trees.", 23 | p2: "Nothing can help us endure dark times better than our faith. ", 24 | p3: "If you can do what you do best and be happy, you're further along in life than most people.", 25 | title2: 'Component interpolation', 26 | info: 'The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.', 27 | value: 'documentation' 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/403.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 23 | 24 | 25 | 57 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/404.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 23 | 24 | 25 | 57 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/Donate.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 22 | 23 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/DragDialog.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 33 | 34 | 37 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/I18n.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 35 | 36 | 47 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/Markdown.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 63 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/Permission.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | -------------------------------------------------------------------------------- /vue-manage-system/src/components/page/VueEditor.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 49 | -------------------------------------------------------------------------------- /vue-manage-system/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 VueI18n from 'vue-i18n'; 6 | import { messages } from './components/common/i18n'; 7 | import 'element-ui/lib/theme-chalk/index.css'; // 默认主题 8 | // import './assets/css/theme-green/index.css'; // 浅绿色主题 9 | import './assets/css/icon.css'; 10 | import './components/common/directives'; 11 | import 'babel-polyfill'; 12 | import qs from 'qs' 13 | Vue.use(qs) 14 | Vue.prototype.$qs = qs 15 | Vue.config.productionTip = false; 16 | Vue.use(VueI18n); 17 | Vue.use(ElementUI, { 18 | size: 'small' 19 | }); 20 | const i18n = new VueI18n({ 21 | locale: 'zh', 22 | messages 23 | }); 24 | 25 | //使用钩子函数对路由进行权限跳转 26 | router.beforeEach((to, from, next) => { 27 | document.title = `${to.meta.title} | vue-manage-system`; 28 | const role = localStorage.getItem('ms_username'); 29 | if (!role && to.path !== '/login') { 30 | next('/login'); 31 | } else if (to.meta.permission) { 32 | // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已 33 | role === 'admin' ? next() : next('/403'); 34 | } else { 35 | // 简单的判断IE10及以下不进入富文本编辑器,该组件不兼容 36 | if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') { 37 | Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器,请使用更高版本的浏览器查看', '浏览器不兼容通知', { 38 | confirmButtonText: '确定' 39 | }); 40 | } else { 41 | next(); 42 | } 43 | } 44 | }); 45 | 46 | new Vue({ 47 | router, 48 | i18n, 49 | render: h => h(App) 50 | }).$mount('#app'); -------------------------------------------------------------------------------- /vue-manage-system/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | 4 | Vue.use(Router); 5 | 6 | export default new Router({ 7 | routes: [{ 8 | path: '/', 9 | redirect: '/dashboard' 10 | }, 11 | { 12 | path: '/', 13 | component: () => 14 | import ( /* webpackChunkName: "home" */ '../components/common/Home.vue'), 15 | meta: { title: '自述文件' }, 16 | children: [{ 17 | path: '/dashboard', 18 | component: () => 19 | import ( /* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'), 20 | meta: { title: '系统首页' } 21 | }, 22 | { 23 | path: '/table', 24 | component: () => 25 | import ( /* webpackChunkName: "table" */ '../components/page/BaseTable.vue'), 26 | meta: { title: '用户管理' } 27 | }, 28 | { 29 | path: '/tabs', 30 | component: () => 31 | import ( /* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'), 32 | meta: { title: '消息通知' } 33 | }, 34 | { 35 | path: '/addtrain', 36 | component: () => 37 | import ( /* webpackChunkName: "form" */ '../components/page/AddTrain.vue'), 38 | meta: { title: '火车添加' } 39 | }, 40 | { 41 | path: '/departtrain', 42 | component: () => 43 | import ( /* webpackChunkName: "form" */ '../components/page/DepartTrain.vue'), 44 | meta: { title: '火车车次发布' } 45 | }, 46 | { 47 | path: '/pricemanage', 48 | component: () => 49 | import ( /* webpackChunkName: "form" */ '../components/page/PriceManage.vue'), 50 | meta: { title: '车票价格管理' } 51 | }, 52 | 53 | { 54 | path: '/404', 55 | component: () => 56 | import ( /* webpackChunkName: "404" */ '../components/page/404.vue'), 57 | meta: { title: '404' } 58 | }, 59 | { 60 | path: '/403', 61 | component: () => 62 | import ( /* webpackChunkName: "403" */ '../components/page/403.vue'), 63 | meta: { title: '403' } 64 | }, 65 | ] 66 | }, 67 | { 68 | path: '/login', 69 | component: () => 70 | import ( /* webpackChunkName: "login" */ '../components/page/Login.vue'), 71 | meta: { title: '登录' } 72 | }, 73 | { 74 | path: '*', 75 | redirect: '/404' 76 | } 77 | ] 78 | }); -------------------------------------------------------------------------------- /vue-manage-system/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const service = axios.create({ 4 | // process.env.NODE_ENV === 'development' 来判断是否开发环境 5 | // easy-mock服务挂了,暂时不使用了 6 | // 服务器baseurl 7 | baseURL: 'http://localhost:8081/', 8 | timeout: 5000, 9 | }); 10 | 11 | // 拦截器 12 | service.interceptors.request.use( 13 | config => { 14 | return config; 15 | }, 16 | error => { 17 | console.log(error); 18 | return Promise.reject(); 19 | } 20 | ); 21 | 22 | service.interceptors.response.use( 23 | response => { 24 | if (response.status === 200) { 25 | return response.data; 26 | } else { 27 | Promise.reject(); 28 | } 29 | }, 30 | error => { 31 | console.log(error); 32 | return Promise.reject(); 33 | } 34 | ); 35 | 36 | export default service; -------------------------------------------------------------------------------- /vue-manage-system/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | port: 8887, 4 | open: true 5 | }, 6 | baseUrl: './', 7 | assetsDir: 'static', 8 | productionSourceMap: false, 9 | // devServer: { 10 | // proxy: { 11 | // '/api':{ 12 | // target:'http://jsonplaceholder.typicode.com', 13 | // changeOrigin:true, 14 | // pathRewrite:{ 15 | // '/api':'' 16 | // } 17 | // } 18 | // } 19 | // } 20 | } --------------------------------------------------------------------------------