package cn.ganiner.controller;
import cn.ganiner.pojo.Exam.*;
import cn.ganiner.pojo.Student;
import cn.ganiner.pojo.Teacher;
import cn.ganiner.service.ExamService;
import cn.ganiner.service.StudentService;
import cn.ganiner.service.TeacherService;
import cn.ganiner.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
@Controller
@RequestMapping("/exam/")
public class ExamController {
@Autowired
private TeacherService teacherService;
@Autowired
private ExamService examService;
@Autowired
private UserService userService;
@Autowired
private StudentService studentService;
@RequestMapping(value = "addexam.do")
public String addexam(Model model){
List<Teacher> teachers = userService.findTeacherAll();
model.addAttribute("teacher",teachers);
return "page/teacher/addexam";
}
@RequestMapping(value = "adminaddexam.do")
public String AdminAddExam(Model model){
List<Teacher> teachers = userService.findTeacherAll();
model.addAttribute("teacher",teachers);
return "page/admin/addexam";
}
/**
* 添加考试
* @param examInformation
* @return
*/
@RequestMapping(value = "examadd.do")
public String examadd(ExamInformation examInformation){
examService.CreateExam(examInformation);
List<PaperJudge>paperJudges = examService.RandJudge((long) examInformation.getJudgenum(),examInformation.getChaptertwo(),examInformation.getDifficulty());
List<PaperChoice>paperChoices = examService.RandChoice((long) examInformation.getChoicenum(),examInformation.getChaptertwo(),examInformation.getDifficulty());
for (int i = 0;i<paperChoices.size();i++){
paperChoices.get(i).setExamid(examInformation.getId());
}
examService.insertRandChoice(paperChoices);
for (int i = 0;i<paperJudges.size();i++){
paperJudges.get(i).setExamid(examInformation.getId());
}
examService.insertRandJudge(paperJudges);
return "redirect:examall.do";
}
/**
* 添加选择题
* @param examInformation
* @return
*/
@RequestMapping(value = "adminexamadd.do")
public String Adminexamadd(ExamInformation examInformation){
examService.CreateExam(examInformation);
List<PaperJudge>paperJudges = examService.RandJudge((long) examInformation.getJudgenum(),examInformation.getChaptertwo(),examInformation.getDifficulty());
List<PaperChoice>paperChoices = examService.RandChoice((long) examInformation.getChoicenum(),examInformation.getChaptertwo(),examInformation.getDifficulty());
for (int i = 0;i<paperChoices.size();i++){
paperChoices.get(i).setExamid(examInformation.getId());
}
examService.insertRandChoice(paperChoices);
for (int i = 0;i<paperJudges.size();i++){
paperJudges.get(i).setExamid(examInformation.getId());
}
examService.insertRandJudge(paperJudges);
return "redirect:allexam.do";
}
/**
* 所有的考试
* @param model
* @return
*/
@RequestMapping(value = "examall.do")
public String ExamAll(Model model){
List<ExamInformation>examInfos = examService.AllExam();
model.addAttribute("examInfo",examInfos);
return "page/teacher/exam_info";
}
/**
* 考试详情
* @param examid
* @param model
* @return
*/
@RequestMapping(value = "detail.do")
public String ExamDetail(@RequestParam int examid, Model model){
List<PaperChoice>paperChoices = examService.AllPaperChoice(examid);
List<PaperJudge>paperJudges = examService.AllPaperJudge(examid);
ExamInformation examInformations = examService.findById(examid);
model.addAttribute("choice",paperChoices);
model.addAttribute("judge",paperJudges);
model.addAttribute("examinfo",examInformations);
return "page/teacher/exam_detail";
}
@RequestMapping(value = "admindetail.do")
public String AdminExamDetail(@RequestParam int examid, Model model){
List<PaperChoice>paperChoices = examService.AllPaperChoice(examid);
List<PaperJudge>paperJudges = examService.AllPaperJudge(examid);
ExamInformation examInformations = examService.findById(examid);
model.addAttribute("choice",paperChoices);
model.addAttribute("judge",paperJudges);
model.addAttribute("examinfo",examInformations);
return "page/admin/exam_detail";
}
/**
* 删除考题
* @param examid
* @return
*/
@RequestMapping(value = "deleteexam.do")
public String DeleteExam(@RequestParam int examid){
examService.DeletePaperChoice(examid);
examService.DeletePaperJudge(examid);
examService.DeleteExamInfo(examid);
return "redirect:examall.do";
}
@RequestMapping(value = "admindeleteexam.do")
public String AdminDeleteExam(@RequestParam int examid){
examService.DeletePaperChoice(examid);
examService.DeletePaperJudge(examid);
examService.DeleteExamInfo(examid);
return "redirect:allexam.do";
}
/**
* 管理员查询
* @param model
* @return
*/
@RequestMapping(value = "allexam.do")
public String AllExam(Model model){
List<ExamInformation>examInfos = examService.AllExam();
model.addAttribute("examInfo",examInfos);
return "page/admin/exam_info";
}
/**
* 根据考试id查询所有参加过考试的学生
* @param examid
* @param model
* @return
*/
@RequestMapping(value = "allexamstu.do")
public String AllExamStu(@RequestParam int examid, Model model){
Map<Long, Long> map = new HashMap<>();
List<ExamHistory>examHistories = examService.ByExamId(examid);
List<Long>longList = new ArrayList<Long>();
List<Student>students = new ArrayList<Student>();
for(int i = 0;i < examHistories.size();i++){
map.put(examHistories.get(i).getStudentid(),examHistories.get(i).getScore());
longList.add(examHistories.get(i).getStudentid());
}
if(longList.isEmpty()){
students.add(null);
}
else {
students = studentService.AllStudent(longList);
for (int i = 0; i < examHistories.size(); i++) {
students.get(i).setId(map.get(students.get(i).getId()));
}
Collections.sort(students, new Comparator<Student>() {
public int compare(Student p1, Student p2) {
if (p1.getId() < p2.getId()) {
return 1;
}
if (p1.getId() == p2.getId()) {
return 0;
}
return -1;
}
});
}
model.addAttribute("student",students);
return "page/admin/exam_allstudent";
}
/**
* 老师页根据考试id查询所有参加过考试的学生
* @param examid
* @param model
* @return
*/
@RequestMapping(value = "allstuexam.do")
public String AllStuExam(@RequestParam int examid, Model model){
Map<Long, Long> map = new HashMap<>();
List<ExamHistory>examHistories = examService.ByExamId(examid);
List<Long>longList = new ArrayList<Long>();
List<Student>students = new ArrayList<Student>();
for(int i = 0;i < examHistories.size();i++){
map.put(examHistories.get(i).getStudentid(),examHistories.get
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
在线考试系统是一种基于互联网的教育技术工具,用于组织、管理和实施在线考试。这种系统通常由软件应用程序支持,为学生和考生提供了在网上参加考试的机会。在线考试系统可以用于各种教育和培训场景,包括学校教育、职业资格认证、招聘考试等。 【主要特点和优势】: 灵活性和便利性:学生和考生可以通过互联网随时随地参加考试,不再受限于特定的地点和时间。 自动化管理:系统能够自动管理考试安排、考生信息、考试成绩等数据。 安全性:在线考试系统通常具有严格的身份验证和防作弊措施。 实时反馈:考试结束后,系统可以立即生成和发布成绩,提供即时反馈。 多样化的题型:系统支持各种题型,包括选择题、填空题、问答题等多种题型。 数据分析:系统可以收集和分析大量的考试数据,帮助教育机构和考试机构更好地了解学生的表现和需求,优化教学和考试内容。 【引流】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes
资源推荐
资源详情
资源评论
收起资源包目录
SSM实现的在线考试系统ssm-Online_Examination.zip (352个子文件)
bootstrap.css 143KB
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
font-awesome.css 34KB
font-awesome.min.css 30KB
font-awesome.min.css 30KB
font-awesome.min.css 28KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
bootstrap-social.css 20KB
dataTables.jqueryui.css 16KB
jquery.dataTables.css 15KB
jquery.dataTables_themeroller.css 14KB
dataTables.jqueryui.min.css 14KB
jquery.dataTables.min.css 13KB
sb-admin-2.min.css 8KB
sb-admin-2.css 8KB
codemirror.css 8KB
dataTables.bootstrap.css 7KB
dataTables.bootstrap4.css 5KB
dataTables.bootstrap.css 5KB
dataTables.bootstrap4.min.css 5KB
dataTables.bootstrap.min.css 4KB
dataTables.uikit.css 4KB
dataTables.uikit.min.css 3KB
dataTables.responsive.css 3KB
dataTables.semanticui.css 3KB
dataTables.foundation.css 3KB
dataTables.semanticui.min.css 3KB
dataTables.material.css 3KB
dataTables.foundation.min.css 3KB
dataTables.material.min.css 2KB
dracula.css 2KB
normalize.css 2KB
style.css 2KB
component.css 2KB
editTable.css 1KB
metisMenu.css 1KB
metisMenu.min.css 781B
demo.css 611B
morris.css 433B
base.css 352B
fontawesome-webfont.eot 162KB
fontawesome-webfont.eot 75KB
glyphicons-halflings-regular.eot 20KB
pattern.gif 127B
.gitattributes 116B
.gitignore 278B
index.html 10KB
favicon.ico 894B
ExamController.java 15KB
UserController.java 12KB
Tk_TeacherController.java 9KB
BasicifnoController.java 8KB
TkController.java 6KB
ExcelUtils.java 5KB
TkServiceImpl.java 5KB
StudentController.java 5KB
UserServiceImpl.java 4KB
StudentServiceImpl.java 3KB
TeacherController.java 3KB
BasicInfoImpl.java 3KB
ExamServiceImpl.java 3KB
ExamInformation.java 3KB
CustomExceptionResolver.java 2KB
Choice.java 2KB
PaperChoice.java 2KB
Judge.java 2KB
CustomerServiceImpl.java 2KB
LoginInterceptor.java 2KB
PageBean.java 1KB
Blank.java 1KB
AdminController.java 1KB
ExamMapper.java 1KB
ExcelBean.java 1KB
ProgramDesign.java 1KB
ReadProgram.java 1KB
ProgramFill.java 1KB
ExamService.java 1KB
TkService.java 1KB
Teacher.java 1KB
UserService.java 1KB
Msg.java 1KB
PaperJudge.java 1KB
Student.java 1KB
Customer.java 1KB
BasicInfoMapper.java 999B
BasicInfoService.java 978B
UserMapper.java 969B
StuInfo.java 948B
FindStudentScore.java 908B
AllAnswer.java 908B
ExamHistory.java 881B
Point1.java 764B
TeacherServiceImpl.java 730B
StudentMapper.java 684B
User.java 661B
StudentService.java 643B
共 352 条
- 1
- 2
- 3
- 4
资源评论
枫蜜柚子茶
- 粉丝: 6242
- 资源: 4607
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功