House rental system based on JAVA+SSM (high-quality graduation project)

? 200,000 + fans across the entire network, csdn guest author, blog expert, CSDN Rising Star Program mentor, high-quality creator in the java field, high-quality author on Blog Star, Nuggets/Huawei Cloud/Alibaba Cloud/InfoQ and other platforms, focusing on Practical practice in Java technology field and graduation project?

Get the project download method at the end of the article

1. Project background introduction:

With the development of society and the improvement of people’s living standards, the demand for housing rental market has gradually increased. In order to meet people’s needs for convenient and fast house rental services, we decided to develop a house rental system based on JAVA + SSM with front-end and back-end separation.
Our goal is to provide tourists, landlords and tenants with a convenient and efficient house rental platform, so that they can easily find properties that suit their needs and conduct rental operations. Through this system, visitors can browse the system homepage, search for property information, and view property details. Landlords can register as system users, publish their own property information, and manage orders, feedback information, collection information, etc. Tenants can also register as system users, search and book properties, and perform related order management, feedback information, collection management and other operations.
During the research and development process, we will use JAVA as the back-end development language and use the SSM framework to achieve front-end and back-end separation. This architecture can make system development more modular and scalable, while also providing good security and stability.
In order to ensure the functional perfection and user experience of the system, we will pay attention to the following design aspects:
The system is designed with three roles: tourists, landlords, and tenants. The thinking at that time was relatively simple and there was no system administrator role set up. Anyway, it was enough for some small projects.

  1. Visitor: Not registered and logged in yet. It has permissions to log in, register, search for properties, and query details.
  2. Landlord: The user role is a landlord, a group who needs to rent houses. It has the capabilities of logging in, modifying personal information, modifying login password, searching for housing, querying details, collecting housing, viewing rental orders, canceling orders, publishing housing information, querying and managing housing information, and managing housing status. , processing of feedback information and other permissions.
  3. Tenant: The user role is a tenant, a group that needs to rent a house. It has the authority to log in, modify personal information, modify login password, search for properties, query details, collect properties, create rental orders, cancel orders, delete orders, make payments, evaluate properties, and fill in feedback information.

2. Project technical introduction:

Front end

Name Description
HTML, CSS Used to design the content and style of web pages
JavaScript, JQuery As Develop scripting language for Web pages, add various dynamic functions to web pages, and provide users with smoother and more beautiful browsing effects
Bootstrap A simple, intuitive and powerful front-end development framework based on HTML, CSS and JavaScript, making Web development faster

Backend

Name Description
Spring Spring is a lightweight open source framework in the field of Java EE programming. The framework was first proposed and subsequently created by a programmer named Rod Johnson in 2002 to solve the complexity of enterprise-level programming development and implement agile development applications. frame. Spring is an open source container framework that integrates various types of tools and implements underlying class instantiation and life cycle management through the core Bean factory. In the entire framework, various types of functions are abstracted into beans, so that the management of various functions can be realized, including dynamic loading and aspect programming.
SpringMVC Spring MVC is a follow-up product of SpringFrameWork and has been integrated into Spring Web Flow. The Spring framework provides full-featured MVC modules for building web applications.
MyBatis Plus MyBatis-Plus (referred to as MP) is an enhancement tool for MyBatis. It only enhances and does not change based on MyBatis. Born to simplify development and improve efficiency.
Thymeleaf Thymeleaf is a popular template engine developed in Java language and used to render templates for XML/XHTML/HTML5 content. engine. Similar to JSP, Velocity, FreeMaker, etc., it can also be easily integrated with web frameworks such as Spring MVC as a template engine for web applications.
Druid Druid is an efficient data query system that mainly solves aggregation queries for large amounts of time-series-based data. Data can be ingested in real time and can be checked immediately after entering Druid. At the same time, the data is almost immutable. It is usually a factual event based on time series. After the fact occurs, it is entered into Druid and the external system can query the fact.

3. Introduction to system function modules:

Function module diagram

4. Database design:

1: comment(comment)

Field name Type Default value Column comment
id int NULL Primary key ID
reply_id int NULL Reply comment ID
room_id int NULL Room ID
user_id int NULL User ID
content text NULL content
rate_count int NULL Number of rating stars
create_time datetime NULL Creation time
update_time datetime NULL Modification time

2:favor(favor)

