Graduation project based on Springboot online shopping system - with source code 311236

Development of Springboot online shopping system

Summary

As the use of the Internet becomes more and more widespread, in the traditional business model, people are used to purchasing all kinds of daily commodities in various merchant stores. However, in the fast-paced new era, people may not be able to spare time to buy all kinds of goods, let alone patiently choose the goods they want. Therefore, designing an online shopping system is not only to cater to the trend of e-commerce, but also a breakthrough in the traditional commodity sales industry, which can bring changes and opportunities to the traditional sales industry.

This system mainly provides users with a platform to purchase various commodities, and attracts many consumers to purchase through the price advantage, so as to realize normal operation. This article mainly uses Java language, Springboot framework, and Mysql database as the development platform. The system is developed using B/S structure to complete an online shopping system. The goal is to realize a sales-centered computer system and build a business system that organically combines user information and account numbers, and account number and order information.

Keywords: Springboot; online shopping; Mysql database

Development of springboot online shopping system

ABSTRACT

With the more and more extensive use of the Internet, in the traditional business model, people are used to buying all kinds of daily goods from various stores. However, in the fast-paced new era, people may not be able to make time for buying all kinds of goods, let alone patiently choose the goods they want. Therefore, designing an online shopping system is not only to meet the general trend of e-commerce, but also a breakthrough in the traditional commodity sales industry, which can bring changes and opportunities to the traditional sales industry.

This system is mainly to provide users with a platform to buy all kinds of goods, attract many consumers to buy through price advantage, and realize normal operation. This paper mainly uses Java language, springboot framework and MySQL database as the development platform. The system is developed with B / S structure to complete an online shopping system. The goal is to realize a sales centered computer system and build a business system with the organic combination of user information and account number, account number and order information.

Key words:Springboot;Online shopping; Mysql database

Table of contents

Abstract I

ABSTRACT II

Chapter 1 Introduction 1

1.1 Research Background 1

1.2 Research Significance 1

1.3 System Objectives 1

1.4 Structure of this paper 2

Chapter 2 Introduction to Key Technologies 3

2.1 Introduction to development environment 3

2.2 Unified Modeling Language 3

2.3 Development Technology 3

2.3.1 J2EE technology 3

2.3.2 MVC pattern 3

2.3.3 MySQL database 3

2.3.4 B/S structure 4

2.3.5 Spring boot framework 4

2.3.6 MyEclipse development tools 4

Chapter 3 System Analysis 5

3.1 Feasibility Analysis 5

3.1.1 Operational Feasibility 5

3.1.2 Technical Feasibility 5

3.1.3 Economic feasibility 5

3.2 Analysis of Functional Requirements 5

3.3 Use case analysis 6

3.4 Data Flow Analysis 7

3.5 Data Dictionary 9

Chapter 4 System Design 13

4.1 Structural Design 13

4.2 Functional Design 13

4.3 Database Design 16

4.3.1 Conceptual Design 16

4.3.2 Logic Design 19

4.3.3 Table design 19

Chapter 5 Detailed System Design 23

5.1 JavaEE connects to the database 23

5.2 Login module 23

5.3 Mall information module 25

5.4 Feedback Center Module 27

5.5 Purchasing goods module 27

5.6 System user management module 28

5.7 Mall Management Module 30

5.8 Commodity sales management module 31

5.9 Order Management Module 31

Chapter 6 System Testing 35

6.1 Test purpose 35

6.2 Test cases 35

Chapter 7 Conclusion 38

Reference 39

Thanks 40

    • introduction

1.1 Research Background

Various items are people's daily consumer goods, and the supply of items has an extremely important relationship with consumer demand. Social pressure has resulted in increasingly busy work and a stronger sense of time, simplifying affairs and facilitating consumption, making online sales gradually become the needs of socialized consumption. At the same time, due to the continuous improvement of people's living consumption quality, the consumption needs of various goods have changed from "quantity" to "quality", and the consumption and diversification of goods consumption have also become a kind of consumption demand.

Online shopping has shown a strong development momentum in today's developed countries, and it can be said to be a new force in promoting national economic growth. In contrast, online shopping in my country is still relatively lagging behind. However, after the development of recent years, more and more people realize the convenience of "ordering online and delivering goods to your door", and more and more people Also began to accept online shopping malls. According to CNNIC's "China Internet Hotspot Survey Report", 17.9% of Internet users in my country have experienced online shopping within half a year, and 29.6% of Internet users who have browsed shopping websites Over 90% of respondents who have had online shopping experience within half a year will continue to do online shopping in the future; 63.7% of netizens who have no shopping experience said they will try online shopping in the future.

Although my country's Internet is developing rapidly, the proportion of online shopping in my country is far from that of developed countries. The number of online shoppers has great potential for development and the market space is huge.

