真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Java如何實(shí)現(xiàn)在線考試系統(tǒng)

這篇文章主要介紹了Java如何實(shí)現(xiàn)在線考試系統(tǒng),具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

創(chuàng)新互聯(lián)是一家專業(yè)提供庫車企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司、H5建站、小程序制作等業(yè)務(wù)。10年已為庫車眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。

學(xué)生模塊功能比較少,就是進(jìn)行考試和查看自己成績兩個(gè)大的功能。

學(xué)生進(jìn)行考試的功能比較復(fù)雜(首先做了校驗(yàn),不在考試時(shí)間范圍內(nèi),不能進(jìn)行考試)

考試試題是數(shù)據(jù)庫根據(jù)發(fā)布考試時(shí)的條件隨機(jī)產(chǎn)生的一套試題。因?yàn)槊看慰荚囶}型題量都是不同的,因此我們繼續(xù)采用JSON的格式去保存數(shù)據(jù),當(dāng)狀態(tài)為1:表示正在考試;狀態(tài)為2:表示已經(jīng)考試結(jié)束;狀態(tài)為3:表示老師已經(jīng)閱完試卷

(1)當(dāng)考試考試的時(shí)候,會(huì)給考上隨機(jī)產(chǎn)生一套試題,并存儲(chǔ)到數(shù)據(jù)庫中,如果考試中電腦突然壞了可以保證重新打開還是之前的試題

(2)考試時(shí)間結(jié)束會(huì)自動(dòng)提交考試,此時(shí)會(huì)將有學(xué)生成績的試題保存到數(shù)據(jù)庫中,老師批閱試卷就是從該JSON中讀取出來的

(3)老師批閱完試卷以后,狀態(tài)會(huì)變?yōu)?,JSON中會(huì)加上考生每道題的得分情況(考試倒計(jì)時(shí)根據(jù)考試考試時(shí)間和考試時(shí)間長度進(jìn)行計(jì)算出來的,如果下午四點(diǎn)考試結(jié)束,學(xué)生三點(diǎn)半登錄系統(tǒng),就只有半個(gè)小時(shí)時(shí)間進(jìn)行考試)

@InitBinderpublic void initBinder(WebDataBinder binder) {SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));}@RequestMapping("/list")public String showExam(HttpServletRequest request,Integer curr, Model model){if (curr == null){curr = 1;}HttpSession session = request.getSession();Student student = (Student) session.getAttribute("studentInfo");Integer classesid = student.getClassesid();if (classesid != null){PageInfo publishexamList = publishExamService.selectAll(classesid, curr, 5);model.addAttribute("publishexamList", publishexamList);}model.addAttribute("studentInfo", student);return "/exam/list";}//進(jìn)入考試頁面,初始化數(shù)據(jù)@SuppressWarnings("unchecked")@RequestMapping("/exam")public String exam(HttpServletRequest request,int id,Model model){//0表示0.5小時(shí),1表示1小時(shí),2表示1.5小時(shí),3表示2小時(shí),4表示2.5小時(shí),5表示3小時(shí)//考試時(shí)間所對(duì)應(yīng)的毫秒數(shù)long[] dateLong = {30*60*1000, 60*60*1000, 90*60*1000, 120*60*1000, 150*60*1000, 180*60*1000};PublishexamWithBLOBs publishexam = publishExamService.selectByKey(id);HttpSession session = request.getSession();Student student = (Student) session.getAttribute("studentInfo");//在考試記錄表中添加一條考試信息Examhis examhis = examhisService.studentIsNotExam(student.getId(), publishexam.getSubjectId(), publishexam.getExamtime());List textList = null;ArrayList list = JsonUtils.toBean(publishexam.getExam(), ArrayList.class, TextModel.class);Date date = new Date();Date date2 = new Date();date2.setTime(publishexam.getExamtime().getTime() + dateLong[publishexam.getExamlength()]);//當(dāng)前時(shí)間如果在考試時(shí)間之前,考試還未開始if (date.compareTo(publishexam.getExamtime()) <= 0){model.addAttribute("message", "對(duì)不起當(dāng)前考試還未開始!");return "/message";}/*1.當(dāng)前時(shí)間>考試時(shí)間+考試時(shí)長,考試已經(jīng)結(jié)束 2.examhis=null,則證明作者第一次點(diǎn)擊開始考試如果examhis不為空狀態(tài)為1:表示正在考試狀態(tài)為2:表示已經(jīng)考試結(jié)束,狀態(tài)為3:表示老師已經(jīng)閱完試卷*/if (date.compareTo(date2) >= 0 || (examhis != null && examhis.getStatus() != 1)){model.addAttribute("message", "對(duì)不起當(dāng)前考試已經(jīng)結(jié)束!");return "/message";}if (examhis == null){examhis = new Examhis();examhis.setStudentid(student.getId());examhis.setStudentname(student.getName());examhis.setSubjectid(publishexam.getSubjectId());examhis.setSubjectname(publishexam.getSubjectName());examhis.setClassesid(student.getClassesid());examhis.setClassesname(student.getClassesname());examhis.setPublishexamid(id);examhis.setExamtime(publishexam.getExamtime());examhis.setStatus(1);textList = new ArrayList();for (TextModel textModel : list) {List text = textService.beginExam(textModel,publishexam.getSubjectId());for (Text text2 : text) {text2.setTexId(textModel.getTextModelId());}textList.addAll(text);}String json = JsonUtils.toJson(textList);examhis.setExamtest(json);examhisService.insert(examhis);}else{textList = JsonUtils.toBean(examhis.getExamtest(), ArrayList.class, Text.class);}int sum = 0;for (TextModel textModel : list) {sum += textModel.getGrade()*textModel.getTextCount();}List textModelList = textModelService.selectTextModel(list);model.addAttribute("textModelList", textModelList);model.addAttribute("studentInfo", student);model.addAttribute("textList", textList);model.addAttribute("publishexam", publishexam);model.addAttribute("sum", sum);model.addAttribute("examTimeLength", dateLong[publishexam.getExamlength()]/1000);model.addAttribute("examTime", (date2.getTime() - date.getTime())/1000);return "/exam/exam";}//提交考試方法@RequestMapping(value="/examEnd", method=RequestMethod.POST)@ResponseBodypublic AjaxResult examEnd(HttpServletRequest request, ExamList examList, int id){PublishexamWithBLOBs publishexam = publishExamService.selectByKey(id);HttpSession session = request.getSession();Student student = (Student) session.getAttribute("studentInfo");//將考試信息轉(zhuǎn)成json,改變考試狀態(tài),更新到考試歷史記錄表中Examhis examhis = examhisService.studentIsNotExam(student.getId(), publishexam.getSubjectId(), publishexam.getExamtime());List list = examList.getExamList();list.remove(0);for (Exam exam : list) {exam.setText(textService.selectOne(exam.getTextId()));if (exam.getAnswer() == null){exam.setAnswer(" ");}}String json = JsonUtils.toJson(list);examhis.setExamtest(json);examhis.setStatus(2);examhisService.update(examhis);return AjaxResult.successInstance("您已成功提交考試");}

因?yàn)椴樵兂煽儽容^簡(jiǎn)單,就是查詢出學(xué)生成績,顯示到頁面上而已,正在進(jìn)行的考試成績?yōu)榭铡?/p>

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Java如何實(shí)現(xiàn)在線考試系統(tǒng)”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!


分享題目:Java如何實(shí)現(xiàn)在線考試系統(tǒng)
本文URL:http://weahome.cn/article/ipidcs.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部