(with source code) springboot is a java-based second-hand book trading platform on campus

Design and Implementation of Second-hand Book Trading Platform on Campus

Summary

With the rapid development of computer technology and network technology, online shopping has been integrated into people's daily life, so e-commerce has become popular. Domestic large-scale websites such as JD.com, Tmall, and Suning.com have matured in book sales and other commodity retail fields, but the second-hand book resources mainly used by college students have not yet been reasonably developed and utilized. The campus second-hand book trading platform I designed and implemented was implemented after reasonable market research. The system is divided into foreground system and background system. The front-end system is user-oriented, and realizes functions such as book inquiry and purchase, and the back-end system realizes the management and control of the system by the administrator. After adding the product to the shopping cart, the client can fill in the address and delivery information, and the payment method can be cash on delivery, etc. At the same time, the user can also give feedback on the product after purchase, and the administrator can view the order details for management and control wait. This design can realize the effective utilization and management of second-hand book resources on campus, eliminate the waste of old books and the disadvantages of management, and realize the electronicization of second-hand book sales management on campus according to the basic process of book sales.

Keywords: second-hand books; MySQL database; trading platform

Design and implementation of campus second-hand book trading platform

Abstract

With the rapid development of computer technology and network technology, online shopping has been integrated into people's daily life, and e-commerce has become popular. Domestic Jingdong Mall, tmall, Suning Tesco and other large websites have been very mature and perfect in the field of book sales and other commodity retail, but the second-hand book resources dominated by second-hand books of college students have not been reasonably developed and utilized. The campus second-hand book trading platform designed and implemented by me is implemented after reasonable market research. The system is divided into foreground system and background system. The foreground system is user-oriented and realizes the functions of book query and purchase. The background system realizes the administrator's management and control of the system. After adding the goods to the shopping cart, the user can fill in the address and distribution information, and the payment method can choose cash on delivery. At the same time, after purchase, the user can also make feedback and evaluation on the goods, and the administrator can view the order details for management and control. This design can realize the effective utilization and management of second-hand book resources on campus, eliminate the waste of old books and the disadvantages of management, and realize the electronization of campus second-hand book sales management according to the basic process of book sales.

Key words:Second hand books; Mysql database; trading platform

Table of contents

Chapter 1 Introduction

1.1  Research background and significance

1.2  Development Status

1.3  The structure of the thesis

Chapter 2 Introduction of Development Tools and Related Technologies

2.1  J2EE technology

2.2 MVVM pattern

2.3 B/S structure

2.4 Spring boot framework

2.5  Mysql database

2. 6  B/S system working principle

Chapter 3 System Analysis

3.1  Feasibility analysis

3.1.1  Economic feasibility

3.1.2  Technical Feasibility

3.1.3  Operation Feasibility

3.2  Functional requirements analysis

3.3  Non-functional requirements analysis

3.4  Business Process Analysis

Chapter 4 System Design

4.1  System architecture design

4.2  Functional module design

4.3  Database design

4.3.1  Conceptual model design

4.3.2  Database logic design

4.3.3  Database table design

Chapter 5 System Implementation

5.1  Implementation of user login

5.2  Realization of the main functions of the front desk of the system

5.2.1  Realization of Homepage

5.2.2  Realization of user registration

5.2.3 Realization of second-hand book display 

5.2.4 Implementation of book search 

5.2.5 Realization of Book Purchase 

5.2.6  Realization of order generation

5.3  Realization of the main functions of the system background

5.3.1  Realization of user management

5.3.2 Realization of book management 

5.3.3  Realization of order management

Chapter 6 System Testing

6.1  The concept of software testing

6.2  Software testing process

6.3  System testing stage

6.4  Test results

Chapter 7 Summary and Outlook

references

thank you

  1. introduction
    1. research background and meaning

With the development of the market economy and the improvement of people's living standards, the second-hand book market is an environmentally friendly and low-cost reading option. In colleges and universities, second-hand book stores provide students with a supply and demand platform, but for the management of second-hand books and Sales, the ordinary old book market cannot be carried out effectively, and with the rapid development and popularization of e-commerce, purchasing goods and obtaining information online has become a habit of modern people's life. And online shopping has become an indispensable part of the group mainly college students, so the emergence of second-hand book trading websites is also a scientific method to solve the problem of used book management in the process of the development of the times.

