一、项目简述
功能包括: 管理员可以增删改查教材、教材商、入库教材、用户(用 户包括学生和教师)可以对教材商、教材进行。xcel的导入 导出操作。教U阿以领取入库的教材,可以退还教材。学 生只能在对应的教师那里领取教材,并且可以退还教材、 查询自己已经领取的教材。并且对已领教材付款等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
teacherService.insertWordData(workapprovaldata);
return Msg.success();
}
//查看出差报告
@GetMapping("/select_work_data")
@ResponseBody
public Msg fun8(Integer pn, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
PageHelper.startPage(pn, 9);
List<Workapprovaldata> list = teacherService.selectWorkData(teacher.getIdSection());
PageInfo page = new PageInfo(list, 5);
return Msg.success().add("dataInfo", page);
}
//出差附件下载
@RequestMapping(value = "/file_download")
public ResponseEntity<byte[]> downloadFile(String dataId, HttpServletRequest req, HttpServletResponse response) throws IOException {
Workapprovaldata workapprovaldata = null;
if (dataId != null) {
Long id = Long.valueOf(dataId);
workapprovaldata = teacherService.selectWorkDataById(id);
}
if (workapprovaldata != null) {
String filePath = workapprovaldata.getDatarar();
//设置文件路径
List<Projecttype> projecttypes = teacherService.select_allProjecttype();
List<Projectsource> projectsources = teacherService.select_allProjectsource();
List<Specialty> specialties = teacherService.select_allSpecialty(teacher.getIdSection());
modelMap.addAttribute("projecttypes", projecttypes);
modelMap.addAttribute("projectsources", projectsources);
modelMap.addAttribute("specialties", specialties);
List<Project> projects = teacherService.selectTeacherProject(teacher.getName());
for (int i = 0; i < projects.size(); i++) {
if (projects.get(i).getVerifyprojectFlag() == 0) projects.get(i).setProjectZT("未审核");
else if (projects.get(i).getVerifyprojectFlag() == 1) projects.get(i).setProjectZT("审核未通过");
else projects.get(i).setProjectZT("审核通过");
}
modelMap.addAttribute("Myproject", projects);
return "teacher/graduation/section_xq/index";
}
// 发布或取消发布已审核通过的课题
@PostMapping("/fb_project")
@ResponseBody
public String fun8(Long project_id, String pd,HttpSession httpSession) {
int s = Integer.parseInt(pd);
teacherService.updateProjectFB(project_id, s);
if (s == 0) {
teacherService.deleteSelectedAll(project_id);
teacherService.updateProjectCount(project_id);
}
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSubmitted(teacher.getId());
return Msg.success().add("workinfo", list);
}
//删除申请失败的教师出差
@PostMapping("/delete_work")
@ResponseBody
public Msg deleteWork(Long id) {
teacherService.deleteWorkById(id);
return Msg.success();
}
//加载报告填写页面
@GetMapping("/fillworkapproval")
public String fun5(Long id, Model model) throws ParseException {
WorkapprovalWithBLOBs workapproval = teacherService.selectWorkById(id);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
String start = sdf.format(workapproval.getBeginDate());
String end = sdf.format(workapproval.getEndDate());
String time = start + " - " + end;
model.addAttribute("workapproval", workapproval);
model.addAttribute("time", time);
return "teacher/workapproval/fillwdata";
}
public Msg delClass(
@RequestBody MyClass myClass,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) classService.delClass(myClass, id_institute));
}
@ResponseBody
@PutMapping("/class")
public Msg putClass(
@RequestBody @Validated({One.class}) MyClass myClass,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) classService.putClass(myClass, id_institute));
}
@ResponseBody
@PostMapping("/class")
public String source() {
return "admin/Subject/SourceManagement";
}
@ResponseBody
@GetMapping("/sources")
public Msg getSources() {
return Msg.success().add("sources", subjectService.selectSubjectSources());
}
@ResponseBody
@PostMapping("/source")
public Msg addSource(@RequestBody @Validated SubjectSource source) throws MyException {
return Msg.sqlChange((int) subjectService.insertSubjectSource(source.getSourcename()));
}
@ResponseBody
@DeleteMapping("/source")
public Msg delSource(@RequestBody SubjectSource source) throws MyException {
return Msg.sqlChange(subjectService.delSubjectSource(source.getId()));
}
@ResponseBody
@PutMapping("/source")
public Msg updateSource(@RequestBody @Validated SubjectSource source) {
return Msg.sqlChange(subjectService.updateSubjectSource(source));
}
//课题类型
@GetMapping("/TypeManagement")
public String subjectType() {
return "admin/Subject/TypeManagement";
}
@PostMapping("/updateSubject")
@ResponseBody
public Msg updateProject(Long id, String projectName, Long idProjecttype, Long idProjectsource, String marchspecialty, String teachernames, @RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpSession httpSession) throws IOException {
//拼接 teacherNames 字段
TeacherWithBLOBs teacher = (TeacherWithBLOBs) request.getSession().getAttribute("teacherInfo");
String teacherName = teacher.getName();
if (teachernames == null || teachernames.trim().length() == 0) {
teachernames = teacherName;
} else {
teachernames = teacherName + "&" + teachernames;
}
SubjectWithBLOBs subject = null;
//文件大小 为 0 则表示 文件没上传
long size = file.getSize();
//不更新课题文件情况
if (file == null || size == 0) {
@GetMapping("/upload_topic_page")
public String uploadTopic(ModelMap modelMap, HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<Projecttype> projecttypes = teacherService.select_allProjecttype();
List<Projectsource> projectsources = teacherService.select_allProjectsource();
List<Specialty> specialties = teacherService.select_allSpecialty(teacher.getIdSection());
modelMap.addAttribute("projecttypes", projecttypes);
modelMap.addAttribute("projectsources", projectsources);
modelMap.addAttribute("specialties", specialties);
return "teacher/graduation/upload";
}
// 上传课题
@PostMapping("/up_project")
@ResponseBody
public Msg fun20(String projectName, Long idProjecttype, Long idProjectsource, String marchspecialty, String teachernames, @RequestParam("file") MultipartFile file, HttpServletRequest request, HttpSession httpSession) throws IOException {
// 把年份排序
Collections.sort(list, new Comparator<DebriefingYear>() {
@Override
public int compare(DebriefingYear o1, DebriefingYear o2) {
return (int) (o2.getYear() - o1.getYear());
}
});
return Msg.success().add("year", list);
}
//查询指定年份的年度述职信息
@GetMapping("/select_debriefing_year_info")
@ResponseBody
public Msg fun12(Long year, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
DebriefingYearWithBLOBs debriefingYear = teacherService.selectYearDebriefingInfo(teacher.getId(), year);
return Msg.success().add("debriefingInfo", debriefingYear);
}
//查询学期述职中年份
@GetMapping("select_debriefing_term")
@ResponseBody
public Msg fun13() {
List<Debriefing> list = teacherService.selectDebriefingTermByYear();
List<Long> temp = new ArrayList<>();
//去除重复的年份
for (Debriefing s : list) {
if (!temp.contains(s.getYear())) {
temp.add(s.getYear());
}
// 学生管理
@GetMapping("/StudentManagement")
public String student() {
return "admin/BasicInfo/StudentManagement";
}
@ResponseBody
@GetMapping("/students")
public Msg getStudents(
@RequestParam Integer offset,
@RequestParam(required = false) Long classId,
@RequestParam(required = false) Long specialtyId,
@RequestParam(required = false) String keyWord,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
long total = studentService.selectStudentsCount(offset, keyWord, classId, specialtyId, id_institute);
return Msg.success()
.add("students", studentService.selectStudents(offset, keyWord, classId, specialtyId, id_institute))
.add("total", total);
}
@ResponseBody
@DeleteMapping("/student")
public Msg delStudent(
@ResponseBody
public Msg delSection(@RequestBody Section section) {
return Msg.sqlChange((int) sectionService.delSection(section));
}
@PutMapping("/section")
@ResponseBody
public Msg updateSection(@RequestBody @Validated Section section, @ModelAttribute("id_institute") long id_institute) throws MyException {
return Msg.sqlChange((int) sectionService.updateSection(section, section.getSectionName(), id_institute));
}
@PostMapping("/section")
@ResponseBody
public Msg addSection(@RequestBody @Validated Section section, @ModelAttribute("id_institute") long id_institute) {
return Msg.sqlChange((int) sectionService.addSection(section, id_institute));
}
// 专业方向
@GetMapping("/SpecialtyManagement")
public String specialty() {
return "admin/Department/SpecialtyManagement";
}
@GetMapping("/specialtys")
@ResponseBody
public Msg getSpecialtys(