基于javaweb+mysql的springboot物业管理系统(java+springboot+layui+html+maven+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot物业管理系统(java+springboot+layui+html+maven+mysql)
项目介绍
本项目为后管系统,分为管理员、业主两种角色; 管理员主要功能为: 社区核心业务处理:车位收费管理、物业收费管理、投诉信息管理、报修信息管理 基础信息管理:楼宇管理、房屋管理、业主管理、车位管理、抄表管理、登录信息管理、修改密码 基础类型管理:投诉类型管理、收费类型管理、报修类型管理 数据统计:报修统计 业主主要功能为: 车位费查询、物业费查询、我的投诉列表、我的报修列表、修改密码等;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 8.0版本;
技术栈
-
后端:SpringBoot+Mybatis
-
前端:HTML+CSS+JavaScript+LayUI
使用说明
运行项目,访问地址:http://localhost:8888
管理员账号/密码:admin/123456
业主账号/密码:kappy/123456
业主账号可通过管理员在业主管理模块进行添加,默认密码为123456
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/carcharge")
public class CarchargeController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private ICarchargeService carchargeService;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/propertyinfo")
public class PropertyInfoController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IPropertyInfoService propertyInfoService;
@Resource
private IHouseService houseService;
@Resource
private IOwnerService ownerService;
@Resource
private IPropertyTypeService propertyTypeService;
@RequestMapping("/queryPropertyAll")
public JsonObject queryPropertyAll(PropertyInfo propertyInfo, String numbers,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
if(numbers!=null){
House house=new House();
house.setNumbers(numbers);
propertyInfo.setHouse(house);
}
PageInfo<PropertyInfo> pageInfo=propertyInfoService.findPropertyInfoAll(page,limit,propertyInfo);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryPropertyAll2")
public JsonObject queryPropertyAll2(PropertyInfo propertyInfo, HttpServletRequest request,
@RequestParam(defaultValue = "1") Integer page,
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/parking")
public class ParkingController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IParkingService parkingService;
@RequestMapping("/queryParkAll")
public JsonObject queryParkAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
String numbers){
PageInfo<Parking> pageInfo= parkingService.findParkAll(page,limit,numbers);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@ApiOperation(value = "新增")
@RequestMapping("/add")
public R add(@RequestBody Parking parking){
if(parking.getOwnerId()!=null){//关联到了户主
parking.setStatus(1);
}else{
parking.setStatus(0);
}
int num= parkingService.add(parking);
if(num>0){
return R.ok();
}else{
return R.fail("添加失败");
}
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
Integer userId=owner.getId();
carcharge.setOwnerId(userId);
PageInfo<Carcharge> pageInfo=carchargeService.findCarchargeAll(page,limit,carcharge);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@ApiOperation(value = "新增")
@RequestMapping("/initData")
public R InitData(@RequestBody Carcharge carcharge){
/**
* 遍历所有得已在使用得车位信息
*/
List<Parking> parkingList=parkingService.queryParkingByStatus();
for(Parking park:parkingList){
carcharge.setStatus(0);
carcharge.setOwnerId(park.getOwnerId());
carcharge.setType("停车费");
carcharge.setParkId(park.getId());
carchargeService.add(carcharge);
}
return R.ok();
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=new Long(id);
carchargeService.delete(idLong);
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/building")
public class BuildingController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IBuildingService buildingService;
@RequestMapping("/queryBuildAll")
public JsonObject queryBuildAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
String numbers){
JsonObject object=new JsonObject();
PageInfo<Building> pageInfo= buildingService.findBuildAll(page,limit,numbers);
object.setCode(0);
object.setMsg("ok");
object.setCount(pageInfo.getTotal());
object.setData(pageInfo.getList());
return R.fail("两次密码不一致");
}
}
@ApiOperation(value = "更新")
@RequestMapping("/reset")
public R reset(Integer id){
//根据id获取当前的数据记录
//System.out.println(id);
Userinfo user=userinfoService.findById(new Long(id));
user.setPassword("123456");
userinfoService.updateData(user);
return R.ok();
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Userinfo> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return userinfoService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Userinfo findById(@PathVariable Long id){
return userinfoService.findById(id);
}
}
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/userinfo")
public class UserinfoController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IUserinfoService userinfoService;
@RequestMapping("/queryUserInfoAll")
public JsonObject queryUserInfoAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
Userinfo userinfo){
JsonObject object=new JsonObject();
PageInfo<Userinfo> pageInfo= userinfoService.findUserinfoAll(page,limit,userinfo);
object.setCode(0);
object.setMsg("ok");
object.setCount(pageInfo.getTotal());
object.setData(pageInfo.getList());
return object;
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
})
@GetMapping()
public IPage<House> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return houseService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public House findById(@PathVariable Long id){
return houseService.findById(id);
}
}
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/notice")
public class NoticeController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private INoticeService noticeService;
@ApiOperation(value = "新增")
@PostMapping()
public int add(@RequestBody Notice notice){
return noticeService.add(notice);
// })
// @GetMapping()
// public IPage<Building> findListByPage(@RequestParam Integer page,
// @RequestParam Integer pageCount){
// return buildingService.findListByPage(page, pageCount);
// }
//
// @ApiOperation(value = "id查询")
// @GetMapping("{id}")
// public Building findById(@PathVariable Long id){
// return buildingService.findById(id);
// }
}
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/propertyinfo")
public class PropertyInfoController {
private Logger log = LoggerFactory.getLogger(getClass());
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/propertyType")
public class PropertyTypeController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IPropertyTypeService propertyTypeService;
@RequestMapping("/queryAll")
public List<PropertyType> queryList(){
List<PropertyType> list= propertyTypeService.findAll();
return list;
}
@RequestMapping("/queryAll1")
public JsonObject queryAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
String numbers){
IPage<PropertyType> pageInfo= propertyTypeService.findListByPage(page,limit);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getRecords());
}
@ApiOperation(value = "新增")
@PostMapping()
public int add(@RequestBody PropertyType propertyType){
return propertyTypeService.add(propertyType);
}
@ApiOperation(value = "新增")
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(@RequestBody Parking parking){
Parking park=new Parking();
if(parking.getOwnerId()!=null){//关联到了户主
park.setStatus(1);
}else{
park.setStatus(0);
}
park.setId(parking.getId());
park.setNumbers(parking.getNumbers());
park.setRemarks(parking.getRemarks());
park.setOwnerId(parking.getOwnerId());
int num= parkingService.updateData(park);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Parking> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return parkingService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Parking findById(@PathVariable Long id){
return parkingService.findById(id);
}
}
@ApiOperation(value = "更新")
@RequestMapping("/update1")
public R update1(@RequestBody Complaint complaint){
//System.out.println(repair.getComId());
int num=complaintService .updateData(complaint);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Complaint> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return complaintService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Complaint findById(@PathVariable Long id){
return complaintService.findById(id);
}
}
}
}
/**
* 退出功能
*/
@RequestMapping("/loginOut")
public void loginOut(HttpServletRequest request, HttpServletResponse response) throws IOException {
HttpSession session=request.getSession();
session.invalidate();
response.sendRedirect(request.getContextPath()+"/login.html");
}
}
public class LoginInterceptor implements HandlerInterceptor {
/**
* 请求之前进行得调用
* @param request
* @param response
* @param handler
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
if(userinfo!=null){//放行
return true;
}
//如果没有登录就跳转到登录页面
response.sendRedirect(request.getContextPath()+"/login.html");
return false;
}
/**
* 请求处理之后调用 但是再视频被渲染之前
* @param request
* @param response
@GetMapping()
public IPage<PropertyInfo> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return propertyInfoService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public PropertyInfo findById(@PathVariable Long id){
return propertyInfoService.findById(id);
}
}
/**
* <p>
* 前端控制器
}
@RequestMapping("/deleteByIds")
@Transactional(rollbackFor = {RuntimeException.class,Error.class})
public R deleteByIds(String ids){
//把字符串转list集合
List<String> list=Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=Long.parseLong(id);
//根据id获取对应的记录信息获取登记时间以及房子id
Records records=recordsService.findById(idLong);
//获取房子id
Integer houId=records.getHouseId();
//获取时间
Date onTime=records.getOnTime();
//删除登记表记录信息
recordsService.delete(idLong);
//物业收费信息表相关信息
propertyInfoService.deleteInfoByHouIdAndTime(houId ,onTime);
}
return R.ok();
}
//
// @ApiOperation(value = "更新")
// @RequestMapping("/update")
// public R update(@RequestBody Building building){
// int num=buildingService.updateData(building);
// if(num>0){
// return R.ok("修改成功",null);
// }else{
// return R.fail("修改失败");
// }
// }
//
// @ApiOperation(value = "查询分页数据")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "page", value = "页码"),
// @ApiImplicitParam(name = "pageCount", value = "每页条数")
// })
// @GetMapping()
// public IPage<Building> findListByPage(@RequestParam Integer page,
// @RequestParam Integer pageCount){
// return buildingService.findListByPage(page, pageCount);
// }
String numbers){
IPage<PropertyType> pageInfo= propertyTypeService.findListByPage(page,limit);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getRecords());
}
@ApiOperation(value = "新增")
@PostMapping()
public int add(@RequestBody PropertyType propertyType){
return propertyTypeService.add(propertyType);
}
@ApiOperation(value = "新增")
@RequestMapping("/addChargeType")
public R add1(@RequestBody PropertyType propertyType){
int num= propertyTypeService.add(propertyType);
if(num>0){
return R.ok();
}else{
return R.fail("添加失败");
}
}
@ApiOperation(value = "删除")
@DeleteMapping("{id}")
public int delete(@PathVariable("id") Long id){
return propertyTypeService.delete(id);
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteId")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
propertyTypeService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "更新")
@PutMapping()
public int update(@RequestBody PropertyType propertyType){
return propertyTypeService.updateData(propertyType);
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update1(@RequestBody PropertyType propertyType){
int num= propertyTypeService.updateData(propertyType);
if(num>0){
repair1.setRemarks(repair.getRemarks());
repair1.setClr(repair.getClr());
repair1.setOwnerId(owner.getId());
repair1.setStatus(Integer.valueOf(0));
repair1.setComDate(new Date());
repair1.setComId(repair.getComId());
//repair1.setOwner(owner);
//repair1.setType(repairtype);
int num=repairService.add(repair1);
if(num>0){
return R.ok();
}
return R.fail("失败啦");
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(Integer id){
Repair repair=new Repair();
repair.setId(id);
repair.setStatus(1);
repair.setHandleDate(new Date());
int num=repairService.updateData(repair);
return R.ok();
}
/**
* 统计分析
*/
@RequestMapping("/queryTongJi")
public List<Tongji> queryTongji(){
return repairService.queryTongji();
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteId")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
repairtypeService.delete(Long.parseLong(id));
}
return R.ok();
}
propertyInfo.setStatus(0);
propertyInfo.setTypeId(1);
propertyInfoService.add(propertyInfo);
}
}
return R.ok();
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=new Long(id);
propertyInfoService.delete(idLong);
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(Integer id){
PropertyInfo propertyInfo =new PropertyInfo();
propertyInfo.setId(id);
propertyInfo.setStatus(1);
int num=propertyInfoService.updateData(propertyInfo);
if(num>0){
return R.ok();
}
return R.fail("失败");
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<PropertyInfo> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return propertyInfoService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public PropertyInfo findById(@PathVariable Long id){
return propertyInfoService.findById(id);