springboot+mysql pig farm management system-computer graduation project source code 11779

Summary

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

The main functional modules of the pig farm management system include system user (administrator, ordinary user) module management (pig classification, pig information, sow information, breeding information, weight data, feed information, feeding information, profit information), adopting an object-oriented approach The development model is used to develop software and set up hardware, which can well meet the needs of actual use. It has improved the corresponding software set up and program coding work. Mysql is used as the main storage unit of background data, and the springboot framework and java are used. Technology, coding and development of business systems, realizing all functions of this system. This report first analyzes the background, role, and significance of the research, laying the foundation for the rationality of the research work. Analyzing the various needs and technical issues of the pig farm management system, proving the necessity and technical feasibility of the system, and then giving a basic introduction to the technical software and design ideas that need to be used to design the system, and finally realizing pig farm management System and deployment operations use it.

Keywords: pig farm management system; Java; springboot; MYSQL

Abstract

In the information society, there is a need for targeted information acquisition channels, but the expansion of channels is basically the direction of people's efforts. Due to the deviation in perspective, people often can obtain different types of information, which is also the most difficult topic for technology to overcome. Research and analyze the pig farm management system and other issues, and then develop and design a pig farm management system to solve the problems.

The main functional modules of the pig farm management system include system user (administrator, ordinary user) module management (pig classification, pig information, sow information, breeding information, weight data, feed information, feeding information, profit information), adopting an object-oriented development model for software development and hardware installation, which can well meet the actual needs of use, improve the corresponding software installation and program coding work, Adopting MySQL as the main storage unit for backend data, using the Spring Boot framework, Java technology, coding and development of business systems, all functions of this system have been achieved. This report first analyzes the background, role, and significance of the research, laying the foundation for the rationality of the research work. Analyze the various requirements and technical issues of the pig farm management system, prove the necessity and technical feasibility of the system, and then provide a basic introduction to the technical software and design ideas required for designing the system. Finally, implement the pig farm management system and deploy it for operation.

Keywords:Pig farm management system; Java; springboot; MYSQL

Table of contents

Summary

Abstract

Chapter 1 Introduction  

1.1 Background of the topic 

1.2 Significance of the topic 

1. 3 Introduction to springboot framework 

1. 4 Thesis structure arrangement

Chapter 2 Requirements Analysis of Pig Farm Management System

2.1  System feasibility analysis

2.1.1  Technical feasibility analysis

2.1.2  Economic feasibility analysis

2.1.3  Operation feasibility analysis

2.2  System requirements analysis

2.2.1  Functional requirements analysis

2.2.2  Non-functional requirements analysis

2.3  System use case analysis

Chapter 3 Overall Design of Pig Farm Management System

3.1  System function module design

3.2  Database design

3.2.1  Database conceptual structure design

3.2.2  Database logical structure design

Chapter 4 Design and Implementation of Key Modules 1 7

4.1  Login module 17

4. 2 Registration module 

4. 3 System User Module 

4. 4 Sow information module 

4. 5 Breeding information module 

4. 6 Weight data module 

4. 7 Feed information module 

4. 8 Feeding information module 

4. 9 Profit information module

Chapter 5 System Experiment and Result Analysis 3 0

5.1  Purpose of testing 30

5.2  System part test 30

5.3  System test results 32

Chapter 6 Conclusion 3 3

References 3 4

Acknowledgments

2021 is against the background of the rapid development of information technology. Today, it has become almost impossible to live without mobile phones and computers, and it has become difficult for people to live without mobile phones and computers. In view of the increased cost management and operation, it is very necessary for pig farm management to establish their own pig farm management system. This will not only allow more people to experience the convenience brought by the network, but also help to increase the popularity and popularity of the pig farm management system itself. The feeling of user dependence.

After decades of rapid development, the Internet has become the most popular and popular media, and the daily information flow is even comparable to that of the past ten years. With its convenient information exchange and fast communication speed, it is quietly changing people's consumption patterns. Simplicity, speed, and low cost are the characteristics of the Internet. On the Internet, buyers and sellers can conduct various transaction activities without meeting each other. Internet commercialization has become a new trend in the contemporary economy. The concept of "electronic commerce" (electronic commerce or e-commerce) was proposed in American academic circles around 1996. After decades of operation, this concept has been widely accepted. B2B, C2C, C2B and B2C are the four types of e-commerce, but B2B and B2C are currently the mainstream. Among them, the enterprise-oriented management model is called B2B, which has very strict requirements on the performance, security and service quality of business systems; while the direct-to-consumer model is called B2C, which is what we are commonly exposed to. So far, e-commerce has been developing for more than ten years and is still very dynamic, with e-commerce applications springing up like mushrooms after a rain.

