(Source code attached) Springboot Handicrafts Trading Platform Computer Completion Design 11541

Summary

In the information society, there is a need for targeted ways to obtain information, but the expansion of the ways is basically the direction that people strive for. Due to deviations in the perspective, people can often obtain different types of information, which is also the most difficult problem for technology to overcome. subject. In view of the problems such as handicraft trading platform, the handicraft trading platform is researched and analyzed, and then a handicraft trading platform is developed and designed to solve the problem.

The main functional modules of the handicraft trading platform include user management, resource management, mall management, and order delivery. It adopts an object-oriented development model for software development and hardware installation, which can well meet the needs of actual use and improve the For the corresponding software construction and program coding work, MySQL is used as the main storage unit of background data, and the springboot framework, Java technology, and Ajax technology are used to code and develop the business system, realizing all the functions of this system. This report first analyzes the background, role, and significance of the research, laying the foundation for the rationality of the research work. Analyze the various needs and technical issues of the handicraft trading platform, prove the necessity and technical feasibility of the system, and 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 handicraft trading Platforms and deployments run using it.

Keywords: Java development language; springboot framework technology; handicraft trading platform

Abstract

In the information society, there is a need for targeted access to information, but the expansion of the access is basically the direction of people's efforts. Because of the deviation in the perspective, people can often obtain different types of information, which is also the most difficult subject for technology to overcome. Aiming at issues such as handicraft trading platforms, research and analysis were conducted on rival handicraft trading platforms, and then a handicraft trading platform was developed and designed to solve the problem.

The main functional modules of the handicraft trading platform include user management, resource management, mall management, and order delivery. The object-oriented development model is adopted for software development and hardware installation, which can well meet the needs of actual use, improve the corresponding software installation and program coding work, take MySQL as the main storage unit of background data, and adopt the springboot framework, Java technology Ajax technology is used to code and develop the business system, realizing all the functions of the system. This report first analyzes the background, role and significance of the research, laying a foundation for the rationality of the research work. This paper analyzes the various requirements and technical problems of the handicraft trading platform, proves the necessity and technical feasibility of the system, and then makes a basic introduction to the technical software and design ideas needed to design the system, and finally realizes the handicraft trading platform and deploys and runs it.

Key words:Java development language; Spring boot framework technology; Handicraft trading platform

Table of contents

Chapter 1 Introduction

1.1 Background and significance 

1.2 Overview of research at home and abroad 

Chapter 2 Introduction to Related Technologies

2.1 B/S architecture

2.2 Introduction to springboot framework

2.3 MySQL database

Chapter 3 System Analysis

3.1  Feasibility analysis

3.1.1  Technical feasibility

3.1.2  Economic feasibility

3.1.3  Operational feasibility

3.2  System functional requirements

3.3  System performance requirements

Chapter 4 System Design

4.1  Overall goal

4.2  Overall structural design

4.3  Function module design

4.4  Database design

4.4.1  Concept design

4.4.2  Logic design

Chapter 5 System Implementation

5.1  Implementation of login module

5.2  Implementation of user modules

5.2.1  Implementation of registration module

5.2.2 Implementation of the delivery address module 

5.2.3 Implementation of product details module 

5.2.4 Implementation of my order module 

5.3  Implementation of background module 3 0

5.3.1 Implementation of user management module 3  0

5.3.2  Implementation of password modification module 3 3

5.3.3 Implementation of announcement management module 3  4

5.3.4 Implementation of handicraft management module 3 5

5.3. 5 Implementation of order delivery management module 3 5

Chapter 6 System Testing

6.1  Test purpose

6.2  Test cases

6.2.1 Announcement Test 

6.2.2  Create data test

6.2.3  Modify data test

6.2.4  Query data test

6.3  Test results

Chapter 7 Conclusion 4 0

References 4 1

Acknowledgments

  1. introduction
    1. Background and significance

With the rapid development of society, the impact of computers is comprehensive and profound. The requirements for handicraft trading platforms are also constantly increasing, and the number of handicraft trading platform categories is increasing, making the development of handicraft trading platforms a necessary and urgent matter. The handicraft trading platform mainly uses computers to manage the information required by the handicraft trading platform to increase user choices. It also facilitates timely query and modification of user information and timely understanding of user information. The handicraft trading platform brings more convenience to users. The system cooperates with the database management system software to meet the needs of users. The application of computer technology in modern management has made computers an important tool for people to apply modern technology. It can effectively solve the problem of convenient and comprehensive acquisition of information and improve efficiency.

This handicraft trading platform mainly involves programs, databases and computer technology. Covering a wide range of knowledge can greatly improve the work efficiency of system personnel.

    1. Overview of research at home and abroad

With the continuous development of the domestic economic situation, China's Internet has entered a rare period of peak development, which has caused Chinese and foreign capitalists to turn to the Internet market. However, the unreasonable structure, shortage of personnel, and increased management needs in many management fields have made more people aware of Internet management.

In today's highly developed information, information management reform has become a more extensive and comprehensive trend. The "handicraft trading platform" is based on the Mysql database and implemented on the basis of Java's springboot programming. In order to ensure the sustainable development of China's economy, the information age is increasingly updated, and handicraft trading platforms are booming. At the same time, with the rapid development of the information society, handicraft trading platforms are faced with more and more information, so it is difficult to obtain their needs for efficient information. How to use convenient and fast methods to enable inquirers to share and trade on the vast platform It is effective in querying, storing, managing and sharing code information and trading platform information, and has important practical significance for our study, work and life. Therefore, academic circles at home and abroad have conducted in-depth and extensive research on this, and a new research field-handicraft trading platform was born.

  1. Introduction to related technologies
    1. B/S architecture

B/S architecture (browser/server) is currently the most widely used architecture, which can make system development, operation, and maintenance easy. You can use this structure when you have a database installed on your computer and a few very common browsers. The B/S structure can be directly used in the B/S system, and the B/S structure can greatly reduce the operation and maintenance of the system in practical applications. On the B/S platform, each database is independent of each other and has high security. Because the B/S architecture can clearly observe the business handled by the system, managers can make timely decisions, thereby avoiding corporate losses. The essential feature of the B/S architecture is centralized management. Users store the data generated by the system into the database to facilitate future applications, thereby meeting various needs.

The B/S model consists of three levels: a browser, a network server, and a database server. Data management adopts the presentation layer, application layer and data layer of most existing B/S systems. The Web browser is designed to meet user requirements and is an intermediate application layer used in data processing and logic processes, thus Form a distributed operating model. The logic of the B/S architecture is that the processing completed on the front end leaves the main business logic to the backend, while the front end is only responsible for a small number of requests, rendering, etc. Due to the rapid development of Internet technology, the B/S architecture makes the system accessible at any time and anywhere.

                                       

Figure 2-1 Three-layer structure diagram of B/S mode

    1. Introduction to springboot framework

