Java项目:ssm毕业论文管理系统

news2024/11/27 12:50:46

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

毕业设计管理系统

1、本系统使用SSM框架

2、有管理员、教师、学生三种角色,管理员使用admin/admin登录,教师使用t_01/6666登录,学生使用142001/111登录

3、管理员有最大权限,可以进行信息管理、教师管理、学生管理、选题管理、公告管理、查看已上传等;

4、教师角色包括个人信息管理、选题管理、进度管理、学生管理、疑问管理、文档管理、成绩管理

5、学生角色包括个人信息管理、课题管理、进度管理、文档管理、提问管理、查看答辩资格、成绩管理

管理员用户:admin 密码:admin

教师用户:t_01 密码:6666

学生用户:142001 密码:111

环境要求

1.JDK配置

首先安装好JDK,我一般使用1.8版本的JDK。

2.安装IDEA
3.MySQL安装
4.   IDEA/Eclipse配置Tomcat 8

MySQL一般安装5.7版本的。

运行截图

相关代码 

AdminContraller

package com.zc.web;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.zc.entity.Announcement;
import com.zc.entity.Student;
import com.zc.entity.Teacher;
import com.zc.entity.ThesisPaper;
import com.zc.entity.ThesisTitle;
import com.zc.entity.User;
import com.zc.service.IAnnouncementService;
import com.zc.service.IDepartmentService;
import com.zc.service.IMajorService;
import com.zc.service.IStudentService;
import com.zc.service.ITeacherService;


/**
 * 
 * @author zhangC
 * adminMainForm() 跳转到主页
 * adminModifyPassword() 跳转 修改密码
 * adminTeacherAdd() 跳转 教师添加
 * adminTeacherManage() 跳转 教师管理
 * adminStudentAdd() 跳转 学生添加
 * adminStudentManage() 跳转 学生管理
 * adminCheckThesis() 跳转 审核课题
 * adminAnnouncement() 跳转 查看公告
 * adminPublishAnnouncement() 跳转 发布公告
 * 
 * @date 2018-4-8
 * @author zhangC
 * addTeacher() 添加教师到数据库中
 * adminShowAllTeacher() 显示教师
 * adminDeleteTeacher() 删除教师
 * adminModifyTeacher() 跳转到教师修改页面,改页面显示要修改的教师信息
 * adminModifyTeacherToDb() 把修改了的教师信息添加到数据库中
 * 
 * @date 2018-4-9
 * @author zhangC
 * adminShowTeacherOne() 显示查询到的教师信息
 * 
 * @date 2018-4-10
 * @author zhangC
 * addStudent() 添加学生
 * adminShowAllStudent() 显示所有学生信息
 * adminModifyStudent() 跳转到修改页面,便显示当前学生信息
 * adminModifyStudentToDb() 修改学生信息,保存到数据库中
 * adminDeleteStudent() 删除学生信息
 * adminShowStudentOne() 显示单个学生信息,用于页面查询到。
 * 
 * @date 2018-4-11
 * @author zhangC
 * adminCheckThesis() 修改了该方法,可以做到跳转页面的同时显示课题信息List
 * agreeThesis() 把课题审核通过 修改status属性
 * disgreeThesis() 课题不通过 
 * 
 * @date 2018-4-17
 * @author zhangC
 * adminPublishAnnouncement() 管理员发布公告
 * adminDeleteAnnouncement() 管理员删除公告
 * 
 * @date 2018-4-18
 * @author zhangC
 * adminShowThesisPaper() 管理员查看所有的最终论文
 * fileDownload() 文件下载
 *
 */

@Controller
@RequestMapping(value="/admin")
public class AdminContraller {
	
	@Autowired
	private ITeacherService teacherService;
	
	@Autowired
	private IDepartmentService departmentService;
	
	@Autowired
	private IStudentService studentService;
	
	@Autowired
	private IMajorService majorService;
	
	@Autowired
	private IAnnouncementService announcementService;
	
	
	@RequestMapping(value="/main",method=RequestMethod.GET)
	public String adminMainForm() {
		return "admin/main.jsp";
	}
	
	@RequestMapping(value="/modifyPassword",method=RequestMethod.GET)
	public String adminModifyPassword() {
		return "admin/adminModifyPassword.jsp";
	}
	
	@RequestMapping(value="/teacherAdd",method=RequestMethod.GET)
	public String adminTeacherAdd() {
		return "admin/adminTeacherAdd.jsp";
	}
	
