package com.taohan.online.exam.handler;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import oracle.net.aso.l;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.taohan.online.exam.po.*;
import com.taohan.online.exam.service.*;
/**
*
* <p>Title: StudentInfoHandler</p>
* <p>Description: </p>
* @version: 1.0
*/
@Controller
@SuppressWarnings("all")
public class StudentInfoHandler {
@Autowired
private StudentInfoService studentInfoService;
@Autowired
private ClassInfoService classInfoService;
@Autowired
private ExamSubjectMiddleInfoService examSubjectMiddleInfoService;
@Autowired
private ExamHistoryPaperService examHistoryPaperService;
@Autowired
private ExamChooseInfoService examChooseInfoService;
@Autowired
private ExamSubjectMiddleInfo esm;
@Autowired
private ClassInfo classInfo;
@Autowired
private ExamPaperInfo examPaper;
@Autowired
private GradeInfo grade;
@Autowired
private StudentInfo student;
@Autowired
private ExamPaperInfoService examPaperInfoService;
private Logger logger = Logger.getLogger(StudentInfoHandler.class);
@RequestMapping("/students")
public ModelAndView getCourses(@RequestParam(value = "studentId", required = false) Integer studentId,
@RequestParam(value = "classId", required = false) Integer classId,
@RequestParam(value = "gradeId", required = false) Integer gradeId,
@RequestParam(value="startPage", required=false, defaultValue="1") Integer startPage,
@RequestParam(value="pageShow", required=false, defaultValue="10") Integer pageShow ) {
logger.info("获取学员集合 classId="+classId+", gradeId="+gradeId+", startPage="+startPage+", pageShow="+pageShow);
ModelAndView model = new ModelAndView();
model.setViewName("/admin/students");
//查询条件处理
StudentInfo student = new StudentInfo();
if (studentId != null)
student.setStudentId(studentId);
if (classId != null) {
classInfo.setClassId(classId);
student.setClassInfo(classInfo);
}
if (gradeId != null) {
grade.setGradeId(gradeId);
student.setGrade(grade);
}
Map<String, Object> map = new HashMap<String, Object>();
//计算当前查询起始数据索引
int startIndex = (startPage-1) * pageShow;
map.put("student", student);
map.put("startIndex", startIndex);
map.put("pageShow", pageShow);
List<StudentInfo> students = studentInfoService.getStudents(map);
model.addObject("students", students);
int studentTotal = studentInfoService.getStudentTotal();
//计算总页数
int pageTotal = 1;
if (studentTotal % pageShow == 0)
pageTotal = studentTotal / pageShow;
else
pageTotal = studentTotal / pageShow + 1;
model.addObject("pageTotal", pageTotal);
model.addObject("pageNow", startPage);
return model;
}
@RequestMapping("/student/{studentId}")
public ModelAndView getCourseById(@PathVariable("studentId") Integer studentId) {
logger.info("获取学员 " + studentId);
ModelAndView model = new ModelAndView();
model.setViewName("/admin/studentedit");
StudentInfo student = studentInfoService.getStudentById(studentId);
model.addObject("student", student);
List<ClassInfo> classes = classInfoService.getClasses(null);
model.addObject("classes", classes);
return model;
}
@RequestMapping(value = "/student/student", method = RequestMethod.POST)
public String isUpdateOrAddCourse(
@RequestParam(value = "studentId", required = false) Integer studentId,
@RequestParam(value = "isupdate", required = false) Integer isUpdate,
@RequestParam(value = "studentName", required = false) String studentName,
@RequestParam("studentAccount") String studentAccount,
@RequestParam("studentPwd") String studentPwd,
@RequestParam("classId") Integer classId) {
StudentInfo student = new StudentInfo();
student.setStudentId(studentId);
student.setStudentName(studentName);
student.setStudentAccount(studentAccount);
student.setStudentPwd(studentPwd);
classInfo.setClassId(classId);
student.setClassInfo(classInfo);
if (isUpdate != null) {
logger.info("修改学员 " + student + " 的信息");
int row = studentInfoService.isUpdateStudent(student);
} else {
logger.info("添加学员 " + student + " 的信息");
int row = studentInfoService.isAddStudent(student);
}
return "redirect:/students";
}
@RequestMapping(value = "/student/{studentId}", method = RequestMethod.DELETE)
public String isDelTeacher(@PathVariable("studentId") Integer studentId) {
logger.info("删除学员 " + studentId);
int row = studentInfoService.isDelStudent(studentId);
return "redirect:/students";
}
@RequestMapping("/preAddStudent")
public ModelAndView preAddStudent() {
logger.info("预添加学员信息");
ModelAndView model = new ModelAndView();
model.setViewName("/admin/studentedit");
List<ClassInfo> classes = classInfoService.getClasses(null);
model.addObject("classes", classes);
return model;
}
@RequestMapping("/validateLoginStudent")
public void validateLoginStudent(@RequestParam("studentAccount") String studentAccount,
HttpServletResponse response) throws IOException {
logger.info("学员账户 "+studentAccount+",尝试登录考试");
//获取需要登录的学生对象
StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
if (student == null) {
logger.error("登录学员账户 "+studentAccount+" 不存在");
response.getWriter().print("n");
} else {
logger.error("登录学员账户 "+studentAccount+" 存在");
response.getWriter().print(student.getStudentPwd());
}
}
@RequestMapping(value="/studentLogin", method=RequestMethod.POST)
public ModelAndView studentLogin(StudentInfo student, HttpServletRequest request) {
ModelAndView model = new ModelAndView();
StudentInfo loginStudent = studentInfoService.getStudentByAccountAndPwd(student.getStudentAccount());
logger.info("学员 "+loginStudent+" 有效登录");
if(loginStudent == null || !student.getStudentPwd().equals(loginStudent.getStudentPwd())){
model.setViewName("reception/suc");
model.addObject("success", "密码错误");
return model;
}
request.getSession().setAttribute("loginStudent", loginStudent);
model.setViewName("reception/suc");
model.addObject("success", "登录成功");
return model;
}
/**
* 退出登录
* @param session
* @return
*/
@RequestMapping("/exit")
public String studentClearLogin(HttpSession session) {
StudentInfo studnet = (StudentInfo) session.getAttribute("loginStudent");
logger.info("学员 "+studnet.getStudentName()+", 编号 "+studnet.getStudentId()+" 退出登录");
session.removeAttribute("loginStudent");
return "redirect:index.jsp";
}
@RequestMapping("/validateAccount")
public void validateRegisterAccount(@RequestParam("studentAccount") String studentAccount,
HttpServletResponse response) throws IOException {
logger.info("验证学员账户 "+studentAccount+",是否已被注册");
StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
if (student == null) {
logger.error("注册学员账户 "+studentAccount+" 可以注册");
response.getWriter().print("t");
} else {
logger.error("注册学员
没有合适的资源?快使用搜索试试~ 我知道了~
基于java的驾考系统(SSM)
共576个文件
gif:153个
jar:97个
java:70个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 100 浏览量
2023-03-23
12:14:33
上传
评论 1
收藏 51.12MB 7Z 举报
温馨提示
运行效果,可参考b站链接: https://www.bilibili.com/video/BV1wL411k7Ey/?vd_source=bf2d43514ea61b1121399ab65421e37c 资源有代码和数据库文件,导入即可用。 数据库:MySQL 工具:IDEA和eclipse均可 语言:java 框架:SSM 先注册一个账号, 再进行登录, 如果已经有账号直接登录, 进入首页, 展示 一系列的考试信息和科目信息和试卷信息,同时还能进行考试。 老师登录:可以跳转到后台管理系统,可以查看学生考试详细信息, 学生试 卷详细信息,还可以查看年级以及班级的详细信息。 管理员登录: 可以跳转导后台管理系统, 可以进行该系统所有的功能进行增 删改,并且可以进行一些试卷的分类。
资源推荐
资源详情
资源评论
收起资源包目录
基于java的驾考系统(SSM) (576个子文件)
file_manager_json.ashx 6KB
upload_json.ashx 3KB
UpLoad_Class.asp 16KB
file_manager_json.asp 6KB
JSON_2.0.4.asp 5KB
upload_json.asp 3KB
demo.asp 2KB
demo.aspx 2KB
bootstrap.css 143KB
bootstrap.min.css 118KB
jquery-ui-1.9.2.custom.css 30KB
jquery-ui-1.9.2.custom.min.css 26KB
bootstrap-theme.css 26KB
zeroModal.css 23KB
bootstrap-theme.min.css 23KB
default.css 21KB
jedate.css 11KB
bootstrap-select.min.css 10KB
404.css 4KB
jeDate-test.css 3KB
qq.css 3KB
simple.css 2KB
prettify.css 973B
form-public.css 412B
index.css 282B
public.css 33B
LitJSON.dll 49KB
jedatefont.eot 2KB
static.gif 35KB
35.gif 13KB
42.gif 13KB
40.gif 10KB
18.gif 8KB
19.gif 8KB
11.gif 8KB
32.gif 7KB
49.gif 6KB
29.gif 6KB
97.gif 5KB
65.gif 5KB
31.gif 5KB
46.gif 5KB
57.gif 5KB
45.gif 5KB
8.gif 5KB
43.gif 4KB
33.gif 4KB
68.gif 4KB
26.gif 4KB
14.gif 4KB
7.gif 4KB
51.gif 4KB
10.gif 4KB
47.gif 4KB
72.gif 4KB
6.gif 3KB
94.gif 3KB
84.gif 3KB
41.gif 3KB
17.gif 3KB
9.gif 3KB
28.gif 3KB
50.gif 3KB
loading1.gif 3KB
95.gif 3KB
22.gif 3KB
27.gif 3KB
67.gif 3KB
90.gif 3KB
60.gif 3KB
loading.gif 3KB
58.gif 3KB
74.gif 2KB
25.gif 2KB
101.gif 2KB
54.gif 2KB
99.gif 2KB
24.gif 2KB
12.gif 2KB
73.gif 2KB
104.gif 2KB
103.gif 2KB
34.gif 2KB
88.gif 2KB
53.gif 2KB
4.gif 2KB
23.gif 2KB
5.gif 2KB
21.gif 2KB
3.gif 2KB
0.gif 2KB
20.gif 2KB
2.gif 2KB
39.gif 2KB
96.gif 2KB
100.gif 2KB
30.gif 2KB
48.gif 2KB
13.gif 2KB
38.gif 2KB
共 576 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
xiaozhima-dun
- 粉丝: 5630
- 资源: 46
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功