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.mysql.fabric.Response;
import com.taohan.online.exam.po.*;
import com.taohan.online.exam.service.*;
/**
*
* <p>Title: StudentInfoHandler</p>
* <p>Description: </p>
* @author: taohan
* @date: 2018-8-16
* @time: 上午10:22:22
* @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);
/**
* 获取学生集合
* @param studentId 学生编号
* @param classId 班级编号
* @param gradeId 年级编号
* @param startPage 起始页 default=1
* @param pageShow 页容量 default=10
* @return
*/
@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;
}
/**
* 根据编号获取学生信息
* @param studentId
* @return
*/
@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;
}
/**
* 添加/修改学生信息
* @param studentId
* @param isUpdate 操作标识
* @param studentName
* @param studentAccount
* @param studentPwd
* @param classId
* @return
*/
@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";
}
/**
* 删除学生
* @param studentId
* @return
*/
@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";
}
/**
* 预添加学生
* @return
*/
@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;
}
/**
* 学生考试登录验证
*
* 此处验证并不合理 登录验证实现如下:
* 前台学生登录传入账户,后台根据账户获取学生密码
* 返回学生密码,前台登录焦点离开密码框使用 JavaScript 判断
*
* @param studentAccount 学生登录账户
* @param response
* @throws IOException
*/
@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());
}
}
/**
* 学生登录考试
* @param student 登录学生
* @param request
* @return
*/
@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/
没有合适的资源?快使用搜索试试~ 我知道了~
jsp+ssm+mysql实现在线考试系统.zip
共705个文件
gif:153个
jar:99个
png:83个
需积分: 47 83 下载量 80 浏览量
2019-06-17
16:06:13
上传
评论 15
收藏 59.23MB ZIP 举报
温馨提示
因上传限制大小,该资源仅包含工程源代码及sql文件,如需查看导入视频 可直接百度搜索 jsp+ssm+mysql实现在线考试系统 在线观看视频
资源推荐
资源详情
资源评论
收起资源包目录
jsp+ssm+mysql实现在线考试系统.zip (705个子文件)
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
StudentInfoHandler.class 17KB
SubjectInfoHandler.class 14KB
ExamSubjectMiddleInfoHandler.class 11KB
ClassInfoHandler.class 9KB
ExamPlanInfoHandler.class 8KB
StudentExamInfoCharts.class 8KB
TeacherInfoHandler.class 8KB
ExamPaperInfoHandler.class 6KB
StudentCount.class 5KB
SubjectImportUtil.class 5KB
CourseInfoHandler.class 5KB
GradeInfoHandler.class 5KB
SubjectInfo.class 5KB
StudentExamInfoHandler.class 4KB
ExamChooseInfoHandler.class 4KB
ExamPaperServiceImpl.class 3KB
ExamPaperInfo.class 3KB
TeacherInfo.class 3KB
AdminHomeHandler.class 3KB
TeacherInfoTest.class 3KB
StudentInfo.class 2KB
StudentInfoTest.class 2KB
ExamChooseInfo.class 2KB
StudentExamInfo.class 2KB
ExamPlanInfo.class 2KB
StudentInfoServiceImpl.class 2KB
TeacherInfoServiceImpl.class 2KB
ClassInfoServiceImpl.class 2KB
ExamSubjectMiddleInfoTest.class 2KB
ExamHistoryInfo.class 2KB
SubjectInfoServiceImpl.class 2KB
ExamChooseInfoServiceImpl.class 2KB
ClassInfo.class 2KB
CourseInfo.class 2KB
ExamHistoryInfoHandler.class 2KB
ExamHistoryPaper.class 2KB
ExamPlanInfoServiceImpl.class 2KB
ExamSubjectMiddleInfo.class 2KB
ExamSubjectMiddleInfoServiceImpl.class 2KB
ExamHistoryPaperServiceImpl.class 2KB
CourseInfoServiceImpl.class 2KB
LoginInterceptor.class 1KB
GradeInfoServiceImpl.class 1KB
GradeInfo.class 1KB
StudentExamInfoServiceImpl.class 1KB
ClassInfoMapper.class 987B
ExamPaperInfoService.class 958B
ExamPaperInfoMapper.class 956B
ClassInfoService.class 915B
StudentInfoService.class 903B
StudentInfoMapper.class 897B
ExamChooseInfoService.class 880B
ExamChooseInfoMapper.class 874B
TeacherInfoService.class 787B
TeacherInfoMapper.class 781B
SubjectInfoService.class 767B
ExamSubjectMiddleInfoService.class 762B
SubjectInfoMapper.class 761B
ExamSubjectMiddleInfoMapper.class 756B
ExamHistoryPaperService.class 672B
ExamPlanInfoService.class 671B
ExamHistoryPaperMapper.class 666B
ExamPlanInfoMapper.class 665B
CourseInfoService.class 619B
CourseInfoMapper.class 613B
GradeInfoService.class 533B
GradeInfoMapper.class 527B
StudentExamInfoService.class 472B
StudentExamInfoMapper.class 466B
StringUtil.class 311B
.classpath 842B
org.eclipse.wst.common.component 491B
org.eclipse.wst.jsdt.ui.superType.container 49B
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
共 705 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
边锋18569936318
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功