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语言和SSM(Spring、Spring MVC、MyBatis)框架开发的在线考试系统的项目描述。 项目名称:在线考试系统 项目概述 在线考试系统是一个基于B/S架构的Web应用程序,使用Java作为后端开发语言,结合SSM框架进行开发。该系统旨在提供一个方便、高效、公平的在线考试环境,支持多种题型,自动阅卷和成绩管理。
资源推荐
资源详情
资源评论
收起资源包目录
基于java语言SSM框架,在线考试系统 (350个子文件)
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
共 350 条
- 1
- 2
- 3
- 4
资源评论
就是一顿骚操作
- 粉丝: 446
- 资源: 40
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功