CN116401630A - Data verification method and device, storage medium and computer equipment - Google Patents

Data verification method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN116401630A
CN116401630A CN202310220653.XA CN202310220653A CN116401630A CN 116401630 A CN116401630 A CN 116401630A CN 202310220653 A CN202310220653 A CN 202310220653A CN 116401630 A CN116401630 A CN 116401630A
Authority
CN
China
Prior art keywords
request
verification
configuration table
preset
check
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310220653.XA
Other languages
Chinese (zh)
Inventor
毛志东
沈鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Shuidi Technology Group Co ltd
Original Assignee
Beijing Shuidi Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Shuidi Technology Group Co ltd filed Critical Beijing Shuidi Technology Group Co ltd
Priority to CN202310220653.XA priority Critical patent/CN116401630A/en
Publication of CN116401630A publication Critical patent/CN116401630A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/552Detecting local intrusion or implementing counter-measures involving long-term monitoring or reporting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data verification method, a data verification device, a storage medium and computer equipment, relates to the technical field of information, and mainly aims to improve the verification efficiency of data, reduce the verification cost and increase the verification range. The method comprises the following steps: receiving a data operation request sent by a client, wherein the data operation request carries a request parameter; determining the full class name information corresponding to the request parameters; determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request; and verifying the request parameters by using the preset verification rule configuration table. The invention is suitable for verifying the request data.

Description