	@RequestMapping(value="/teacherManage",method=RequestMethod.GET)
	public String adminTeacherManage() {
		
		return "admin/adminTeacherManage.jsp";
	}
	
	@RequestMapping(value="/studentAdd",method=RequestMethod.GET)
	public String adminStudentAdd() {
		return "admin/adminStudentAdd.jsp";
	}
	
	@RequestMapping(value="/studentManage",method=RequestMethod.GET)
	public String adminStudentManage() {
		return "admin/adminStudentManage.jsp";
	}
	
	@RequestMapping(value="/checkThesis",method=RequestMethod.GET)
	public String adminCheckThesis(Model model) {
		List<ThesisTitle> thesisList = teacherService.showAllThesisTitle();
		
		for(int i=0;i<thesisList.size();i++) {
			int status = thesisList.get(i).getStatus();
			if(status == 1) {
				thesisList.get(i).setStatusName("未审核");
			}else if(status == 2) {
				thesisList.get(i).setStatusName("审核通过");
			}else {
				thesisList.get(i).setStatusName("未通过");
			}
		}
		
		model.addAttribute("thesisTitleList", thesisList);
		System.out.println("查询到该所以的课题有:"+thesisList);
		
		return "admin/adminCheckThesis.jsp";
	}
	
	@RequestMapping(value="/announcement")
	public String adminAnnouncement(Model model) {
		List<Announcement> list = announcementService.showAllAnnonucement();
		SimpleDateFormat time=new SimpleDateFormat("yyyy-MM-dd"); 
		for(int i=0;i<list.size();i++) {
			Date time4db = list.get(i).getLastModifyTime();
			String formatTime = time.format(time4db);
			list.get(i).setTimeFormat(formatTime);
		}
		
		model.addAttribute("announcementList", list);
		
		return "admin/adminAnnouncement.jsp";
	}
	
	@RequestMapping(value="/publishAnnouncement",method=RequestMethod.GET)
	public String adminPublishAnnouncement() {
		return "admin/adminPublishAnnouncement.jsp";
	}
	
	@RequestMapping(value="/teacherAdd",method=RequestMethod.POST)
	public String addTeacher(HttpServletRequest request, String teacherNo, String teacherName,String sex,String phone,String department,Model model) throws Exception {
		teacherNo = new String(teacherNo.getBytes("iso-8859-1"),"utf-8");
		teacherName = new String(teacherName.getBytes("iso-8859-1"),"utf-8");
		sex = new String(sex.getBytes("iso-8859-1"),"utf-8");
		//String inputMan = (String) session.getAttribute("currentUser");
		
		User user = (User)request.getSession().getAttribute("currentUser");
		String inputMan = user.getUserNo();
		
		// String inputMan = (String) request.getSession().getAttribute("currentUser.userNo");
		// inputMan = new String(inputMan.getBytes("iso-8859-1"),"utf-8");
		phone = new String(phone.getBytes("iso-8859-1"),"utf-8");
		department = new String(department.getBytes("iso-8859-1"),"utf-8");
		
		if(teacherNo == null || "".equals(teacherNo) || teacherName == null || "".equals(teacherName)|| sex == null || "".equals(sex) || phone == null || "".equals(phone) || department == null || "".equals(department)  ) {
			model.addAttribute("message", "存在未填写的信息");
			return "admin/main.jsp";
		}else {
			Date currentTime = new Date();
			
			Teacher teacher = new Teacher();
			teacher.setTeacherNo(teacherNo);
			teacher.setTeacherName(teacherName);
			teacher.setDepartmentId(Integer.parseInt(department));
			teacher.setSex(sex);
			teacher.setInputMan(inputMan);
			teacher.setLastModifyTime(currentTime);
			teacher.setPhone(phone);
			
			int addNum = teacherService.addTeacher(teacher);
			// System.out.println("添加数目:"+addNum);
			model.addAttribute("message", "成功添加一条教师信息");
			return "admin/adminTeacherAdd.jsp";
		}
		
		
		
	}
	
	@RequestMapping(value="/showAllTeacher",method=RequestMethod.POST)
	public String adminShowAllTeacher(Model model,HttpServletResponse response) throws Exception {
		List<Teacher> teachers = teacherService.showAllTeacher();
		for(int i=0;i<teachers.size();i++) {
			System.out.println(teachers.get(i));
			int depmentId = teachers.get(i).getDepartmentId();
			String departmentName = departmentService.getNameById(depmentId);
			teachers.get(i).setDepartmentName(departmentName);
		}
		
		
		model.addAttribute("teacherList", teachers);
		System.out.println("全部教师集合:"+teachers);
		return "admin/adminTeacherManage.jsp";
	}
	