Our country has become the second largest economy in the world. The rapid development of economic strength and the general improvement of people's living standards have constantly required enterprises to provide more diversified entertainment methods and faster and more convenient services. Therefore, more requirements have been put forward for the pig farm industry. Strict requirements, such as better management and more comfortable services. Now we can see more and more pig farms, and the amount of information is huge. The rapid development of the pig farm industry has caused management costs to continue to expand. However, the traditional purchasing method has many disadvantages: real time difference, overload, high cost and zero sharing of information. The pig farm management system is the Internet service launched by the pig farm mall to adapt to the development of the times. With its convenient and efficient services, it reduces the labor intensity of pig farm mall employees.

The pig farm management system designed in this article is carried out under such objective conditions. It is a very valuable work that benefits the people and the country. In terms of pig farm management, traditional management methods are obviously unable to compare with pig farm management systems, which are playing an increasingly important role. The pig farm management system's fast speed, large amount of information, security, and simplicity are all advantages that the traditional model cannot match, and it is playing an increasingly important role. The pig farm management system in this article is based on the MySQL database and springboot framework.

    1. The significance of the topic

Socialism has entered a new era, and the economic strength is getting stronger and stronger. We are also becoming busier and busier, our demands on life have become more stringent, and our need for fast and convenient services is gradually increasing. Therefore, the management and service requirements for the pig farm industry are becoming increasingly strict. In order to adapt to the development of the times, major pig farm malls began to use computers extensively for management and launched pig farm management systems, which provided a new way to improve staff efficiency and reduce their work intensity.

At the same time, the computerization of the pig farm management system is also a move that conforms to the trend of the times. Nowadays, the types of pig farms are gradually increasing, and the vast amount of pig farm information has caused management problems in the pig farm industry. The pig farm industry has entered an era of rapid development, and the management of pig farm management systems has become increasingly difficult. Driven by this objective need, establishing, improving, and developing pig farm management systems can bring great benefits to administrators. of convenience.

This system is a pig farm management system made for the convenience of administrators and users. It combines the needs of users and designs a pig farm management system based on springboot and MySQL.

    1. Introduction to springboot framework

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

    1. Thesis structure arrangement

The paper will be arranged hierarchically. In addition to the abstract, table of contents, acknowledgments, and literature reference sections, the main text will also analyze the website requirements, elaborate on the general design and implemented functions, and finally list some commissioning records. The paper mainly The architecture is as follows:

Chapter 1 explains the background of the project and the practical significance of development.

Chapter 2 analyzes the feasibility and functional requirements of this system.

Chapter 3 explains the overall design of the project.

Chapter 4 clarifies the implementation of detailed functions of the pig farm management system, mainly based on the technical functional module functions.

Chapter 5 lists some system debugging and testing records.

Chapter 6 presents the conclusion of the pig farm management system.

The pig farm management system uses the mysql database for storage and development tools such as IDEA and Tomcat for development, which can bring a lot of convenience to our writing work. The system is developed using the springboot framework, which makes the system more scalable and maintainable, reduces Java configuration code, and simplifies programming code. Currently, the springboot framework is also one of the frameworks chosen by many companies.

      1. Economic feasibility analysis

The development software used in developing the pig farm management system, such as IDEA development tools, Tomcat8.0 server, MySQL5.7 database, Photoshop image processing software, etc., are all open source and free. These environments have been systematically studied in schools. , you can operate it independently without any additional cost, and the system development tools can be downloaded directly from the Internet, so it is economically feasible.

      1. Operational feasibility analysis

When designing this project, I referred to many successful cases of similar systems, systematically analyzed their operation interfaces and functions, and combined many cases together to highlight people-oriented and simplified operations, so people with basic computer knowledge can Operate this project. Therefore, there is no problem with operational feasibility.

    1. System Requirements Analysis
      1. Functional requirements analysis

The design and implementation of the pig farm management system is to make it easier for users to manage some information related to insurance claims . Users can save a lot of time and energy when searching and managing, and effectively reduce unnecessary search time. The system is functionally divided into two parts: the ordinary user terminal and the administrator terminal .

Normal client:

(1) Registration and login: When the user wants to query and manage the functions implemented in the system , he must log in to the system. If he does not have an account, on the login interface, click the "Register" button to jump to In the registration interface, fill in the registration information according to the prompts, add and submit, the user 's information is added to the database, and then enter the filled in account number and password to log in ;

(2) Personal information: Users can update their personal avatar, nickname, mobile phone number and other information by clicking the "Personal Information" button.

