Springboot graduation project based on Javaweb supermarket management system - with source code 281024

Design and Realization of Supermarket Management System

Summary

In the information society, there is a need for targeted information acquisition channels, but the expansion of channels is basically the direction that people are striving for. Due to the deviation in their perspective, people can often obtain different types of information, which is also the most difficult technology to overcome. topic. Aiming at the supermarket management system and other issues, research and analyze the supermarket management system, and then develop and design the supermarket management system to solve the problem.

The main functional modules of the supermarket management system include user management, commodity inventory management, product classification management, and cash register. The object-oriented development model is adopted for software development and hardware erection, which can well meet the needs of actual use and perfect For the corresponding software construction and program coding work, Mysql is used as the main storage unit of background data, and springboot technology and Redis technology are used to code and develop the business system, realizing all the functions of the system. This report first analyzes the background, function and significance of the research, laying the foundation for the rationality of the research work. Analyze the requirements and technical problems of the supermarket management system, prove the necessity and technical feasibility of the system, then make a basic introduction to the technical software and design ideas that need to be used in the design system, and finally realize the supermarket management system and Deployment runs use it.

Keywords: supermarket management system; springboot technology; Mysql database

Design and implementation of supermarket management system

Abstract

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

The main functional modules of the supermarket management system include user management, commodity inventory management, product classification management and cashier. The object-oriented development mode is adopted for software development and hardware erection, which can well meet the needs of actual use, improve the corresponding software architecture and program coding, and take MySQL as the main storage unit of background data, Using springboot technology and redis technology to code and develop the business system, all the functions of the system are realized. This report first analyzes the background, function and significance of the research, which lays a foundation for the rationality of the research work. This paper analyzes the various requirements and technical problems of the supermarket management system, proves the necessity and technical feasibility of the system, then makes a basic introduction to the technical software and design ideas needed to design the system, and finally realizes the supermarket management system and deploys it.

Key words: Supermarket management system; Springboot technology; Mysql database

Table of contents

Chapter 1 Introduction

1.1  Research Significance

1.2  Research status at home and abroad

1.3 Research content 2

Chapter 2 Introduction to Related Technologies

2.1 Development Technology

2.2  MVVM pattern

2.3 MySQL database

2.4 B/S structure

2.5 Introduction to spring boot framework

2.6 Main functions of Vue.js

Chapter 3 System Analysis

3.1 System feasibility analysis

3.2 System  function analysis and description 6

3.3 System UML use case analysis 6

3.3.1 Administrator Use Case 7

3.3.2 User use case 7

3.4 System flow analysis 8

3.4.1 Add information process 8

3.4.2 Operation process 9

3.4.3 Delete information flow 10

Chapter 4 System Design

4.1  System architecture design

4.2  Overall system design

4.3  System function design

4.4  Database design

4.4.1  Data Requirements Analysis

4.4.2  Database conceptual design

4.4.3  Database table design

Chapter 5 System Implementation

5.1  Implementation of the database access layer

5.2  Implementation of login module

5.3 Realization of user login module

5.4  Realization of common user data modification module

5.5  Realization of Commodity Inventory Management Module

5.6  Realization of product classification management module

5.7  Realization of Cashier Management Module 28

Chapter 6 System Testing 31

6.1  Test purpose 31

6.2  Functional testing 31

6.3  Performance testing 32

Chapter 7 Summary and Outlook 34

Reference 35

Thanks 36

  1. introduction
    1. Significance

In the 1980s, the supermarkets in our country initially formed a new mode of operation, and now it has become an important form of my country's retail industry and has played an important role in the development of the national economy. For supermarkets, commodity circulation is the basis for their development, and operating income is their ultimate goal. Because it is necessary to order goods from suppliers, and different suppliers provide different goods, including the freight, packaging and price of goods, and even the goods provided by different suppliers of similar goods are different, which determines the supply of goods business will be very important. In addition, in the operation process of the supermarket, it is necessary to grasp the inventory capacity of commodities at any time, consider the suppliers of different commodities, determine the quantity and types of commodities to be ordered, etc. These are all important issues that need to be carefully considered. The management and statistics of internal data such as supplier information, commodity information, inventory information, and commodity order records. In the past, manual statistics were used, and paper documents were used. The work efficiency was very low and the flow of commodities and commodities could not be understood in a timely and punctual manner. types, etc., so that it cannot adapt to the diverse needs of different customers.

