• SSM毕业设计管理系统


    作者主页:夜未央5788

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

    文末获取源码

    项目介绍

    本项目包含三种角色:管理员、学生用户角色与教师角色。

    管理员角色包含以下功能:
    学生信息管理、教师信息管理。

    用户角色包含以下功能:

    查看通知公告,登录,登录后学生主页面,选择课题,选择课题后状态为等待老师去人状态,填写开题报告,提交中期检查,提交免答辩申请,上传论文等功能。

    教师角色包含以下功能:

    教师角色登录,教师首页,申报课题,审批学生选题,审核开题报告,审核中期检查,初审免答辩申请,审核论文是否过关,综合打分等功能。

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 

    5.数据库:5.7/8.0版本均可;

    6.是否Maven项目:是;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis

    2. 前端:JSP+CSS+JavaScript+jQuery

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

    3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;

    4. 运行项目,输入localhost:8080/ 登录

    运行截图

    教师角色

     

     

     

     

     

     

     

     

    用户角色

     

     

     

     

     

    相关代码

    用户控制器

    1. @Controller
    2. @RequestMapping("/userController")
    3. public class UserController {
    4. @Autowired
    5. private UserService userService;
    6. @ResponseBody
    7. @RequestMapping(value="/isuser",method=RequestMethod.POST)
    8. public boolean isUser(String account) {
    9. return userService.isUser(account);
    10. }
    11. @ResponseBody
    12. @RequestMapping(value="/ispassword",method=RequestMethod.POST)
    13. public boolean ispassword(@RequestParam("password")String password,HttpSession session) {
    14. User user = (User) session.getAttribute("user");
    15. if(user!=null) {
    16. return userService.ispassword(Utils.md5(password),user.getUserId());
    17. }
    18. return false;
    19. }
    20. @ResponseBody
    21. @RequestMapping(value="/login",method=RequestMethod.POST)
    22. public String login(HttpSession session,String randStr,String account,String password) {
    23. String randStr2=(String) session.getAttribute("randStr");
    24. if(randStr2!=null&&randStr2.equals(randStr)) {
    25. password=Utils.md5(password);
    26. Subject currentUser = SecurityUtils.getSubject();
    27. if (!currentUser.isAuthenticated()) {
    28. //把用户名和密码封装为UsernamePasswordToken
    29. UsernamePasswordToken token = new UsernamePasswordToken(account, password);
    30. try {
    31. //执行登录
    32. currentUser.login(token);
    33. return toUI(session,account,password);
    34. }
    35. //用户不存在
    36. catch (UnknownAccountException ae) {
    37. return "passwordError";
    38. }
    39. //用户被锁定
    40. catch (LockedAccountException e) {
    41. return "passwordError";
    42. }
    43. }else {
    44. return toUI(session,account,password);
    45. }
    46. }else {
    47. return "randStrError";
    48. }
    49. }
    50. private String toUI(HttpSession session,String account,String password) {
    51. User user = userService.login(account, password);
    52. if(user!=null) {
    53. if(2==user.getUserRoles()) {
    54. session.setAttribute("user", user);
    55. return "student/sindex.html";
    56. }
    57. if(1==user.getUserRoles()) {
    58. session.setAttribute("user", user);
    59. return "teacher/tindex.html";
    60. }
    61. if(3==user.getUserRoles()) {
    62. session.setAttribute("admin", user);
    63. return "admin/showStudent";
    64. }
    65. }
    66. return "passwordError";
    67. }
    68. @RequestMapping("/logout")
    69. public String logout(HttpSession session) {
    70. session.removeAttribute("user");
    71. return "redirect:login.html";
    72. }
    73. @ResponseBody
    74. @RequestMapping(value="/updateInfo",method=RequestMethod.POST)
    75. public boolean updateStudentInfo(User user,
    76. @RequestParam(value="portrait",required=false)MultipartFile portrait,HttpServletRequest request) {
    77. if(portrait!=null&&portrait.getSize()>0) {
    78. if(portrait.getSize()>(10*1024*1024)) {
    79. return false;
    80. }
    81. String filename=portrait.getOriginalFilename();
    82. String dbPath="/graduation/portrait/"+user.getUserId();
    83. String basePath=Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16)+"/portrait/"+user.getUserId();
    84. if(!new File(basePath).exists()) {
    85. new File(basePath).mkdirs();
    86. }
    87. File portraitFile=new File(basePath,filename);
    88. try {
    89. portrait.transferTo(portraitFile);
    90. user.setUserPortrait(dbPath+"/"+filename);
    91. return userService.updateUserInfo(user);
    92. } catch (Exception e) {
    93. e.printStackTrace();
    94. }
    95. }
    96. return userService.updateUserInfo(user);
    97. }
    98. @ResponseBody
    99. @RequestMapping(value="/updatePwd",method=RequestMethod.PUT)
    100. public boolean updateStudentPwd(User user,HttpSession session) {
    101. String password=user.getUserPassword();
    102. if(password!=null&&!password.isEmpty()) {
    103. user.setUserPassword(Utils.md5(password));
    104. boolean bool = userService.updateUserInfo(user);
    105. if(bool==true) {
    106. session.removeAttribute("user");
    107. return true;
    108. }
    109. }
    110. return false;
    111. }
    112. }

    论文控制器

    1. @Controller
    2. @RequestMapping("/lunwenController")
    3. public class LunwenController {
    4. @Autowired
    5. private LunwenService lunwenService;
    6. @Autowired
    7. private StudentService studentService;
    8. @RequestMapping("/gotoTstudentlunwen")
    9. public String gotoTstudentlunwen(String studentId) {
    10. return "redirect:http://localhost:8080/graduation/teacher/tstudentlunwen.html?studentId="+studentId;
    11. }
    12. @ResponseBody
    13. @RequestMapping("/getLunwenBySid")
    14. public Lunwen getLunwenBySid(String studentId,HttpSession session) {
    15. if(studentId!=null&&!studentId.isEmpty()) {
    16. Lunwen lunwen = lunwenService.getLunwenBySid(studentId);
    17. if(lunwen!=null) {
    18. return lunwen;
    19. }
    20. }else {
    21. User user = (User) session.getAttribute("user");
    22. if(user!=null) {
    23. Student student = studentService.getStudentByUserId(user.getUserId());
    24. Lunwen lunwen = lunwenService.getLunwenBySid(student.getStudentId());
    25. if(lunwen!=null) {
    26. return lunwen;
    27. }
    28. }
    29. }
    30. return new Lunwen();
    31. }
    32. @ResponseBody
    33. @RequestMapping(value="/upLunwenBySid",method=RequestMethod.PUT)
    34. public boolean upLunwenBySid(Lunwen lunwen) {
    35. return lunwenService.upLunwenBySid(lunwen);
    36. }
    37. @ResponseBody
    38. @RequestMapping(value="/upload_lunwen",method=RequestMethod.POST)
    39. public boolean saveProduct(@RequestParam(value="lunwen",required=true)MultipartFile lunwen,
    40. @RequestParam("userId")String userId,HttpServletRequest request) {
    41. if(lunwen!=null&&lunwen.getSize()>0) {
    42. if(lunwen.getSize()>(10*1024*1024)) {
    43. return false;
    44. }
    45. String filename = lunwen.getOriginalFilename();
    46. String basePath=request.getServletContext().getRealPath("/WEB-INF/lunwen/"+userId);
    47. new File(basePath).mkdir();
    48. File lunewenFile=new File(basePath,filename);
    49. try {
    50. HttpSession session = request.getSession();
    51. User user = (User) session.getAttribute("user");
    52. if(user!=null) {
    53. Student student = studentService.getStudentByUserId(userId);
    54. Lunwen lw=new Lunwen();
    55. lw.setLunwenDate(new Date());
    56. lw.setLunwenName(filename);
    57. lw.setLunwenPath(basePath+"/"+filename);
    58. lunwenService.insertOrUpdate(student.getStudentId(),lw);
    59. }else {
    60. return false;
    61. }
    62. //相同文件会覆盖
    63. lunwen.transferTo(lunewenFile);
    64. return true;
    65. } catch (Exception e) {
    66. e.printStackTrace();
    67. }
    68. }
    69. return false;
    70. }
    71. @RequestMapping("/downloadResource")
    72. public @ResponseBody void downloadResource(HttpServletResponse response,
    73. HttpServletRequest request,String studentId) throws Exception {
    74. if(studentId==null||studentId.isEmpty()) {
    75. return;
    76. }
    77. Lunwen lunwen = lunwenService.getLunwenBySid(studentId);
    78. if(lunwen==null) {
    79. return;
    80. }
    81. String dataDir=lunwen.getLunwenPath();
    82. String fileName=lunwen.getLunwenName();
    83. Path path=Paths.get(dataDir);
    84. if(Files.exists(path)) {
    85. response.setContentType("application/octet-stream");
    86. response.addHeader("Content-Disposition", "attachment;filename="+Utils.filenameEncoding(fileName, request));
    87. try {
    88. Files.copy(path, response.getOutputStream());
    89. } catch (IOException e) {
    90. e.printStackTrace();
    91. }
    92. }
    93. return;
    94. }
    95. }

    如果也想学习本系统,下面领取。回复:116ssm

  • 相关阅读:
    Oracle主备切换,ogg恢复方法(集成模式)
    【Spring mvc】处理文件上传的请求
    S4.2.4.5 Fast Training Sequence (FTS)
    uniapp实战项目 (仿知识星球App) - - 封装组件
    springboot 使用 logback日志
    Elasticsearch7.10.0安装
    MongoDB简介
    投入产出公开数据集:世界投入产出表(1995-2014)、全国投入产出表(1990-2018)、分省市投入产出表(1997-2017)
    Twins: Revisiting the Design of Spatial Attention in Vision Transformers
    Python实现的热点话题发现系统
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/125478302