(3) Change password: The user clicks the "Change Password" button to change the login password. First enter the original password, then enter the new password and confirm the password. When the original password is correct and the new password is consistent twice, the change is successful. , otherwise an error message will be given.

(4) Pig information: The user clicks "Pig Information" to display all pig information. It supports querying pig information by pig number or inputting pig breed or pig weight. If you want to add new pig information, click "Add" button, enter relevant information, and click the "Submit" button to add it. At the same time, you can select a certain piece of pig information, click "Delete" to delete it, and download the import document. (5) Equipment repair report: Click the "Equipment Repair" button to view the equipment repair report submitted by you. It supports querying the equipment repair report through the device number or device name. If you want to know the detailed information of a certain equipment repair report, click " View" will enter the details interface;

(5) Sow information: Click the "Sow Information" button to view all sow information in the system. It supports querying sow information by sow number or sow breed. If you want to add a new sow , click the "Add" button, and then fill in the specific information of the sow according to the prompts. Click Submit to save the added sow information in the database. At the same time, you can click the "Match" button to enter the sow information for breeding and submit it. You can also select the sow information to be deleted and directly click the "Delete Button" to delete the sow information.

(6) Breeding information: When the user clicks "Matching Information", all the breeding information will be displayed. It supports querying the breeding information by sow number or sow breed. If you want to add new breeding information, click the "Add" button. Enter relevant information and click the "Submit" button to add it. At the same time, you can select a certain piece of breeding information and click "Delete" to delete it.

(7) Weight data: After clicking the "Weight Data" button, you will see all the weight data in the system. It supports querying the weight data by pig number or pig weight. If you want to know the detailed information of a certain pig weight data, click on the following "View" will enter the details interface;

Administrator side:

(1) Login: Users can log in through the account and password in the background. The user's account and password are set directly in the database. If you forget your password, you can click "Forgot Password" to retrieve the password;

(2) Personal information: The administrator clicks the "Personal Information" button to update the individual's avatar, nickname, mobile phone number and other information.

(3) Modify password: The administrator clicks the "Modify Password" button to change the login password. First enter the original password, then enter the new password and confirm the password. When the original password is correct and the new password is consistent after entering it twice, modify it. Successful, otherwise an error message will be given.

(4) System users: Administrators can manage and control all user roles in the system, including administrators and ordinary users. If you need to add a new user, click the "Add" button on the page and enter the above information according to the prompts. User information can be viewed in the corresponding user interface after clicking "Submit". You can click the "Delete" button behind the user to directly delete a user.

(5) Pig information: The administrator clicks "Pig Information" to display all pig information. It supports querying pig information by pig number or inputting pig breed or pig weight. If you want to add new pig information, click "Add" " button, enter relevant information, click the "Submit" button to add it, and at the same time, you can select a certain piece of pig information, click "Delete" to delete it, and download the import document.

(6) Sow information: Click the "Sow Information" button to view all sow information in the system. It supports querying sow information by sow number or sow breed. If you want to add a new sow , click the "Add" button, and then fill in the specific information of the sow according to the prompts. Click Submit to save the added sow information in the database. At the same time, you can click the "Match" button to enter the sow information for breeding and submit it. You can also select the sow information to be deleted and directly click the "Delete Button" to delete the sow information.

(7) Breeding information: The administrator clicks "Matching Information" to display all breeding information. It supports querying the breeding information by sow number or sow breed. If you want to add new breeding information, click the "Add" button , enter the relevant information and click the "Submit" button to add it. At the same time, you can select a certain piece of breeding information and click "Delete" to delete it.

(8) Feed information: Click the "Feed Information" button to view all feed information in the system. It supports querying feed information by feed name or feed number. If you want to add new feed, click the "Add" button. Then fill in the specific information of the feed according to the prompts, click Submit and the added feed information will be saved in the database. At the same time, you can click the "Submit Feed" button to enter the feed information for submission, or you can select the feed information to be deleted and click directly "Delete button" to delete feed information.

(9) Feeding information: When the administrator clicks "Feeding Information", all feeding information will be displayed. Feeding information can be queried by feed number or feed name. If you want to add new feeding information, click the "Add" button and enter Related information can be added by clicking the "Submit" button. At the same time, you can select a certain piece of feeding information and click "Delete" to delete it.

      1. Non-functional requirements analysis

The non-functional requirements of the pig farm management system include the security, reliability, performance, scalability, etc. of the self-service pig farm management system . The details can be expressed in the following 3-1 table:

Table 2.1 Non-functional requirements table for pig farm management system

safety

Mainly refers to the installation of the pig farm management system database, the use of the database and the setting of passwords must comply with standards.

reliability

Reliability means that the pig farm management system can be operated according to the user's instructions. After testing, the reliability is more than 90%.