Data verification method and device, storage medium and computer equipment
Technical Field
The present invention relates to the field of information technologies, and in particular, to a data verification method, a data verification device, a storage medium, and a computer device.
Background
When a client sends a request to a server, in order to ensure compliance of the request, verification of the request data is required.
Currently, on one hand, each request data is usually packaged as a whole, and a verification code corresponding to the whole is written to verify the request data. However, when the data amount to be verified is large, the whole verification logic needs to write longer codes, the longer codes reduce the readability, and the longer the code block is, the lower the reusability is, when the request data changes, the verification codes need to be rewritten, so that the verification efficiency of the data is lower, meanwhile, the data verification logic has strong invasiveness to the codes, and meanwhile, for similar different requests, for example, the verification rule of a part of parameters of the request is different, but two verification logic codes need to be written, so that the unnecessary development and maintenance cost is increased.
On the other hand, verification is typically performed by marking verification annotations on the requested data. However, in this verification manner, when the verification rules of the same data under different conditions are different, the verification annotation cannot realize differential verification, so that the verification range of the data is smaller.
Disclosure of Invention
The invention provides a data verification method, a data verification device, a storage medium and computer equipment, which mainly aim to improve the verification efficiency of data, reduce the development cost of software, have wider application range, are easy to operate and reduce the use threshold.
According to a first aspect of the present invention, there is provided a data verification method comprising:
receiving a data operation request sent by a client, wherein the data operation request carries a request parameter;
determining the full class name information corresponding to the request parameters;
determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request;
and verifying the request parameters by using the preset verification rule configuration table.
Preferably, the determining the full class name information corresponding to the request parameter includes:
and calling the full class name information in the request parameters by using a preset reflection mechanism.
Preferably, the determining, according to the full class name information and the request scenario corresponding to the data operation request, a preset check rule configuration table corresponding to the request parameter includes:
matching the full-class name information with each standard class name recorded in a preset check list, and determining a plurality of target standard class names matched with the full-class name information in each standard class name;
matching the request scene with standard request scenes corresponding to the target standard class names to obtain target standard request scenes matched with the request scenes;
determining a target preset check rule configuration table corresponding to the target standard request scene, and determining the target preset check rule configuration table as a preset check rule configuration table corresponding to the request parameter.
Preferably, the verifying the request parameter using the preset verification rule configuration table includes:
judging whether the preset check rule configuration table is an empty table or not;
if the preset check rule configuration table is an empty table, determining that the request parameter is qualified in check;
and if the preset check rule configuration table is a non-empty table, checking the request parameters based on each check rule recorded in the preset check rule configuration table.
Preferably, the verifying the request parameter based on each verification rule recorded in the preset verification rule configuration table includes:
determining the verification attribute corresponding to each verification rule recorded in the preset verification rule configuration table;
determining an attribute value corresponding to the verification attribute in the request parameter based on the verification attribute;
determining a verification rule corresponding to each verification rule;
and verifying the attribute value by using the verification rule.
Preferably, the arbitrary check rule includes a null value check rule, a range value check rule, an enumerated value check rule and a maximum length check rule.
Preferably, after the verifying the request parameter using the preset verification rule configuration table, the method further includes:
if the request parameters meet all the check rules in the preset check rule configuration table, determining that the request parameters pass the check;
if the request parameter does not meet any one check rule in the preset check rule configuration table, generating alarm information corresponding to the any one check rule, and displaying the alarm information on a client interface.
According to a second aspect of the present invention, there is provided a data verification apparatus comprising:
the receiving unit is used for receiving a data operation request sent by the client, wherein the data operation request carries a request parameter;
the class name determining unit is used for determining the full class name information corresponding to the request parameters;
the configuration table determining unit is used for determining a preset check rule configuration table corresponding to the request parameters according to the full class name information and the request scene corresponding to the data operation request;
and the verification unit is used for verifying the request parameters by using the preset verification rule configuration table.
According to a third aspect of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above data verification method.
According to a fourth aspect of the present invention there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above data verification method when executing the program.
Compared with the prior art, the data verification method, the device, the storage medium and the computer equipment provided by the invention have the advantages that the data operation request sent by the client is received, wherein the data operation request carries the request parameters; determining the full class name information corresponding to the request parameters; then, according to the full-class name information and a request scene corresponding to the data operation request, determining a preset check rule configuration table corresponding to the request parameter; and finally, checking the request parameters by using the preset checking rule configuration table. Therefore, the preset rule check configuration table is selected according to the full class name information corresponding to the request parameters and the request scene, and finally, each check rule recorded in the preset rule check configuration table is utilized to check the request parameters, so that the problem that when a certain client requests data change, only the data check rule of the parameter class aiming at the request in the preset check rule configuration table is required to be changed (newly added or reduced or modified), and the service end code is not required to be modified, the data check method and the system are more convenient for checking the data, further, the data check efficiency is improved, and meanwhile, when more data need to be checked or more check rules are needed, the longer check codes can be avoided, the problem that the reusability of long code blocks is lower is avoided, and therefore, the development and maintenance cost is saved. In addition, the problem that the differential verification cannot be realized due to marking verification notes can be avoided, so that the application range of the method and the device for verifying the data is wider.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 shows a flow chart of a data verification method provided by an embodiment of the invention;
FIG. 2 is a flowchart of another data verification method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data verification device according to an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating a structure of another data verification apparatus according to an embodiment of the present invention;
FIG. 5 shows an embodiment of the present invention a physical structure schematic of a computer device.
Detailed Description
The invention will be described in detail hereinafter with reference to the drawings in conjunction with embodiments. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other.
At present, the data verification efficiency is low by encapsulating each request data into a whole and writing a verification code corresponding to the whole to verify the request data, and meanwhile, the data verification range is small by marking verification notes on the request data to verify.
In order to solve the above problem, an embodiment of the present invention provides a data verification method, as shown in fig. 1, including:
101. and receiving a data operation request sent by the client, wherein the data operation request carries a request parameter.
The data operation request can be a request filled in a client by a user, and the request parameter refers to data filled in a client page by the user.
For the embodiment of the invention, when the user fills data in the client page, the data operation request is triggered, then the request parameters carried in the data operation request are acquired, for example, the user fills data in the insurance report form of the client page, the data operation request is triggered, then the request parameters in the data operation request are acquired, namely, the data filled in the insurance report form by the user, such as the filled name, the applicant age, the disease stage of the insured person and the like, are acquired.
102. And determining the full class name information corresponding to the request parameters.
The full class name information refers to a java full-limit class name, and is equivalent to a package name and a class name.
For the embodiment of the invention, in order to verify the request parameters, the full-class name information corresponding to the request parameters needs to be determined first, the full-class name information in the request parameters can be dynamically acquired by utilizing a java reflection mechanism, then the preset verification rule configuration table is determined according to the full-class name information and the request scene corresponding to the data operation request, and finally, null verification, enumeration value and the like are performed on the request parameters by utilizing each verification rule recorded in the preset verification rule configuration table, so that the problem of long verification time caused by writing the verification codes can be avoided by utilizing each verification rule recorded in the preset verification rule configuration table.
103. And determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request.
Wherein, the request scene comprises a deletion scene, a storage scene, a modification scene and a query scene.
For the embodiment of the invention, preset check rule configuration tables corresponding to various kinds of names and various request scenes are stored in a database, different kinds of names correspond to different preset check rule configuration tables, different request scenes correspond to different preset check rule configuration tables, after obtaining full-class name information corresponding to request parameters and request scenes corresponding to data operation requests, the full-class name information and the preset check rule configuration tables corresponding to the request scenes are determined in the database, and finally, the preset check rule configuration tables are utilized to check the request parameters, so that the request parameters are checked through configuration of the preset check rule configuration tables, and the problem of code writing errors can be checked.
104. And verifying the request parameters by using a preset verification rule configuration table.
The preset check rule configuration table stores various check rules, such as name check rules, age check rules and the like, corresponding to the request parameters and the request scenes, wherein each check rule comprises various check rules, such as enumeration value check rules, null value check rules, range value check rules and the like.
For the embodiment of the invention, after the preset check rule configuration table corresponding to the request parameter is determined, the request parameter can be checked by using the check rule in each check rule recorded in the preset check rule configuration table. By configuring different check rule configuration tables for different names and request scenes and checking the request parameters by using check rules corresponding to check rules in the check rule configuration tables, the problem that service end codes are rewritten due to the change of the check rules or the change of the request parameters can be avoided.
According to the data verification method provided by the invention, compared with the mode that all request data are packaged into a whole at present and verification codes corresponding to the whole are written to verify the request data, the data verification method provided by the invention is characterized in that a data operation request sent by a client is received, wherein the data operation request carries request parameters; determining the full class name information corresponding to the request parameters; then, according to the full-class name information and a request scene corresponding to the data operation request, determining a preset check rule configuration table corresponding to the request parameter; and finally, checking the request parameters by using the preset checking rule configuration table. Therefore, the preset rule check configuration table is selected according to the full class name information corresponding to the request parameters and the request scene, and finally, each check rule recorded in the preset rule check configuration table is utilized to check the request parameters, so that the problem that when a certain client requests data change, only the data check rule of the parameter class aiming at the request in the preset check rule configuration table is required to be changed (newly added or reduced or modified), and the service end code is not required to be modified, the data check method and the system are more convenient for checking the data, further, the data check efficiency is improved, and meanwhile, when more data need to be checked or more check rules are needed, the longer check codes can be avoided, the problem that the reusability of long code blocks is lower is avoided, and therefore, the development and maintenance cost is saved. In addition, the problem that the differential verification cannot be realized due to marking verification notes can be avoided, so that the application range of the method and the device for verifying the data is wider.
Further, in order to better illustrate the above process of verifying data, as a refinement and extension of the above embodiment, another data verification method is provided in the embodiment of the present invention, as shown in fig. 2, where the method includes:
201. and receiving a data operation request sent by the client, wherein the data operation request carries a request parameter.
Specifically, when a user performs operations such as data filling or data storage or data deletion in a client page, namely, a data operation request is sent to a server, after the server receives the data operation request sent by the client, the server analyzes a request parameter carried in the request, then determines a preset check rule configuration table according to the request parameter and a request scene corresponding to the data operation request, and finally checks the request parameter according to each check rule recorded in the data check rule configuration table.
202. And determining the full class name information corresponding to the request parameters.
For the embodiment of the present invention, after resolving the request parameter carried in the data operation request, in order to determine the preset check rule configuration table, the full class name information corresponding to the request parameter needs to be determined first, based on this, step 202 specifically includes: and calling the full class name information in the request parameters by using a preset reflection mechanism.
The preset reflection mechanism may specifically be a Java reflection mechanism, specifically, a class name and a package name in the request parameter are obtained by using the Java reflection mechanism, and finally, the class name and the package name form full class name information corresponding to the request parameter.
203. And determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request.
The preset check rule configuration table stores the full-class name information and various data check rules corresponding to the request scene.
For the embodiment of the present invention, after determining the full class name information corresponding to the request parameter, in order to verify the request parameter, a preset verification rule configuration table corresponding to the request parameter needs to be determined first, based on which, step 203 specifically includes: matching the full-class name information with each standard class name recorded in a preset check list, and determining a plurality of target standard class names matched with the full-class name information in each standard class name; matching the request scene with standard request scenes corresponding to the target standard class names to obtain target standard request scenes matched with the request scenes; determining a target preset check rule configuration table corresponding to the target standard request scene, and determining the target preset check rule configuration table as a preset check rule configuration table corresponding to the request parameter.
The preset check list stores preset check rule configuration list identifiers corresponding to different standard class names and different standard request scenes. Specifically, in order to determine a preset check rule configuration table, a request scene corresponding to a data operation request is required to be determined, then a preset check rule configuration table corresponding to a request parameter is searched in a database according to full-class name information and the request scene, the specific search method includes the steps of firstly acquiring the preset check list, then matching the full-class name corresponding to the request parameter with each standard class name in the preset check list, determining similarity between the full-class name and each standard class name, then determining a plurality of target similarity values larger than a preset similarity threshold value in each similarity value, determining target standard class names corresponding to the plurality of target similarity values, then determining standard request scenes corresponding to the plurality of target standard class names, calculating similarity between the request scene corresponding to the data operation request and the plurality of standard request scenes, finally determining the standard request scene with the maximum similarity value as the target standard request scene matched with the request scene, then searching the preset check rule configuration table corresponding to the target standard request scene in the preset check list, and finally checking the request parameter by using the preset check rule configuration table.
204. And judging whether the preset check rule configuration table is an empty table or not.
205. And if the preset check rule configuration table is an empty table, determining that the request parameters are qualified in check.
Specifically, after determining a preset check rule configuration table of the request parameter in a corresponding request scene, in order to check the request parameter, whether the preset check rule configuration table is an empty table or not needs to be judged, if so, the request parameter is not configured with a check rule, and check is not needed, and the request parameter is considered to pass the check.
206. And if the preset check rule configuration table is a non-empty table, checking the request parameters based on each check rule recorded in the preset check rule configuration table.
For the embodiment of the present invention, in the case that the preset check rule configuration table corresponding to the request parameter is not an empty table, the request parameter needs to be checked according to each check rule recorded in the preset check rule configuration table, based on which step 206 specifically includes: determining the verification attribute corresponding to each verification rule recorded in the preset verification rule configuration table; determining an attribute value corresponding to the verification attribute in the request parameter based on the verification attribute; determining a verification rule corresponding to each verification rule; and verifying the attribute value by using the verification rule.
Wherein, the check rule includes: name checking rules, age checking rules, disease type checking rules, etc.; the verification rule comprises: null value check rules, range value check rules, enumerated value check rules, maximum length check rules, and the like.
Specifically, each verification rule recorded in a preset verification rule configuration table is determined, the attribute to be verified of each verification rule is obtained from each verification rule, then the attribute value corresponding to the verification attribute is obtained from the request parameter by using a reflection algorithm according to the obtained verification attribute, then the verification rule aiming at the attribute value is obtained from the verification rule, the verification rule is traversed, and the attribute value is verified, so that a verification result is obtained. For example, if the attribute to be checked is determined to be age in a certain check rule, the attribute value corresponding to the age attribute is determined to be 70 years old in the request parameter according to the age attribute, and one check rule corresponding to the check rule is "the guaranteed age of the guaranteed page is between 18 years old and 60 years old", and the other check rule is "the age value cannot be null", the attribute value check corresponding to the age in the request parameter is finally determined to be failed, so that the next check rule is determined in the preset check rule configuration table, the check attribute corresponding to the next check rule is determined, then the attribute value corresponding to the check attribute is determined in the request parameter, finally, the attribute value is checked by utilizing the check rule corresponding to the next check rule to obtain the check result, and the steps are repeated until all check rules in the preset check rule configuration table are checked, and finally, the whole check result corresponding to the request parameter is obtained.
Further, after the request parameter is verified by using each verification rule recorded in the preset verification rule configuration table, whether the verification of the request parameter is passed or not needs to be determined according to the verification result corresponding to each verification rule, and based on this, the method further includes: if the request parameters meet all the check rules in the preset check rule configuration table, determining that the request parameters pass the check; if the request parameter does not meet any one of the check rules in the preset check rule configuration table, generating alarm information corresponding to the any one check rule, and displaying the alarm information on a client interface.
Specifically, if all the verification rules in the preset verification rule configuration table are utilized to verify the request parameters, the verification results of the request parameters are determined to be passed, if the verification results of the request parameters are not passed by a certain verification rule, the client side request is considered to be not passed by data verification, and prompt information of the verification rule is directly returned to the client side, so that a user of the client side corrects the request data according to the verification rule.
Further, after the verification of the request parameter data is completed, the server side performs real business logic processing according to the request parameter after the verification is passed, namely the server side sends SQL sentences to the target database, then the target database executes the SQL sentences and returns a response execution result to the server side, and finally the server side returns an execution result of the operation data to the client side to be displayed to the user.
The embodiment of the invention can verify all the parameter objects requested by the client in the mode, and only needs to configure the verification rule in the database aiming at different parameter types and different scenes, thereby realizing the unification of the verification codes without repeated coding, and further improving the verification efficiency of the data. Meanwhile, when the verification logic of a certain client request is changed, only the data verification rule of the parameter class aiming at the request in the database is changed (newly added or reduced or modified), the server code is not required to be modified, the server application is not required to be deployed again, the condition of writing errors of the technical level code is avoided, and therefore the verification accuracy of the data is improved.
In the actual application process, the request scene aiming at the client can be abstracted into a plurality of types of adding, deleting, modifying and inquiring, the embodiment of the invention can effectively avoid the writing work of the service end codes caused by the change of the data checking rule by configuring the personalized checking rule, the data checking logic can be changed without redeploying the release application, and the configuration, the scenerization and the dynamics of the data checking operation can be realized only by changing the modified checking rule, namely, the technical effect of pluggable data checking is achieved.
According to the other data verification method provided by the invention, compared with the mode that all request data are packaged into a whole at present and verification codes corresponding to the whole are written to verify the request data, the data verification method provided by the invention comprises the steps of receiving a data operation request sent by a client, wherein the data operation request carries request parameters; determining the full class name information corresponding to the request parameters; then, according to the full-class name information and a request scene corresponding to the data operation request, determining a preset check rule configuration table corresponding to the request parameter; and finally, checking the request parameters by using the preset checking rule configuration table. Therefore, the preset rule check configuration table is selected according to the full class name information corresponding to the request parameters and the request scene, and finally, each check rule recorded in the preset rule check configuration table is utilized to check the request parameters, so that the problem that when a certain client requests data change, only the data check rule of the parameter class aiming at the request in the preset check rule configuration table is required to be changed (newly added or reduced or modified), and the service end code is not required to be modified, the data check method and the system are more convenient for checking the data, further, the data check efficiency is improved, and meanwhile, when more data need to be checked or more check rules are needed, the longer check codes can be avoided, the problem that the reusability of long code blocks is lower is avoided, and therefore, the development and maintenance cost is saved. In addition, the problem that the differential verification cannot be realized due to marking verification notes can be avoided, so that the application range of the method and the device for verifying the data is wider.
Further, as a specific implementation of fig. 1, an embodiment of the present invention provides a data verification apparatus, as shown in fig. 3, where the apparatus includes: a receiving unit 31, a class name determining unit 32, a configuration table determining unit 33, and a checking unit 34.
The receiving unit 31 may be configured to receive a data operation request sent by a client, where the data operation request carries a request parameter.
The class name determining unit 32 may be configured to determine full class name information corresponding to the request parameter.
The configuration table determining unit 33 may be configured to determine a preset check rule configuration table corresponding to the request parameter according to the full class name information and a request scenario corresponding to the data operation request.
The verification unit 34 may be configured to verify the request parameter using the preset verification rule configuration table.
In a specific application scenario, in order to determine the full class name information corresponding to the request parameter, the class name determining unit 32 may be specifically configured to invoke the full class name information in the request parameter by using a preset reflection mechanism.
In a specific application scenario, in order to determine a preset check rule configuration table corresponding to the request parameter, as shown in fig. 4, the configuration table determining unit 33 includes a matching module 331 and a first determining module 332.
The matching module 331 may be configured to match the full-class name information with each standard class name recorded in a preset check list, and determine, among the standard class names, a plurality of target standard class names matched with the full-class name information.
The matching module 331 may be specifically configured to match the request scenario with a standard request scenario corresponding to each target standard class name, so as to obtain a target standard request scenario matched with the request scenario.
The first determining module 332 may be configured to determine a target preset check rule configuration table corresponding to the target standard request scenario, and determine the target preset check rule configuration table as a preset check rule configuration table corresponding to the request parameter.
In a specific application scenario, in order to verify the request parameter by using the preset verification rule configuration table, the verification unit 34 includes a determining module 341, a second determining module 342, and a verification module 343.
The determining module 341 may be configured to determine whether the preset check rule configuration table is an empty table.
The second determining module 342 may be configured to determine that the request parameter is verified to be qualified if the preset verification rule configuration table is an empty table.
The verification module 343 may be configured to, if the preset verification rule configuration table is a non-empty table, verify the request parameter based on each verification rule recorded in the preset verification rule configuration table.
In a specific application scenario, in order to verify the request parameter based on each verification rule recorded in the preset verification rule configuration table, the verification module 343 determines the sub-module and the verification sub-module.
The determining submodule can be used for determining the verification attribute corresponding to each verification rule recorded in the preset verification rule configuration table.
The determining submodule may be specifically configured to determine, based on the verification attribute, an attribute value corresponding to the verification attribute in the request parameter.
The verification sub-module can be used for determining verification rules corresponding to the verification rules; and verifying the attribute value by using the verification rule.
In a specific application scenario, the arbitrary one check rule includes a null value check rule, a range value check rule, an enumeration value check rule and a maximum length check rule.
In a specific application scenario, to display the inspection information, the apparatus further comprises: and a display unit 35.
The display unit 35 may be configured to determine that the request parameter passes the verification if the request parameter meets each verification rule in the preset verification rule configuration table; if the request parameter does not meet any one check rule in the preset check rule configuration table, generating alarm information corresponding to the any one check rule, and displaying the alarm information on a client interface.
It should be noted that, for other corresponding descriptions of each functional module related to the data verification device provided by the embodiment of the present invention, reference may be made to corresponding descriptions of the method shown in fig. 1, which are not repeated herein.
Based on the above method as shown in fig. 1, correspondingly, the embodiment of the present invention further provides a computer readable storage medium, on which a computer program is stored, which when being executed by a processor, implements the following steps: receiving a data operation request sent by a client, wherein the data operation request carries a request parameter; determining the full class name information corresponding to the request parameters; determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request; and verifying the request parameters by using the preset verification rule configuration table.
Based on the embodiment of the method shown in fig. 1 and the device shown in fig. 3, the embodiment of the invention further provides a physical structure diagram of a computer device, as shown in fig. 5, where the computer device includes: a processor 41, a memory 42, and a computer program stored on the memory 42 and executable on the processor, wherein the memory 42 and the processor 41 are both arranged on a bus 43, the processor 41 performing the following steps when said program is executed: receiving a data operation request sent by a client, wherein the data operation request carries a request parameter; determining the full class name information corresponding to the request parameters; determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request; and verifying the request parameters by using the preset verification rule configuration table.
According to the technical scheme, the data operation request sent by the client is received, wherein the data operation request carries the request parameters; determining the full class name information corresponding to the request parameters; then, according to the full-class name information and a request scene corresponding to the data operation request, determining a preset check rule configuration table corresponding to the request parameter; and finally, checking the request parameters by using the preset checking rule configuration table. Therefore, the preset rule check configuration table is selected according to the full class name information corresponding to the request parameters and the request scene, and finally, each check rule recorded in the preset rule check configuration table is utilized to check the request parameters, so that the problem that when a certain client requests data change, only the data check rule of the parameter class aiming at the request in the preset check rule configuration table is required to be changed (newly added or reduced or modified), and the service end code is not required to be modified, the data check method and the system are more convenient for checking the data, further, the data check efficiency is improved, and meanwhile, when more data need to be checked or more check rules are needed, the longer check codes can be avoided, the problem that the reusability of long code blocks is lower is avoided, and therefore, the development and maintenance cost is saved. In addition, the problem that the differential verification cannot be realized due to marking verification notes can be avoided, so that the application range of the method and the device for verifying the data is wider.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may alternatively be implemented in program code executable by computing devices, so that they may be stored in a memory device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps within them may be fabricated into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of data verification, comprising:
receiving a data operation request sent by a client, wherein the data operation request carries a request parameter;
determining the full class name information corresponding to the request parameters;
determining a preset check rule configuration table corresponding to the request parameters according to the full-class name information and the request scene corresponding to the data operation request;
and verifying the request parameters by using the preset verification rule configuration table.
2. The method according to claim 1, wherein determining full class name information corresponding to the request parameter comprises:
and calling the full class name information in the request parameters by using a preset reflection mechanism.
3. The method according to claim 1, wherein the determining the preset check rule configuration table corresponding to the request parameter according to the full class name information and the request scenario corresponding to the data operation request includes:
matching the full-class name information with each standard class name recorded in a preset check list, and determining a plurality of target standard class names matched with the full-class name information in each standard class name;
matching the request scene with standard request scenes corresponding to the target standard class names to obtain target standard request scenes matched with the request scenes;
determining a target preset check rule configuration table corresponding to the target standard request scene, and determining the target preset check rule configuration table as a preset check rule configuration table corresponding to the request parameter.
4. The method of claim 1, wherein verifying the request parameter using the preset verification rule configuration table comprises:
judging whether the preset check rule configuration table is an empty table or not;
if the preset check rule configuration table is an empty table, determining that the request parameter is qualified in check;
and if the preset check rule configuration table is a non-empty table, checking the request parameters based on each check rule recorded in the preset check rule configuration table.
5. The method of claim 4, wherein the verifying the request parameter based on each verification rule recorded in the preset verification rule configuration table comprises:
determining the verification attribute corresponding to each verification rule recorded in the preset verification rule configuration table;
determining an attribute value corresponding to the verification attribute in the request parameter based on the verification attribute;
determining a verification rule corresponding to each verification rule;
and verifying the attribute value by using the verification rule.
6. The method of claim 5, wherein the any one of the check rules includes a null check rule, a range value check rule, an enumerated value check rule, and a maximum length check rule.
7. The method of claim 1, wherein after said verifying said request parameters using said preset verification rule configuration table, said method further comprises:
if the request parameters meet all the check rules in the preset check rule configuration table, determining that the request parameters pass the check;
if the request parameter does not meet any one check rule in the preset check rule configuration table, generating alarm information corresponding to the any one check rule, and displaying the alarm information on a client interface.
8. A data verification apparatus, comprising:
the receiving unit is used for receiving a data operation request sent by the client, wherein the data operation request carries a request parameter;
the class name determining unit is used for determining the full class name information corresponding to the request parameters;
the configuration table determining unit is used for determining a preset check rule configuration table corresponding to the request parameters according to the full class name information and the request scene corresponding to the data operation request;
and the verification unit is used for verifying the request parameters by using the preset verification rule configuration table.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program when executed by the processor implements the steps of the method according to any one of claims 1 to 7.
CN202310220653.XA 2023-03-08 2023-03-08 Data verification method and device, storage medium and computer equipment Pending CN116401630A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310220653.XA CN116401630A (en) 2023-03-08 2023-03-08 Data verification method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310220653.XA CN116401630A (en) 2023-03-08 2023-03-08 Data verification method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN116401630A true CN116401630A (en) 2023-07-07