	@RequestMapping(value="/deleteTeacher")
	public String adminDeleteTeacher(int id,Model model) {
		// System.out.println(id);
		int num = teacherService.deleteTeacher(id);
		// System.out.println("删除了"+num+"条数据!");
		model.addAttribute("message", "成功删除一条教师信息");
		return "admin/adminTeacherManage.jsp";
	}
	
	@RequestMapping(value="/modifyTeacher")
	public String adminModifyTeacher(int id,Model model) {
		Teacher teacher = teacherService.getTeacherByid(id);
		
		String teacherNo = teacher.getTeacherNo();
		String teacherName = teacher.getTeacherName();
		int depId = teacher.getDepartmentId();
		String departmentName = departmentService.getNameById(depId);
		String sex = teacher.getSex();
		String phone = teacher.getPhone();
		
		model.addAttribute("id", id);
		model.addAttribute("teacherNo", teacherNo);
		model.addAttribute("teacherName", teacherName);
		model.addAttribute("departmentName", departmentName);
		model.addAttribute("sex", sex);
		model.addAttribute("phone", phone);
		return "admin/adminTeacherModify.jsp";
	}
	
	@RequestMapping(value="/modifyTeacherToDb")
	public String adminModifyTeacherToDb(int id,Model model,HttpServletRequest request, String teacherNo,String departmentOld, String teacherName,String sex,String phone,String department) throws Exception {
		// System.out.println(id);
		
		int departmentId = 0;
		departmentOld = new String(departmentOld.getBytes("iso-8859-1"),"utf-8");
		departmentId =  departmentService.getIdByName(departmentOld);
		
		teacherNo = new String(teacherNo.getBytes("iso-8859-1"),"utf-8");
		teacherName = new String(teacherName.getBytes("iso-8859-1"),"utf-8");
		sex = new String(sex.getBytes("iso-8859-1"),"utf-8");
		User user = (User)request.getSession().getAttribute("currentUser");
		String inputMan = user.getUserNo();
		phone = new String(phone.getBytes("iso-8859-1"),"utf-8");
		department = new String(department.getBytes("iso-8859-1"),"utf-8");
		Date currentTime = new Date();
		
		Teacher teacher = new Teacher();
		teacher.setId(id);
		teacher.setTeacherNo(teacherNo);
		teacher.setTeacherName(teacherName);
		if (department == null || "".equals(department)) {
			teacher.setDepartmentId(departmentId);
		}else {
			teacher.setDepartmentId(Integer.parseInt(department));
		}
		teacher.setSex(sex);
		teacher.setInputMan(inputMan);
		teacher.setLastModifyTime(currentTime);
		teacher.setPhone(phone);
		
		int num = teacherService.updateTeacher(teacher);
		System.out.println("修改数目:"+num);
		return "admin/adminTeacherManage.jsp";
	}
	
	
	@RequestMapping(value="/showTeacherOne",method=RequestMethod.POST)
	public String adminShowTeacherOne(Model model,HttpServletResponse response, @RequestParam(value="teacherNo",required=false) String teacherNo,@RequestParam(value="teacherName",required=false) String teacherName) throws Exception {
		
		if( ("".equals(teacherNo) || teacherNo == null) && ("".equals(teacherName) || teacherName == null) ) {
			adminShowAllTeacher(model, response);
		}else if((!"".equals(teacherNo) || teacherNo != null) &&("".equals(teacherName) || teacherName == null) ) {
			List<Teacher> teachers = teacherService.showTeacherOne1(teacherNo);
			if(teachers.isEmpty()) {
				model.addAttribute("showMessage", "没有与查询相匹配的教师信息");
			}else {
				for(int i=0;i<teachers.size();i++) {
					
					System.out.println(teachers.get(i));
					int depmentId = teachers.get(i).getDepartmentId();
					String departmentName = departmentService.getNameById(depmentId);
					teachers.get(i).setDepartmentName(departmentName);
				}
			}
			model.addAttribute("teacherList", teachers);
			System.out.println("教师集合:"+teachers);
			return "admin/adminTeacherManage.jsp";
		}else if(("".equals(teacherNo) || teacherNo == null) && (!"".equals(teacherName) || teacherName != null)) {
			teacherName = new String(teacherName.getBytes("iso-8859-1"),"utf-8");
			List<Teacher> teachers = teacherService.showTeacherOne2(teacherName);
			if(teachers.isEmpty()) {
				model.addAttribute("showMessage", "没有与查询相匹配的教师信息");
			}else {
				for(int i=0;i<teachers.size();i++) {
					System.out.println(teachers.get(i));
					int depmentId = teachers.get(i).getDepartmentId();
					String departmentName = departmentService.getNameById(depmentId);
					teachers.get(i).setDepartmentName(departmentName);
				}
			}
			model.addAttribute("teacherList", teachers);
			System.out.println("教师集合:"+teachers);
			return "admin/adminTeacherManage.jsp";
		} else {
			teacherName = new String(teacherName.getBytes("iso-8859-1"),"utf-8");
			teacherNo = new String(teacherNo.getBytes("iso-8859-1"),"utf-8");
			List<Teacher> teachers = teacherService.showTeacherOne3(teacherNo, teacherName);
			if(teachers.isEmpty()) {
				model.addAttribute("showMessage", "没有与查询相匹配的教师信息");
			}else {
				for(int i=0;i<teachers.size();i++) {
					System.out.println(teachers.get(i));
					int depmentId = teachers.get(i).getDepartmentId();
					String departmentName = departmentService.getNameById(depmentId);
					teachers.get(i).setDepartmentName(departmentName);
				}
			}
			
			model.addAttribute("teacherList", teachers);
			System.out.println("教师集合:"+teachers);
			return "admin/adminTeacherManage.jsp";
		}
		return "admin/adminTeacherManage.jsp";
	}
	
