项目编号:BS-XX-006
本系统基于SSM实现后勤报修管理功能,前端采用DIV+CSS布局处理,采用异步请求AJAX发送请求和接受消息,数据库采用MYSQL,开发工具使用IDEA或ECLIPSE,提供基于MAVEN和非MAVEN两种版本供使用。
主要包含三个角色:
- 管理员角色:admin / 123456 主要可以管理用户信息,报修分配维修人员,发布公告,维修类型管理,个人资料修改等功能
- 普通用户:loguser / 123456 主要可以进行宿舍问题报修,查询报修记录,对报修结果进行评价,查看公告,修改个人资料等功能
- 维护人员:repair / 123456 主要可以查看分配的维护记录,对维护的结果进行处理,维护个人记录等相关功能
部分功能展示如下:
一,管理员登陆
- 报修系统首页:可以根据时间和状态进行搜索报修记录
2. 用户登陆注册
3.维护分类管理
4.发布公告
5.用户管理
6,管理分配报修单
7,个人资料修改
二,普通用户登陆
- 新增报修
- 查看自己报修历史并修改报修单
3.查看报修信息和公告信息等操作
4,对维护结果进行评分操作
三,维护人员登陆
- 查看维修记录并修改报修状态
2.修改个人资料
本系统功能完整,运行无误,界面简洁大方,适合做毕业设计或课程设计使用。
部分核心代码:
package com.logistics.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.logistics.service.IndexService;
import com.logistics.common.utils.exception.ServiceException;
import com.logistics.common.utils.response.Res;
@Controller
@RequestMapping("/index")
public class IndexController {
@Autowired
private IndexService indexService;
@ResponseBody
@RequestMapping("/getIndexInfo")
public ModelAndView addPlacard(@RequestParam(value = "title", required = false, defaultValue = "") String title,
@RequestParam(value = "status", required = false, defaultValue = "") String status,
@RequestParam(value = "timeRange", required = false, defaultValue = "") String timeRange,
@RequestParam(value = "pageNo", required = false, defaultValue = "") Integer pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "") Integer pageSize,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
res = indexService.getIndexInfo();
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
}
package com.logistics.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.logistics.persistence.model.User;
import com.logistics.service.UserService;
import com.logistics.common.utils.exception.ServiceException;
import com.logistics.common.utils.response.Res;
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
/**
* 用户登录接口
*
* @param userName
* @param password
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/login")
public ModelAndView login(@RequestParam(value = "userName", required = false) String userName,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "rememberMe", required = false) String rememberMe,
@RequestParam(value = "directPage", required = false) String directPage,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.login(userName, password, rememberMe, request, response);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 判断是否登录
* @param directPage
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/checkLogin")
public ModelAndView isLogin(
@RequestParam(value = "directPage", required = false) String directPage,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
User user = userService.getUser(request, response);
if(user==null){
throw new ServiceException("未登录");
}
res.addRespose("isLogin", 1);
res.addRespose("groupId", user.getGroupId());
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
@ResponseBody
@RequestMapping("/logout")
public ModelAndView logout(
@RequestParam(value = "directPage", required = false) String directPage,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.logout(request, response);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 用户注册接口
* @param userName
* @param password
* @param password2
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/singIn")
public ModelAndView singIn(
@RequestParam(value = "userName", required = false) String userName,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "password2", required = false) String password2,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.singIn(userName,password,password2, request, response);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 修改密码
* @param password
* @param password2
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/changePassword")
public ModelAndView changePassword(
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "password2", required = false) String password2,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
Long userId = userService.getUser(request, response).getUsrId();
res = userService.changePassword(userId,password,password2);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 获取维修人员列表
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/getRepairManList")
public ModelAndView getRepairManList(
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.getRepairManList();
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
*
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/getAllUserList")
public ModelAndView getAllUserList(
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.getAllUserList();
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
@ResponseBody
@RequestMapping("/addUser")
public ModelAndView addUser(
@RequestParam(value = "userName", required = false) String userName,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "usrMobile", required = false) String usrMobile,
@RequestParam(value = "address", required = false) String address,
@RequestParam(value = "groupId", required = false) String groupId,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.addUser(userName,password, usrMobile, groupId,address);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
@ResponseBody
@RequestMapping("/removeUser")
public ModelAndView removeUser(
@RequestParam(value = "userId", required = false) String userId,
HttpServletRequest request,HttpServletResponse response) {
Res res = new Res();
try {
res = userService.removeUser(userId);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
}
package com.logistics.controller;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.logistics.persistence.model.User;
import com.logistics.service.RepairOrderService;
import com.logistics.service.UserService;
import com.logistics.common.Page;
import com.logistics.common.utils.exception.ServiceException;
import com.logistics.common.utils.response.Res;
@Controller
@RequestMapping("/repairOrder")
public class RepairOrderController {
@Autowired
private RepairOrderService repairOrderService;
@Autowired
private UserService userService;
/**
* 添加维修单
*
* @param title
* @param des
* @param phone
* @param address
* @param categoryId
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/addOrder")
public ModelAndView addOrder(@RequestParam(value = "title", required = false, defaultValue = "") String title,
@RequestParam(value = "des", required = false, defaultValue = "") String des,
@RequestParam(value = "phone", required = false, defaultValue = "") String phone,
@RequestParam(value = "address", required = false, defaultValue = "") String address,
@RequestParam(value = "categoryId", required = false, defaultValue = "") String categoryId,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
User user = userService.getUser(request, response);
res = repairOrderService.addOrder(title, des, phone, address, categoryId,user.getUsrId());
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
@ResponseBody
@RequestMapping("/getOrder")
public ModelAndView getOrder(
@RequestParam(value = "orderId", required = false, defaultValue = "") String orderId,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
res = repairOrderService.getOrder(orderId);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
//确认完成
@ResponseBody
@RequestMapping("/completeOrder")
public ModelAndView completeOrder(
@RequestParam(value = "orderId", required = false, defaultValue = "") String orderId,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
User user = userService.getUser(request, response);
res = repairOrderService.completeOrder(orderId,user.getUsrId());
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 修改维修单
*
* @param orderId
* @param title
* @param des
* @param phone
* @param address
* @param categoryId
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/updateOrder")
public ModelAndView updateOrder(
@RequestParam(value = "orderId", required = false, defaultValue = "") String orderId,
@RequestParam(value = "title", required = false, defaultValue = "") String title,
@RequestParam(value = "des", required = false, defaultValue = "") String des,
@RequestParam(value = "phone", required = false, defaultValue = "") String phone,
@RequestParam(value = "address", required = false, defaultValue = "") String address,
@RequestParam(value = "categoryId", required = false, defaultValue = "") String categoryId,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
res = repairOrderService.updateOrder(orderId, title, des, phone, address, categoryId);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 查询所有维修单
*
* @param name
* @param model
* @return
*/
@ResponseBody
@RequestMapping("/queryRepairOrderList")
public ModelAndView queryRepairOrderList(
@RequestParam(value = "title", required = false, defaultValue = "") String title,
@RequestParam(value = "status", required = false, defaultValue = "") String status,
@RequestParam(value = "timeRange", required = false, defaultValue = "") String timeRange,
@RequestParam(value = "pageNo", required = false, defaultValue = "") Integer pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "") Integer pageSize,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
Page page = new Page();
page.setPageNo(pageNo == null ? 0 : pageNo);
page.setPageSize(pageSize == null ? page.getPageSize() : pageSize);
res = repairOrderService.queryRepairOrderList(title, status, timeRange, page);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 查询个人维修单
*
* @param title
* @param status
* @param timeRange
* @param pageNo
* @param pageSize
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/getMyRepairOrderList")
public ModelAndView getMyRepairOrderList(HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
User user = userService.getUser(request, response);
res = repairOrderService.getMyRepairOrderList(user);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 获取我维修的订单
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/getMyTaskOrder")
public ModelAndView getMyTaskOrder(HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
User user = userService.getUser(request, response);
res = repairOrderService.getMyTaskOrder(user);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 评价订单
* @param orderId
* @param star
* @param comment
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping("/commentOrder")
public ModelAndView commentOrder(
@RequestParam(value = "orderId", required = false, defaultValue = "") String orderId,
@RequestParam(value = "star", required = false, defaultValue = "") String star,
@RequestParam(value = "comment", required = false, defaultValue = "") String comment,
HttpServletRequest request, HttpServletResponse response) {
Res res = new Res();
try {
User user = userService.getUser(request, response);
res = repairOrderService.commentOrder(orderId,star,comment,user);
} catch (ServiceException e) {
e.printStackTrace();
res.addError(Res.MESSAGE_NAME_ERROR, e.getMessage());
}
return res.toView(response);
}
/**
* 测试接口
*
* @param name
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping("/hello")
public ModelAndView hello(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
Model model, HttpServletRequest request, HttpServletResponse response) {
model.addAttribute("name", name);
try {
if (name == null) {
name = "";
}
response.getWriter().write("<h1>Hello " + name + "</h1>");
} catch (IOException e) {
}
return null;
}
}