(with source code) graduation design of springboot campus transportation tool rental system 061335

Lease System of Campus Transportation Tools Based on Javaweb

Summary

With the advent of the Internet trend, all walks of life are considering using the Internet to promote themselves. The best way is to establish their own Internet system and maintain and manage it. In actual application, the working rules and development steps of the application software are adopted, and the campus transportation tool rental system is constructed by using JSP technology.

This design mainly realizes the campus transportation tool leasing system integrating the advantages of humanization, high efficiency, and convenience, and completes user management, content management, vehicle site management, vehicle leasing management, user registration management, vehicle information management, cancellation order, vehicle Return, top-up management, vehicle maintenance and other functional modules. The system communicates with the server through the browser to realize data interaction and change. Just use a computer and move your fingers to operate the system and realize data communication management. The design process of the whole system has fully considered the security, stability and reliability of data, and the operation process is simple. The system improves work efficiency and reduces errors and omissions in data storage through scientific management methods and convenient services.

The campus transportation tool rental system uses Java language, adopts spring boot technology based on B/S mode to develop, and uses MyEclipse compiler to write. In terms of data, it mainly uses the Mysql relational database of SUN Company as the data storage medium, and cooperates with the front desk HTML +CSS technology completes the development of the system.

Key words: campus transportation tools; Java language; relational data;

Campus transportation tool rental system based on Java Web

Abstract

With the advent of the Internet trend, all walks of life are considering using the Internet to promote themselves. The best way is to establish their own Internet system, maintain and manage it. In practical application, according to the working rules and development steps of the application software, JSP technology is used to build the campus transportation tool rental system.

This design is mainly to realize humanization, the advantages of high efficiency, convenient to campus transport at lease system, complete the user management, content management, site management, vehicle rental vehicle management, user registration management, vehicle information management, cancel the order, vehicle return, credit management, vehicle maintenance function module. The system communicates with the server through the browser to realize data exchange and change. Just through a computer, a finger can operate the system, to achieve data communication management. The whole system design process has fully considered the data security, stability and reliability, and the operation process is simple. The system improves work efficiency and reduces errors and omissions in data storage through scientific management and convenient service.

The campus transportation tool rental system uses Java language, spring boot technology based on B / S mode and MyEclipse compiler. In terms of data, the MySQL relational database of Sun company is mainly used as the data storage medium, and the system development is completed with the foreground HTML + CSS technology.

Key words: Campus transportation tools; Java language; Relational data;

Table of contents

Chapter 1 Introduction 1

1.1 Research background and significance 1

1.2 Development status 1

1.3 Organizational structure of this article1

Chapter 2 Introduction to Related Technologies 3

2.1 J2EE Technology 3

2.2 MVVM pattern 3

2.3 Mysql database 3

2.4 B/S structure 4

2.5 JavaScript running mode 4

Chapter 3 System Analysis 5

3.1 Feasibility analysis 5

3.1.1 Technical Feasibility Analysis 5

3.1.2 Economic feasibility analysis 5

3.1.3 Operation Feasibility Analysis 5

3.2 Analysis of functional requirements 5

3.3 Analysis of non-functional requirements 7

3.4 Data flow analysis 7

Chapter 4 System Design 10

4.1 System Architecture Design 10

4.2 System function structure 10

4.3 Functional module design 11

4.4 Form Field Validation Processing Design 12

4.5 System Maintenance Design 12

4.6 Database Design 12

4.6.1 Conceptual model 12

4.6.2 Relational Model 13

4.6.3 Data Table 13

Chapter 5 System Implementation 17

5.1 Implementation of login module 20

5.2 Implementation of User Subsystem Module 20

5.2.1 Registration module 20

5.2.2 Vehicle station module 24

5.2.3 Vehicle information module 24

5.2.4 Vehicle Leasing Module 26

5.3 Implementation of the supervisor subsystem module 28

5.3.1 User Management Module 28

5.3.2 Profile module 29

5.3.3 Vehicle information management module 31

5.3.4 Vehicle Maintenance Management Module 34

5.3.5 Vehicle return module 35

Chapter 6 System Testing 36

6.1 Test purpose 36

6.2 Testing process 36

6.3 Test results 37

Chapter 7 Summary and Outlook 38

Reference 39

Thanks 40

    • introduction

    • research background and meaning

The 21st century has already entered the era of rapid development of Internet information, and the popularity of the Internet has brought many conveniences to people. Most enterprises, factories, etc. have their own systems, and car rental companies have also shifted from the traditional model to the Internet. At this time, it is imperative for travel agencies to establish their own systems. So what are the functions and significance of the construction of the campus transportation tool rental system?

Design a system that manages vehicle information and customer information, and monitors rental, mainly including vehicle rental status, basic vehicle information, and customer information management. Due to the complexity of the relationship between various processes, the management workload is heavy and complicated. In the past and even now, many leasing companies still use manual management, which makes frequent mistakes and continuously reduces service quality. The development of the campus transportation tool rental system has fundamentally improved this situation. This management system covers all aspects of the vehicle leasing business, enabling the leasing service to be completed quickly and standardizedly, saving manpower and material resources; while simplifying the leasing service, it can effectively improve the service quality and economic benefits, and build a smooth communication channel between the two parties.

    • development status

At present, the construction of the rental system based on campus transportation tools in my country is still in the development stage. Due to the lack of unified theory, layout planning and coordination of various leasing companies, coupled with the lack of scientific software engineering theory, it often results in redundant construction of leasing companies and estrangement of resources, resulting in unnecessary waste.