In terms of sales and promotion of second-hand books, many scholars have studied second-hand book trading websites. Their research results have proved that there is a demand for the purchase and use of second-hand books in the market. At the same time, they have also studied the management of second-hand books. However, it may be that the express delivery after the purchase of books is not popular enough, and the payment method is not simple and convenient enough. Therefore, online trading of second-hand books is not yet popular in the market dominated by colleges and universities. Therefore, this second-hand book on campus The book trading platform project has improved the functions of actual purchase, distribution and payment, hoping to promote the marketization of the second-hand book trading platform on campus, which will also be the greatest significance and application prospect of this project.

    1. development status

After several years of development, many online shopping malls recognized by consumers have appeared at home and abroad. The content of these online shopping malls is diverse, and they include relatively complete functions, including registering users, searching for products, managing orders, introducing product details, and online feedback. Nowadays, the widespread use of the Internet has led to the development of online shopping centers at home and abroad to a certain extent. As long as enterprises type online through this platform, they can manage the content of the system at any time. By displaying product content and posting announcements, consumers are encouraged to purchase and conduct online transactions.

In recent years, with the rapid development of computer technology and network technology, online shopping has been integrated into people's daily life, and e-commerce has therefore become popular. Large-scale domestic websites such as JD.com, Tmall, and Suning.com have matured in the field of book sales and other commodity sales, but the second-hand book resources mainly used by college students have not yet been reasonably developed and utilized. Effective utilization and management of such second-hand book resources, eliminating the waste of old books and the disadvantages of management, and realizing the electronic sales management of second-hand books according to the basic process of book sales are also inevitable for the development of e-commerce.

    1. Thesis structure

Based on the information and data obtained from market research, combined with domestic and foreign frontier research, and using relevant system development and design methods, the campus second-hand book trading platform was finally designed.

There are seven chapters in this paper, as follows.

The first chapter outlines the purpose and significance of the research on the campus second-hand book trading platform; it summarizes the research situation and future research trends in the field at home and abroad, and finally gives the composition of the paper.

The second chapter gives a brief overview of the development techniques and tools used in this paper.

The third chapter briefly analyzes the needs and feasibility of each business process of the system.

The fourth chapter designs the second-hand book trading platform on campus.

The fifth chapter realizes the second-hand book trading platform on campus, and posts screenshots of relevant pages, and describes the operation method of realizing specific functions in language.

The sixth chapter uses test cases to test some main functional modules of the second-hand book trading platform on campus, and finally draws the test results.

Chapter 7 summarizes the full text and makes an outlook on future research.

  1. Introduction to development tools and related technologies
    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. MVVM pattern

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

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

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

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

    1. B/S structure

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

    1. Spring boot framework

The Spring framework is an open source application framework on the Java platform that provides a container with inversion of control features. 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 (EnterpriseJavaBeans) model. The Spring framework provides a series of solutions for development, such as using the core features of inversion of control, and implementing inversion of control through dependency injection to realize the containerization of the management object life cycle, using aspect-oriented programming for declarative transaction management, and integrating 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 feature of inversion of control (IOC). IOC is designed to facilitate project maintenance and testing. It provides a method for unified configuration and management of Java objects through the Java reflection mechanism. The Spring framework uses the container 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. Aspect Oriented Programming(AOP) framework, the Spring AOP framework is based on the proxy mode, and can be configured at runtime; the AOP framework is mainly modularized for the 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 the basic needs through integration with AspectJ. Functions such as transaction management and remote access 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 multiple 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 addresses 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 Apache Cayne, but also can be used with Spring's transaction management to provide data access Flexible abstraction. The Spring framework initially did not 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 Struts Web framework and between the request processing layer and the model was not enough, so they created Spring MVC.

    1. Mysql database

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

In the actual implementation process of the campus second-hand book trading platform designed in this article, the main reason for choosing the Mysql database is that there will be a large number of databases that are frequently operated during the application and development of enterprise application systems, and data security The sexual requirements are also very high. Combining these factors, Mysql, which has a relatively high safety factor, is finally selected to store the background data of the second-hand book trading platform on campus.

2.6 B/S system working principle:

The B/S architecture adopts the working mode of browser request and server response.

Users can access information such as text, data, pictures, animation, video on demand and sound generated by the web server on the Internet through a browser;