	@RequestMapping(value="/studentAdd",method=RequestMethod.POST)
	public String addStudent(HttpServletRequest request,String studentNo, String studentName,String sex,String grade,String phone,String major,Model model) throws Exception {
		studentNo = new String(studentNo.getBytes("iso-8859-1"),"utf-8");
		studentName = new String(studentName.getBytes("iso-8859-1"),"utf-8");
		sex = new String(sex.getBytes("iso-8859-1"),"utf-8");
		grade = new String(grade.getBytes("iso-8859-1"),"utf-8");
		
		User user = (User)request.getSession().getAttribute("currentUser");
		String inputMan = user.getUserNo();
		
		//inputMan = new String(inputMan.getBytes("iso-8859-1"),"utf-8");
		
		
		phone = new String(phone.getBytes("iso-8859-1"),"utf-8");
		major = new String(major.getBytes("iso-8859-1"),"utf-8");
		if(studentNo== null || "".equals(studentNo)||studentName == null || "".equals(studentName) || sex==null ||"".equals(sex) || grade == null || "".equals(grade) || phone == null || "".equals(phone) || major==null ||"".equals(major)) {
			model.addAttribute("message", "存在未填写的信息");
			return "admin/main.jsp";
			
		}else {
			Date currentTime = new Date();
			
			Student student = new Student();
			student.setStudentNo(studentNo);
			student.setStudentName(studentName);
			student.setSex(sex);
			student.setGrade(grade);
			student.setInputMan(inputMan);
			student.setPhone(phone);
			student.setMajorId(Integer.parseInt(major));
			student.setLastModifyTime(currentTime);
			
			int addNum = studentService.addStudent(student);
			// System.out.println("添加数目:"+addNum);
			
			model.addAttribute("message", "成功添加一条学生信息");
			
			return "admin/adminStudentAdd.jsp";
		}
		
		
		
		
	}
	
	@RequestMapping(value="/showAllStudent",method=RequestMethod.POST)
	public String adminShowAllStudent(Model model,HttpServletResponse response) throws Exception {
		List<Student> students = studentService.showAllStudent();
		for(int i=0;i<students.size();i++) {
			System.out.println(students.get(i));
			int majorId = students.get(i).getMajorId();
			String majorName = majorService.getNameById(majorId);
			students.get(i).setMajorName(majorName);
		}
		
		
		model.addAttribute("studentList", students);
		System.out.println("全部教师集合:"+students);
		return "admin/adminStudentManage.jsp";
	}
	
	@RequestMapping(value="/modifyStudent")
	public String adminModifyStudent(int id,Model model) {
		
		Student student = studentService.getStudentNameById(id);
		String studentNo = student.getStudentNo();
		String studentName= student.getStudentName();
		int majorId = student.getMajorId();
		String majorName = majorService.getNameById(majorId);
		String grade = student.getGrade();
		String sex = student.getSex();
		String phone = student.getPhone();
		
		
		model.addAttribute("id", id);
		model.addAttribute("studentNo", studentNo);
		model.addAttribute("studentName", studentName);
		model.addAttribute("grade", grade);
		model.addAttribute("majorName", majorName);
		model.addAttribute("sex", sex);
		model.addAttribute("phone", phone);
		return "admin/adminStudentModify.jsp";
	}
	
