基于javaweb+mysql的springboot校园报修管理系统(java+springboot+bootstrap+jsp+maven+mysql)

基于javaweb+mysql的springboot校园报修管理系统(java+springboot+bootstrap+jsp+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

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

功能说明

基于javaweb+mysql的SpringBoot校园报修管理系统(java+springboot+bootstrap+jsp+maven+mysql)

项目介绍

本项目为后台管理系统,包括管理员与学生两种角色; 学生包含以下功能: 学生提交报修,添加维修,催单,水电缴费,登录页面等功能。

管理员包含以下功能: 查看所有报修单,催单,维修安排,学生管理,添加学生,维修人员管理等功能。

环境需要

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.数据库:MySql 5.7版本; 6.是否Maven项目:是;

技术栈

  1. 后端:SpringBoot 2. 前端:JSP+CSS+JavaScript+jquery+bootstrap

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录

/**
 * 用户的web层
 *
 */

@Controller
@CrossOrigin(origins = {"http://localhost:18084", "null"})
@RequestMapping("/student")
     */
    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public String infomation(HttpServletRequest httpServletRequest, Model model) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        Student student = studentService.getStudentById(id);

        StudentResult studentResult = new StudentResult(
                student.getId(), student.getName(), student.getPassword(),
                student.getSexual(), student.getSexual() == 0 ? "男" : "女",
                student.getEmail(), student.getPhone(), student.getDoor());
        model.addAttribute("student", studentResult);

        return "student/info";
    }

    /**
     * 修改密码的控制器
     *
     * @param password
     * @param httpSession
     * @param httpServletResponse
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/changepassword", method = RequestMethod.POST)
    public
    @ResponseBody
    LoginResult changePassword(String password, HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        Student student = studentService.getStudentByEmail(id);

        studentService.changePassword(student.getId(), password);

        return new LoginResult(true);
    }
    
    
    /**
     * 修改其它资料
     *
     * @param name
     * @param phone
     * @param sexual
        repair.setPicMD5("/" + repair.getPicMD5());

        RepairInfoVo repairInfoVo = new RepairInfoVo(repair);
        repairInfoVo.setStatesInfo(RepairEnumCN.stateOf(repair.getStatus()).getStateInfo());

        model.addAttribute("repairInfoVo", repairInfoVo);

        return "admin/detail";
    }

    @RequestMapping(value = "/repair/{repairId}/cancel", method = RequestMethod.GET)
    public String cancelRepair(@PathVariable("repairId") int repairId) {
        repairService.cancelRepair(repairId);
        return "redirect:/admin/dashboard";
    }

    @RequestMapping(value = "/repair/{repairId}/confirm", method = RequestMethod.GET)
    public String confirmRepair(@PathVariable("repairId") int repairId) {
        repairService.confirmRepair(repairId);

        return "redirect:/admin/dashboard";
    }

    @RequestMapping(value = "/repair/{repairId}/arrange", method = RequestMethod.GET)
    public String arrangeRepair(@PathVariable("repairId") int repairId, Model model) {
        Repair repair = repairService.getRepairById(repairId);

        if (repair.getStatus() == RepairEnum.REPAIR_ARRANGED.getState())
        {
            return "redirect:/admin/repair/" + String.valueOf(repairId) + "/detail";
        }

        List<Technician> techniciens = technicianService.getAllTechnician();

        model.addAttribute("repair", repair);
        model.addAttribute("techniciens", techniciens);

        return "/admin/addArrange";
    }

    @RequestMapping(value = "/maintenance/{repairId}/add", method = RequestMethod.POST)
    public String submitArrange(@PathVariable("repairId") int repairId, @RequestParam("technicianId") String technicianId) {

        // 解决表单提交时乱码的问题(JSP在表单提交时默认采用ISO-8859-1编码)
        try {
        String doorName = student.getDoor();
        Door door = doorDao.queryByName(doorName);
        model.addAttribute("fee", door);
        return "student/feelist";
    }
    
    @RequestMapping(value = "/feeupload", method = RequestMethod.GET)
    public String feeupload(Model model,HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
    	String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
        Student student = studentService.getStudentById(id);
        String doorName = student.getDoor();
        Door door = doorDao.queryByName(doorName);
        model.addAttribute("feeup", door);
    	return "student/feeupload";
    }
    
    /**
     * 缴费
     * @param model
     * @param httpSession
     * @param httpServletResponse
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/uploadfee", method = RequestMethod.POST)
    public String uploadfee(String name, String water, String power,Model model,HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
    	String id = null;
		try {
			id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
		} catch (NullPointerException e1) {
			return "student/login";
		}
        Student student = studentService.getStudentById(id);
        String doorName = student.getDoor();
        Door door = doorDao.queryByName(doorName);
        double waterInput = 0;
        double PowerInput = 0;
        double waterDB = 0;
        double powerDB = 0;
        try {
        	waterInput = Double.parseDouble(water);
		} catch (NumberFormatException e) {
			waterInput = 0;
		}
        try {

    @RequestMapping(value = "/technician", method = RequestMethod.GET)
    public String technician(Model model) {

        List<Technician> techniciens = technicianService.getAllTechnician();

        model.addAttribute("techniciens", techniciens);

        return "admin/technician";
    }

    /**
     * 添加维修人员 GET方法
     * @param model
     * @return
     */
    @RequestMapping(value = "/addtechnician", method = RequestMethod.GET)
    public String addTechnician(Model model) {
        return "/admin/addTechnician";
    }

    /**
     * 添加维修人员 POST方法
     * @param model
     * @return
     */
    @RequestMapping(value = "/addtechnician", method = RequestMethod.POST)
    public String addTechnician(@RequestParam("name") String name,@RequestParam("number") String number,@RequestParam("phone") String phone, Model model, HttpServletRequest httpServletRequest) {

        technicianService.addTechnician(name,number,phone);

        return "redirect:/admin/technician";
    }
}
package com.ilovecl.demo.interceptor;

    @RequestMapping(value = "/repair/{repairId}/delete", method = RequestMethod.GET)
    public String delete(@PathVariable("repairId") int repairId) {
        repairService.deleteRepair(repairId);

        return "redirect:/student/dashboard";
    }

    /**
     * 修改报修单
     *
     * @param repairId
     * @param model
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/update", method = RequestMethod.GET)
    public String update(@PathVariable("repairId") int repairId, Model model) {
        Repair repair = repairService.getRepairById(repairId);
        model.addAttribute("repair", repair);
        return "/student/update";
    }

    /**
     * 修改报修单
     *
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/update", method = RequestMethod.POST)
    public String update(@PathVariable("repairId") int repairId, @RequestParam("detail") String detail, @RequestParam("place") String place,
                         @RequestParam("file") MultipartFile file, HttpServletRequest httpServletRequest) {

        String sno = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        int id = repairId;

        String picMD5 = "";

        logger.info(detail);
        logger.info(place);
        logger.info(picMD5);

        if (file != null) {
            try {
                picMD5 = MD5.getMD5(sno + String.valueOf(System.currentTimeMillis()) + file.getOriginalFilename());
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("*************************************************");
            }

     * @param httpSession
     * @param httpServletResponse
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/changeinfo", method = RequestMethod.POST)
    public
    @ResponseBody
    LoginResult changeInfo(String name, String phone, String sexual, HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
        System.out.println("name:"+name+";phone:"+phone+";sexual:"+sexual);
        Student student = studentService.getStudentByEmail(id);

        if(sexual.equals("男"))
        {
            sexual="0";
        }else{
            sexual="1";
        }
        studentService.changeOtherInfo(student.getId(), Integer.valueOf(sexual), name, phone);

        httpServletResponse.addCookie(new Cookie(StudentConst.STUDENT_NAME, student.getName()));

        return new LoginResult(true);
    }
}
package com.ilovecl.demo.web;

     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/delete", method = RequestMethod.GET)
    public String delete(@PathVariable("repairId") int repairId) {
        repairService.deleteRepair(repairId);

        return "redirect:/student/dashboard";
    }

    /**
     * 修改报修单
     *
     * @param repairId
     * @param model
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/update", method = RequestMethod.GET)
    public String update(@PathVariable("repairId") int repairId, Model model) {
        Repair repair = repairService.getRepairById(repairId);
        model.addAttribute("repair", repair);
        return "/student/update";
    }

    /**
     * 修改报修单
     *
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/update", method = RequestMethod.POST)
    public String update(@PathVariable("repairId") int repairId, @RequestParam("detail") String detail, @RequestParam("place") String place,
                         @RequestParam("file") MultipartFile file, HttpServletRequest httpServletRequest) {

        String sno = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        int id = repairId;

        String picMD5 = "";

        logger.info(detail);
        logger.info(place);
        logger.info(picMD5);

        if (file != null) {
            try {
                picMD5 = MD5.getMD5(sno + String.valueOf(System.currentTimeMillis()) + file.getOriginalFilename());
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("*************************************************");
            }

            // 保存现场照片
            String path = httpServletRequest.getSession().getServletContext().getRealPath("/");
            System.out.println("图片路径:" + path);
        return "redirect:/student/dashboard";
    }

    /**
     * 修改报修单
     *
     * @param repairId
     * @param model
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/update", method = RequestMethod.GET)
    public String update(@PathVariable("repairId") int repairId, Model model) {
        Repair repair = repairService.getRepairById(repairId);
        model.addAttribute("repair", repair);
        return "/student/update";
    }

    /**
     * 修改报修单
     *
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/update", method = RequestMethod.POST)
    public String update(@PathVariable("repairId") int repairId, @RequestParam("detail") String detail, @RequestParam("place") String place,
                         @RequestParam("file") MultipartFile file, HttpServletRequest httpServletRequest) {

        String sno = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        int id = repairId;

        String picMD5 = "";

        logger.info(detail);
        logger.info(place);
        logger.info(picMD5);

        if (file != null) {
            try {
                picMD5 = MD5.getMD5(sno + String.valueOf(System.currentTimeMillis()) + file.getOriginalFilename());
            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("*************************************************");
            }

            // 保存现场照片
            String path = httpServletRequest.getSession().getServletContext().getRealPath("/");
            System.out.println("图片路径:" + path);
            String fileName = picMD5;
            File targetFile = new File(path, fileName);
            try {
                OutputStream outputStream = new FileOutputStream(targetFile);
            RepairInfoVo repairInfoVo = new RepairInfoVo(repair);
            repairInfoVo.setStatesInfo(RepairEnumCN.stateOf(repair.getStatus()).getStateInfo());
            repairInfoVos.add(repairInfoVo);
        }
        model.addAttribute("repairInfoVos", repairInfoVos);

        return "student/tobecanceled";

    }

    /**
     * 同意取消报修单
     *
     * @param repairId
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/tobecanceled/{repairId}/agree", method = RequestMethod.GET)
    public String agreeCanceled(@PathVariable("repairId") int repairId, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        Student student = studentService.getStudentByEmail(id);

        repairService.agreeToBeCanceled(repairId);

        return "redirect:/student/tobecanceled";
    }

    /**
     * 拒绝取消报修单
     *
     * @param repairId
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/tobecanceled/{repairId}/reject", method = RequestMethod.GET)
    public String rejectCanceled(@PathVariable("repairId") int repairId, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        repairService.rejectToBeCanceled(repairId);

        return "redirect:/student/tobecanceled";
    }

    /**
     * 获取个人信息的控制器
     *
        	waterInput = Double.parseDouble(water);
		} catch (NumberFormatException e) {
			waterInput = 0;
		}
        try {
        	PowerInput = Double.parseDouble(power);
		} catch (NumberFormatException e) {
			PowerInput = 0;
		}
        try {
        	waterDB = Double.parseDouble(door.getWater());
		} catch (NumberFormatException e) {
			waterDB = 0;
		}
        try {
        	powerDB = Double.parseDouble(door.getPower());
		} catch (NumberFormatException e) {
			powerDB = 0;
		}
        
        door.setWater( waterDB+waterInput+"");
        door.setPower( powerDB+PowerInput+"");
        door.setDate(new Date(System.currentTimeMillis()));
        doorDao.update(door);
        model.addAttribute("fee", door);
    	return "student/feelist";
    }
    

    /**
     * 修改其它资料
     *
     * @param name
     * @param phone
     * @param sexual
     * @param httpSession
     * @param httpServletResponse
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/changeinfo", method = RequestMethod.POST)
    public
    @ResponseBody
    LoginResult changeInfo(String name, String phone, String sexual, HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
        System.out.println("name:"+name+";phone:"+phone+";sexual:"+sexual);
        Student student = studentService.getStudentByEmail(id);
        return "student/urgent";
    }

    /**
     * 删除某条催单
     *
     * @param repairId
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/urgent/{repairId}/delete", method = RequestMethod.GET)
    public String deleteUrgent(@PathVariable("repairId") int repairId, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        Student student = studentService.getStudentById(id);

        urgentRepairService.deleteUrgentRepair(repairId);

        return "redirect:/student/urgent";
    }

    /**
     * 重新提交某条催单
     *
     * @param repairId
     * @return
     */
    @RequestMapping(value = "/urgent/{repairId}/resubmit", method = RequestMethod.GET)
    public String reSubmitUrgent(@PathVariable("repairId") int repairId) {

        urgentRepairService.reSubmit(repairId);

        return "redirect:/student/urgent";
    }

    /**
     * 获取所有待取消的报修单
     *
     * @param httpServletRequest
     * @param model
     * @return
     */
    @RequestMapping(value = "/tobecanceled", method = RequestMethod.GET)
    public String toBeCanceled(HttpServletRequest httpServletRequest, Model model) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();


        List<Technician> techniciens = technicianService.getAllTechnician();

        model.addAttribute("repair", repair);
        model.addAttribute("techniciens", techniciens);

        return "/admin/addArrange";
    }

    @RequestMapping(value = "/maintenance/{repairId}/add", method = RequestMethod.POST)
    public String submitArrange(@PathVariable("repairId") int repairId, @RequestParam("technicianId") String technicianId) {

        // 解决表单提交时乱码的问题(JSP在表单提交时默认采用ISO-8859-1编码)
        try {
            technicianId = new String(technicianId.getBytes("ISO-8859-1"), "utf8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        repairService.arrangeRepair(repairId, Integer.valueOf(technicianId));

        return "redirect:/admin/dashboard";
    }

    @RequestMapping(value = "/finish", method = RequestMethod.GET)
    public String finish(Model model) {
        List<Repair> repairs = repairService.getAllFinish();

        Student student;
        List<RepairInfoVo> repairInfoVos = new ArrayList<>();
        for(Repair repair: repairs){
            student = studentService.getStudentById(repair.getStudentId());
            RepairInfoVo repairInfoVo = new RepairInfoVo(student, repair);
            repairInfoVo.setStatesInfo(RepairEnumCN.stateOf(repair.getStatus()).getStateInfo());
            repairInfoVos.add(repairInfoVo);
        }
        model.addAttribute("repairInfoVos", repairInfoVos);

        return "/admin/finish";
    }

    @RequestMapping(value = "/urgent", method = RequestMethod.GET)
    public String urgent(Model model) {
    
    /**
     * 修改其它资料
     *
     * @param name
     * @param phone
     * @param sexual
     * @param httpSession
     * @param httpServletResponse
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/feelist", method = RequestMethod.GET)
    public String feelist( Model model, HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
        Student student = studentService.getStudentById(id);
        String doorName = student.getDoor();
        Door door = doorDao.queryByName(doorName);
        model.addAttribute("fee", door);
        return "student/feelist";
    }
    
    @RequestMapping(value = "/feeupload", method = RequestMethod.GET)
    public String feeupload(Model model,HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
    	String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
        Student student = studentService.getStudentById(id);
        String doorName = student.getDoor();
        Door door = doorDao.queryByName(doorName);
        model.addAttribute("feeup", door);
    	return "student/feeupload";
    }
    
    /**
     * 缴费
     * @param model
     * @param httpSession
     * @param httpServletResponse
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/uploadfee", method = RequestMethod.POST)
    public String uploadfee(String name, String water, String power,Model model,HttpSession httpSession, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) {
    	String id = null;
		try {
			id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();
		} catch (NullPointerException e1) {
			return "student/login";
		}
        Student student = studentService.getStudentById(id);
        String doorName = student.getDoor();
        Door door = doorDao.queryByName(doorName);
            );
        }

        model.addAttribute("list", maintenanceResults);

        return "/admin/arrange";
    }

    @RequestMapping(value = "/arrange/{maintenanceId}/cancel", method = RequestMethod.GET)
    public String cancelArrange(@PathVariable("maintenanceId") int maintenanceId) {
        Maintenance maintenance = maintenanceService.getById(maintenanceId);

        // 删除检修安排记录
        maintenanceService.cancelMaintenance(maintenanceId);

        // 同时也修改相应的维修单的状态
        repairService.unArrangeRepair(maintenance.getRepairId());

        return "redirect:/admin/arrange";
    }

    @RequestMapping(value = "/student", method = RequestMethod.GET)
    public String student(Model model) {
        List<Student> students = studentService.getAll();

        List<StudentResult> studentResults = new ArrayList<StudentResult>();

        for (Student student : students) {
            studentResults.add(new StudentResult(
                    student.getId(), student.getName(), student.getPassword(),
                    student.getSexual(), student.getSexual() == 0 ? "男" : "女",
                    student.getEmail(), student.getPhone(), student.getDoor())
            );
        }
        model.addAttribute("students", studentResults);

        return "admin/student";
    }

    @RequestMapping(value = "/addstudent", method = RequestMethod.GET)
    public String addStudent(Model model) {
        return "/admin/addStudent";
    }

    @RequestMapping(value = "/addstudent", method = RequestMethod.POST)
    public String addStudent(@RequestParam("name") String name, @RequestParam("email") String email,
                             @RequestParam("password") String password, @RequestParam("sexual") String sexual,
                             @RequestParam("phone") String phone,@RequestParam("door") String door, Model model, HttpServletRequest httpServletRequest) {

        int sex = sexual.equals("男") ? 0 : 1;
                loginResult = new LoginResult(true);

                httpServletRequest.getSession().setAttribute("ADMIN_ID", id);
                httpServletResponse.addCookie(new Cookie("ADMIN_ID", String.valueOf(id)));
            }else{
                loginResult = new LoginResult(false);
            }
        }

        if(!loginResult.isSuccess()){
            loginResult.setReason("invalid user");
        }

        logger.info("LoginResult:"+loginResult);
        return loginResult;
    }

    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    public String logout(HttpSession httpSession) {
        logger.info("退出要移除的sessionId是:"+httpSession.getId());
        httpSession.removeAttribute("ADMIN_ID");
        return "redirect:../student/login";
    }

    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
    public String dashboard(Model model, HttpServletRequest httpServletRequest) {
        List<Repair> repairs = repairService.getAllUnFinish();

        Student student;
        List<RepairInfoVo> repairInfoVos = new ArrayList<>();
        for(Repair repair:repairs){
            student = studentService.getStudentById(repair.getStudentId());
            RepairInfoVo repairInfoVo = new RepairInfoVo(student, repair);
            repairInfoVo.setStatesInfo(RepairEnumCN.stateOf(repair.getStatus()).getStateInfo());
            repairInfoVos.add(repairInfoVo);
        }

        model.addAttribute("repairInfoVos", repairInfoVos);

        return "/admin/dashboard";
    }

    @RequestMapping(value = "/repair/{repairId}/detail", method = RequestMethod.GET)
    public String detailRepair(@PathVariable("repairId") int repairId, Model model) {
        Repair repair;

        repair = repairService.getRepairById(repairId);
        repair.setPicMD5("/" + repair.getPicMD5());

        RepairInfoVo repairInfoVo = new RepairInfoVo(repair);
        repairInfoVo.setStatesInfo(RepairEnumCN.stateOf(repair.getStatus()).getStateInfo());

        model.addAttribute("repairInfoVo", repairInfoVo);
    @RequestMapping(value = "/repair/{repairId}/acceptance", method = RequestMethod.GET)
    public String acceptance(@PathVariable("repairId") int repairId) {
        repairService.Acceptance(repairId);
        return "redirect:/student/dashboard";
    }

    /**
     * 将报修单标记为催单
     *
     * @param repairId
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value = "/repair/{repairId}/urgent", method = RequestMethod.GET)
    public String urgent(@PathVariable("repairId") int repairId, HttpServletRequest httpServletRequest) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        Student student = studentService.getStudentById(id);

        urgentRepairService.submitUrgentRepair(repairId, student.getId());

        return "redirect:/student/urgent";
    }

    /**
     * 查看所有的催单
     *
     * @param httpServletRequest
     * @param model
     * @return
     */
    @RequestMapping(value = "/urgent", method = RequestMethod.GET)
    public String showUrgent(HttpServletRequest httpServletRequest, Model model) {
        String id = httpServletRequest.getSession().getAttribute(StudentConst.STUDENT_ID).toString();

        Student student = studentService.getStudentById(id);

        List<UrgentRepair> urgentRepairs = urgentRepairService.getAllUrgentRepairByStudentId(student.getId());

        List<StudentUrgentResult> studentUrgentResults = new ArrayList<StudentUrgentResult>();

        String detail = "";
        for (UrgentRepair urgentRepair : urgentRepairs) {
            detail = repairService.getRepairById(urgentRepair.getRepairId()).getDetail();
            studentUrgentResults.add(new StudentUrgentResult(
                    urgentRepair.getId(), urgentRepair.getStatus(), UrgentRepairEnum.stateOf(urgentRepair.getStatus()).getStateInfo(),
                    urgentRepair.getRepairId(), detail, urgentRepair.getStudentId(), urgentRepair.getCreateTime()));
        }
        model.addAttribute("studentUrgentResults", studentUrgentResults);

请添加图片描述

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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值