整个系统分为三部分,管理员子系统、教师子系统和学生子系统。学生子系统主要完成教师发布的作业信息的查看与下载,上传自己的作业,发布留言等功能,学生子系统模块如图4-1。
代码上传github上了。下载地址 https://github.com/21503882/work-submit
图4-1 学生子系统模块图
管理员子系统完成本站信息的管理与维护的功能,管理员子系统包括的主要功能模块有教师信息管理、课程信息管理、班级信息管理、开课信息管理、学生信息管理、教师上传资料管理、学生上传作业管理、留言管理等。管理员子系统功能模块图如图4-2。
图 4-2 管理员子系统模块
教师子系统可以分为发布作业资料模块,学生作业查看与下载模块,回复学生留言模块等,教师子系统如图4-3。
图 4-3 教师子系统模块
图5-4 系统登录界面
图5-5教师管理模块
图5-6 班级管理模块
图5-7 开课管理模块
图5-8 学生信息管理模块
图5-9 学生上传作业管理模块
图5-10 教师资料上传管理模块
图5-11 教师资料上传模块
图5-12 学生作业查看与下载管理模块
图5-13 留言查看与回复模块
图5-14 教学资料信息查看模块
图5-15 学生作业提交选择教师模块
作业查看模块
图5-16 学生作业提交模块
图5-17 留言模块
留言及回复
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.stereotype.Controller;
import com.hdxy.vehicle.base.Pagination;
import com.hdxy.vehicle.entity.Exam;
import com.hdxy.vehicle.entity.StudentInfo;
import com.hdxy.vehicle.entity.SysUser;
import com.hdxy.vehicle.service.ExamService;
import com.hdxy.vehicle.service.StudentInfoService;
import com.hdxy.vehicle.service.SysUserService;
import com.hdxy.vehicle.util.ActionResult;
/**
* TODO 类描述
*
* @version 0.0.1
* @author generator
* @date 2019-02-19
*/
@Controller
public class StudentInfoAction {
@Autowired
private StudentInfoService studentInfoService;
@Autowired
private ExamService examService;
@Autowired
private SysUserService sysUserService;
/**
* 统计学员信息
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/countStudentInfo")
public Pagination<StudentInfo> countStudentInfo(StudentInfo entity) {
try {
return studentInfoService.countStudentInfo(entity);
} catch (Exception e) {
e.printStackTrace();
}
return new Pagination<>(0, new ArrayList<>());
}
/**
* 显示退学学员信息并分页
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/findOutStudentInfo")
public Pagination<StudentInfo> findOutStudentInfo(StudentInfo entity, HttpSession session) {
try {
entity.setStuStatus(2);
SysUser sysUser = (SysUser) session.getAttribute("sysUser");
if (sysUser != null) {
if (sysUser.getType() == 0) {
entity.setCoach(sysUser.getId());
}
entity.setDeleted(0);
return studentInfoService.findPageByCondition(entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return new Pagination<>(0, new ArrayList<>());
}
/**
* 显示所有学员信息并分页
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/findStudentInfo")
public Pagination<StudentInfo> findStudentInfo(StudentInfo entity, HttpSession session) {
try {
SysUser sysUser = (SysUser) session.getAttribute("sysUser");
if (sysUser != null) {
if (sysUser.getType() == 0) {
entity.setCoach(sysUser.getId());
}
entity.setDeleted(0);
return studentInfoService.findPageByCondition(entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return new Pagination<>(0, new ArrayList<>());
}
/**
* 删除学员息
*
* @param id
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/delStudentInfo")
public ActionResult delStudentInfo(StudentInfo entity) {
ActionResult res = new ActionResult();
try {
entity.setDeleted(1);
studentInfoService.updateById(entity);
res.setSuccess(true);
res.setMsg("删除成功");
} catch (Exception e) {
e.printStackTrace();
res.setMsg("出现异常,删除失败");
}
return res;
}
/**
* 跳转编辑页面
*
* @param id
* @return
*/
@RequestMapping("/isAdmin/forwardEditStudentInfo")
public ModelAndView forwardEditStudentInfo(Integer id) {
ModelAndView model = new ModelAndView();
model.setViewName("backstage/editStudentInfo");
try {
StudentInfo studentInfo = studentInfoService.findById(id);
SysUser sysUser = new SysUser();
sysUser.setType(0);
sysUser.setState(1);
List<SysUser> coachList = sysUserService.findByCondition(sysUser);
model.addObject("studentInfoEdit", studentInfo);
model.addObject("coachList", coachList);
} catch (Exception e) {
e.printStackTrace();
}
return model;
}
/**
* 修改学员信息
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/upStudentInfo")
public ActionResult upStudentInfo(StudentInfo entity, HttpSession session) {
ActionResult res = new ActionResult();
try {
entity.setUpdateDate(new Date());
entity.setUpdateUser(((SysUser) session.getAttribute("sysUser")).getId());
studentInfoService.updateById(entity);
res.setSuccess(true);
res.setMsg("修改成功");
} catch (Exception e) {
e.printStackTrace();
res.setMsg("出现异常,修改失败");
}
return res;
}
/**
* 通过科目考试信息
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/studentInfoAudit")
public ActionResult studentInfoAudit(StudentInfo entity, Double score, HttpSession session) {
ActionResult res = new ActionResult();
try {
if ("001".equals(entity.getCurrentSub())) {
entity.setCurrentSub("002");
} else if ("002".equals(entity.getCurrentSub())) {
entity.setCurrentSub("003");
} else if ("003".equals(entity.getCurrentSub())) {
entity.setCurrentSub("004");
} else if ("004".equals(entity.getCurrentSub())) {
entity.setStuStatus(1);
}
entity.setUpdateDate(new Date());
entity.setUpdateUser(((SysUser) session.getAttribute("sysUser")).getId());
studentInfoService.updateById(entity);
// 插入成绩
Exam exam = new Exam();
exam.setUserId(entity.getUpdateUser());
exam.setScore(score);
exam.setCurrentSub(entity.getCurrentSub());
exam.setExamDate(new Date());
exam.setDeleted(0);
examService.save(exam);
;
res.setSuccess(true);
res.setMsg("操作成功");
} catch (Exception e) {
e.printStackTrace();
res.setMsg("出现异常,操作失败");
}
return res;
}
}