├── README.md ├── seat.sql ├── springboot ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── example │ │ └── spring_seatreservation │ │ ├── Bean │ │ ├── MyTask.java │ │ ├── MyUser.java │ │ ├── R.java │ │ ├── ReservationCode.java │ │ └── SeatCode.java │ │ ├── Other │ │ ├── DynamicTaskService.java │ │ ├── SignedNumber.java │ │ └── UpPic.java │ │ ├── SpringSeatReservationApplication.java │ │ ├── config │ │ ├── CommonConfig.java │ │ ├── InterceptorConfig.java │ │ └── ThreadPoolTaskExecutorConfig.java │ │ ├── controller │ │ ├── AdminController.java │ │ ├── ForumController.java │ │ ├── PublicController.java │ │ ├── TeacherController.java │ │ └── UserController.java │ │ └── mapper │ │ ├── AdminMapper.java │ │ ├── ForumMapper.java │ │ ├── PublicMapper.java │ │ ├── TeacherMapper.java │ │ └── UserMapper.java │ └── resources │ └── application.yaml └── vue ├── .gitignore ├── README.md ├── mobileseatreservation.iml ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── Guide │ ├── Login.vue │ └── Register.vue ├── admin │ ├── AnnounceManagement.vue │ ├── ForumManagement.vue │ ├── Main.vue │ ├── SeatCrud.vue │ ├── SeatManagement.vue │ ├── SeatNumber.vue │ ├── Statistics.vue │ ├── StudentManagement.vue │ └── TeacherManagement.vue ├── assets │ ├── logo.png │ └── management.png ├── components │ ├── Area.vue │ ├── ChooseArea.vue │ ├── HeadTip.vue │ ├── LeftLayout.vue │ ├── Score.vue │ ├── Seat.vue │ ├── TabLayout.vue │ ├── TimeListCharts.vue │ ├── TimeSlider.vue │ ├── ToggleArea.vue │ ├── UserCounterListCharts.vue │ └── navbar.vue ├── main.js ├── req.js ├── router │ └── index.js ├── teacher │ ├── Main.vue │ ├── ReservationMess.vue │ ├── ScoreManagement.vue │ ├── SeatMess.vue │ └── StudentMess.vue └── user │ ├── BeUse.vue │ ├── Forum.vue │ ├── ForumInfo.vue │ ├── Main.vue │ ├── PushArticle.vue │ ├── Reservation.vue │ ├── ScoreMess.vue │ ├── Seat.vue │ └── ToSigned.vue └── vue.config.js /README.md: -------------------------------------------------------------------------------- 1 | # SpringSeatReservation 2 | 图书馆座位预约系统 3 | vue+springboot 4 | 含移动端、后台管理。代码简单,欢迎star 5 | 6 | |  |  | 7 | | :- | :- | 8 | 9 | 10 | 11 | 12 |  13 |  14 |  15 | -------------------------------------------------------------------------------- /seat.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Ultimate v12.5.1 (64 bit) 3 | MySQL - 5.7.32 : Database - seatreservation 4 | ********************************************************************* 5 | */ 6 | 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | /*!40101 SET SQL_MODE=''*/; 10 | 11 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 12 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 13 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 14 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 15 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`seatreservation` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */; 16 | 17 | USE `seatreservation`; 18 | 19 | /*Table structure for table `announce` */ 20 | 21 | DROP TABLE IF EXISTS `announce`; 22 | 23 | CREATE TABLE `announce` ( 24 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 25 | `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 26 | `content` text COLLATE utf8mb4_unicode_ci, 27 | `datetime` bigint(20) DEFAULT NULL, 28 | PRIMARY KEY (`id`) 29 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 30 | 31 | /*Data for the table `announce` */ 32 | 33 | insert into `announce`(`id`,`title`,`content`,`datetime`) values 34 | (1,'图书馆预约须知','1.图书馆22:30闭馆。\r\n2.用户可在0:00-21:00时间段预约座位,开始时间最早为8:00,最迟预约到22:30。\r\n3.预约开始时间前后半小时可以签到,签到码通过馆内数据大屏查询或询问老师和管理员,超时记为违规并释放座位。\r\n4.暂离图书馆要在60分钟内返回签到,否则座位将被释放,同时记违规使用。',1660171080175), 35 | (2,'馆内文明须知','1、注意仪表,衣冠不整者谢绝入馆。\r\n2、保持馆内安静,请勿喧哗,入馆后请将手机调至振动档。\r\n3、保持馆内清洁卫生,请勿在馆内进食,不随地吐痰、不乱扔纸屑。爱护公共设施,不得涂抹刻画。\r\n4、维护馆内安全,本馆严禁吸烟,严禁携带易燃、易爆物品入内。\r\n5、爱护图书文献,请勿涂写、折页、撕毁书刊,违者将按章罚款。\r\n6、未办理有关手续不得携带书刊、光盘出馆,违者按本馆《书刊保护条例》处理。\r\n7、请讲普通话,请注意文明用语,读者与工作人员互相尊重。\r\n8、读者必须经过大厅磁检门离馆,如遇监测器报警,请配合值班人员的检查。\r\n9、请遵守图书馆的规章制度,做一名文明的读者。',1660171080175); 36 | 37 | /*Table structure for table `area` */ 38 | 39 | DROP TABLE IF EXISTS `area`; 40 | 41 | CREATE TABLE `area` ( 42 | `aid` int(11) NOT NULL AUTO_INCREMENT, 43 | `areaName` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '区域名', 44 | `subName` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '区域缩写', 45 | PRIMARY KEY (`aid`) 46 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 47 | 48 | /*Data for the table `area` */ 49 | 50 | insert into `area`(`aid`,`areaName`,`subName`) values 51 | (1,'一层西阅览区','AW'), 52 | (2,'一层东阅览区','AE'), 53 | (3,'二层西自习区','BW'), 54 | (4,'二层东自习区','BE'), 55 | (5,'三层西自习区','CW'), 56 | (6,'三层东自习区','CE'); 57 | 58 | /*Table structure for table `article` */ 59 | 60 | DROP TABLE IF EXISTS `article`; 61 | 62 | CREATE TABLE `article` ( 63 | `datetime` bigint(20) DEFAULT NULL, 64 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 65 | `content` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 66 | `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 67 | `uid` bigint(20) DEFAULT NULL, 68 | PRIMARY KEY (`id`) 69 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 70 | 71 | /*Data for the table `article` */ 72 | 73 | insert into `article`(`datetime`,`id`,`content`,`title`,`uid`) values 74 | (1660171080175,2,'最近刷了7年的英语真题,有两套错一个 ,两套错三个 10年11年12年都是错四个.也试做了英语一10年的错6个\r\n万能的吧友求教!!!!','英语二10年后平均每套错三个什么水平 等到考试能考多少分?',3), 75 | (1660171080175,3,'材料考本专业 期望院校只要考上国家线就能稳上 哎 不知道还来不来得及有点焦虑 家里人意思是不想考研就准备考事业单位了','现在开始备考能考上国家线吗….英一数二',1), 76 | (1660171080175,4,'本人英语学渣,四级没过,考研目标50分,怎么去复习作文啊,要不要去买晚上的模板啊,背王江涛的作文20篇还是直接背他书上的模板啊?','本人英语学渣,四级没过,考研目标50分,怎么去复习作文啊',3); 77 | 78 | /*Table structure for table `comments` */ 79 | 80 | DROP TABLE IF EXISTS `comments`; 81 | 82 | CREATE TABLE `comments` ( 83 | `cid` bigint(20) NOT NULL AUTO_INCREMENT, 84 | `content` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 85 | `uid` bigint(20) DEFAULT NULL, 86 | `aid` bigint(20) DEFAULT NULL COMMENT '动态id', 87 | `datetime` bigint(20) DEFAULT NULL, 88 | PRIMARY KEY (`cid`) 89 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 90 | 91 | /*Data for the table `comments` */ 92 | 93 | insert into `comments`(`cid`,`content`,`uid`,`aid`,`datetime`) values 94 | (2,'我21届阅读比你还差点最后79,如果22难度的话上80没啥问题吧',1,2,1660175986071), 95 | (3,'这都能上80了吗?,我平均错5个,有时候能错个3个,上个70我就满意了',1,2,1660176005810), 96 | (4,'没啥参考价值,七八十吧',1,2,1660176025848), 97 | (5,'我英一英二那些卷子60分的选择几乎都在55以上,最后82',1,2,1660176036320), 98 | (6,'还行,我一战英二平时也错三个,偶尔错四个或者两个,最后江苏考了76,这个分数讲真的很不满意,因为平时感觉80分十有八九。 你后面作文啥的注意一下哈,新题型保证别错,其他问题不大。',1,2,1660176040474), 99 | (7,'努力吧,我同学大二就说自己出国没问题了,结果英语才考50分',1,4,1660176057495), 100 | (8,'十几年没碰英语,现在复习三月,刷真题英语二最好成绩是17年,客观题拿50分',1,4,1660176085212), 101 | (9,'模板 有需要的发你,去年有同学用了,考的好。',1,4,1660176101546), 102 | (10,'emmm,同学,过不过国家线不是吧友说的算的,加油吧。',1,3,1660176111721); 103 | 104 | /*Table structure for table `reservation` */ 105 | 106 | DROP TABLE IF EXISTS `reservation`; 107 | 108 | CREATE TABLE `reservation` ( 109 | `rid` bigint(20) NOT NULL AUTO_INCREMENT, 110 | `uid` bigint(20) DEFAULT NULL COMMENT '用户id', 111 | `startTime` bigint(20) DEFAULT NULL, 112 | `endTime` bigint(20) DEFAULT NULL, 113 | `sid` bigint(20) DEFAULT NULL COMMENT '座位id', 114 | `state` int(11) DEFAULT '0' COMMENT '0待签到1已签到使用中2未及时签到3暂离4暂离60分钟未签到-1使用完成', 115 | `leaveTime` bigint(20) DEFAULT NULL COMMENT '暂离时间', 116 | `score` int(11) DEFAULT NULL COMMENT '扣多少信用分', 117 | PRIMARY KEY (`rid`) 118 | ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 119 | 120 | /*Data for the table `reservation` */ 121 | 122 | insert into `reservation`(`rid`,`uid`,`startTime`,`endTime`,`sid`,`state`,`leaveTime`,`score`) values 123 | (15,1,1660116600000,1660129024000,100,2,NULL,10), 124 | (16,3,1660116600000,1660129024000,101,2,NULL,NULL), 125 | (17,1,1660183200000,1660221000000,61,-1,1660161142018,NULL), 126 | (18,3,1660185000000,1660215600000,65,2,NULL,NULL), 127 | (19,6,1660190400000,1660219200000,63,-1,NULL,NULL), 128 | (20,9,1660192200000,1660210200000,69,2,NULL,NULL), 129 | (21,10,1660201200000,1660219200000,72,2,NULL,NULL), 130 | (22,10,1660210200000,1660212000000,70,4,1660209524628,NULL), 131 | (24,10,1660212000000,1660213800000,58,-1,NULL,NULL), 132 | (25,10,1660219200000,1660221000000,35,-1,1660218204527,NULL), 133 | (26,1,1659943800000,1659961800000,35,-1,NULL,NULL), 134 | (27,3,1659933000000,1659940200000,100,-1,NULL,NULL), 135 | (28,1,1659832200000,1659839400000,101,-1,NULL,NULL), 136 | (29,10,1659749400000,1659756600000,58,-1,NULL,NULL), 137 | (30,6,1659943800000,1659961800000,35,-1,NULL,NULL), 138 | (31,1,1659943800000,1659961800000,61,-1,NULL,NULL), 139 | (32,1,1659943800000,1659961800000,35,-1,NULL,NULL), 140 | (33,6,1660210200000,1660212000000,70,-1,NULL,NULL), 141 | (34,6,1660226400000,1660226400000,72,-1,NULL,NULL); 142 | 143 | /*Table structure for table `seat` */ 144 | 145 | DROP TABLE IF EXISTS `seat`; 146 | 147 | CREATE TABLE `seat` ( 148 | `sid` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '位置id', 149 | `area` int(11) DEFAULT NULL COMMENT '区域', 150 | `type` int(11) DEFAULT '0' COMMENT '0座位1桌子', 151 | `row` int(11) DEFAULT NULL COMMENT '行', 152 | `column` int(11) DEFAULT NULL COMMENT '列', 153 | `state` int(11) DEFAULT '0' COMMENT '0有座1有约2被使用', 154 | PRIMARY KEY (`sid`) 155 | ) ENGINE=InnoDB AUTO_INCREMENT=671 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 156 | 157 | /*Data for the table `seat` */ 158 | 159 | insert into `seat`(`sid`,`area`,`type`,`row`,`column`,`state`) values 160 | (35,1,0,2,2,0), 161 | (36,1,1,1,2,0), 162 | (37,1,1,1,3,0), 163 | (38,1,1,1,4,0), 164 | (39,1,1,1,5,0), 165 | (40,1,0,2,5,0), 166 | (41,1,0,2,4,0), 167 | (42,1,0,2,3,0), 168 | (46,1,1,9,2,0), 169 | (47,1,1,9,3,0), 170 | (48,1,1,9,4,0), 171 | (49,1,1,9,5,0), 172 | (50,1,0,8,2,0), 173 | (51,1,0,8,3,0), 174 | (52,1,0,8,4,0), 175 | (53,1,0,8,5,0), 176 | (54,1,1,5,2,0), 177 | (55,1,1,5,3,0), 178 | (56,1,1,5,4,0), 179 | (57,1,1,5,5,0), 180 | (58,1,0,4,2,0), 181 | (59,1,0,4,3,0), 182 | (60,1,0,4,4,0), 183 | (61,1,0,4,5,0), 184 | (62,1,0,6,2,0), 185 | (63,1,0,6,3,0), 186 | (64,1,0,6,4,0), 187 | (65,1,0,6,5,0), 188 | (66,1,0,2,8,0), 189 | (67,1,0,3,8,0), 190 | (68,1,0,4,8,0), 191 | (69,1,0,5,8,0), 192 | (70,1,0,6,8,0), 193 | (71,1,0,7,8,0), 194 | (72,1,0,8,8,0), 195 | (73,1,1,2,9,0), 196 | (74,1,1,3,9,0), 197 | (75,1,1,4,9,0), 198 | (76,1,1,5,9,0), 199 | (77,1,1,6,9,0), 200 | (78,1,1,7,9,0), 201 | (79,1,1,8,9,0), 202 | (80,1,0,2,10,0), 203 | (82,1,0,4,10,0), 204 | (83,1,0,5,10,0), 205 | (84,1,0,6,10,0), 206 | (85,1,0,7,10,0), 207 | (86,1,0,8,10,0), 208 | (87,1,0,3,10,0), 209 | (88,1,0,2,13,0), 210 | (96,1,0,1,13,0), 211 | (97,1,1,1,14,0), 212 | (98,1,1,2,14,0), 213 | (99,1,1,1,15,0), 214 | (100,1,1,2,15,0), 215 | (101,1,0,1,16,0), 216 | (102,1,0,2,16,0), 217 | (104,1,1,4,14,0), 218 | (105,1,1,4,15,0), 219 | (106,1,1,5,15,0), 220 | (107,1,1,5,14,0), 221 | (108,1,0,4,13,0), 222 | (109,1,0,5,13,0), 223 | (110,1,0,4,16,0), 224 | (112,1,0,5,16,0), 225 | (113,1,0,8,14,0), 226 | (114,1,0,8,13,0), 227 | (115,1,0,8,15,0), 228 | (116,1,0,8,16,0), 229 | (118,1,1,9,16,0), 230 | (119,1,1,9,15,0), 231 | (120,1,1,9,14,0), 232 | (121,1,1,9,13,0), 233 | (122,1,1,4,20,0), 234 | (123,1,1,4,21,0), 235 | (124,1,1,4,22,0), 236 | (125,1,1,5,22,0), 237 | (126,1,1,5,21,0), 238 | (127,1,1,5,20,0), 239 | (128,1,0,3,19,0), 240 | (129,1,0,3,20,0), 241 | (130,1,0,4,19,0), 242 | (131,1,0,5,19,0), 243 | (132,1,0,6,19,0), 244 | (134,1,0,6,21,0), 245 | (135,1,0,6,22,0), 246 | (136,1,0,3,21,0), 247 | (137,1,0,3,22,0), 248 | (138,1,0,3,23,0), 249 | (139,1,0,4,23,0), 250 | (140,1,0,5,23,0), 251 | (141,1,0,6,23,0), 252 | (144,1,0,6,20,0), 253 | (152,2,0,2,6,0), 254 | (153,2,0,2,7,0), 255 | (154,2,0,2,8,0), 256 | (155,2,0,2,9,0), 257 | (156,2,0,2,10,0), 258 | (157,2,0,2,11,0), 259 | (158,2,0,2,12,0), 260 | (159,2,0,2,13,0), 261 | (160,2,0,2,14,0), 262 | (161,2,0,2,15,0), 263 | (166,2,1,3,6,0), 264 | (167,2,1,3,7,0), 265 | (168,2,1,3,8,0), 266 | (169,2,1,3,9,0), 267 | (170,2,1,3,10,0), 268 | (171,2,1,3,11,0), 269 | (172,2,1,3,12,0), 270 | (173,2,1,3,13,0), 271 | (174,2,1,3,14,0), 272 | (175,2,1,3,15,0), 273 | (180,2,0,4,6,0), 274 | (181,2,0,4,7,0), 275 | (182,2,0,4,8,0), 276 | (183,2,0,4,9,0), 277 | (184,2,0,4,10,0), 278 | (185,2,0,4,11,0), 279 | (186,2,0,4,12,0), 280 | (187,2,0,4,13,0), 281 | (188,2,0,4,14,0), 282 | (189,2,0,4,15,0), 283 | (190,2,0,6,2,0), 284 | (191,2,0,6,3,0), 285 | (192,2,0,6,4,0), 286 | (193,2,0,6,5,0), 287 | (194,2,0,6,6,0), 288 | (195,2,0,6,7,0), 289 | (196,2,0,6,8,0), 290 | (197,2,0,6,9,0), 291 | (198,2,0,6,11,0), 292 | (199,2,0,6,10,0), 293 | (200,2,0,6,12,0), 294 | (201,2,0,6,13,0), 295 | (202,2,0,6,14,0), 296 | (203,2,0,6,15,0), 297 | (204,2,0,8,15,0), 298 | (205,2,0,8,14,0), 299 | (206,2,0,8,13,0), 300 | (207,2,0,8,12,0), 301 | (208,2,0,8,11,0), 302 | (209,2,0,8,10,0), 303 | (210,2,0,8,9,0), 304 | (211,2,0,8,8,0), 305 | (212,2,0,8,7,0), 306 | (213,2,0,8,6,0), 307 | (214,2,0,8,5,0), 308 | (215,2,0,8,4,0), 309 | (216,2,0,8,3,0), 310 | (217,2,0,8,2,0), 311 | (218,2,1,7,2,0), 312 | (219,2,1,7,3,0), 313 | (220,2,1,7,4,0), 314 | (221,2,1,7,5,0), 315 | (222,2,1,7,6,0), 316 | (223,2,1,7,7,0), 317 | (224,2,1,7,8,0), 318 | (225,2,1,7,9,0), 319 | (226,2,1,7,10,0), 320 | (227,2,1,7,11,0), 321 | (228,2,1,7,12,0), 322 | (229,2,1,7,13,0), 323 | (230,2,1,7,14,0), 324 | (231,2,1,7,15,0), 325 | (234,2,0,2,16,0), 326 | (235,2,0,2,17,0), 327 | (237,2,0,2,19,0), 328 | (238,2,0,2,20,0), 329 | (239,2,0,2,21,0), 330 | (240,2,0,2,22,0), 331 | (241,2,0,2,23,0), 332 | (242,2,0,2,24,0), 333 | (243,2,0,4,24,0), 334 | (244,2,0,4,23,0), 335 | (245,2,0,4,22,0), 336 | (246,2,0,4,21,0), 337 | (247,2,0,4,20,0), 338 | (248,2,0,4,19,0), 339 | (249,2,0,4,18,0), 340 | (250,2,0,4,17,0), 341 | (251,2,0,4,16,0), 342 | (252,2,1,3,16,0), 343 | (253,2,1,3,17,0), 344 | (254,2,1,3,18,0), 345 | (255,2,1,3,20,0), 346 | (256,2,1,3,19,0), 347 | (257,2,1,3,21,0), 348 | (258,2,1,3,22,0), 349 | (259,2,1,3,23,0), 350 | (260,2,1,3,24,0), 351 | (261,2,0,2,18,0), 352 | (278,3,1,5,2,0), 353 | (279,3,1,5,3,0), 354 | (280,3,1,5,4,0), 355 | (281,3,1,5,5,0), 356 | (282,3,0,4,2,0), 357 | (283,3,0,4,3,0), 358 | (284,3,0,4,4,0), 359 | (285,3,0,4,5,0), 360 | (286,3,0,6,2,0), 361 | (287,3,0,6,3,0), 362 | (288,3,0,6,4,0), 363 | (289,3,0,6,5,0), 364 | (290,3,0,2,8,0), 365 | (291,3,0,3,8,0), 366 | (292,3,0,4,8,0), 367 | (293,3,0,5,8,0), 368 | (294,3,0,6,8,0), 369 | (295,3,0,7,8,0), 370 | (296,3,0,8,8,0), 371 | (297,3,1,2,9,0), 372 | (298,3,1,3,9,0), 373 | (299,3,1,4,9,0), 374 | (300,3,1,5,9,0), 375 | (301,3,1,6,9,0), 376 | (302,3,1,7,9,0), 377 | (303,3,1,8,9,0), 378 | (304,3,0,2,10,0), 379 | (305,3,0,4,10,0), 380 | (306,3,0,5,10,0), 381 | (307,3,0,6,10,0), 382 | (308,3,0,7,10,0), 383 | (309,3,0,8,10,0), 384 | (310,3,0,3,10,0), 385 | (311,3,0,2,13,0), 386 | (312,3,0,1,13,0), 387 | (313,3,1,1,14,0), 388 | (314,3,1,2,14,0), 389 | (315,3,1,1,15,0), 390 | (316,3,1,2,15,0), 391 | (317,3,0,1,16,0), 392 | (318,3,0,2,16,0), 393 | (319,3,1,4,14,0), 394 | (320,3,1,4,15,0), 395 | (321,3,1,5,15,0), 396 | (322,3,1,5,14,0), 397 | (323,3,0,4,13,0), 398 | (324,3,0,5,13,0), 399 | (325,3,0,4,16,0), 400 | (326,3,0,5,16,0), 401 | (327,3,0,8,14,0), 402 | (328,3,0,8,13,0), 403 | (329,3,0,8,15,0), 404 | (330,3,0,8,16,0), 405 | (331,3,1,9,16,0), 406 | (332,3,1,9,15,0), 407 | (333,3,1,9,14,0), 408 | (334,3,1,9,13,0), 409 | (335,3,1,4,20,0), 410 | (336,3,1,4,21,0), 411 | (337,3,1,4,22,0), 412 | (338,3,1,5,22,0), 413 | (339,3,1,5,21,0), 414 | (340,3,1,5,20,0), 415 | (341,3,0,3,19,0), 416 | (342,3,0,3,20,0), 417 | (343,3,0,4,19,0), 418 | (344,3,0,5,19,0), 419 | (345,3,0,6,19,0), 420 | (346,3,0,6,21,0), 421 | (347,3,0,6,22,0), 422 | (348,3,0,3,21,0), 423 | (349,3,0,3,22,0), 424 | (350,3,0,3,23,0), 425 | (351,3,0,4,23,0), 426 | (352,3,0,5,23,0), 427 | (353,3,0,6,23,0), 428 | (354,3,0,6,20,0), 429 | (355,5,0,2,2,0), 430 | (356,5,1,1,2,0), 431 | (357,5,1,1,3,0), 432 | (358,5,1,1,4,0), 433 | (359,5,1,1,5,0), 434 | (360,5,0,2,5,0), 435 | (361,5,0,2,4,0), 436 | (362,5,0,2,3,0), 437 | (363,5,1,9,2,0), 438 | (364,5,1,9,3,0), 439 | (365,5,1,9,4,0), 440 | (366,5,1,9,5,0), 441 | (367,5,0,8,2,0), 442 | (368,5,0,8,3,0), 443 | (369,5,0,8,4,0), 444 | (370,5,0,8,5,0), 445 | (383,5,0,2,8,0), 446 | (384,5,0,3,8,0), 447 | (385,5,0,4,8,0), 448 | (386,5,0,5,8,0), 449 | (387,5,0,6,8,0), 450 | (388,5,0,7,8,0), 451 | (389,5,0,8,8,0), 452 | (390,5,1,2,9,0), 453 | (391,5,1,3,9,0), 454 | (392,5,1,4,9,0), 455 | (393,5,1,5,9,0), 456 | (394,5,1,6,9,0), 457 | (395,5,1,7,9,0), 458 | (396,5,1,8,9,0), 459 | (397,5,0,2,10,0), 460 | (398,5,0,4,10,0), 461 | (399,5,0,5,10,0), 462 | (400,5,0,6,10,0), 463 | (401,5,0,7,10,0), 464 | (402,5,0,8,10,0), 465 | (403,5,0,3,10,0), 466 | (404,5,0,2,13,0), 467 | (405,5,0,1,13,0), 468 | (406,5,1,1,14,0), 469 | (407,5,1,2,14,0), 470 | (408,5,1,1,15,0), 471 | (409,5,1,2,15,0), 472 | (410,5,0,1,16,0), 473 | (411,5,0,2,16,0), 474 | (412,5,1,4,14,0), 475 | (413,5,1,4,15,0), 476 | (414,5,1,5,15,0), 477 | (415,5,1,5,14,0), 478 | (416,5,0,4,13,0), 479 | (417,5,0,5,13,0), 480 | (418,5,0,4,16,0), 481 | (419,5,0,5,16,0), 482 | (420,5,0,8,14,0), 483 | (421,5,0,8,13,0), 484 | (422,5,0,8,15,0), 485 | (423,5,0,8,16,0), 486 | (424,5,1,9,16,0), 487 | (425,5,1,9,15,0), 488 | (426,5,1,9,14,0), 489 | (427,5,1,9,13,0), 490 | (428,5,1,4,20,0), 491 | (429,5,1,4,21,0), 492 | (430,5,1,4,22,0), 493 | (431,5,1,5,22,0), 494 | (432,5,1,5,21,0), 495 | (433,5,1,5,20,0), 496 | (434,5,0,3,19,0), 497 | (435,5,0,3,20,0), 498 | (436,5,0,4,19,0), 499 | (437,5,0,5,19,0), 500 | (438,5,0,6,19,0), 501 | (439,5,0,6,21,0), 502 | (440,5,0,6,22,0), 503 | (441,5,0,3,21,0), 504 | (442,5,0,3,22,0), 505 | (443,5,0,3,23,0), 506 | (444,5,0,4,23,0), 507 | (445,5,0,5,23,0), 508 | (446,5,0,6,23,0), 509 | (447,5,0,6,20,0), 510 | (448,4,0,2,2,0), 511 | (449,4,0,2,3,0), 512 | (450,4,0,2,4,0), 513 | (451,4,0,2,5,0), 514 | (452,4,0,2,6,0), 515 | (453,4,0,2,7,0), 516 | (454,4,0,2,8,0), 517 | (455,4,0,2,9,0), 518 | (456,4,0,2,10,0), 519 | (457,4,0,2,11,0), 520 | (458,4,0,2,12,0), 521 | (459,4,0,2,13,0), 522 | (460,4,0,2,14,0), 523 | (461,4,0,2,15,0), 524 | (462,4,1,3,2,0), 525 | (463,4,1,3,3,0), 526 | (464,4,1,3,4,0), 527 | (465,4,1,3,5,0), 528 | (466,4,1,3,6,0), 529 | (467,4,1,3,7,0), 530 | (468,4,1,3,8,0), 531 | (469,4,1,3,9,0), 532 | (470,4,1,3,10,0), 533 | (471,4,1,3,11,0), 534 | (472,4,1,3,12,0), 535 | (473,4,1,3,13,0), 536 | (474,4,1,3,14,0), 537 | (475,4,1,3,15,0), 538 | (476,4,0,4,2,0), 539 | (477,4,0,4,3,0), 540 | (478,4,0,4,4,0), 541 | (479,4,0,4,5,0), 542 | (480,4,0,4,6,0), 543 | (481,4,0,4,7,0), 544 | (482,4,0,4,8,0), 545 | (483,4,0,4,9,0), 546 | (484,4,0,4,10,0), 547 | (485,4,0,4,11,0), 548 | (486,4,0,4,12,0), 549 | (487,4,0,4,13,0), 550 | (488,4,0,4,14,0), 551 | (489,4,0,4,15,0), 552 | (490,4,0,6,2,0), 553 | (491,4,0,6,3,0), 554 | (492,4,0,6,4,0), 555 | (493,4,0,6,5,0), 556 | (494,4,0,6,6,0), 557 | (495,4,0,6,7,0), 558 | (496,4,0,6,8,0), 559 | (497,4,0,6,9,0), 560 | (498,4,0,6,11,0), 561 | (499,4,0,6,10,0), 562 | (500,4,0,6,12,0), 563 | (501,4,0,6,13,0), 564 | (502,4,0,6,14,0), 565 | (503,4,0,6,15,0), 566 | (504,4,0,8,15,0), 567 | (505,4,0,8,14,0), 568 | (506,4,0,8,13,0), 569 | (507,4,0,8,12,0), 570 | (508,4,0,8,11,0), 571 | (509,4,0,8,10,0), 572 | (510,4,0,8,9,0), 573 | (511,4,0,8,8,0), 574 | (512,4,0,8,7,0), 575 | (513,4,0,8,6,0), 576 | (514,4,0,8,5,0), 577 | (515,4,0,8,4,0), 578 | (516,4,0,8,3,0), 579 | (517,4,0,8,2,0), 580 | (518,4,1,7,2,0), 581 | (519,4,1,7,3,0), 582 | (520,4,1,7,4,0), 583 | (521,4,1,7,5,0), 584 | (522,4,1,7,6,0), 585 | (523,4,1,7,7,0), 586 | (524,4,1,7,8,0), 587 | (525,4,1,7,9,0), 588 | (526,4,1,7,10,0), 589 | (527,4,1,7,11,0), 590 | (528,4,1,7,12,0), 591 | (529,4,1,7,13,0), 592 | (530,4,1,7,14,0), 593 | (531,4,1,7,15,0), 594 | (532,4,0,2,16,0), 595 | (533,4,0,2,17,0), 596 | (534,4,0,2,19,0), 597 | (535,4,0,2,20,0), 598 | (536,4,0,2,21,0), 599 | (537,4,0,2,22,0), 600 | (538,4,0,2,23,0), 601 | (539,4,0,2,24,0), 602 | (540,4,0,4,24,0), 603 | (541,4,0,4,23,0), 604 | (542,4,0,4,22,0), 605 | (543,4,0,4,21,0), 606 | (544,4,0,4,20,0), 607 | (545,4,0,4,19,0), 608 | (546,4,0,4,18,0), 609 | (547,4,0,4,17,0), 610 | (548,4,0,4,16,0), 611 | (549,4,1,3,16,0), 612 | (550,4,1,3,17,0), 613 | (551,4,1,3,18,0), 614 | (552,4,1,3,20,0), 615 | (553,4,1,3,19,0), 616 | (554,4,1,3,21,0), 617 | (555,4,1,3,22,0), 618 | (556,4,1,3,23,0), 619 | (557,4,1,3,24,0), 620 | (558,4,0,2,18,0), 621 | (560,6,0,2,3,0), 622 | (561,6,0,2,4,0), 623 | (562,6,0,2,5,0), 624 | (563,6,0,2,6,0), 625 | (564,6,0,2,7,0), 626 | (565,6,0,2,8,0), 627 | (566,6,0,2,9,0), 628 | (567,6,0,2,10,0), 629 | (568,6,0,2,11,0), 630 | (570,6,0,2,13,0), 631 | (571,6,0,2,14,0), 632 | (572,6,0,2,15,0), 633 | (574,6,1,3,3,0), 634 | (575,6,1,3,4,0), 635 | (576,6,1,3,5,0), 636 | (577,6,1,3,6,0), 637 | (578,6,1,3,7,0), 638 | (579,6,1,3,8,0), 639 | (580,6,1,3,9,0), 640 | (581,6,1,3,10,0), 641 | (582,6,1,3,11,0), 642 | (584,6,1,3,13,0), 643 | (585,6,1,3,14,0), 644 | (586,6,1,3,15,0), 645 | (588,6,0,4,3,0), 646 | (589,6,0,4,4,0), 647 | (590,6,0,4,5,0), 648 | (591,6,0,4,6,0), 649 | (592,6,0,4,7,0), 650 | (593,6,0,4,8,0), 651 | (594,6,0,4,9,0), 652 | (595,6,0,4,10,0), 653 | (596,6,0,4,11,0), 654 | (598,6,0,4,13,0), 655 | (599,6,0,4,14,0), 656 | (600,6,0,4,15,0), 657 | (602,6,0,6,3,0), 658 | (603,6,0,6,4,0), 659 | (604,6,0,6,5,0), 660 | (605,6,0,6,6,0), 661 | (606,6,0,6,7,0), 662 | (607,6,0,6,8,0), 663 | (608,6,0,6,9,0), 664 | (609,6,0,6,11,0), 665 | (610,6,0,6,10,0), 666 | (619,6,0,8,11,0), 667 | (620,6,0,8,10,0), 668 | (621,6,0,8,9,0), 669 | (622,6,0,8,8,0), 670 | (623,6,0,8,7,0), 671 | (624,6,0,8,6,0), 672 | (625,6,0,8,5,0), 673 | (626,6,0,8,4,0), 674 | (627,6,0,8,3,0), 675 | (630,6,1,7,3,0), 676 | (631,6,1,7,4,0), 677 | (632,6,1,7,5,0), 678 | (633,6,1,7,6,0), 679 | (634,6,1,7,7,0), 680 | (635,6,1,7,8,0), 681 | (636,6,1,7,9,0), 682 | (637,6,1,7,10,0), 683 | (638,6,1,7,11,0), 684 | (643,6,0,2,16,0), 685 | (644,6,0,2,17,0), 686 | (645,6,0,2,19,0), 687 | (646,6,0,2,20,0), 688 | (647,6,0,2,21,0), 689 | (648,6,0,2,22,0), 690 | (649,6,0,2,23,0), 691 | (652,6,0,4,23,0), 692 | (653,6,0,4,22,0), 693 | (654,6,0,4,21,0), 694 | (655,6,0,4,20,0), 695 | (656,6,0,4,19,0), 696 | (657,6,0,4,18,0), 697 | (658,6,0,4,17,0), 698 | (659,6,0,4,16,0), 699 | (660,6,1,3,16,0), 700 | (661,6,1,3,17,0), 701 | (662,6,1,3,18,0), 702 | (663,6,1,3,20,0), 703 | (664,6,1,3,19,0), 704 | (665,6,1,3,21,0), 705 | (666,6,1,3,22,0), 706 | (667,6,1,3,23,0), 707 | (669,6,0,2,18,0); 708 | 709 | /*Table structure for table `user` */ 710 | 711 | DROP TABLE IF EXISTS `user`; 712 | 713 | CREATE TABLE `user` ( 714 | `uid` bigint(20) NOT NULL AUTO_INCREMENT, 715 | `username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 716 | `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 717 | `type` int(11) DEFAULT '0' COMMENT '0学生1老师2管理员', 718 | `score` int(11) DEFAULT '100' COMMENT '信用分', 719 | `number` bigint(20) DEFAULT NULL COMMENT '学号', 720 | PRIMARY KEY (`uid`) 721 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 722 | 723 | /*Data for the table `user` */ 724 | 725 | insert into `user`(`uid`,`username`,`password`,`type`,`score`,`number`) values 726 | (1,'张三','123456789',0,90,123), 727 | (2,'王老师','123456789',1,100,999), 728 | (3,'李四','123456789',0,100,124), 729 | (6,'赵四','123456789',0,100,126), 730 | (7,'周一','123456789',0,100,130), 731 | (9,'张六','123456789',0,100,131), 732 | (10,'李明','123456789',0,100,135); 733 | 734 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 735 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 736 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 737 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 738 | -------------------------------------------------------------------------------- /springboot/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 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 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tah9/SpringSeatReservation/cda674bd1be445edfa1cdacad2e95f3e915ea263/springboot/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /springboot/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | -------------------------------------------------------------------------------- /springboot/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /springboot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.0 9 | 10 | 11 | com.example 12 | spring_seatreservation 13 | 0.0.1-SNAPSHOT 14 | spring_seatreservation 15 | Demo project for Spring Boot 16 | 17 | 1.8 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | org.mybatis.spring.boot 26 | mybatis-spring-boot-starter 27 | 2.2.2 28 | 29 | 30 | mysql 31 | mysql-connector-java 32 | runtime 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-maven-plugin 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Bean/MyTask.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Bean; 2 | 3 | /** 4 | * @Author: crush 5 | * @Date: 2021-07-29 15:35 6 | * version 1.0 7 | */ 8 | public class MyTask { 9 | /** 10 | * 动态任务名 11 | */ 12 | private String name; 13 | 14 | /** 15 | * 设定动态任务开始时间 16 | */ 17 | private long start; 18 | 19 | Runnable runnable; 20 | 21 | public MyTask(String name, long start, Runnable runnable) { 22 | this.name = name; 23 | this.start = start; 24 | this.runnable = runnable; 25 | } 26 | 27 | public Runnable getRunnable() { 28 | return runnable; 29 | } 30 | 31 | public MyTask setRunnable(Runnable runnable) { 32 | this.runnable = runnable; 33 | return this; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public MyTask setName(String name) { 41 | this.name = name; 42 | return this; 43 | } 44 | 45 | public long getStart() { 46 | return start; 47 | } 48 | 49 | public MyTask setStart(long start) { 50 | this.start = start; 51 | return this; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "MyTask{" + 57 | "name='" + name + '\'' + 58 | ", start=" + start + 59 | '}'; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Bean/MyUser.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Bean; 2 | 3 | 4 | public class MyUser { 5 | long uid; 6 | String username; 7 | String password; 8 | long number; 9 | 10 | public long getNumber() { 11 | return number; 12 | } 13 | 14 | public MyUser setNumber(long number) { 15 | this.number = number; 16 | return this; 17 | } 18 | 19 | int type; 20 | 21 | public int getType() { 22 | return type; 23 | } 24 | 25 | public MyUser setType(int type) { 26 | this.type = type; 27 | return this; 28 | } 29 | 30 | 31 | public MyUser(long uid, String username, String password) { 32 | this.uid = uid; 33 | this.username = username; 34 | this.password = password; 35 | } 36 | 37 | public long getUid() { 38 | return uid; 39 | } 40 | 41 | public MyUser setUid(long uid) { 42 | this.uid = uid; 43 | return this; 44 | } 45 | 46 | public String getUsername() { 47 | return username; 48 | } 49 | 50 | public MyUser setUsername(String username) { 51 | this.username = username; 52 | return this; 53 | } 54 | 55 | public String getPassword() { 56 | return password; 57 | } 58 | 59 | public MyUser setPassword(String password) { 60 | this.password = password; 61 | return this; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Bean/R.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Bean; 2 | 3 | import java.util.HashMap; 4 | 5 | 6 | public class R extends HashMap { 7 | HashMap map; 8 | 9 | public R() { 10 | map = new HashMap<>(); 11 | } 12 | 13 | public HashMap builder() { 14 | return map; 15 | } 16 | 17 | public R ok() { 18 | map.put("code", 200); 19 | return this; 20 | } 21 | 22 | public R add(String key, Object value) { 23 | map.put(key, value); 24 | return this; 25 | } 26 | 27 | public R bad() { 28 | map.put("code", 400); 29 | return this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Bean/ReservationCode.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Bean; 2 | 3 | public class ReservationCode { 4 | public static final int TIME_BEGAN = 0;//到达约定的时间,待签到 5 | public static final int SIGNED_BE_USE = 1;//正在使用座位 6 | public static final int UNSIGNED = 2;//预约未及时签到 7 | public static final int LEAVE = 3;//离开座位 8 | public static final int LEAVE_UNSIGNED = 4;//离开60分钟未及时签到 9 | public static final int FINISH = -1;//已完成 10 | 11 | } 12 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Bean/SeatCode.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Bean; 2 | 3 | public class SeatCode { 4 | public static final int CAN_USE = 0; 5 | public static final int BE_RESERVATION = 1; 6 | public static final int BE_USE = 2; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Other/DynamicTaskService.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Other; 2 | 3 | import com.example.spring_seatreservation.Bean.MyTask; 4 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.util.concurrent.ListenableFutureCallback; 7 | 8 | import java.time.LocalDateTime; 9 | import java.util.*; 10 | import java.util.concurrent.ConcurrentHashMap; 11 | import java.util.concurrent.CopyOnWriteArrayList; 12 | import java.util.concurrent.ScheduledFuture; 13 | 14 | /** 15 | * @author crush 16 | */ 17 | @Component 18 | public class DynamicTaskService { 19 | 20 | /** 21 | * 以下两个都是线程安全的集合类。 22 | */ 23 | public Map> taskMap = new ConcurrentHashMap<>(); 24 | public List taskList = new CopyOnWriteArrayList(); 25 | 26 | 27 | private final ThreadPoolTaskScheduler syncScheduler; 28 | 29 | public DynamicTaskService(ThreadPoolTaskScheduler syncScheduler) { 30 | this.syncScheduler = syncScheduler; 31 | } 32 | 33 | /** 34 | * 查看已开启但还未执行的动态任务 35 | * 36 | * @return 37 | */ 38 | public List getTaskList() { 39 | return taskList; 40 | } 41 | 42 | 43 | /** 44 | * 添加一个动态任务 45 | * 任务名:目标状态码-座位id 46 | * 47 | * @param myTask 48 | * @return 49 | */ 50 | public boolean add(MyTask myTask) { 51 | // 此处的逻辑是 ,如果当前已经有这个名字的任务存在,先删除之前的,再添加现在的。(即重复就覆盖) 52 | if (null != taskMap.get(myTask.getName())) { 53 | stop(myTask.getName()); 54 | } 55 | 56 | Date startTime = new Date(myTask.getStart()); 57 | 58 | // schedule :调度给定的Runnable ,在指定的执行时间调用它。 59 | //一旦调度程序关闭或返回的ScheduledFuture被取消,执行将结束。 60 | //参数: 61 | //任务 – 触发器触发时执行的 Runnable 62 | //startTime – 任务所需的执行时间(如果这是过去,则任务将立即执行,即尽快执行) 63 | ScheduledFuture> schedule = syncScheduler.schedule(myTask.getRunnable(), startTime); 64 | taskMap.put(myTask.getName(), schedule); 65 | taskList.add(myTask.getName()); 66 | return true; 67 | } 68 | 69 | /** 70 | * 停止任务 71 | * 72 | * @param name 73 | * @return 74 | */ 75 | public boolean stop(String name) { 76 | if (null == taskMap.get(name)) { 77 | return false; 78 | } 79 | ScheduledFuture> scheduledFuture = taskMap.get(name); 80 | scheduledFuture.cancel(true); 81 | taskMap.remove(name); 82 | taskList.remove(name); 83 | return true; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Other/SignedNumber.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Other; 2 | 3 | import java.util.Map; 4 | 5 | public class SignedNumber { 6 | private static final long KEY = 123456; 7 | 8 | /** 9 | * 用座位id、用户id、预约开始时间后6位相加进行加密 10 | * 11 | * @param map 12 | * @return 13 | */ 14 | public static long getSignedNumber(Map map) { 15 | long sid = new Long(map.get("sid").toString()); 16 | long uid = new Long(map.get("uid").toString()); 17 | long startTime = new Long(map.get("startTime").toString()) % 1000000; 18 | return KEY * (sid + uid + startTime) % 1000000; 19 | } 20 | 21 | /** 22 | * 用座位id、用户id、暂离时间后6位相加进行加密 23 | * 24 | * @param map 25 | * @return 26 | */ 27 | public static long getLeaveSignedNumber(Map map) { 28 | long sid = new Long(map.get("sid").toString()); 29 | long uid = new Long(map.get("uid").toString()); 30 | long leaveTime = new Long(map.get("leaveTime").toString()) % 1000000; 31 | return KEY * (sid + uid + leaveTime) % 1000000; 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/Other/UpPic.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.Other; 2 | 3 | import org.springframework.web.multipart.MultipartFile; 4 | import org.springframework.web.multipart.MultipartHttpServletRequest; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import java.io.File; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.Random; 11 | import java.util.TimeZone; 12 | 13 | public class UpPic { 14 | //当日23:59:59时间戳 15 | // long curDateEndTime = startTime / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset() + 86400000L - 1; 16 | 17 | //将接口上传的所有文件保存到本地指定路径下,返回文件名 18 | public static String upPics(HttpServletRequest request) throws Exception { 19 | List files = ((MultipartHttpServletRequest) request).getFiles("file"); 20 | if (files.size() == 0) { 21 | return null; 22 | } 23 | File rootFile = new File("D:/BookApp"); 24 | if (!rootFile.exists()) { 25 | rootFile.mkdir(); 26 | } 27 | List resultsPath = new ArrayList<>(); 28 | for (MultipartFile file : files) { 29 | String randomNumber = getRandomNumber(10); 30 | File newFile = new File("D:/BookApp/" + randomNumber + ".jpg"); 31 | file.transferTo(newFile); 32 | String url =/* request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() +*/ 33 | "/BookApp/" + randomNumber + ".jpg"; 34 | resultsPath.add(url); 35 | } 36 | String result = resultsPath.toString(); 37 | //list转string后去除首尾[]中括号 38 | return result.substring(1, result.length() - 1).replaceAll(" ", ""); 39 | } 40 | 41 | public static String getRandomNumber(int length) { 42 | String val = ""; 43 | Random random = new Random(); 44 | for (int i = 0; i < length; i++) { 45 | val += String.valueOf(random.nextInt(10)); 46 | } 47 | return val; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/SpringSeatReservationApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; 7 | import org.springframework.scheduling.annotation.EnableScheduling; 8 | 9 | @EnableScheduling 10 | @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) 11 | @MapperScan("com.example.spring_seatreservation.mapper") 12 | public class SpringSeatReservationApplication { 13 | 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(SpringSeatReservationApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/config/CommonConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.config; 2 | 3 | 4 | import org.springframework.boot.web.servlet.MultipartConfigFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.util.unit.DataSize; 8 | 9 | import javax.servlet.MultipartConfigElement; 10 | 11 | @Configuration 12 | public class CommonConfig { 13 | 14 | /* 设置上传文件大小限制 15 | * @param: 16 | * @return: javax.servlet.MultipartConfigElement 17 | */ 18 | @Bean 19 | public MultipartConfigElement multipartConfigElement() { 20 | MultipartConfigFactory factory = new MultipartConfigFactory(); 21 | //单个文件最大-30MB 22 | factory.setMaxFileSize(DataSize.ofMegabytes(30)); 23 | //该方法已降级 24 | //factory.setMaxRequestSize("30MB"); 25 | /// 设置总上传数据总大小-120MB 26 | factory.setMaxRequestSize(DataSize.ofMegabytes(120)); 27 | return factory.createMultipartConfig(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/config/InterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.config; 2 | 3 | 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 7 | 8 | /** 9 | * 拦截器配置类 10 | */ 11 | @Configuration 12 | public class InterceptorConfig implements WebMvcConfigurer { 13 | 14 | 15 | 16 | //映射本地文件夹以加载图片 17 | @Override 18 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 19 | registry.addResourceHandler("/BookApp/**") 20 | .addResourceLocations("file:" + "D:/BookApp/"); 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/config/ThreadPoolTaskExecutorConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; 6 | 7 | /** 8 | * 异步线程池ThreadPoolExecutor 配置类 9 | * 10 | * @Author: crush 11 | * @Date: 2021-07-23 14:14 12 | */ 13 | @Configuration 14 | public class ThreadPoolTaskExecutorConfig { 15 | 16 | @Bean 17 | public ThreadPoolTaskScheduler syncScheduler() { 18 | ThreadPoolTaskScheduler syncScheduler = new ThreadPoolTaskScheduler(); 19 | // syncScheduler.setPoolSize(5); 20 | // 这里给线程设置名字,主要是为了在项目能够更快速的定位错误。 21 | syncScheduler.setThreadGroupName("syncTg"); 22 | syncScheduler.setThreadNamePrefix("syncThread-"); 23 | syncScheduler.initialize(); 24 | return syncScheduler; 25 | } 26 | 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.controller; 2 | 3 | import com.example.spring_seatreservation.Bean.R; 4 | import com.example.spring_seatreservation.mapper.AdminMapper; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | import javax.annotation.Resource; 8 | import java.text.SimpleDateFormat; 9 | import java.time.LocalDate; 10 | import java.time.LocalDateTime; 11 | import java.time.LocalTime; 12 | import java.time.ZoneOffset; 13 | import java.util.*; 14 | 15 | @RestController 16 | @RequestMapping("/admin") 17 | public class AdminController { 18 | @Resource 19 | AdminMapper adminMapper; 20 | 21 | @PostMapping("/updateSport") 22 | public Map updateSport(@RequestBody Map map) { 23 | adminMapper.updateSport(map); 24 | return new R().ok().builder(); 25 | } 26 | 27 | @PostMapping("/addAnnounce") 28 | public Map addAnnounce(@RequestBody Map map) { 29 | map.put("datetime", System.currentTimeMillis()); 30 | adminMapper.addAnnounce(map); 31 | return new R().ok().builder(); 32 | } 33 | 34 | @PostMapping("/addSeat") 35 | public Map addSeat(@RequestBody Map map) { 36 | adminMapper.addSeat(map); 37 | return new R().ok().builder(); 38 | } 39 | 40 | @PostMapping("/deleteSeat") 41 | public Map deleteSeat(@RequestBody Map map) { 42 | adminMapper.deleteSeat(map); 43 | return new R().ok().builder(); 44 | } 45 | 46 | @PostMapping("/deleteArticle") 47 | public Map deleteArticle(@RequestBody Map map) { 48 | adminMapper.deleteArticle(map); 49 | return new R().ok().builder(); 50 | } 51 | 52 | @PostMapping("/deleteAnnounce") 53 | public Map deleteAnnounce(@RequestBody Map map) { 54 | adminMapper.deleteAnnounce(map); 55 | return new R().ok().builder(); 56 | } 57 | 58 | @PostMapping("/updatePwd") 59 | public Map updatePwd(@RequestBody Map map) { 60 | adminMapper.updatePassword(map); 61 | return new R().ok().builder(); 62 | } 63 | 64 | @GetMapping("/getUser") 65 | public Map getUser() { 66 | List> list = adminMapper.getUser(); 67 | return new R().ok().add("rows", list).builder(); 68 | } 69 | 70 | @GetMapping("/getTeacher") 71 | public Map getTeacher() { 72 | List> list = adminMapper.getTeacher(); 73 | return new R().ok().add("rows", list).builder(); 74 | } 75 | 76 | @GetMapping("/getStatistics") 77 | public Map getStatistics() { 78 | List> list = adminMapper.getStatistics(); 79 | List> timeList = new ArrayList<>(); 80 | for (int i = 16; i < 45; i++) { 81 | String time = (i / 2) + (i % 2 == 0 ? ":00" : ":30"); 82 | String endTime = ((i + 1) / 2) + ((i + 1) % 2 == 0 ? ":00" : ":30"); 83 | int sum = 0; 84 | for (Map map : list) { 85 | Date date = new Date((long) map.get("startTime")); 86 | Calendar cr = Calendar.getInstance(); 87 | cr.setTime(date); 88 | int startHalfHour = cr.get(Calendar.HOUR_OF_DAY) * 2 + (cr.get(Calendar.MINUTE) > 0 ? 1 : 0); 89 | Date date2 = new Date((long) map.get("endTime")); 90 | Calendar cr2 = Calendar.getInstance(); 91 | cr.setTime(date2); 92 | int endHalfHour = cr2.get(Calendar.HOUR_OF_DAY) * 2 + (cr2.get(Calendar.MINUTE) > 0 ? 1 : 0); 93 | 94 | if (startHalfHour<=i&&endHalfHour>i) { 95 | ++sum; 96 | } 97 | } 98 | Map item = new HashMap<>(); 99 | item.put("time", time + "-" + endTime); 100 | item.put("sum", sum); 101 | timeList.add(item); 102 | } 103 | return new R().ok().add("userCounter", adminMapper.getUserCounter()) 104 | .add("timeList", timeList).builder(); 105 | } 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/controller/ForumController.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.controller; 2 | 3 | import com.example.spring_seatreservation.Bean.R; 4 | import com.example.spring_seatreservation.mapper.ForumMapper; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | import javax.annotation.Resource; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | @RestController 12 | @RequestMapping("/forum") 13 | public class ForumController { 14 | 15 | @Resource 16 | ForumMapper forumMapper; 17 | 18 | @GetMapping("/getArticle") 19 | public Map getArticle() { 20 | return new R().add("rows", forumMapper.getArticle()).builder(); 21 | } 22 | 23 | @PostMapping("/insertArticle") 24 | public Map insertArticle(@RequestBody Map map) { 25 | map.put("datetime", System.currentTimeMillis()); 26 | forumMapper.insertArticle(map); 27 | return new R().builder(); 28 | } 29 | 30 | @PostMapping("/insertComment") 31 | public Map insertComment(@RequestBody Map map) { 32 | map.put("datetime", System.currentTimeMillis()); 33 | forumMapper.insertComment(map); 34 | return new R().builder(); 35 | } 36 | 37 | @PostMapping("/getComment") 38 | public Map getComment(@RequestBody Map map) { 39 | 40 | return new R().add("rows",forumMapper.getComment(map)).builder(); 41 | } 42 | 43 | @GetMapping("/getAnnounce") 44 | public Map getAnnounce() { 45 | return new R().add("rows", forumMapper.getAnnounce()).builder(); 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/controller/PublicController.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.controller; 2 | 3 | 4 | import com.example.spring_seatreservation.Bean.*; 5 | import com.example.spring_seatreservation.Other.DynamicTaskService; 6 | import com.example.spring_seatreservation.Other.SignedNumber; 7 | import com.example.spring_seatreservation.mapper.PublicMapper; 8 | import com.example.spring_seatreservation.mapper.UserMapper; 9 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import javax.annotation.Resource; 13 | import java.util.*; 14 | 15 | @RestController 16 | @EnableAutoConfiguration 17 | @RequestMapping("/public") 18 | public class PublicController { 19 | @Resource 20 | PublicMapper publicMapper; 21 | @Resource 22 | UserMapper userMapper; 23 | 24 | 25 | private final DynamicTaskService dynamicTask; 26 | 27 | 28 | public PublicController(DynamicTaskService dynamicTask) { 29 | this.dynamicTask = dynamicTask; 30 | } 31 | 32 | { 33 | //启动项目,重启预约线程 34 | Timer timer = new Timer(); 35 | TimerTask timerTask = new TimerTask() { 36 | @Override 37 | public void run() { 38 | 39 | //所有等待或使用状态的预约都需要检查 状态0/1/3的数据 40 | List> list = publicMapper.getNeedCheckReservation(); 41 | 42 | for (Map map : list) { 43 | int state = (int) map.get("state"); 44 | long startTime = new Long(map.get("startTime").toString()); 45 | 46 | //预约结束时自动恢复座位状态 47 | dynamicTask.add(new MyTask(ReservationCode.FINISH + "-" + map.get("sid"), (long) map.get("endTime"), () -> { 48 | userMapper.updateReservation(ReservationCode.FINISH, map.get("rid")); 49 | userMapper.updateSeat(SeatCode.CAN_USE, map.get("sid")); 50 | })); 51 | //使用中的 52 | if (state == ReservationCode.SIGNED_BE_USE) { 53 | 54 | } 55 | //预约中的 56 | else if (state == ReservationCode.TIME_BEGAN) { 57 | //超时设置违约状态并释放座椅 58 | dynamicTask.add(new MyTask(ReservationCode.UNSIGNED + "-" + map.get("sid"), 59 | startTime + 30 * 60 * 1000L, () -> { 60 | dynamicTask.stop(ReservationCode.FINISH + "-" + map.get("sid")); 61 | publicMapper.updateReservation(ReservationCode.UNSIGNED, map.get("rid")); 62 | userMapper.updateSeat(SeatCode.CAN_USE, map.get("sid")); 63 | })); 64 | } 65 | //暂离的 66 | else if (state == ReservationCode.LEAVE) { 67 | dynamicTask.add(new MyTask(ReservationCode.LEAVE_UNSIGNED + "-" + map.get("sid"), 68 | ((long) map.get("leaveTime")) + 60 * 60 * 1000L, () -> { 69 | dynamicTask.stop(ReservationCode.FINISH + "-" + map.get("sid")); 70 | publicMapper.updateReservation(ReservationCode.LEAVE_UNSIGNED, map.get("rid")); 71 | userMapper.updateSeat(SeatCode.CAN_USE, map.get("sid")); 72 | })); 73 | } 74 | } 75 | } 76 | }; 77 | timer.schedule(timerTask, 5000); 78 | } 79 | 80 | /** 81 | * 通过座位id获取签到码 82 | * 83 | * @param map 84 | * @return 85 | */ 86 | @PostMapping("/getSignedNumber") 87 | public Map getSignedNumber(@RequestBody Map map) { 88 | Map reservation = publicMapper.getReservationBySid(map.get("sid")); 89 | 90 | HashMap result = new R().ok().builder(); 91 | Object state = reservation.get("state"); 92 | if (state.equals(ReservationCode.TIME_BEGAN)) { 93 | result.put("number", SignedNumber.getSignedNumber(reservation)); 94 | } else if (state.equals(ReservationCode.LEAVE)) { 95 | result.put("number", SignedNumber.getLeaveSignedNumber(reservation)); 96 | } 97 | return result; 98 | } 99 | 100 | 101 | /** 102 | * 查看已开启但还未执行的动态任务 103 | * 104 | * @return 105 | */ 106 | @GetMapping 107 | public List getStartingDynamicTask() { 108 | return dynamicTask.getTaskList(); 109 | } 110 | 111 | 112 | 113 | /** 114 | * 根据名称 停止一个动态任务 115 | * 116 | * @param name 117 | * @return 118 | */ 119 | @DeleteMapping("/{name}") 120 | public String stopDynamicTask(@PathVariable("name") String name) { 121 | // 将这个添加到动态定时任务中去 122 | if (!dynamicTask.stop(name)) { 123 | return "停止失败,任务已在进行中."; 124 | } 125 | return "任务已停止"; 126 | } 127 | 128 | 129 | @GetMapping("/getArea") 130 | public Map getAnnounce() { 131 | return new R().ok().add("rows", publicMapper.getArea()).builder(); 132 | } 133 | 134 | @PostMapping("/getAreaSeats") 135 | public Map getAreaSeats(@RequestBody Map map) { 136 | List> areaSeats = publicMapper.getAreaSeats(map); 137 | for (Map areaSeat : areaSeats) { 138 | areaSeat.put("show", false); 139 | } 140 | return new R().ok().add("rows", areaSeats).builder(); 141 | 142 | } 143 | 144 | 145 | @PostMapping("/upPwd") 146 | public Map updatePwd(@RequestBody Map map) { 147 | Long number = new Long(map.get("number").toString()); 148 | if (publicMapper.getUserByNumber(number).getPassword().equals(map.get("opassword"))) { 149 | publicMapper.updatePwd(map.get("npassword").toString() 150 | , number); 151 | return new R().ok().builder(); 152 | } else { 153 | return new R().bad().builder(); 154 | } 155 | } 156 | 157 | @PostMapping("/register") 158 | public Map register(@RequestBody MyUser user) { 159 | try { 160 | publicMapper.insertUser(user); 161 | return new R().ok().builder(); 162 | } catch (Exception e) { 163 | return new R().bad().builder(); 164 | } 165 | } 166 | 167 | @PostMapping("/login") 168 | public Map login(@RequestBody MyUser user) { 169 | try { 170 | MyUser resultUser = publicMapper.getUserByNumber(user.getNumber()); 171 | System.out.println(resultUser); 172 | if (resultUser.getPassword().equals(user.getPassword())) { 173 | return new R().ok().add("user", resultUser).builder(); 174 | } else { 175 | throw new Exception(); 176 | } 177 | } catch (Exception e) { 178 | return new R().bad().builder(); 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/controller/TeacherController.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.controller; 2 | 3 | import com.example.spring_seatreservation.Bean.R; 4 | import com.example.spring_seatreservation.mapper.TeacherMapper; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | import javax.annotation.Resource; 8 | import java.util.Map; 9 | 10 | @RestController 11 | @RequestMapping("/teacher") 12 | public class TeacherController { 13 | 14 | @Resource 15 | TeacherMapper teacherMapper; 16 | 17 | 18 | @GetMapping("/getReservation") 19 | public Map getReservation() { 20 | return new R().ok().add("rows", teacherMapper.getReservation()).builder(); 21 | } 22 | 23 | @GetMapping("/getReservationNeedSub") 24 | public Map getReservationNeedSub() { 25 | return new R().ok().add("rows", teacherMapper.getReservationNeedSub()).builder(); 26 | } 27 | 28 | @PostMapping("/subScore") 29 | public Map subScore(@RequestBody Map map) { 30 | teacherMapper.subScore(map); 31 | teacherMapper.subReservationScore(map); 32 | return new R().ok().builder(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.controller; 2 | 3 | import com.example.spring_seatreservation.Bean.MyTask; 4 | import com.example.spring_seatreservation.Bean.R; 5 | import com.example.spring_seatreservation.Bean.ReservationCode; 6 | import com.example.spring_seatreservation.Bean.SeatCode; 7 | import com.example.spring_seatreservation.Other.DynamicTaskService; 8 | import com.example.spring_seatreservation.Other.SignedNumber; 9 | import com.example.spring_seatreservation.mapper.PublicMapper; 10 | import com.example.spring_seatreservation.mapper.UserMapper; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.annotation.Resource; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | 19 | @RestController 20 | @RequestMapping("/user") 21 | public class UserController { 22 | 23 | private final DynamicTaskService dynamicTask; 24 | 25 | 26 | public UserController(DynamicTaskService dynamicTask) { 27 | this.dynamicTask = dynamicTask; 28 | } 29 | 30 | @Resource 31 | UserMapper userMapper; 32 | @Resource 33 | PublicMapper publicMapper; 34 | 35 | 36 | /** 37 | * startTime,endTime,sid,rid,uid 38 | * 39 | * @param map 40 | */ 41 | @PostMapping("/addReservation") 42 | public Map addReservation(@RequestBody Map map) { 43 | 44 | List> curReservation = userMapper.getCurReservation(map.get("uid")); 45 | //当前用户已有预约 46 | if (curReservation.size() > 0) { 47 | return new R().bad().builder(); 48 | } 49 | long startTime = ((long) map.get("startTime")); 50 | long endTime = ((long) map.get("endTime")); 51 | 52 | String finishTaskName = ReservationCode.FINISH 53 | + "-" + map.get("sid"); 54 | String unSignedTaskName = ReservationCode.UNSIGNED 55 | + "-" + map.get("sid"); 56 | //插入预约记录 57 | userMapper.addReservation(map); 58 | userMapper.updateSeat(SeatCode.BE_RESERVATION, map.get("sid")); 59 | int rid = Integer.parseInt(map.get("rid").toString()); 60 | 61 | //预约开始超过30分钟将设置预约状态为违约未签到, 62 | //并释放座椅 63 | dynamicTask.add(new MyTask(unSignedTaskName, 64 | startTime + 30 * 60 * 1000L, () -> { 65 | dynamicTask.stop(finishTaskName); 66 | userMapper.updateReservation(ReservationCode.UNSIGNED, rid); 67 | userMapper.updateSeat(SeatCode.CAN_USE, map.get("sid")); 68 | })); 69 | 70 | //预约结束时自动恢复座位状态 71 | dynamicTask.add(new MyTask(finishTaskName, endTime, () -> { 72 | userMapper.updateReservation(ReservationCode.FINISH, rid); 73 | userMapper.updateSeat(SeatCode.CAN_USE, map.get("sid")); 74 | })); 75 | 76 | return new R().ok().builder(); 77 | } 78 | 79 | 80 | /** 81 | * 通过rid签到 82 | * 预约开始的时间前后半小时内有效(暂离1小时内有效) 83 | * 84 | * @param map 85 | * @return 86 | */ 87 | @PostMapping("/toSigned") 88 | public Map toSigned(@RequestBody Map map) { 89 | long number = new Long(map.get("number").toString()); 90 | //获取预约记录 91 | Map reservation = userMapper.getReservationByRid(map.get("rid")); 92 | 93 | long currentTimeMillis = System.currentTimeMillis(); 94 | Object state = reservation.get("state"); 95 | //预约签到 96 | if (state.equals(ReservationCode.TIME_BEGAN)) { 97 | if (currentTimeMillis > ((long) reservation.get("startTime")) + 30 * 60 * 1000L 98 | || currentTimeMillis < ((long) reservation.get("startTime")) - 30 * 60 * 1000L) { 99 | //不在前后半小时内 100 | return new R().bad().builder(); 101 | } 102 | boolean flag = number == SignedNumber.getSignedNumber(reservation); 103 | if (flag) { 104 | userMapper.updateReservation(ReservationCode.SIGNED_BE_USE, reservation.get("rid")); 105 | userMapper.updateSeat(SeatCode.BE_USE, reservation.get("sid")); 106 | //预约签到成功,关闭签到倒计时任务 107 | dynamicTask.stop(ReservationCode.UNSIGNED + "-" + reservation.get("sid").toString()); 108 | } 109 | return new R().ok().add("verify", flag).builder(); 110 | 111 | } 112 | //暂离签到 113 | else if (state.equals(ReservationCode.LEAVE)) { 114 | if (currentTimeMillis > ((long) reservation.get("leaveTime")) + 60 * 60 * 1000L) { 115 | //暂离超过1小时 116 | return new R().bad().builder(); 117 | } 118 | boolean flag = number == SignedNumber.getLeaveSignedNumber(reservation); 119 | if (flag) { 120 | userMapper.updateReservation(ReservationCode.SIGNED_BE_USE, reservation.get("rid")); 121 | userMapper.updateSeat(SeatCode.BE_USE, reservation.get("sid")); 122 | //暂离回来签到成功,关闭签到倒计时任务 123 | dynamicTask.stop(ReservationCode.LEAVE_UNSIGNED + "-" + reservation.get("sid").toString()); 124 | } 125 | return new R().ok().add("verify", flag).builder(); 126 | } else { 127 | return new R().bad().builder(); 128 | } 129 | } 130 | 131 | 132 | /** 133 | * 暂离,rid,sid 134 | * 135 | * @param map 136 | * @return 137 | */ 138 | @PostMapping("/toLeave") 139 | public Map toLeave(@RequestBody Map map) { 140 | long leaveTime = System.currentTimeMillis(); 141 | //更新数据库中预约状态和座位状态 142 | userMapper.leaveReservation(leaveTime, map.get("rid")); 143 | userMapper.leaveSeat(map.get("sid")); 144 | //超过60分钟未签到将设置状态为暂离超时未签到,同时释放座位 145 | dynamicTask.add(new MyTask(ReservationCode.LEAVE_UNSIGNED + "-" + map.get("sid"), 146 | leaveTime + 60 * 60 * 1000L, () -> { 147 | dynamicTask.stop(ReservationCode.FINISH + "-" + map.get("sid").toString()); 148 | userMapper.updateReservation(ReservationCode.LEAVE_UNSIGNED, map.get("rid")); 149 | userMapper.updateSeat(SeatCode.CAN_USE, map.get("sid")); 150 | })); 151 | return new R().builder(); 152 | } 153 | 154 | 155 | // /** 156 | // * 获取当前其他用户的预约,得到自己可以预约的时间范围 157 | // * curTime,sid, 158 | // * @param map 159 | // * @return 160 | // */ 161 | // @PostMapping("/getTimeRange") 162 | // public Map getTimeRange(@RequestBody Map map) { 163 | // List> list = userMapper.getTimeRange(map); 164 | // return new R().ok().add("rows", ).builder(); 165 | // } 166 | 167 | 168 | @PostMapping("/getReservation") 169 | public Map getReservationNeedSub(@RequestBody Map map) { 170 | return new R().ok().add("rows", userMapper.getReservation(map)).builder(); 171 | } 172 | 173 | @PostMapping("/getReservationByUid") 174 | public Map getReservationByUid(@RequestBody Map map) { 175 | List> list = userMapper.getReservationByUid(map.get("uid")); 176 | return new R().add("rows", list).builder(); 177 | } 178 | 179 | @PostMapping("/getScore") 180 | public Map getScore(@RequestBody Map map) { 181 | return new R().add("score", userMapper.getScore(map.get("uid"))).builder(); 182 | } 183 | // 184 | // @PostMapping("/getReservationToSigned") 185 | // public Map getReservationToSigned(@RequestBody Map map) { 186 | // ListMap result = userMapper.getReservationToSigned(map.get("uid")); 187 | // return new R().add("score", ).builder(); 188 | // } 189 | 190 | 191 | } 192 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.mapper; 2 | 3 | import org.apache.ibatis.annotations.Delete; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Select; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | public interface AdminMapper { 12 | @Update("update sport set full=${full},excellence=${excellence},good=${good},pass=${pass},fail=${fail}" + 13 | " where sid=${sid}") 14 | void updateSport(Map map); 15 | 16 | @Insert("insert announce(content,title,datetime)" + 17 | " values(#{content},#{title},${datetime})") 18 | void addAnnounce(Map map); 19 | 20 | @Insert("insert seat(`area`,`type`,`row`,`column`)" + 21 | " values(${area},${type},${row},${column})") 22 | void addSeat(Map map); 23 | 24 | 25 | @Delete("delete from seat where sid=${sid}") 26 | void deleteSeat(Map map); 27 | 28 | @Delete("delete from article where id=${id}") 29 | void deleteArticle(Map map); 30 | 31 | @Delete("delete from announce where id=${id}") 32 | void deleteAnnounce(Map map); 33 | 34 | @Select("select * from user where type=0") 35 | List> getUser(); 36 | 37 | @Select("select * from user where type=1") 38 | List> getTeacher(); 39 | 40 | @Update("update user set password =#{password} where uid=${uid}") 41 | void updatePassword(Map map); 42 | 43 | @Select("SELECT `startTime`,`endTime` FROM reservation WHERE state=-1 ORDER BY startTime") 44 | List> getStatistics(); 45 | 46 | @Select("SELECT COUNT(a.`uid`) as counter,b.`number`,b.`username` FROM reservation AS a \n" + 47 | "LEFT JOIN USER AS b ON b.`uid`=a.`uid`\n" + 48 | "WHERE a.`state`=-1 GROUP BY a.`uid` ORDER BY COUNT(a.`uid`)") 49 | List> getUserCounter(); 50 | } 51 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/mapper/ForumMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.mapper; 2 | 3 | import org.apache.ibatis.annotations.Insert; 4 | import org.apache.ibatis.annotations.Select; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public interface ForumMapper { 10 | @Select("select * from announce order by id desc") 11 | List> getAnnounce(); 12 | 13 | @Select("select * from article order by id desc") 14 | List> getArticle(); 15 | 16 | @Insert("insert article(title,content,datetime,uid) " + 17 | " values(#{title},#{content},${datetime},${uid})") 18 | void insertArticle(Map map); 19 | 20 | 21 | @Insert("insert comments(content,uid,datetime,aid)" + 22 | " values(#{content},${uid},${datetime},${aid})") 23 | void insertComment(Map map); 24 | 25 | @Select("SELECT a.*,b.`username` FROM comments AS a LEFT JOIN USER AS b ON b.`uid`=a.`uid` WHERE aid=${aid} ORDER BY cid DESC") 26 | List> getComment(Map map); 27 | } 28 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/mapper/PublicMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.mapper; 2 | 3 | 4 | import com.example.spring_seatreservation.Bean.MyUser; 5 | import org.apache.ibatis.annotations.Delete; 6 | import org.apache.ibatis.annotations.Insert; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.apache.ibatis.annotations.Update; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public interface PublicMapper { 14 | 15 | 16 | @Insert("insert into user(number,username,password,type) " + 17 | "values(${number},#{username},#{password},${type})") 18 | void insertUser(MyUser user); 19 | 20 | @Select("select * from user where number=${number}") 21 | MyUser getUserByNumber(long number); 22 | 23 | @Update("update user set password=#{password} where number=#{number}") 24 | void updatePwd(String password, long number); 25 | 26 | @Select("select * from area") 27 | List> getArea(); 28 | 29 | @Select("select * from seat where area=${area}") 30 | List> getAreaSeats(Map map); 31 | 32 | @Select("SELECT * FROM reservation WHERE state!=-1 and state !=2 and state != 4") 33 | List> getNeedCheckReservation(); 34 | 35 | @Update("update reservation set state=${state} where rid=${rid}") 36 | void updateReservation(Object state, Object rid); 37 | 38 | @Select("SELECT * FROM reservation WHERE sid=${sid} AND state=0 OR state=3") 39 | Map getReservationBySid(Object rid); 40 | } 41 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/mapper/TeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.mapper; 2 | 3 | 4 | import com.example.spring_seatreservation.Bean.R; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | public interface TeacherMapper { 15 | 16 | @Select("SELECT a.*,b.*,c.*,d.*,d.`score` as uScore FROM reservation AS a \n" + 17 | " LEFT JOIN seat AS b ON b.`sid`=a.`sid` \n" + 18 | " LEFT JOIN `area` AS c ON c.`aid`=b.`area`\n" + 19 | " LEFT JOIN USER AS d ON d.`uid`=a.`uid`\n" + 20 | " ORDER BY rid DESC") 21 | List> getReservation(); 22 | 23 | @Select("SELECT a.*,b.* FROM reservation AS a LEFT JOIN USER AS b ON b.`uid`=a.`uid` WHERE state=2 OR state=4") 24 | List> getReservationNeedSub(); 25 | 26 | @Update("update user set `score`=score-10 where uid=${uid}") 27 | void subScore(Object uid); 28 | 29 | @Update("update reservation set `score`=10 where rid=${rid}") 30 | void subReservationScore(Object rid); 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /springboot/src/main/java/com/example/spring_seatreservation/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.spring_seatreservation.mapper; 2 | 3 | import org.apache.ibatis.annotations.Insert; 4 | import org.apache.ibatis.annotations.Options; 5 | import org.apache.ibatis.annotations.Select; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | public interface UserMapper { 12 | 13 | //插入后,得到刚插入的数据id(在承载实体里面) 14 | @Insert("insert reservation (uid,startTime,endTime,sid)" + 15 | " values(${uid},${startTime},${endTime},${sid})") 16 | @Options(useGeneratedKeys = true, keyProperty = "rid") 17 | void addReservation(Map map); 18 | 19 | @Select("SELECT a.*,b.*,c.* FROM reservation AS a \n" + 20 | "LEFT JOIN seat AS b ON b.`sid`=a.`sid` \n" + 21 | "LEFT JOIN `area` AS c ON c.`aid`=b.`area` \n" + 22 | "WHERE a.`uid`=${uid}") 23 | List> getReservationByUid(Object uid); 24 | 25 | 26 | @Select("SELECT * FROM reservation WHERE uid=${uid} AND (state=0 OR state=1 OR state=3)") 27 | List> getCurReservation(Object uid); 28 | 29 | 30 | @Select("SELECT a.*,b.* FROM reservation AS a LEFT JOIN USER AS b ON b.`uid`=a.`uid` WHERE (state=2 OR state=4 ) AND a.`score` IS NOT NULL AND a.`uid`=${uid}") 31 | List> getReservation(Map map); 32 | 33 | 34 | @Update("update reservation set state=${state} where rid=${rid}") 35 | void updateReservation(Object state, Object rid); 36 | 37 | @Select("select * from reservation where rid=${rid}") 38 | Map getReservationByRid(Object rid); 39 | 40 | @Update("update seat set state=${state} where sid=${sid}") 41 | void updateSeat(int state, Object sid); 42 | 43 | @Update("update reservation set leaveTime=${leaveTime}, state=3 where rid=${rid}") 44 | void leaveReservation(Object leaveTime, Object rid); 45 | 46 | @Update("update seat set state=1 where sid=${sid}") 47 | void leaveSeat(Object sid); 48 | 49 | @Select("select score from user where uid=${uid}") 50 | int getScore(Object uid); 51 | } 52 | -------------------------------------------------------------------------------- /springboot/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | 2 | spring: 3 | jackson: 4 | default-property-inclusion: non_null 5 | datasource: 6 | username: root 7 | password: 123456 8 | driver-class-name: com.mysql.cj.jdbc.Driver 9 | url: jdbc:mysql://localhost:3306/seatreservation?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true 10 | 11 | 12 | thymeleaf: 13 | cache: false 14 | server: 15 | port: 9003 16 | 17 | 18 | 19 | ## 开启驼峰支持 20 | #mybatis: 21 | # mapper-locations: classpath:mapper/*.xml #对应mapper映射xml文件所在路径 22 | # type-aliases-package: cn.wbnull.springbootdemo.model #对应实体类路径 23 | # configuration: 24 | # map-underscore-to-camel-case: true 25 | 26 | #mybatis: 27 | ## type-aliases-package: org.larry.springboot.entity 28 | # mapper-locations: classpath:mapper/**/*.xml 29 | # check-config-location: true 30 | 31 | -------------------------------------------------------------------------------- /vue/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 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 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /vue/README.md: -------------------------------------------------------------------------------- 1 | # mobileseatreservation 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Customize configuration 19 | See [Configuration Reference](https://cli.vuejs.org/config/). 20 | -------------------------------------------------------------------------------- /vue/mobileseatreservation.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mobileseatreservation", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "axios": "^0.27.2", 11 | "echarts": "^5.3.3", 12 | "element-ui": "^2.15.9", 13 | "vant": "^2.12.48", 14 | "vue": "^2.6.11", 15 | "vue-router": "^3.2.0" 16 | }, 17 | "devDependencies": { 18 | "@vue/cli-plugin-router": "~4.5.19", 19 | "@vue/cli-service": "~4.5.19", 20 | "vue-template-compiler": "^2.6.11" 21 | }, 22 | "browserslist": [ 23 | "> 1%", 24 | "last 2 versions", 25 | "not dead" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tah9/SpringSeatReservation/cda674bd1be445edfa1cdacad2e95f3e915ea263/vue/public/favicon.ico -------------------------------------------------------------------------------- /vue/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 12 | We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue. 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /vue/src/App.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 95 | -------------------------------------------------------------------------------- /vue/src/Guide/Login.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 图书馆座位预约 5 | 6 | 7 | 8 | 学工号 9 | 10 | 11 | 12 | 密码 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 登录 21 | 22 | 23 | 注册 24 | 25 | 26 | 27 | 28 | 29 | 71 | 72 | 149 | -------------------------------------------------------------------------------- /vue/src/Guide/Register.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 注册账号 5 | 6 | 7 | 8 | 学工号 9 | 10 | 11 | 12 | 姓名 13 | 14 | 15 | 16 | 密码 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 注册 32 | 33 | 34 | 35 | 36 | 37 | 38 | 登录 39 | 40 | 41 | 42 | 43 | 44 | 45 | 79 | 80 | 160 | -------------------------------------------------------------------------------- /vue/src/admin/AnnounceManagement.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | {{ scope.row.title }} 10 | 11 | 12 | 15 | 16 | {{ scope.row.content }} 17 | 18 | 19 | 21 | 22 | {{ $formatTime(scope.row.datetime) }} 23 | 24 | 25 | 26 | 27 | 删除 31 | 32 | 33 | 34 | 35 | 36 | 37 | 72 | 73 | 81 | -------------------------------------------------------------------------------- /vue/src/admin/ForumManagement.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | {{ scope.row.title }} 10 | 11 | 12 | 15 | 16 | {{ scope.row.content }} 17 | 18 | 19 | 21 | 22 | {{ $formatTime(scope.row.datetime) }} 23 | 24 | 25 | 26 | 27 | 删除 31 | 32 | 33 | 34 | 35 | 36 | 37 | 72 | 73 | 81 | -------------------------------------------------------------------------------- /vue/src/admin/Main.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {active=cur}" style="background: #102438;color: white"> 7 | {{ tab.name }} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 38 | 39 | 42 | -------------------------------------------------------------------------------- /vue/src/admin/SeatCrud.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 添加座位 12 | 添加桌子 13 | 14 | 15 | 16 | 删除 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 97 | 98 | 108 | -------------------------------------------------------------------------------- /vue/src/admin/SeatManagement.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {if ($route.path!=='/admin/seat/number') 5 | $router.replace('/admin/seat/number')}">签到码 6 | 7 | {if ($route.path!=='/admin/seat/crud') 8 | $router.replace('/admin/seat/crud')}">座位管理 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 34 | 35 | 40 | -------------------------------------------------------------------------------- /vue/src/admin/SeatNumber.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 签到码:{{number}} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 65 | 66 | 76 | -------------------------------------------------------------------------------- /vue/src/admin/Statistics.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 32 | 33 | 36 | -------------------------------------------------------------------------------- /vue/src/admin/StudentManagement.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 添加 15 | 16 | 17 | 20 | 23 | 24 | {{ scope.row.number }} 25 | 26 | 27 | 30 | 31 | {{ scope.row.username }} 32 | 33 | 34 | 36 | 37 | {{ scope.row.score }} 38 | 39 | 40 | 42 | 43 | 44 | 45 | 重置 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 119 | 120 | 136 | -------------------------------------------------------------------------------- /vue/src/admin/TeacherManagement.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 添加 15 | 16 | 17 | 20 | 23 | 24 | {{ scope.row.number }} 25 | 26 | 27 | 30 | 31 | {{ scope.row.username }} 32 | 33 | 34 | 36 | 37 | {{ scope.row.score }} 38 | 39 | 40 | 42 | 43 | 44 | 45 | 重置 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 119 | 120 | 136 | -------------------------------------------------------------------------------- /vue/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tah9/SpringSeatReservation/cda674bd1be445edfa1cdacad2e95f3e915ea263/vue/src/assets/logo.png -------------------------------------------------------------------------------- /vue/src/assets/management.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tah9/SpringSeatReservation/cda674bd1be445edfa1cdacad2e95f3e915ea263/vue/src/assets/management.png -------------------------------------------------------------------------------- /vue/src/components/Area.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 116 | 117 | 132 | -------------------------------------------------------------------------------- /vue/src/components/ChooseArea.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 36 | 37 | 40 | -------------------------------------------------------------------------------- /vue/src/components/HeadTip.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 10 | 可选 11 | 14 | 17 | 18 | 使用中 19 | 22 | 25 | 26 | 有约 27 | 28 | 桌子 29 | 30 | 31 | 32 | 44 | 45 | 48 | -------------------------------------------------------------------------------- /vue/src/components/LeftLayout.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 56 | 84 | -------------------------------------------------------------------------------- /vue/src/components/Score.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 信用分: 4 | {{score}} 5 | 6 | 7 | 8 | 29 | 30 | 33 | -------------------------------------------------------------------------------- /vue/src/components/Seat.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 53 | 54 | 72 | -------------------------------------------------------------------------------- /vue/src/components/TabLayout.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 45 | 75 | -------------------------------------------------------------------------------- /vue/src/components/TimeListCharts.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 72 | 73 | 75 | -------------------------------------------------------------------------------- /vue/src/components/TimeSlider.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ startText }} 6 | -- 7 | {{ endText }} 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 121 | 122 | 125 | -------------------------------------------------------------------------------- /vue/src/components/ToggleArea.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 39 | 40 | 43 | -------------------------------------------------------------------------------- /vue/src/components/UserCounterListCharts.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 72 | 73 | 75 | -------------------------------------------------------------------------------- /vue/src/components/navbar.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ title }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 37 | 38 | 89 | -------------------------------------------------------------------------------- /vue/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import ElementUI from 'element-ui'; 5 | import 'element-ui/lib/theme-chalk/index.css'; 6 | import Vant from 'vant'; 7 | import 'vant/lib/index.css'; 8 | 9 | Vue.config.productionTip = false 10 | 11 | Vue.use(Vant); 12 | Vue.use(ElementUI); 13 | 14 | function getUser() { 15 | return JSON.parse(localStorage.getItem('user')); 16 | } 17 | 18 | function timeStamp(value) { 19 | 20 | let date = new Date(value); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 21 | let year = date.getFullYear(); 22 | let month = ("0" + (date.getMonth() + 1)).slice(-2); 23 | let sdate = ("0" + date.getDate()).slice(-2); 24 | let hour = ("0" + date.getHours()).slice(-2); 25 | let minute = ("0" + date.getMinutes()).slice(-2); 26 | let second = ("0" + date.getSeconds()).slice(-2); 27 | let result = year + "." + month + "." + sdate + " " + hour + ":" + minute //+ ":" + second; 28 | // 返回 29 | return result; 30 | } 31 | 32 | Vue.prototype.$getUser=getUser 33 | Vue.prototype.$formatTime = timeStamp 34 | 35 | new Vue({ 36 | router, 37 | render: function (h) { 38 | return h(App) 39 | } 40 | }).$mount('#app') 41 | -------------------------------------------------------------------------------- /vue/src/req.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | const request = axios.create({ 4 | baseURL: '/api', 5 | timeout: 60000, 6 | withCredentials: true 7 | }) 8 | 9 | // 比如统一加token,对请求参数统一加密 10 | request.interceptors.request.use(config => { 11 | // config.headers['token'] = window.localStorage.getItem("token"); // 设置请求头 12 | // hideLoading(); // 隐藏加载 13 | return config 14 | }, error => { 15 | 16 | return Promise.reject(error) 17 | }); 18 | 19 | // response 拦截器 20 | // 可以在接口响应后统一处理结果 21 | request.interceptors.response.use( 22 | response => { 23 | return response.data 24 | }, 25 | error => { 26 | console.log('err' + error) // for debug 27 | return error 28 | } 29 | ) 30 | 31 | 32 | export default request 33 | -------------------------------------------------------------------------------- /vue/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | Vue.use(VueRouter) 5 | 6 | const routes = [ 7 | { 8 | path: '/login', 9 | component: () => import('../Guide/Login') 10 | }, { 11 | path: '/register', 12 | component: () => import('../Guide/Register') 13 | }, { 14 | path: '/admin', 15 | component: () => import('../admin/Main'), 16 | children: [ 17 | { 18 | path: 'announce', 19 | component: () => import('../admin/AnnounceManagement') 20 | }, { 21 | path: 'forum', 22 | component: () => import('../admin/ForumManagement') 23 | }, { 24 | path: 'seat', 25 | component: () => import('../admin/SeatManagement'), 26 | children: [ 27 | { 28 | path: "number", 29 | component: () => import('../admin/SeatNumber') 30 | }, 31 | { 32 | path: "crud", 33 | component: () => import('../admin/SeatCrud') 34 | } 35 | ] 36 | }, { 37 | path: 'student', 38 | component: () => import('../admin/StudentManagement') 39 | }, { 40 | path: 'teacher', 41 | component: () => import('../admin/TeacherManagement') 42 | }, { 43 | path: 'statistics', 44 | component: () => import('../admin/Statistics') 45 | }, 46 | ] 47 | }, 48 | { 49 | path: '/student', 50 | component: () => import('../user/Main'), 51 | children: [ 52 | { 53 | path: 'forum', 54 | component: () => import('../user/Forum') 55 | }, 56 | { 57 | path: 'seat', 58 | component: () => import('../user/Seat'), 59 | children: [ 60 | { 61 | path: 'reservation', 62 | component: () => import('../user/Reservation') 63 | }, { 64 | path: 'toSigned', 65 | component: () => import('../user/ToSigned') 66 | }, { 67 | path: 'beUse', 68 | component: () => import('../user/BeUse') 69 | } 70 | ] 71 | } 72 | 73 | ] 74 | } 75 | , { 76 | path: '/LookStudentMess', 77 | component: () => import('../teacher/StudentMess') 78 | }, { 79 | path: '/ScoreMess', 80 | component: () => import('../user/ScoreMess') 81 | }, { 82 | path: '/PushArticle', 83 | component: () => import('../user/PushArticle') 84 | }, { 85 | path: '/ForumInfo', 86 | component: () => import('../user/ForumInfo') 87 | }, { 88 | path: '/Teacher', 89 | component: () => import('../teacher/Main'), 90 | children: [ 91 | { 92 | path: 'seat', 93 | component: () => import('../teacher/SeatMess') 94 | }, { 95 | path: 'reservation', 96 | component: () => import('../teacher/ReservationMess') 97 | }, { 98 | path: 'score', 99 | component: () => import('../teacher/ScoreManagement') 100 | } 101 | ] 102 | } 103 | ] 104 | 105 | const router = new VueRouter({ 106 | mode: 'history', 107 | base: process.env.BASE_URL, 108 | routes 109 | }) 110 | 111 | export default router 112 | -------------------------------------------------------------------------------- /vue/src/teacher/Main.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {active=index;if($route.path!==tab.url)$router.replace(tab.url)}" 6 | :style="index===active?'color:#409eff;font-weight:bold;':''" v-for="(tab,index) in tabs">{{ tab.name }} 7 | 8 | 9 | 10 | 11 | 12 | 42 | 43 | 46 | -------------------------------------------------------------------------------- /vue/src/teacher/ReservationMess.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ item.username }} 7 | {{ getTime(item.startTime) }} 8 | 9 | 10 | 11 | 12 | {{ getState(item.state) }} 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 66 | 67 | 70 | -------------------------------------------------------------------------------- /vue/src/teacher/ScoreManagement.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ item.username }} 7 | {{ getTime(item.startTime) }} 8 | 9 | 10 | 11 | 12 | {{ getState(item.state) }} 13 | 14 | 15 | 扣分 16 | 已扣{{ item.score }}分 17 | 18 | 19 | 20 | 21 | 22 | 23 | 70 | 71 | 74 | -------------------------------------------------------------------------------- /vue/src/teacher/SeatMess.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 签到码:{{number}} 10 | 11 | 12 | 13 | 14 | 15 | 63 | 64 | 68 | -------------------------------------------------------------------------------- /vue/src/teacher/StudentMess.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{item.username}} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 32 | 33 | 36 | -------------------------------------------------------------------------------- /vue/src/user/BeUse.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 座位信息 10 | 11 | 12 | 13 | 14 | 15 | 16 | 暂离 17 | 18 | 19 | 20 | 21 | 61 | 62 | 65 | -------------------------------------------------------------------------------- /vue/src/user/Forum.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ item.title }} 6 | {{ item.content }} 7 | 8 | 9 | 发帖 10 | 11 | {{ item.title }} 12 | {{ item.content }} 13 | {{ $formatTime(item.datetime) }} 14 | 15 | 16 | 17 | 18 | 48 | 49 | 94 | -------------------------------------------------------------------------------- /vue/src/user/ForumInfo.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ item.title }} 6 | {{ item.content }} 7 | 8 | 评论 9 | 10 | 11 | 12 | {{ item.username }} 13 | {{ $formatTime(item.datetime) }} 14 | 15 | {{ item.content }} 16 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | 72 | 73 | 77 | -------------------------------------------------------------------------------- /vue/src/user/Main.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {active=index;if($route.path!==tab.url)$router.replace(tab.url)}" 6 | :style="index===active?'color:#409eff;font-weight:bold;':''" v-for="(tab,index) in tabs">{{ tab.name }} 7 | 8 | 9 | 10 | 11 | 12 | 42 | 43 | 46 | -------------------------------------------------------------------------------- /vue/src/user/PushArticle.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 17 | 18 | 发布 19 | 20 | 21 | 22 | 60 | 61 | 63 | -------------------------------------------------------------------------------- /vue/src/user/Reservation.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 预约 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 预约 24 | 25 | 26 | 27 | 144 | 145 | 148 | -------------------------------------------------------------------------------- /vue/src/user/ScoreMess.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{ item.username }} 8 | {{ getTime(item.startTime) }} 9 | 10 | 11 | 12 | 13 | {{ getState(item.state) }} 14 | 15 | 16 | 已扣{{ item.score }}分 17 | 18 | 19 | 20 | 21 | 22 | 23 | 65 | 66 | 69 | -------------------------------------------------------------------------------- /vue/src/user/Seat.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | 24 | -------------------------------------------------------------------------------- /vue/src/user/ToSigned.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 座位信息 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {{ stateName }}签到 19 | 20 | 21 | 22 | 23 | 73 | 74 | 77 | -------------------------------------------------------------------------------- /vue/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | open: false, 4 | host: '0.0.0.0', 5 | port: 8080, 6 | https: false, 7 | disableHostCheck: true, 8 | proxy: { 9 | '/api': { 10 | target: 'http://localhost:9003/', 11 | ws: true, 12 | changOrigin: true, 13 | pathRewrite: { 14 | '^/api': '' 15 | } 16 | } 17 | } 18 | } 19 | } 20 | --------------------------------------------------------------------------------