	@RequestMapping(value="/modifyStudentToDb")
	public String adminModifyStudentToDb(int id,Model model,HttpServletRequest request, String studentNo,String majorOld, String studentName,String sex,String phone,String major,String grade) throws Exception {
		// System.out.println(id);
		
		int majorId = 0;
		majorOld = new String(majorOld.getBytes("iso-8859-1"),"utf-8");
		majorId = majorService.getIdByName(majorOld);
		
		studentNo = new String(studentNo.getBytes("iso-8859-1"),"utf-8");
		studentName = new String(studentName.getBytes("iso-8859-1"),"utf-8");
		sex = new String(sex.getBytes("iso-8859-1"),"utf-8");
		grade = new String(grade.getBytes("iso-8859-1"),"utf-8");
		User user = (User)request.getSession().getAttribute("currentUser");
		String inputMan = user.getUserNo();
		phone = new String(phone.getBytes("iso-8859-1"),"utf-8");
		major = new String(major.getBytes("iso-8859-1"),"utf-8");
		Date currentTime = new Date();
		
		/*Teacher teacher = new Teacher();
		teacher.setId(id);
		teacher.setTeacherNo(teacherNo);
		teacher.setTeacherName(teacherName);
		if (major == null || "".equals(major)) {
			teacher.setDepartmentId(departmentId);
		}else {
			teacher.setDepartmentId(Integer.parseInt(department));
		}
		teacher.setSex(sex);
		teacher.setInputMan(inputMan);
		teacher.setLastModifyTime(currentTime);
		teacher.setPhone(phone);*/
		
		Student student = new Student();
		student.setId(id);
		student.setStudentNo(studentNo);
		student.setStudentName(studentName);
		if(major==null || "".equals(major)) {
			student.setMajorId(majorId);
		} else {
			student.setMajorId(Integer.parseInt(major));
		}
		student.setSex(sex);
		student.setInputMan(inputMan);
		student.setLastModifyTime(currentTime);
		student.setPhone(phone);
		student.setGrade(grade);
		
		int num = studentService.updateStudent(student);
		
		System.out.println("修改数目:"+num);
		return "admin/adminStudentManage.jsp";
	}
	
	@RequestMapping(value="/deleteStudent")
	public String adminDeleteStudent(int id,Model model) {
		// System.out.println(id);
		int num = studentService.deleteStudent(id);
		//System.out.println("删除了"+num+"条数据!");
		model.addAttribute("message", "成功删除一条学生信息");
		return "admin/adminStudentManage.jsp";
	}
	
	@RequestMapping(value="/showStudentOne",method=RequestMethod.POST)
	public String adminShowStudentOne(Model model,HttpServletResponse response, @RequestParam(value="studentNo",required=false) String studentNo,@RequestParam(value="studentName",required=false) String studentName) throws Exception {
		
		if( ("".equals(studentNo) || studentNo == null) && ("".equals(studentName) || studentName == null) ) {
			adminShowAllStudent(model, response);
		}else if((!"".equals(studentNo) || studentNo != null) &&("".equals(studentName) || studentName == null) ) {
			List<Student> students = studentService.showStudentOne1(studentNo);
			if(students.isEmpty()) {
				model.addAttribute("showMessage", "没有与查询相匹配的学生信息");
			}else {
				for(int i=0;i<students.size();i++) {
					
					int mojarId = students.get(i).getMajorId();
					String majorName= majorService.getNameById(mojarId);
					students.get(i).setMajorName(majorName);
				}
			}
			model.addAttribute("studentList", students);
			System.out.println("学生集合:"+students);
			return "admin/adminStudentManage.jsp";
		}else if(("".equals(studentNo) || studentNo == null) && (!"".equals(studentName) || studentName != null)) {
			studentName = new String(studentName.getBytes("iso-8859-1"),"utf-8");
			List<Student> students = studentService.showStudentOne2(studentName);
			if(students.isEmpty()) {
				model.addAttribute("showMessage", "没有与查询相学生的教师信息");
			}else {
				for(int i=0;i<students.size();i++) {
					int mojarId = students.get(i).getMajorId();
					String majorName= majorService.getNameById(mojarId);
					students.get(i).setMajorName(majorName);
				}
			}
			model.addAttribute("studentList", students);
			System.out.println("学生集合:"+students);
			return "admin/adminStudentManage.jsp";
		} else {
			studentName = new String(studentName.getBytes("iso-8859-1"),"utf-8");
			studentNo = new String(studentNo.getBytes("iso-8859-1"),"utf-8");
			List<Student> students = studentService.showStudentOne3(studentNo, studentName);
			if(students.isEmpty()) {
				model.addAttribute("showMessage", "没有与查询相匹配的学生信息");
			}else {
				for(int i=0;i<students.size();i++) {
					int mojarId = students.get(i).getMajorId();
					String majorName= majorService.getNameById(mojarId);
					students.get(i).setMajorName(majorName);
				}
			}
			
			model.addAttribute("studentList", students);
			System.out.println("学生集合:"+students);
			return "admin/adminStudentManage.jsp";
		}
		return "admin/adminStudentManage.jsp";
	}
	
	
	@RequestMapping(value="/agreeThesis")
	public String agreeThesis(int id,Model model) {
		
		int num = teacherService.agreeThesisTitle(id);
		System.out.println("课题已审核");
		adminCheckThesis(model);
		return "admin/adminCheckThesis.jsp";
	}
	