And each web server can be connected with the database server in various ways, and a large amount of data is actually stored in the database server;

Download the program from the Web server to execute locally. If an instruction related to the database is encountered during the download process, the Web server will hand it over to the database server for interpretation and execution, and return it to the Web server, and the Web server will return it to the user. In this structure, many networks are connected together to form a huge network, that is, the global network. Each enterprise can build its own Internet on the basis of this structure.

In the B/S mode, the user requests access to many servers distributed on the network through the browser. The browser's request is processed by the server, and the processing result and corresponding information are returned to the browser. Other data Processing and requests are all completed by the Web Server. Through the frame structure and the browser embedded in the operating system, this structure has become the mainstream structure mode of today's software applications.

                             

 

Chapter Three System Analysis

    1. Feasibility Analysis

The feasibility analysis of this system will be carried out from the perspectives of economy, technology and operation.

      1. economic feasibility

The entire system has rigorous steps from design to development and testing. All work tasks are completed by myself without external technical support, which saves all service costs and labor costs. In terms of hardware, a second-hand mobile phone is used to save costs. The workstation is used as the project deployment server and database server, and the cost is less than 10,000 yuan. The actual network deployment is also completed by myself without other labor costs involved. The entire development process is based on the principle of low cost and low consumption.

      1. technical feasibility

The purpose of the technical feasibility analysis is to confirm whether the system can be implemented using existing technologies, and to evaluate the development efficiency and completion. Technical feasibility refers to whether the development of computer software and hardware can meet the requirements of development under the current technical conditions. Because the development of the system is based on the Java language, the software and hardware conditions required for the development of the system can be met on an ordinary computer. Because it takes up relatively little memory, there is theoretically no problem in developing and designing software with the MySQL database because it takes up too little memory. The above techniques can effectively guarantee the successful and efficient development of the system.

      1. operational feasibility

The interface of the campus second-hand book trading platform is simple and easy to operate. Common interface windows are used to log in to the interface, and access operations are performed through computers. Users can access operations as long as they have used computers. The development of this system is developed with Java technology. Humanization and perfection are the more prominent features of B/S structure development, which makes user operations more concise and convenient than others. Easy to operate, easy to manage, and good interactivity are fully reflected in the operation of this system.

    1. Functional Requirements Analysis

The goal of designing the second-hand book trading platform on campus on the Internet is to conduct second-hand book trading activities more effectively, which is also a new option for second-hand book trading. This makes the transactions between people and businesses tend to be managed in a networked manner, making Internet transactions easier, thereby improving work efficiency and reducing management costs. In this system, user identities need to be managed, including buyer identities and merchant identities.

For the first time, customers can view detailed introductions, physical pictures, prices and other basic information of various commodities on the campus second-hand book trading platform, so that customers can identify the commodities they are satisfied with. After selecting an item, the customer can add the selected item to the cart, and if you change your mind before checkout, you can still skip the purchase. After the customer selects the product to be purchased, he can submit it to the system software, and the system software will automatically generate a corresponding order number.

The platform administrator plays a very critical role in the system software. The administrator can implement requirements such as commodity management, order management system, user management system, and commodity category management. In addition, the system software should also ensure that the information content is clear and orderly, and administrators can easily find the management categories they need.

The front desk functions of this system include the following items:

  1. User registration and login: users register and log in.
  2. Mall browsing: Display mall information in a list.
  3. Second-hand book search: Users can search through keywords or book categories to find their favorite books as soon as possible.
  4. Shopping cart: This is the most fundamental component of the second-hand book trading platform on campus. When users are looking for their favorite books, they can add them to the shopping cart, and then inquire about others again.
  5. Personal order: The customer chooses the second-hand book to be purchased, fills in the delivery address, receiver, and contact number, submits the purchase order, and then pays online. The payment can be made through Alipay, WeChat or UnionPay.

The background functions of this system include the following items:

  1. User management: display the information of all registered users, and perform operations such as modification and deletion.
  2. Second-hand book management: users place orders to purchase books, and the administrator is responsible for processing them regularly, delivering goods to users according to the order information, and maintaining all the details of second-hand books in the existing second-hand book trading platform.
  3. Order management system: View order status, update order information for payment, update delivery status and delete order information, and resolve customer order information and deliver to customers.

