源码获取:博客首页 "资源" 里下载!
本项目为后管系统,分为管理员、业主两种角色;
管理员主要功能为:
社区核心业务处理:车位收费管理、物业收费管理、投诉信息管理、报修信息管理
基础信息管理:楼宇管理、房屋管理、业主管理、车位管理、抄表管理、登录信息管理、修改密码
基础类型管理:投诉类型管理、收费类型管理、报修类型管理
数据统计:报修统计
业主主要功能为:
车位费查询、物业费查询、我的投诉列表、我的报修列表、修改密码等;
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 8.0版本;
6.是否Maven项目:是;
1. 后端:SpringBoot+Mybatis
2. 前端:HTML+CSS+JavaScript+LayUI
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,访问地址:http://localhost:8888
管理员账号/密码:admin/123456
业主账号/密码:kappy/123456
业主账号可通过管理员在业主管理模块进行添加,默认密码为123456
@Controller
public class UserController {
@Autowired
@Qualifier("pmsService")
private PmsService pmsService;
@RequestMapping(value="/login")
public String login(@ModelAttribute("user") User user1, String userId,String password,Model model,HttpSession session) {
User user =pmsService.login(userId, password);
if(user!=null) {
session.setAttribute("user",user);
if(user.getRoleType()==0) {
return "manager/userMg";
}
else return "user/user_login";
}
else {
model.addAttribute("errorMessage", "登录失败,请重新登录");
return "user/user_login";
}
}
@RequestMapping(value="/change")
public String change(@RequestParam("password")String password,@RequestParam("phone")String phone,Model model,HttpSession session) {
User user=(User)(session.getAttribute("user"));
String userId=user.getUserId();
System.out.println(userId);
System.out.println(password);
System.out.println(phone);
pmsService.change(password,phone,userId);
model.addAttribute("errorMessage", "修改成功,请重新登录");
user=null;
session.setAttribute("user", user);
return "user/user_login";
}
@RequestMapping(value= {"/","/index"})
public String fist(Model model) {
return "user/user_login";
}
@RequestMapping(value="/signout")
public String logout(HttpSession session,Model model) {
User user=null;
session.setAttribute("user", user);
return "user/user_login";
}
@RequestMapping(value="/user/user-list")
public void selectUser(
HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String key = request.getParameter("key");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String roleTypeStr = request.getParameter("roleType");
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int roleType = Integer.valueOf(roleTypeStr);
User user = new User();
user.setUserName(key);
user.setRoleType(roleType);
PageVO page = pmsService.listUser(user, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/user/addUser")
public void addUser(@ModelAttribute("user") User user){
if(user.getSexId() == 0) {
user.setSex("男");
}
else {
user.setSex("女");
}
user.setRoleType(user.getTypeId());
pmsService.addUser(user);
System.out.println("add user :"+ user.getUserId());
user = null;
}
@RequestMapping(value="/user/updateUser")
public void updateUser(@ModelAttribute("user") User user){
//User user = new User();
if(user.getSexId() == 0) {
user.setSex("男");
}
else {
user.setSex("女");
}
user.setRoleType(user.getTypeId());
pmsService.modifyUser(user);
System.out.println("modify user :"+ user.getUserName());
System.out.println("modify user :"+ user.getUserId());
System.out.println("modify user :"+ user.getPassword());
}
@RequestMapping(value="/user/deleteUser")
public void deleteUser(@RequestBody User user, HttpServletResponse response){
String userId = user.getUserId();
pmsService.removeUserById(userId);
System.out.println("delete user :"+ userId);
}
@RequestMapping(value="/user/loadEditUser")
@ResponseBody
public Object loadEditUser(@RequestParam(value="name",required=false) String name){
User user = new User();
user = pmsService.findUserById(name);
System.out.println("load user :"+ user.getUserName());
return user;
}
@RequestMapping(value= {"/userMg"})
public String userMg(@ModelAttribute("user") User user) {
return "manager/userMg";
}
//关于我们
@RequestMapping(value="/info")
public String about() {
return "user/about";
}
}
@Controller
public class RepairController {
@Autowired
@Qualifier("pmsService")
private PmsService pmsService;
@RequestMapping(value= {"/repairMg"})
public String repairMg(@ModelAttribute("repair") Repair repair) {
return "manager/repairMg";
}
@RequestMapping(value="/manager/repair-list")
public void selectRepair(
HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String key = request.getParameter("key");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String repairState1 = request.getParameter("repairState");
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int repairState = Integer.valueOf(repairState1);
Repair repair = new Repair();
repair.setUserId(key);
repair.setRepairState(repairState);
PageVO page = pmsService.listRepair(repair, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/manager/updateRepair")
public void updateRepair(@ModelAttribute("repair") Repair repair){
repair.setRepairState(repair.getTypeId());
pmsService.modifyRepair(repair);
System.out.println("modify Repair :"+ repair.getRepairId());
}
@RequestMapping(value="/manager/deleteRepair")
public void deleteRepair(@RequestBody Repair repair, HttpServletResponse response){
int repairId = repair.getRepairId();
pmsService.removeRepair(repairId);
System.out.println("delete Repair :"+ repairId);
}
@RequestMapping(value="/manager/loadEditRepair")
@ResponseBody
public Object loadEditRepair(@RequestParam(value="repairId",required=false) String repairId){
int repairId1 = Integer.valueOf(repairId);
Repair repair = new Repair();
repair = pmsService.findRepair(repairId1);
System.out.println("load Repair :"+ repairId);
return repair;
}
@RequestMapping(value="repair")
public String repair(Model model) {
return "user/repair";
}
@RequestMapping(value="user/repair-list")
public void selectAdvice(HttpServletRequest request, HttpServletResponse response, HttpSession session)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
User user = (User) session.getAttribute("user");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String repairState = request.getParameter("repairState");
String beginDate = request.getParameter("beginDate");
String endDate = request.getParameter("endDate");
System.out.println(beginDate);
System.out.println(endDate);
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int reState = Integer.valueOf(repairState);
Repair repair =new Repair();
repair.setUserId(user.getUserId());
repair.setRepairState(reState);
PageVO page = pmsService.listRepair(repair, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/user/addRepair")
public void addRepair(HttpServletRequest request, HttpServletResponse response, HttpSession session,
@ModelAttribute("repair") Repair repair) throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String buildingNum = request.getParameter("buildingNum");
String roomNum = request.getParameter("roomNum");
Date date = (Date) new Timestamp(System.currentTimeMillis());
User user = (User) session.getAttribute("user");
String userId = user.getUserId();
int bdNum = Integer.valueOf(buildingNum);
int rmNum = Integer.valueOf(roomNum);
repair.setUserId(userId);
repair.setRepairDate(date);
repair.setBuildingNum(bdNum);
repair.setRoomNum(rmNum);
repair.setRepairState(0);
pmsService.addRepair(repair);
}
@RequestMapping(value="/user/loadRepair")
@ResponseBody
public Object loadAdvice(@RequestParam(value="repairId",required=false) String repairId){
int id = Integer.valueOf(repairId);
Repair repair = new Repair();
repair = pmsService.selectRepairByIdUser(id);
return repair;
}
}
@Controller
public class ConsumeController {
@Autowired
@Qualifier("pmsService")
private PmsService pmsService;
@RequestMapping(value= {"/consumeMg"})
public String consumeMg(@ModelAttribute("consume") Consume consume) {
return "manager/consumeMg";
}
@RequestMapping(value="/manager/consume-list")
public void selectConsume(
HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String key = request.getParameter("key");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String consumeType1 = request.getParameter("consumeType");
String consumeState1 = request.getParameter("consumeState");
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
int consumeType = Integer.valueOf(consumeType1);
int consumeState = Integer.valueOf(consumeState1);
Consume consume = new Consume();
consume.setUserId(key);
consume.setConsumeState(consumeState);
consume.setConsumeType(consumeType);
System.out.println(consume.getConsumeState());
PageVO page = pmsService.listConsume(consume, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/manager/addConsume")
public void addConsume(@ModelAttribute("consume") Consume consume){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = consume.getDate()+ " 00:00:00";
Date date = Timestamp.valueOf(dateStr);
consume.setConsumeDate(date);
System.out.println("add consume :"+ consume.getUserId());
consume.setConsumeType(consume.getTypeId());
consume.setCreateDate(new Timestamp(System.currentTimeMillis()));
consume.setPrice(consume.getCount() * consume.getUnitPrice());
consume.setConsumeState(0);
pmsService.addConsume(consume);
}
@RequestMapping(value="/pay")
public String pay() {
return "user/pay";
}
@RequestMapping(value="/list_consume")
public void selectConsume(
HttpServletRequest request, HttpServletResponse response,HttpSession session)throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
String pageNoStr = request.getParameter("pageNo");
String rowMaxStr = request.getParameter("rowMax");
String consumeType = request.getParameter("consumeType");
int pageNo = Integer.valueOf(pageNoStr);
int rowMax = Integer.valueOf(rowMaxStr);
String select=request.getParameter("select");
User user=(User)session.getAttribute("user");
Map map=new HashMap<>();
String calendar=request.getParameter("calendar");
String calendar1=request.getParameter("calendar1");
map.put("calendar", calendar);
map.put("calendar1", calendar1);
System.out.println(calendar+"9");
System.out.println(calendar1+"10");
map.put("consumeType", consumeType);
map.put("user", user);
map.put("select", select);
PageVO page = pmsService.listConsumeUser(map, pageNo, rowMax);
response.reset();
response.setContentType("text/plain;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(page));
response.flushBuffer();
}
@RequestMapping(value="/payconsume")
public void payconsume(HttpServletRequest request, HttpServletResponse response) {
String[] list = request.getParameterValues("list");
for (String item : list) {
int consumeId=Integer.valueOf(item);
pmsService.payOneItem(consumeId);
}
}
}
源码获取:博客首页 "资源" 里下载!