	@RequestMapping(value="/disagreeThesis")
	public String disgreeThesis(int id,Model model) {
		
		int num = teacherService.disagreeThesisTitle(id);
		System.out.println("课题审核不通过");
		adminCheckThesis(model);
		return "admin/adminCheckThesis.jsp";
	}
	
	@RequestMapping(value="/publishAnnouncement")
	public String adminPublishAnnouncement(HttpServletRequest request,Model model,String announcement) throws Exception {
		announcement = new String(announcement.getBytes("iso-8859-1"),"utf-8");
		
		if(announcement == null|| "".equals(announcement)) {
			
			model.addAttribute("message", "发布的公告不可为空");
			return "admin/main.jsp";
		}else {
			Announcement an = new Announcement();
			an.setContext(announcement);
			an.setInputMan("admin");
			Date time = new Date();
			an.setLastModifyTime(time);
			
			int num = announcementService.addAnnouncement(an);
			System.out.println("添加公告"+num+"条");
			model.addAttribute("message", "成功添加了一个条公告");
			adminAnnouncement(model);
			
			return "admin/adminAnnouncement.jsp";
		}
		
	}
	
	@RequestMapping(value="/deleteAnnouncement")
	public String adminDeleteAnnouncement(Model model,int id) throws Exception {
		int num = announcementService.deleteAnnouncement(id);
		System.out.println("删除公告"+num+"条");
		
		model.addAttribute("message", "删除一个条公告");
		adminAnnouncement(model);
		return "admin/adminAnnouncement.jsp";
	}
	
	@RequestMapping(value="/showThesisPaper")
	public String adminShowThesisPaper(Model model) {
		List<ThesisPaper> paperList = teacherService.getAllPaper();
		List<Student> studentList = new ArrayList<Student>();
		Student s = new Student();
		for(int i=0;i<paperList.size();i++) {
			int studentId = paperList.get(i).getStudentId();
			String studentName = studentService.getStudentNameById(studentId).getStudentName();
			int thesisId = teacherService.getTopicInfoByStudentId(studentId).getThesisId();
			String thesisName = teacherService.getThesisById(thesisId).getThesisName();
			String filePath = paperList.get(i).getPaperInfo();
			String[] str = filePath.split("\\\\");
			String fileName = str[str.length-1].toString();
			s.setStudentName(studentName);
			s.setThesisName(thesisName);
			s.setFileName(fileName);
			s.setFilePath(filePath);
			studentList.add(s);
		}
		model.addAttribute("studentList", studentList);
		return "admin/adminThesisPaperResult.jsp";
	}
	
	@RequestMapping(value="/fileDownload")
	public ResponseEntity<byte[]> fileDownload(HttpServletRequest request, @RequestParam("filePath") String filePath,@RequestParam("fileName") String fileName, Model model) throws Exception {
		fileName = new String(fileName.getBytes("iso-8859-1"),"utf-8");
		filePath = new String(filePath.getBytes("iso-8859-1"),"utf-8");
		File file = new File(filePath);
		HttpHeaders headers = new HttpHeaders();
		String downloadFile = new String(fileName.getBytes("utf-8"), "iso-8859-1");
		headers.setContentDispositionFormData("attachment", downloadFile);
		headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
		return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers,HttpStatus.CREATED); 
	}
	
}

MajorContraller

package com.zc.web;