performance

Performance is a necessary condition for the pig farm management system to occupy the market, so it is best to have good performance.

Scalability

For example, the database reserves multiple attributes, such as the use of interfaces, to ensure the non-functional requirements of the system.

Ease of use

Users only need to follow the page display content of the pig farm management system and operate.

maintainability

The maintainability of pig farm management system development is very important. After testing, there is no problem with maintainability.

    1. System use case analysis

The use case diagram of ordinary user roles in the pig farm management system is shown in Figure 2.1:

Figure 2.1 Common user role use case diagram

The use case diagram of the administrator role in the pig farm management system is shown in Figure 2.2 :

Figure 2.2 Administrator role use case diagram

  • Chapter 3 Overall Design of Pig Farm Management System

After analyzing the background, significance and feasibility of project development, the next step is to discuss the functional division of the project and the design of various tables in the project database during specific implementation. In this chapter, a systematic introduction will be made.

    1. System function module design

The design of the functional module is to create a system architecture based on the specific functions that the system is to implement and how the functions are divided. It is displayed in the form of a module diagram to facilitate us to list and involve the functions . In terms of system functions, the project is divided into two modules: administrator + system user . Each module logs in and corresponds to the corresponding function. The specific function module diagram is shown in Figure 3.1.

Figure 3.1 Function module diagram of pig farm management system

    1. Database Design

The design of the database carries various data of the system. In a system, all kinds of data require a special container. The database is this container. When establishing the database, it mainly consists of two parts: the design of the database model and the design of each database table. .

      1. Database conceptual structure design

The following is the ER entity relationship diagram of the main database tables in the entire pig farm management system.

Figure 3.2 Overall ER relationship diagram of pig farm management system

      1. Database logical structure design

From the previous ER diagram, you can see that the project requires the creation of many data tables. The following is the relational model of the main database tables in the project:

Table body_weight_data (weight data)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

body_weight_data_id

int

10

0

N

Y

Weight data ID

2

pig_number

varchar

64

0

N

N

Pig number

3

pig_weight

varchar

64

0

Y

N

Pig weight

4

record_date

date

10

0

Y

N

Record date

5

recording_personnel

int

10

0

Y

N

0

record keeper

6

detailed_remarks

text

65535

0

Y

N

Remarks for details

7

recommend

int

10

0

N

N

0

Intelligent Recommendation

8

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

9

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table breeding_information (breeding information)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

breeding_information_id

int

10

0

N

Y

Breeding information ID

2

sow_number

varchar

64

0

Y

N

Sow number

3

sow_breed

varchar

64

0

Y

N

Sow breed

4

breeding_time

date

10

0

Y

N

Breeding time

5

expected_production_date

date

10

0

Y

N

Estimated production date

6

days_from_production

int

10

0

Y

N

0

Days to production

7

recording_personnel

int

10

0

Y

N

0

record keeper

8

notes_details

text

65535

0

Y

N

Remark details

9

recommend

int

10

0

N

N

0

Intelligent Recommendation

10

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

11

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table feeding_information (feeding information)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

feeding_information_id

int

10

0

N

Y

Staging information ID

2

feed_number

varchar

64

0

Y

N

Feed number

3

feed_name

varchar

64

0

Y

N

Feed name

4

feed_type

varchar

64

0

Y

N

Feed type

5

feed_storage

varchar

64

0

Y

N

feed inventory

6

feed_input

varchar

64

0

Y

N

input feed

7

recording_personnel

int

10

0

Y

N

0

record keeper

8

details

text

65535

0

Y

N

Detailed information

9

recommend

int

10

0

N

N

0

Intelligent Recommendation

10

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

11

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table feed_information (feed information)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

feed_information_id

int

10

0

N

Y

Feed information ID

2

feed_number

varchar

64

0

Y

N

Feed number

3

feed_name

varchar

64

0

Y

N

Feed name

4

feed_type

varchar

64

0

Y

N

Feed type

5

manufacturer

varchar

64

0

Y

N

Manufacturer

6

feed_weight

varchar

64

0

Y

N

Feed weight

7

feed_cost

varchar

64

0

Y

N

feed cost

8

feed_storage

varchar

64

0

Y

N

feed inventory

9

recording_personnel

int

10

0

Y

N

0

record keeper

10

remarks

text

65535

0

Y

N

Remarks

11

recommend

int

10

0

N

N

0

Intelligent Recommendation

12

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

13

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table ordinary_users (ordinary users)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

ordinary_users_id

int

10

0

N

Y

Common user ID

2

user_name

varchar

64

0

Y

N

username

3

user_gender

varchar

64

0

Y

N

User gender

4

user_age