With the continuous increase of people's daily needs and types, supermarkets are becoming more and more important in people's daily life, which leads to the rapid development of supermarkets and the expansion of business scale, and the management methods will become more and more complicated. , in the previous mode of operation, the operators were all selling and buying at the counter, but the current mode cannot meet the current situation, so it is urgent to introduce new management methods and technologies. In recent years, foreign large-scale chain supermarkets have continuously poured into the country, which has brought a great impact on traditional business methods. The scale of domestic traditional supermarkets is also expanding, and their operation and management methods are also learning from international supermarkets. At present, domestic stores Consistent with the substantial growth in sales volume, almost all supermarkets are changing the traditional pattern of selling a single category and a single commodity, and are developing towards a model of diversified varieties and diversified user choices. In terms of business, supermarkets need to deal with a large amount of inventory information, and must constantly update product sales information, continuously add product information, and conduct statistical analysis on all product information. The previous purely manual statistics and management methods cannot effectively manage each commodity, the collection and settlement speed is slow, business errors are prone to occur, it is not suitable for commodity price adjustment, and the inventory efficiency is low. The decision-making of management, storage, etc. is mainly based on experience, lacks real-time analysis functions, and the requirements of management personnel for timely transmission of data have not been met, which greatly limits the further development of the supermarket.

Computer information management has many advantages such as fast speed and large storage capacity. Therefore, the introduction of advanced office systems in supermarket management can realize the transmission and control of huge commodities in supermarkets, thereby facilitating the decision-making and management of the sales industry, and providing a comprehensive solution for supermarket management. And the supermarket staff relieved many inconveniences. The ultimate goal of this research paper is to write a management information system that integrates the order management and information management of supermarket commodities, so as to reduce the cost of supermarket operations, improve the work efficiency of supermarkets and simplify their management processes.

    1. Research status at home and abroad

Since the first supermarket was born in the United States in the 1930s, the tedious and large amount of work in the supermarket's purchase, sales, and storage information records, viewing, and analysis, as well as the supermarket's operation and management process, is time-consuming, laborious, and inefficient. Leading to data errors, these have always plagued the development of supermarkets. With the economic development driving consumption growth, national policies have less and less restrictions on foreign enterprises, more and more foreign brand supermarkets have entered China, domestic traditional brand supermarkets are also rising rapidly, the scale of operation is also increasing, and the variety and quantity of products are increasing. The original mode of manually recording all order information can no longer meet the fiercely competitive market demand, and continuously strengthening operation and management has become a key condition for supermarkets to gain market competitive advantages.

Analysis of the application of confidence technology in supermarket management in my country at present. The information technology used in supermarket management mainly includes network technology, POS (Point of Sale System, point of sale real-time information system) system technology, bar code technology and scanning technology, Web technology, database technology, Java technology, etc. Network technology has made a very large contribution in some links such as receiving goods, inventory management, and ordering goods. The use of network technology in supermarket management saves a lot of manual input of commodity order information, coupled with the combination of barcode technology, managers can quickly obtain information such as inventory and prices of different commodities. Because of its powerful functions, it has a wide range of applications. Combining network technology and the actual management needs of supermarket orders, develop a complete supermarket order system, which can quickly improve the core competitiveness of supermarkets while reducing labor costs.

    1. Content of the study

At present, many people still use traditional paper tools as the main tool for information management, while the application of network technology only plays an auxiliary role. In terms of awareness of network tools, traditional office software is still the main tool people use, while relatively comprehensive and professional information management software is still not understood or recognized by most people. This topic aims to achieve various functions of the supermarket management system through label classification management, etc., so as to achieve the management of the supermarket management system.

The detailed introduction will be elaborated in the following six chapters:

The first chapter, the introduction, introduces the background and significance of the research topic selection, the research status, and briefly introduces the chapter content of this article.