The Spring framework is an open source application framework on the Java platform that provides a container with control inversion characteristics. Although the Spring framework itself has no restrictions on the programming model, its frequent use in Java applications made it so popular that it was later used as a supplement or even a substitute for the EJB (Enterprise JavaBeans) model. The Spring framework provides a series of solutions for development, such as utilizing the core features of inversion of control and implementing inversion of control through dependency injection to implement containerization of the managed object life cycle, using aspect-oriented programming for declarative transaction management, and integration A variety of persistence technologies manage data access, provide a large number of excellent web frameworks to facilitate development, and so on. The Spring framework has the Inversion of Control (IOC) feature. IOC is designed to facilitate project maintenance and testing. It provides a method for unified configuration and management of Java objects through Java's reflection mechanism. The Spring framework uses containers to manage the life cycle of objects. The container can configure objects by scanning XML files or specific Java annotations on classes. Developers can obtain objects through dependency lookup or dependency injection. Spring framework has aspect-oriented programming(AOP) framework, the Spring AOP framework is based on the proxy mode and is configurable at runtime; the AOP framework mainly modularizes cross-concerns between modules. The AOP framework of the Spring framework only provides basic AOP features. Although it cannot be compared with the AspectJ framework, it can also meet basic needs through integration with AspectJ. Transaction management, remote access and other functions under the Spring framework can be realized by using Spring AOP technology. Spring's transaction management framework brings an abstraction mechanism to the Java platform that enables local and global transactions, as well as nested transactions, to work with savepoints and in almost any environment on the Java platform. Spring integrates a variety of transaction templates. The system can configure transactions through transaction templates, XML or Java annotations, and the transaction framework integrates functions such as messaging and caching. Spring's data access framework solves common difficulties developers encounter when using databases in their applications. It not only provides support for all popular data access frameworks such as Java: JDBC, iBATS/MyBATIs, Hibernate, Java Data Objects (JDO), ApacheOJB and ApacheCayne, but can also be used with Spring's transaction management to provide data access. Flexible abstraction. The Spring framework did not initially intend to build its own Web MVC framework . During the development process, its developers believed that the separation between the presentation layer and the request processing layer of the existing StrutsWeb framework, as well as between the request processing layer and the model, was not enough, so they created SpringMVC.

    1. MySQL database

As a storage place for data, a database is a must for the project. MySQL is a very excellent relational database. The early MySQL was not owned by Oracle, but was acquired by him later. MySQL is very small, the installation package is only a few megabytes, and it is relatively easy to learn SQL language writing. The most important thing is that MySQL is also an open source software, so there is no need to pay extra. The system itself is also based on learning and summarizing the knowledge learned. Mainly, it is best to use free software as much as possible in system development, so MySQL is chosen for database management. The capacity of MySQL is also very large. It also supports the operation of sub-databases and tables, and supports distribution. Therefore, more and more small and medium-sized enterprises choose this database management tool. It is also worth mentioning that open source also has a disadvantage, that is, it is easy to be cracked and hacked, so MySQL is still used more in small and medium-sized projects.

MySQL does not require a platform, so any programmer can complete his own system development through the MySQL database and save a lot of resources. Because of its powerful features, it can be used to store data from this system.

MySQL is suitable for various applications. When we run the database, it is easy to get started. We only need to write a piece of code to complete the corresponding functions and can be used on any platform without the need for a second time. Compile. The MySQL database also has the advantages of storing data locally and allowing structured queries for easy management; MySQL is a completely networked system, and its database can be accessed from anywhere on the Internet, and it can be shared with anyone anywhere; In addition, MySQL also provides access control capabilities, which can prevent data from being used illegally. The MySQL service is stable and the development cost is low, so during the development process, the MySQL database is the most popular.

  1. system analysis
    1. Feasibility Analysis

Feasibility analysis is also to analyze whether the project's development system is valuable for development, and whether it is really necessary to improve the management system's shortcomings in information dictation. Taking the design goals and implementation process of this project's handicraft trading platform as an example, if this system is developed, it is hoped that the user's management information problem can be solved well, and if this enables the handicraft trading platform to develop the theory of maximum value, and also It can solve users' problems to a certain extent in disguised form, so the research and development system of this project is the most valuable and meaningful system. But have the R&D goals achieved the desired results, and whether the scientific research tasks have the greatest utility and value after they are realized, and whether they are equal to all total costs. Therefore, the R&D stage is essentially the stage where the R&D system can be truly designed.

      1. technical feasibility

Technical feasibility means that the identified science and technology or the science and technology in decision-making methods do not break through the boundaries of the scientific and technological resources mastered by the organization or familiar to relevant personnel. In the process of technology research, attention should be paid to comprehensively investigating various key technical issues included in the system development process, selecting mature technologies as much as possible, carefully citing advanced technologies, paying attention to specific research platforms and developers, and evaluating the effectiveness of key technologies.

Java technology is key to the design and implementation of this handicraft trading platform. Based on B/S architecture and MySQL database management, it is crucial for front-end applications and back-end database management. In order to effectively apply this program, It is necessary to maintain the characteristics of comprehensive functions, easy to understand and simple to use. When building database management, it is necessary to ensure that the data analysis information is complete, the data analysis information is stable, and the data analysis information is highly stable. In the early days, people had understanding and familiarity with the basic important knowledge points of Java. They had a brief grasp and familiarity with the MySQL database. In the early days, they had a general grasp and practice of basic courses such as software engineering testing and UML language. After By practicing the above courses, you will be able to develop, test and judge the corresponding information systems for the above courses.

Java can be combined with MySQL to develop a handicraft trading platform, which must be reasonable and effective.

      1. economic feasibility

The feasibility of implementing the national economy mainly includes two aspects: first, the potential possibility of obtaining and utilizing various resources of the national economy from a certain plan to be implemented; second, the potential possibility of achieving the overall goal of the national economic development policy; second, the potential possibility of achieving the overall goal of the national economic development policy; It refers to the economic costs and benefits obtained in order to complete a certain national economic development policy implementation plan. Since the government's financial resources are limited, each financial resource obtained and utilized from the national economic development policy implementation plan is also limited. Therefore, every public policy measure faces a competition for public financial capital. But in general, "the occupation of social and economic resources of public policy measures is directly proportional to the expected value of its policy measure goals." Of course, this also touches on a cost-efficiency question. If the total cost of a certain method is equal to the profit, it is obvious that this socioeconomic policy measure is ineffective.

The original intention of developing this project was to save money. I did it by myself and basically did not need start-up capital. In addition, the entire process of project development is a self-study process, which is a win-win result. Therefore, in summary, the R&D advantages of this project outweigh the disadvantages, which is in line with the actual development of my country's current socialist market economy.

      1. operational feasibility

The registration and login page of the handicraft trading platform is designed to be simple and easy to use. You can log in to the page through the most common page window, and use a computer to realize the login function. Therefore, users can log in as long as they usually use a computer. The R&D work environment of this operating system uses Java technology and the B/S structure. These R&D work environments make the system more complete, make the entire design more personalized, and make the user functions more concise and convenient. This management system has the advantages of easy operation, easy management, good interactivity, and is also very simple in actual operation. Therefore, this management system can also be designed commercially.

To sum up, the research and development of this equipment meets the technical, process and technical requirements, so its research and development is operable.

    1. System functional requirements

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

Table 3-1 Announcement browsing use case description

Description item

illustrate

Use case name

Announcement inquiry

Use case description

Users can view the details of the announcement

participants

user

Preconditions

The user is an ordinary user type and successfully entered the system

Postcondition

Browse successfully

main event flow

(1) Users can browse the announcement modules and announcement contents

(2) Users can click on the announcement to read the announcement in detail.

Exception event flow

e1. Report 500 error

e2. Database connection exception

Table 3-1 Personal information management use case description