varchar

64

0

Y

N

User age

5

examine_state

varchar

16

0

N

N

passed

Approval Status

6

recommend

int

10

0

N

N

0

Intelligent Recommendation

7

user_id

int

10

0

N

N

0

User ID

8

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

9

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table pig_classification (pig classification)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

pig_classification_id

int

10

0

N

Y

Pig classification ID

2

pig_breeds

varchar

64

0

Y

N

Pig breeds

3

recommend

int

10

0

N

N

0

Intelligent Recommendation

4

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

5

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table pig_information (pig information)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

pig_information_id

int

10

0

N

Y

Pig information ID

2

pig_number

varchar

64

0

N

N

Pig number

3

pig_breeds

varchar

64

0

Y

N

Pig breeds

4

pig_weight

varchar

64

0

Y

N

Pig weight

5

feeding_time

varchar

64

0

Y

N

feeding time

6

recording_personnel

int

10

0

Y

N

0

record keeper

7

remarks

text

65535

0

Y

N

Remarks

8

recommend

int

10

0

N

N

0

Intelligent Recommendation

9

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

10

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table profit_information (profit information)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

profit_information_id

int

10

0

N

Y

Profit information ID

2

sold_amount

varchar

64

0

Y

N

Amount sold

3

cost_amount

varchar

64

0

Y

N

cost amount

4

profit_amount

varchar

64

0

Y

N

Profit amount

5

record_date

date

10

0

Y

N

Record date

6

recording_personnel

int

10

0

Y

N

0

record keeper

7

details

text

65535

0

Y

N

Detailed information

8

recommend

int

10

0

N

N

0

Intelligent Recommendation

9

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

10

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

Table sow_information (sow information)

serial number

name

type of data

length

Decimal places

Allow null values

primary key

default value

illustrate

1

sow_information_id

int

10

0

N

Y

Sow information ID

2

sow_number

varchar

64

0

N

N

Sow number

3

sow_breed

varchar

64

0

Y

N

Sow breed

4

sow_weight

varchar

64

0

Y

N

Sow weight

5

number_of_listings

varchar

64

0

Y

N

Number of times put out

6

listing_quantity

varchar

64

0

Y

N

Production volume

7

accumulated_listings

varchar

64

0

Y

N

Cumulative slaughter

8

recording_personnel

int

10

0

Y

N

0

record keeper

9

remarks

text

65535

0

Y

N

Remarks

10

recommend

int

10

0

N

N

0

Intelligent Recommendation

11

create_time

datetime

19

0

N

N

CURRENT_TIMESTAMP

creation time

12

update_time

timestamp

19

0

N

N

CURRENT_TIMESTAMP

Update time

  • Chapter 4 Design and Implementation of Key Modules
    1. Login module

Administrators and ordinary users enter their account number + password on the login interface and click the "Login" button. The system will match the accounts of the administrator and ordinary users in the user database table. If the account number and password are correct, they will log in to each system. The user's main management interface, otherwise the corresponding information will be prompted and the user will return to the login interface. The main interface is displayed as shown in Figure 4.1 below.

Figure 4.1 Login interface diagram

The login key code is as follows.

  /**

     * Log in

     * @param data

     * @param httpServletRequest

     * @return

     */

    @PostMapping("login")

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

        log.info("[Execute login interface]");

        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, "Account or password cannot be empty");

        }

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

            return error(30000, "Account or password cannot be empty");

        }

        //Determine whether there is this user

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

            return error(30000,"User does not exist");

        }

        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,"User group does not exist");

        }

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

        //Query user review status

        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. 注册模块

不是猪场管理系统中用户的是可以在线进行注册的,当用户点击“注册”按钮的时候,当填写上自己的账号+密码+确认密码+昵称+邮箱+手机号等信息后再点击“注册”按钮后将会先验证输入的有没有空数据,再次验证密码和确认密码是否是一样的,最后验证输入的账户名和数据库表中已经注册的账户名是否重复,只有都验证没问题后即可注册成功。其用户注册界面展示如下图4.2所示。

图4.2注册界面图

注册关键代码如下所示。

/**

     * 注册

     * @param user

     * @return

     */

    @PostMapping("register")

    public Map<String, Object> signUp(@RequestBody User user) {

        // 查询用户

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

        query.put("username",user.getUsername());

        List list = service.select(query, new HashMap<>()).getResultList();

        if (list.size()>0){

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

        }

        user.setUserId(null);

        user.setPassword(service.encryption(user.getPassword()));

        service.save(user);

        return success(1);

}

/**

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

     */

    @Id

    @GeneratedValue(strategy = GenerationType.IDENTITY)

    @Column(name = "user_id")

    private Integer userId;

    /**

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

     */

    @Basic

    @Column(name = "state")

    private Integer state;

    /**

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

     */

    @Basic

    @Column(name = "user_group")

    private String userGroup;

    /**

     * 上次登录时间:

     */

    @Basic

    @Column(name = "login_time")

    private Timestamp loginTime;

    /**

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

     */

    @Basic

    @Column(name = "phone")

    private String phone;

    /**

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

     */

    @Basic

    @Column(name = "phone_state")

    private Integer phoneState;

    /**

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

     */

    @Basic

    @Column(name = "username")

    private String username;

    /**

     * 昵称:[0,16]

     */

    @Basic

    @Column(name = "nickname")

    private String nickname;

    /**

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

     */

    @Basic

    @Column(name = "password")

    private String password;

    /**

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

     */

    @Basic

    @Column(name = "email")

    private String email;

    /**

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

     */

    @Basic

    @Column(name = "email_state")

    private Integer emailState;

    /**

     * 头像地址:[0,255]

     */

    @Basic

    @Column(name = "avatar")

    private String avatar;

    /**

     * 创建时间:

     */

    @Basic

    @Column(name = "create_time")

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

    private Timestamp createTime;

    @Basic

    @Transient

    private String code;

}

    1. 系统用户模块

管理员可以对系统中所有的用户角色进行管控,包含了管理员以及普通用户这两种角色,如果需要添加新的用户,点击页面中的“添加”按钮根据提示输入上用户信息,点击“提交”以后在对应的用户界面就可以查看到了,可以点击用户后面的“删除”按钮直接删除某一用户,这里以普通用户为例。界面如下图4.3所示。

图4.系统用户界面图

系统用户关键代码如下所示。

 @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. 母猪信息模块

点击“母猪信息”这个菜单,可以查看到系统中所有添加的母猪信息,支持通过母猪编号或者母猪品种对母猪信息进行查询,如果想要了解某一母猪的详细信息,点击后面的“详情”会进入详情界面,用户和管理员如果想要选择某一母猪,点击“配种”按钮,根据提示填写对应的信息,点击“提交”按钮,信息没有错误在数据库就会提交成功,配种成功。界面如下图4.4所示。

图4.4 母猪信息界面图

母猪信息代码如下。

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

}

    1. 配种信息模块

管理员点击“配种信息”会显示出所有的配种信息,支持通过母猪编号或者母猪品种对配种信息进行查询,如果想要添加新的配种信息,点击“添加”按钮,输入相关信息,点击“提交”按钮就可以添加了,同时可以选择某一条配种信息,点击“删除”进行删除。界面如下图4.5所示。

图4.5配种信息界面图

配种信息关键代码如下所示。

 @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. 体重数据模块

管理员点击“体重数据”会显示出所有的体重数据信息,支持通过生猪编号或者生猪体重对体重数据信息进行查询,如果想要添加新的体重数据信息,点击“添加”按钮,输入相关信息,点击“提交”按钮就可以添加了,同时可以选择某一条体重数据信息,点击“删除”进行删除。界面如下图4.6所示。

图4.6 体重数据界面图

    1. 饲料信息模块

点击“饲料信息”这个菜单,可以查看到系统中所有添加的饲料信息,支持通过饲料名称对饲料信息进行查询,如果想要了解某一饲料的详细信息,点击后面的“详情”会进入详情界面,用户和管理员如果想要选择某一饲料,点击“投料”按钮,根据提示填写对应的信息,点击“提交”按钮,信息没有错误在数据库就会提交成功,投料成功。界面如下图4.5所示。

图4.7饲料信息界面图

    1. 投料信息模块

管理员点击“投料信息”会显示出所有的投料信息,支持通过饲料编号或者饲料名称对投料信息进行查询,如果想要添加新的投料信息,点击“添加”按钮,输入相关信息,点击“提交”按钮就可以添加了,同时可以选择某一条投料信息,点击“删除”进行删除。界面如下图4.8所示。

图4.8 投料信息界面图

    1. 利润信息模块

点击“利润信息”这个菜单,可以查看到系统中所有添加的利润信息,支持通过售出金额或者成本金额对利润信息进行查询,添加新的利润信息,点击“添加”按钮,根据提示输入利润信息,点击“提交”按钮,新的利润信息就在系统中显示出来了,也可以对添加的利润信息进行删除。界面如下图4.9所示。

图4.9 利润信息界面图

通过前面章节的介绍,我们可以看到本猪场管理系统已经完成了,但是能不能投入使用还是未知,因为在每个项目正式使用之前必须对开发的项目进行测试,如果不进行测试一旦投入使用可能会出现很多未可知的问题,比如使用人数太多导致系统瘫痪,比如某一功能存在bug信息填写错误等等,这些错误将给使用者带来很多的困扰,甚至造成更大的损失,因此测试是项目投入使用的最后一步,为用户提供一个运行顺畅、完美的项目也就是我们进行最后测试的目的。

    1. 系统部分测试

用户登录功能测试:

表5.1 用户登录功能测试表

测试名称

测试功能

操作过程

预期结果

测试结果

用户登录模块测试

用户登录成功的情况

点击前登录界面输入账号和密码分别输入admin和admin后点击“登录”按钮。

登录成功并调整到用户界面

正确

生猪信息添加功能测试:

表5.2 生猪信息添加功能测试表

测试名称

测试功能

操作过程

预期结果

测试结果

生猪信息添加模块测试

生猪信息添加成功的情况

在生猪信息的页面中将点击添加,输入生猪相关信息,输入正确的信息后然后点击“提交”按钮。

提示添加成功

正确

生猪信息添加模块测试

生猪信息添加失败的情况

在生猪信息页面中不填写的生猪编号,其他信息正常输入“提交”按钮。

提示“添加失败,信息不能为空”

正确

查询母猪信息功能模块测试:

表5.3 查询母猪信息功能测试表

测试名称

测试功能

操作过程

预期结果

测试结果

查询母猪信息功能测试

查询成功的情况

在母猪信息界面输入母猪编号进行查询

查询成功

正确

配种信息添加功能测试:

表5.4 配种信息添加功能测试表

测试名称

测试功能

操作过程

预期结果

测试结果

配种信息添加模块测试

配种信息添加成功的情况

在配种信息的页面中将点击添加,输入配种信息相关信息,输入正确的信息后然后点击“提交”按钮。

提示添加成功

正确

配种信息添加模块测试

配种信息添加失败的情况

在配种信息页面中不填写的母猪编号或者母猪名称,其他信息正常输入“提交”按钮。

提示“添加失败,信息不能为空”

正确

    1. 系统测试结果

通过编写猪场管理系统的测试用例,已经检测完毕用户的登录模块、生猪信息添加模块、查询利润信息模块、配种信息添加模块的功能测试,在对以上功能得测试过程中,发现了系统中的很多漏送并进行了完善,经过多人在线进行测试,系统完全可以正常运行,当然在后期的维护中系统将不断完善。

  • 6 章 结论

在开发本猪场管理系统之前我胸有成竹,觉得很简单,但在实际的开发中我发现了自身的很多问题,许多编程思想和方法都还没有掌握牢靠,比如Jquery、AJAX 、Spring、SpringMVC等许多Java Web开发技术,通过开发这个猪场管理系统我成长了很多,懂得了做什么事情都要脚踏实地,不能眼高手低,在本次猪场管理系统的开发中我逐渐掌握逐渐熟悉的技术。

本次猪场管理系统的开发中我还学会了例如良好的编程思想和完善的规划思想。在着手编程之前需要罗列出程序框架的大概,脑海中构建出程序的主题框架。做好这一步我们才能胸有成竹的经行开发项目。当设计框架了熟于心之后,需要思考本次编程所需的主要知识点和技术点,并充分学习。如此一来项目的开发才能循序渐进、如丝般顺滑,长久以往就能养成良好的开发习惯。一个程序好不好还要看出的bug多不多,如果在项目完成前做好bug的查验与预防可能发生的事故才能保证程序的稳定长久性运行。如果项目在完工后出现各种问题自己,那么在进入社会后,不仅会给公司团队带来麻烦和增加不必要的工作,还会导致客户流失,公司对自己的评价下降。

在本次项目中我也暴露了诸多问题。对于Java的编程知识有所欠缺,环境配置和算法上出现诸多问题,时常导致项目运行出错,或者目标的实现有问题。或者实现想法时算法未优化,使得代码冗长,程序运行不顺畅。

参考文献

[1] Yang Yingying, Qiao Yunhua, Ban Yurong. RS10 system management based on spring boot microservice architecture [J]. Manufacturing Automation, 2021, 43(12): 193-196.

[2] Li Yaqin. Research on the advantages of Java programming language and its application practice [J]. Internet Weekly, 2021(24):60-62.

[3] Tu Huayan. Database design of dormitory management system based on MySQL [J]. Computer Programming Skills and Maintenance, 2021(12):104-106.DOI:10.16184/j.cnki.comprg.2021.12.038.

[4] An Chenhao, Yu Ronghuan. Construction of a world-ground integrated network structure database based on MySQL [J]. Ordnance Industry Automation, 2021, 40(12): 66-70.