The second chapter introduces technical knowledge, develops by introducing key technologies, and introduces intuitively expressed technical knowledge into the system.

The third chapter focuses on the analysis of the system. Starting from the powerful supply and demand market of the system, it discusses the feasibility of system development, system process, system performance and function.

The fourth chapter introduces the detailed design scheme of the system, including system structure design and database design.

The fifth chapter, the realization of the system design, demonstrates the structure of the system through the detailed description of the system function design.

Chapter 6, the overall test of the system, to judge whether the system can be run online.

  1. Related technology introduction
    1. Development Technology

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

    1. MVVM pattern

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

    1. MySQL database

The advancement of science and technology has brought many conveniences to daily life: classroom projectors use virtual imaging technology, digital cameras use photoelectric detection technology, for example, the records of goods entering and leaving warehouses in supermarkets require an information warehouse. This information warehouse is a database, and this time the agricultural product e-commerce service system also needs the support of this technology.

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

    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 introduction

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. Main functions of Vue.js

Vue.js is a progressive framework for building user interfaces. Unlike other heavyweight frameworks, Vue is designed with bottom-up incremental development. Vue's core library only focuses on the view layer, and is very easy to learn and integrate with other libraries or existing projects. On the other hand, Vue is fully capable of driving complex single-page applications developed with single-file components and libraries supported by the Vue ecosystem.

The goal of Vue.js is to enable responsive data binding and composed view components with the simplest API possible .

Vue.js itself is not a catch-all framework - it only focuses on the view layer. So it's very easy to learn, very easy to integrate with other libraries or existing projects. On the other hand, Vue.js can also power complex single-page applications when used with related tooling and supporting libraries.


Chapter 3 System Analysis

3.1 System Feasibility Analysis

The development environment and configuration of the system can be installed by yourself. The system uses the springboot development tool and the relatively mature Mysql database to interact with the relevant data between the foreground and the background of the system. According to the technical language, the database is modified and maintained according to the requirements. It can make the system operation more stable and safe, so as to complete the development of the realization system.

(1) Hardware Feasibility Analysis

The design of the supermarket management system and information analysis does not have any hard requirements for the computer used. As long as the computer can be used normally, it is feasible to write code and page design. The main reason is that there are some requirements for the server. For the server to be uploaded after the platform is built There are certain requirements, the server must be selected with relatively high security, and then the system must be opened smoothly, and it cannot be paused for too long; cost-effective; high security.

(2) Software feasibility analysis

Provides a common mechanism similar to the pretext dynamic model, with a more focused design. In addition, modularization and storage of information can be easily achieved using the java language. In addition, code reuse can also be well reflected. Therefore, considering the actual situation of the system, the springboot framework is selected as the system development technology. Through the above analysis, the design and implementation of the system is feasible in software.

Therefore, we conducted a feasibility study from two aspects, and it can be seen that there is no problem in the development of the system.

3.2 System function analysis and description

The use of the supermarket management system is divided into two authority modules, the administrator and the user.

The functions that administrators can use mainly include: homepage, user management (administrators, ordinary users), more management (commodity inventory, product classification, cash register), etc.

Users can realize; Home commodity inventory, product classification, cash register, etc.

3.3 System UML use case analysis

3.3.1 Admin Use Case

After the administrator logs in, he can go to the home page, and the functions that the administrator can use mainly include: home page, user management (administrators, ordinary users), more management (commodity inventory, product classification, cash register), etc.

The usage example of the administrator is shown in Figure 3-1.

                                                 Figure 3-1 Administrator use case diagram

 

3.3.2 User Use Cases

After the user registers and logs in, he can manage the home page, commodity inventory, product classification, and cash register.

The user example is shown in Figure 3-2.

                

 

                                                               Figure 3-2 User use case diagram

 

3.4 System flow analysis

3.4.1 Add information process

Add information, the numbering system uses the automatic numbering mode, no user fills in, the user adds information and enters the information, the system will automatically confirm the information and data, if the verification is successful, the information is valid and added to the database, if the information is invalid, re-enter the information. Figure 3-3 shows the process of adding information.

 

                                                            Figure 3-3 Flowchart of adding information