The user use case diagram is shown below.

 

Figure 3-1 User use case diagram

The administrator use case diagram is shown below.

 

Figure 3-2 Administrator use case diagram

    1. Non-Functional Requirements Analysis 

1. Accuracy and confidentiality of system processing

The system software should ensure the confidentiality of the company's internal information content to ensure the interests of users. The system software should select the management authority, control the application management authority of different users, and the user must not abuse the authority for actual operation. System software should ensure the security of data information. In addition, the customer specified that the system has the reliability of the aspect ratio, the accuracy of the data, and the system is recoverable.

2. System software development and scalability

Customers will continue to put forward new requirements for the system and expand system functions during the use of the system, which requires that the system software must have excellent scalability to take into account the customer's long-term and easy-to-use regulations. Constantly put forward new requirements for the system and expand system functions.

3. Convenience and executable of system software

The design of the control system should be personalized, the user interface should be clear and simple, and the operation should be simple and convenient, so as to achieve the purpose of man-machine friendliness.

4. Response time of system software

System software response speed is a key reference for considering the advantages and disadvantages of system software features. The system requires short response time, fast upgrade solution, short data exchange and transmission time, and fast response speed of background management web server. Due to the uniqueness of system software users, system software must respond immediately and effectively. And, be sure to ensure efficient responsiveness under the premise of safety.

    1. business process analysis

Business Flow Diagram (TFD) describes the business processing process through some specific symbols. It emphasizes the relationship between each processing activity in the business process and the specific business department, and selects some modules for specific description. Focus on describing the most important second-hand book transaction and order business in the overall business of this system. After users enter the campus second-hand book transaction platform, they browse various module information, select the books they want to buy and add them to the shopping cart, and the user proceeds to the shopping cart. Purchased books are checked and confirmed, and order information is filled in. In addition, managers enter the back-end management to implement the relevant management methods of the order information control module, and provide feedback mechanisms to customers after resolution.

The system business flow chart is shown below.

 

Figure 3-2 System business flow chart

  1. system design
    1. System architecture design

This system mainly uses a five-layer architecture for development, which is mainly divided into "presentation layer", "control layer", "service layer", "business logic layer" and "data access layer".

The "presentation layer" is mainly used as an interface for interacting with users, providing users with good experience. The system mainly uses Ajax technology for data transmission in the front-end and back-end interactions, which can not only achieve no-refresh interaction, but also have a relatively stable operating status.

The "control layer" mainly controls the synchronization between the front-end interface and the back-end program data, and then completes data update or interface control according to the front-end request. And responsible for the final assembly and invocation of the services provided by the "service layer".

The "service layer" is between the "control layer" and the "business logic layer". It mainly reassembles the data services of the "business logic layer", and then provides them to the "control layer" as an interface.

The "business logic layer" is mainly to dynamically call the method of the "data access layer", operate complex algorithms, process requests from the front end and make corresponding logical processing.

The "data access layer" is mainly responsible for the access to the database, and can access the database system, text files, binary files, xml documents and so on. Responsible for adding, modifying, deleting, and loading business objects.

The system architecture diagram is shown below.

 

Figure 4-1 System architecture diagram

    1. Functional module design

The basic functional requirements of the system have been obtained through software requirements analysis. According to the different functional modules, the system is divided into various functional blocks. The functional structure of the system is shown in the figure below.

 

Figure 4-2 System function structure diagram

The front desk is suitable for user login, registration, display and retrieval of second-hand books, purchase of books and viewing their own orders, etc.

  1. Browsing second-hand books: As long as you enter this platform, you can view various book information. Users can browse according to their own needs and choose the books they want.
  2. Query books: For users who have a clear goal of buying books, they can directly search for the title of the book they want to buy in the search bar, which can find it faster and more accurately.
  3. Personal information: You can become a member of the platform by registering your personal information and registering. This module includes name, gender, city, account balance, phone number and email.
  4. Password modification: This module includes the original password, new password and confirmation password.
  5. Personal order: After the user purchases the product, an order will be generated. The order number is automatically generated. After the user pays, he can see the paid order in the order management module pending delivery. The background administrator can see Go to the order details, after checking, the order status will become reviewed, and the order status will be fed back to the user at the same time.

