基于SSM的房屋租售信息管理系统的设计与实现

编程入门 行业动态 更新时间:2024-10-22 16:43:20

基于SSM的房屋租售<a href=https://www.elefans.com/category/jswz/34/1769682.html style=信息管理系统的设计与实现"/>

基于SSM的房屋租售信息管理系统的设计与实现

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:采用JSP技术开发
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

管理员功能模块实现

管理员登录

个人中心

房东管理

用户管理

房屋出售管理

房屋出租管理

轮播图管理

公告管理

用户功能模块实现

系统首页

个人中心

房屋出售管理

屋出租管理

公告管理

四、核心代码

登录相关

文件上传

封装


一、项目简介

计算机技术的应用非常广泛,几乎涉及到每个行业,人们现在的生活也无法离开互联网。传统的房屋租售管理模式主要依靠管理人员纯手工记录的相关信息,比较繁琐,不方便查找,也非常容易出现错误。为了简化房屋租售的工作流程,提高房屋租售的管理效率,实现房屋租售行业的现代化建设,本文设计和实现了一款房屋租售信息管理系统。首先,根据收集到的用户需求分析,对设计系统有一个初步的认识与了解,确定房屋租售信息管理系统的总体功能模块。然后,详细设计系统的主要功能模块,使用MySQL数据库将与系统有关的数据进行保存,再通过使用关键的开发工具,如MyEclipse开发平台、JSP技术等,编写相关的代码设计本系统。接着,进行系统测试,并且不断地查找问题,以及想出解决问题的方法,不断地改进和完善系统的设计。最后,对系统进行总结和展望工作,总结实现系统过程中的学习经验等内容,并且对系统未来的运维和发展提出相关的展望。本系统的设计和实现,在安全性方面,用户使用浏览器访问网站时,采用注册和密码等相关的保护措施,提高系统的可靠性,维护用户的个人信息和财产的安全;在方便性方面,促进了房屋租售行业的信息化建设,极大的方便了相关的工作人员对房屋信息进行管理。

关键词:房屋租售;Java语言;B/S模式;JSP技术;系统测试


二、系统功能

本系统主要通过使用Java语言编码设计系统功能,MySQL数据库管理数据,JSP技术设计简洁的、友好的网址页面,然后在MyEclipse开发平台中,编写相关的Java代码文件,接着通过连接语言完成与数据库的搭建工作,再通过平台提供的Tomcat插件完成信息的交互,最后在浏览器中打开系统网址便可使用本系统。本系统的使用角色可以被分为用户和管理员,用户具有注册、评价信息等功能,管理员具有修改、管理信息等功能。



三、系统项目截图

管理员功能模块实现

管理员登录

管理员可以选择任一浏览器打开网址,输入信息无误后,以管理员的身份行使相关的管理权限

 

个人中心

管理员可以通过选择个人中心,管理相关的个人信息记录,比如进行修改密码,查看个人信息,修改用户名等操作

 

房东管理

管理员可以通过选择房东管理,管理相关的房东信息记录,比如进行添加房东信息,查看房东姓名,修改房东手机号,删除失效的房东信息记录等操作

 

用户管理

管理员可以通过选择用户管理,管理相关的用户信息记录,比如进行添加用户信息,查看用户姓名,修改用户照片,删除失效的用户信息记录等操作

房屋出售管理

管理员可以通过选择房屋出售管理,管理相关的房屋出售、留言、订单等信息记录,比如进行添加房屋出售信息,查看发布房东,修改房屋状态等操作

 

房屋出租管理

管理员可以通过选择房屋出租管理,管理相关的房屋出租、留言、订单等信息记录,比如进行查看房屋名称,修改房屋户型,删除失效房屋信息等操作

 

轮播图管理

管理员可以通过选择订轮播图管理,管理相关的轮播图信息记录,比如进行查看轮播图名称,修改轮播图片,批量删除失效的轮播图等操作

 

公告管理

管理员可以通过选择公告信息管理,管理相关的公告信息记录,比如进行添加公告信息,查看公告内容,修改公告时间等操作

用户功能模块实现

系统首页

用户在浏览器中打开本系统,可以查看房屋出售、房屋出租、公告、论坛、留言等操作 

 

个人中心

用户可以通过选择密码信息管理,管理用户相关的个人信息记录,通过输入正确的原密码,再次输入新密码,完成密码的修改操作

 

房屋出售管理

用户可以通过选择房屋出售管理,管理用户相关的房屋出售、留言、订单等信息记录,比如进行查看发布房东,查看房屋状态等操作

 

屋出租管理

用户可以通过选择房屋出售管理,管理用户相关的房屋出租、留言、订单等信息记录,比如进行查看发布房东,查看房屋状态等操作

 

公告管理

用户可以通过选择公告管理,管理用户相关的公告信息记录,比如进行查看公告名称,查看公告类型,查看公告详情等操作

 


四、核心代码

登录相关


package com.controller;import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.bind.annotation.RestController;import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;/*** 登录相关*/
@RequestMapping("users")
@RestController
public class UserController{@Autowiredprivate UserService userService;@Autowiredprivate TokenService tokenService;/*** 登录*/@IgnoreAuth@PostMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));if(user==null || !user.getPassword().equals(password)) {return R.error("账号或密码不正确");}String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());return R.ok().put("token", token);}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {return R.error("用户已存在");}userService.insert(user);return R.ok();}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 密码重置*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request){UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));if(user==null) {return R.error("账号不存在");}user.setPassword("123456");userService.update(user,null);return R.ok("密码已重置为:123456");}/*** 列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,UserEntity user){EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/list")public R list( UserEntity user){EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();ew.allEq(MPUtil.allEQMapPre( user, "user")); return R.ok().put("data", userService.selectListView(ew));}/*** 信息*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") String id){UserEntity user = userService.selectById(id);return R.ok().put("data", user);}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrUser(HttpServletRequest request){Long id = (Long)request.getSession().getAttribute("userId");UserEntity user = userService.selectById(id);return R.ok().put("data", user);}/*** 保存*/@PostMapping("/save")public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {return R.error("用户已存在");}userService.insert(user);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);userService.updateById(user);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){userService.deleteBatchIds(Arrays.asList(ids));return R.ok();}
}

文件上传

package com.controller;import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;import org.apachemons.io.FileUtils;
import org.apachemons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;/*** 上传文件映射表*/
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{@Autowiredprivate 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);FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));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);}/*** 下载文件*/@IgnoreAuth@RequestMapping("/download")public ResponseEntity<byte[]> download(@RequestParam String fileName) {try {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();}File file = new File(upload.getAbsolutePath()+"/"+fileName);if(file.exists()){/*if(!fileService.canRead(file, SessionManager.getSessionUser())){getResponse().sendError(403);}*/HttpHeaders headers = new HttpHeaders();headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    headers.setContentDispositionFormData("attachment", fileName);    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);}} catch (IOException e) {e.printStackTrace();}return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);}}

封装

package com.utils;import java.util.HashMap;
import java.util.Map;/*** 返回数据*/
public class R extends HashMap<String, Object> {private static final long serialVersionUID = 1L;public R() {put("code", 0);}public static R error() {return error(500, "未知异常,请联系管理员");}public static R error(String msg) {return error(500, msg);}public static R error(int code, String msg) {R r = new R();r.put("code", code);r.put("msg", msg);return r;}public static R ok(String msg) {R r = new R();r.put("msg", msg);return r;}public static R ok(Map<String, Object> map) {R r = new R();r.putAll(map);return r;}public static R ok() {return new R();}public R put(String key, Object value) {super.put(key, value);return this;}
}

更多推荐

基于SSM的房屋租售信息管理系统的设计与实现

本文发布于:2023-11-15 04:27:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1593632.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:信息管理系统   房屋   SSM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!