3.4.2 Operation process

If the user wants to enter the system, he first enters the system login interface, selects the login type to log in through the correct user name and password, the system will check the login information, the information is correct, and then enter the corresponding function interface, prompting that the information is wrong and the login fails. The system operation process is shown in Figure 3-4.

 

                                                  Figure 3-4 Operation flow chart

3.4.3 Delete information process

The user selects the information to delete and clicks the Delete button. The system prompts whether to delete the information. If the user wants to delete the information, the system will delete the information. System database deletion information. Figure 3-5 shows the flow chart of deleting information.

 

                                                         Figure 3-5  Flow chart of deleting information

Chapter 4 System Design

4.1 System architecture design

The architecture design of the supermarket management system is mainly divided into three layers, mainly including the Web layer, the business layer, and the Model layer. The web layer also includes the View layer and the Controller layer, and the Model layer includes the metadata extension layer and the data access layer.

The system architecture is shown in the figure below.

 

Figure 4-1 System architecture

4.2 Overall system design

The supermarket management system is generally divided into a front-end user module and a back-end administrator module.

The two modules appear to exist independently, but the accessed database is the same. The function of each module is made according to the previously completed demand analysis, and after consulting relevant materials.

To sum up, the functional structure diagram of the system is shown in the figure below.

                       

 

Figure 4-2 System function structure diagram

4.3 System function design

 

Login module: The login module is the entrance to the system, and all users must log in to access the system. To log in, you need to enter your username and password, and if you try to log in multiple times, you need to enter a verification code. When logging in, you need to choose the role of the user, whether it is a general user or an administrator to log in. After a successful login, the user's permissions will be obtained through the database and redirected to the user's home page.

Administrator user management module: administrator management includes: administrator addition, modification and deletion operations. When adding an administrator, first determine whether the administrator added by the user is an admin (super administrator), if not, the addition is successful. When modifying, if you are a super administrator, you can modify the information of all administrators, and if you are an ordinary administrator, you can only modify your own information. Super administrators can delete all other administrators except themselves, and ordinary administrators cannot perform the operation of deleting administrators.

Commodity inventory information management module: Commodity inventory management is divided into commodity addition and modification. Commodity inventory information is modified, added, and deleted by administrators; commodity purchases are performed by ordinary users.

Product classification management module: product classification management is divided into product addition, modification and product classification. Product information is modified, added, and deleted by administrators; products are executed by ordinary users.

Cash register management module: cash register management is divided into cash register addition and modification. The cash register is modified, added, and deleted by the administrator;

4.4.1 Data Requirements Analysis

From the previous analysis, the most important things in the database are attraction information, user information, administrator information, as well as gourmet information and purchase information. The analysis can get the following data description:

Ordinary users: used to record various information of users, including data items such as user number, age, name, gender, and audit status.

Administrator: Record the login information of the administrator. Including user name, password, permissions and other data items.

Commodity management: the content stored for commodity information, including commodity number, commodity name, commodity purchase price, commodity unit price, inventory quantity, product classification and other data items.

Inventory management: content stored for inventory management, including data items such as product name, product number, inventory quantity, inventory number, product classification, and audit status.

Cash register: the content stored at the cash register, including data items such as sales date, product name, product category, product unit price, sales quantity, total price, sales order number, and review status.

4.4.2 Database conceptual design

According to the previous data flow chart, combined with the functional module design of the system, design each information entity that conforms to the system.

The ER diagram of the system is shown in the figure below.

  

Figure 4-3 System ER diagram

4.4.3 Database table design

The data tables owned by the supermarket management system are as follows: product classification table, cash register table, platform user table, inventory management table, commodity management table.

Due to the large number of data tables, only the main data tables of the system are displayed, as shown in the following table.

product_classification表:

name

type

length

not null

primary key

note

product_classification_id

int

11

yes

yes

Product category ID

type

varchar

64

no

no

type

examine_state

varchar

16

yes

no

Approval Status

recommend

int

11

yes

no

Intelligent Recommendation

create_time

datetime