The background includes administrator login, adding books, viewing and modifying book information, and order management.

  1. Add books: This module is used to put new books on the shelves, including adding book titles, categories, introductions, current book sales and inventory, unit prices and pictures.
  2. View book information: You can view the information of books on the shelves, modify the information at any time, and remove books that are sold out.
  3. Order management: Orders are generated by the foreground, and the background can make some changes to the status of the order.
    1. Database Design
      1. conceptual model design

Conceptual structure design is based on requirement analysis, abstracting requirement analysis into concepts, which makes it easy for developers to simplify complex operations, so that developers can focus on processing patterns and organizational structures, among which the commonly used conceptual model is ER Model.

The system ER diagram is shown below.

                   

 

Figure 4-3 System ER Diagram                   

In the figure, the user purchases goods, the relationship is 1:N, the user's management of second-hand books, including price, quantity, etc., the relationship is 1:N, the user adds the second-hand books to the shopping cart, the relationship is 1:1, the user Has its own order, the relationship is 1:N.

      1. Database logic design

Aiming at the entities and attributes of the system, combined with the idea of ​​data design, the content of the logical design of the system is described as follows.

Second-hand books (book number , title, picture, price, category, newness, introduction).

Shopping cart ( shopping cart number , item number, purchase quantity, total amount, buyer, purchase time).

Order ( order number , user name, order content, total amount, mobile phone number, delivery address, whether to pay, current status).

Feedback ( Feedback ID , Feedback Person, Feedback Content, Reply Content, Reply Person)

Information ( information number , title, category, content, picture).

      1. database table design

After completing the overall design of the database query definition, the above database query definition structure can now be transformed into a specific database system suitable for a certain type of database management, that is, the logical structure of the database query.

The design results of each table in the database query of the campus second-hand book trading platform are shown in the table below. Each table indicates a table in a database query.

name

type

length

not null

primary key

note

ordinary_users_id

int

11

yes

yes

common user ID

full_name

varchar

64

no

no

Name

gender

varchar

64

no

no

gender

examine_state

varchar

16

yes

no

Approval Status

recommend

int

11

yes

no

Intelligent Recommendation

user_id

int

11

yes

no

User ID

create_time

datetime

0

yes

no

creation time

update_time

timestamp

0

yes

no

update time

name

type

length

not null

primary key

note

seller_id

int

11

yes

yes

seller ID

full_name

varchar

64

no

no

Name

gender

varchar

64

no

no

gender

examine_state

varchar

16

yes

no

Approval Status

recommend

int

11

yes

no

Intelligent Recommendation

user_id

int

11

yes

no

User ID

create_time

datetime

0

yes

no

creation time

update_time

timestamp

0

yes

no

update time

name

type

length

not null

primary key

note

shopping_mall_id

int

11

yes

yes

Mall ID

seller_name_

int

11

no

no

seller name

remark_information

varchar

64

no

no

Remarks

recommend

int

11

yes

no

Intelligent Recommendation

cart_title

varchar

125

no

no

title

cart_img

text

0

no

no

cover picture

cart_description

varchar

255

no

no

describe

cart_price_ago

double

8

yes

no

Original price: [1]

cart_price

double

8

yes

no

Selling Price: [1]

cart_inventory

int

11

yes

no

Commodity stocks

cart_type

varchar

64

yes

no

Categories:

cart_content

longtext

0

no

no

text:

cart_img_1

text

0

no

no

Main image 1:

cart_img_2

text

0

no

no

Main image 2:

cart_img_3

text

0

no

no

Main image 3:

cart_img_4

text

0

no

no

Main image 4:

cart_img_5

text

0

no

no

Main image 5:

create_time

datetime

0

yes

no

creation time

update_time

timestamp

0

yes

no

update time

name

type

length

not null

primary key

note

order_id

int

11

yes

yes

Order ID:

order_number

varchar

64

no

no

order number:

goods_id

mediumint

8

yes

no

commodity id

title

varchar

32

no

no

Item title:

img

varchar

255

no

no

product picture:

price

double

10

yes

no

price:

price_ago

double

10

yes

no

original price:

num

int

8

yes

no

quantity:

price_count

double

8

yes

no

Total price:

norms

varchar

255

no

no

Specification:

type

varchar

64

yes

no

Categories:

contact_name

varchar

32

no

no

Contact name:

contact_email