1.2 Research Significance

With the prosperity of the mobile Internet era today, the country has also released the "Internet +" strategy, which intends to use the Internet to transform various traditional industries. Through the use of information management systems and Internet platforms, the Internet and traditional industries will be deeply integrated and developed to achieve The effect of 1+1>2. The Internet strategy can be said to be the top priority of many strategies in the development of my country's current era. With the fast train of the Internet era, the digital information development of the chain shopping mall business can be said to be like a fish in water. China's computer network has been developed for decades, and the basic network has long been popularized in major cities. It can be said that Internet informatization has played a mainstay role in all aspects of retailing, life services, information services, etc.

In recent years, China's Internet has developed rapidly, and even surpassed most developed countries in the world, reaching the level of global leadership. The emergence of Zero Mobile Internet has rapidly transformed traditional industries. People can purchase food, clothing, skin care products, etc. through various online shopping malls. The online shopping system is the industry that people are most exposed to in urban life today, and the platforms of major Internet companies have a high degree of penetration. Therefore, the development of the "online shopping system" studied in this paper should conform to the needs of the times.

1.3 System Objectives

For a typical database system, especially for a network system with a particularly large data flow such as an online shopping system, it must meet the requirements of ease of use and flexible operation. The system should meet the following goals when designing

(1) It adopts the operation method of man-machine dialogue, the interface is beautiful and friendly, the information query is flexible and convenient, and the data storage is accurate, safe and reliable;

(2) Fully display all commodities, and can display the main commodities;

(3) It is convenient for customers to quickly search for product information;

(4) Users can modify their basic information at any time;

(5) Realize the function of placing an order;

(6) Customers can view their order information at any time;

(7) For the data entered by customers, the system conducts strict data inspection to eliminate human errors as much as possible;

(8) The system maximizes the ease of maintenance and operability;

(9) The system runs stably, safely and reliably.

1.4 Structure of this paper

The specific content of this paper includes: introduction, key technologies adopted by the system, system analysis, system design, system realization and system test. This paper emphatically describes the composition and structure of the system, expounds the design scheme, implementation method, development tools and related technologies of the system, and also analyzes the development process of some links. The system simulates the important modules of the system in a certain environment, which proves the usability and reliability of the system.

    • Key Technology Introduction

2.1 Development Environment Introduction

1. Software architecture scheme: B/S mode is adopted. B/S represents the system where the server is issued by the web server and the client is received by the browser. Its front desk is html language, which is interpreted by the browser. The B/S structure can be interpreted by a web server in a scripting language such as jsp, php, asp, JavaScript.

2. Operating system solution: Windows 7 (ultimate version) operating system, which is compatible with the required software, and has a good operating speed and a good interface.

3. Background database: choose Mysql. Mysql is designed to provide the highest level of security for enterprise data through features such as database encryption, more secure default settings, enhanced password policies and fine-grained permission controls, and an enhanced security model.

4. Development tools: choose Myeclipse10

5. Development language: Java language.

6. Development technology: JavaEE+html+css+js technology

2.2 Unified Modeling Language

Unified Modeling Language (UML) is a visual modeling language. Generally speaking, system developers can use UML to clearly express how they design the system, which is a manifestation of design ideas. However, UML It is used as an auxiliary tool, just like the lubricating oil of automobile bearings. UML includes a number of graphical elements that can be combined with each other for diagrams. Since UML is a language, UML has rules for combining these elements. UML provides a variety of diagrams to design design systems, such as use case diagrams and behavior diagrams commonly used in the early stage of design systems. These diagrams need to use multiple views to show a system. This group of views is called a model (Model). A UML model describes what a system needs to do. At the same time, UML provides methods for organizing and extending these diagrams.

2.3 Development Technology

2.3.1 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 [1][2].

2.3.2 MVC pattern

The MVC 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 MVC mode, the view only handles data collection, processing, and user requests, and does not include business process processing, business process It is handled by the model (Model) [3].

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 MVC is the design of the business model. A typical application example is the popular EJB model, which 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 framework for applying design models [4].

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[5][6].

2.3.3 MySQL database

The advancement of science and technology has brought many conveniences to daily life: classroom projectors use virtual imaging technology, digital cameras use photoelectric detection technology, for example, the records of goods entering and leaving warehouses in supermarkets require an information warehouse. This information warehouse is the database, and this logistics information management system also needs the support of this technology [7].

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 disadvantages, in all aspects, it is the mainstream application of users [8].

2.3.4 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 the effect of "slimming", and there is no need to consider the problem of non-stop installation of software [9].

2.3.5 Spring boot framework

