博主主页:一季春秋
博主简介:专注Java技术领域和毕业设计项目实战、Java、微信小程序、安卓等技术开发,远程调试部署、代码讲解、文档指导、ppt制作等技术指导。
主要内容:SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、小程序、安卓app、大数据等设计与开发精彩专栏推荐订阅👇🏻👇🏻 不然下次找不到哟
SpringBoot+Vue项目持续更新中
http://t.csdn.cn/1mgm8
🍅文末获取联系🍅
目录
一、项目介绍
综合小区管理系统管理系统按照操作主体分为管理员和用户。管理员的功能包括报修管理、车位管理、车位分配管理、出入管理、字典管理、房屋管理、物业费缴纳管理、公告管理、物业人员投诉管理、我的私信管理、物业人员管理、用户管理、管理员管理。用户的功能包括管理部门以及部门岗位信息,管理招聘信息,培训信息,薪资信息等。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。
二、项目主要技术
开发语言:Java
使用框架:spring boot
前端技术:Vue 、css、element-ui、js
开发工具:IDEA/MyEclipse/Eclipse、Visual Studio Code
数据库:MySQL 5.7/8.0
数据库管理工具:phpstudy/Navicat
JDK版本:jdk1.8
Maven: apache-maven 3.8.1-bin
三、功能结构设计
图即为设计的管理员功能结构,管理员权限操作的功能包括管理公告,管理综合小区管理系统信息,包括出入管理,报修管理,报修管理,物业费缴纳等,可以管理操作员。
四、管理员功能实现
4.1出入管理功能实现
图即为编码实现的出入管理界面,管理员在出入管理界面中可以对界面中显示,可以对招聘信息的招聘状态进行查看,可以添加新的招聘信息等。
4.2报修管理功能实现
图即为编码实现的报修管理界面,管理员在报修管理界面中查看奖罚种类信息,奖罚描述信息,新增奖惩信息等。
4.3车位管理功能实现
图即为编码实现的车位管理界面,管理员在车位管理界面中新增。
4.4公告管理功能实现
图即为编码实现的公告管理界面,管理员在公告管理界面查看公告的工作状态,可以对公告的数据进行导出,可以添加新公告的信息,可以编辑公告信息,删除公告信息。
五、用户功能实现
5.1物业人员投诉实现
图即为编码实现的物业人员投诉界面。
5.2报修管理实现
图即为编码实现的报修管理界面。
5.3房屋实现
5.4物业费缴纳实现
图即为编码现的物业费缴纳界面。
六、部分核心代码
6.1登录注册相关代码
*/
@RequestMapping("users")
@RestController
public class UsersController {
@Autowired
private UsersService usersService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
if(user==null || !user.getPassword().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
R r = R.ok();
r.put("token", token);
r.put("role",user.getRole());
r.put("userId",user.getId());
return r;
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UsersEntity user){
// ValidatorUtils.validateEntity(user);
if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
usersService.insert(user);
return R.ok();
}
6.2上传文件相关代码
*/
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
@Autowired
private ConfigService configService;
/**
* 上传文件
*/
@RequestMapping("/upload")
public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
if (file.isEmpty()) {
throw new EIException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/upload/");
if(!upload.exists()) {
upload.mkdirs();
}
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(upload.getAbsolutePath()+"/"+fileName);
file.transferTo(dest);
if(StringUtils.isNotBlank(type) && type.equals("1")) {
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
if(configEntity==null) {
configEntity = new ConfigEntity();
configEntity.setName("faceFile");
configEntity.setValue(fileName);
} else {
configEntity.setValue(fileName);
}
configService.insertOrUpdate(configEntity);
}
return R.ok().put("file", fileName);
}
6.3报修相关代码
/**
* 报修
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/baoxiu")
public class BaoxiuController {
private static final Logger logger = LoggerFactory.getLogger(BaoxiuController.class);
private static final String TABLE_NAME = "baoxiu";
@Autowired
private BaoxiuService baoxiuService;
@Autowired
private TokenService tokenService;
@Autowired
private CheweiService cheweiService;//车位
@Autowired
private CheweiFenpeiService cheweiFenpeiService;//车位分配
@Autowired
private ChuruService churuService;//出入
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private FangwuService fangwuService;//房屋
@Autowired
private FeiyongService feiyongService;//物业费缴纳
@Autowired
private GonggaoService gonggaoService;//公告
@Autowired
private LiuyanService liuyanService;//物业人员投诉
@Autowired
private SixinService sixinService;//我的私信
@Autowired
private WuyeService wuyeService;//物业人员
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private UsersService usersService;//管理员
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("物业人员".equals(role))
params.put("wuyeId",request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = baoxiuService.queryPage(params);
//字典表数据转换
List<BaoxiuView> list =(List<BaoxiuView>)page.getList();
for(BaoxiuView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
BaoxiuEntity baoxiu = baoxiuService.selectById(id);
if(baoxiu !=null){
//entity转view
BaoxiuView view = new BaoxiuView();
BeanUtils.copyProperties( baoxiu , view );//把实体数据重构到view中
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(baoxiu.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody BaoxiuEntity baoxiu, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,baoxiu:{}",this.getClass().getName(),baoxiu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
baoxiu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<BaoxiuEntity> queryWrapper = new EntityWrapper<BaoxiuEntity>()
.eq("yonghu_id", baoxiu.getYonghuId())
.eq("baoxiu_name", baoxiu.getBaoxiuName())
.eq("baoxiu_types", baoxiu.getBaoxiuTypes())
.eq("baoxiu_zhuangtai_types", baoxiu.getBaoxiuZhuangtaiTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
BaoxiuEntity baoxiuEntity = baoxiuService.selectOne(queryWrapper);
if(baoxiuEntity==null){
baoxiu.setInsertTime(new Date());
baoxiu.setCreateTime(new Date());
baoxiuService.insert(baoxiu);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody BaoxiuEntity baoxiu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,baoxiu:{}",this.getClass().getName(),baoxiu.toString());
BaoxiuEntity oldBaoxiuEntity = baoxiuService.selectById(baoxiu.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// baoxiu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
if("".equals(baoxiu.getBaoxiuPhoto()) || "null".equals(baoxiu.getBaoxiuPhoto())){
baoxiu.setBaoxiuPhoto(null);
}
baoxiuService.updateById(baoxiu);//根据id更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<BaoxiuEntity> oldBaoxiuList =baoxiuService.selectBatchIds(Arrays.asList(ids));//要删除的数据
baoxiuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}