Design and implementation of NoSQL-based non-relational database data storage system

Author Homepage: Programming Compass

About the author: High-quality creator in the Java field, CSDN blog expert, invited author of Nuggets, many years of architect design experience, resident lecturer in Tencent Classroom

Main content: Java project, graduation design, resume template, learning materials, interview question bank, technical mutual assistance

Favorites, likes, don't get lost, it's good to follow the author

Get the source code at the end of the article 

Item Number: None

1. Environmental introduction

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or eclipse

2. Project introduction

The emergence of NoSQL database is to solve the challenges brought by multiple data types of large-scale data collections, especially the big data application problems, including the storage of ultra-large-scale data. This time, the document management system based on MongoDB was selected, which aims to design a convenient and fast document management system. During the development of this system, the database of the system uses MongoDB database, the front end of the system mainly uses HTML, and the back end of the system uses the Django framework of Python language. The system sets that only when the user successfully logs in can he enter the system for corresponding operations. The password is encrypted by a hash function, which greatly ensures the security of the password. All users can upload and download documents using this system, and supervisors and system administrators can add approval operations. In addition, administrators can perform additions, deletions, and modifications to users. Finally, after the operation test, the system can run smoothly, the system interface is simple, the operation is simple, it can optimize office efficiency, save manpower, meet the purpose and requirements of system development, and is of great significance to promote the informationization of document management.

Using a computer to operate documents is different from manual work. With the continuous increase of company employees and documents and other data, how to manage documents in the simplest way and connect them with users is an important content of this research project. Computer technology will be deeply involved in in the document management system. How to link system function modules with users and assign permissions is the key point of the system, as well as the logical relationship and operation process realized by function modules. This document management system is a project implemented based on the MongoDB database [ 5 ] . Main content of the subject:

1. Analyze the characteristics of the document management system and determine the relationship between modules;

2. Determine the non-relational database storage method;

3. Realize the logical relationship of related businesses such as login, user addition, deletion and modification;

4. Analyze the requirements of the system, clarify which functions and implementation methods need to be realized, etc. [ 6 ] ;

5. Assign permissions, set permissions for system administrators, supervisors and auditors, and ordinary users. Different permissions can perform different functions.

1. Document management: Document management based on non-relational data is the core work of system design, and users with different identities have different operational permissions on documents. For ordinary users, files can be uploaded and downloaded. For supervisory auditors and system administrators, in addition to the functions of uploading and downloading documents that ordinary users have, they also have the authority to approve documents uploaded by users.

2. Login function: The login function of the system is a necessary link to ensure the security of the system. There are three types of login objects, and different categories have different operation rights to the system. The three types of login objects are: ordinary users, system administrators, and supervisors and auditors.

3. User management: According to different types of login users, assign different operation rights. The authority of the administrator identity includes operations of adding, deleting, and modifying the administrator's personal password and other user-related information; the authority of supervising the identity of the auditor includes uploading and downloading files, viewing files and exporting file information; The authority of ordinary users can only modify the user's own password and personal information.

4. Role management: The role management function is mainly to manage the types of login objects, and different sub-roles can be assigned to objects. Supervisors and auditors can approve documents, which can be divided into first-instance review and second-instance review according to different sub-roles. The system administrator conducts final review on documents, but cannot conduct final review on files uploaded by himself. During the process of the first and second trial of the document, the first and second reviewers can check the specific content of the document.

(1) Add user function

The function of adding users is one of the basic functions of the document management system. After entering the webpage management page, the administrator clicks Add Personnel, enters the job number and name, and clicks Save to complete the creation of a new user; the login page requires the user to enter his own user name Name and password, the initial password is 123456, you can modify it after entering the system. After input, the system will verify whether the user exists in the database. If it exists, compare whether the password is the same as that in the database. If they are the same, the verification is passed and the document management page is entered. Otherwise, it will display account or password error. In order to ensure the security of the user, when the user modifies the password, the user password will be encrypted and stored in the database through the hash function, so as to avoid user security issues from causing harm to the system.

(2) View information

Ordinary users can view their uploaded documents and all document information; administrators and auditors can view all information of all users and all uploaded documents.

(3) User information

This operation is implemented by the administrator. On the Add User page, the administrator can create, delete, modify users and assign permissions, and at the same time assign users to different departments.

 

Users of the document management system are divided into three types according to the permissions of the login objects, namely ordinary users, supervisors and auditors, and system administrators.

Ordinary users only have the functions of uploading and downloading files and changing personal passwords.

 In addition to uploading and downloading documents and changing personal passwords, supervisory auditors can also view the content of documents uploaded by users, conduct first and second examinations on documents, and import all document information into excel.

In addition to the functions of ordinary users, the system administrator can also add and modify users, and can finalize the document and choose to return the document. The specific flow chart is shown in Figure 7:

 

Figure 7 System flow chart

Three, system display

 4.1 User login