[5] Ding Haiyang, Wang Haoxiang, Yao Quanzhu. Design and implementation of automobile sales management system based on MVVM framework [J]. Electronic Production, 2021(22):55-56+8.DOI:10.16589/j.cnki.cn11-3571 /tn.2021.22.019.

[6]Sufyan bin Uzayr. Mastering Java:A Beginner's Guide[M].CRC Press:2021-11-01.

[7] Shan Shuqian, Ren Jiaxun. Design and implementation of database principle website based on SpringBoot and Vue framework [J]. Computer Knowledge and Technology, 2021, 17(30): 40-41+50.DOI: 10.14004/j.cnki .ckt.2021.2868.

[8] Wang Shuai. Design of informationized pig farm management system and its application in breeding sow farms [D]. Shihezi University, 2021.

[9] Wang Liangliang. Design of intelligent and precise livestock and poultry breeding management system - taking pig breeding as an example [J]. Journal of Shandong Vocational and Technical College of Commerce, 2021, 21(02): 107-110.DOI: 10.13396/j.cnki .jsict.2021.02.025.

[10] Qinglin, Wang Chunguang, Jin Min, Wulan Tuya. Design and implementation of small-scale pig farm management system based on Django [J]. Heilongjiang Animal Husbandry and Veterinary Medicine, 2021(02):1-5+158-159 .DOI:10.13881/j.cnki.hljxmsy.2020.02.0387.

[11] Wang Ruinian, Zhang Jia, Huang Shouting. Construction practice of digital pig management system [J]. Today's Pig Industry, 2021(01):9-13.

[12] Chai Jie. Application status and development trends of Internet of Things pig farms in my country [J]. Swine Science, 2020, 37(12): 86-89.

[13] Wang Shuai, Hu Xiaoliang, Huang Tao, Xie Biao, Nie Cunxi, Yang Zhiwei, Hao Kexing, Wang Jing, Hu Guangdong. Evaluation of the application effect of information management system in sow production [J]. Journal of Livestock Ecology, 2020, 41(11):74-78.

[14] Qing Lin. Research on digital management system for small pig farms in northern regions [D]. Inner Mongolia Agricultural University, 2020. DOI: 10.27229/d.cnki.gnmnu.2020.000855.

[15] Xie Lulu. Design and R&D of intelligent sow feeding and management system [D]. Southwest University, 2020.DOI:10.27684/d.cnki.gxndx.2020.000988.

[16] Wang Xuemin, Fang Xiaomin, Fu Yanfeng, Tu Feng, Wang Li, Li Bixia, Zhao Weimin, Xu Xiaobo, Ren Shouwen. Design and use of pig farm financial reimbursement software [J]. Pig Industry Science, 2020, 37(01):136 -137.

[17]Kan Ji, Xiaojun Chen, Aoming Qin, Jia Liu, Jinmei Wu. Design and Implementation of Teaching Quality Evaluation System Based on SpringBoot[C]//Proceedings of the Seventh International Academic Conference on Computing and Information Science., 2019: 444-452.

[18] Ma Guanjun, Liu Xiangdong. Application and research progress of pig farm production management system [J]. Swine Science, 2019, 36(05): 122-124.

[19] Shufan Liu, Ximei Li, Peng Sun. Design and Implementation of Communication Base Station Survey System based on Springboot[C]//Proceedings of the 2018 Academic Conference on Smart Education and Artificial Intelligence Development (Part 1)., 2018:34 -36.

[20] Li Xinjian, Development and application of intelligent pig farm digital management system. Henan Province, Henan Agricultural University, 2018-12-01.

Acknowledgments

This concludes the paper, thank you for reading. I would like to express my special thanks to my supervisor. Although I was very busy during my internship and often made corrections while writing my thesis, my supervisor was still very responsible and asked me about the progress of my tasks from time to time and followed up. As for the progress of my thesis, with the help of my advisor, I gradually completed my thesis and procedures. I also learned a lot of knowledge and experience from my advisor, which benefited me a lot. At the same time, I also saw my own shortcomings from my mentor, whether it was on a technical level or in terms of attitude towards work. The mentor was like a mirror that reflected my shortcomings and shortcomings. In addition, I would also like to thank my classmates and people in society who helped me with my papers and programs during my internship. I didn’t know much about the springboot framework before, but they gave me a lot of help when I was writing programs. The inspiration and reflections also helped me debug and detect the program. Without them, I would not have been able to successfully complete this graduation project. At this point, my graduation project has come to a successful conclusion.

To get the project source code for free, please follow ❥ Like, collect and send a private message to the blogger, thank you~

Guess you like

Origin blog.csdn.net/vx1_Biye_Design/article/details/133039310