Server data unified verification method and system, electronic equipment and storage medium

By establishing a basic verification rule library and business logic library in the information business system, using Groovy scripts to implement verification logic, and dynamically updating verification rules and scripts in the database, the problem of difficult to unify verification logic and dynamic hot updates in various business links in the existing technology is solved, and the effect of dynamically updating verification logic and meeting data verification needs without shutting down maintenance is achieved.

CN120010892APending Publication Date: 2025-05-16自然资源部重庆测绘院
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510008231.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

In an information business system, it is difficult for the existing technology to unify the verification logic of each business link, dynamic thermal update verification logic, and meet the operation logic and data requirements of other related business modules that need to call the data verification during data verification without shutting down maintenance.

Method used

By establishing a basic verification rule library and a business logic library, using Groovy scripts to implement verification logic, including basic verification logic and business verification logic, and dynamically update verification rules and scripts in the database to achieve dynamic hot updates.

Benefits of technology

It realizes dynamic update of the verification logic without shutting down maintenance and user unconsciousness, unifying the verification logic of each business link, and meeting the operation logic and data requirements of other related business modules that need to be called during data verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120010892A_ABST
    Figure CN120010892A_ABST
Patent Text Reader

Abstract

The invention discloses a server-side data unified verification method and system, electronic equipment and a storage medium. The method comprises the steps that a basic verification rule base is established; establishing a business logic library; receiving data and executing verification, including executing basic verification logic and business verification logic; a verification result is returned; dynamically updating the basic verification rule and the Grouping script; wherein the basic verification rule and the Groomy script code are both stored in a database which can be modified online. According to the scheme, the server-side verification can effectively solve the defect that verification cannot be carried out when data is directly submitted by bypassing a front-end page; the verification requirements can be met when data is imported in batches through a table and data exchange with other systems is carried out through a data interface; data filled and reported by a front end, data imported in batches and data exchanged with other systems through a data interface can be verified by using uniform logic; and the verification logic can be dynamically updated on the premise of non-stop maintenance and no perception of a user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information-based business system construction, and in particular to data reporting rules, unified control of reporting quality, and dynamic hot update control logic technology. Background Art

[0002] When developing an information-based business system, in order to ensure data quality, it is necessary to perform format verification and quality control on the data reported by users and the data interacting with other related systems through data interfaces. This data format verification and quality control requirement usually runs through all aspects of the business process.

[0003] There are two common data verification methods: front-end verification and server-side verification. The two methods have different application scenarios. When using the server-side verification mode, the problems that usually need to be solved include: 1. How to unify the verification logic of each business link; 2. How to dynamically update the verification logic without stopping the machine for maintenance and without user awareness? 3. How to meet the needs of calling the operation logic of other related business modules in the system and other related business data to participate in the verification logic operation during data verification. Summary of the invention

[0004] The purpose of the present invention is to provide a server-side data unified verification method, system, electronic device and storage medium, which can solve at least one of the above problems based on the server-side verification mode.

[0005] According to a first aspect of the present invention, a unified verification method for server data is provided, which comprises: Establish a basic verification rule base; Establish a business logic library, which stores the Groovy script code that implements the verification logic. The verification logic includes two types of information: basic verification logic and business verification logic. Each verification logic contains a Groovy script and an execution sequence number. Receive data and perform verification, including executing basic verification logic and business verification logic; Return the verification results; after all the verifications are completed, the verification results are summarized and returned at one time; Dynamically update basic validation rules and Groovy scripts; The basic validation rules and Groovy script codes are stored in a database that can be modified online.

[0006] According to the unified verification method for server-side data, the basic verification rule library includes: field alias, used for display; field name, used to mark field uniqueness; prohibitive regular expression; prohibitive error statement; prompt regular expression; prompt warning statement; execution sort number.

[0007] According to the unified verification method for server-side data, the basic verification logic is preset and necessary, and the business verification logic is written according to business needs.

[0008] According to the unified verification method for server-side data, in the step of receiving data and performing verification, The basic verification logic is executed before the business verification logic; If there are multiple Groovy scripts for basic verification logic, they are executed in ascending order of execution sequence number; if there are multiple Groovy scripts for business verification logic, they are also executed in ascending order of execution sequence number.

[0009] According to the unified verification method for server-side data, in the step of receiving data and performing verification, The Groovy script execution method is as follows: read the Groovy script string from the business logic library, load and execute it in Java using the GroovyClassLoader Rule class; Among them, before executing the Groovy script, dynamic compilation is required and the compilation result is cached. Before compiling, first determine whether the script in the database has changed. If not, use the compilation result in the cache to execute. If it has changed, recompile.