Most of the traditional campus transportation tool rental systems stay in stand-alone operation or C/S architecture. Although some use platform-independent Java technology to realize Web applications, this is only the openness of the system development level. In a specific application, no matter Whether it is the client side or the server side, specific software support is required. Since it fails to provide the open environment that users really expect and the product is updated very quickly, it has been difficult to adapt to the simultaneous use of more than 100 computers in LAN users. And the cost is high and the efficiency is low.

"Campus transportation tool leasing system" aims to promote real management informatization, improve the heavy work of leasing companies in user information, vehicle information and vehicle leasing links, use the network, adopt B/S structure, establish functional modules, and highlight interaction It realizes the online campus transportation tool rental system based on JSP, and realizes information exchange and sharing with cross-service sites and vehicles through open interfaces.

    • Organization of this article

The first chapter is the introduction, the beginning of this article, some textual descriptions of the research background and research significance of this topic.

The second chapter studies the development technology and development tools used in the campus transportation tool leasing system.

The third chapter is the system analysis part, including the description of the overall requirements of the system, the analysis of system requirements from a functional point of view, and the non-functional analysis of whether the system can be realized.

The fourth chapter is the system design part, an important part of this article, which provides the detailed design of the system architecture and the design description of some main functional modules.

The fifth chapter is the specific realization of the system, introducing the specific realization of each module of the system.

The sixth chapter tests and runs the system on the basis of the previous chapters.

Finally, the system is seriously summarized, so as to have a new prospect for the future.

    • Related technology introduction

    • J2EE technology

People can master many foreign languages, but what a computer scientist is proficient in is mostly programming languages, which are not human natural languages, such as C language, Java, Perl and so on. Since the "middleware" developed by different companies is not standardized enough, Sun launched J2EE and used this standard to solve the ills. It provides a good mechanism, allowing each layer to allow the corresponding server and components to run, making the system stable and usable, efficient in development, and easy to maintain.

    • MVVM pattern

The MVVM model is a commonly used development model, which is mainly divided into M layer, V layer and C layer in terms of code implementation.

View (View) represents the user interaction interface. A web application may have many interfaces. In the MVVM mode, the view only deals with data collection, processing, and user requests, and does not include the processing of business processes and business processes. Handled by the Model.

Model (Model) is the processing of business processes/states and the formulation of business rules. The process of the model processing the business process cannot be seen by other layers. It is like a black box. After receiving the data requested by the view, it returns the final processing result. The main core of MVVM is the design of the business model. A typical application example is the popular EJB model. It further divides the model from the perspective of application technology implementation in order to make full use of existing components, but it cannot be used as a A framework for applying design models.

The controller (Controller) can be understood as receiving the user's request, and then the view and the model are matched together to complete the user's request together. It has a very obvious role in dividing the control layer, and can clearly tell you that it is a distributor, which model and view to choose, and what kind of request from the user can be completed. The control layer does not do all the data processing, for example: the user clicks a connection, after the control layer receives the request, it does not process the business information, it just transmits the user's information to the model, and tells the model what to do, and then chooses the one that meets the requirements The view is returned to the user.

    • MySQL database

The reason for using the MySQL software is that it can be accessed by multiple users, and there are Archives, etc. in it. It will classify the data first, and then store them in tables separately. Such special operations will improve the speed of the data management system itself, allowing the database to be used flexibly. The code of MySQL is public, and allows others to compile and upgrade it twice. This feature can reduce the cost of users, and form a good website system after matching with suitable software. Although it has shortcomings, it is the mainstream application object of users in all aspects.

    • B/S structure

B/S (Browser/Server) is a more convenient architecture than its predecessor architecture. It uses the Web server to complete the data transfer and exchange. You only need to download the browser as the client, then the work will achieve a "slimming" effect, and there is no need to consider the problem of non-stop installation of software.

    • JavaScript run mode:

JavaScript is a high-level scripting language belonging to the network. It has been widely used in the development of Web applications. It is often used to add various dynamic functions to web pages and provide users with smoother and more beautiful browsing effects. Usually, JavaScript scripts realize their own functions by embedding them in HTML.

1.8.1 is an interpreted scripting language (code is not precompiled ).

1.8.2 is primarily used to add interactivity to HTML ( an application of Standard Generalized Markup Language ) pages.

1.8.3 can be directly embedded in HTML pages, but written as a separate js file is conducive to the separation of structure and behavior .

1.8.4 Cross-platform feature, with the support of most browsers, it can run on multiple platforms (such as Windows , Linux , Mac , Android , iOS , etc.).

1.8.5 Like other languages, the JavaScript scripting language has its own basic data types, expressions and arithmetic operators , and the basic program framework of the program. JavaScript provides four basic data types and two special data types for processing data and text. Variables provide a place to store information, and expressions can complete more complex information processing.

    • system analysis

    • Feasibility Analysis

This design is based on the B/S mode, using Java and JSP technologies using MySQL database and Myeclipse. The overall feasibility is divided into the following three aspects.

    • Technical Feasibility Analysis

The so-called technical feasibility refers to whether the functions planned in the early stage can be satisfied within a limited time. Whether there will be problems that cannot be solved in the development and design. Whether the completed project can be well applied, if there are shortcomings, whether there is great difficulty in later maintenance. After evaluating the system, it was determined that existing technology could achieve the goals. Using JSP technology to realize dynamic pages, embedding low-dependency design patterns, flexible databases, and stable servers, the operating efficiency of the entire system is greatly improved. It can be seen that achieving the goal at the technical level is not a nonsense.

    • Economic Feasibility Analysis

Most of the tools used in the project are currently popular open source and free, so in the early stage of development, the funds used for the project will be greatly reduced, and the development of the software will not be affected by the funds during the project start-up period, so It is still economically feasible. Try to use the least cost to meet the needs of users. Save funds for labor costs and equipment costs. It will go further and further on the road of paperless and high efficiency.

    • Operational Feasibility Analysis

The operation of this system to realize the function is very simple. The common configuration of ordinary computers can run this software, and as long as you have a rough understanding of the basic common sense of computer use, you can use this software smoothly. The computer has the ability to connect to the Internet and can access the system normally. It does not require the operator to have any superb ability. It only needs to understand the business process and operate correctly according to professional knowledge. Therefore, the campus transportation tool rental system is feasible. .

    • 3.2 Analysis of Functional Requirements

Before system development and design, you should make a preliminary idea of ​​the functions, know what sections the management system has, what functions each section has, whether the overall design meets the needs of users, and then conduct a detailed analysis and summary of the developed system functions , so as to design a complete system and implement it. Communication analysis of users and developers to achieve the best understanding and make the system function to the best.

The user use case diagram is shown below.

Figure 3-1 User use case diagram

The administrator use case diagram is shown below.

Figure 3-1 Administrator use case diagram

After analyzing the requirements of the campus transportation tool rental system, the whole system is mainly divided into two parts: administrators and users, and the functions of the branches under each module are different. Describe the function as follows:

User module:

Register an account.

Account login authentication.

Manage profile information, modify modifiable information items.

Vehicle rentals while viewing individual rental records.

Cancel the rental order, and check whether the rental order is recorded.

Vehicle return: return the vehicle and make payment, and leave a comment on the vehicle (whether it is easy to use and whether there is some information feedback on the place that needs maintenance)

Admin module:

Admin user add, delete, modify

Change login password

Add, delete, modify and query vehicle information.

Message reply, delete, query.

Registered users review, delete, modify, query.

Check and delete the rental car.

The user can place an order if the vehicle status is rentable, and the user cannot place an order if the vehicle status is under maintenance.

    • Non-Functional Requirements Analysis

There are many non-functional requirements of the system, such as performance requirements, maximum number of users that can be carried, stability, and usability requirements. The analysis of this system takes into account the requirement of ease of use, because the system is used by people, so it is necessary to fully consider the user experience from the user's point of view, so that the system is easy to understand, easy to use and easy to operate.

    • Data Flow Analysis

The zero-level data flow chart includes modules such as login and registration, user functions, and retrieval maintenance. The data used in the login and registration module stores user account documents, and the storage required by the user function module is the data file of each functional module of the user. The above data files are retrieved by keywords.

The zero-level data flow diagram of the system is shown in the figure below.

Figure 3-2 System data flow diagram (zero layer)

The first-level data flow chart is a refinement of the zero-level data flow chart, subdividing login registration into filling in login registration data and improving data, and subdividing user functions into basic user functions and main user functions.

The layer-by-layer data flow diagram of the system is shown in the figure below.

Figure 3-3 System data flow diagram (one layer)

The second-tier data flow is the refinement of filling in login registration information and user functions in the first-tier data flow diagram. That is: fill in the login registration information and refine it into filling information and background review, and user functions are refined into operations such as vehicle rental reservation, online message, vehicle review, customer service consultation, and vehicle collection.

The layer 2 data flow diagram of the system is shown in the figure below.

Figure 3-4 System data flow diagram (second floor)

    • system design

    • System architecture design

At present, the main data access method of the B/S system is: the user can enter the system through the browser page, and the system can automatically process the request sent by the user to the server. The processing request is carried out in the background of the system. Perform corresponding operations on the page, and you can see the processing results delivered by the server. The campus transportation tool rental system is mainly divided into a three-layer architecture design of view-model-control. In the view layer, it mainly operates the data fed back and displayed from the server to the client. In the model layer, it mainly deals with related business logic, data integration, etc., and the final control layer is between the view and the model. It is to adjust the relationship between the two layers and finally implement the data transmission.

系统架构图如下图所示。

图4-1系统架构图

    • 系统功能结构

系统设计的目的是分析系统包括的所有功能结构,为开发人员设计开发和实现系统做好准备工作。经过前期的需求调查、分析和整理之后,确定的总体需求主要包括多个模块,分别是:系统用户管理、站点管理、内容管理、车辆站点管理、车辆租赁管理、车辆信息管理、取消订单管理、车辆归还管理、充值管理、车辆维修管理。系统整体角色分为二个部分,一是注册用户、二是管理员。权限分布也是很明显,游客即是无需任何验证便可浏览相关信息;注册用户以进行各种车辆的信息浏览和搜索,注册用户可以根据需要和喜欢的车辆类型进行下单租赁,用户可以查询订单是否已经被接单,订单生成后表示用户租赁成功,前台网站除了可以进行车辆的下单还可以查看新闻,进行在线留言,用户同时可以修改个人的信息资料,下单成功后用户既有了车主的身份,可以查看个人的租赁记录,进行车辆归还并进行支付,还可对车辆进行留言评价(好不好用及有没有需要维修的地方的一些信息反馈);管理员是最高权限拥有者。

系统功能结构图如下图所示。

图4-2系统功能结构图

    • 功能模块设计

用户管理模块

该模块是为所有用户登录设计的,如注册用户这种会员登录后只能进行自己的普通功能操作(如个人信息修改),管理员登录后有不同的权限,管理员不能超越权限。管理员能对整个系统的数据进行管理,主要是用户的登录权限以及用户登录后在系统里的操作权限。

个人信息模块

用户同时可以修改个人的信息资料;

车辆租赁订单模块

