package cn.ds.controller;
import cn.ds.pojo.Exam.*;
import cn.ds.pojo.Student;
import cn.ds.pojo.Teacher;
import cn.ds.service.ExamService;
import cn.ds.service.StudentService;
import cn.ds.service.TeacherService;
import cn.ds.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.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;
//2019.1.3添加
@RequestMapping("/addexam")
public String addexam(Model model){
List<Teacher> teachers = userService.findTeacherAll();
model.addAttribute("teacher",teachers);
return "page/teacher/addexam";
}
@RequestMapping("/adminaddexam")
public String AdminAddExam(Model model){
List<Teacher> teachers = userService.findTeacherAll();
model.addAttribute("teacher",teachers);
return "page/admin/addexam";
}
@RequestMapping("/examadd") //添加考试
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());
System.out.println("返回的id" + examInformation.getId());
for (int i = 0;i<paperChoices.size();i++){
System.out.println("生成的题目" +paperChoices.get(i).getContent());
paperChoices.get(i).setExamid(examInformation.getId());
}
examService.insertRandChoice(paperChoices);
System.out.println("选择题生成成功");
for (int i = 0;i<paperJudges.size();i++){
System.out.println("生成的题目" +paperJudges.get(i).getContent());
paperJudges.get(i).setExamid(examInformation.getId());
}
examService.insertRandJudge(paperJudges);
System.out.println("判断题生成成功");
return "redirect:examall.do";
}
@RequestMapping("/adminexamadd") //添加考试
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());
System.out.println("返回的id" + examInformation.getId());
for (int i = 0;i<paperChoices.size();i++){
System.out.println("生成的题目" +paperChoices.get(i).getContent());
paperChoices.get(i).setExamid(examInformation.getId());
}
examService.insertRandChoice(paperChoices);
System.out.println("选择题生成成功");
for (int i = 0;i<paperJudges.size();i++){
System.out.println("生成的题目" +paperJudges.get(i).getContent());
paperJudges.get(i).setExamid(examInformation.getId());
}
examService.insertRandJudge(paperJudges);
System.out.println("判断题生成成功");
return "redirect:allexam.do";
}
@RequestMapping("/examall")
public String ExamAll(Model model){
List<ExamInformation>examInfos = examService.AllExam();
model.addAttribute("examInfo",examInfos);
return "page/teacher/exam_info";
}
@RequestMapping("detail")
public String ExamDetail(@RequestParam int examid, Model model){
System.out.println("考试id" +examid);
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("admindetail")
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";
}
@RequestMapping("deleteexam")
public String DeleteExam(@RequestParam int examid){
examService.DeletePaperChoice(examid);
examService.DeletePaperJudge(examid);
examService.DeleteExamInfo(examid);
return "redirect:examall.do";
}
@RequestMapping("admindeleteexam")
public String AdminDeleteExam(@RequestParam int examid){
System.out.println("删除的考试id"+ examid);
examService.DeletePaperChoice(examid);
examService.DeletePaperJudge(examid);
examService.DeleteExamInfo(examid);
return "redirect:allexam.do";
}
//管理员查询
@RequestMapping("/allexam")
public String AllExam(Model model){
List<ExamInformation>examInfos = examService.AllExam();
model.addAttribute("examInfo",examInfos);
return "page/admin/exam_info";
}
//根据考试id查询所有参加过考试的学生
@RequestMapping("/allexamstu")
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>() {//按score排序
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查询所有参加过考试的学生
@RequestMapping("/allstuexam")
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()
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
在线考试系统是一种基于互联网的教育技术工具,用于组织、管理和实施在线考试。这种系统通常由软件应用程序支持,为学生和考生提供了在网上参加考试的机会。在线考试系统可以用于各种教育和培训场景,包括学校教育、职业资格认证、招聘考试等。 【主要特点和优势】: 灵活性和便利性:学生和考生可以通过互联网随时随地参加考试,不再受限于特定的地点和时间。 自动化管理:系统能够自动管理考试安排、考生信息、考试成绩等数据。 安全性:在线考试系统通常具有严格的身份验证和防作弊措施。 实时反馈:考试结束后,系统可以立即生成和发布成绩,提供即时反馈。 多样化的题型:系统支持各种题型,包括选择题、填空题、问答题等多种题型。 数据分析:系统可以收集和分析大量的考试数据,帮助教育机构和考试机构更好地了解学生的表现和需求,优化教学和考试内容。 【引流】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes
资源推荐
资源详情
资源评论
收起资源包目录
SSM(Bootstrap+Jquery)在线考试系统examsystem.zip (641个子文件)
UserExample$GeneratedCriteria.class 12KB
ItemsExample$GeneratedCriteria.class 11KB
OrdersExample$GeneratedCriteria.class 11KB
OrderdetailExample$GeneratedCriteria.class 9KB
UserController.class 8KB
UserController.class 8KB
UserExample$Criteria.class 8KB
ItemsExample$Criteria.class 8KB
OrdersExample$Criteria.class 8KB
OrderdetailExample$Criteria.class 6KB
ExcelUtils.class 4KB
ExcelUtils.class 4KB
StudentServiceImpl.class 4KB
StudentServiceImpl.class 4KB
UserServiceImpl.class 4KB
UserServiceImpl.class 4KB
CustomerController.class 3KB
CustomerController.class 3KB
StudentController.class 3KB
StudentController.class 3KB
Choice.class 2KB
Choice.class 2KB
ItemsController.class 2KB
OrderdetailExample$Criterion.class 2KB
CustomerServiceImpl.class 2KB
CustomerServiceImpl.class 2KB
OrdersExample$Criterion.class 2KB
ItemsExample$Criterion.class 2KB
UserExample$Criterion.class 2KB
OrderdetailExample.class 2KB
PageBean.class 2KB
PageBean.class 2KB
OrdersExample.class 2KB
TeacherController.class 2KB
TeacherController.class 2KB
ItemsExample.class 2KB
UserExample.class 2KB
BasicifnoController.class 2KB
BasicifnoController.class 2KB
Msg.class 2KB
Msg.class 2KB
Items.class 2KB
ReadProgram.class 2KB
ReadProgram.class 2KB
ExcelBean.class 2KB
ExcelBean.class 2KB
ItemsServiceImpl.class 2KB
Student.class 2KB
Student.class 2KB
User.class 2KB
Orders.class 1KB
CommonInterceptor.class 1KB
CommonInterceptor.class 1KB
Point1.class 1KB
Point1.class 1KB
Customer.class 1KB
Customer.class 1KB
Point2.class 1KB
Point2.class 1KB
BasicInfoImpl.class 1KB
BasicInfoImpl.class 1KB
CustomDateConverter.class 1KB
Orderdetail.class 1KB
UserService.class 1KB
UserService.class 1KB
CustomPropertyEditor.class 984B
User.class 981B
User.class 981B
ItemsMapper.class 962B
Teacher.class 962B
Teacher.class 962B
UserMapper.class 941B
UserMapper.class 941B
OrderdetailMapper.class 877B
OrdersMapper.class 827B
UserMapper.class 807B
TeacherServiceImpl.class 774B
TeacherServiceImpl.class 774B
Semester.class 746B
Semester.class 746B
Major.class 737B
Major.class 737B
Class.class 731B
Class.class 731B
StudentMapper.class 548B
StudentMapper.class 548B
ItemsQueryVo.class 532B
BasicInfoMapper.class 510B
BasicInfoMapper.class 510B
BasicInfoService.class 456B
BasicInfoService.class 456B
CustomerMapper.class 455B
CustomerMapper.class 455B
ItemsService.class 428B
CustomerService.class 380B
CustomerService.class 380B
BaseService.class 375B
BaseService.class 375B
KnowledgeServiceImpl.class 323B
KnowledgeServiceImpl.class 323B
共 641 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
枫蜜柚子茶
- 粉丝: 8973
- 资源: 5351
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- whl@pip install pyaudio ERROR: Failed building wheel for pyaudio
- Constantsfd密钥和权限集合.kt
- 基于Java的财务报销管理系统后端开发源码
- 基于Python核心技术的cola项目设计源码介绍
- 基于Python及多语言集成的TSDT软件过程改进设计源码
- 基于Java语言的歌唱比赛评分系统设计源码
- 基于JavaEE技术的课程项目答辩源码设计——杨晔萌、李知林、岳圣杰、张俊范小组作品
- 基于Java原生安卓开发的蔚蓝档案娱乐应用设计源码
- 基于Java、Vue、JavaScript、CSS、HTML的毕设设计源码
- 基于Java和HTML的CMS看点咨询系统设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功