Springboot is SpringMVC+Spring+Mybatis. These three frameworks have their own unique advantages, so combining them together can create a strong spark. The designer can create a web application program without consuming a lot of effort, and this program also has the characteristics of clear hierarchy, upgrade and update operations will not affect normal use, and allows multiple uses. This composite framework forms a system with complete structure, powerful functions and good structure: SpringMVC separates each plate, Spring makes development more flexible and convenient, using Mybatis allows developers to directly manipulate objects, each level of division of labor is detailed, and realizes each level The decoupling between them makes the code more flexible and streamlined. This framework enables programmers to avoid individual errors during the development period that lead to the destruction of the whole, and also to respond to new customer requirements for products in the later stage [10] [11].

2.3.6 MyEclipse Development Tools

MyEclipse is developed by Genuitec, a very powerful JavaEE integrated development environment, including: complete coding, debugging, testing and publishing functions [10], full support for JSP, Spring, CSS, JavaScript, SpringMVC, HTML, JSF, Mybatis, SQL and other technologies. In terms of architecture, the features of MyEclipse can be divided into seven categories: JavaEE model; Web development tools, EJB development tools, JavaEE project deployment services, connectors for application servers, database services, and MyEclipse integration help [11].

For each of the above functional categories, there are corresponding functional parts in MyEclipse, and they are realized through a series of plug-ins. The modular structure of MyEclipse allows it to independently expand and upgrade any one of the modules without affecting other modules. The powerful MyEclipse application development platform is not only an Eclipse plug-in, but also a powerful integrated development environment for JavaEE [12].

    • system analysis

3.1 Feasibility analysis

The system is simple to operate and easy to understand. The operation process of the online shopping system is similar to that of most e-commerce systems, which avoids the time and burden for users to learn to use the system.

3.1.1 Operation Feasibility

What this system uses is the current popular development language, that is, Java technology. At the same time, all information is displayed in the form of web pages, and the information in the system can be operated on the database in the background to achieve the effect of data update. Users only need to know basic computer operations or surf the Internet to use this system, and system administrators only need to know how to upload files and process text to operate and manage the background. The system layout is relatively simple, and the functional operation is not complicated, which fully meets the needs of the modern market. Therefore, the system is operationally feasible.

3.1.2 Technical Feasibility

This system uses Myeclipse10 development tools under the Windows7 development environment, and uses Mysql as the database management system to realize various functions of the system. Mysql is a master-slave database server, which is also the characteristic of a master-slave database server. The server itself focuses on data management and provides a consistent interface for client applications. It can improve the performance of the system and reduce its limitations.

3.1.3 Economic feasibility

This system is an online online shopping system. Customers can directly purchase goods on the system. At the same time, the price of the computer is very low, but the performance has made great progress. The development of this system can effectively improve work efficiency, reduce management costs, save management expenses, and bring a qualitative leap to the work efficiency of enterprises. Therefore, this system is completely feasible economically.

3.2 Analysis of Functional Requirements

Through this system, merchants save investment in trading venues, service quality, maintenance store miscellaneous expenses, etc., thereby reducing prices; on the part of buyers, not only saves time and cost, but also reduces purchase costs, and can "shop around Three "freely select cost-effective products. Accelerate the speed of transactions and currency circulation, which in turn promotes economic growth.

According to the requirements of the conditions, the system structure is mainly composed of two major users. One is the user and the other is the administrator user.

1 User login and identity requirements

Verify user information for buyers, admins, etc.

2 Functional requirements for sales of this system (for buyers and users)

Users are allowed to complain about the problems of the products online.

Allow users to review items.

Allow users to query product information.

Allows users to manage purchase orders.

Automatically generate orders.

The user pays for the order online.

Select the product, make a purchase, and fill in the shipping address, contact number and other information.

3 system management function requirements (for administrator users)

Feedback center management (add, delete, modify, query).

Management of user orders (delete, modify, query).

Management of mall centers (delete, modify, query).

Management of the mall list (delete, modify, query).

Management of sales information (adding, deleting, modifying commodity categories).

3.3 Use case analysis

1. The administrator is mainly responsible for system management, mall management, order management, user information management, and sales management. The following figure describes the use case of the administrator.

Figure 3-1 Administrator use case diagram

2. Users mainly use the online purchase service of the system. The following figure shows the user use case diagram.

Figure 3-2 User use case diagram

3.4 Data Flow Analysis

The design of the data flow diagram is mainly due to the fact that the current function of the system has not yet been determined. It is possible to describe the functional content that may be used first, and to learn from the user information such as "what data the system receives from the outside world" and "what data the system sends to the outside world". Design a data flow diagram based on the answers given by the user.

The following is the 0-layer data flow diagram of the system. System users are divided into administrators and ordinary users.

Figure 3-4 System data flow diagram (layer 0)

The following figure shows the data flow diagram of the system layer 1.

Figure 3-5 System data flow diagram (layer 1)

The data flow diagram of the second layer of the online shopping system mainly reflects the principle of interaction between the operation and data of each functional module in detail. And it shows in more detail the data flow direction of each role's operation on the functional modules, so that developers can understand the development direction of the system and can develop a system model more accurately.

The product information maintenance is refined to obtain the second-layer data flow chart of product information management, as shown in the figure below.

Figure 3-6 Commodity management data flow diagram (2 layers)

Refine the order information management to obtain the second-layer data flow chart of order information management, as shown in the figure below.

Figure 3-7 Order management data flow diagram (2 layers)

3.5 Data Dictionary

1. Data storage description

The following table describes the data flow, data source, data destination and data flow of user information.

Table 3-1 User information description

data flow

User Info

data stream source

User information table and user detailed information table in Mysql database

where the data goes

System interface, user information management interface

data stream composition

Username, user password, adding time, serial number

The following table describes the data flow, data source, data destination, and data flow of the purchase order information.

Table 3-2 Description of purchase order information

data flow

purchase order information

data stream source

Purchase order table and purchase order details table in Mysql database

where the data goes

purchase order interface

data stream composition

Purchase order ID, user ID, product ID, quantity

The following table describes the data flow, data source, data destination, and data flow of order information.

Table 3-3 Description of order information

data flow

order information

data stream source

Order table and order details table in Mysql database

where the data goes

User order interface, order management interface

data stream composition

User ID, order ID, product ID, order time, order amount

下表描述了商品分类的数据流、数据来源、数据去向和数据流组成的词条。

表3-4商品分类信息描述

数据流

商品分类信息

数据流来源

Mysql数据库中商品分类表、商品详情表

数据去向

商品详情界面、购买订单界面、商品分类管理界面

数据流组成

商品分类名

下表描述了商品管理的数据流、数据来源、数据去向和数据流组成的词条。

表3-5商品信息描述

数据流

商品信息

数据流来源

Mysql数据库中商品表、商品类别表

数据去向

商品查询界面、商品详情界面、购买订单界面、商品管理界面

数据流组成

商品名、商品价格、库存数量、商品类别

2.数据处理描述

下表描述用户通过输入用户名和密码进行身份验证处理,验证成功后将返回的信息显示在界面上。

表3-6用户身份验证

处理逻辑名称

用户身份验证

简述

检查输入信息的合法性

输入的数据流

用户名+密码

处理过程

根据输入的用户名和密码,检索用户,显示查询信息

输出的数据流

用户信息、商品信息

下表描述用户成功登录系统后通过商品名查询商品信息,根据查询后返回的数据显示在界面上。

表3-7商品信息查询

处理逻辑名称

商品信息查询

简述

检查输入信息的合法性

输入的数据流

商品名或商品编号或商品类别

处理过程

登录成功的用户,通过商品名查询用户所需的商品,还可查询用户的订单及评论。

输出的数据流

用户订单信息,购买订单信息

下表描述管理员用户成功登录系统后,购买商品,填写订单收货人、收货地址、联系电话等,生成购买订单后,重新查询订单表,返回的订单数据显示在界面上。

表3-9订单生成

处理逻辑名称

订单生成

简述

检查输入信息的合法性

输入的数据流

订单信息

处理过程

登录成功的用户,往数据库添加一条订单信息数据。

输出的数据流

订单信息

下表描述用户成功登录系统后可以提交反馈信息,返回的反馈中心数据显示在界面上。

表3-10反馈中心

处理逻辑名称

反馈中心提交

简述

检查输入信息的合法性

输入的数据流

反馈内容

处理过程

登录成功的用户,进行反馈提交

输出的数据流

反馈信息

    • 系统设计

4.1结构设计

本系统的设计是基于Java技术+Mysql数据库+Tomcat服务器的方式设计,以Myeclipse10为开发工具,并运用Photoshop CS6技术美化网页,辅之以CSS技术。本系统使用的角色主要有系统管理员和普通用户,系统分为前台和后台,前台主要用于商品的展示和购买,后台用于商品信息和订单信息的管理,首先以普通用户通过账号注册后登录系统前台,可以进行各种商品的信息浏览和搜索,用户可以将需要的商品进行下单购买,用户可以查询订单是否已经被管理员确认,订单生成后表示用户购买成功,前台系统除了可以进行商品的下单还可以对商品进行收藏,进行商品反馈,用户同时可以修改个人的信息资料,查看订单信息;以管理员的身份登录系统后台可以进行商品维护、订单维护、销售信息管理等。

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

图4-1系统功能结构图

4.2功能设计