0

yes

no

creation time

update_time

timestamp

0

yes

no

update time

commodity_management表:

name

type

length

not null

primary key

note

commodity_management_id

int

11

yes

yes

Commodity management ID

commodity_number

varchar

64

no

no

Product Number

trade_name

varchar

64

no

no

Product name

commodity_purchase_price

varchar

64

no

no

Commodity purchase price

item_pricing_

varchar

64

no

no

Commodity price

inventory_quantity

varchar

64

no

no

stock quantity

product_classification

varchar

64

no

no

Product Categories

examine_state

varchar

16

yes

no

Approval Status

recommend

int

11

yes

no

Intelligent Recommendation

create_time

datetime

0

yes

no

creation time

update_time

timestamp

0

yes

no

update time

ordinary_users table:

name

type

length

not null

primary key

note

ordinary_users_id

int

11

yes

yes

common user ID

user_number

varchar

64

yes

no

user ID

age

int

11

no

no

age

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

inventory_management表:

name

type

length

not null

primary key

note

inventory_management_id

int

11

yes

yes

Inventory management ID

trade_name

varchar

64

no

no

Product name

commodity_number

varchar

64

no

no

Product Number

inventory_quantity

varchar

64

no

no

stock quantity

inventory_number

varchar

64

no

no

stock number

product_classification

varchar

64

no

no

Product Categories

examine_state

varchar

16

yes

no

Approval Status

recommend

int

11

yes

no

Intelligent Recommendation

create_time

datetime

0

yes

no

creation time

update_time

timestamp

0

yes

no

update time

hits table:

name

type

length

not null

primary key

note

hits_id

int

10

点赞ID

user_id

int

11

点赞人

create_time

timestamp

0

创建时间

update_time

timestamp

0

更新时间

source_table

varchar

255

来源表

source_field

varchar

255

来源字段

source_id

int

10

来源ID

cashier表:

名称

类型

长度

不是null

主键

注释

cashier_id

int

11

收银台ID

date_of_sale

date

0

销售日期

trade_name

varchar

64

商品名

product_classification

varchar

64

产品分类

item_pricing_

varchar

64

商品单价

total_price

varchar

64

总价

sales_volumes

int

11

销售数量

sales_order_no

varchar

64

销售单号

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

  

第5章系统实现

5.1数据库访问层的实现

从B/S架构的原理可知,超市管理系统 的各大模块的实现均需要对数据库的数据进行操作,具体包括查询数据、写入数据、更新数据和删除数据,因此,在开发各功能模块前,首先创建一个名称"conn. springboot"的文件,该文件主要用于连接数据,以后对程序需要操作数据时,可能使用语句"<? springboot reqiure_once('conn. springboot');?>"调用就可以了。

该文件的代码如下:

server:

  port: 5000

  servlet:

    context-path: /api

spring:

  datasource:

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

    username: root

    password: root

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

  jackson:

    property-naming-strategy: CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES

    default-property-inclusion: ALWAYS

    time-zone: GMT+8

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

  servlet:

    multipart:

      max-file-size: 100MB

      max-request-size: 100MB

5.2登录模块的实现

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

登录流程图如下图所示。

 

图5-4登录流程图

登录界面如下图所示。

 

图5-2登录界面

登录的关键代码如下:

/**

     * 登录

     * @param data

     * @param httpServletRequest

     * @return

     */

    @PostMapping("login")

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

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

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

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

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

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

        List resultList = null;

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

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

            map.put("username", username);

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

        }

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

            map.put("email", email);

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

        }

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

            map.put("phone", phone);

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

        }else{

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

        }

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

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

        }

        //判断是否有这个用户

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

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

        }

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

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

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

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

        if (groupList.size()<1){

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

        }

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

        //查询用户审核状态

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

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

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

            if (res==null){

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

            }

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

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

            }

        }

        //查询用户状态

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

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

        }

        String md5password = service.encryption(password);

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

            // 存储Token到数据库

            AccessToken accessToken = new AccessToken();

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

            accessToken.setUser_id(byUsername.getUserId());

            tokenService.save(accessToken);

            // 返回用户信息

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

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

            JSONObject ret = new JSONObject();

            ret.put("obj",user);

            return success(ret);

        } else {

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

        }

}