varchar

125

no

no

Contact email:

contact_phone

varchar

11

no

no

Contact phone:

contact_address

varchar

255

no

no

Recipient address:

postal_code

varchar

9

no

no

Zip code:

user_id

int

10

yes

no

Buyer ID:

merchant_id

mediumint

8

商家ID:

create_time

timestamp

0

创建时间:

update_time

timestamp

0

更新时间:

description

varchar

255

描述

state

varchar

16

订单状态

名称

类型

长度

不是null

主键

注释

type_id

int

11

商品分类ID:

father_id

smallint

5

上级分类ID

name

varchar

255

商品名称:

desc

varchar

255

描述:

icon

varchar

255

图标:

source_table

varchar

255

来源表:

source_field

varchar

255

来源字段:

create_time

timestamp

0

创建时间:

update_time

timestamp

0

更新时间:

第五章系统实现

    1. 用户登录的实现

用户登录页面,该页面有一个权限区分,主要用于区分系统管理员和普通客户的登录。当登录的账号是系统管理员时,管理员可以进行商品的后台管理,而普通客户只能进行客户端的操作,普通客户只有在注册登录以后方可在网上购买商品。如果客户还没有登录的账号和密码,必须先在系统上注册一个。在登录后,可以进入购买的操作。

已登录的用户可以查看、修改个人信息以及密码修改等操作。用户信息的查看功能在yonghuzhuce_updt.jsp页面中实现。用户信息,和密码修改功能在系统窗口中实现的。

登录界面如下图所示。

 

图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-2首页界面

      1. 用户注册的实现

用户注册页面主要用于客户注册,在这个页面中客户要填写用户名,密码,姓名,地址和Email等信息,并且各项信息都不能为空。客户也可以点击修改个人资料和密码。系统管理员对已注册客户的信息可进行确认,可将用户列为正式用户,也可以将其删除。一般注册了的用户默认都是正是用户,前提是管理员没有删除该账号。客户在注册成功以后,才可登录系统。模块的功能是在yonghuzhuce.jsp页面中实现的。

用户注册界面如下所示。

 

图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;

}

      1. 二手书籍展示的实现

二手书籍展示页是展示系统二手书籍的页面,通过sql语句:"select shangpinxinximingcheng,id,tupian,jiage,addtime from shangpinxinxi order by addtime desc",将所有是二手书籍按二手书籍编号降序排列。

二手书籍展示页面,如下图所示。

 

图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书籍搜索界面

      1. 书籍购买的实现

购物车页面主要用于客户交易书籍,当客户选定了要订的书籍以后,可以查看书籍的内容简介。在客户已登录的前提下,在搜索到自己所需的书籍以后,当点击添加到购物车时,可把自己选订的书籍添加到购物车中。

书籍购买界面如下图所示。

 

图5-1书籍购买界面

书籍购买主要代码如下:

@RequestMapping(value = {"/avg_group", "/avg"})

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

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

        return success(count.getResultList());

}

      1. 订单生成的实现

客户订单管理模块主要包括了查看客户详细订单和处理订单等功能。这些功能分别在dingdan_detail.jsp、dingdan_list.jsp二个页面中实现的。

客户填写订单,主要是在把选订的商品加入购物车以后,需填写的一个订单。目的是为了让管理员了解客户的信息,也是为客户提供一个购物的便利,以下信息客户必须填写。为了方便客户,特为客户提供了多种的支付币种,支付方式,客户可以在支付页面中选择适合自己情况的方式。

订单生成界面如下图所示。

 

图5-1订单生成界面

订单生成界面逻辑代码如下:

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

}

    1. 系统后台主要功能实现 
      1. 用户管理的实现

管理员对系统用户的管理,在yhzhgl.jsp实现管理员用户的管理,包括录入、删除、修改,修改密码通过SESSION获取用户名,然后输入新密码,提交到mod.jsp中,使用sql命令更新密码。

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

 

图5-1用户管理界面

个人资料修改界面如下图所示。

 

图5-1个人资料修改界面

个人资料修改的逻辑代码如下。

@RestController

@RequestMapping("auth")

public class AuthController extends BaseController<Auth, AuthService> {

    /**

     * 服务对象

     */

    @Autowired

    public AuthController(AuthService service) {

        setService(service);

    }

}

      1. 书籍管理的实现

管理员在首页通过管理员账号登录以后,就可以进入后台管理。查询书籍信息主要可以查看书籍的编号,书籍图片,单价等信息。书籍信息管理模块中包含书籍类别信息管理和书籍信息管理两个小模块。在书籍类别信息管理小模块中系统管理员可以对书籍类别信息管理进行更改,其功能是在shangpinleibie_updt.jsp页面中实现的。而书籍信息管理模块提供了书籍信息的添加修改删除等功能。其中添加是在shangpin_add.jsp中实现的,可以添加书籍名,介绍,类型,单价,以及上传图片和书籍的简介等信息。

书籍管理界面如下图所示。

 

图5-1书籍管理界面

书籍管理主要代码如下。

@RequestMapping(value = {"/avg_group", "/avg"})

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

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

        return success(count.getResultList());

}

      1. 订单管理的实现

管理员在后台管理界面点击到所有订单界面dingdan_list.jsp,向控制层dingdanAction发送请求,搜索当前所有订单信息,dingdanAction向dingdanDAOImp调用搜索全部订单的请求,向数据库的订单表搜索当前所有订单并将订单信息以对象的形式层层返回到dingdan_list.jsp界面,显示出当前所有订单信息。同时可以删除过期订单,确认已有订单,进行发货处理。

订单列表界面如下图所示。

 

图5-1订单列表界面

订单支付界面如下图所示。

 

图5-1订单支付界面

  1. 系统测试
    1. 软件测试的概念

软件测试是指使用人工或全自动方法来操作或测试某些系统软件的整个过程。其目的取决于是否考虑要求的要求或澄清预期结果与特定结果之间的差异。它是帮助识别和开发设计手机软件计算机技术的正确性,彻底性和质量的全过程。

软件测试和测试不关注整个过程的主题活动,而只是分析整个过程中的物质以及开发和设计的手机软件。测试工程师应“实施”手机软件,在整个过程中对材料(开发文本和源代码)进行演练和操作,以发现问题并报告质量。测试工程师还必须假设手机软件存在问题,因此他们所做的实际操作都是为了更好地发现大量问题,而不仅仅是证明一切都适当。

    1. 软件测试过程

软件功能性测试是指执行指定的工作流程,通过对一个系统的所有特性和功能都进行测试确保符合需求和规范。

系统功能性测试表如下表所示。

表6-1系统功能性测试表

编号

测试功能

测试内容

测试结果

1

用户登录

1.验证用户名与密码的正确性。

2.验证密码是否可见。

通过

2

首页展示

1.首页数据是否成功加载。

2.验证搜索功能的准确性。

3.验证是否可以异步加载。

4.验证导航栏按钮。

通过

3

个人信息修改

1.验证登录名是否可以正常更改。

2.验证联系方式是否可以更改。

3.验证收货地址可以正常修改。

4.验证密码是否可以修改。

通过

4

购物车管理

1.购物车清单是否可以生成。

2.验证消费信息是否准确。

通过

8

二手书籍管理

1.书籍信息是否与上传一致。

2.是否能完成价格修改。

3.验证库存信息修改。

通过

9

订单处理

1.能否正常处理订单的状态。

2.验证数据准确性。

通过

10

添加书籍

1.上传书籍是否添加验证。

2.图片是否成功上传。

3.验证表单是否提交成功。

通过

11

用户管理

1.验证用户录入功能。

2.验证用户违规清理功能。

通过

    1. 系统测试阶段

第一个测试阶段:系统软件的操作界面由几个子控制模块组成,每个子控制模块都有其相对的作用。因此,系统软件的检测必须首先进行控制模块的检测。每个控制模块必须执行明确定义的子功能。测试控制模块的目的是确保每个控制模块都可以作为一个模块运行。

第二个测试阶段:集成检测是根据设计方案的软件体系结构,按照某种对策对经过控制模块检测的各个控制模块进行组装,并在整个组成过程中进行必要的检测。

第三个测试阶段:客户将执行校园二手书籍交易平台的工程验收。系统测试后,所有控制模块均已根据设计计划组装成详细的二手书籍交易平台。错误的插槽已被移除,操作接口必须进一步认证成效。

    1. 测试结果