Family

ID=87009358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310220653.XA Pending CN116401630A (en) 2023-03-08 2023-03-08 Data verification method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN116401630A (en)

Similar Documents

Publication Publication Date Title
CN109558525B (en) Test data set generation method, device, equipment and storage medium
CN111352935B (en) Index creating method, device and equipment in block chain type account book
CN111241061A (en) Writing method of state database, data processing device and storage medium
CN112506486A (en) Search system establishing method and device, electronic equipment and readable storage medium
KR20180019051A (en) Method of executing data scrubbing inside a smart storage device
CN111159040A (en) Test data generation method, device, equipment and storage medium
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN114116691A (en) Data import checking method, system, device and computer readable medium
CN113391972A (en) Interface testing method and device
CN114281803A (en) Data migration method, device, equipment, medium and program product
CN110806979B (en) Interface return value checking method, device, equipment and storage medium
CN107133163A (en) A kind of method and apparatus for verifying description class API
CN116048981A (en) Method, device, medium and equipment for designing rear-end interface test case
CN116401630A (en) Data verification method and device, storage medium and computer equipment
CN111444194B (en) Method, device and equipment for clearing indexes in block chain type account book
CN112417020B (en) Service expansion realization method, device, computer equipment and storage medium
CN110636042B (en) Method, device and equipment for updating verified block height of server
CN111538651A (en) Interface testing method, device, server and storage medium
CN111651362A (en) Test case generation method and device, storage medium and computer equipment
CN112686759A (en) Account checking monitoring method, device, equipment and medium
CN117171816B (en) Data verification method based on industrial identification and related equipment
CN113434359B (en) Data traceability system construction method and device, electronic device and readable storage medium
CN116561130A (en) Data warehouse table verification method and device, storage medium and computer equipment
CN117827187A (en) Application development method, device and equipment based on shared component
CN115344602A (en) Method and device for real-time aggregation query of data and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination