Graduation project based on springboot train ticket sales system - with source code 211004

springboot train ticket sales system

Summary

In the information society, there is a need for targeted information acquisition channels, but the expansion of channels is basically the direction that people are striving for. Due to the deviation in their perspective, people can often obtain different types of information, which is also the most difficult technology to overcome. topic. Aiming at problems such as the train ticket sales system, the train ticket sales system is researched and analyzed, and then the train ticket sales system is developed and designed to solve the problems.

The main functional modules of the train ticket sales system include home page, site management (carousel map, bulletin board), user management (administrators, ordinary users), content management (news list, news classification list), and more management (ticket center, ticket information, Refund information, message information) system management, adopt the object-oriented development mode for software development and hardware erection, which can well meet the needs of actual use, and improve the corresponding software erection and program coding work, adopt Mysql As the main storage unit of the background data, the coding and development of the business system is carried out by using the springboot framework, Java technology, and Ajax technology, and all the functions of the system are realized. This report first analyzes the background, function and significance of the research, laying the foundation for the rationality of the research work. Analyze the various requirements and technical problems of the train ticket sales system, prove the necessity and technical feasibility of the system, then give a basic introduction to the technical software and design ideas that need to be used in the design system, and finally realize the train ticket sales System and deployment runs use it.

Keywords: train ticket sales system; springboot framework; Mysql database

Springboot train ticket selling system

Abstract

In the information society, there is a need for targeted information access, but the expansion of access is basically the direction of people's efforts. Due to the deviation of the perspective, people can often obtain different types of information, which is also the most difficult subject for technology to overcome. Aiming at the problems of train ticket sales system, this paper studies and analyzes the train ticket sales system, and then develops and designs the train ticket sales system to solve the problems.

The main functional modules of the train ticket sales system include home page, site management (rotation chart and bulletin board), user management (administrator and ordinary users), content management (news list and news classification list) and more management (Ticket Center, ticket purchase information, ticket refund information and message information) system management. The object-oriented development mode is adopted for software development and hardware erection, which can well meet the needs of actual use, The corresponding software erection and program coding are improved. MySQL is used as the main storage unit of background data, and springboot framework, Java technology and Ajax technology are used for the coding and development of business system to realize all the functions of the system. This report first analyzes the background, function and significance of the research, which lays a foundation for the rationality of the research work. Based on the analysis of various requirements and technical problems of the train ticket sales system, this paper proves the necessity and technical feasibility of the system, then makes a basic introduction to the technical software and design idea required by the design system, and finally realizes the operation and use of the train ticket sales system and departments.

Key words: train ticket selling system; Springboot framework; Mysql database

Table of contents

Chapter 1 Introduction 1

1.1 Research background and significance 1

1.2 Development status 1

Chapter 2 Introduction to Related Technologies 3

2.1 Development Technology 3

2.2 Language introduction 3

2.3 HTML web technology 3

2.4 MVVM pattern 3

2.5 Mysql database 4

Chapter 3 System Analysis 6

3.1 Feasibility analysis 6

3.2 Functional requirements analysis 6

3.2.1 Foreground user function 7

3.2.2 Background administrator function 8

3.3 Non-functional requirements analysis 8

3.4 Security Requirements Analysis 9

3.4.1 System security 9

3.4.2 Data Security 9

3.5 Data flow analysis 9

Chapter 4 System Design 11

4.1 System Architecture Design 11

4.2 Overall system design 11

4.3 System function design 12

4.4 Database Design 13

4.4.1 Data Requirements Analysis 13

4.4.2 Database conceptual design 13

4.4.3 Database table design 14

Chapter 5 System Implementation 19

5.1 Implementation of the database access layer 19

5.2 Realization of registration module 19

5.3 Implementation of login module 24

5.4 Realization of user data modification module 27

5.5 Realization of ticket information management module 28

5.6 Realization of message information module 29

Chapter 6 System Testing 31

6.1 The Importance of Software Testing 31

6.2 Research and Selection of Test Cases 31

6.3 Test environment and test conditions 32

6.4 System operation 33

6.5 Systematic evaluation 33

6.5.1 System function evaluation 33

6.5.2 System technical evaluation 33

6.5.3 Systematic economic evaluation 33

Chapter 7 Summary and Outlook 34

Reference 35

Thanks 37

  1. introduction

  1. research background and meaning

Promoting industrialization with information technology and transforming traditional industries with information technology is a strategic task that our country must complete urgently. As a product of industrial civilization, railways, how to realize the modernization of management methods, operation organizations and service standards with the help of information technology, is a major issue facing my country's railway workers.

