Java|Java 实战项目之毕业设计管理系统的实现流程

一、项目简述 功能包括: 该系统不错分为学生,教师,管理员,教导主任四种角 色,包括学生管理,教师管理,学生选题,教师选题,主 任审核,管理员审核,开题报告,中期检查,论文提交, 文件管理等等非常不错。
二、项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
Java|Java 实战项目之毕业设计管理系统的实现流程
文章图片

Java|Java 实战项目之毕业设计管理系统的实现流程
文章图片

Java|Java 实战项目之毕业设计管理系统的实现流程
文章图片

Java|Java 实战项目之毕业设计管理系统的实现流程
文章图片

Java|Java 实战项目之毕业设计管理系统的实现流程
文章图片

用户管理操作控制层:

/** * 用户管理操作 */@Controller@RequestMapping("/user")public class UserController { @Autowiredprivate UserService userService; /*** 用户添加页面* @return*/@GetMapping("/add")public String create() {return "user/add"; } /*** 用户添加操作* @param user* @return*/@PostMapping("/add")@ResponseBodypublic Map add(@RequestBody User user) {if(StringUtils.isEmpty(user.getUserName())){return MapControl.getInstance().error("请填写用户名").getMap(); }if(StringUtils.isEmpty(user.getName())){return MapControl.getInstance().error("请填写名称").getMap(); }if(StringUtils.isEmpty(user.getUserPwd())){return MapControl.getInstance().error("请填写密码").getMap(); }int result = userService.create(user); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } /*** 根据id删除* @param id* @return*/@PostMapping("/delete/{id}")@ResponseBodypublic Map delete(@PathVariable("id") Integer id) {int result = userService.delete(id); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } //批量删除@PostMapping("/delete")@ResponseBodypublic Map delete(String ids) {int result = userService.delete(ids); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } /*** 编辑用户信息操作* @param user* @return*/@PostMapping("/edit")@ResponseBodypublic Map edit(@RequestBody User user) {if(StringUtils.isEmpty(user.getUserName())){return MapControl.getInstance().error("请填写用户名").getMap(); }if(StringUtils.isEmpty(user.getName())){return MapControl.getInstance().error("请填写名称").getMap(); }if(StringUtils.isEmpty(user.getUserPwd())){return MapControl.getInstance().error("请填写密码").getMap(); }int result = userService.update(user); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } /*** 根据id查询,跳转修改页面* @param id* @param modelMap* @return*/@GetMapping("/edit/{id}")public String edit(@PathVariable("id") Integer id, ModelMap modelMap) {User user = userService.detail(id); modelMap.addAttribute("user", user); return "user/edit"; } //查询所有@PostMapping("/query")@ResponseBodypublic Map query(@RequestBody User user) {List list = userService.query(user); Integer count = userService.count(user); return MapControl.getInstance().success().page(list, count).getMap(); } //跳转列表页面@GetMapping("/list")public String list() {return "user/list"; } }

跳转首页判断以及数据展示图表:
@Controllerpublic class IndexController { @AutowiredUserService userService; @AutowiredTeacherService teacherService; @AutowiredStudentService studentService; @AutowiredClazzService clazzService; @AutowiredSubjectService subjectService; @AutowiredCourseService courseService; @AutowiredSectionService sectionService; @AutowiredScoreService scoreService; //跳转系统主页@GetMapping("/index")public String login() {return "index"; } //跳转用户基本信息页面@GetMapping("/info")public String info() {return "info"; } //跳转修改密码页面@GetMapping("/pwd")public String pwd() {return "pwd"; } //修改密码 根据旧密码来修改密码@PostMapping("/pwd")@ResponseBodypublic Map pwd(String sourcePwd,String newPwd,String type,Integer id) {//先判断类型if("1".equals(type)) {User user = userService.detail(id); //比较原密码是否相同 注意:原密码也要加密后再进行比较,因为数据库中存储的是加密后的密码if(user.getUserPwd().equals(MD5Utils.getMD5(sourcePwd))) {User entity = new User(); entity.setId(id); entity.setUserPwd(MD5Utils.getMD5(newPwd)); //主要要加密int result = userService.update(entity); if(result <= 0) {return MapControl.getInstance().error().getMap(); } else {return MapControl.getInstance().success().getMap(); }} else {return MapControl.getInstance().error("原密码错误").getMap(); }}if("2".equals(type)) {Teacher teacher = teacherService.detail(id); //比较原密码if(teacher.getTeacherPwd().equals(MD5Utils.getMD5(sourcePwd))) {Teacher entity = new Teacher(); entity.setId(id); entity.setTeacherPwd(MD5Utils.getMD5(newPwd)); int result = teacherService.update(entity); if(result <= 0) {return MapControl.getInstance().error().getMap(); } else {return MapControl.getInstance().success().getMap(); }} else {return MapControl.getInstance().error("原密码错误").getMap(); }}if("3".equals(type)) {Student student = studentService.detail(id); //比较原密码if(student.getStuPwd().equals(MD5Utils.getMD5(sourcePwd))) {Student entity = new Student(); entity.setId(id); entity.setStuPwd(MD5Utils.getMD5(newPwd)); int result = studentService.update(entity); if(result <= 0) {return MapControl.getInstance().error().getMap(); } else {return MapControl.getInstance().success().getMap(); }} else {return MapControl.getInstance().error("原密码错误").getMap(); }} return MapControl.getInstance().error().getMap(); } //跳转系统主页(数据概览)@GetMapping("/main")public String main(ModelMap modelMap) {//1.系统数据概览List clazzes = clazzService.query(null); List subjects = subjectService.query(null); List teachers = teacherService.query(null); List courses = courseService.query(null); List sections = sectionService.query(null); List students = studentService.query(null); modelMap.addAttribute("clazzCnt",clazzes.size()); modelMap.addAttribute("subjectCnt",subjects.size()); modelMap.addAttribute("teacherCnt",teachers.size()); modelMap.addAttribute("courseCnt",courses.size()); modelMap.addAttribute("studentCnt",students.size()); modelMap.addAttribute("sectionCnt",sections.size()); //2.班级学生数量List mapList = new ArrayList<>(); for(Clazz clazz : clazzes) {Map map = new HashMap<>(); map.put("name",clazz.getClazzName()); //设置班级名称int cnt = 0; //统计学生数量for(Student student : students) {if(student.getClazzId() == clazz.getId()) {cnt++; }}map.put("cnt",cnt); //设置学生数量mapList.add(map); }modelMap.addAttribute("mapList",mapList); //3.查询各科平均成绩(根据专业查询各科平均成绩)List mapList2 = scoreService.queryAvgScoreBySection(); modelMap.addAttribute("mapList2",mapList2); return "main"; } }

公告管理控制器:
/** * 公告管理控制器 */@Controller@RequestMapping("/notice")public class NoticeController { @Autowiredprivate NoticeService noticeService; //跳转添加页面@GetMapping("/add")public String add() {return "notice/add"; } /*** 公告添加* @param notice* @return*/@PostMapping("/add")@ResponseBodypublic Map add(Notice notice, HttpServletRequest request) {if(StringUtils.isEmpty(notice.getTitle())){return MapControl.getInstance().error("请填写公告标题").getMap(); }if(StringUtils.isEmpty(notice.getContent())){return MapControl.getInstance().error("请填写公告内容").getMap(); }User user = (User) request.getSession().getAttribute("user"); notice.setAuthor(user.getUserName()); notice.setAuth("1"); int result = noticeService.create(notice); if (result <= 0) {//新增失败return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } //根据id删除@PostMapping("/delete/{id}")@ResponseBodypublic Map delete(@PathVariable("id") Integer id) {int result = noticeService.delete(id); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } //批量删除@PostMapping("/delete")@ResponseBodypublic Map delete(String ids) {int result = noticeService.delete(ids); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } /*** 修改公告操作* @param notice* @return*/@PostMapping("/edit")@ResponseBodypublic Map edit(@RequestBody Notice notice) {if(StringUtils.isEmpty(notice.getTitle())){return MapControl.getInstance().error("请填写公告标题").getMap(); }if(StringUtils.isEmpty(notice.getContent())){return MapControl.getInstance().error("请填写公告内容").getMap(); }int result = noticeService.update(notice); if (result <= 0) {return MapControl.getInstance().error().getMap(); }return MapControl.getInstance().success().getMap(); } //根据id查询,跳转修改页面@GetMapping("/edit/{id}")public String edit(@PathVariable Integer id, ModelMap modelMap) {//查询要修改的老师Notice notice = noticeService.detail(id); modelMap.addAttribute("notice", notice); return "notice/edit"; }//根据id查询,跳转添加页面@GetMapping("/look/{id}")public String look(@PathVariable Integer id, ModelMap modelMap) {Notice notice = noticeService.detail(id); modelMap.addAttribute("notice", notice); return "notice/look"; } //查询所有@PostMapping("/query")@ResponseBodypublic Map query(@RequestBody Notice notice) {List list = noticeService.query(notice); Integer count = noticeService.count(notice); return MapControl.getInstance().success().put("data", list).put("count", count).getMap(); } //跳转列表页面@GetMapping("/list")public String list() {return "notice/list"; }}

登陆用户判断业务控制层:
@Controllerpublic class LoginController { @Autowiredprivate UserService userService; @Autowiredprivate TeacherService teacherService; @Autowiredprivate StudentService studentService; //跳转登录页面@GetMapping("/login")public String login() {return "login"; } //登录操作@PostMapping("/login")@ResponseBodypublic Map login(String userName, String password, String captcha, String type, HttpSession session) {//判断用户名、密码、用户类型、验证码是否为空if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password) || StringUtils.isEmpty(captcha) || StringUtils.isEmpty(type)) {return MapControl.getInstance().error("用户名或密码不能为空").getMap(); }//获取系统生成的验证码String _captcha = (String) session.getAttribute("captcha"); //先判断验证码是否正确if (!(captcha.toLowerCase()).equals(_captcha.toLowerCase())) {//验证码错误return MapControl.getInstance().error("验证码错误").getMap(); } //判断用户类型if ("1".equals(type)) { //管理员验证登录User user = userService.login(userName, MD5Utils.getMD5(password)); //对密码进行加密处理,因为数据库中存储的是加密后的密码if (user != null) {session.setAttribute("user", user); session.setAttribute("type", 1); return MapControl.getInstance().success().add("data", user).getMap(); } else {return MapControl.getInstance().error("用户名或密码错误").getMap(); }}if ("2".equals(type)) { //老师验证登录Teacher teacher = teacherService.login(userName, MD5Utils.getMD5(password)); if (teacher != null) {session.setAttribute("user", teacher); session.setAttribute("type", "2"); return MapControl.getInstance().success().add("data", teacher).getMap(); } else {return MapControl.getInstance().error("用户名或密码错误").getMap(); }}if ("3".equals(type)) { //学生验证登录Student student = studentService.login(userName, MD5Utils.getMD5(password)); if (student != null) {session.setAttribute("user", student); session.setAttribute("type", "3"); return MapControl.getInstance().success().add("data", student).getMap(); } else {return MapControl.getInstance().error("用户名或密码错误").getMap(); }}return MapControl.getInstance().getMap(); } }

【Java|Java 实战项目之毕业设计管理系统的实现流程】到此这篇关于Java 实战项目之毕业设计管理系统的实现流程的文章就介绍到这了,更多相关Java 毕业设计管理系统内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

    推荐阅读