Hi,同学们好呀,学长今天带大家复盘一个学长帮往届同学做的一个毕业作品
基于java web的毕业设计管理系统
计算机技术高度发达的今天,利用信息技术对大量复杂的信息进行有效的管理成为一种普遍而实用的手段。一方面,这极大的减少了簿记和人力的开销,另一方面,现代计算机强大的计算能力和网络的普遍部署,大大简化了大量信息的处理和流动。每年毕业临近时,都有优良的毕业生需要进行毕业设计,这其中的首要关节就是课题的选择,以往指导老师都是采用人工手写方式给学生们提供相关的毕业课题提供学生选择,如果指导老师带领的学生比较多,或者是当年毕业的学生比较多,这样就造成学生的毕业课题选择很混乱,指导老师难于统计学生的毕业课题选择情况等一系列问题,基于这些传统问题,我们需要一个能够自动统计,实时分配课题的一个管理平台来帮助学生、指导老师。
此系统的开发,主要目的是使老师能更好地管理课程设计,也能使学生能更好地把自己想要选的课程准确无误的选出来,使在选择毕业课题时期的学生能有条不紊的进行。
该项目可以实现大学毕业设计中流程的大多是操作。主要有以下几点:
1、管理员添加教师信息和学生信息
2、教师网上报课题,管理员进行审核,审核通过的课题可以作为最终的选题开供学生选择
3、学生选择课题,并会实时显示选题信息
4、待选题结束之后,学生可以下载相关课题的任务书和开题报告模板
5、教师可以提醒学生提交开题报告
6、教师进行对自己管理的学生的开题报告进行审核,通过后可以进行之后的操作
7、学生上传毕业论文,审核通过之后该学生具有答辩资格,可进行答辩
8、教师最终把学生的开题报告进行提交,供管理员查看,保存
配置环境
访问
技术栈
该系统使用的是SSM(Spring+SptingMVC+MyBatis)框架+mysql数据库
系统工程目录
<build>
<finalName>BSManager</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties
**/ *.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties
**/ *.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>**/*.jsp
**/ *.css</include>
<include>**/*.js
**/ *.jpg</include>
<include>**/*.xml
false
package com.zc.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.zc.entity.User;
/**
* @date 2018-4-11
* @author zhangC
* 这是个过滤器 用于验证用户登陆 (查找session)
* 把图片的路径过滤掉,否则会出现图片无法加载
*
*
*/
public class LoginFilter implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
// TODO Auto-generated method stub
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
// TODO Auto-generated method stub
HttpServletRequest servletRequest = (HttpServletRequest)request;
HttpServletResponse servletResponse = (HttpServletResponse) response;
HttpSession session = servletRequest.getSession();
String path = servletRequest.getRequestURI();
System.out.println("当前路径:"+path);
User currentUser = (User)session.getAttribute("currentUser");
if (path.indexOf("index.jsp") > -1 || path.indexOf("teacherLogin.jsp") > -1
|| path.indexOf("studentLogin.jsp") > -1 || path.indexOf("adminLogin.jsp") > -1
|| path.indexOf("login") > -1 || path.indexOf("adminLogin.jsp") > -1 || path.indexOf(".jpg") > -1
|| path.indexOf(".html") > -1 || path.indexOf(".png") > -1 || path.indexOf(".css") > -1
|| path.indexOf(".js") > -1) {
chain.doFilter(servletRequest, servletResponse);
return;
}
if(currentUser == null || "".equals(currentUser)) {
//servletResponse.sendRedirect("${pageContext.request.contextPath}/index.jsp");
//servletRequest.getRequestDispatcher("/index.jsp").forward(request, response);
servletResponse.sendRedirect("/BSManager/index.jsp");
}else {
chain.doFilter(servletRequest, servletResponse);
}
}
public void destroy() {
// TODO Auto-generated method stub
}
}
spring-dao.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 配置数据库的相关参数properties的属性 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 数据库连接池 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!-- 连接属性 -->
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<!-- c3p0连结池的属性 -->
<property name="maxPoolSize" value="30"/>
<property name="minPoolSize" value="10"/>
<property name="autoCommitOnClose" value="false"/>
<property name="checkoutTimeout" value="10000"/>
<property name="acquireRetryAttempts" value="2"/>
</bean>
<!-- 配置SqlSessionFactroy对象 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<property name="typeAliasesPackage" value="com.zc.entity"/>
<property name="mapperLocations" value="classpath:mapping/*.xml"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
<property name="basePackage" value="com.zc.dao"></property>
</bean>
</beans>
spring-web.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- 开启springMVC注解模式 -->
<mvc:annotation-driven/>
<!-- 静态资源默认servlet配置 -->
<mvc:default-servlet-handler/>
<!-- 配置jsp 显示viewResolver -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
</bean>
<!-- 扫描web相关的bean -->
<context:component-scan base-package="com.zc.web"/>
<!-- 文件上传和下载 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
<value>20480000</value>
</property>
<property name="defaultEncoding">
<value>utf-8</value>
</property>
</bean>
@RequestMapping(value="/admin/login")
public String adminLogin(String userNo,String password,Model model,HttpServletRequest request) {
User currentUser = userService.login(userNo, password);
if("".equals(currentUser)||currentUser==null) {
model.addAttribute("message", "用户名或密码错误");
return "error.jsp";
}
if(currentUser.getPermission()==3) {
// request.getSession().setAttribute("userNo", userNo);
HttpSession session = request.getSession();
session.setMaxInactiveInterval(3600);
session.setAttribute("currentUser", currentUser);
//model.addAttribute("userNo", userNo);
return "admin/main.jsp";
}else {
model.addAttribute("message", "当前用户不是管理员");
return "error.jsp";
}
}
@RequestMapping(value="/teacher/login")
public String teacherLogin(String userNo,String password,Model model,HttpServletRequest request) {
User currentUser = userService.login(userNo, password);
if("".equals(currentUser)||currentUser==null) {
model.addAttribute("message", "用户名或密码错误");
return "error.jsp";
}
if(currentUser.getPermission()==2) {
HttpSession session = request.getSession();
session.setMaxInactiveInterval(3600);
// 在t_user表的信息
session.setAttribute("currentUser", currentUser);
// 完整的teacher信息
Teacher teacher = teacherService.showInfoByNo(userNo);
int depId = teacher.getDepartmentId();
String depName = departmentService.getNameById(depId);
teacher.setDepartmentName(depName);
session.setAttribute("teacher", teacher);
//model.addAttribute("userNo", userNo);
return "teacher/main.jsp";
}else {
model.addAttribute("message", "当前用户不是教师");
return "error.jsp";
}
}
@RequestMapping(value="/student/login")
public String studentLogin(String userNo,String password,Model model,HttpServletRequest request) {
User currentUser = userService.login(userNo, password);
if("".equals(currentUser)||currentUser==null) {
model.addAttribute("message", "用户名或密码错误");
return "error.jsp";
}
if(currentUser.getPermission()==1) {
HttpSession session = request.getSession();
session.setMaxInactiveInterval(3600);
// t_user 表中的关于学生的信息
session.setAttribute("currentUser", currentUser);
// t_student 表中的信息
Student student = studentService.getStudentByNO(userNo);
int majorId = student.getMajorId();
String majorName = majorService.getNameById(majorId);
student.setMajorName(majorName);
session.setAttribute("student", student);
// model.addAttribute("userNo", userNo);
return "student/main.jsp";
}else {
model.addAttribute("message", "当前用户不是学生");
return "error.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";
}
}