Railway informatization is an important symbol of railway modernization. Its fundamental purpose is to apply information technology to various activities such as railway production, operation and management decision-making, transform traditional industries, improve railway productivity, improve market competitiveness, and improve economic benefits of railway operations.

Today in the 21st century, we have already entered the information age. With the rapid development of computer technology, network services have been integrated into every aspect of our lives. my country has continuously developed railway transportation in recent years, and the simple window ticketing model can no longer achieve the purpose of facilitating people's travel. More and more people choose to buy train tickets on the Internet. It is an inevitable trend of social development to develop a convenient and fast online ticket booking mode by integrating advanced network technology and computer management system.

The train ticket sales system improves work efficiency by realizing computer management of ticket information. We can use the database to store the ticketing situation of the entire railway station in the computer, and complete data access and management through rich user interfaces to meet user needs. The goal of a train station ticketing information management system is to provide timely and extensive information services, speed up the efficiency of information retrieval, live and flexible query, and reduce the burden of management personnel making reports and statistical analysis. However, due to the complexity of railway train ticket management, the design and development of this graduation project is only a tentative work, but it is very enlightening, and it can play a role in the research and development of this type of program.

  1. development status

In today's world, the scientific and technological progress with information technology as the main symbol is changing with each passing day, and the transformation of high-tech achievements into real productivity is getting faster and faster. Throughout the global economic development, information technology and the information industry have become the main drivers of economic growth and the transformation is getting faster and faster. Looking at the global economic development, information technology and the information industry have become one of the main driving forces of economic growth and are changing Traditional production and management methods and lifestyles, developed countries are changing traditional production and management methods and lifestyles through one of the driving forces of industrial structure. Developed countries have entered the stage of information economy through the upgrading of industrial structure and the transformation of economic structure . The Tenth Five-Year Plan for National Economic and Social Development adopted by the Fifth Plenary Session of the Seventeenth Central Committee of the Communist Party of China has clearly pointed out: "Informatization is the general trend of economic and social development in the world today, and it is also the key to the optimization and upgrading of China's industries and the realization of industrialization and modernization. Vigorously promoting the national economy and social informatization is a strategic measure covering the overall modernization drive. It can be seen that the party and the country have given priority to the development of national economy and social informatization, which reflects the objective requirements of advanced productive forces. It is an important strategic decision. This is an opportunity to accelerate the development of civil aviation, and it is also a rare opportunity for civil aviation informatization. With the advent of knowledge economy, human beings have gradually entered the information society, and the speed of information growth is getting faster and faster. People Hope to use advanced management theories and methods to obtain and process more and more information to improve work efficiency and management level. Due to the importance of information resources to people's lives, activities such as information collection, transmission, and utilization are continuously improved. It has increasingly become an important part of people's social life. The emergence and development of the train ticket sales system just meets people's needs.

  1. Related technology introduction

  1. Development Technology

The front-end framework of this system adopts the popular progressive JavaScript framework Vue.js. Use Vue-Router and Vuex to realize dynamic routing and global state management, Ajax to realize front-end and back-end communication, and Element UI component library to make the page quickly form. Back-end part: use springboot as the development framework, and integrate MyBatis, Redis and other related technologies at the same time.

  1. language introduction

The Java computer programming language itself is different from the traditional C++ computer programming language. It is very simple and can be learned quickly. As an object-oriented language, its main features are:

object oriented

Its basic unit is the object, and the object contains properties and methods. Properties are used to describe objects, and methods are used to manipulate objects.

cross-platform

The software program written can be run and used on any computer without limitation due to different software and hardware conditions.

Multithreading

In an application program, two or more threads can exist at the same time, and these multiple threads can run concurrently, which saves time and improves software performance at the same time.

  1. HTML web technology

HTML is a commonly used language for making web pages, and it is generally used to make static pages. Its commands can reflect text information, link information, graphic information and table information, etc. It is now widely accepted and widely used on the Internet [5].

  1. MVVM pattern

MVVM is shorthand for Model-View-ViewModel. It's essentially an improved version of MVC. MVVM is to abstract the state and behavior of the View in it, and let us separate the view UI from the business logic. Of course, ViewModel has already done these things for us. It can take out the data of Model and help deal with the business logic involved in View because of the need to display content. Microsoft's WPF brings new technical experience, such as Silverlight, audio , video , 3D , animation ..., which leads to more detailed and customizable software UI layer. At the same time, at the technical level, WPF also brings new features such as Binding, Dependency Property, Routed Events, Command, DataTemplate, and ControlTemplate. The origin of the MVVM (Model-View-ViewModel) framework is a new type of architectural framework developed and evolved from the application of the MVP (Model-View-Presenter) pattern combined with WPF . It is based on the original MVP framework and incorporates the new features of WPF to cope with the increasingly complex needs of customers.

  1. Mysql database