Use case name

Manage and modify personal information

participants

user

describe

Users view and modify personal information

Preconditions

The user is logged into the system

Postcondition

none

event stream

(1) Users view personal information

(2) Users modify personal information

Additional information

(a) Users can change passwords

(b) Users can modify personal information, such as name, avatar, etc.

Table 3-1 Comment use case description

Use case name

Comment

participants

user

describe

User comments

Preconditions

User is logged in

Postcondition

The content of the comments does not violate the rules

event stream

(1) Enter the comment data on the comment page and submit the comment

(2) Update and display the comment board

Additional information

(a) Comment content cannot be empty

Table 3-1 Collection use case description

Use case name

collect

participants

user

describe

User adds content to favorites

Preconditions

User is logged in

Postcondition

none

event stream

(1) Add to favorites on the favorites page

(2) Update and display favorites

Additional information

none

Table 3-1 User management use case description

Description item

illustrate

Use case name

User action

Use case description

The administrator can manage users under the condition that the administrator correctly logs in to the background management.

participants

administrator

Preconditions

The administrator logs in successfully and jumps to the main background interface.

Postcondition

Successful operation

main event flow

The administrator jumps to the user management page to query user details.

Administrators can delete user information

Exception event flow

e1. Report 500 error

e2. Database connection exception

The order management use case description is shown in the table below.

Table 3-1 Order management use case description

Description item

illustrate

Use case name

Order management information operations

Use case description

Under the premise that the administrator correctly logs in to the backend management, he can manage orders, skill information and other orders.

participants

administrator

Preconditions

Administrator successfully logged in

Postcondition

Successful operation

main event flow

(1) The administrator enters the order management page and queries the order information.

(2) Administrators can add, delete and edit orders

(3) The administrator adds a new skill and jumps to the query page if the addition is successful.

Exception event flow

e1. Report 500 error

e2. Database connection exception

Table 3-1 Mall management use case description

Description item

illustrate

Use case name

Mall operation

Use case description

Under the condition that the administrator correctly logs in to the backend management, the mall orders can be managed.

participants

administrator

Preconditions

Administrator successfully logged in

Postcondition

Successful operation

main event flow

(1) The administrator enters the mall management page and queries the information mall information

(2) Administrators can delete the mall

Exception event flow

e1. Report 500 error

e2. Database connection exception

Table 3-1 Announcement management use case description

Use case name

Announcement management

participants

manager

describe

Managers provide functions such as adding, modifying, deleting, and reviewing

Preconditions

  1. Administrator successfully logs into the system
  2. Administrators can only modify and delete existing announcements

Postcondition

none

event stream

(1) Administrators view modification announcements

(2) Manager adds announcement

(3) Manager deletes announcement

Additional information

(a) If the newly added announcement does not meet the requirements, the addition will fail.

(b) If the modified announcement does not meet the requirements, the modification will fail.

Table 3-1 Order delivery management use case description

Description item

illustrate

Use case name

Order shipping operations

Use case description

Under the premise that the administrator correctly logs in to the backend management, the order shipping module can be managed.

participants

administrator

Preconditions

Administrator successfully logged in

Postcondition

Successful operation

main event flow

(1) The administrator enters the order delivery interface and queries the order delivery mall information

(2) Administrators can delete order shipments

Exception event flow

e1. Report 500 error

e2. Database connection exception

Table 3-1 Comment management use case description

Description item

illustrate

Use case name

Comment operation

Use case description

Under the condition that the administrator correctly logs in to the background management, the comment module can be managed.

participants

administrator

Preconditions

Administrator successfully logged in

Postcondition

Successful operation

main event flow

(1)管理员进入评论管理页面,查询评论商城的信息

(2)管理员可以从用户评论中删除数据

异常事件流

e1.报500错误

e2.数据库连接异常

表3-1 文件上传用例描述

用例名称

文件上传

参与者

用户

描述

用户上传文件至服务器

前置条件

用户已登录

后置条件

事件流

在文件上传页点击“上传”按钮

补充说明

    1. 系统性能需求

第一,友好界面。手工艺品交易平台开发设计,界面的友好性比较重要,满足这一要求才能体现出人性化设计特征,和用户应用系统便捷性相适应,动态的人机交互设计,用户应用系统的时候能感受到操作的便利,提高用户的体验良好感受,才能有助于将系统开采设计的作用价值充分发挥出来。

第二,稳定性要求。开发设计的手工艺品交易平台,需要保持其稳定,系统应用稳定才能有助于各项管理工作高效率完成,提升系统使用体验度。系统运行保障因外部异常造成系统崩溃,系统发生问题后数据能及时备份,第一时间恢复数据信息,保障系统良好运行。

第三,可扩展性。手工艺品交易平台的开发设计,需要满足可扩展性的要求,系统的设计需要考虑未来系统业务扩展问题,在测试不断应用下,功能需求会不断扩展,通过良好扩展性作用发挥,满足多样化的需要。

第四,满足需求。为能有效加强对大用户的需求,在开发手工艺品交易平台的过程中,要能和实际应用的需求紧密对接,保障系统的实用性。系统开发要能有前瞻性,由于管理系统建设是长期工程,不同阶段需要有先导发展蓝图以及行动纲领为指导。预见性地考虑教材订购信息管理的重要问题。系统的开发要能满足灵活性应用的需要,将系统的价值充分发挥出来。

  1. 系统设计
    1. 总体目标

手工艺品交易平台主要服务于手工艺品用户,利用网络改变传统手工艺品交易平台 模式,简化手工艺品交易平台流程,减轻传统手工艺品交易平台带来的工作负担和降低大量资源的消耗。本系统达到的目标主要有以下几点:

(1)通过简单的页面设计和便捷的功能操作,保证系统的简单性和实用性,形成良好的用户体验。

(2)本系统主要针对手工艺品交易平台需求进行设计开发,突出较强的针对性。

(3)能够具有一定的安全机制,保证用户信息的安全性。

    1. 总体结构设计

层次框图是一系列由多层矩形框架组成的树,其顶部为矩形框架,表示整个数据结构,下方的长方形立方体表示独立的数据,下方的长方形表示该数据的实际数据(不能进行分割)。由于这个架构的精炼,层级方块图描述的资料结构也愈加详尽,这个模型很好地满足了需求分析的要求。首先对最上层的信息进行分类,然后在图表中的每个路径上重复地进行优化,直至完整的数据结构被确定。

这个系统由二个模块组成,一个是管理员,另一个是用户,这二个部分看起来是独立的,实际上却是连接着数据库,每个模块都有自己的权限,唯一不同的,就是访问的方式不同。在调研资料的基础上,完成了各个模块的功能。在对上述功能进行分析的基础上,本系统提出了二个主要的模块,每个单元可划分为若干小单元。

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

                             

                  图4-2 系统功能结构图

    1. 功能模块设计

1.登录模块:

本手工艺品交易平台的用户登录涉及到三类信息的判断:第一类是用户名和密码是否为空;第二类是验证码是否录入和正确;第三类就是用户登录信息、验证码和权限是否匹配通过。在该用户登录流程对会对用户名和密码是否为空进行判断,以及验证码是否正确进行判断,只有以上的几类信息中的一种存在问题的情况下都是无法登录成功的。

2.公告管理模块:

本手工艺品交易平台 中的公告管理,管理方式都是对信息的三种基本操作:一种是完成公告信息的添加,在这里会对公告信息的录入情况来判断;一种是对公告信息的修改,另一种就是对公告信息的删除。其后两种操作都是要建立在第一种操作而生成的公告列表的基础上完成的。

3.订单发货管理模块:

本手工艺品交易平台中的订单发货管理,管理方式都是对信息的三种基本操作:一种是完成订单发货信息的添加,在这里会对订单发货信息的录入情况来判断;一种是对订单发货信息的修改,另一种就是对订单发货信息的删除。其后两种操作都是要建立在第一种操作而生成的订单发货列表的基础上完成的。

    1. 数据库设计
      1. 概念设计

借助先进的系统,ER图使其他用户可以快速轻松地了解系统的功能以及他们之间的关系。根据手工艺品交易平台分析结果,整个手工艺品交易平台包括以下各个单元:管理员,公告,用户,订单发货,地址,订单,评论等。

系统的主要实体间关系E-R图如下图所示。

总体ER图如下图所示。

图4-3 总体ER图

      1. 逻辑设计

所有系统的应用数据相互区分。一旦在相应的系统中实现,它们将与自己相应的网络和服务器通信。所以这个系统可以连接这些数据。当我们选择桥梁截面时,以下将简要介绍如何建立系统。在单击上一个按键的时候,就会自动在对话框中弹出数据源的名字,之后再单击下一个按键时,就在填写相对应的身份验证和登录信息。按照系统功能设计的特点与职能模块的分类,手工艺品交易平台 的总体设计和实施过程一共涉及到了几个资料表格。

以下就介绍了一些根据各类别主要数据库表的设计结构以及基本功能建立数据库表:

    1. 表address (收货地址:)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

address_id

int

10

0

N

Y

收货地址:

2

name

varchar

32

0

Y

N

姓名:

3

phone

varchar

13

0

Y

N

手机:

4

postcode

varchar

8

0

Y

N

邮编:

5

address

varchar

255

0

N

N

地址:

6

user_id

mediumint

8

0

N

N

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

7

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

8

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

9

default

bit

1

0

N

N

0

默认判断

    1. 表article (文章:用于内容管理系统的文章)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

article_id

mediumint

8

0

N

Y

文章id:[0,8388607]

2

title

varchar

125

0

N

Y

标题:[0,125]用于文章和html的title标签中

3

type

varchar

64

0

N

N

0

文章分类:[0,1000]用来搜索指定类型的文章

4

hits

int

10

0

N

N

0

点击数:[0,1000000000]访问这篇文章的人次

5

praise_len

int

10

0

N

N

0

点赞数

6

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

7

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

8

source

varchar

255

0

Y

N

来源:[0,255]文章的出处

9

url

varchar

255

0

Y

N

来源地址:[0,255]用于跳转到发布该文章的网站

10

tag

varchar

255

0

Y

N

标签:[0,255]用于标注文章所属相关内容,多个标签用空格隔开

11

content

longtext

2147483647

0

Y

N

正文:文章的主体内容

12

img

varchar

255

0

Y

N

封面图

13

description

text

65535

0

Y

N

文章描述

    1. 表article_type (文章分类)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

type_id

smallint

5

0

N

Y

分类ID:[0,10000]

2

display

smallint

5

0

N

N

100

显示顺序:[0,1000]决定分类显示的先后顺序

3

name

varchar

16

0

N

N

分类名称:[2,16]

4

father_id

smallint

5

0

N

N

0

上级分类ID:[0,32767]

5

description

varchar

255

0

Y

N

描述:[0,255]描述该分类的作用

6

icon

text

65535

0

Y

N

分类图标:

7

url

varchar

255

0

Y

N

外链地址:[0,255]如果该分类是跳转到其他网站的情况下,就在该URL上设置

8

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

9

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

    1. 表auth (用户权限管理)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

auth_id

int

10

0

N

Y

授权ID:

2

user_group

varchar

64

0

Y

N

用户组:

3

mod_name

varchar

64

0

Y

N

模块名:

4

table_name

varchar

64

0

Y

N

表名:

5

page_title

varchar

255

0

Y

N

页面标题:

6

path

varchar

255

0

Y

N

路由路径:

7

position

varchar

32

0

Y

N

位置:

8

mode

varchar

32

0

N

N

_blank

跳转方式:

9

add

tinyint

3

0

N

N

1

是否可增加:

10

del

tinyint

3

0

N

N

1

是否可删除:

11

set

tinyint

3

0

N

N

1

是否可修改:

12

get

tinyint

3

0

N

N

1

是否可查看:

13

field_add

text

65535

0

Y

N

添加字段:

14

field_set

text

65535

0

Y

N

修改字段:

15

field_get

text

65535

0

Y

N

查询字段:

16

table_nav_name

varchar

500

0

Y

N

跨表导航名称:

17

table_nav

varchar

500

0

Y

N

跨表导航:

18

option

text

65535

0

Y

N

配置:

19

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

20

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

    1. 表cart (购物车)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

cart_id

int

10

0

N

Y

购物车ID:

2

title

varchar

64

0

Y

N

标题:

3

img

varchar

255

0

N

N

0

图片:

4

user_id

int

10

0

N

N

0

用户ID:

5

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

6

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

7

state

int

10

0

N

N

0

状态:使用中,已失效

8

price

double

9

2

N

N

0.00

单价:

9

price_ago

double

9

2

N

N

0.00

原价:

10

price_count

double

11

2

N

N

0.00

总价:

11

num

int

10

0

N

N

1

数量:

12

goods_id

mediumint

8

0

N

N

商品id:[0,8388607]

13

type

varchar

64

0

N

N

未分类

商品分类:

14

description

varchar

255

0

Y

N

描述:[0,255]用于产品规格描述

    1. 表collect (收藏)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

collect_id

int

10

0

N

Y

收藏ID:

2

user_id

int

10

0

N

N

0

收藏人ID:

3

source_table

varchar

255

0

Y

N

来源表:

4

source_field

varchar

255

0

Y

N

来源字段:

5

source_id

int

10

0

N

N

0

来源ID:

6

title

varchar

255

0

Y

N

标题:

7

img

varchar

255

0

Y

N

封面:

8

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

9

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

    1. 表comment (评论)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

comment_id

int

10

0

N

Y

评论ID:

2

user_id

int

10

0

N

N

0

评论人ID:

3

reply_to_id

int

10

0

N

N

0

回复评论ID:空为0

4

content

longtext

2147483647

0

Y

N

内容:

5

nickname

varchar

255

0

Y

N

昵称:

6

avatar

varchar

255

0

Y

N

头像地址:[0,255]

7

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

8

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

9

source_table

varchar

255

0

Y

N

来源表:

10

source_field

varchar

255

0

Y

N

来源字段:

11

source_id

int

10

0

N

N

0

来源ID:

    1. 表goods (商品信息)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

goods_id

mediumint

8

0

N

Y

产品id:[0,8388607]

2

title

varchar

125

0

Y

N

标题:[0,125]用于产品和html的<title>标签中

3

img

text

65535

0

Y

N

封面图:用于显示于产品列表页

4

description

varchar

255

0

Y

N

描述:[0,255]用于产品规格描述

5

price_ago

double

8

2

N

N

0.00

原价:[1]

6

price

double

8

2

N

N

0.00

