基于javaweb+jsp的教务管理系统(java+JSP+Spring+SpringBoot+layui+maven)

基于javaweb+jsp的教务管理系统(java+JSP+Spring+SpringBoot+layui+maven)
一、项目简述

功能包括:
三角色教师 管理员,学生教务管理系统,包括院系管理,课题综合管理,信息管理,以及差旅管理,学生选题等等。

二、项目运行

环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

        long size = file.getSize();
        //不更新课题文件情况
        if (file == null || size == 0) {
            subject = new SubjectWithBLOBs();
            subject.setId(id);
            subject.setProjectname(projectName);
            subject.setIdProjecttype(idProjecttype);
            subject.setIdProjectsource(idProjectsource);
            subject.setMarchspecialty(marchspecialty);
            subject.setTeachernames(teachernames);
            //修改后状态置 0
                cookie.setHttpOnly(true);
                cookie.setPath("/");
                response.addCookie(cookie);
                model.addAttribute("student", student.get(0));
                return "200";
            }else {
                return "0";
            }
        } else {
            return "300";
    IndexServiceImpl indexService;
    @Autowired
    AdminService adminService;
    @Autowired
    TopicsService topicsService;
    //Session过期时间
    private final Integer SAVE_TIME = 60*60*24;
    @GetMapping("/login")
    public String login(){
        return "student/login";
    }
        model.addAttribute("tclass", idclass);
        return "student/studentinfo";
    }
    /**
     * 将查看的个人信息放到信息修改页面
     */
    @RequestMapping("/modifyinfo")
    public String modifyinfo(Model model) {
        Student student = (Student) request.getSession().getAttribute("student");
        MyClass idclass = indexService.studentinfo(student.getIdClass());
        model.addAttribute("tclass", idclass);
        return "student/modifyinfo";
    }
    /**
     * 修改个人信息
     * 根据班级(className)修改
     *
     */
        Map<String, String> map = new HashMap<String, String>();
        map.put("pd", "" + 1);
        return JSONObject.toJSONString(map);
    }
    @PostMapping("del_project")
    @ResponseBody
    public Msg deleteProject(Long id) {
        teacherService.deleteProject(id);
        return Msg.success();
    }
    }
    @PostMapping("/login")
    @ResponseBody
    public Msg login(String name, String pwd, HttpSession httpSession) {
        name = name.trim();
//        LOGGER.info("{}--{}",name,pwd);
        return adminService.login(name, pwd, httpSession);
    }
}
教师管理控制层:
@Authority(roles = {Role.TEACHER})
@Controller
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    TeacherService teacherService;
    @Autowired
    SubjectService subjectService;
    @RequestMapping(value = {"", "/loginPage"})
    public String loginPage() {
            return "201";
        }
    }
    /**
     * 取消选报
     */
    @RequestMapping("/cancel")
    @ResponseBody()
    public String cancel(Long project_id, Model model, HttpSession httpSession) {
        System.out.println(1);
        String projectName = topicsService.selectprojectname(project_id);
        Student student = (Student) request.getSession().getAttribute("student");
        List<Subjectselected> subjectselected = subjectselectedMapper.selectBystudentid(student.getId());
        if (subjectselected != null && subjectselected.size() != 0 && subjectselected.get(0).getStuselectFlag() != 3
                && project_id.equals(subjectselected.get(0).getIdProject())) {
            topicsService.deleteprojectselectedid(student.getId());
            httpSession.removeAttribute("XZproject");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        String start = sdf.format(workapproval.getBeginDate());
        String end = sdf.format(workapproval.getEndDate());
        String time = start + " - " + end;
        model.addAttribute("workapproval", workapproval);
        model.addAttribute("time", time);
        return "teacher/workapproval/fillwdata";
    }
    //上传出差报告
    @PostMapping("/fill_in_w")
    @ResponseBody
    public Msg fun7(@RequestParam("id_work") Long idWork, @RequestParam("news") String news, @RequestParam("flag") Integer flag,
                    @RequestParam("file") MultipartFile file) throws IOException {
        //判断file的值是否为空
        if (file.isEmpty()) {
            return Msg.error();
        }
        String fileName = file.getOriginalFilename();// 获取上传文件的原名
        int size = (int) file.getSize();
        System.out.println(fileName + "-->" + size);
        File path = new File(ResourceUtils.getURL("target").getPath());
        String savePath = path.getAbsolutePath() + "\\classes\\static\\model";
    @GetMapping("/exit")
    public String exit(HttpServletResponse response) {
        //将Cookie 中的token 置空
        Cookie cookie = new Cookie("token", null);
        cookie.setPath("/");
        response.addCookie(cookie);
        return "redirect:/";
    }
    //打印页面
    @GetMapping("/print_term_debriefing")
    //查询指定年份的年度述职信息
    @GetMapping("/select_debriefing_year_info")
    @ResponseBody
    public Msg fun12(Long year, HttpSession httpSession) {
        Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
        DebriefingYearWithBLOBs debriefingYear = teacherService.selectYearDebriefingInfo(teacher.getId(), year);
        return Msg.success().add("debriefingInfo", debriefingYear);
    }
    //查询学期述职中年份
    @GetMapping("select_debriefing_term")
    @ResponseBody
    public Msg fun13() {
        List<Debriefing> list = teacherService.selectDebriefingTermByYear();
        List<Long> temp = new ArrayList<>();
        //去除重复的年份
        for (Debriefing s : list) {
            if (!temp.contains(s.getYear())) {
                temp.add(s.getYear());
            }
        }
        }
    }*/
    /**
     *   跳转页面(修改密码)
     */
    @RequestMapping("/changepsw")
    public String changepsw() {
        return "student/changepsw";
    }
    /**
     * 200修改成功
     * 201对不起密码错误
     * 202对不起输入框为空
     * 203新密码不一致
     * 204修改失败
     */
    @RequestMapping(value = "/changepassword", method = RequestMethod.PUT)
    @ResponseBody
            User user = new User();
            //-1表示为超管
            user.setId(0L);
            user.setRole("teacher");
            user.setUserName(name);
            //生成Token 存到 Cookie
            Cookie cookie = new Cookie("token", TokenUtil.createToken(
                    user
            ));
            //该Cookie无法被js读取
            cookie.setHttpOnly(true);
            cookie.setPath("/");
            response.addCookie(cookie);
            Teacher teacher = teacherService.selectTeacher(name);
            httpSession.setAttribute("teacherInfo", teacher);
            httpSession.setMaxInactiveInterval(3600);
        }
        return Msg.success().add("info", flag);
    }
    //教师信息修改
    //修改教师密码
    @PostMapping("/teacherupdetpwd")
    @ResponseBody
        teacher.setName(name);
        teacher.setGender(gender);
        teacherService.teacherupdateInfo(teacher);
        return Msg.success();
    }
    //教师出差模块
    //查询所有教师出差申请信息
    @GetMapping("/select_work_all")
    @ResponseBody
    public Msg fun1(HttpSession httpSession) {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        List<WorkapprovalWithBLOBs> list = teacherService.selectTeacherWorkAll(teacher.getId());
        return Msg.success().add("workinfo", list);
    }
    //查询申请成功教师出差申请
    @GetMapping("/select_work_success")
    @ResponseBody
    public Msg fun2(HttpSession httpSession) {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSuccess(teacher.getId());
    @GetMapping("/login")
    public String login(){
        return "student/login";
    }
    @PostMapping(value = "/login")
    @ResponseBody
    public String login(String name, String pwd, Model model, HttpServletResponse response) {
        name = name.trim();
        List<Student> student = studentService.selectByName(name);
        if (student.size() >= 1) {
            if (student.get(0).getPwd().equals(pwd)) {
                request.getSession().setAttribute("student",student.get(0));
                request.getSession().setMaxInactiveInterval(SAVE_TIME);
                User user = new User();
                //-1表示为超管
                user.setId(1L);
                user.setRole("student");
                user.setUserName(name);
                //生成Token 存到 Cookie
                Cookie cookie = new Cookie("token", TokenUtil.createToken(
                        user
                ));
                //该Cookie无法被js读取
                cookie.setHttpOnly(true);
                            +File.separator+"model"+File.separator + teacher.getId();
            String saveFileName = savePath +File.separator + uploadFileName;
            File dirs = new File(savePath);
            //判断路径是否存在,如果不存在就创建一个
            if (!dirs.exists()) {
                dirs.mkdirs();
            }
            file.transferTo(new File(dirs, uploadFileName)); // 开始接受文件
            SubjectWithBLOBs project = subject1;
            project.setProjectname(projectName);
            project.setIdProjecttype(idProjecttype);
            project.setIdProjectsource(idProjectsource);
            project.setFilepath(saveFileName);
            project.setMarchspecialty(marchspecialty.trim());
            project.setTeachernames(teachernames);
            //修改后状态置 0
            project.setSelectFlag(0);
            project.setVerifyprojectFlag(0);
            project.setReleaseFlag(0);
            int i = subjectService.updateSubjectByid(project);
            return Msg.success();
        Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
        int flag = teacherService.teacherUpdetpwd(teacher.getUsername(), oldpwd, newpwd);
        return Msg.success().add("flag", flag);
    }
    //修改教师信息
    @PostMapping("/teacherupdeteinfo")
    @ResponseBody
    public Msg updateinfo(String name, String gender, HttpSession httpSession) {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        teacher.setName(name);
        teacher.setGender(gender);
        teacherService.teacherupdateInfo(teacher);
        return Msg.success();
    }
    //教师出差模块
    //查询所有教师出差申请信息
    @GetMapping("/select_work_all")
    @ResponseBody
    public Msg fun1(HttpSession httpSession) {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        List<WorkapprovalWithBLOBs> list = teacherService.selectTeacherWorkAll(teacher.getId());
        return Msg.success().add("workinfo", list);
    }
    //查询申请成功教师出差申请
    @PostMapping("/upload_year_debriefing")
    @ResponseBody
    public Msg fun10(String year, String teachingTask, String scientificResearch,
                     String otherWork, String winAward, String summary, HttpSession httpSession) {
        Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
        DebriefingYearWithBLOBs debriefingYear = new DebriefingYearWithBLOBs();
        debriefingYear.setIdTeacher(teacher.getId());
        debriefingYear.setYear(Long.parseLong(year));
        debriefingYear.setTeachingtask(teachingTask);
        debriefingYear.setAchievementsinscientificresearch(scientificResearch);
        debriefingYear.setOtherwork(otherWork);
        debriefingYear.setWinaward(winAward);
        debriefingYear.setSummary(summary);
    @GetMapping("/cxallProject")
    public String fun7(ModelMap modelMap, HttpSession httpSession) {
        Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
        List<Project> projects = teacherService.selecSectionProject(teacher.getSectionName());
        for (int i = 0; i < projects.size(); i++) {
            if (projects.get(i).getVerifyprojectFlag() == 0) projects.get(i).setProjectZT("未审核");
            else if (projects.get(i).getVerifyprojectFlag() == 1) projects.get(i).setProjectZT("审核未通过");
            else projects.get(i).setProjectZT("审核通过");
        }
        modelMap.addAttribute("allproject", projects);
        return "teacher/graduation/section_xq/subjectinfoto";
    }
}
学生管理控制层:
@Authority(roles = {Role.STUDENT})
                    @RequestParam("file") MultipartFile file) throws IOException {
        //判断file的值是否为空
        if (file.isEmpty()) {
            return Msg.error();
        }
        String fileName = file.getOriginalFilename();// 获取上传文件的原名
        int size = (int) file.getSize();
        System.out.println(fileName + "-->" + size);
        File path = new File(ResourceUtils.getURL("target").getPath());
        String savePath = path.getAbsolutePath() + "\\classes\\static\\model";
        String saveFileName = savePath + "\\" + fileName;
//        String path = "D:/test";//文件保存路径
        File targetFile = new File(savePath);
        if (!targetFile.getParentFile().exists()) { //判断文件父目录是否存在
            targetFile.getParentFile().mkdir();
        }
    @ResponseBody
    public String login(String name, String pwd, Model model, HttpServletResponse response) {
        name = name.trim();
        List<Student> student = studentService.selectByName(name);
        if (student.size() >= 1) {
            if (student.get(0).getPwd().equals(pwd)) {
                request.getSession().setAttribute("student",student.get(0));
                request.getSession().setMaxInactiveInterval(SAVE_TIME);
                User user = new User();
                //-1表示为超管
                user.setId(1L);
            student.setName(null);
        }
        if (student.getGender().equals(Tstudent.getGender())) {
            student.setGender(null);
        }
        if (student.getGender() == null && student.getName() == null && student.getIdClass() == null && student.getStunum() == null) {
        } else {
            student.setId(Tstudent.getId());
            count = indexService.updateBymodifyinfo(student);
            student = indexService.selectByid(Tstudent.getId());
            model.addAttribute("student", student);
        }
        if (count > 0) {
            request.getSession().setAttribute("student",student);
            request.getSession().setAttribute("modifyFlag",1);
            return "200";
        } else {
            request.getSession().setAttribute("modifyFlag",0);
            return "201";
        }
    }
    @GetMapping("/teacherInfo")
    public String teacherInfo() {
        return "teacher/teacherInfo/teacherinfo";
    }
    @GetMapping("/modifyinfo")
    public String modifyInfo() {
        return "teacher/teacherInfo/updateinfo";
    }
    @GetMapping("/workapprovalinfo")
    public String workInfo() {
        return "teacher/workapproval/winfo";
    }
    @GetMapping("/workapprovaldata")
    public String workData() {
        return "teacher/workapproval/wdata";
    }
    @GetMapping("/seeworkdata")
    public String seeWorkData() {
        return "teacher/workapproval/seewdata";
//         把年份排序
        Collections.sort(list, new Comparator<DebriefingYear>() {
            @Override
            public int compare(DebriefingYear o1, DebriefingYear o2) {
                return (int) (o2.getYear() - o1.getYear());
            }
        });
        return Msg.success().add("year", list);
    }
    //查询指定年份的年度述职信息
    @GetMapping("/select_debriefing_year_info")
    @ResponseBody
    public Msg fun12(Long year, HttpSession httpSession) {
        Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
        DebriefingYearWithBLOBs debriefingYear = teacherService.selectYearDebriefingInfo(teacher.getId(), year);
        return Msg.success().add("debriefingInfo", debriefingYear);
    }
    //查询学期述职中年份
    @GetMapping("select_debriefing_term")
                response.addCookie(cookie);
                model.addAttribute("student", student.get(0));
                return "200";
            }else {
                return "0";
            }
        } else {
            return "300";
        }
    }
    @RequestMapping("/index")
    public String index(Model model, HttpSession httpSession) {
        Student student = (Student) request.getSession().getAttribute("student");
        Subject project = indexService.indexinfo(student.getId());
        String str = null;
        Long flag = null;
        if (project == null) {
            model.addAttribute("projectName", "未选课题");
            model.addAttribute("flag", "未选题");
            flag = 3L;
        }
        model.addAttribute("selectFlag",selectFlag);
        model.addAttribute("flag", flag);
        model.addAttribute("topicstos", topicstos);
        model.addAttribute("projectName", projectName);
        model.addAttribute("project_id", project_id);
        model.addAttribute("XZproject", httpSession.getAttribute("XZproject"));
        return "student/topicsinfoto";
    }
    }
    /**
     * 200修改成功
     * 201对不起密码错误
     * 202对不起输入框为空
     * 203新密码不一致
     * 204修改失败
     */
    @RequestMapping(value = "/changepassword", method = RequestMethod.PUT)
    @ResponseBody
    public String changepswdao(String oldpassword, String newpassword, String newpassword1) {
        if(!verifypassword(newpassword)){
            return "206";
        }
        if(!verifypassword(newpassword1)){
            return "206";
        }
        Student student = (Student) request.getSession().getAttribute("student");
        Student studentdao = loginService.selectByName(student.getUsername());
        int result;
        if (newpassword.equals(newpassword1) && !newpassword.equals("") && !newpassword1.equals("")) {
            if (studentdao.getPwd().equals(oldpassword)) {
        return "teacher/showtable/annualassessment";
    }
    @GetMapping("/show_technical_personnel")
    public String showTechnicalPersonnel() {
        return "teacher/showtable/technicalpersonnel";
    }
    @GetMapping("/show_workload")
    public String showWorkLoad() {
        return "teacher/showtable/workload";
    }
    @GetMapping("/exit")
    public String exit(HttpServletResponse response) {
        //将Cookie 中的token 置空
        Cookie cookie = new Cookie("token", null);
        cookie.setPath("/");
        response.addCookie(cookie);
        return "redirect:/";
    }
    //打印页面
    @GetMapping("/print_term_debriefing")
        return Msg.success().add("workinfo", list);
    }
    //查询申请失败教师出差申请
    @GetMapping("/select_work_failed")
    @ResponseBody
    public Msg fun3(HttpSession httpSession) {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        List<WorkapprovalWithBLOBs> list = teacherService.selectWorkFailed(teacher.getId());
        return Msg.success().add("workinfo", list);
    }
    //查询已提交教师出差申请
    @GetMapping("/select_work_submitted")
    @ResponseBody
    public Msg fun4(HttpSession httpSession) {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSubmitted(teacher.getId());
        return Msg.success().add("workinfo", list);
    }
    //删除申请失败的教师出差
    @PostMapping("/delete_work")
    @ResponseBody
    public Msg deleteWork(Long id) {
        teacherService.deleteWorkById(id);
    //查看自己的课题发布记录
    @GetMapping("/cxmyProject")
    public String fun21(ModelMap modelMap, HttpSession httpSession)  {
        TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
        List<Projecttype> projecttypes = teacherService.select_allProjecttype();
        List<Projectsource> projectsources = teacherService.select_allProjectsource();
        List<Specialty> specialties = teacherService.select_allSpecialty(teacher.getIdSection());
        modelMap.addAttribute("projecttypes", projecttypes);
        modelMap.addAttribute("projectsources", projectsources);
        modelMap.addAttribute("specialties", specialties);
        List<Project> projects = teacherService.selectTeacherProject(teacher.getName());
        for (int i = 0; i < projects.size(); i++) {
            if (projects.get(i).getVerifyprojectFlag() == 0) projects.get(i).setProjectZT("未审核");
            else if (projects.get(i).getVerifyprojectFlag() == 1) projects.get(i).setProjectZT("审核未通过");
            else projects.get(i).setProjectZT("审核通过");
        }
        modelMap.addAttribute("Myproject", projects);
        return "teacher/graduation/section_xq/index";
    }
    // 发布或取消发布已审核通过的课题

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值