Mysql has been updated many times, and the functional level has been very rich and perfect. From Mysql4 version to 5 version, a relatively large update has been made, and it has achieved good practical application results in actual commercial use. The latest version of Mysql supports the compression of information, and at the same time, it can also perform encryption to better meet the needs of information security. At the same time, after multiple updates of the system, the mirroring function of the database itself has also been greatly enhanced, the smoothness of operation and ease of use have been greatly improved, and the use and creation of drivers are also more efficient and faster. The biggest change is the optimization of the display of spatial information, which makes it easier to label and calculate coordinates on the application map. The powerful backup function also ensures that users will feel more at ease during the use process, and the supported Office features also support users' self-installation and use. The display form of information has also been greatly updated, and two very useful display areas have been added, one is the information area, which has classified tables and text, and the display of the interface is more refreshing and specific. The second is the information control of the instrument, which can display information in the instrument information area and compare multiple information at the same time, which brings great convenience to the actual use of users [7][8].

In the actual implementation process of the train ticket sales system designed in this article, the main reason for choosing the Mysql database is that there will be a large number of databases that are frequently operated during the application and development of the enterprise application system, and the data security The requirements are also very high. Combining these factors, Mysql, which has a relatively high safety factor, is finally selected to store the background data of the train ticket sales system [9][10].

The overall structure diagram of the database management system is shown in the figure below.

Figure 2-1 Database structure

  1. system analysis

  1. Feasibility Analysis

In terms of technology, the current mainstream springboot framework is used to build the main framework of the system. The front desk uses jquery and ajax to realize the design and aesthetic adjustment of the front page. The above technologies are all learned systematically by myself and practiced in course design It can make development more convenient and systematic. From a technical point of view, this system is completely achievable.

In terms of practicality, the main task of this design is the ticket center, ticket purchase information, refund information, message information, system management, etc. in the train ticket sales system, which is in line with the current development trend. From the perspective of users, while also considering system operating costs and human resources, it adopts a convenient way on the Internet to realize online business, making the business process more systematic and more convenient for user experience, which is more practical.

In terms of economy, the main purpose of the train ticket sales system designed in this project is to conduct information query management and retrieval services more conveniently and quickly, that is, information software that can be directly put into use. The main cost of the system is mainly concentrated on the operation of continuous maintenance and management update of the used data in the later period. However, once the system is put into actual operation and use, it can improve the efficiency of information query and retrieval. At the same time, it is also necessary to effectively ensure the security of the information of the inquirer. At the same time, the practical application brought by this train ticket sales system The value of this aspect far exceeds the cost of developing and maintaining the actual system. Therefore, it is economically feasible to develop this software.

  1. Functional Requirements Analysis

The functions of the train ticket sales system are mainly divided into front-end users registering and logging in according to their own needs, browsing flight information and purchasing tickets for selected flights. Background system administrators are divided into ordinary administrators and super administrators due to different responsibilities. Ordinary administrators mainly process ticket purchases and on-site ticket sales by conductors, while super administrators mainly handle registered users, information data, and flight details. Information, conductor details, conductor on-site ticket sales for processing.

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-2 Administrator use case diagram

  1. front-end user function

Foreground users can be divided into unregistered user needs, registered user needs and conductor needs.

The functions for unregistered users are as follows:

Account registration: The user fills in personal information and verifies the mobile phone number.

Browse information data: Users can browse the information data on the main page to understand the latest information data of the system.

Browsing tickets: Users can browse ticket information according to the ticket type, and select a train to view details, such as: train number, arrival city, date, departure time, fare, remaining tickets, etc.

The functions for registered users are as follows:

Login: Log in according to the account password.

Maintain personal information: Users can modify their registration information at any time due to changes in personal information.

Ticket purchase information: The user selects a train to purchase a ticket according to his or her needs.

View ticket history: Users can view information about their previous ticket purchases.

  1. Background administrator function

The administrator functions are as follows:

Change password: Administrators can change their own login passwords to the system at any time to ensure system security.

Process the purchase order information: handle the purchase order review, etc.

Manage ordinary administrators: manage ordinary administrators. Ordinary administrators can be added or deleted when transferring relevant staff.

Train number information management: maintain ticket information, add, delete, and modify information.

资讯数据信息管理:发布、删除相关的资讯数据信息。

用户管理:可以查看注册用户的信息,并对其进行管理。

售票统计管理:管理员提交售票统计,提交成功后,可以查看到已提交的售票统计记录,并可以对其进行编辑更新删除等操作。

图像统计:常用的图像统计方式有柱状图、曲线图、折线图、饼状图等,本模块中以柱状图的形式来统计不同分型数据所占的情况。

  1. 非功能需求分析

首先主要考虑的是系统功能软件,在具体设计的环节上,是不是能够较好的满足各类用户的基本功能需求,如果不能较好的满足用户需求,那么这个系统的存在是没有价值的。软件系统的非功能性求分析,从7个方面展开,一个是性能分析,针对系统;一个是安全分析,针对系统,一个是完整度分析,针对系统,一个是可维护分析,针对系统,一个是可扩展性分析,针对系统,一个是适应业务的性能分析。面对火车票售卖系统存在的性能、安全、扩展、完整度等7个方面性能综合比对分析后发现,需要相应的非功能性需求分析。

  1. 安全性需求分析

  1. 系统的安全性

安全性对每一个系统来说都是非常重要的。安全性很好的系统可以保护企业的信息和用户的信息不被窃取。提高系统的安全性不仅是对用户的负责,更是对企业的负责。尤其针对于火车票售卖系统来说,必须要有很好的安全性来保障整个系统。

系统具有对使用者有权限控制,针对角色的不通限制使用者的权限,以此来确保系统的安全性。

  1. 数据的安全性

数据库中的数据是从外界输入的,当数据的输入时,由于种种原因,输入的数据会无效,或者是脏数据。因此,怎样保证输入的数据符合规定,成为了数据库系统,尤其是多用户的关系数据库系统首要关注的问题。

因此,在写入数据库时,要保证数据完整性、正确性和一致性。

  1. 数据流程分析

对系统的数据流进行分析,系统的使用者分为二类,一般用户,管理员。系统主要对界面信息传送,登录信息的验证,注册信息的接收,用户各种操作的响应做处理。

系统顶层数据流图如下图所示。

图3-2 顶层数据流图

要判断用户是是什么身份,是根据登录的数据来判断后,跳转到对应的功能界面。在系统的内部用户就可以对数据进行操作,数据库中心就可以接收到系统传输的有效数据流来对数据sql语句进行对应操作。

系统底层数据流图如下图所示。

图3-3 底层数据流图

系统可以分为前台和后台两部分,每一种操作后系统都返回操作结果。前台和后台的数据连接主要通过数据库,既分别对数据库做不同的操作。

  1. 系统设计

  1. 系统架构设计

本火车票售卖系统的架构设计主要分为可以3层,主要有Web层,业务层,Model层。其中web层还包括View层和Controller层,Model层包括元数据扩展层和数据访问层。

系统架构如下图所示。

图4-1 系统架构

  1. 系统总体设计

火车票售卖系统总体分为前台用户模块和后台管理员模块。

两个模块表现上是分别独立存在,但是访问的数据库是一样的。每一个模块的功能都是根据先前完成的需求分析,并查阅相关资料后整理制作的。

综上所述,系统功能结构图如下图所示。

图4-2 系统功能结构图

  1. 系统功能设计

登录模块:登录模块是进入系统的入口,所有用户必须登录后才能访问系统。登录需要输入用户名和密码,如果多次尝试登录需要输入验证码。登录时需要选择用户的角色,是一般用户还是管理员登录等。登录成功后,会通过数据库获取用户的权限,并跳转至用户的主页面。

管理员用户管理模块:管理员管理包括:管理员的添加,修改和删除操作。添加管理员时,先判断用户添加的管理员是否是admin(超级管理员),如果不是则添加成功。修改时候,如果是超级管理员,可以修改所有管理员的信息,如果是普通管理员,那么只能修改自己的信息。超级管理员可以删除自己以外的所有其他管理员,普通管理员不能执行删除管理员的操作。

留言信息模块:留言信息促进用户之间的交流,发表个人意见、建议、看法等,在留言板可以查看已有的留言记录,发布新留言,可以展示个人动态头像,个人匿名昵称等。

资讯数据模块:可分为资讯数据浏览、资讯数据检索、资讯数据维护三个模块,管理员对资讯数据有维护的权限,发布新的资讯数据、更新已有的资讯数据等。