[0010] According to the unified verification method for server-side data, executing basic verification logic and business verification logic includes: First, the data to be verified is received through the data input interface. The data format adopts standard JSON. The key of the JSON data is matched with the field name in the basic verification rule library to query the corresponding basic verification rule regular expression; wherein, it is verified whether the value in the JSON data meets the requirements of the prohibitive regular expression. If not, the prohibitive error message is recorded, and the verification of the field is ended, and the verification of the next field is continued; if it meets, the verification of the prompt regular expression is executed; if it does not meet the prompt rule, the corresponding prompt message is recorded, and the verification of the field is completed, and then the verification of the next field in the JSON is carried out; Then, the business logic verification is performed according to the sequence number; if it is necessary to use the operation logic and business data in other business modules in the system to participate in the logical operation, the Java function of the business module of the system is called in the Groovy script.

[0011] According to the unified verification method for server-side data, calling the Java function of the business module of the system in the Groovy script includes: Introduce the Java class that needs to call the module into the business logic verification Groovy script, obtain the instance object through the BeanFactory of the Spring framework, and then use the method functions of this object to implement logical operations and data queries.

[0012] According to a second aspect of the present invention, a server-side data unified verification system is provided, which is used to execute the server-side data unified verification method according to any one of claims 1 to 7, and the system includes a data quality control module, and the data quality control module has: The basic verification rule library is used to store separate verification rules for each field of the business data to be verified; Business logic library, used to store the logic for mutual verification between different fields, as well as the operation logic that needs to be introduced into other business modules other than the data quality control module in the system and the verification logic of business data participating in logical operations; A data input interface, used to receive data to be verified; Data output interface, used to output verification results.

[0013] According to a third aspect of the present invention, there is provided an electronic device, comprising a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.

[0014] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0015] Beneficial effects: 1. Compared with data verification on the front end, server-side verification can effectively solve the defect that verification cannot be performed when data is submitted directly without bypassing the front-end page.

[0016] 2. It can meet the verification requirements when importing data in batches through tables and exchanging data with other systems through data interfaces.

[0017] 3. Ability to use unified logic to verify data reported by the front end, data imported in batches, and data exchanged with other systems through data interfaces.

[0018] 4. Ability to dynamically update verification logic without downtime for maintenance and without user awareness.

[0019] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The present invention is further described below in conjunction with the accompanying drawings and embodiments; Figure 1 Schematic diagram of calling data verification module for business module; Figure 2 It is a schematic diagram of data verification and dynamic update verification rules; Figure 3 Flowchart for basic rule verification. DETAILED DESCRIPTION

[0021] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0022] Reference Figure 1-3 , the unified verification method of server data in an embodiment of the present invention comprises: Establish a basic verification rule base; Establish a business logic library, which stores the Groovy script code that implements the verification logic. The verification logic includes two types of information: basic verification logic and business verification logic. Each verification logic contains a Groovy script and an execution sequence number. Receive data and perform verification, including executing basic verification logic and business verification logic; Return the verification results; after all the verifications are completed, the verification results are summarized and returned at one time; Dynamically update basic validation rules and Groovy scripts; The basic validation rules and Groovy script codes are stored in a database that can be modified online.

[0023] The basic validation rule base stores separate validation rules for each field of business data. The basic validation rule base specifically contains the following information: field alias (for display); field name (for marking field uniqueness); prohibitive regular expression (mandatory validation rule for this field, used for restriction); prohibitive error statement; suggestive regular expression (non-mandatory validation rule for this field, used for reminder); suggestive warning statement; execution sort number.

[0024] The business logic library stores the logic for mutual verification between different fields and the verification logic that needs to be introduced into other business modules and other data in the system to participate in logical operations. The basic verification logic is preset and necessary, and the business verification logic is written according to business needs.

[0025] In the step of receiving data and performing verification, the basic verification logic is executed before the business verification logic. Among them, if there are multiple Groovy scripts for the basic verification logic, they are executed in order of execution sequence number from small to large; if there are multiple Groovy scripts for the business verification logic, their execution sequence is also executed in order of execution sequence number from small to large. The Groovy script execution method is: read the Groovy script string from the business logic library, and use the Groovy ClassLoader Rule class in Java to load and execute it. Among them, before executing the Groovy script, dynamic compilation is required, and the compilation result is cached; before compiling, first determine whether the script in the database has changed. If it has not changed, use the compilation result in the cache to execute. If it has changed, it needs to be recompiled.

[0026] The process of executing basic validation logic and business validation logic includes: First, the data to be verified and other parameters are received through the data input interface. The data format is standard JSON. The key of the JSON data is matched with the field name in the basic verification rule library to query the corresponding basic verification rule regular expression. Among them, the value in the JSON data is verified to see if it meets the requirements of the prohibitive regular expression. If not, the prohibitive error message is recorded, and the verification of the field is ended, and the verification of the next field is continued. If it meets the requirements, the verification of the prompt regular expression is executed. If it does not meet the prompt rule, the corresponding prompt message is recorded, and the verification of the field is completed, and then the verification of the next field in the JSON is carried out.

