基于javaweb+mysql的springboot小区物业管理系统(java+springboot+html+layui+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot小区物业管理系统(java+springboot+html+layui+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 8.0版本;
6.是否Maven项目:是;
技术栈
-
后端:SpringBoot+Mybatis
-
前端:HTML+CSS+JavaScript+LayUI
使用说明
- 使用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
PageInfo<Complaint> pageInfo=complaintService.findComplaintAll(page,limit,complaint);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryComplaintAll2")
public JsonObject queryComplaintAll2(Complaint complaint, HttpServletRequest request,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
//获取当前得登录用户
Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
String username=userinfo.getUsername();
//根据username获取登录账号得业主id
Owner owner=ownerService.queryOwnerByName(username);
complaint.setOwnerId(owner.getId());
PageInfo<Complaint> pageInfo=complaintService.findComplaintAll(page,limit,complaint);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@ApiOperation(value = "新增")
@RequestMapping(value = "/add",method = RequestMethod.GET)
public R add( Complaint complaint,HttpServletRequest request)
{
//获取当前得登录用户
Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
String username=userinfo.getUsername();
//根据username获取登录账号得业主id
Owner owner=ownerService.queryOwnerByName(username);
complaint.setOwnerId(owner.getId());
complaint.setStatus(0);
complaint.setComDate(new Date());
int num=complaintService.add(complaint);
if(num>0){
return R.ok();
}
return R.fail("失败啦");
}
@ApiOperation(value = "删除")
/**
*/
@Api(tags = {""})
@RestController
@RequestMapping("/owner")
public class OwnerController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IOwnerService ownerService;
@Resource
private IUserinfoService userinfoService;
@RequestMapping("/queryOwnerAll")
public JsonObject queryOwnerAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
Owner owner){
PageInfo<Owner> pageInfo= ownerService.findOwnerAll(page,limit,owner);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryAll")
@Transactional
public List queryAll(){
PageInfo<Owner> pageInfo= ownerService.findOwnerAll(1,100,null);
return pageInfo.getList();
}
@ApiOperation(value = "新增")
@RequestMapping("/add")
public R add(@RequestBody Owner owner){
//md5加密
// String md5Password = DigestUtils.md5DigestAsHex("123456".getBytes());
owner.setPassword("123456");//默认密码123456
String username=userinfo.getUsername();
//根据username获取登录账号得业主id
Owner owner=ownerService.queryOwnerByName(username);
Repair repair1=new Repair();
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));
}
/**
* <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");
* @param page
* @param limit
* @param recordVo
* @return
*/
@RequestMapping("/queryRecordsAll")
public JsonObject queryRecordsAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
RecordVo recordVo){
JsonObject jsonObject=new JsonObject();
PageInfo <RecordVo> pageInfo=recordsService.findRecordsAll(page,limit,recordVo);
jsonObject.setCode(0);
jsonObject.setCount(pageInfo.getTotal());
jsonObject.setMsg("ok");
jsonObject.setData(pageInfo.getList());
return jsonObject;
}
/**
* 抄表的添加工作
*/
@RequestMapping("/add")
@Transactional(rollbackFor = {RuntimeException.class,Error.class})
public R add(@RequestBody Records records){
/*
步骤:
1、添加抄表记录信息
1.1 根据记录中的房子和类型查询上次抄表的度数以及相关时间信息
如果存在,需要获取上次的度数,上次时间
如果不存在 上次度数设置为0 上次时间使用本次时间
1.2 添加记录信息
2、添加物业收费信息
2.1 获取 上次到这次之间的度数信息
2.2 根据收费类型查询收费标准
2.3 用1的度数×2的的收费标准 获取相关费用
2.4 并设定为未缴费状态
2.5 添加工作
*/
//根据参数房子id和类型id 获取最后一次登记信息
Integer houId=records.getHouseId();
Integer typeId=records.getTypeId();
//获取最后一次记录信息
Records rec=recordsService.queryByHouIdAndTypeId(houId,typeId);
@RequestMapping("/queryRecordsAll")
public JsonObject queryRecordsAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
RecordVo recordVo){
JsonObject jsonObject=new JsonObject();
PageInfo <RecordVo> pageInfo=recordsService.findRecordsAll(page,limit,recordVo);
jsonObject.setCode(0);
jsonObject.setCount(pageInfo.getTotal());
jsonObject.setMsg("ok");
jsonObject.setData(pageInfo.getList());
return jsonObject;
}
/**
* 抄表的添加工作
*/
@RequestMapping("/add")
@Transactional(rollbackFor = {RuntimeException.class,Error.class})
public R add(@RequestBody Records records){
/*
步骤:
1、添加抄表记录信息
1.1 根据记录中的房子和类型查询上次抄表的度数以及相关时间信息
如果存在,需要获取上次的度数,上次时间
如果不存在 上次度数设置为0 上次时间使用本次时间
1.2 添加记录信息
2、添加物业收费信息
2.1 获取 上次到这次之间的度数信息
2.2 根据收费类型查询收费标准
2.3 用1的度数×2的的收费标准 获取相关费用
2.4 并设定为未缴费状态
2.5 添加工作
*/
//根据参数房子id和类型id 获取最后一次登记信息
Integer houId=records.getHouseId();
Integer typeId=records.getTypeId();
//获取最后一次记录信息
Records rec=recordsService.queryByHouIdAndTypeId(houId,typeId);
if(rec!=null){
//获取上次表的度数 上次抄表时间
records.setUpTime(rec.getOnTime());
records.setNum(rec.getNum2());
}else{
records.setUpTime(records.getOnTime());
records.setNum(0.0);
}
//添加记录信息到数据库
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();
}
@ApiOperation(value = "更新")
@RequestMapping("/update1")
public R update1(@RequestBody Repair repair){
//System.out.println(repair.getComId());
int num=repairService .updateData(repair);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
* </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 = "新增")
@RequestMapping("/addChargeType")
public R add1(@RequestBody PropertyType propertyType){
int num= propertyTypeService.add(propertyType);
if(num>0){
return R.ok();
}else{
return R.fail("添加失败");
}
}
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/carcharge")
public class CarchargeController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private ICarchargeService carchargeService;
@Resource
private IParkingService parkingService;
propertyInfo.setHouseId(house.getId());
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({
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
parkingService.delete(Long.parseLong(id));
}
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 = "每页条数")
})
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")
public R update(Integer id){
Carcharge carcharge =new Carcharge();
carcharge.setId(id);
carcharge.setStatus(1);
int num=carchargeService.updateData(carcharge);
if(num>0){
return R.ok();
}
return R.fail("失败");
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Carcharge> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return carchargeService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Carcharge findById(@PathVariable Long id){
return carchargeService.findById(id);
}
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
buildingService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(@RequestBody Building building){
int num= buildingService.updateData(building);
if(num>0){
return R.ok();
}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);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Building findById(@PathVariable Long id){
return buildingService.findById(id);
}
}
@RequestMapping("/queryRepairAll")
public JsonObject queryRepairAll(Repair repair,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
PageInfo<Repair> pageInfo=repairService.findRepairAll(page,limit,repair);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryRepairAll2")
public JsonObject queryRepairAll2(Repair repair, HttpServletRequest request,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
//获取当前得登录用户
Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
String username=userinfo.getUsername();
//根据username获取登录账号得业主id
Owner owner=ownerService.queryOwnerByName(username);
repair.setOwnerId(owner.getId());
PageInfo<Repair> pageInfo=repairService.findRepairAll(page,limit,repair);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryAll")
public List<Repairtype> queryAll(){
return repairtypeService.findList();
}
@RequestMapping("/deleteByIds")
public R deleteByIds(String ids){
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
repairService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "新增")
@RequestMapping("/add")
public R add(@RequestBody Repair repair, HttpServletRequest request)
* </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 object;
}
@RequestMapping("/queryBuild")
public List<Building> queryBuild(){
PageInfo<Building> pageInfo= buildingService.findBuildAll(1,100,null);
return pageInfo.getList();
}
@ApiOperation(value = "新增")
@RequestMapping("/add")
public R add(@RequestBody Building building){
int num= buildingService.add(building);
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){
@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 = "新增")
@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){
*/
@RequestMapping("/add")
@Transactional(rollbackFor = {RuntimeException.class,Error.class})
public R add(@RequestBody Records records){
/*
步骤:
1、添加抄表记录信息
1.1 根据记录中的房子和类型查询上次抄表的度数以及相关时间信息
如果存在,需要获取上次的度数,上次时间
如果不存在 上次度数设置为0 上次时间使用本次时间
1.2 添加记录信息
2、添加物业收费信息
2.1 获取 上次到这次之间的度数信息
2.2 根据收费类型查询收费标准
2.3 用1的度数×2的的收费标准 获取相关费用
2.4 并设定为未缴费状态
2.5 添加工作
*/
//根据参数房子id和类型id 获取最后一次登记信息
Integer houId=records.getHouseId();
Integer typeId=records.getTypeId();
//获取最后一次记录信息
Records rec=recordsService.queryByHouIdAndTypeId(houId,typeId);
if(rec!=null){
//获取上次表的度数 上次抄表时间
records.setUpTime(rec.getOnTime());
records.setNum(rec.getNum2());
}else{
records.setUpTime(records.getOnTime());
records.setNum(0.0);
}
//添加记录信息到数据库
records.setCheckTime(new Date());
recordsService.add(records);
//2 添加费用信息
PropertyInfo info=new PropertyInfo();
info.setHouseId(houId);
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
//z转成集合对象
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=Long.parseLong(id);
houseService.delete(idLong);
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(@RequestBody House house){
if(house.getIntoDate()!=null){
house.setStatus(1);
}else{
house.setStatus(0);
}
int num= houseService.updateData(house);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@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);
}