车票中心管理模块:车票中心管理分为车次添加、修改和车票购票。车票信息由管理员进行修改、添加、删除操作;车票购票由普通用户来执行。

  1. 数据库设计

  1. 数据需求分析

从前面可以分析到数据库中最重要的是车票信息,购票信息,同时存在留言信息和车票退票信息。分析可以得到如下数据描述:

平台用户:用于记录用户的各种信息,包括用户名、密码、姓名、性别、地址、邮箱、联系方式等数据项。

管理员:记录管理员的登录信息。包括用户名,密码,权限等数据项。

车票:存放给车票的内容,包括火车编号、到达城市、日期、出发时间、票价、余票等数据项。

购票信息:存储用户的火车购票信息。包括火车购票的订单号、火车班次、到达城市、日期、出发时间、途径站点、票价、余票、购买数量、总价格、购票人、是否支付等数据项。

留言:存储用户的留言。包括留言内容,留言的信息,留言人,时间等数据项。

资讯数据:存储平台内的资讯数据内容。包括标题,资讯数据内容,时间等数据项。

  1. 数据库概念设计

根据前面的数据流程图,结合系统的功能模块设计,设计出符合系统的各信息实体。

系统ER图如下图所示。

图4-3 系统ER图

  1. 数据库表设计

火车票售卖系统所拥有的数据表有以下:由于数据表较多,只展示系统主要数据表,如下表所示。

comment

字段名称

类型

长度

不是null

主键

字段说明

comment_id

int

11

主键

评论ID

user_id

int

11

评论人ID

reply_to_id

int

11

回复评论ID空为0

content

longtext

0

内容

nickname

varchar

255

昵称

avatar

varchar

255

头像地址

create_time

timestamp

0

创建时间

update_time

timestamp

0

更新时间

source_table

varchar

255

来源表

source_field

varchar

255

来源字段

source_id

int

10

来源ID

message_information

字段名称

类型

长度

不是null

主键

字段说明

message_information_id

int

11

主键

留言信息ID

train_number

varchar

64

火车编号

departure_station

varchar

64

出发站

station_along_the_way

varchar

64

沿途站

terminus

varchar

64

终点站

message_user

int

11

留言用户

message_information

text

0

留言信息

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

ordinary_users

字段名称

类型

长度

不是null

主键

字段说明

ordinary_users_id

int

11

主键

普通用户ID

user_name

varchar

64

用户姓名

user_gender

varchar

64

用户性别

user_age

varchar

64

用户年龄

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

user_id

int

11

用户ID

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

refund_information

字段名称

类型

长度

不是null

主键

字段说明

refund_information_id

int

11

主键

退票信息ID

train_number

varchar

64

火车编号

departure_station

varchar

64

出发站

station_along_the_way

varchar

64

沿途站

terminus

varchar

64

终点站

departure_time

datetime

0

发车时间

seat_type

varchar

64

座位类型

seat_unit_price

varchar

64

座位单价

purchase_user

int

11

购买用户

ticket_quantity

varchar

64

购票数量

total_ticket_price

varchar

64

购票总价

ticket_purchase_instructions

text

0

购票须知

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

ticket_center

字段名称

类型

长度

不是null

主键

字段说明

ticket_center_id

int

11

主键

车票中心ID

train_number

varchar

64

火车编号

departure_station

varchar

64

出发站

station_along_the_way

varchar

64

沿途站

terminus

varchar

64

终点站

departure_time

datetime

0

发车时间

seat_type

varchar

64

座位类型

seat_unit_price

int

11

座位单价

number_of_seats

varchar

64

座位数量

remaining_quantity

varchar

64

剩余数量

train_picture

varchar

255

火车图片

ticket_purchase_instructions

text

0

购票须知

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

ticket_information

字段名称

类型

长度

不是null

主键

字段说明

ticket_information_id

int

11

主键

购票信息ID

train_number

varchar

64

火车编号

departure_station

varchar

64

出发站

station_along_the_way

varchar

64

沿途站

terminus

varchar

64

终点站

departure_time

datetime

0

发车时间

seat_type

varchar

64

座位类型

seat_unit_price

int

11

座位单价

purchase_user

int

11

购买用户

ticket_quantity

varchar

64

购票数量

total_ticket_price

varchar

64

购票总价

ticket_purchase_instructions

text

0

购票须知

pay_state

varchar

16

支付状态

pay_type

varchar

16