1.用户登录模块:确保用户注册信息的真实度是提高系统效率和盈利的重要因素。真实的用户才能带来价值,注册是保证真实用户使用系统主要业务的第一步,通过对用户注册信息的审核,可防止机器注册。使用现如今较为流行的管理员进行账号激活的验证方式,对用户注册信息进行过滤,未激活用户信息将不能使用系统主要功能。

如下图所示为用户登录流程图。

图4-2用户登录流程图

2.商品浏览模块:没有登录的用户和登录的用户都可以在系统前台进行商品浏览,用户可以查看商品的详细信息和选择相应的商品类别进行该类别下的商品查看,用户还可以通过商品名称的关键字进行搜索。

如下图所示为商品浏览流程图。

图4-3商品浏览流程图

3.订单管理模块:用户购买商品后,填写收货地址、收货人、电话等信息,生成订单信息,管理员可以审核订单,删除、修改订单,对订单信息进行相应的商品发货。

如下图所示为订单管理流程图。

图4-4订单管理流程图

4.商品管理模块

系统管理员可以对商品信息进行增、删、改、查的操作。

5.用户管理模块

系统管理员可以对用户信息进行增、删、改、查的操作。

6.购买订单模块

用户对个人添加至购买订单里面的商品进行增删改查等操作。

7.反馈中心管理模块

系统管理员可以对用户的反馈信息进行审核回复操作。

4.3数据库设计

4.3.1概念设计

本系统的E-R图表现了系统中各个实体之间的联系,经过分析,系统的实体有商品、商品、反馈中心、订单、用户等。

销售管理的实体图如下图所示。

图4-6销售管理实体图

商品类别实体图如下图所示。

图4-7商品类别信息实体图

用户信息实体图如下图所示。

图4-8用户信息实体图

订单管理的实体图如下图所示。

图4-9订单管理实体图

系统总体的E-R图如下图所示。

图4-10系统E-R图

4.3.2逻辑设计

Allusers表是系统用户的信息表,存储系统用户真实姓名、性别、年龄、电话、地址、备注、编号、姓名、用户密码以及其相对应的密码等相关信息。

Dingdan表是订单信息表,存储用户的订单的相关信息,其中包括编号、订单号、金额、订单内容、用户名、姓名、添加时间、是否审核等相关信息。

yonghuzhuce表是用户注册信息表,存储用户的注册信息,其中包括编号、用户名、密码、姓名、性别、出生年月、QQ、邮箱、电话、身份证、头像等相关信息。

shangpinxinxi表是商品信息表,存储商品内容的信息,其中包括编号、商品编号、商品名称、类别、价格、发布人、图片、添加时间等相关信息。

4.3.3表设计

数据库表设计:经过前期的需求分析、可执行分析、数据流分析等各个流程分析,结合软件工程的高内聚、低耦合规则,并考虑到以后的程序功能扩展,设计如下几张表。

名称

类型

长度

不是null

主键

注释

user_id

int

11

用户ID

user_name

varchar

64

用户名

gender

varchar

64

性别

age

varchar

64

年龄

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

user_id

int

11

用户ID

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

名称

类型

长度

不是null

主键

注释

mall_center_id

int

11

商城列表ID

brand

varchar

64

品牌

specifications

varchar

64

规格

recommend

int

11

智能推荐

cart_title

varchar

125

标题:

cart_img

text

0

封面图:

cart_description

varchar

255

描述:

cart_price_ago

double

8

原价

cart_price

double

8

卖价

cart_inventory

int

11

商品库存

cart_type

varchar

64

商品分类:

cart_content

longtext

0

正文

cart_img_1

text

0

主图1:

cart_img_2

text

0

主图2:

cart_img_3

text

0

主图3:

cart_img_4

text

0

主图4:

cart_img_5

text

0

主图5:

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

名称

类型

长度

不是null

主键

注释

commodity_management_id

int

11

商品管理ID

remarks

varchar

64

备注

recommend

int

11

智能推荐

cart_title

varchar

125

标题

cart_img

text

0

封面图:

cart_description

varchar

255

描述:

cart_price_ago

double

8

原价:[1]

cart_price

double

8

卖价:[1]

cart_inventory

int

11

商品库存

cart_type

varchar

64

商品分类:

cart_content

longtext

0

正文

cart_img_1

text

0

主图1:

cart_img_2

text

0

主图2:

cart_img_3

text

0

主图3:

cart_img_4

text

0

主图4:

cart_img_5

text

0

主图5:

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

名称

类型

长度

不是null

主键

注释

Feedback Center_id

int

11

反馈中心ID:

Feedback_id

smallint

5

反馈ID:

information

varchar

255

信息:

desc

varchar

255

描述:

icon

varchar

255

图标:

source_table

varchar

255

来源表:

source_field

varchar

255

来源字段:

create_time

timestamp

0

创建时间:

update_time

timestamp

0

更新时间:

名称

类型

长度

不是null

主键

注释

order_id

int

11

订单ID:

order_number

varchar

64

订单号:

goods_id

mediumint

8

商品id:

title

varchar

32

商品标题:

img

varchar

255

商品图片:

price

double

10

价格:

price_ago

double

10

原价:

num

int

8

数量:

price_count

double

8

总价:

norms

varchar

255

规格:

type

varchar

64

商品分类:

contact_name

varchar

32

联系人姓名:

contact_email

varchar

125

联系人邮箱:

contact_phone

varchar

11

联系人手机:

contact_address

varchar

255

收件地址:

postal_code

varchar

9

邮政编码:

user_id

int

10

买家ID:

merchant_id

mediumint

8

商家ID:

create_time

timestamp

0

创建时间:

update_time

timestamp

0

更新时间:

description

varchar

255

描述:

state

varchar

16

订单状态:

    • 系统详细设计

5.1登录模块

本系统主要的用户有系统管理员、用户,一个系统最基本的功能就是登录功能,本系统可以进行系统登录的角色有用户、管理员,用户对应前台登录界面,管理员对应后台登录界面,首先进入登录页,输入用户名和密码,然后提交至服务端进行数据库数据验证,通过JavaEE逻辑代码判断数据库是否存在用户输入的这一个记录,如果存在,则判断用户身份,如果是用户,则进入用户前台,如果是管理员用户,则进入系统主页,并把用户对象存放在session中,如果不存在这样一条记录,则返回登录界面。

登录界面如下所示。

图5-1前台登录界面

图5-3用户注册界面

登录关键代码如下:

/**

* 注册

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

}

5.3商城资讯模块

系统为用户提供商城资讯推荐,方便用户浏览推荐信息。在shangchenzixunlist.jsp实现商城资讯列表的展示,用户点击浏览,通过推荐id传递值,找到数据表的该商城资讯信息。

如下图所示为商城资讯界面。

图5-4商城资讯界面

商城资讯关键代码如下:

@Transactional

public Map<String, Object> addMap(Map<String,Object> map){

service.insert(map);

return success(1);

}

public Map<String,Object> readBody(BufferedReader reader){

BufferedReader br = null;

StringBuilder sb = new StringBuilder("");

try{

br = reader;

String str;

while ((str = br.readLine()) != null){

sb.append(str);

}

br.close();

String json = sb.toString();

return JSONObject.parseObject(json, Map.class);

}catch (IOException e){

e.printStackTrace();

}finally{

if (null != br){

try{

br.close();

}catch (IOException e){

e.printStackTrace();

}

}

}

return null;

}

public void insert(Map<String,Object> body){

StringBuffer sql = new StringBuffer("INSERT INTO ");

sql.append("`").append(table).append("`").append(" (");

for (Map.Entry<String,Object> entry:body.entrySet()){

sql.append("`"+humpToLine(entry.getKey())+"`").append(",");

}

sql.deleteCharAt(sql.length()-1);

sql.append(") VALUES (");

for (Map.Entry<String,Object> entry:body.entrySet()){

Object value = entry.getValue();

if (value instanceof String){

sql.append("'").append(entry.getValue()).append("'").append(",");

}else {

sql.append(entry.getValue()).append(",");

}

}

sql.deleteCharAt(sql.length() - 1);

sql.append(")");

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

Query query = runCountSql(sql.toString());

query.executeUpdate();

}

5.4反馈中心模块

系统提供反馈中心功能,在fankuizhognxinadd.jsp实现商品的反馈,添加反馈信息后,存入数据库的反馈中心表。管理员管理商品的反馈信息。

如下图所示为反馈中心的界面图。

图5-5反馈中心界面

反馈中心关键代码如下:

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

}

5.5购买商品模块

用户在浏览商品后,登录系统前台,进行商品购买,将商品添加至购物车,在个人后台可以查看购物车里面的商品,确定商品之后可以生成订单,然后支付。

如下图所示为购买商品的部分界面。

图5-6购买商品界面

5.6系统用户管理模块

过去传统的手工登记管理系统人员信息很不方便,也很容易造成数据出错,所以本系统需要一个可以管理登记人员信息的功能,管理员登入系统,可以添加新的管理员用户,删除现有的管理员,也可以对自己的密码和管理员用户的密码进行修改。修改密码是经过跟数据库的原来的密码字段的数据进行判断,如果输入两次的新密码一致,则更新密码这属性对应的一条数据。

如下图所示为系统用户管理的部分界面。

图5-7系统用户管理界面

如下图所示为修改密码界面。

图5-8修改密码界面

系统用户管理关键代码如下:

@RequestMapping("/get_obj")

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

List resultList = service.selectBaseList(service.select(service.readQuery(request), service.readConfig(request)));

if (resultList.size() > 0) {

JSONObject jsonObject = new JSONObject();

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

return success(jsonObject);

} else {

return success(null);

}

}

5.7商城管理模块

用户在系统前台浏览商城,管理员登录系统后,可以对添加、删除、修改商城信息,系统前台的商城信息时随系统后台变化而变化的。

商城管理的界面如下图所示。

图5-9商城管理界面

商城管理关键代码如下:

public Map<String, Object> error(Integer code, String message) {

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

map.put("error", new HashMap<String, Object>(4) { {

put("code", code);

put("message", message);

}});

return map;

}

5.8商品销售管理模块

管理人员可以对商品销售信息进行维护管理操作。

如下图所示为商品销售管理界面。

图5-10商品销售管理界面

商品销售管理关键代码如下:

public List selectBaseList(String select) {

List<Map<String,Object>> mapList = baseMapper.selectBaseList(select);

List<E> list = new ArrayList<>();

for (Map<String,Object> map:mapList) {

list.add(JSON.parseObject(JSON.toJSONString(map),eClass));

}

return list;

}

5.9订单管理模块

管理人员可以对订单进行增删查改的操作,这些操作将在订单管理界面进行。

如下图为订单管理界面。

图5-11订单管理界面

订单管理关键代码如下:

public class FindConfig {

public static String PAGE = "page";

public static String SIZE = "size";

public static String LIKE = "like";

public static String ORDER_BY = "orderby";

public static String FIELD = "field";

public static String GROUP_BY = "groupby";

public static String MIN_ = "_min";

public static String MAX_ = "_max";

}

    • 系统测试

6.1测试目的

该系统能够完成商品搜索,商城资讯、商品购买,反馈中心管理,销售管理,用户管理等功能,做到所开发的系统操作简单,尽量使系统操作不受用户对电脑知识水平的限制,符合系统可维护性,由于系统涉及的信息比较广,数据库中的数据需定期修改,系统可利用的空间及性能也随之下降,为了使系统更好地运转,系统可以对系统数据及一些简单的功能进行独立的维护及调整;符合系统开放性要求,该系统能够在开放的硬件体系结构中运行,并且能与其他系统顺利连接。

6.2测试用例

1.注册测试

表6-1注册测试用例

字段名称

描述

测试项

首页注册功能测试

输入数据

1、输入正确的邮箱、用户名、密码、确认密码、以及验证码之后点击“注册”按钮

2、输入错误的用户名或密码、邮箱、验证码等,单击“注册”按钮

3、不输入邮箱、用户名、密码、确认密码、以及验证码之后点击“注册”按钮

预计输出数据

1、用户能正确注册账号,成功插入数据库用户的账户资料,提示注册成功。

2、无法注册用户信息,注册失败。

3、无法注册用户信息,注册失败。

使用上述测试用例对前台首页注册界面进行测试,当在输入正确的邮箱、用户名、密码、确认密码、以及验证码之后,系统将弹出注册成功信息提示对话框。

使用上述测试用例对前台首页注册界面进行测试,当在输入错误的用户名或密码、邮箱、验证码之后,系统将提示错误。

使用上述测试用例对前台首页注册界面进行测试,当在不输入用户名、密码、邮箱、验证码之后,点击注册按钮。

2.登录界面进行测试

表6-2登录测试用例

测试项

首页登录功能测试

输入数据

1、输入正确的用户名和密码,单击“登录”按钮

2、输入错误的用户名和密码,单击“登录”按钮

3、不输入用户名和密码,单击“登录”按钮

预计输出数据

1、数据库中存在的用户能正确登录,。结果弹出主界面。

2、错误的或者无效用户登录,登录系统失败。

3、输入用户名或密码信息为空,登录系统失败。

3.商品管理进行测试

名称:用户管理测试 目的:测试商品管理界面

内容:口令的输入,合法性检查,合理性检查,界面的显示控制。

下表描述了商品表中目前所存在的记录。

表6-5商品表预存数据

商品名

商品类别

商品价格

商品状态

A

A

389

上架

B

B

249

上架

C

C

322

下架

D

D

168

上架

添加时应注意事项:

管理员添加商品时必须添加已存在的商品类别,若该商品不属于现有的所有类别,则应该先添加商品类别。

下表描述了添加商品进行测试的用例,主要是为了防止添加商品时出现异常和存在的漏洞。

表6-6添加商品测试用例

输入

输出

商品名

商品价格

商品图片

参数错误

参数错误

请选择上传图片

A

1

a.jpg

添加成功

4.购买商品测试

名称:购买商品测试 目的:测试购买商品界面

内容:口令的输入,合法性检查,合理性检查,界面的显示控制。

下表描述了购买商品的测试用例,防止购买时出错。

表6-7购买商品测试用例

输入

输出

用户ID

商品ID

商品数量

11

1

1

购买商品成功

22

电视

请填写商品数量

33

电视

a

购买失败

用户购买商品时,首先判断商品数量是否小于库存,若超出库存数量,则提示商品数量不足。

    • 结论

经过这几个月的设计和开发,“基于Springboot的网上购物系统”已经完成了,其功能符合设计需求,能够完成用户的注册、在线购买、订单信息、反馈中心管理和管理员的商城管理、订单审核、反馈信息处理、用户管理、销售管理,信息维护、查询等功能。经过最后的使用,证明系统完全具有可行性与可扩充性。

在系统的分析阶段,主要是分析系统的需求,理解系统要完成的基本功能,找出系统的用例(Use Case)和角色(Actor),画出系统的用例模型图,用例模型是此后系统建模的基础。在用例的基础上分析顺序图和协作图,得到系统的所有对象,然后建立对象模型。抽象出系统的类,并将系统中联系紧密的类划分为若干个包,画出包图。有了这些基础,就可以将系统划分为小单元功能模块。

整个过程中,我必须认可UML统一建模语言,它让我很清晰的知道自己想做什么,想实现什么,对系统后面的代码编写起到决定性的帮助,同时经过本次系统的设计与实现,让我积累了很多经验,提高了编写程序的能力,为以后的学习和工作打下了坚实的基础。

由于时间有限,本系统还有待继续完善和改进,因此需要进一步进行分析和修改,以使其更加完善!

参考文献

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

  1. 曹华山.Springboot框架在Web应用开发中的设计与实现[J].无线互联科技,2021,18(11):108-109.

  1. 程红琳. 网上商城品目扩容效果几何[N]. 中国政府采购报,2021-05-18(005).

  1. 马君峰, 农产品自营网上商城智慧平台V1.0. 甘肃省,甘肃科博科技咨询有限责任公司,2021-02-01.

[5]王娟.基于Android系统的手机网上商城设计与实现[J].电子技术与软件工程,2021(03):43-44.

[6]韩己峰.综合性网上商城引领山东政府采购驶入高速路[J].中国政府采购,2020(12):39-41.

[7]袁江琛.基于MVC框架网上商城的设计与实现[J].信息与电脑(理论版),2020,32(20):126-128.

[8]袁江琛.Ajax+jQuery在网上商城购物车模块中的设计与实现[J].电脑编程技巧与维护,2020(10):34-35+68.

[9]王柯梦,王瑞平.基于B2C网上商城前台系统数据库设计与实现[J].广西质量监督导报,2020(09):70-71.

[10]薄志强. 基于Springboot框架的网上商城系统的设计与实现[D].西安电子科技大学,2020..

[11]张浩. 基于网上商城服务对话系统的研究与实现[D].黑龙江大学,2020.

[12]孙建英.分布式、集中式、区块链技术在网上商城中的应用[J].商场现代化,2020(01):13-15.

[13]李颖,方浪,武瑞婵.“Free-Try”虚拟试衣在网上商城中的实现[J].襄阳职业技术学院学报,2019,18(06):64-66.

[14]王一凡. 基于MOT的云南移动网上商城O2O手机营销策略优化研究[D].云南大学,2019.

[15]布祉颖.论B2C和O2O的进口零食营销的模式——关于零始科技有限公司的零始网研究[J].现代妇女(下旬),2018(12):75-76.

[16]老潘,花椰菜.零食控的购物车[J].宠物世界(狗迷),2018(12):50-55.

致谢

大学的学习生活总是感觉短暂的,总感到知识还没有学够,但大学毕业就在我们面前,即毕业设计即将的结束,意味着我们的大学生涯即将结束。毕业设计是我们在大学所学知识的一次总结,更是对我们过去所学知识的提炼和升华,通过毕业设计,我们认识到大学学习过程中还有那些知识没有掌握,那些知识需要我们进入深入研究。这次毕业设计让我学到了很多新的知识,研究了一些新的以前自己不熟悉的领域,使我处理问题的能力得到了一定的提升,同时也为今后的继续深造或踏入社会大门提供了很好的锻炼机会。

我也曾经沮丧过,失落过,想放弃过,可是因为你们这不厌其烦的鼓励和支持才使得我坚持了下来,这里我要对我的老师和同学们说句“谢谢你们”。因为我们的知识是有限的,所以本文将不可避免的会出现一些错误和不足之处,还请老师指正。

点赞+收藏+关注 → 私信领取本源代码、数据库

Guess you like

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