本系统主要实现的功能有: 学生以及老师的注册登录,在线考试,错题查询,学生管理,问题管理,错题管理,错题查询,分数查询,试卷管 理,人工组卷。自动组卷,教师,班级,统计等等管理功能。
环境配置: jdk1.8 + tomcat8.5 + mysql + eclispe (intellij idea,eclispe,myeclispe,sts 都支持)
项目技术: vue+springboot+ springmvc + mybatis + thymeleaf + javascript + jquery + ajax + maven等等
/** * yy */@restcontroller@requestmapping(value = "/v1/subjects")public class subjectcontroller { private static logger logger = loggerfactory.getlogger(subjectcontroller.class); @autowired subjectrvice subjectrvice; @apioperation(value = "获取科目列表", notes = "") @requestmapping(value = "", method = requestmethod.get) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public pageinfo<subject> getsubjectlist(@requestparam(required = fal) integer pageindex, @requestparam(required = fal) integer pagesize, @requestparam(required = fal) integer limit, @requestparam(required = fal) integer offt) { if(pageindex != null && pagesize != null) { pagehelper.startpage(pageindex, pagesize); } list<subject> subjects = subjectrvice.getsubjectlist(); pageinfo pageinfo = new pageinfo(subjects); return pageinfo; } @apioperation(value = "根据名字获取科目信息", notes = "根据科目名称获取科目详细信息") @apiimplicitparam(name = "name", value = "科目名称", required = true, datatype = "string", paramtype = "path") @requestmapping(value = "/{name}/name", method = requestmethod.get) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public list<subject> getsubjectbyname(@pathvariable string name) { return subjectrvice.getsubjectfuzzy(name); } @apioperation(value = "获取课程信息", notes = "根据课程id获取课程详细信息") @apiimplicitparam(name = "idorname", value = "课程id或名称", required = true, datatype = "string", paramtype = "path") @requestmapping(value = "/arch/{idorname}", method = requestmethod.get) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public list<subject> getsubjectforarch(@pathvariable string idorname) { list<subject> subjects = new arraylist<subject>(); subject subject = subjectrvice.getsubjectbyname(idorname); if (subject == null) { try { subject = subjectrvice.getsubjectbyid(idorname); } catch (exception e) { } } if (subject != null) { subjects.add(subject); } return subjects; } @apioperation(value = "创建课程", notes = "创建课程") @apiimplicitparam(name = "subject", value = "课程实体subject", required = true, datatype = "subject") @requestmapping(value = "", method = requestmethod.post) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public responentity<?> postsubject(@requestbody subject subject) { if(subjectrvice.getsubjectbyname(subject.getname()) != null) { return new responentity<object>(new dto("课程已存在!"), httpstatus.internal_rver_error); } subjectrvice.savesubject(subject); return new responentity(httpstatus.created); } @apioperation(value = "获取课程信息", notes = "根据课程id获取课程详细信息") @apiimplicitparam(name = "id", value = "课程id", required = true, datatype = "string", paramtype = "path") @requestmapping(value = "/{id}", method = requestmethod.get) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public subject getsubject(@pathvariable string id) { return subjectrvice.getsubjectbyid(id); } @apioperation(value = "更新课程信息", notes = "根据课程id更新用户信息") @apiimplicitparam(name = "subject", value = "课程实体", required = true, datatype = "subject") @requestmapping(value = "", method = requestmethod.put) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public responentity<?> putsubject(@requestbody subject subject) { subjectrvice.updatesubject(subject); return new responentity(httpstatus.ok); } @apioperation(value = "删除课程", notes = "根据课程id删除课程") @apiimplicitparam(name = "id", value = "课程id", required = true, datatype = "long", paramtype = "path") @requestmapping(value = "/{id}", method = requestmethod.delete) @preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')") public responentity<?> deletesubject(@pathvariable string id) { try { subjectrvice.deletesubject(id); }catch (runtimeexception e) { return new responentity(new dto("该课程包含有考试,不能删除"), httpstatus.internal_rver_error); } return new responentity(httpstatus.ok); }}
/*** yy*/@restcontroller@requestmapping(value = "/v1/questions")public class questioncontroller {private static logger logger = loggerfactory.getlogger(questioncontroller.class);@autowiredquestionrvice questionrvice;@autowiredpaperanswerpaperrvice paperanswerpaperrvice;@apioperation(value = "获取题目分页列表", notes = "")@requestmapping(value = "", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public pageinfo<question> getquestionlistbypage(@requestparam(required = fal) integer pageindex,@requestparam(required = fal) integer pagesize,@requestparam(required = fal) integer limit,@requestparam(required = fal) integer offt) {if(pageindex != null && pagesize != null) {pagehelper.startpage(pageindex, pagesize);}list<question> questions = questionrvice.getquestionlist();pageinfo pageinfo = new pageinfo(questions);return pageinfo;}@apioperation(value = "获取试卷题目分页列表", notes = "")@requestmapping(value = "/papers/{paperid}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public pageinfo<question> getquestionlistbypaper(@pathvariable string paperid,@requestparam(required = fal) integer pageindex,@requestparam(required = fal) integer pagesize,@requestparam(required = fal) integer limit,@requestparam(required = fal) integer offt) {if(pageindex != null && pagesize != null) {pagehelper.startpage(pageindex, pagesize);}list<question> questions = questionrvice.getquestionlistbypaper(paperid);pageinfo pageinfo = new pageinfo(questions);return pageinfo;}@apioperation(value = "获取试卷题目数量", notes = "")@requestmapping(value = "/papers/{paperid}/count", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public responentity<?> getquestioncountbypaper(@pathvariable string paperid) {integer count = questionrvice.countbypaperid(paperid);return new responentity<object>(count, httpstatus.ok);}@apioperation(value = "创建题目", notes = "创建题目")@apiimplicitparams({@apiimplicitparam(name = "question", value = "题目实体question", required = true, datatype = "question"),@apiimplicitparam(name = "id", value = "试卷id", required = true, datatype = "string", paramtype = "path")})@requestmapping(value = "/{id}", method = requestmethod.post)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public responentity<?> postquestion(@pathvariable("id") string id, @requestbody question question) {questionrvice.savequestion(id, question);return new responentity(httpstatus.created);}@apioperation(value = "获取题目信息", notes = "根据题目id获取题目详细信息")@apiimplicitparam(name = "id", value = "题目id", required = true, datatype = "string", paramtype = "path")@requestmapping(value = "/{id}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public question getquestion(@pathvariable string id) {return questionrvice.getquestion(id);}@apioperation(value = "根据试卷id和题目编号获取题目信息", notes = "根据题目id获取题目详细信息")@apiimplicitparams({@apiimplicitparam(name = "paperid", value = "试卷id", required = true, datatype = "string", paramtype = "path"),@apiimplicitparam(name = "number", value = "题目编号", required = true, datatype = "string", paramtype = "path")})@requestmapping(value = "/papers/{paperid}/questions/{number}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public question getquestionbypaperidandquestionid(@pathvariable string paperid,@pathvariable integer number,@requestparam(required = fal) string answerpaperid) {paperanswerpaper paperanswerpaper = null;//传入的是答卷idif(answerpaperid != null) {// todo: 2017-04-17paperanswerpaper = paperanswerpaperrvice.getbyanswerpaperid(answerpaperid);if(paperanswerpaper != null) {return questionrvice.getquestionbypaperidandquestionnumber(paperanswerpaper.getpaperid(), number);}el {logger.error("根据答卷id获取答卷失败");}}return questionrvice.getquestionbypaperidandquestionnumber(paperid, number);}@apioperation(value = "获取题目信息", notes = "根据题目name获取题目详细信息")@apiimplicitparam(name = "name", value = "试卷name", required = true, datatype = "string", paramtype = "path")@requestmapping(value = "/name/{name}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public list<question> getquestionbyname(@pathvariable string name) {//模糊查询return questionrvice.getquestionfuzzy(name);}@apioperation(value = "获取题目信息", notes = "根据试卷id获取所有题目")@apiimplicitparam(name = "paperid", value = "试卷id", required = true, datatype = "string", paramtype = "path")@requestmapping(value = "/papers/{paperid}/questions", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public list<question> getquestionbypaperid(@pathvariable string paperid) {return questionrvice.getquestionbypaperid(paperid);}@apioperation(value = "获取题目信息", notes = "根据试卷id获取所有题目,但不返回答案")@apiimplicitparam(name = "paperid", value = "试卷id", required = true, datatype = "string", paramtype = "path")@requestmapping(value = "/papers/{paperid}/ignore", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public list<question> getquestionbypaperidignoreanswer(@pathvariable string paperid) {return questionrvice.getquestionbypaperidignoreanswer(paperid);}@apioperation(value = "更新题目信息", notes = "根据题目id更新题目信息")@apiimplicitparam(name = "question", value = "题目实体", required = true, datatype = "question")@requestmapping(value = "", method = requestmethod.put)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public responentity<?> putquestion(@requestbody question question) {questionrvice.updatequestion(question);return new responentity(httpstatus.ok);}@apioperation(value = "删除题目", notes = "根据题目id删除试卷")@apiimplicitparam(name = "id", value = "题目id", required = true, datatype = "string", paramtype = "path")@requestmapping(value = "/{id}", method = requestmethod.delete)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public responentity<?> deletequestion(@pathvariable string id) {questionrvice.deletequestion(id);return new responentity(httpstatus.ok);}}
/*** 考试控制层,负责试卷提交等*/@restcontroller@requestmapping("/v1/exam")public class examcontroller {@autowiredexamrvice examrvice;@autowiredanswerpaperrvice answerpaperrvice;@autowiredanswerquestionrvice answerquestionrvice;@autowiredanswerpaperquestionrvice answerpaperquestionrvice;@autowiredquestionrvice questionrvice;@autowiredpaperrvice paperrvice;@autowiredwrongquestionrvice wrongquestionrvice;@autowiredpaperanswerpaperrvice paperanswerpaperrvice;@apioperation(value = "根据试卷id和题目编号获取题目信息", notes = "根据题目id获取题目详细信息")@apiimplicitparams({@apiimplicitparam(name = "paperid", value = "试卷id", required = true, datatype = "string", paramtype = "path"),@apiimplicitparam(name = "number", value = "题目编号", required = true, datatype = "string", paramtype = "path")})@requestmapping(value = "/questions/{number}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public question getquestionbypaperidandquestionid(@requestparam string paperid,@requestparam string urname,@requestparam(required = fal) string answerpaperid,@pathvariable integer number) {question question = null;answerquestion answerquestion = null;if(answerpaperid == null) {paper paper = paperrvice.getpaperbyid(paperid);if(paper != null) {answerpaper answerpaper = answerpaperrvice.findbyanswerurandpapername(urname, paper.getname());if(answerpaper != null) {answerquestion = answerquestionrvice.getanswerquestionbypaperidandquestionnumber(answerpaper.getid(), number);}}}el {answerquestion = answerquestionrvice.getanswerquestionbypaperidandquestionnumber(answerpaperid, number);}if(answerquestion == null) {question = questionrvice.getquestionbypaperidandquestionnumber(paperid, number);if(question != null) {//答案不返回question.tanswer("");}} el {question = new question();question.tid(answerquestion.getid());question.tnumber(answerquestion.getnumber());question.ttitle(answerquestion.gettitle());question.tscore(answerquestion.getscore());question.ttype(answerquestion.gettype());question.toptiona(answerquestion.getoptiona());question.toptionb(answerquestion.getoptionb());question.toptionc(answerquestion.getoptionc());question.toptiond(answerquestion.getoptiond());question.tanswer(answerquestion.getanswer());}return question;}@requestmapping(value = "/submit/{type}/{urname}", method = requestmethod.post)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public responentity<?> submit(@requestbody paper paper, @pathvariable string type,@pathvariable string urname,@requestparam(required = fal) string answerpaperid) {/*** 更改试卷状态,finished:true*/if(type.equals("official")) {/*** 正式考试*/answerpaper answerpaper = new answerpaper();if(answerpaperid != null) {answerpaper.tid(answerpaperid);}el {return new responentity<object>(httpstatus.internal_rver_error);}answerpaper.tanswertime(new simpledateformat("yyyy-mm-dd hh:mm:ss").format(new date()));answerpaper.tpapername(paper.getname());answerpaper.tanswerur(urname);answerpaper.tchecked("fal");answerpaper.tfinished("true");answerpaper.ttype("official");examrvice.updateanswerpaper(answerpaper);} el if(type.equals("simulate")) {/*** 模拟考试*/answerpaper answerpaper = new answerpaper();if(answerpaperid != null) {answerpaper.tid(answerpaperid);}el {return new responentity<object>(httpstatus.internal_rver_error);}answerpaper.tanswertime(new simpledateformat("yyyy-mm-dd hh:mm:ss").format(new date()));answerpaper.tpapername(paper.getname());answerpaper.tanswerur(urname);answerpaper.tchecked("fal");answerpaper.tfinished("true");answerpaper.ttype("simulate");examrvice.updateanswerpaper(answerpaper);}el if(type.equals("practice")) {/*** 1.接收提交的试卷* 2.计算成绩* 3.记录考试记录* 4.返回计算结果*/int score = 0;//正确题目数double right = 0.0;//错误题目数double wrong = 0.0;double correctrate = 0.0;list<question> questions = questionrvice.getquestionbypaperid(paper.getid());answerpaper answerpaper = answerpaperrvice.findbyanswerurandpapername(urname, paper.getname());list<answerquestion> answerquestions = answerquestionrvice.findbyanswerpaperid(answerpaper.getid());/*保存题目信息,返回给前端*/list<dtorightandwrong> results = new arraylist<dtorightandwrong>();dtorightandwrong dtorightandwrong = null;//遍历提交的试卷的题目for(answerquestion answerquestion : answerquestions) {//遍历包含正确答案的题目for(question question : questions) {/*** 1.题目序号相同* 2.结果与答案相同*/if(answerquestion.getnumber().equals(question.getnumber())) {if(answerquestion.getanswer().equals(question.getanswer())) {/*累计得分*/score += integer.parint(question.getscore());right ++;}el {wrong ++;//记录错题dtorightandwrong = new dtorightandwrong();dtorightandwrong.tquestion(que女孩子名字大全stion);dtorightandwrong.tanswerquestion(answerquestion);results.add(dtorightandwrong);//保存错题wrongquestion wrongquestion = new wrongquestion();try{beanutils.copyproperties(wrongquestion, answerquestion);wrongquestion.turname(urname);wrongquestion.trightanswer(question.getanswer());wrongquestion.tanalysis(question.getanalysis());if(wrongquestionrvice.getwrongquestion(wrongquestion.getid()) == null) {wrongquestionrvice.savequestion(wrongquestion);}}catch (exception e) {system.out.println(wrongquestion.tostring());}}}}}//计算正确率correctrate = (right/(right + wrong)) * 100;dtoresult result = new dtoresult();result.tscore(score);result.tright(right);result.twrong(wrong);result.tcorrectrate(correctrate);result.tresults(results);paper paper1 = paperrvice.getpaperbyid(paper.getid());//更新参与人数paper1.tpeoples(string.valueof(integer.parint(paper1.getpeoples()) + 1));paperrvice.updatepaper(paper1);return new responentity<object>(result, httpstatus.ok);}paper paper1 = paperrvice.getpaperbyid(paper.getid());//更新参与人数paper1.tpeoples(string.valueof(integer.parint(paper1.getpeoples() + 1)));paperrvice.updatepaper(paper1);return new responentity<object>(httpstatus.ok);}/*** 提交题目* @param urname* @param dtoanswerpaper* @return*/@requestmapping(value = "/submit/one/{urname}", method = requestmethod.post)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public responentity<?> submitone(@大学生主题班会pathvariable string urname, @requestbody dtoanswerpaper dtoanswerpaper) {paper paper = dtoanswerpaper.getpaper();question question = dtoanswerpaper.getquestion();//判断数据库是否保存了这次答卷answerpaper answerpaper = answerpaperrvice.getanswerpaperbynameandur(paper.getname(),浮力教案 urname);answerquestion answerquestion = null;answerpaperquestion answerpaperquestion = null;list<answerquestion> answerquestions = null;//重新生成idstring answerpaperid = idgen.uuid();string answerquestionid = idgen.uuid();//答卷为空,则执行保存if(answerpaper == null) {answerpaper = new answerpaper();answerpaper.tid(answerpaperid);answerpaper.tanswertime(new simpledateformat("yyyy-mm-dd hh:mm:ss").format(new date()));answerpaper.tpapername(paper.getname());answerpaper.ttype(paper.gettype());answerpaper.tanswerur(urname);answerpaper.tchecked("fal");answerpaper.tfinished("fal");//保存答卷answerpaperrvice.saveanswerpaper(answerpaper);// todo: 2017-04-17 保存试卷答卷paperanswerpaper paperanswerpaper = new paperanswerpaper();paperanswerpaper.tpaperid(paper.getid());paperanswerpaper.tanswerpaperid(answerpaperid);paperanswerpaperrvice.save(paperanswerpaper);//新记录answerquestion = new answerquestion();//初始化信息answerquestion.tid(answerquestionid);answerquestion.ttitle(question.gettitle());answerquestion.ttype(question.gettype());answerquestion.tnumber(question.getnumber());answerquestion.toptiona(question.getoptiona());answerquestion.toptionb(question.getoptionb());answerquestion.toptionc(question.getoptionc());answerquestion.toptiond(question.getoptiond());answerquestion.tcontent(question.getcontent());answerquestion.tscore(question.getscore());answerquestion.tanalysis(question.getanalysis());answerquestion.tanswer(question.getanswer());answerpaperquestion = new answerpaperquestion();answerpaperquestion.tanswerpaperid(answerpaper.getid());answerpaperquestion.tanswerquestionid(answerquestionid);//保存answerquestionrvice.saveanswerquestion(answerquestion);answerpaperquestionrvice.saveanswerpaperquestion(answerpaperquestion);return new responentity<object>(answerpaper, httpstatus.ok);} el {answerquestions = answerquestionrvice.findbyanswerpaperid(answerpaper.getid());if(answerquestions != null && answerquestions.size() > 0) {int count = 0;answerquestion existanswerquestion = null;for(answerquestion question1 : answerquestions) {if (question1.getnumber().equals(question.getnumber())) {count++;ex仙剑奇侠传小雪的诗istanswerquestion = question1;//保存当前存在的记录}}//记录不存在if(count == 0) {//新记录answerquestion = new answerquestion();answerpaperquestion = new answerpaperquestion();answerquestion = new answerquestion();//初始化信息answerquestion.tid(answerquestionid);answerquestion.ttitle(question.gettitle());answerquestion.ttype(question.gettype());answerquestion.tnumber(question.getnumber());answerquestion.to我们相爱吧是真的吗ptiona(question.getoptiona());answerquestion.toptionb(question.getoptionb());answerquestion.toptionc(question.getoptionc());answerquestion.toptiond(question.getoptiond());answerquestion.tcontent(question.getcontent());answerquestion.tscore(question.getscore());answerquestion.tanalysis(question.getanalysis());answerquestion.tanswer(question.getanswer());answerpaperquestion = new answerpaperquestion();answerpaperquestion.tanswerpaperid(answerpaper.getid());answerpaperquestion.tanswerquestionid(answerquestionid);//保存answerquestionrvice.saveanswerquestion(answerquestion);answerpaperquestionrvice.saveanswerpaperquestion(answerpaperquestion);} el {//记录存在,则执行更新// todo: 2017/3/30//更新当前存在的记录existanswerquestion.tanswer(question.getanswer());answerquestionrvice.updateanswerquestion(existanswerquestion);}}}return new responentity<object>(answerpaper, httpstatus.ok);}}
/*** 答卷控制层,用于获取已经提交的答卷*/@restcontroller@requestmapping("/v1/answer-papers")public class answerpapercontroller {@autowiredanswerpaperrvice answerpaperrvice;@autowiredanswerquestionrvice answerquestionrvice;/*** 根据id查找* @param id* @return*/@requestmapping(value = "/{id}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public answerpaper getanswerpaper(@pathvariable string id) {return answerpaperrvice.getanswerpaperbyid(id);}/*** 根据name查找* @param name* @return*/@requestmapping(value = "/name/{name}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public list<answerpaper> getanswerpaperbyname(@pathvariable string name) {return answerpaperrvice.getanswerpaperfuzzy(name);}/*** 根据答卷id和题目编号获取题目信息* @param paperid* @param number* @return*/@requestmapping(value = "/papers/{paperid}/questions/{number}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public answerquestion getquestionbypaperidandquestionid(@pathvariable string paperid, @pathvariable integer number) {answerquestion answerquestion = answerquestionrvice.getanswerquestionbypaperidandquestionnumber(paperid, number);return answerquestion;}/*** 已分页方式获取数据* @param urname* @param pageindex* @param pagesize* @param limit* @param offt* @return*/@requestmapping(value = "/urs/{urname}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public pageinfo<answerpaper> getlistbyur(@pathvariable("urname") string urname,@requestparam(required = fal) integer pageindex,@requestparam(required = fal) integer pagesize,@requestparam(required = fal) integer limit,@requestparam(required = fal) integer offt) {if(pageindex != null && pagesize != null) {pagehelper.startpage(pageindex, pagesize);}list<answerpaper> answerpapers = answerpaperrvice.getanswerpaperlistbyanswerur(urname);pageinfo pageinfo = new pageinfo(answerpapers);return pageinfo;}@requestmapping(value = "/urs/{urname}/type/{type}", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public pageinfo<answerpaper> getlistbyurandtype(@pathvariable("urname") string urname,@pathvariable("type") string type,@requestparam(required = fal) integer pageindex,@requestparam(required = fal) integer pagesize,@requestparam(required = fal) integer limit,@requestparam(required = fal) integer offt) {if(pageindex != null && pagesize != null) {pagehelper.startpage(pageindex, pagesize);}list<answerpaper> answerpapers = answerpaperrvice.getanswerpaperlistbyanswerurandtype(urname, type);pageinfo pageinfo = new pageinfo(answerpapers);return pageinfo;}/*** 获取未批改或已批改的答卷数量,* @return*/@requestmapping("/check")@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public dtotask countuncheckanswerpaper() {dtotask dtotask = new dtotask();integer checked = answerpaperrvice.countcheck("true");integer unchecked = answerpaperrvice.countcheck("fal");dtotask.tchecked(checked);dtotask.tunchecked(unchecked);return dtotask;}/*** 以分页方式获取数据* @param pageindex* @param pagesize* @param limit* @param offt* @return*/@requestmapping(value = "", method = requestmethod.get)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public pageinfo<answerpaper> getlistbyur(@requestparam(required = fal) integer pageindex,@requestparam(required = fal) integer pagesize,@requestparam(required = fal) integer limit,@requestparam(required = fal) integer offt) {if(pageindex != null && pagesize != null) {pagehelper.startpage(pageindex, pagesize);}list<answerpaper> answerpapers = answerpaperrvice.getanswerpaperlist();pageinfo pageinfo = new pageinfo(answerpapers);return pageinfo;}/*** 更新* @param answerpaper* @return*/@requestmapping(value = "", method = requestmethod.put)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public responentity<?> putpaper(@requestbody answerpaper answerpaper) {answerpaperrvice.updatepaper(answerpaper);return new responentity(httpstatus.ok);}/*** 计算考试成绩* @param id* @return*/@requestmapping(value = "/{id}/calculate", method = requestmethod.put)@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "') or hasauthority('" + role.role_student + "')")public responentity<?> calculationscore(@pathvariable string id) {/*** 计算成绩*/list<answerquestion> questions = answerquestionrvice.findbyanswerpaperid(id);if(questions != null && questions.size() > 0) {int score = 0;try {for(answerquestion question : questions) {score += integer.parint(question.getmarkscore());}} catch (exception e) {// todo: 2017/4/1}/*** 保存成绩*/answerpaper answerpaper = new answerpaper();answerpaper.tid(id);answerpaper.tscore(integer.tostring(score));answerpaper.tchecked("true");answerpaperrvice.updatepaper(answerpaper);} el {// todo: 2017/4/1}return new responentity<object>(httpstatus.ok);}@requestmapping(value = "/analysis/paper")@preauthorize("hasauthority('" + role.role_teacher + "') or hasauthority('" + role.role_admin + "')")public list<paperanalysis> analysispaper() {return answerpaperrvice.analysispaper();}}
以上就是java online exam在线考试系统的实现的详细内容,更多关于java 在线考试系统的资料请关注www.887551.com其它相关文章!
本文发布于:2023-04-03 22:29:20,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/81d26674c97d5ab9f74c3f6ee2e02c8a.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java Online Exam在线考试系统的实现.doc
本文 PDF 下载地址:Java Online Exam在线考试系统的实现.pdf
留言与评论(共有 0 条评论) |