支付类型 微信、支付宝、网银

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

  1. 系统实现

  1. 数据库访问层的实现

该系统是通过jdbc和Mysql达成连接的,新建一个jdbc.properties文件来填写与数据库连接所需要的驱动和参数。

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

第一个参数代表Mysql数据库的驱动,第二个参数代表要连接的数据库,第三个和第四个参数代表数据库连接名和密码。

后台与数据库访问主要是通过HQL语句来进行查询的,查询语句中的表名是表格的实体类名,在这种查询语句中*是不允许使用的,除非适合聚合函数一起使用才可以。

  1. 注册模块的实现

用户在填写数据的时候必须与注册页面上的验证相匹配否则会注册失败,注册页面的表单验证是通过JavaScript进行验证的,用户名的长度必须在6到18之间,邮箱必须带有@符号,密码和密码确认必须相同,你输入的密码,系统会根据你输入密码的强度给出指定的值,电话号码和身份证号码必须要求输入格式与生活相符合,当你前台验证通过的时候你点击注册,表单会将你输入的值通过name值传递给后台并保存到数据库中。

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

图5-1用户注册流程图

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

图5-2用户注册界面

用户注册代码如下:

/**

* 注册

* @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;

}

  1. 登录模块的实现

主要由两部分组成,登录前的登录界面以及登录后的用户功能界面。登录界面,要求用户输入用户名和密码,当用户名和密码其中一个输入为空时,给出提示“用户名,密码不能为空”。获取用户名和密码后到数据库中查找,如果用户名存在,以及对应的密码正确,则登录成功,否则登录失败。登录失败后给出提示,并把焦点停在文本框中。登录成功后将该次会话的全局变量username设置为用户名。登录成功后进入会员的功能模块,主要有会员基本信息修改,已经发布航班信息管理,发布信息,和退出功能。退出功能是清除全局变量username的值,并跳回到首页。

登录流程图如下图所示。

图5-4登录流程图

用户登录界面如下图所示。

图5-5用户登录界面

用户登录代码如下:

/**

* 登录

* @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, "账号或密码不正确");

}

}

  1. 用户资料修改模块的实现

用户登录/注册成功之后可以修改自己的基本信息。修改页面的表单中每一个input的name值都要与实体类中的参数相匹配,在用户点击修改页面的时候,如果改后用户名与数据库里面重复了,页面会提示该用户名已经存在了,否则通过Id来查询用户,并将用户的信息修改为表单提交的数据。

  1. 车票信息管理模块的实现

如果资讯数据的信息需要修改,管理员可以通过查询车票信息的基本信息来查询车票信息,查询车票信息是通过ajax技术来进行查询的,需要传递车票信息的标题、编号等参数然后在返回到该页面中,可以选中要修改或删除的那条信息,如果选中了超过一条数据,页面会挑一个窗口提醒只能选择一条数,如果没有选中数据会挑一个窗口题型必须选择一条数据。当选择确认修改的时候,后台会根据传过来的id到数据库查询,并将结果返回到修改页面中,可以在修改页面中修改刚刚选中的信息当点击确认的时候from表单会将修改的数据提交到后台并保存到数据库中,就是说如果提交的数据数据库中存在就修改,否则就保存。

车票信息展示界面如下图所示。

图5-6车票信息展示界面

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

图5-7车票信息管理界面

  1. 留言信息模块的实现

用户可以发表自己的留言。将页面session中的用户账号userId和发表留言文字框内容传入控制层LiuyanAction,调用addLiuyan方法,通过LiuyanDAOImp向数据库留言表插入,将结果返回lyb.jsp界面。

留言信息留言添加流程图如下图所示。

图5-8留言添加流程图

留言信息界面如下所示。

图5-9留言发表界面

  1. 系统测试

测试存在于软件开发进程中的最后一个阶段,它可以保证一个软件的开发质量是否符合设计者的初衷,也为程序的正式上线做了最后一道质量检测的工序。软件测试主要是控制各种条件、包括软件输出方式,使用模式和运行环境等,来评估一个系统或应用是否符合设计标准。在软件测试过程中,我们一般刻意的去制造错误和极端条件,不能仅依照正常模式允许,而是多去尝试那些意外的情况。

  1. 软件测试的重要性

只有在运行和维护阶段之前经历大量的测试的软件,才能说明它的质量是经得起检验的。最近计算机业界也都一致认为,测试应该存在于软件设计的每个阶段,因为越早发现错误,修复起来就越容易。

实际上,对于一个软件应用,错误是必然存在的,无论使用何种技术或手段,都不可能绝对的排除软件漏洞。测试是随着软件开发一同诞生的,两者是共同发展进步的。实际上,测试可以大幅度的降低维护的成本,如果一个漏洞在开发的早期就被发现,那么修复它的成本远比上线后再修复的成本要低得多。

  1. 测试实例的研究与选择

测试有白盒测试和黑盒测试两种方式。

其中,白盒测试是将软件看成一个透明的白盒子,按照程序的内部控制结构和处理技术逻辑来选定测试用例、软件系统测试的逻辑路径及过程需要进行管理测试,又称玻璃盒测试。因此白盒测试需要选择足够多的测试用例,覆盖尽可能多的代码来发现程序中的错误。

黑盒测试,也称为功能测试。它将需软件看作一个黑盒,像一个普通用户一样来模拟软件的使用流程。黑盒测试通过大量的输入边界值或错误数据,来检查是否可产生正确的输出。

本系统测试主要选择黑盒测试,少量采用白盒测试。通过测试达到以下测试目的:

1.检查各大功能模块的运行,确保其能够正确运行,并检查各页面的完整性,保证页面完整。

2.检查各个接口是否可以正确地输入和输出,保证数据流通稳定可行。

3.检查数据结构,保证其和外部接口没有访问错误,访问顺利。

4.检查原计划的性能需求有没有完成,运行流畅。

本系统的测试用例(部分):

登录部分测试用例

编号

对象

项目

操作

预期结果

结果

1

登录

登录提示

使用正确的账号密码登录

成功登录

预期结果

2

登录提示

使用正确的账号但错误的密码登录

提示密码错误

预期结果

3

登录提示

使用错误的账号登录

提示不存在账户

预期结果

4

登录提示

不输入账号,点击登录

提示输入账号

预期结果

5

登录提示

输入账号但不输入密码点击登录

提示输入密码

预期结果

6

登录入口

已登录账号,查看登录入口

不显示登录入口

预期结果

  1. 测试环境与测试条件

处理器:Inter Core I7-4710MQ四核处理器

内存:4GB

硬盘:1T

操作系统:Windows 10

数据库:MySQL

6.4系统运行情况

全部测试用例都已通过(包括但不限于以上测试用例),且不存在漏洞,实现了论文开始时所作要求。本系统运行稳定,使用流畅,可以满足用户需求。

6.5系统评价

6.5.1系统功能评价

试运行后进行系统评估,可以认为该系统达到预定的目标要求,可以满足用户的需求,也满足了系统开发前所作目标。

6.5.2系统技术评价

系统在经过大量重复测试后运行十分稳定,安全实用,功能模块已经达到预定目标所需。

6.5.3系统经济评价

在规定的时间内实现系统的大部分功能,且满足要求,节省开发成本,有助于提高科学管理水平,符合本人经济情况。

  1. 总结与展望

随着计算机互联网技术的迅猛发展,各行各业都已经实现采用计算机相关技术对日益放大的数据进行管理。该课题是火车票售卖系统为核心展开的,主要是为了实现火车票售卖系统信息化管理和用户在线购票的需求。

火车票售卖系统的开发是以Java编程语言作为基础,在Myeclipse平台上完成编码工作,系统整体为B/S架构,数据库系统使用Mysql。文中详细分析了火车票售卖系统的研究背景、研究目的和意义、开发工具和相关技术以及系统需求、系统详细设计和系统测试等等一系列内容。系统实现了火车票售卖系统所需的一些基本功能,并通过测试对这些实现的功能进行了完善,进而提高了系统整体的实用性。整个系统的开发过程中大量使用了Java相关的知识以及前端开发使用的html和javascript等,同时涉及到了很多开源框架和组件,例如后台系统中运用的MVC架构、Freemarker模板引擎等,前端运用的UI框架等。

系统投入运行时,各功能均运行正常。系统的每个界面的操作符合常规逻辑,对使用者来说操作简单,界面友好。整个系统的各个功能设计合理,体现了人性化。

但是由于自己在系统开发过程中对一些用到的相关知识和技术掌握不够牢固,再加上自身开发经验欠缺,因此系统在有些方面的功能还不够完善,考虑的不够全面,因此整个系统还有待日后逐步完善。

参考文献

[1]刘学玉.JAVA编程语言在计算机软件开发中的应用[J].电子技术与软件工程,2022(01):57-60.

[2]胡世洋,赖森林.浅论SSM框架在构建“微农”信息服务中的应用[J].电脑知识与技术,2021,17(34):4-6.DOI:10.14004/j.cnki.ckt.2021.3589.

[3]李耀,李路兰,王明宇,杨广,王伟,孙新杰.基于SSM框架的创新创业申报系统的构建——以六盘水师范学院为例[J].电脑知识与技术,2021,17(33):47-48+52.DOI:10.14004/j.cnki.ckt.2021.3317.

[4]段淑萍,王晓丽.基于Java语言的继电保护大数据管理系统设计与实现[J].电脑编程技巧与维护,2021(11):87-89.DOI:10.16184/j.cnki.comprg.2021.11.032.

[5]王宇,夏丽丽,何颖刚.基于SSM框架的高校毕业论文管理系统的设计与实现[J].电子技术与软件工程,2021(22):26-29.

[6]陈玥.基于Java语言开发的宿舍管理系统[J].信息与电脑(理论版),2021,33(21):38-40.

[7]吴迪.Java编程语言在计算机软件开发中的应用[J].信息与电脑(理论版),2021,33(20):29-31.

[8]Alessandro Midolo,Emiliano Tramontana. Refactoring Java Loops to Streams Automatically[C]//Proceedings of 2021 4th International Conference on Computer Science and Software Engineering (CSSE 2021).,2021:147-151.DOI:10.26914/c.cnkihy.2021.052091.

[9]张翔.浅谈JAVA编程语言在计算机软件开发中的应用[J].电子元器件与信息技术,2021,5(10):204-205.DOI:10.19772/j.cnki.2096-4455.2021.10.095.

[10]周游,张国华.基于SSM框架智慧养老系统设计[J].软件,2021,42(10):47-49.

[11]王江霖,黄彩霞,樊旭龙.基于SSM框架的网络资源共享平台的研究与实现[J].电脑知识与技术,2021,17(28):76-78.DOI:10.14004/j.cnki.ckt.2021.2999.

[12]蒙笑阳.基于SSM框架的室内定位导航系统[J].铁路通信信号工程技术,2021,18(09):38-42.

[13]蔡浪,刘彬.基于SSM框架的医院感染信息实时监测系统设计与实现[J].现代信息科技,2021,5(18):24-27.DOI:10.19850/j.cnki.2096-4706.2021.18.007.

[14]雷义伟,齐圣.基于C#.NET和SSM框架的通信台站动环监控系统实现技术[J].自动化技术与应用,2021,40(08):75-80.

[15]秦溧,艾青.基于SSM框架的学生生活服务平台的设计与实现[J].电脑知识与技术,2021,17(13):80-82.DOI:10.14004/j.cnki.ckt.2021.1355.

[16]Siyi Liu. Explore Java Language and Android Mobile Software Development[J]. International Journal of Frontiers in Engineering Technology,2021,3.0(2.0):

[17]Kevin Kline. The Java Language Extension for SQL Server Is Now Open Source[J]. Database Trends and Applications,2020,34(4):

[18]陈云. 基于微服务架构的火车票售卖系统的设计与实现[D].上海交通大学,2020.DOI:10.27307/d.cnki.gsjtu.2020.002881.

[19]王璐. 电子商务平台火车票售卖系统的设计与实现[D].西安电子科技大学,2018.

[20]邱鹏,万怀宇,林友芳,刘宇,姚一.基于用户行为分析的在线订票系统缓存优化策略研究[J].计算机与现代化,2017(05):92-98.

致谢

本次设计历时3个月。在这个毕业设计中,它离不开指导教师的指导,使事情基本顺利。指导老师无论是在毕业设计历经中,还是在论文做完中都给了了我特别大的助益。另1个方面,教师认真负责的工作姿态,谨慎的教学精神厚重的理论水准都使我获益匪浅。他勤恳谨慎的教学育人学习姿态也给我留下了特别特别深的感觉。我从老师那里学到了很多东西。在理论和实践中,我的技能得到了特别大的提高。在此,特向教师表示由衷的感激。

经过对该毕业设计的全部研究和开发,我的系统研发经历了从需求分析到实现详细功能,再到最终测试和维护的特殊进展。让我对系统研发有了更深层次的认识。如今我的动手本领单独处理疑惑的本领也获取到了特别大的演练学习增多,这是这次毕业设计最好的收获。

最后,在整个系统开发过程中,我周围的同学和朋友给了我很多意见,所以我很快就确认了系统的商业思想。在次,我由衷的向他们表示感激。

Guess you like

Origin blog.csdn.net/DZBS2000/article/details/128947239