import java.io.PrintWriter;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zc.entity.Major;
import com.zc.service.IMajorService;

import net.sf.json.JSONArray;

/**
 * 
 * @author zhangC
 * 
 * showAllMajor() 获得所有专业信息
 *
 */

@Controller

public class MajorContraller {
	
	@Autowired
	private IMajorService majorService;
	
	@RequestMapping(value="/getAllMajor")
	public String showAllMajor(HttpServletResponse response,HttpServletRequest request) throws Exception {
		List<Major> majors = majorService.allMajor();
		
		JSONArray json =  JSONArray.fromObject(majors);
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter write = response.getWriter();
		write.write(json.toString());
		write.close();
		return "admin/adminStudentAdd.jsp";
	}
}

如果也想学习本系统,下面领取。关注并回复:005ssm

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/42251.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

JavaWeb简单实例——DBUtils

简单介绍&#xff1a; DBUtils是一个用来简化我们JDBC的编码工作量的一个工具。它可以在不影响数据库访问性能的情况下简化我们的代码编辑量。DBUtils的作用主要是&#xff1a;写数据&#xff0c;读数据&#xff0c;优化性能。 常用的类和对应的API&#xff1a; QureyRunner…

Spring Framework 6正式发布,携JDK 17Jakarta EE开启新篇章

本文已被https://yourbatman.cn收录&#xff1b;女娲Knife-Initializr工程可公开访问啦&#xff1b;程序员专用网盘https://wangpan.yourbatman.cn&#xff1b;技术专栏源代码大本营&#xff1a;https://github.com/yourbatman/tech-column-learning&#xff1b;公号后台回复“…

1.什么是闭包

什么是闭包 1. 概念 闭包&#xff08;closure&#xff09;指有权访问另一个函数作用域中变量的函数。—《JavaScript高级程设计》 简单理解就是一个函数。 2. 如何产生闭包&#xff1f; 当一个嵌套的内部函数引用了嵌套的外部函数的变量&#xff08;函数&#xff09;时&…

CANoe-vTESTstudio之Test Diagram编辑器(元素介绍)

Test Diagram编辑器里的工具箱,有多个图形符号,它们是组成测试图表的图形元素,具有不同的作用。图形元素能够高效并快速地创建测试图表,然后生成测试用例 1. 基本测试设计元素 基本元素用来创建图形设计 1.1 Setup Setup元素的测试代码能够执行一次,在检查测试用例之前…

特别有用!Jmeter命令行执行时设置并发数和循环次数的方法

Jmeter命令行方式运行概述 之前写过一篇文章介绍如何在centos上部署jmeter来执行性能测试&#xff0c;链接如下&#xff1a; https://blog.csdn.net/liwenxiang629/article/details/124140833 因为大多数linux服务器都是没有GUI界面的&#xff0c;这就需要我们通过命令行的方…

MobPush Android For Unity

集成准备 注册账号 使用MobSDK之前&#xff0c;需要先在MobTech官网注册开发者账号&#xff0c;并获取MobTech提供的AppKey和AppSecret&#xff0c;详情可以点击查看注册流程 下载.unitypackage包 打开 Github 下载 MobPush-For-Unity 项目&#xff0c;下载完成后直接双击或…

【图神经网络论文整理】(十)—— How Powerful are Graph Neural Networks?:GIN

作者信息&#xff1a;Keyulu Xu, Weihua Hu, Jure Leskovec, Stefanie Jegelka论文来源&#xff1a;Computer Vision and Pattern Recognition论文地址&#xff1a;https://arxiv.org/abs/1810.00826 本文介绍的论文是《How Powerful are Graph Neural Networks?》。 作者提…

