文章目录
1 前言
Hi,同学们好呀,学长今天带大家复盘一个学长帮往届同学做的一个毕业作品
基于java web的毕业设计管理系统
2 系统目的
计算机技术高度发达的今天,利用信息技术对大量复杂的信息进行有效的管理成为一种普遍而实用的手段。一方面,这极大的减少了簿记和人力的开销,另一方面,现代计算机强大的计算能力和网络的普遍部署,大大简化了大量信息的处理和流动。每年毕业临近时,都有优良的毕业生需要进行毕业设计,这其中的首要关节就是课题的选择,以往指导老师都是采用人工手写方式给学生们提供相关的毕业课题提供学生选择,如果指导老师带领的学生比较多,或者是当年毕业的学生比较多,这样就造成学生的毕业课题选择很混乱,指导老师难于统计学生的毕业课题选择情况等一系列问题,基于这些传统问题,我们需要一个能够自动统计,实时分配课题的一个管理平台来帮助学生、指导老师。
3 系统功能需求
此系统的开发,主要目的是使老师能更好地管理课程设计,也能使学生能更好地把自己想要选的课程准确无误的选出来,使在选择毕业课题时期的学生能有条不紊的进行。
该项目可以实现大学毕业设计中流程的大多是操作。主要有以下几点:
- 1、管理员添加教师信息和学生信息
- 2、教师网上报课题,管理员进行审核,审核通过的课题可以作为最终的选题开供学生选择
- 3、学生选择课题,并会实时显示选题信息
- 4、待选题结束之后,学生可以下载相关课题的任务书和开题报告模板
- 5、教师可以提醒学生提交开题报告
- 6、教师进行对自己管理的学生的开题报告进行审核,通过后可以进行之后的操作
- 7、学生上传毕业论文,审核通过之后该学生具有答辩资格,可进行答辩
- 8、教师最终把学生的开题报告进行提交,供管理员查看,保存
4 开发环境及技术栈
配置环境
- jdk1.8
- mysql5.1.47版本以上
- idea
访问
- localhost:8080/BSManager 这是的登陆到系统的主页。(包括学生和教师的登陆)
- localhost:8080/BSManager/admin/index.jsp 这是登陆到管理员的登陆界面
技术栈
该系统使用的是SSM(Spring+SptingMVC+MyBatis)框架+mysql数据库
系统工程目录
5 项目展示
5.1普通用户
登录
主页
修改个人信息
课题管理
选择课题
进度管理
文档管理
提问管理
查看公告
查看成绩
5.2 教师用户
登录
主页
修改个人信息
课题管理
进度管理
审核开题报告
学生管理
文档管理
论文审核
发布公告
添加成绩
6 项目代码实现
6.1 maven资源过滤配置
<build><finalName>BSManager</finalName><resources><resource><directory>src/main/java</directory><includes><include>**/*.properties</include>
<include>**/*.xml</include></includes><filtering>false</filtering></resource><resource><directory>src/main/resources</directory><includes><include>**/*.properties</include>
<include>**/*.xml</include></includes><filtering>false</filtering></resource><resource><directory>src/main/webapp</directory><includes><include>**/*.jsp</include>
<include>**/*.css</include><include>**/*.js</include>
<include>**/*.jpg</include><include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
6.2 过滤器
packagecom.zc.filter;importjava.io.IOException;importjavax.servlet.Filter;importjavax.servlet.FilterChain;importjavax.servlet.FilterConfig;importjavax.servlet.ServletException;importjavax.servlet.ServletRequest;importjavax.servlet.ServletResponse;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importjavax.servlet.http.HttpSession;importcom.zc.entity.User;/**
* @date 2018-4-11
* @author zhangC
* 这是个过滤器 用于验证用户登陆 (查找session)
* 把图片的路径过滤掉,否则会出现图片无法加载
*
*
*/publicclassLoginFilterimplementsFilter{publicvoidinit(FilterConfig filterConfig)throwsServletException{// TODO Auto-generated method stub}publicvoiddoFilter(ServletRequest request,ServletResponse response,FilterChain chain)throwsIOException,ServletException{// TODO Auto-generated method stubHttpServletRequest 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);}}publicvoiddestroy(){// TODO Auto-generated method stub}}
6.3 项目配置
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>
6.4 主要功能
6.4.1 登录
@RequestMapping(value="/admin/login")publicStringadminLogin(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")publicStringteacherLogin(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")publicStringstudentLogin(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";}}
6.4.2 管理员功能
@RequestMapping(value="/showTeacherOne",method=RequestMethod.POST)publicStringadminShowTeacherOne(Model model,HttpServletResponse response,@RequestParam(value="teacherNo",required=false)String teacherNo,@RequestParam(value="teacherName",required=false)String teacherName)throwsException{if(("".equals(teacherNo)|| teacherNo ==null)&&("".equals(teacherName)|| teacherName ==null)){adminShowAllTeacher(model, response);}elseif((!"".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";}elseif(("".equals(teacherNo)|| teacherNo ==null)&&(!"".equals(teacherName)|| teacherName !=null)){
teacherName =newString(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 =newString(teacherName.getBytes("iso-8859-1"),"utf-8");
teacherNo =newString(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)publicStringaddStudent(HttpServletRequest request,String studentNo,String studentName,String sex,String grade,String phone,String major,Model model)throwsException{
studentNo =newString(studentNo.getBytes("iso-8859-1"),"utf-8");
studentName =newString(studentName.getBytes("iso-8859-1"),"utf-8");
sex =newString(sex.getBytes("iso-8859-1"),"utf-8");
grade =newString(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 =newString(phone.getBytes("iso-8859-1"),"utf-8");
major =newString(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 =newDate();Student student =newStudent();
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";}}
6 最后
版权归原作者 WEB_DC 所有, 如有侵权,请联系我们删除。