5.3用户资料修改模块的实现

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

5.4普通用户管理模块的实现

根据需求,需要对用户进行注册、删除或修改详情信息。删除或修改教师时,系统根据用户的状态判定为可删除状态下,才会给出删除和修改链接,点击删除链接按钮时,请求到达后台,还会先查询用户状态再次做出判定能否删除。点击修改链接按钮时,会跳转到修改信息的页面,重新填写好数据后,数据提交到后台会对数据库中相应的记录做出修改。

注册用户时,会给出数据填写的页面,该页面根据填写好的用户编号同样会事先发送Ajax请求查询编号是否已存在,数据填写好之后提交到后台,会调用相关服务在数据库中插入记录。

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

 

图5-3用户管理流程图

用户登录页面设计效果如下图所示。

 

图5-4用户登录界面

用户登录的关键代码如下。

/**

     * 登录

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

5.5商品库存管理模块的实现

此页面的关键是编写商品库存信息,包括商品编号,名称,商品进价、商品单价、商品库存、产品分类详情等。单击提交按钮以完成信息的添加。如果未写入完整的商品信息,例如,如果未写入商品编号,系统将给出相应的错误提示,并且无法成功输入。数据以概念的形式以onsubmit =“return checkForm()”的形式写入以进行检查,checkForm()函数是一种用于写入数据的不同类型的校对方法,是不是为空也是经过form表单中的οnsubmit=”return checkForm()来检查。

管理员点击左侧菜单“商品信息管理”,页面跳转到商品信息管理外观,调用后台商品查询所有商品库存信息。并将信息密封到数据集合List,绑定到请求对象,然后页面跳转到相应的springboot页面,显示出商品信息,单击删除按钮完成商品库存信息的删除。

商品库存管理流程图如下图所示。

 

图5-5商品库存管理流程图

商品库存管理界面如下图所示。

 

图5-6商品库存管理界面

 

图5-7商品库存添加界面

商品库存管理代码如下所示。

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

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

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

        return success(count.getResultList());

}

5.6产品分类管理模块的实现

根据需求,需要对产品分类进行添加、删除或修改详情信息。删除或修改产品类型时,系统根据产品的状态判定为可删除状态下,才会给出删除和修改链接,点击删除链接按钮时,请求到达后台,还会先查询产品类型状态再次做出判定能否删除。点击修改链接按钮时,会跳转到修改信息的页面,重新填写好数据后,数据提交到后台会对数据库中相应的记录做出修改。

添加产品时,会给出数据填写的页面,该页面根据填写好的产品分类同样会事先发送Ajax请求查询分配是否已存在,数据填写好之后提交到后台,会调用相关服务在数据库中插入记录。

产品分类管理流程图如下图所示。

 

图5-8产品分类管理流程图

产品分类管理页面设计效果如下图。

 

图5-8产品分类管理界面

产品分类管理的关键代码如下。

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

}

5.7收银台管理模块的实现

此页面的关键是编写收银台信息,包括销售单号、商品名、产品分类、商品单价、销售数量、总价、销售日期、详情等。单击提交按钮以完成信息的添加。如果未写入完整的收银台信息,例如,如果未写入收银台编号,系统将给出相应的错误提示,并且无法成功输入。数据以概念的形式以onsubmit =“return checkForm()”的形式写入以进行检查,checkForm()函数是一种用于写入数据的不同类型的校对方法,是不是为空也是经过form表单中的οnsubmit=”return checkForm()来检查。

管理员点击左侧菜单“收银台”,页面跳转到收银台外观,调用后台收银台查询所有收银信息。并将信息密封到数据集合List,绑定到请求对象,然后页面跳转到相应的jsp,显示出收银台信息,单击删除按钮完成收银台信息的删除。

收银台管理流程图如下图所示。

 

图5-9收银台管理流程图

收银台添加界面如下图所示。

 

图5-10收银台管理流程图

收银台管理的关键代码如下。

@RequestMapping("/get_obj")

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

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

        List resultList = select.getResultList();

        if (resultList.size() > 0) {

            JSONObject jsonObject = new JSONObject();

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

            return success(jsonObject);

        } else {

            return success(null);

        }

}

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

        StringBuffer sql = new StringBuffer("select ");

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

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

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

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

        }

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

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

        }

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

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

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

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

        }

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

        return runEntitySql(sql.toString());

    }

第6章系统测试

6.1测试目的

对任何系统而言,测试都是必不可少的环节,测试可以发现系统存在的很多问题,所有的软件上线之前,都应该进行充足的测试之后才能保证上线后不会Bug频发,或者是功能不满足需求等问题的发生。下面分别从单元测试,功能测试和用例测试来对系统进行测试以保证系统的稳定性和可靠性。

6.2功能测试

下表是商品库存管理功能的测试用例,检测了商品库存管理中对商品库存信息的增加,删除,修改,查询操作是否成功运行。观察系统的响应情况,得出该功能也达到了设计目标,系统运行正确。

前置条件;用户登录系统。

表6-1 商品库存管理的测试用例

功能描述

用于商品库存管理

测试目的

检测商品库存管理时的各种操作的运行情况

测试数据以及操作

预期结果

实际结果

点击添加商品库存,必填项合法输入,点击保存

提示添加成功

与预期结果一致

点击添加商品库存,必填项输入不合法,点击保存

提示必填项不能为空

与预期结果一致

点击修改商品库存,必填项修改为空,点击保存

提示必填项不能为空

与预期结果一致

点击修改商品库存,必填项输入不合法,点击保存

提示必填项不能为空

与预期结果一致

点击删除商品库存,选择商品库存删除

提示删除成功

与预期结果一致

点击搜索商品库存,输入存在的商品库存名

查找出商品库存

与预期结果一致

点击搜索商品库存,输入不存在的商品库存名

不显示商品库存

与预期结果一致

下表是酒店预订管理功能的测试用例,检测了酒店预订管理中对酒店信息的增加,删除,修改,查询操作是否成功运行。观察系统的响应情况,得出该功能也达到了设计目标,系统运行正确。

前置条件;用户登录系统。

表6-2 酒店预订管理的测试用例

功能描述

用于酒店预订管理

测试目的

检测酒店预订管理时的各种操作的运行情况

测试数据以及操作

预期结果

实际结果

点击添加酒店,必填项合法输入,点击保存

提示添加成功

与预期结果一致

点击添加酒店,必填项输入不合法,点击保存

提示必填项不能为空

与预期结果一致

点击修改酒店,必填项修改为空,点击保存

提示必填项不能为空

与预期结果一致

点击修改酒店,必填项输入不合法,点击保存

提示必填项不能为空

与预期结果一致

点击删除酒店,选择酒店删除

提示删除成功

与预期结果一致

点击搜索酒店,输入存在的酒店名

查找出酒店

与预期结果一致

点击搜索酒店,输入不存在的酒店名

不显示酒店

与预期结果一致

下表是产品分类管理功能的测试用例,检测了产品分类管理中产品分类单的操作是否成功运行。观察系统的响应情况,得出该功能也达到了设计目标,系统运行正确。

前置条件;用户登录系统。

表6-3 产品分类管理的测试用例

功能描述

用于产品分类管理

测试目的

检测产品分类管理时各种操作的情况

测试数据以及操作

预期结果

实际结果

未选择产品,点击提交

提示请选择产品

与预期结果一致

未输入文字,点击提交

提示请输入文字

与预期结果一致

未选择时间,点击提交

提示请选择时间

与预期结果一致

6.3性能测试

使用阿里云PTS(Performance Testing Service)性能测试服务对线上系统进行压力测试。线上服务器环境为:1核心CPU,1G内存,1Mbps公网带宽,Centos7.0操作系统。

压测过程中使用了2台并发机器,每台机器20个用户并发,对系统主页,登录,数据查询和数据维护等模块进行并发访问,测试结果是有40个用户并发时,数据管理相关页面的响应时间甚至达到了7s,通过查看服务器出网流量发现已经达到1381kb/s,可以看出服务器的带宽已经达到峰值,如果系统使用5Mbps的带宽,系统的响应时间和TPS将会大大增加。在整个测试的过程中,CPU的使用率占用仅8%,也提现出带宽瓶颈对系统的影响非常严重。

第7章总结与展望

随着计算机互联网技术的迅猛发展,各行各业都已经实现采用计算机相关技术对日益放大的数据进行管理。该课题是超市管理系统 为核心展开的,主要是为了实现超市管理系统信息化管理。

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

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

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

参考文献

[1]ZHENG Yang-yang,ZHU Tie-hui,JIA Wei.Does Internet use promote the adoption of agricultural technology?Evidence from 1449 farm households in 14 Chinese provinces[J].Journal of Integrative Agriculture,2022,21(01):282-292.

[2]梅瑞泽,王静.超市信息管理系统的设计与实现[J].电子测试,2021(18):78-80.

[3]李贺,吴琪.C超市库存管理优化研究[J].中小企业管理与科技(中旬刊),2021(10):25-27.

[4]席月.基于供应链视角的永辉超市存货管理研究[J].经济研究导刊,2021(22):93-95.

[5]温馨. AJ自营超市库存管理优化研究[D].桂林电子科技大学,2021.

[6]吴永豪.基于大数据平台的无人智慧超市管理系统设计[J].电子技术与软件工程,2021(12):189-191.

[7]朱卫琪. B水果连锁超市供应商管理优化研究[D].中原工学院,2021.

[8]岳纹.企业小型超市订单管理系统的研究与开发[J].电脑编程技巧与维护,2021(05):89-91.[9]门志宇.家乐福连锁超市食品存货管理问题及对策研究[J].商场现代化,2021(08):24-26.

[10]王立新.基于信息技术的超市后台管理系统研究[J].无线互联科技,2021,18(08):60-61.

[11]高晓雪.超市化库存管理在装调车间的应用[J].中国管理信息化,2021,24(07):91-92.

[12] Huang Zhiyuan, Tian Jilei. Research on Inventory Management of Small and Medium-sized Supermarkets [J]. Accounting Study, 2021(04):124-125.

[13] Wu Chunmei, Cao Meiqi, Wang Jinhui, Tan Xiao, Li Dongxue, Yang Bo. Management and Design of Smart Convenience Supermarket System [J]. Electronic Production, 2021(01):55-56+69.

[14] Huang Minfang, Zhang Yuankai, Wang Yanxin, Hu Xiangpei. Online supermarket order sorting optimization model based on JIT assembly model [J]. Chinese Management Science, 2020, 28(05): 159-166.

[15] Zhou Chen. Research and Design of Smart Supermarket Based on Online Orders [J]. Think Tank Times, 2019(22): 234-235.

[16] Mao Yongbo. Research and Development of Supermarket Order Management System Based on J2EE Architecture [D]. Xidian University, 2019.

thank you

This design took 3 months. In this graduation project, it is inseparable from the guidance of the instructor to make things go smoothly. The instructor has given me a lot of help both in the graduation design experience and in the completion of the thesis. On the other hand, I have benefited a lot from the teacher's serious and responsible work attitude, prudent teaching spirit and strong theoretical level. His diligent and cautious attitude towards teaching and educating people also left me with a particularly deep feeling. I have learned a lot from my teachers. In theory and practice, my skills have been greatly improved. Here, I would like to express my heartfelt gratitude to the teachers.

After all the research and development of this graduation project, my system research and development has experienced a special progress from requirement analysis to realization of detailed functions, to final testing and maintenance. Let me have a deeper understanding of system development. Now my hands-on ability and ability to deal with doubts alone have also gained a particularly large increase in practice and learning. This is the best harvest of this graduation project.

Finally, during the whole system development process, the classmates and friends around me gave me a lot of opinions, so I quickly confirmed the business idea of ​​the system. Here, I sincerely express my gratitude to them.

Like+Favorite+Follow → private message to receive the source code and database
 

Guess you like

Origin blog.csdn.net/weixin_61498557/article/details/131162466