卖价:[1]

7

sales

int

10

0

N

N

0

销量:[0,1000000000]

8

inventory

int

10

0

N

N

0

商品库存

9

type

varchar

64

0

N

N

商品分类:

10

hits

int

10

0

N

N

0

点击量:[0,1000000000]访问这篇产品的人次

11

content

longtext

2147483647

0

Y

N

正文:产品的主体内容

12

img_1

text

65535

0

Y

N

主图1:

13

img_2

text

65535

0

Y

N

主图2:

14

img_3

text

65535

0

Y

N

主图3:

15

img_4

text

65535

0

Y

N

主图4:

16

img_5

text

65535

0

Y

N

主图5:

17

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

18

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

19

customize_field

text

65535

0

Y

N

自定义字段

20

source_table

varchar

255

0

Y

N

来源表:

21

source_field

varchar

255

0

Y

N

来源字段:

22

source_id

int

10

0

N

N

0

来源ID:

23

user_id

int

10

0

Y

N

0

添加人

    1. 表goods_type (商品类型)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

type_id

int

10

0

N

Y

商品分类ID:

2

father_id

smallint

5

0

N

N

0

上级分类ID:[0,32767]

3

name

varchar

255

0

Y

N

商品名称:

4

desc

varchar

255

0

Y

N

描述:

5

icon

varchar

255

0

Y

N

图标:

6

source_table

varchar

255

0

Y

N

来源表:

7

source_field

varchar

255

0

Y

N

来源字段:

8

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

9

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

    1. 表handicrafts (手工艺品)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

handicrafts_id

int

10

0

N

Y

手工艺品ID

2

name_of_handicraft

varchar

64

0

Y

N

手工品名称

3

texture_of_material

varchar

64

0

Y

N

材质

4

specifications

varchar

64

0

Y

N

规格

5

recommend

int

10

0

N

N

0

智能推荐

6

cart_title

varchar

125

0

Y

N

标题:[0,125]用于产品html的标签中

7

cart_img

text

65535

0

Y

N

封面图:用于显示于产品列表页

8

cart_description

varchar

255

0

Y

N

描述:[0,255]用于产品规格描述

9

cart_price_ago

double

8

2

N

N

0.00

原价:[1]

10

cart_price

double

8

2

N

N

0.00

卖价:[1]

11

cart_inventory

int

10

0

N

N

0

商品库存

12

cart_type

varchar

64

0

N

N

未分类

商品分类:

13

cart_content

longtext

2147483647

0

Y

N

正文:产品的主体内容

14

cart_img_1

text

65535

0

Y

N

主图1:

15

cart_img_2

text

65535

0

Y

N

主图2:

16

cart_img_3

text

65535

0

Y

N

主图3:

17

cart_img_4

text

65535

0

Y

N

主图4:

18

cart_img_5

text

65535

0

Y

N

主图5:

19

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

创建时间

20

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间

    1. 表hits (用户点击)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

hits_id

int

10

0

N

Y

点赞ID:

2

user_id

int

10

0

N

N

0

点赞人:

3

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

4

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

5

source_table

varchar

255

0

Y

N

来源表:

6

source_field

varchar

255

0

Y

N

来源字段:

7

source_id

int

10

0

N

N

0

来源ID:

    1. 表notice (公告)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

notice_id

mediumint

8

0

N

Y

公告id:

2

title

varchar

125

0

N

N

标题:

3

content

longtext

2147483647

0

Y

N

正文:

4

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

5

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

    1. 表order (订单)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

order_id

int

10

0

N

Y

订单ID:

2

order_number

varchar

64

0

Y

N

订单号:

3

goods_id

mediumint

8

0

N

N

商品id:[0,8388607]

4

title

varchar

32

0

Y

N

商品标题:

5

img

varchar

255

0

Y

N

商品图片:

6

price

double

10

2

N

N

0.00

价格:

7

price_ago

double

10

2

N

N

0.00

原价:

8

num

int

10

0

N

N

1

数量:

9

price_count

double

8

2

N

N

0.00

总价:

10

norms

varchar

255

0

Y

N

规格:

11

type

varchar

64

0

N

N

未分类

商品分类:

12

contact_name

varchar

32

0

Y

N

联系人姓名:

13

contact_email

varchar

125

0

Y

N

联系人邮箱:

14

contact_phone

varchar

11

0

Y

N

联系人手机:

15

contact_address

varchar

255

0

Y

N

收件地址:

16

postal_code

varchar

9

0

Y

N

邮政编码:

17

user_id

int

10

0

N

N

0

买家ID:

18

merchant_id

mediumint

8

0

N

N

0

商家ID:

19

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

20

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

21

description

varchar

255

0

Y

N

描述:[0,255]用于产品规格描述

22

state

varchar

16

0

N

N

待付款

订单状态:待付款,待发货,待签收,已签收,待退款,已退款,已拒绝,已完成

    1. 表order_shipment (订单发货)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

order_shipment_id

int

10

0

N

Y

订单发货ID

2

order_number

varchar

64

0

Y

N

订单号

3

courier_number

varchar

64

0

Y

N

快递单号

4

name_of_handicraft

varchar

64

0

Y

N

手工品名称

5

texture_of_material

varchar

64

0

Y

N

材质

6

specifications

varchar

64

0

Y

N

规格

7

user

int

10

0

Y

N

0

用户

8

purchase_quantity

varchar

64

0

Y

N

购买数量

9

consignee

varchar

64

0

Y

N

收货人

10

contact_number

varchar

64

0

Y

N

联系电话

11

shipment

varchar

64

0

Y

N

发货情况

12

recommend

int

10

0

N

N

0

智能推荐

13

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

创建时间

14

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间

    1. 表praise (点赞)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

praise_id

int

10

0

N

Y

点赞ID:

2

user_id

int

10

0

N

N

0

点赞人:

3

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

4

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

5

source_table

varchar

255

0

Y

N

来源表:

6

source_field

varchar

255

0

Y

N

来源字段:

7

source_id

int

10

0

N

N

0

来源ID:

8

status

bit

1

0

N

N

1

点赞状态:1为点赞,0已取消

    1. 表registered_users (注册用户)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

registered_users_id

int

10

0

N

Y

注册用户ID

2

user_name

varchar

64

0

Y

N

用户姓名

3

examine_state

varchar

16

0

N

N

已通过

审核状态

4

recommend

int

10

0

N

N

0

智能推荐

5

user_id

int

10

0

N

N

0

用户ID

6

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

创建时间

7

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间

表slides (轮播图)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

slides_id

int

10

0

N

Y

轮播图ID:

2

title

varchar

64

0

Y

N

标题:

3

content

varchar

255

0

Y

N

内容:

4

url

varchar

255

0

Y

N

链接:

5

img

varchar

255

0

Y

N

轮播图:

6

hits

int

10

0

N

N

0

点击量:

7

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

8

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

表upload (文件上传)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

upload_id

int

10

0

N

Y

上传ID

2

name

varchar

64

0

Y

N

文件名

3

path

varchar

255

0

Y

N

访问路径

4

file

varchar

255

0

Y

N

文件路径

5

display

varchar

255

0

Y

N

显示顺序

6

father_id

int

10

0

Y

N

0

父级ID

7

dir

varchar

255

0

Y

N

文件夹

8

type

varchar

32

0

Y

N

文件类型

表user (用户账户:用于保存用户登录信息)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

user_id

mediumint

8

0

N

Y

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

2

state

smallint

5

0

N

N

1

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

3

user_group

varchar

32

0

Y

N

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

4

login_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

上次登录时间:

5

phone

varchar

11

0

Y

N

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

6

phone_state

smallint

5

0

N

N

0

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

7

username

varchar

16

0

N

N

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

8

nickname

varchar

16

0

Y

N

昵称:[0,16]

9

password

varchar

64

0

N

N

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

10

email

varchar

64

0

Y

N

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

11

email_state

smallint

5

0

N

N

0

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

12

avatar

varchar

255

0

Y

N

头像地址:[0,255]

13

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

表user_group (用户组:用于用户前端身份和鉴权)

编号

名称

数据类型

长度

小数位

允许空值

主键

默认值

说明

1

group_id

mediumint

8

0

N

Y

用户组ID:[0,8388607]

2

display

smallint

5

0

N

N

100

显示顺序:[0,1000]

3

name

varchar

16

0

N

N

名称:[0,16]

4

description

varchar

255

0

Y

N

描述:[0,255]描述该用户组的特点或权限范围

5

source_table

varchar

255

0

Y

N

来源表:

6

source_field

varchar

255

0

Y

N

来源字段:

7

source_id

int

10

0

N

N

0

来源ID:

8

register

smallint

5

0

Y

N

0

注册位置:

9

create_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

创建时间:

10

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

更新时间:

  1. 系统实现
    1. 登录模块的实现

用户登录的验证将不再局限于登录信息和权限的匹配验证,而是另外增加了一个验证码,只有界面上所有的编辑框数据都准确的情况下才能实现登录成功。管理员的登录和前台用户登录是一样的过程,其主要就是利用权限字段来完成对用户或管理员的角色识别。

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

                                            

图5-1 用户登录流程图

登录界面如下图所示。

图5-1 登录界面

登录系统主要代码如下。