The login page of this document management system has different executable functions after entering the system according to the identity and authority of the login object. The login page requires the user to enter the user name and password. The super user, that is, the administrator, has been created on the terminal, and the common user is added by the administrator on the site. Both information is stored in the table. After clicking the login button, the system first checks whether the user name exists in the database table and whether the password is correct. After the verification is successful, it will enter the next page. After the administrator logs in, it will enter the site management page, and after the ordinary user logs in, it will enter the document management page. The login page is shown in Figure 8:

Figure 8 Login page

When the system user logs in to the module, the elements filled in by the user are transmitted to the backend in the form of a form, and the backend processes and judges. If the user enters an error, it will return the account or password input error; if it is correct, it will jump to the main page and proceed to the next step; if the account is set to quit, it will return the account is locked, please contact the administrator. The main code for backend login is as follows:

 

4.2 User modify password  

After the user logs in to the main page of the system, the operation of changing the password can be performed in the upper right corner. After clicking the change password, the user enters the change password operation. It is necessary to enter the new password twice, click save, and the database will save the encrypted password. The password modification interface is shown in Figure 9 below:

Figure 9 Change password interface

To modify the password, the user needs to enter the new password twice. If they are not the same, the two passwords will be inconsistent; if not entered, the returned password cannot be empty. The main code for modifying the password at the back end is as follows:

4.3 User Information Management

Administrators can manage all users in a unified manner, such as adding new users, viewing all user information, modifying user information, deleting users, assigning permissions to users, and assigning departments to users, etc. When implementing the user information management system, we choose to use the system modules that come with the Django framework, and on this basis, we rewrite the system, expand the functions, etc., and realize the user information management functions. When the administrator checks the user information, the user information management system will provide a table of all user information. The interface is simple and clear, and the user information is clearly visible. At the same time, a search box is designed at the top of the page. Finding a user will be easy. The page effect is shown in Figure 10:

 

Figure 10 User management effect display interface

The main code of backend user management is as follows:

 

4.3.1 Add user

The administrator has the authority to create new users. Click the Add Personnel button on the user management page, and the user management page will jump to the add user interface. The administrator can enter the user's basic information, job number, name, etc. The user name is the name, and the initial password is 123456, which can be modified by the user after the first login. Then you can set the department for the user, assign a role, and finally submit it to create a successful user. (* is required information, others are optional.) Adding users and assigning permissions is shown in Figure 11:

 

Figure 11 Add user interface

4.3.2 Modify user

When the administrator wants to modify the user's information, he needs to click the name of the user he wants to modify on the user management interface, and the page will jump to the user's information interface. The administrator can modify the information such as job number, name, and department. After modification, permissions can also be reassigned. After clicking Save, the new user information will be updated and saved in the database table. If the user's password is forgotten, the administrator can reset the password, and the password will be reset to 123456. The effect is shown in Figure 12:

      Modify user If the user name is modified, judge whether the user name conflicts with other users. The main code is as follows:

 

Figure 12 Modify user information interface

4.3.3 Delete user

The method for deleting users in this document management system is that when the system modifies the user information, the role assignment is set as a resigned employee. If the employee resigns, it is changed to a resigned employee, and the account will not be able to log in, indicating that the account is locked. The page effect display is shown in Figure 13:

 

Figure 13 Display of resigned employees

4.4 Document Management

4.4.1 Document upload

Document management is the core part of the document management system. According to the different identities of users when they log in, users have different operation rights. First of all, all users can upload and download documents, and the first and second examiners can view the specific content of the document during the first and second examination of the document. The effect display of the upload document page is shown in Figure 14:

 

Figure 14 upload document

4.4.2 Document Approval

Among them, for supervisors and auditors, they are divided into two sub-role identities, the first reviewer and the second reviewer, who approve documents. According to different sub-roles, document approval is divided into first review and second review, and the content of all documents can be viewed during the review process; for The system administrator can conduct final review on the files, or choose to return the files but cannot carry out final review on the files uploaded by himself. The page effect display is shown in Figure 15:

 

Figure 15 Document review

4.4.3 Document Information Export

Auditors can export all user-uploaded document information (including document number, file name, file path, uploading user, and upload time) to excel, and the page effect is shown in Figure 16:

 

Figure 16 export document information to excel

V. Project Summary

This paper discusses the design and implementation of a NoSQL-based non-relational database data storage system, and proposes a MongoDB-based document management system based on the storage and management of massive documents. According to the identity and authority of the login object, functions such as document upload, download, and approval can be performed. As a non-relational data storage system in non-relational data technology, MongoDB has the remarkable characteristics of high performance and high scalability of NoSQL, and as a non-relational database that is most like a relational database, it has the advantages of a traditional SQL relational database some features. For the MongoDB-based document management system discussed in this article, it has the best applicability.

The exploration and research of new technologies are always bumpy. Learning the MongoDB database from scratch, borrowing books, and searching materials all bear witness to my efforts. Although the document management system based on MongoDB has shown certain advantages in performance and scalability compared with other similar systems, there are still some shortcomings and limitations. It is hoped that the subject can be further studied in the future and the system can be improved.

Guess you like

Origin blog.csdn.net/whirlwind526/article/details/130362265