可以进行各种车辆的信息浏览和搜索,注册用户可以根据需要和喜欢的车辆类型进行下单租赁,用户可以查询订单是否已经被接单,订单生成后表示用户租赁成功。

校园热点新闻模块

用户点击新闻浏览菜单,点击新闻查看新闻数据、标题、内容、类别、图片。

留言信息管理模块

用户登录系统后,可在留言板进行留言,管理员在后台可以查看或搜索留言信息,同时可回复或删除留言信息。

车辆维修管理模块

车辆状态为可租赁则用户可以进行下单,状态为维修中则用户不可下单。

    • 表单字段校验处理设计

1.出错信息类型

出错信息类型包括:

A 未输入必填项;

B 应输入合法字符或数字却输入非法字符或数字;

C 对空数据表进行更改或删除操作;

D 向要求唯一值的关键字段添加重复值。

2.出错处理对策

对于错误A,系统要求用户输入非空值。

对于错误B,系统要求用户输入合法字符。

对于错误C,系统提示数据表无记录可更改或删除。

对于错误D,系统要求用户输入非重复值。

    • 系统维护设计

校园代步工具租赁系统是个现代化的高度集成的综合信息系统,系统主要服务对象为用户,最大化在页面中提供多的信息,因此在系统维护上,数据量较大,整体的维护设计如下:

(1)代码的维护:部署在云服务器上或本地服务器,通过SVN或FTP保持版本更新迭代。

(2)功能增加:功能升级在必要的前提下。

(3)数据维护:根据安全性等需求,定期对数据库进行人工备份。

    • 数据库设计

    • 概念模型

对于一个要开发的系统来说,E-R图可以让别人能更快更轻松的了解此系统的事务及它们之间的关系。根据系统分析阶段所得出的结论确定了在校园代步工具租赁系统中存在着多个实体分别是用会员、管理员、车辆、租订、客服、咨询、留言、评论。

系统总体ER图如下图所示。

图4-4系统总体ER图

    • 关系模型

管理员(管理员id、用户名、密码、权限)

用户(用户注册id、用户账号、审核状态、用户ID)

充值管理(充值管理id、用户账号、充值金额、充值时间、审核状态)

车辆信息(车辆信息id、车辆编号、颜色、状态、图片、价格、审核状态)

车辆维修(车辆维修id、车辆编号、颜色、状态、维修时间、维修原因、审核状态)

车辆租赁(车辆租赁id、车辆编号、颜色、状态、价格/天、用户账号、租赁时间、审核状态)

车辆归还(车辆归还id、车辆编号、颜色、状态、用户账号、归还时间、天数、审核状态)

车辆站点(车辆站点id、站点编号、站点地名、车辆数量、图片、点击数、点赞数、审核状态)

    • 数据表

数据库逻辑结构就是将E-R图在数据库中用具体的字段进行描述。用字段和数据类型描述来使对象特征实体化,最后形成具有一定逻辑关系的数据库表结构。校园代步工具租赁系统所需要的部分数据结构表如下表所示。

user_registration表:

名称

类型

长度

不是null

主键

注释

user_registration_id

int

11

用户注册ID

user_account

varchar

64

用户账号

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

user_id

int

11

用户ID

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

recharge_management表:

名称

类型

长度

不是null

主键

注释

recharge_management_id

int

11

充值管理ID

user_account

int

11

用户账号

recharge_amount

int

11

充值金额

recharge_time

date

0

充值时间

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

vehicle表:

名称

类型

长度

不是null

主键

注释

vehicle_id

int

11

车辆信息ID

vehicle_number

varchar

64

车辆编号

colour

varchar

64

颜色

state

varchar

64

状态

picture

varchar

255

图片

price

varchar

64

价格

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

vehicle_maintenance表:

名称

类型

长度

不是null

主键

注释

vehicle_maintenance_id

int

11

车辆维修ID

vehicle_number

varchar

64

车辆编号

colour

varchar

64

颜色

state

varchar

64

状态

maintenance_time

date

0

维修时间

maintenance_reason

text

0

维修原因

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

vehicle_rental表:

名称

类型

长度

不是null

主键

注释

vehicle_rental_id

int

11

车辆租赁ID

vehicle_number

varchar

64

车辆编号

state

varchar

64

状态

colour

varchar

64

颜色

price

varchar

64

价格/天

user_account

int

11

用户账号

lease_time

datetime

0

租赁时间

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

vehicle_return表:

名称

类型

长度

不是null

主键

注释

vehicle_return_id

int

11

车辆归还ID

vehicle_number

varchar

64

车辆编号

colour

varchar

64

颜色

state

varchar

64

状态

user_account

int

11

用户账号

price

int

11

价格

lease_time

datetime

0

租赁时间

total_amount

varchar

64

总金额

days

int

11

天数

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

vehicle_station表:

名称

类型

长度

不是null

主键

注释

vehicle_station_id

int

11

车辆站点ID

site_number

varchar

64

站点编号

site_name

varchar

64

站点地名

number_of_vehicles

varchar

64

车辆数量

picture

varchar

255

图片

hits

int

11

点击数

praise_len

int

11

点赞数

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

    • 系统实现

    • 登录模块的实现

系统的登录窗口是用户的入口,用户只有在登录成功后才可以进入访问。通过在登录提交表单,后台处理判断是否为合法用户,进行页面跳转,进入系统中去。

登录合法性判断过程:用户输入账号和密码后,系统首先确定输入输入数据合法性,然后在login.jsp页面发送登录请求,调用登录验证方法来验证。

用户登录模块的IPO如下所示:

输入:用户名和密码。

处理:

1)检测用户输入的账号、密码是否正确及在数据库已对应存在。

2)从数据库中提取记录,并储存在本地的session中(timeout默认=30min)。

3)根据用户名,将其显示在系统首页上。

输出:是否成功的信息。

登录流程图如下所示。

图5-1登录流程图

系统登录界面如下所示。

图5-2系统登录界面

用户登录的逻辑代码如下。

/**

* 登录

* @param data

* @param httpServletRequest

* @return

*/

@PostMapping("login")

public Map<String, Object> login(@RequestBody Map<String, String> data, HttpServletRequest httpServletRequest) {

log.info("[执行登录接口]");

String username = data.get("username");

String email = data.get("email");

String phone = data.get("phone");

String password = data.get("password");

List resultList = null;

Map<String, String> map = new HashMap<>();

if(username != null && "".equals(username) == false){

map.put("username", username);

resultList = service.select(map, new HashMap<>()).getResultList();

}

else if(email != null && "".equals(email) == false){

map.put("email", email);

resultList = service.select(map, new HashMap<>()).getResultList();

}

else if(phone != null && "".equals(phone) == false){

map.put("phone", phone);

resultList = service.select(map, new HashMap<>()).getResultList();

}else{

return error(30000, "账号或密码不能为空");

}

if (resultList == null || password == null) {

return error(30000, "账号或密码不能为空");

}

//判断是否有这个用户

if (resultList.size()<=0){

return error(30000,"用户不存在");

}

User byUsername = (User) resultList.get(0);

Map<String, String> groupMap = new HashMap<>();

groupMap.put("name",byUsername.getUserGroup());

List groupList = userGroupService.select(groupMap, new HashMap<>()).getResultList();

if (groupList.size()<1){

return error(30000,"用户组不存在");

}

UserGroup userGroup = (UserGroup) groupList.get(0);

//查询用户审核状态

if (!StringUtils.isEmpty(userGroup.getSourceTable())){

String sql = "select examine_state from "+ userGroup.getSourceTable() +" WHERE user_id = " + byUsername.getUserId();

String res = String.valueOf(service.runCountSql(sql).getSingleResult());

if (res==null){

return error(30000,"用户不存在");

}

if (!res.equals("已通过")){

return error(30000,"该用户审核未通过");

}

}

//查询用户状态

if (byUsername.getState()!=1){

return error(30000,"用户非可用状态,不能登录");

}

String md5password = service.encryption(password);

if (byUsername.getPassword().equals(md5password)) {

// 存储Token到数据库

AccessToken accessToken = new AccessToken();

accessToken.setToken(UUID.randomUUID().toString().replaceAll("-", ""));

accessToken.setUser_id(byUsername.getUserId());

tokenService.save(accessToken);

// 返回用户信息

JSONObject user = JSONObject.parseObject(JSONObject.toJSONString(byUsername));

user.put("token", accessToken.getToken());

JSONObject ret = new JSONObject();

ret.put("obj",user);

return success(ret);

} else {

return error(30000, "账号或密码不正确");

}

}

    • 用户子系统模块的实现

    • 注册模块

此页面实现会员的注册,必须注册登录后才能使用系统大部分功能,用户名不允许重复如果重复将会注册失败,并弹出相应的提示,通过js实现对输入的验证。

用户注册流程图如下所示。

图5-3用户注册流程图

用户注册界面如下图所示。

图5-4用户注册界面

用户注册关键代码如下所示。

/**

* 注册

* @param user

* @return

*/

@PostMapping("register")

public Map<String, Object> signUp(@RequestBody User user) {

// 查询用户

Map<String, String> query = new HashMap<>();

query.put("username",user.getUsername());

List list = service.select(query, new HashMap<>()).getResultList();

if (list.size()>0){

return error(30000, "用户已存在");

}

user.setUserId(null);

user.setPassword(service.encryption(user.getPassword()));

service.save(user);

return success(1);

}

/**

* 用户ID:[0,8388607]用户获取其他与用户相关的数据

*/

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

@Column(name = "user_id")

private Integer userId;

/**

* 账户状态:[0,10](1可用|2异常|3已冻结|4已注销)

*/

@Basic

@Column(name = "state")

private Integer state;

/**

* 所在用户组:[0,32767]决定用户身份和权限

*/

@Basic

@Column(name = "user_group")

private String userGroup;

/**

* 上次登录时间:

*/

@Basic

@Column(name = "login_time")

private Timestamp loginTime;

/**

* 手机号码:[0,11]用户的手机号码,用于找回密码时或登录时

*/

@Basic

@Column(name = "phone")

private String phone;

/**

* 手机认证:[0,1](0未认证|1审核中|2已认证)

*/

@Basic

@Column(name = "phone_state")

private Integer phoneState;

/**

* 用户名:[0,16]用户登录时所用的账户名称

*/

@Basic

@Column(name = "username")

private String username;

/**

* 昵称:[0,16]

*/

@Basic

@Column(name = "nickname")

private String nickname;

/**

* 密码:[0,32]用户登录所需的密码,由6-16位数字或英文组成

*/

@Basic

@Column(name = "password")

private String password;

/**

* 邮箱:[0,64]用户的邮箱,用于找回密码时或登录时

*/

@Basic

@Column(name = "email")

private String email;

/**

* 邮箱认证:[0,1](0未认证|1审核中|2已认证)

*/

@Basic

@Column(name = "email_state")

private Integer emailState;

/**

* 头像地址:[0,255]

*/

@Basic

@Column(name = "avatar")

private String avatar;

/**

* 创建时间:

*/

@Basic

@Column(name = "create_time")

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

private Timestamp createTime;

@Basic

@Transient

private String code;

}

    • 车辆站点模块

车辆站点过程中,首先使用getmap(id,"xinxi"),通过车辆站点ID得到车辆站点数据,将车辆站点数据赋值给车辆站点,调用CommDAO的insert方法将车辆编号数据插入车辆数量表中,最后查看个人历史车辆数量记录,可以销毁历史出入车辆数据。

车辆站点界面如图所示。

图5-5车辆站点界面

车辆站点关键代码如下所示。

@RequestMapping(value = {"/count_group", "/count"})

public Map<String, Object> count(HttpServletRequest request) {

Query count = service.count(service.readQuery(request), service.readConfig(request));

return success(count.getResultList());

}

    • 车辆信息模块

首先使用sql语句查询出所有车辆表的数据,用户在车辆页查看车辆信息和评论信息,点击评论,跳转至评论添加页面,然后调用mysql_query($sql)方法将评论内容插入评论表中,评论管理页面则调用mysql_query($sql),返回一个List的对象,在for循环里,使用JSP得到每个List对象的数据,然后放入页面模板中。

车辆信息流程图如下所示。

图5-6车辆信息流程图

车辆信息界面如图所示。

图5-7车辆信息界面

车辆信息管理界面如图所示。

图5-8车辆信息管理界面

    • 车辆租赁模块

车辆租赁过程中,首先通过车辆ID得到车辆数据,将车辆数据赋值给车辆租赁,调用mysql_query($sql)方法将租订数据插入租赁表中,最后查看个人历史车辆租赁记录,可以销毁历史租赁数据。

车辆租赁流程图如下所示。

图5-9车辆租赁流程图

车辆租赁界面如图所示。

图5-10车辆租赁界面

车辆租赁管理界面如图所示。

图5-11车辆租赁管理界面

车辆租赁关键代码如下所示。

@RequestMapping("/get_list")

public Map<String, Object> getList(HttpServletRequest request) {

Map<String, Object> map = service.selectToPage(service.readQuery(request), service.readConfig(request));

return success(map);

}

    • 管理员子系统模块的实现

    • 用户管理模块

用户在yhzhgl查看用户信息,先使用sql语句查询出所有用户表的数据,然后调用mysql_query($sql),返回一个数组对象,在for循环里,将数据放入页面模板中,添加用户则将添加的用户数据封装在sql语句,中然后调用mysql_query($sql)方法将用户内容插入用户表中。

用户管理界面如下图所示。

图5-12用户管理界面

系统用户管理关键代码如下所示。

/**

* 修改密码

* @param data

* @param request

* @return

*/

@PostMapping("change_password")

public Map<String, Object> change_password(@RequestBody Map<String, String> data, HttpServletRequest request){

// 根据Token获取UserId

String token = request.getHeader("x-auth-token");

Integer userId = tokenGetUserId(token);

// 根据UserId和旧密码获取用户

Map<String, String> query = new HashMap<>();

String o_password = data.get("o_password");

query.put("user_id" ,String.valueOf(userId));

query.put("password" ,service.encryption(o_password));

Query ret = service.count(query, service.readConfig(request));

List list = ret.getResultList();

Object s = list.get(0);

int count = Integer.parseInt(list.get(0).toString());

if(count > 0){

// 修改密码

Map<String,Object> form = new HashMap<>();

form.put("password",service.encryption(data.get("password")));

service.update(query,service.readConfig(request),form);

return success(1);

}

return error(10000,"密码修改失败!");

}

    • 个人资料模块

用户点击登录填写账号信息登录后,会切换内容为“某某用户欢迎您”和历史订单,并给出注销链接。当用户登录成功后会将个人信息保存在session作用域中,点击自己的用户名时,会跳转到个人详细信息页面,由后台通过Freemarker取出session作用域中的用户信息进行动态渲染,例如,邮箱、电话号码、用户名等等。同时页面上会显示修改个人信息和修改密码的按钮,这时客户可以修改自己的登录密码以保障账号的安全性,防止被人窃取账号,通过updatePassword()实现,同时也可以根据自己的个人信息是否变动做出相应的修改,通过updateUserInfo()实现。

密码修改流程图如下所示。

图5-13密码修改流程图

密码修改关键代码如下所示。

/**

* 修改密码

* @param data

* @param request

* @return

*/

@PostMapping("change_password")

public Map<String, Object> change_password(@RequestBody Map<String, String> data, HttpServletRequest request){

// 根据Token获取UserId

String token = request.getHeader("x-auth-token");

Integer userId = tokenGetUserId(token);

// 根据UserId和旧密码获取用户

Map<String, String> query = new HashMap<>();

String o_password = data.get("o_password");

query.put("user_id" ,String.valueOf(userId));

query.put("password" ,service.encryption(o_password));

Query ret = service.count(query, service.readConfig(request));

List list = ret.getResultList();

Object s = list.get(0);

int count = Integer.parseInt(list.get(0).toString());

if(count > 0){

// 修改密码

Map<String,Object> form = new HashMap<>();

form.put("password",service.encryption(data.get("password")));

service.update(query,service.readConfig(request),form);

return success(1);

}

return error(10000,"密码修改失败!");

}

    • 车辆信息管理模块

添加车辆信息时,输入必填字段后,表现层接受传过来的车辆信息参数,再调用addCheliang方法,经过业务层到持久层的处理,完成对整个添加车辆信息的操作。addCheliang方法也和用户管理中的addUser方法类似,同时做添加和修改工作。

修改车辆信息时,选择需要修改的车辆进行修改,调用控制器的editCheliang方法,拿到该车辆原本的信息并显示到页面,管理员再对需要修改的车辆信息字段进行修改,完成后调用addCheliang方法,调用业务层的updateByKey方法,更新数据库的车辆信息表的数据。

车辆信息管理流程图如下所示。

图5-14车辆管理流程图

车辆信息添加界面如下图所示。

图5-15车辆信息添加界面

车辆信息查询界面如下图所示。

图5-16车辆信息查询界面

车辆信息添加关键代码如下所示。

@RequestMapping("/get_obj")

public Map<String, Object> obj(HttpServletRequest request) {

Query select = service.select(service.readQuery(request), service.readConfig(request));

List resultList = select.getResultList();

if (resultList.size() > 0) {

JSONObject jsonObject = new JSONObject();

jsonObject.put("obj",resultList.get(0));

return success(jsonObject);

} else {

return success(null);

}

}

public Query select(Map<String,String> query,Map<String,String> config){

StringBuffer sql = new StringBuffer("select ");

sql.append(config.get(FindConfig.FIELD) == null || "".equals(config.get(FindConfig.FIELD)) ? "*" : config.get(FindConfig.FIELD)).append(" ");

sql.append("from ").append("`").append(table).append("`").append(toWhereSql(query, "0".equals(config.get(FindConfig.LIKE))));

if (config.get(FindConfig.GROUP_BY) != null && !"".equals(config.get(FindConfig.GROUP_BY))){

sql.append("group by ").append(config.get(FindConfig.GROUP_BY)).append(" ");

}

if (config.get(FindConfig.ORDER_BY) != null && !"".equals(config.get(FindConfig.ORDER_BY))){

sql.append("order by ").append(config.get(FindConfig.ORDER_BY)).append(" ");

}

if (config.get(FindConfig.PAGE) != null && !"".equals(config.get(FindConfig.PAGE))){

int page = config.get(FindConfig.PAGE) != null && !"".equals(config.get(FindConfig.PAGE)) ? Integer.parseInt(config.get(FindConfig.PAGE)) : 1;

int limit = config.get(FindConfig.SIZE) != null && !"".equals(config.get(FindConfig.SIZE)) ? Integer.parseInt(config.get(FindConfig.SIZE)) : 10;

sql.append(" limit ").append( (page-1)*limit ).append(" , ").append(limit);

}

log.info("[{}] - 查询操作,sql: {}",table,sql);

return runEntitySql(sql.toString());

}

    • 车辆维修管理模块

车辆维修管理车辆状态为可租赁则用户可以进行下单,状态为维修中则用户不可下单。

车辆维修添加界面如下图所示。

图5-17客服添加界面

取消订单界面如下图所示。

图5-18取消订单界面

取消订单关键代码如下所示。

server:

port: 5000

servlet:

context-path: /api

spring:

datasource:

url: jdbc:mysql://127.0.0.1:3306/CS725260_20211101091736?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8

username: root

password: root

driver-class-name: com.mysql.cj.jdbc.Driver

jackson:

property-naming-strategy: CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES

default-property-inclusion: ALWAYS

time-zone: GMT+8

date-format: yyyy-MM-dd HH:mm:ss

servlet:

multipart:

max-file-size: 100MB

max-request-size: 100MB

    • 车辆归还模块

车辆归还管理,车辆编号、颜色、状态、用户账号、价格、租赁时间、总金额、天数、审核状态、智能推荐等租车审核、添加、删除。

车辆归还界面如下图所示。

图5-19车辆归还界面

    • 系统测试

    • 测试目的

在对该系统进行完详细设计和编码之后,就要对校园代步工具租赁系统的程序进行测试,检测程序是否运行无误,反复进行测试和修改,使之最后成为完整的软件,满足用户的需求,实现预期的功能。

    • 测试过程

在软件的测试过程中,通常测试人员需要针对不同的功能模块设计多种测试用例。通过测试用例能够及时发现代码业务逻辑上是否与真实的业务逻辑相对应,及时发现代码上或逻辑上的缺陷,以此来来完善系统,提高软件产品的质量,使软件具有良好的用户体验。

注册测试用例表如下所示。

表6-1注册测试用例

测试性能

新用户注册

用例目的

测试系统新用户个人信息注册功能的功能和安全性

前提条件

进入注册页面填写个人信息

输入条件

预期输出

实际情况

各项基本信息输入不完整

不允许注册,无法点击注册按钮

一致

填写已存在的用户名

系统显示出提示信息,要求重新填写

一致

两次密码输入不一致

系统显示出提示信息,要求重新填写

一致

填写的各项信息没有符合提示的长度和字符要求

系统显示出提示信息,要求重新填写

一致

胡乱填写电话号码

收不到验证码

一致

填写验证码与收到的不一致

系统显示提示信息告知用户验证码错误,不予注册

一致

登录测试用例表如下所示。

表6-2登录测试用例

测试性能

用户或操作员登录系统

用例目的

测试用户或操作员登录系统时功能是否正常

前提条件

进入用户登录页面或操作员登录页面

输入条件

预期输出

实际情况

各项信息不予填写,直接点击登陆按钮

不允许登录,提示填写账号相关信息

一致

填写错误的登录名或密码后点击登录系统

提示用户名或密码错误,要求重新填写进行登录

一致

填写与验证码信息不一致的信息

系统显示出提示信息,表明验证码错误,要求重新填写

一致

车辆租订测试用例表如下所示。

表6-3车辆租订测试用例

测试性能

用户进行租订车辆的操作

用例目的

测试用户进行租订车辆操作时,系统的功能是否正常

前提条件