系统软件可以在运行过程中执行其相关功能,可以完成查询,添加,删除,修改等功能,并且运行显示信息都正常,后端管理数据库查询也可以正常工作,数据信息确保一致性和可靠性。

  1. 总结与展望

通过对校园二手书籍交易平台的研究及设计与开发,基于Springboot框架的校园二手书籍交易平台基本开发完毕,并实现了小型的二手书籍交易平台的基本功能。主要包括用户注册信息管理、用户信息管理、二手书籍管理、用户订单管理、二手资讯管理模块。但是由于时间仓促及知识的缺陷,所以本系统还有很多不足的地方,比如没有与银行系统挂钩的支付模块,没有安全访问的限制,没有销售报表的打印等多方面的问题,这些都有待进一步的完善。

本课题按软件工程的要求设计与实现了整个系统,即可行性计划、需求分析报告、总体计划设计、总体设计和自动化测试过程。经开发与测试,其功能基础符合要求。该系统软件的关键是探索系统软件的开发环境,编程语言等核心技术,系统软件数据库查询的基本结构以及系统流程图程序模块的详细分析。该系统的创新点就是支持二手书籍的多条件查询和喜好书籍的自动推荐。

参考文献

  1. 曹瑜琳,周春晖,陈云燕,孟庆芸,韩思梦,方怡.关于高校二手书交易平台“易书屋”的分析与设计[J].科技与创新,2022(04):95-97+100.
  2. [2]简工博. 二手商品交易成“80后”“90后”时尚生活方式[N]. 解放日报,2022-01-31(004).

[3]李俊,马琦,朱嘉灵,陈乐.新型大学校园二手交易平台构建研究[J].物流工程与管理,2021,43(12):145-148.

[4]陈光磊,王廷湘,吴艳,王茂华,李东阳,唐徐韵.O2O模式:高校二手书籍交易现状与平台构建设想[J].营销界,2021(Z3):76-78.

[5]徐彦. C2B2C模式垂直二手交易平台商业模式研究[D].电子科技大学,2021.

[6]贺欢,胡成耀,汪洋,谢腾飞.大学生二手交易平台的现状调查与前景预测——以阜阳师范大学为例[J].现代营销(学苑版),2021(06):93-95.

[7]赵壮. 推荐算法在校园二手交易平台中的研究与应用[D].武汉轻工大学,2021.

[8]邬红梅,路雨晴.高校二手书籍交易现状分析与分享平台建设——以洛阳市高校为例[J].科技创新与应用,2020(29):44-47.

[9]邬红梅,路雨晴.高校二手书籍市场交易现状与存在问题分析——以洛阳市高校为例[J].时代经贸,2020(20):53-55.

[10]郑青青. 网络二手书平台经营现状与创新策略研究[D].苏州大学,2020.

[11]肖肖,林道婷,向志成,朱晓华.基于自主购书模式下的书籍循环利用体系的构建——以高校ibooking交易平台为例[J].教育现代化,2019,6(77):172-174.

[12]龙晓菲,陈斌,毕蒙蒙,汪露,郁玥.关于建立线上二手书籍交易平台的可行性研究[J].纳税,2019,13(16):184+187.

[13]任长玉. 我国二手书网络交易平台现状和发展策略研究[D].青岛科技大学,2019.

[14] Xu Hongyin, Wu Lian, Li Yumi, Cai Xia. Development and Design of Idle Book Exchange Trading Platform on University Campus [J]. Internet of Things Technology, 2018, 8(08): 96-97.

[15] Lin Yuan. Research and design of second-hand book trading platform in colleges and universities [D]. Changchun University of Technology, 2018.

thank you

Time flies, and in a blink of an eye, my years of school life are coming to an end. Looking back on these years of study and life, I have gained a lot, both happiness and sadness. The end of school life is also a new beginning for me. The dissertation is about to be completed. Here, I have many people in my heart who I want to thank. First of all, I would like to thank my mentor, who not only guides me in study and research, but also helps me in life and dealing with others. I would also like to thank the teachers, your rigorous academic spirit and positive work attitude have encouraged my growth and progress. Thanks to the roommates who have lived together for many years, thank you for your company and care over the years. Finally, I would like to thank all the paper reviewers for taking the time out of their busy schedules to review this paper and give valuable comments and suggestions.

Please pay attention to like + private message blogger, get the source code of the project for free

Guess you like

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