/**

     * 登录

     * @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. 用户模块的实现
      1. 注册模块的实现

系统的用户通过自行注册生成,在系统首页点击用户注册菜单,系统跳转到对应的注册页面。点击重置按钮,清空所填数据,点击注册按钮完成注册。

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

                                                   

         图5-1 用户注册流程图

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

图5-1 用户注册界面

用户注册系统主要代码如下。

/**

     * 注册

     * @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. 收货地址模块的实现

当用户点击“收货地址”右后,就回去显示出目前现有的地址,也可以添加新的地址。

收货地址界面如图所示。

图5-1 收货地址界面

      1. 商品详情模块的实现

当访客点击了任意商品后将会进入该款商品的详情界面,可以了解到该商品的图片信息、商品信息、价钱信息等,同时可以对该商品进行加购+立即购买+收藏+点赞+评论。商品信息界面如图所示。

图5-1 商品信息界面

      1. 我的订单模块的实现

当用户点击“我的订单”链接后就进入自己购买的订单的界面展示。

我的订单界面如下图所示。

图5-1 我的订单界面

    1. 后台模块的实现
      1. 用户管理模块的实现

用户通过注册了方可获得登录使用权限,此时选择注册用户选项,系统就会自动转到用户注册工作面,在注册该部分信息时系统会自动调用add函数,然后在给定的文本框中填写有关该用户的基础信息后选择确认即可完成注册。检索用户信息,在新增用户信息以后,在检索工具栏中填写对应的用户信息,系统就会将该用户有关的所有信息展示出来。

用户管理流程图如下所示。

                                          

图5-1 用户管理流程图

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

图5-1 用户管理界面

用户管理代码如下。

@PostMapping("/set")

@Transactional

    public Map<String, Object> set(HttpServletRequest request) throws IOException {

        service.update(service.readQuery(request), service.readConfig(request), service.readBody(request.getReader()));

        return success(1);

}

    public Map<String,String> readConfig(HttpServletRequest request){

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

        map.put(FindConfig.PAGE,request.getParameter(FindConfig.PAGE));

        map.put(FindConfig.SIZE,request.getParameter(FindConfig.SIZE));

        map.put(FindConfig.LIKE,request.getParameter(FindConfig.LIKE));

        map.put(FindConfig.ORDER_BY,request.getParameter(FindConfig.ORDER_BY));

        map.put(FindConfig.FIELD,request.getParameter(FindConfig.FIELD));

        map.put(FindConfig.GROUP_BY,request.getParameter(FindConfig.GROUP_BY));

        map.put(FindConfig.MAX_,request.getParameter(FindConfig.MAX_));

        map.put(FindConfig.MIN_,request.getParameter(FindConfig.MIN_));

        return map;

}

    public Map<String,String> readQuery(HttpServletRequest request){

        String queryString = request.getQueryString();

        if (queryString != null && !"".equals(queryString)) {

            String[] querys = queryString.split("&");

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

            for (String query : querys) {

                String[] q = query.split("=");

                map.put(q[0], q[1]);

            }

            map.remove(FindConfig.PAGE);

            map.remove(FindConfig.SIZE);

            map.remove(FindConfig.LIKE);

            map.remove(FindConfig.ORDER_BY);

            map.remove(FindConfig.FIELD);

            map.remove(FindConfig.GROUP_BY);

            map.remove(FindConfig.MAX_);

            map.remove(FindConfig.MIN_);

            return map;

        }else {

            return new HashMap<>();

        }

}

    @Transactional

    public void update(Map<String,String> query,Map<String,String> config,Map<String,Object> body){

        StringBuffer sql = new StringBuffer("UPDATE ").append("`").append(table).append("`").append(" SET ");

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

            Object value = entry.getValue();

            if (value instanceof String){

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

            }else {

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

            }

        }

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

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

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

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

        query1.executeUpdate();

}

    public String toWhereSql(Map<String,String> query, Boolean like) {

        if (query.size() > 0) {

            try {

                StringBuilder sql = new StringBuilder(" WHERE ");

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

                    if (entry.getKey().contains(FindConfig.MIN_)) {

                        String min = humpToLine(entry.getKey()).replace("_min", "");

                        sql.append("`"+min+"`").append(" >= '").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("' and ");

                        continue;

                    }

                    if (entry.getKey().contains(FindConfig.MAX_)) {

                        String max = humpToLine(entry.getKey()).replace("_max", "");

                        sql.append("`"+max+"`").append(" <= '").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("' and ");

                        continue;

                    }

                    if (like == true) {

                        sql.append("`"+humpToLine(entry.getKey())+"`").append(" LIKE '%").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("%'").append(" and ");

                    } else {

                        sql.append("`"+humpToLine(entry.getKey())+"`").append(" = '").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("'").append(" and ");

                    }

                }

                sql.delete(sql.length() - 4, sql.length());

                sql.append(" ");

                return sql.toString();

            } catch (UnsupportedEncodingException e) {

                log.info("拼接sql 失败:{}", e.getMessage());

            }

        }

        return "";

    }

      1. 密码修改模块的实现

用户使用该手工艺品交易平台 注册完成后,用户对登录密码有修改需求时,系统也可以提供用户修改密码权限。系统中所有的操作者能够变更自己的密码信息,执行该功能首先必须要登入系统,然后选择密码变更选项以后在给定的文本框中填写初始密码和新密码来完成修改密码的操作。在填写的时候,假如两次密码填写存在差异,那么此次密码变更操作失败,下面的图片展示的就是该板块对应的工作面。

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

                               

图5-1 密码修改流程图

密码修改界面如图所示。

图5-1 修改密码界面

修改密码代码如下所示。

 /**

     * 修改密码

     * @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,"密码修改失败!");

    }

      1. 公告管理模块的实现

在主页左侧菜单栏中点击“公告管理”按钮,再从二级目录中点击“新增公告”按钮,进入到新增公告界面。在此处公告可以添加公告的名称、价格、预约方式。

在主页左侧菜单栏中点击“公告管理”按钮,再从二级目录中点击“查询公告”按钮,进入到查询公告界面。在此处公告可以查询当前所有公告记录。

公告展示界面如下图所示。

图5-1 公告展示界面

公告管理界面如下图所示。

图5-1 公告管理界面

公告管理主要代码如下。

  @PostMapping("/add")

    @Transactional

    public Map<String, Object> add(HttpServletRequest request) throws IOException {

        service.insert(service.readBody(request.getReader()));

        return success(1);

    }

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

    }

      1. 手工艺品管理模块的实现

管理员执行手工艺品管理,并可以操作相关内容,例如添加,查看,编辑和删除。通过单击“添加手工艺品”,可以通过手工艺品添加界面添加详细信息。单击查看字段级别链接以查看有关所选字段级别的信息。然后单击“提交”跳转重返到添加页面。添加成功后的信息会载入到手工艺品查询列表中,管理员可进行编辑以及修改。

手工艺品添加流程图如下所示。

                                                  

                         

图5-1 手工艺品管理流程图

手工艺品管理如下图所示。

图5-1 手工艺品管理界面

      1. 订单发货管理模块的实现

管理员执行订单发货管理,并可以操作相关内容,例如添加,查看,编辑和删除。通过单击“添加订单发货”,可以通过订单发货添加界面添加详细信息并添加订单发货注释。单击查看字段级别链接以查看有关所选字段级别的信息。然后单击“提交”跳转重返到添加页面。添加成功后的信息会载入到订单发货查询列表中,管理员可进行编辑以及修改。

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

                                                 

图5-1 订单发货管理流程

订单发货管理界面如下图所示。

图5-1 订单发货管理界面

订单发货管理代码如下所示。

@PostMapping("/set")

@Transactional

    public Map<String, Object> set(HttpServletRequest request) throws IOException {

        service.update(service.readQuery(request), service.readConfig(request), service.readBody(request.getReader()));

        return success(1);

}

    public Map<String,String> readConfig(HttpServletRequest request){

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

        map.put(FindConfig.PAGE,request.getParameter(FindConfig.PAGE));

        map.put(FindConfig.SIZE,request.getParameter(FindConfig.SIZE));

        map.put(FindConfig.LIKE,request.getParameter(FindConfig.LIKE));

        map.put(FindConfig.ORDER_BY,request.getParameter(FindConfig.ORDER_BY));

        map.put(FindConfig.FIELD,request.getParameter(FindConfig.FIELD));

        map.put(FindConfig.GROUP_BY,request.getParameter(FindConfig.GROUP_BY));

        map.put(FindConfig.MAX_,request.getParameter(FindConfig.MAX_));

        map.put(FindConfig.MIN_,request.getParameter(FindConfig.MIN_));

        return map;

}

    public Map<String,String> readQuery(HttpServletRequest request){

        String queryString = request.getQueryString();

        if (queryString != null && !"".equals(queryString)) {

            String[] querys = queryString.split("&");

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

            for (String query : querys) {

                String[] q = query.split("=");

                map.put(q[0], q[1]);

            }

            map.remove(FindConfig.PAGE);

            map.remove(FindConfig.SIZE);

            map.remove(FindConfig.LIKE);

            map.remove(FindConfig.ORDER_BY);

            map.remove(FindConfig.FIELD);

            map.remove(FindConfig.GROUP_BY);

            map.remove(FindConfig.MAX_);

            map.remove(FindConfig.MIN_);

            return map;

        }else {

            return new HashMap<>();

        }

}

    @Transactional

    public void update(Map<String,String> query,Map<String,String> config,Map<String,Object> body){

        StringBuffer sql = new StringBuffer("UPDATE ").append("`").append(table).append("`").append(" SET ");

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

            Object value = entry.getValue();

            if (value instanceof String){

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

            }else {

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

            }

        }

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

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

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

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

        query1.executeUpdate();

}

    public String toWhereSql(Map<String,String> query, Boolean like) {

        if (query.size() > 0) {

            try {

                StringBuilder sql = new StringBuilder(" WHERE ");

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

                    if (entry.getKey().contains(FindConfig.MIN_)) {

                        String min = humpToLine(entry.getKey()).replace("_min", "");

                        sql.append("`"+min+"`").append(" >= '").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("' and ");

                        continue;

                    }

                    if (entry.getKey().contains(FindConfig.MAX_)) {

                        String max = humpToLine(entry.getKey()).replace("_max", "");

                        sql.append("`"+max+"`").append(" <= '").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("' and ");

                        continue;

                    }

                    if (like == true) {

                        sql.append("`"+humpToLine(entry.getKey())+"`").append(" LIKE '%").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("%'").append(" and ");

                    } else {

                        sql.append("`"+humpToLine(entry.getKey())+"`").append(" = '").append(URLDecoder.decode(entry.getValue(), "UTF-8")).append("'").append(" and ");

                    }

                }

                sql.delete(sql.length() - 4, sql.length());

                sql.append(" ");

                return sql.toString();

            } catch (UnsupportedEncodingException e) {

                log.info("拼接sql 失败:{}", e.getMessage());

            }

        }

        return "";

    }

  1. 系统测试
    1. 测试目的

在这个产品被投入使用前,首先需要进行试用,这是重要的环节。考虑到某个部分的开发没有缺陷情况下,把各种模块拼接,也有一定概率就存在矛盾。这就好比每个人都很独特,但聚在一起就显得杂乱无章,需要保证有默契的配合。对于测试,要看它的各项内容是否契合的原则。若与最初定下的标准有一定程度上的出入,那么就需要做出一些调整,让最终的大方向朝着目标前进。

测试是为了发现在开发的程序中所存在的问题,测试这一工作是非常艰巨的,而又是非常困难的,这一部分在程序的设计中占有很大比例,可以说一个程序的开发工作量要是占据了百分至六十,那么剩下的百分之四十必然是测试这一部分,甚至更高。

    1. 测试用例
      1. 公告测试

公告测试用例如下表所示。

表6-3 公告测试用例

测试用例编号

YL_03

测试用例名称

系统使用者进行在线交流

测试用例描述

使用者输入标题、内容等信息

系统入口

浏览器

步骤

预期结果

实际结果

输入完整的论坛标题和内容

提示“交流成功”,并进入系统

预期结果

不输入的论坛标题和内容

提示“请输入完整”

预期结果

      1. 创建数据测试 

在系统中,创建功能也是基础功能之一,因此创建功能的测试很有代表性。在此章节主要列举在创建时各种情况下系统结果的测试。由于系统涉及创建功能操作过多,因此将多处统称创建功能。

创建数据用例如下表所示。

表6-5 创建数据测试用例

测试用例编号

YL_05

测试用例名称

系统使用者进行创建数据

测试用例描述

使用者输入要创建的数据

系统入口

浏览器

步骤

预期结果

实际结果

输入完整并且格式正确的数据

提示“创建成功”,并显示所有数据

预期结果

核心位置数据但非必要位置不输入数据

提示“创建成功”,并显示所有数据

预期结果

核心数据位置不输入数据

提示“创建失败”

预期结果

      1. 修改数据测试 

在系统中,修改功能是系统主要实现功能,因此修改功能的测试很有代表性。在此章节主要列举在修改时各种情况下系统结果的测试。由于系统涉及修改功能操作过多,因此将多处数据表记录修改和状态修改统称修改功能。

修改数据用例如下表所示。

表6-6 修改数据测试用例

测试用例编号

YL_06

测试用例名称

系统使用者进行修改数据

测试用例描述

使用者对可修改的数据项进行修改

系统入口

浏览器

步骤

预期结果

实际结果

将现有数据修改成正确的数据

提示“修改成功”,并显示所有数据

预期结果

将现有数据修改成错误的数据

提示“修改失败”

预期结果

      1. 查询数据测试 

在系统中,查询功能是使用系统使用最多也是最基础的功能,因此查询功能的测试很有代表性。在此章节主要列举在查询时各种情况下系统结果的测试。

查询数据用例如下表所示。

表6-7 查询数据测试用例

测试用例编号

YL_05

测试用例名称

系统使用者进行查询数据

测试用例描述

全部查询以及输入关键词查询

系统入口

浏览器

步骤

预期结果

实际结果

界面自动查询全部

显示对应所有记录

预期结果

输入已存在且能匹配成功的关键字

显示所查询到的数据

预期结果

输入不存在的关键字

显示数据界面为空

预期结果

    1. 测试结果

在本次测试的过程主要针对所有功能下的添加操作,修改操作和删除操作,并以真实数据一一进行相关功能项目的输入,最终能够保证每个项目涉及的功能都是能够正常运行,因此能够保证本次设计的,已实现的功能能够正常运行并且相关数据库的信息也同样保证正确。

结  论

本次手工艺品交易平台利用了Web应用同现实手工艺品交易平台工作进行相结合,在系统功能开始编码之前,作者花费了大量时间在图书馆内进行资料文献的收集和总结,通过大量文献的分析,能够发现,手工艺品交易平台的方式在商城中扮演的位置是越来越重要,而使用的方式也是越来越多元化,也正是因为这个原因,作者深深的希望能够开发出一种专门针对用户的手工艺品交易平台 ,以满足用户的需求。

在本次手工艺品交易平台中,利用了目前市场上普遍使用的Java技术,以及数据库管理功能MySQL,和目前比较流行的springboot框架,最后配合使用到了VUE页面布局技术进行系统界面的布置,以现实生活的手工艺品交易平台过程为标准,设计实现了公告、公告查询、资讯浏览、地址、订单、购物车、点赞收藏、评论等功能,并维护好后台的信息和整体系统的稳定性。

但是由于作者受到了技术水平的限制,在有限的时间,只能够将系统功能模拟时的功能实现,在许多功能方面仍然存在很大的弊端,而这些弊端需要不断的测试,不断的总结,不断的改进。例如本次系统设计中,在数据储存的方面并不够全面,很容易出现信息泄露的风险;例如针对用户权限的设置同样不够全面完整,没有考虑权限在实际情况的运用是否能够完美执行。而在这之后的日子里,作者将会继续学习Java技术和相关的信息技术,对系统功能进行更加完整的,详细的分析,将系统功能一一进行完善,帮助使用者完成相应的操作。

参考文献

[1]娄晓婷,孙文梅.新疆传统手工艺品市场需求调查[J].合作经济与科技,2023(01):87-89.DOI:10.13665/j.cnki.hzjjykj.2023.01.007.

[2]李罡,周正茂. 基于Java技术实现内存键值数据管理的方法及其装置[P]. 北京市:CN114840498B,2022-09-13.

[3]王曼维,杨荻,李岩,及松洁.基于SpringBoot框架的智慧医疗问诊系统设计与实现[J].中国医学装备,2022,19(03):133-136.

[4]高志平. 基于SpringBoot框架与ITIL方法的运维管理系统的设计与实现[D].华东师范大学,2021.DOI:10.27149/d.cnki.ghdsu.2021.001482.

[5]林易康, 基于Java的web应用程序控制管理软件. 湖北省,武汉东湖学院,2021-10-01.

[6]喻佳,吴丹新.基于SpringBoot的Web快速开发框架[J].电脑编程技巧与维护,2021(09):31-33.DOI:10.16184/j.cnki.comprg.2021.09.013.

[7]He Xinbin,Bai Yongbin,Yue Lisen,Wang Haixiao,Liu Yi. Design and Implementation of Information System Based on Java Technology Platform[J]. Journal of Physics: Conference Series,2021,2033(1).

[8]Qu Xiaona. Application of Java Technology in Dynamic Web Database Technology[J]. Journal of Physics: Conference Series,2021,1744(4).

[9]李竹林,郭跃,车雯雯.基于轻量级框架SpringBoot的家教APP设计与实现[J].河南科技,2021,40(03):22-24.

[10]王超,张琪立,田广强,李晶晶.基于Springboot框架的学校机房计费管理系统的设计与实现[J].电子技术与软件工程,2020(23):159-160.

[11]史一帆,曾嫚.浅析互联网思维下高校手工艺品交易平台的建立状况及突破策略[J].商讯,2020(13):167+169.

[12]Tian Ming Huang. Design and Implementation of App System for Legal Consulting Based on JAVA Technology[J]. Procedia Computer Science,2020,166(C).

[13]邓琳,刘文飞,卢楚乔.“互联网+”背景下全国残疾人手工艺品交易平台构建研究[J].现代营销(信息版),2019(06):108-109.

[14]肖睿,崔雪炜,艾华,潘亚,张娟. Java面向对象程序开发及实战[M].人民邮电出版社:大数据开发实战系列, 201801.209.

[15]SJ/T 11683-2017, Java语言源代码缺陷控制与测试指南[S].

[16]方印,高赟.少数民族手工艺品交易法律关系及主要问题初探[J].凯里学院学报,2017,35(01):69-73.

[17]Wu Hongyan. Construction of Online Teaching System Based on SpringBoot Framework for Normal University Students’ Informatization Teaching Ability Training[P]. 2022 2nd International Conference on Education, Information Management and Service Science (EIMSS 2022),2022.

致  谢

On the occasion of the completion of this thesis, I would like to thank my supervisor. In the web design class of the instructor, I learned a lot, which also laid a certain foundation for my internship. The instructor also made many suggestions for my design and gave me careful guidance. They patiently guided me to improve the problem, gave me the experience of writing thesis, and often encouraged me. In addition, I would like to thank the front-end classmates who taught me to improve this project. For this project, I completed it while learning, and there are many things to start with. I don’t understand it very well, but my front-end development classmates very patiently guided me to complete this project. In the back-end development of the system, the back-end development technology used was often explained to me, which helped me better write the paper. Completed, I would like to express my heartfelt thanks to the classmates who helped me and the instructors who have always taught me, and wish me a successful career.

Please follow and like + privately message the blogger to receive the project source code for free
 

Guess you like

Origin blog.csdn.net/ID3461074420/article/details/132685418