用户进入车辆详情页,该车辆能够被租订

输入条件

预期输出

实际情况

用户未登录,点击租订按钮

跳转至登录页面,提示用户先进性登录

一致

正常的登录用户,点击租订按钮

系统弹出提示框,提示用户租订成功,同时该车辆的状态更改为已租订状态

一致

车辆管理测试用例表如下所示。

表6-4车辆管理测试用例

测试性能

车辆相关信息管理功能

用例目的

测试系统后台操作员对车辆相关信息进行管理的功能是否正常

前提条件

登录系统后台进入相关管理页面

输入条件

预期输出

实际情况

普通操作员登录,点击进入车辆相关信息管理的页面

提示非超级用户,权限不够,无法进入相关页面

一致

超级操作员登入,删除某个已被租订的车辆

提示该车辆删除失败

一致

点击增加车辆按钮

页面正常跳转

一致

增加车辆是,填写已存在的车辆编号

提示该编号已存在

一致

    • 测试结果

经过对此系统的测试,得出该系统足以满足用户日常需求,在功能项目和操作等方面也能满足操作员对于其他用户的管理。但是,还有很多功能有待添加,这个系统仅能满足大部分的需求,还需要对此系统的功能更进一步的完善,这样使用起来才能更加的完美。

    • 总结与展望

通过校园代步工具租赁系统的开发,本人巩固了之前学过的知识,如今将平时所学到的知识融合在设计中,在设计过程中,做了很多的准备,首先,在数据库系统的设计过程中,尤其是在数据库的工作原理、工作特点,对其深刻的讨论,与此同时,对于小型站点来说,最好服务器的选择,其次,利用所学的知识点分析所做的系统,并在此基础上设计。

目前本系统已经上线,正在试运行阶段,用户反馈良好,基本完成用户所需,试运行过程中没有出现阻断性问题,有一些不足和小问题也及时予以修正,系统上线后,为了保证数据的安全性,对系统进行了备份操作,系统备份是每两个月备份一次,数据库备份为每周备份一次,系统部署在租赁的云平台服务器中。

本次系统上线成功后,得到了用户的高度认可,但是在功能上和性能上还需做进一步的研究处理,使其有更高的性能和更好的用户体验。

系统在以后的升级过程中,需要解决一系列用户所提出的问题,例如打印过程中如何避免浏览器的兼容性问题,大量用户访问时,如何保持较高的响应速度,在系统今后的升级过程中将着重解决这些安全性问题。

参考文献

[1]周坤. 基于用户体验的校园小型代步工具设计研究[D].哈尔滨理工大学,2021.DOI:10.27063/d.cnki.ghlgu.2021.000229.

[2] Multi-million-pound funding package for school transport[J]. M2 Presswire,2020:

[3]韩思凡.基于Web的校园个人自行车租赁系统[J].卫星电视与宽带多媒体,2020(02):23-24.

[4]Ping Wanxin,Chen Yuankun,Hou Xiaoyan. Design of Campus Bicycle Rental Management System Based on SSM Framework[J]. Journal of Physics: Conference Series,2019,1314:

[5]郑立楠.浅谈共享式大学校园代步工具设计[J].南方农机,2018,49(23):183+197.

[6]刘非飞. 大学生校园代步工具动感形态设计研究[D].长春工业大学,2019.

[7]陈亦仁,闫小刚.校园代步工具造型设计[J].机械设计,2019,34(06):131.DOI:10.13841/j.cnki.jxsj.2019.06.026.

[8]季雪雯. 轻型代步工具外形的个性化设计研究[D].华中科技大学,2019.

[9]史京华. 高校校园代步工具现状分析研究[D].河北科技大学,2019.

[10]洪富艳,初慧峰.关于完善校园自助公共自行车租赁系统的几点思考[J].现代经济信息,2018(07):393-394.

[11]李靖,田昕灵.校园代步工具造型设计[J].机械设计,2018,32(11):134.DOI:10.13841/j.cnki.jxsj.2018.11.033.

[12]沈晗洋,贾倩楠,臧凤岐,石洁.校园自行车互助式租赁系统的研究与设计[J].设计,2018(21):24-25.

[13]张琪.基于校园一卡通的自行车租赁子系统分析与设计[J].软件导刊,2019,14(09):121-123.

[14]金志强,段爱华.基于B/S结构的校园自行车租赁管理系统设计——以安徽财经大学为例[J].电子世界,2019(16):192-193.

[15]刘长川. 校园自行车停放租赁系统的设计研究[D].北京理工大学,2018.

[16]黄姜磊,徐仁朝,李理想,周良新,花小林.基于校园卡的自行车租赁管理系统的设计与开发[J].数字技术与应用,2019(02):182.DOI:10.19695/j.cnki.cn12-1369.2019.02.126.

致谢

伴随着设计的完成,大学生涯也随之即将结束。大学期间是我最珍惜的时光,大学时光中学会了很多,也成长了很多,这段时光中每一段回忆都刻在脑海中。感谢一起学习,一起成长同学们,和成长过程悉心教导的老师们,非常感激有你们的陪伴。

首先感谢我的指导老师,设计的完成离不开老师的一系列指导。在毕业设计的完成过程中,老师给出了很多中肯的建议,正是由于老师一丝不苟的工作态度,我的设计才能顺利的完成。

最后,感谢在大学生涯中每一位教导我的老师,是你们教给了我丰富的知识,更教会了我遇到问题时,如何去应对并解决。谢谢你们的帮助与支持。

免费领取项目源码,请关注点赞+私聊

Guess you like

Origin blog.csdn.net/Q_3461074420/article/details/128879389