In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to implement the examination management system in Java". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Java how to achieve the examination management system" it!
Brief introduction of the project
The functions of this system include:
Support single-choice questions, multiple-choice questions, judgment questions support students (student), teacher (teacher), administrator (admin) three roles students: take the exam and view my exam teacher: all permissions of students + create / edit questions + create / edit exam administrator: all rights of teachers + administrative users.
Project operation
Environment configuration:
Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX (Webstorm is also fine) + Eclispe (both supported by IntelliJ IDEA,Eclispe,MyEclispe,Sts).
Project technology
It is composed of Springboot + Maven + Jpa+ Vue and so on, and BCMIS mode + Maven management and so on.
Effect picture display
Main code
Log in to the control layer:
@ RestControllerpublic class LoginController {@ Resource (name = "loginService") private ILoginService loginService; / * user login call generates two token after login and returns their home page * * student student/student * * teacher teacher/teacher * * administrator admin/admin * / @ RequestMapping (value = "/ login/login", method = RequestMethod.POST, produces = {"application/json" Charset=UTF-8 "}) public Result login (HttpRequest request) {return loginService.login (request.getString (" login_name "), request.getString (" pwd "));} / * * login check * / @ RequestMapping (value =" / login/check ", method = RequestMethod.POST, produces = {" application/json;charset=UTF-8 "}) public Result check () {return new Result () } / * token renewal * / @ RequestMapping (value = "/ login/refresh", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public Result refresh (HttpRequest request) {String refreshToken = request.getString ("refresh_token"); String urlId = request.getString ("url_id"); Token token = TokenCache.getInstance (). Get (urlId) If (token = = null) {ExceptionHelper.error (ErrorCode.ERROR_CODE_0003);} try {Claims claims = TokenUtils.parseToken (refreshToken); if ((String.valueOf (claims.getOrDefault ("student_id", ") {claims.put (" student_id ", SessionContext.get (" student_id ") } if (StringUtils.isNotEmpty ((String.valueOf (claims.getOrDefault ("teacher_id", ") {claims.put (" teacher_id ", SessionContext.get (" teacher_id ") } if ((String.valueOf (claims.getOrDefault ("login_name", ") {claims.put (" login_name ", SessionContext.get (" login_name "));} claims.put (" name ", claims.get (" name ")); token.setToken (TokenUtils.createToken (claims, TokenUtils.expireTime)) Token.setRefreshToken (TokenUtils.createToken (claims, TokenUtils.long_expireTime)); TokenCache.getInstance () .add (token);} catch (Exception e) {ExceptionHelper.error (ErrorCode.ERROR_CODE_0003);} return new Result (token) } / * exit the system * / @ RequestMapping (value = "/ login/exit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public Result exit (HttpRequest request) {String urlId = request.getString ("url_id"); if (StringUtils.isNotEmpty (urlId)) {TokenCache.getInstance () .remove (urlId) } return new Result ();}}
Unified management of student teacher administrator information:
/ * uniformly manage student and teacher administrator information * / @ RestControllerpublic class UserController {@ Resource (name = "userService") private IUserService userService; / * query user information * first determine the user type and query user information * / @ RequestMapping (value = "/ user/qryUserInfo", method = RequestMethod.POST, produces = {"application/json") Charset=UTF-8 "}) public Result qryUserInfo () {return userService.qryUserInfo ();} / * Update user information * / @ RequestMapping (value =" / user/update ", method = RequestMethod.POST, produces = {" application/json;charset=UTF-8 "}) public Result update (HttpRequest request) {User user = new User (); user.setUserId (request.getString (" user_id ")) User.setName (request.getString ("name")); user.setSex (request.getInteger ("sex")); user.setType (User.UserType.get (request.getInteger ("type")); return userService.update (user, ImageUtil.stringToBytes (request.getString ("user_image") Update user password * / @ RequestMapping (value = "/ user/updatePwd", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public Result updatePwd (HttpRequest request) {return userService.updatePwd (request.getString ("old_pwd"), request.getString ("pwd"));}}
Student Management Controller:
/ * Student Controller * / @ RestControllerpublic class StudentController {@ Resource (name = "studentService") private IStudentService studentService; / * Administrator queries student list * / @ RequestMapping (value = "/ student/qryPage", method = RequestMethod.POST, produces = {"application/json") Charset=UTF-8 "}) @ RoleAnnotation (types = {RoleEnum.admin}) public ListResult qryPage (HttpRequest request) {Map param = new HashMap (); int pageNo = request.containsKey (" page_no ")? Request.getInteger ("page_no"): 1; int pageSize = request.containsKey ("page_size")? Request.getInteger ("page_size"): 20; if (request.containsKey ("student_id")) {param.put ("student_id", request.getString ("student_id"));} if (request.containsKey ("name")) {param.put ("name", request.getString ("name");} return studentService.qryPage (param, pageNo, pageSize) } @ RequestMapping (value = "/ student/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @ RoleAnnotation (types = {RoleEnum.admin}) public Result insert (HttpRequest request) {Student student = new Student (); student.setStudentId (request.getString ("student_id")); student.setName (request.getString ("student_name")) Student.setPwd (request.getString ("student_id")); student.setSex (request.getInteger ("sex")); student.setClassId (request.getString ("class_id")); student.setUpdateTime (new Date ()); return studentService.insert (student, ImageUtil.stringToBytes (request.getString ("student_image"));} @ RequestMapping (value = "/ student/update", method = RequestMethod.POST, produces = {"application/json") Charset=UTF-8 "}) @ RoleAnnotation (types = {RoleEnum.admin}) public Result update (HttpRequest request) {Student student = new Student (); student.setStudentId (request.getString (" student_id ")); student.setName (request.getString (" student_name ")); student.setPwd (request.getString (" student_id ")); student.setSex (request.getInteger (" sex ")) Student.setClassId (request.getString ("class_id")); student.setUpdateTime (new Date ()); return studentService.update (student, ImageUtil.stringToBytes (request.getString ("student_image"));} @ RequestMapping (value = "/ student/del", method = RequestMethod.POST, produces = {"application/json") Charset=UTF-8 "}) @ RoleAnnotation (types = {RoleEnum.admin}) public Result del (HttpRequest request) {List studentIdList = new ArrayList (); JSONArray array = request.getJSONArray (" student_id_list "); for (int I = 0; I < array.size (); iTunes +) {studentIdList.add (array.getString (I));} return studentService.del (studentIdList) }} at this point, I believe you have a deeper understanding of "how to implement the examination management system in Java". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.