Field name Type Default value Column comment
id int NULL Primary key ID
user_id int NULL User ID
room_id int NULL House ID
create_time datetime NULL Creation time
update_time datetime NULL Modification time

3: message (message)

Field name Type Default value Column comment
id int NULL Primary key ID
room_id int NULL House ID
order_id int NULL
send_id int NULL Sender ID
accept_id int NULL Acceptor ID
title varchar NULL title
content text NULL content
status varchar NULL status
create_time datetime NULL Creation time
update_time datetime NULL Modification time
remark varchar NULL Handling comments

4: room(room)

Field name Type Default value Column comment
id int NULL Primary key ID
owner_id int NULL Landlord ID
title varchar NULL Title
sub_title varchar NULL Subtitle
month_price double NULL Monthly rental price
location varchar NULL location
info text NULL Description
content text NULL Content
img text NULL Cover
images text NULL Images
create_time datetime NULL Creation time
update_time datetime NULL Modification time
look_count int NULL Views

5: room_detail (room_detail)

< /table>

6: room_order (room_order)

Field name Type Default value Column comment
id int NULL Primary key ID
room_id int NULL Room ID
bedroom_count int NULL Number of rooms
parlour_count int NULL Number of living rooms
restroom_count int NULL Number of bathrooms
bathroom_count int NULL Number of bathrooms
capacity varchar NULL size
garage int NULL Number of garages
area varchar NULL Community
address varchar NULL Detailed address
type varchar NULL type
build_year varchar NULL Year of construction
status varchar NULL Status
elevator varchar NULL Is there an elevator
kitchen varchar NULL Is there a kitchen
free_wifi varchar NULL Free Wi-Fi
window varchar NULL Window
metro varchar NULL Is there a subway
rent_type varchar NULL Leasing method
create_time datetime NULL Creation time
update_time datetime NULL Modification time
Field name Type Default value Column comment
id int NULL Primary key ID
room_id int NULL House ID
user_id int NULL User ID
owner_id int NULL Landlord ID
order_num varchar NULL Order number
pay_order varchar NULL Order serial number
title varchar NULL title
sub_title varchar NULL Subtitle
pay_money double NULL Price
content text NULL Content
attachment varchar NULL Attachment file
status varchar NULL status
create_time datetime NULL Creation time
pay_time datetime NULL Payment time
update_time datetime NULL Modification time
from_time datetime NULL
to_time datetime NULL

7: user(user)

Field name Type Default value Column comment
id int NULL Primary key ID
name varchar NULL Name
password varchar NULL Login password
sex varchar NULL Gender
birth varchar NULL Year and month of birth
idcard_num varchar NULL ID card number
phone varchar NULL Mobile phone number
email varchar NULL Mailbox
location varchar NULL Location
about varchar NULL About
role varchar NULL role
create_time datetime NULL Creation time
update_time datetime NULL Modification time

5. Role introduction:

  1. The system is designed with three roles: tourists, landlords, and tenants. The thinking at that time was relatively simple and there was no system administrator role set up. Anyway, it was enough for some small projects.

    1. Visitor: Not registered and logged in yet. It has permissions to log in, register, search for properties, and query details.
    2. Landlord: The user role is a landlord, a group who needs to rent houses. It has the capabilities of logging in, modifying personal information, modifying login password, searching for housing, querying details, collecting housing, viewing rental orders, canceling orders, publishing housing information, querying and managing housing information, and managing housing status. , processing of feedback information and other permissions.
    3. Tenant: The user role is a tenant, a group that needs to rent a house. It has the authority to log in, modify personal information, modify login password, search for properties, query details, collect properties, create rental orders, cancel orders, delete orders, make payments, evaluate properties, and fill in feedback information.

6. Function introduction:

Introduction to visitor functions
Function module Function description
Login and registration aspects Register as a system user
System homepage Browse the system homepage, search for property information, and view property details (statistical views)
Introduction to landlord functions
Function module Function description
Login and registration aspects Fill in user information to register an account and use email and password to log in
Personal information Modify personal information (name, location, email, Mobile phone number, ID number, personal description, etc.), change login password
Order management View all orders, order details, cancel orders, delete Order
Publish the property Fill in the basic information, fill in the detailed information, upload the cover image and house photos
Housing information management Your own published housing information, edit housing, delete housing, pause publishing, start publishing, lease expiration
Feedback information Query all feedback information, feedback information search, delete feedback, process feedback
Collection management Query all collection information, search for collection information, cancel collection
System homepage Browse the system homepage, search for property information, and view property details (Statistical views), bookmark listings
Introduction to tenant functions