MySQL表的增删查改(嘎嘎详细~

hello呀&#xff01;各位&#xff0c;这里是Sunlightʊə。 目前大三&#xff0c;主要在学习Java语言。可以一起交流呀&#xff01; 相关文章&#xff1a; MySQL数据库的基础操作&#xff08;简单、基础版 专栏&#xff1a; Java数据结构 Java基础语法 MySQL基础 目录 新增&am…

流式 Isotype control 流式细胞仪control组

流式细胞术是非常让人着迷的实验。在众多医学研究手段里,如果说弱水三千只取一瓢的话,那我会首选流式细胞术。从我个人感受来讲,流式细胞术高速客观,具有统计学意义,能够处理复杂样本并同时获取多种参数,最最关键的是它性能可靠,可重复性非常好。 虽然也存在一些局限,…

3款超实用的电脑软件,免费又良心,内存满了也绝不卸载

超强的3款电脑软件&#xff0c;每款都是百里挑一的精品。 1、视频画质增强器 这是国人开发的图片视频增强工具&#xff0c;完全免费无任何弹屏广告&#xff0c;它能将画质很差的图片&#xff0c;一键转化为高清大图&#xff0c;同时还能无损放大图片&#xff0c;图片输出格式支…

第150篇 笔记-元宇宙(Metaverse)

定义&#xff1a;元宇宙是一个整体虚拟世界的概念&#xff0c;它与现实世界并行存在&#xff0c;提供主权数字所有权、独特的在线身份、互联环境和沉浸式体验。 随着最近区块链生态系统中NFT的爆炸&#xff0c;以及Facebook的头部转向“Meta”&#xff0c;元宇宙已进入主流公众…

代码源每日一题div1 枚举倍数 平方计数

平方计数 - 题目 - Daimayuan Online Judge 题意&#xff1a; 思路&#xff1a; 首先注意到暴力枚举一定超时&#xff0c;因此我们考虑只枚举一个指针&#xff0c;然后推一推式子降低另一个指针的复杂度 对于完全平方数这个条件&#xff0c;我们无法直接转换 即对于每一个a[…

1.3 测控电路的信号类型、测控电路的类型与组成、测控电路的发展趋势

笔者电子信息专业硕士毕业&#xff0c;获得过多次电子设计大赛、大学生智能车、数学建模国奖&#xff0c;现就职于南京某半导体芯片公司&#xff0c;从事硬件研发&#xff0c;电路设计研究。对于学电子的小伙伴&#xff0c;深知入门的不易&#xff0c;特开次博客交流分享经验&a…

技术指南 | 如何集成Perforce版本控制系统Helix Core (P4V) 与敏捷规划工具Hansoft

Helix Core是Perforce公司旗下一款集源代码管理和内容协作为一体的版本配置与管理工具&#xff0c;可以帮助您管理随时间推移而产生的数字资产&#xff08;代码&#xff0c;文件等&#xff09;变更&#xff0c;处理每天数以千万计的传输&#xff0c;上千TB的数据&#xff0c;以…

zabbix模板监控和自定义监控

目录 一、环境准备 二、使用模板监控 1、添加监控主机 2、设置应用监控模板 3、查看监控数据 三、自定义监控 1、配置自定义监控key 2、创建自定义监控模板、应用集、监控项和图形 2.1、监控模板、应用集、监控项介绍 2.2、创建监控模板 2.3、给自定义模板添加应用集…

mysql回表查询和索引覆盖

作为 JAVA 开发的必备知识&#xff0c;了解回表查询和索引覆盖可以大大提升数据库查询的速度&#xff0c;也是优化数据库查询的必备知识。 1. 什么是索引? 索引&#xff08;在 MySQL 中也叫“键key”&#xff09;是存储引擎快速找到记录的一种数据结构&#xff0c;通俗来说类…

什么是Hystrix?简述实现机制

分布式容错框架 阻⽌故障的连锁反应&#xff0c;实现熔断 快速失败&#xff0c;实现优雅降级提供实时的监控和告警资源隔离&#xff1a; 线程隔离&#xff0c;信号量隔离 线程隔离&#xff1a;Hystrix会给每⼀个Command分配⼀个单独的线程池&#xff0c;这样在进⾏单个服务调⽤…

深入react源码看setState究竟做了什么?

前言 在深究 React 的 setState 原理的时候&#xff0c;我们先要考虑一个问题&#xff1a;setState 是异步的吗&#xff1f; 首先以 class component 为例&#xff0c;请看下述代码&#xff08;demo-0&#xff09; class App extends React.Component {state {count: 0}hand…

LQ0272 矩形运算【计算几何】

题目来源&#xff1a;蓝桥杯2012初赛 Java A组H题 题目描述 在编写图形界面软件的时候&#xff0c;经常会遇到处理两个矩形的关系。 如图 1 所示&#xff0c;矩形的交集指的是&#xff1a;两个矩形重叠区的矩形&#xff0c;当然也可能不存在&#xff08;参看图 2 &#xff09…

Linux下C语言UDP协议通信实践

UDP和TCP协议一样&#xff0c;都是传输层协议。是无连接的&#xff0c;不安全的&#xff0c;报式传输层协议&#xff0c;通信过程默认也是阻塞的。其通信特点主要如下&#xff1a; &#xff08;1&#xff09;不需要建立连接 &#xff0c;所以不需要进行 connect () 操作 &…