[0027] Then, perform business logic verification according to the sequence number. When performing business logic verification, if you need to use the operation logic and business data in other business modules other than the aforementioned data quality control module in the system to participate in the logical operation, you can call the Java function of the system's business module in the Groovy script. The specific calling method is: introduce the Java class of the module to be called in the business logic verification Groovy script, obtain the instance object through the BeanFactory of the Spring framework, and then use the method function of this object to implement logical operations and data queries.

[0028] Since the basic validation rules and logic validation Groovy are stored in the database, they can be modified online by modifying the database, achieving non-stop maintenance and user-unaware updates.

[0029] The present invention also provides a unified data verification system for the server side, which is used to execute the unified data verification method for the server side, wherein the system includes a data quality control module, and the data quality control module has a basic verification rule library, a business logic library, a data input interface, and a data output interface. The verification rule library stores a separate verification rule for each field of the business data to be verified, the business logic library stores the logic for mutual verification between different fields, and the operation logic in other business modules other than the data quality control module that needs to be introduced into the system and the verification logic for business data participating in logical operations, the data input interface is used to receive the data to be verified and other parameters, and the data output interface is used to output the verification results.

[0030] In summary, in the solution of the present invention, Java is used as the implementation language of the method, and Groovy is used as the dynamic scripting language. The dynamic hot update of the verification logic is realized through the dynamic compilation characteristics of Groovy. An independent data quality control module can be developed in the information system. When the business module in the information system needs to verify the data, the data quality control module is called to perform the verification, thereby ensuring the consistency of the data verification logic of each module and each business link in the whole system.

[0031] The embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.

Claims

1. A unified verification method for server-side data, characterized in that: include: Establish a basic verification rule base; Establish a business logic library, which stores the Groovy script code that implements the verification logic. The verification logic includes two types of information: basic verification logic and business verification logic. Each verification logic contains a Groovy script and an execution sequence number. Receive data and perform verification; Including executing basic verification logic and business verification logic; Return the verification results; after all the verifications are completed, the verification results are summarized and returned at one time; Dynamically update basic validation rules and Groovy scripts; The basic validation rules and Groovy script codes are stored in a database that can be modified online.

2. The unified verification method for server-side data according to claim 1, characterized in that: The basic validation rule base includes: field alias, used for display; field name, used to mark field uniqueness; Prohibitory regular expression; prohibitory error statement; suggestive regular expression; suggestive warning statement; execution sequence number.

3. The unified verification method for server-side data according to claim 2, characterized in that: The basic validation logic is preset and required, and the business validation logic is written according to business needs.

4. The unified verification method for server data according to claim 3, characterized in that: In the step of receiving data and performing verification, The basic verification logic is executed before the business verification logic; If there are multiple Groovy scripts for basic verification logic, they are executed in ascending order of execution sequence number; if there are multiple Groovy scripts for business verification logic, they are also executed in ascending order of execution sequence number.

5. The unified verification method for server data according to claim 4, characterized in that: In the step of receiving data and performing verification, The Groovy script execution method is as follows: read the Groovy script string from the business logic library, load and execute it in Java using the GroovyClassLoader Rule class; Among them, before executing the Groovy script, dynamic compilation is required and the compilation result is cached. Before compiling, first determine whether the script in the database has changed. If not, use the compilation result in the cache to execute. If it has changed, recompile.

6. The unified server data verification method according to claim 5, characterized in that: Executing basic validation logic and business validation logic includes: First, the data to be verified is received through the data input interface. The data format adopts standard JSON. The key of the JSON data is matched with the field name in the basic verification rule library to query the corresponding basic verification rule regular expression; wherein, it is verified whether the value in the JSON data meets the requirements of the prohibitive regular expression. If not, the prohibitive error message is recorded, and the verification of the field is ended, and the verification of the next field is continued; if it meets, the verification of the prompt regular expression is executed; if it does not meet the prompt rule, the corresponding prompt message is recorded, and the verification of the field is completed, and then the verification of the next field in the JSON is carried out; Then, the business logic verification is performed according to the sequence number; if it is necessary to use the operation logic and business data in other business modules in the system to participate in the logical operation, the Java function of the business module of the system is called in the Groovy script.

7. The unified verification method for server data according to claim 6, characterized in that: The Java functions of the business modules of the system that are called in the Groovy script include: Introduce the Java class that needs to call the module into the business logic verification Groovy script, obtain the instance object through the BeanFactory of the Spring framework, and then use the method functions of this object to implement logical operations and data queries.

8. The server-side data unified verification system is characterized by: The method for unified verification of server-side data according to any one of claims 1 to 7 comprises a data quality control module, wherein the data quality control module has: The basic verification rule library is used to store separate verification rules for each field of the business data to be verified; Business logic library, used to store the logic for mutual verification between different fields, as well as the operation logic that needs to be introduced into other business modules other than the data quality control module in the system and the verification logic of business data participating in logical operations; A data input interface, used to receive data to be verified; Data output interface, used to output verification results.

9. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.