< /table>

7. Development tools and environment:

  • Development Tools

    • IntelliJ IDEA 2019.2.2 is mainly used for system development, system debugging, etc.
    • WebStorm 2019.2.1 mainly focuses on the development of front-end pages.
    • Navcat mainly performs database connection, database and table building, system debugging, etc.
  • Development environment

    • JDK 1.8
    • Maven 3.6
    • MySQL 5.7
    • Tomcat 8.5.78

8. Project structure:

This project uses the standard SSM directory structure, and the backend uses the MVC three-tier architecture. The specific project structure is as follows:

  • src: source code directory
  • src/main/java: source code main directory
  • src/main/java/xxx/component: storage address of common Java components, such as login interceptor [interceptor]
  • src/main/java/xxx/controller: java controller class storage address [control layer]
  • src/main/java/xxx/entity: Java entity class storage address [Model]
  • src/main/java/xxx/dao: MyBatis mapping interface storage address, [data access layer]
  • src/main/java/xxx/service: java business layer interface storage address [Business Logic Abstraction Layer]
  • src/main/java/xxx/utils: Java tool class storage address [Tool class]
  • src/resources: Resource file storage directory (Spring, SpringMVC, Mybatis, logs, data sources, database scripts, etc.)
  • src/main/resources/mybatis: MyBatis configuration file location
  • src/main/resources/mybatis/mybatis-config.xml: MyBatis global configuration file
  • src/main/resources/spring/applicationContext.xml: Spring configuration file
  • src/main/resources/springmvc/springmvc-servlet.xml: Spring configuration file
  • src/main/resources/db.properties: data source configuration
  • src/main/resources/log4j.properties: Log configuration
  • src/main/resources/verio_house.sql: database script
  • src/main/webapp/resource: front-end static resource storage address
  • src/main/webapp/WEB-INF/templates: front-end page storage address
  • src/main/webapp/WEB-INF/web.xml: Java EE project file
  • pom.xml: Maven project dependency management file

Notice! If you want to deploy this project, you need to modify two files:

  1. Database configuration file: src/main/resources/db.properties
  2. Alibaba Cloud object storage configuration: src/main/java/com/verio/utils/OssUtil.java

Note that the version of MySQL is 5.7, and other unknown problems may occur when using other versions.

9. Code examples:

/**
Generate verification code
 */
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{<!-- -->
 AjaxResult ajax = AjaxResult.success();
 boolean captchaEnabled = configService.selectCaptchaEnabled();
 ajax.put("captchaEnabled", captchaEnabled);
 if (!captchaEnabled)
 {<!-- -->
 return ajax;
 }
 //Save verification code information

 String uuid = IdUtils.simpleUUID();
 String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
   String capStr = null, code = null;
 BufferedImage image = null;
   // Generate verification code
 String captchaType = RuoYiConfig.getCaptchaType();
 if ("math".equals(captchaType))
 {<!-- -->
 String capText = captchaProducerMath.createText();
 capStr = capText.substring(0, capText.lastIndexOf("@"));
 code = capText.substring(capText.lastIndexOf("@") + 1);
 image = captchaProducerMath.createImage(capStr);
 }
 else if ("char".equals(captchaType))
 {<!-- -->
 capStr = code = captchaProducer.createText();
 image = captchaProducer.createImage(capStr);
 }
   redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
 // Convert stream information to write
 FastByteArrayOutputStream os = new FastByteArrayOutputStream();
 try
 {<!-- -->
 ImageIO.write(image, "jpg", os);
 }
 catch (IOException e)
 {<!-- -->
 return AjaxResult.error(e.getMessage());
 }
   ajax.put("uuid", uuid);
 ajax.put("img", Base64.encode(os.toByteArray()));
 return ajax;
}
/**
Universal local file upload

@param multipartFile file object
@return file access link URL
 /
@PostMapping("/file")
public SimpleResponse uploadImg(@RequestParam("file") MultipartFile file) {
 // File extension
 String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
 File savePathFile = new File(newTomcatFolder);
 if (!savePathFile.exists()) {
 // If the directory does not exist, create the directory
 savePathFile.mkdir();
 }
 // Generate unique file name from UUID
 String filename = UUID.randomUUID() + "." + suffix;
 try {
 // Save the file to the specified directory
 file.transferTo(new File(newTomcatFolder + filename));
 } catch (Exception e) {
 e.printStackTrace();
 return SimpleResponse.error("Exception when saving file");
 }
 // Return to access link
 return SimpleResponse.success(newTomcatHost + filename);
}
/*
User login
 */
@PostMapping("/login")
public ReturnMsg manageLogin(@RequestBody Map<String, String> param) {<!-- -->
 if (StrUtil.isEmpty(param.get("username")) || StrUtil.isEmpty(param.get("password"))) {<!-- -->
 return ReturnMsg.error("Wrong username or password!");
 }
 ManageDTO manageDTO = new ManageDTO();
 manageDTO.setUserName(param.get("username"));
 manageDTO.setPassWord(param.get("password"));
 QueryWrapper manageDTOQueryWrapper = new QueryWrapper<>(manageDTO);
 manageDTOQueryWrapper.last("limit 1");
 ManageDTO adminDTOS = manageService.getOne(manageDTOQueryWrapper);
 if (adminDTOS == null) return ReturnMsg.error("Wrong username or password!");
 Map<String, Object> map = new HashMap<>();
 map.put("avatar", StrUtil.isNotBlank(adminDTOS.getPhotoImg()) ? adminDTOS.getPhotoImg() : "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
 map.put("introduction", adminDTOS.getName() + ",Hello!");
 map.put("name", adminDTOS.getName());
 map.put("roles", Arrays.asList("admin"));
 map.put("type", adminDTOS.getStatus());
 Map<String, String> returnMap = new HashMap<>();
 String uuid = UUID.randomUUID().toString();
 returnMap.put("token", uuid);
 userInfoMap.put(uuid, JSON.toJSONString(map));
 return ReturnMsg.ok(returnMap);
}

10. System screenshot:

202310292222440

202310292224316

202310292226552

202310292230958

202310292231709

202310292234430

11. Project summary:

The implementation of the overall functional module of the house rental system based on JAVA + SSM is mainly a test of what I have learned in the past few years in college. For the system, it is mainly through the current intelligent house rental system based on JAVA + SSM The implementation of the system has begun. After a semester of graduation project implementation, it is nearing completion. So far, when I recall the system development days throughout the semester, I have gained a lot. The main task of the graduation project is to establish an intelligent house rental system based on JAVA + SSM. It mainly uses JAVA and Mysql database development tools to perform corresponding operations on each functional module of the system. Finally, the system debugging results show that the system Basically can meet the functional requirements.

The development of the house rental system platform based on JAVA + SSM has been of great help to the improvement of my university studies. It enables me to learn the technical aspects of computer knowledge and the communication aspects of interacting with people. It makes me realize that no matter what we do, we need to persevere and work hard. Only by trying and persisting in doing it, we Only then can you succeed and gain the joy of success. If you don’t try and think with knowledge, you won’t even have a chance of success. Only by doing the actual operation will you get closer and closer to success. As the road moves forward, the future The road is beautiful. Regarding the implementation of the driving school management platform, this is the first time I have completed the design of a management system. During the design process of the project, I overcame various difficulties, and in the face of these difficulties, I actively faced them, found ways to solve the problems, and better mastered the theoretical knowledge and hands-on practical ability, starting from the development of the system. By the time the design was completed, I had completed a more comprehensive, complete, and secure platform management system, which also gave me a great sense of accomplishment and made me more confident in my future life.

12. Source code acquisition:

Everyone like, collect, follow, comment, viewget the project download link and blogger contact information

Click the link to go directly: Download link

syntaxbug.com © 2021 All Rights Reserved.
Function module Function description
Login and registration aspects Fill in user information to register an account and use email and password to log in
Personal information Modify personal information (name, location, email, Mobile phone number, ID number, personal description, etc.), change login password
Order management View all orders, create orders, pay orders (false Payment), order details, cancel order, delete order, comment on listings
Feedback information Feedback information, query all feedback information, feedback information search , query details and processing opinions
Collection management Query all collection information, search for collection information, cancel collection
System homepage Browse the system homepage, search for property information, view property details (statistical views), and bookmark properties