Custom annotation rule verification method and device, computer equipment and storage medium
Through custom annotations and Java reflection API technology, flexible verification of spreadsheet data is realized, which solves the problem of insufficient flexibility of traditional verification rules, improves the efficiency and accuracy of verification, and simplifies the development process.
Patent Information
- Application Number
- CN202410674000.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-30
AI Technical Summary
The verification rules of traditional spreadsheet data have low flexibility and are difficult to meet the completeness and accuracy requirements for importing and exporting complex data.
Adopt the rule verification method of custom annotations, use Java reflection API technology to obtain and parse the target field data in the spreadsheet, detect the custom annotations, determine the verification tools and rules according to the verification type and rule attribute value, and perform data verification , improve the flexibility and accuracy of verification.
Custom annotations enhance the flexibility and scalability of rule verification, improve the efficiency and accuracy of verification, simplify the development process, facilitate testing and debugging, and improve the maintainability of business code.
Smart Images

Figure CN118569228A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a rule verification method, device, computer equipment and storage medium for custom annotations. Background Art
[0002] With the development of information technology, more and more data are stored in the form of Excel documents. Importing data from Excel to Web systems or exporting data from Web systems to Excel has become a common demand. During the import and export process of data in Excel, the integrity and accuracy of the data need to be verified.
[0003] However, traditional spreadsheet data verification has problems such as low flexibility of verification rules. Summary of the invention
[0004] Based on this, it is necessary to provide a rule verification method, device, computer equipment and storage medium with custom annotations that can improve the flexibility of verification rules in order to address the above technical problems.
[0005] In a first aspect, a rule verification method for a custom annotation is provided, the rule verification method comprising:
[0006] Obtaining target field data at a target location in the electronic form; wherein the target location is a target row and / or target column in a target page of the electronic form;
[0007] Based on Java reflection API technology, detect whether the target field data at the target location has corresponding custom annotations;
[0008] If the target field data at the target location has a corresponding custom annotation, obtain the property configuration information of the custom annotation, determine the verification tool according to the verification type, and determine the verification rule according to the verification rule property value; the property configuration information includes the verification type and the verification rule property value;
[0009] The target field data at the target location is verified according to the verification tools and verification rules to obtain the verification results.
[0010] In one embodiment, obtaining target field data at a target location in a spreadsheet includes: in response to an import operation of the spreadsheet, traversing and reading the spreadsheet to obtain corresponding source code; traversing and parsing the source code to obtain corresponding field data to be checked; and traversing and extracting the field data to be checked based on Java reflection API technology to obtain target field data at the corresponding target location.
[0011] In one of the embodiments, the above-mentioned rule verification method also includes: if there is no corresponding custom annotation for the target field data at the target location, obtaining the data processing method of the target field data at the target location, and obtaining the corresponding data processing result after performing data processing on the target field data at the target location according to the data processing method.
[0012] In one of the embodiments, the verification result includes a verification pass; the above-mentioned rule verification method also includes: in response to the verification result being a verification pass, obtaining a data processing mode of the target field data at the target location, and performing data processing on the target field data at the target location according to the data processing mode to obtain a corresponding data processing result.
[0013] In one of the embodiments, the verification result includes a verification failure; the rule verification method further includes: in response to the verification result being a verification failure, outputting a verification failure alarm message to an import terminal of the electronic form.
[0014] In one of the embodiments, outputting verification failure alarm information to an import terminal of an electronic spreadsheet includes: obtaining a verification failure alarm type of the electronic spreadsheet; the verification failure alarm type includes verification failure multiple alarms and verification failure centralized alarms; in response to the verification failure alarm type being verification failure multiple alarms, outputting first alarm information to the import terminal of the electronic spreadsheet; the first alarm information is used to characterize a verification failure of target field data at a target location; in response to the verification failure alarm type being verification failure centralized alarm, recording the first alarm information to a first alarm log; in response to the completion of verification of target field data at each target location corresponding to a target row, outputting a first alarm log to the import terminal of the electronic spreadsheet.
[0015] In one of the embodiments, the rule verification method further includes: in response to the existence of a rule verification program exception, determining the risk level of the rule verification program exception; wherein the risk level includes high risk and low risk; in response to the risk level being high risk, outputting verification program exception alarm information to the electronic spreadsheet import terminal; the verification program exception alarm information is used to characterize the existence of a rule verification program exception; in response to the risk level being low risk, recording the verification program exception alarm information to a second alarm log; in response to the target field data at each target position corresponding to the target row completing the verification, outputting a second alarm log to the electronic spreadsheet import terminal.
[0016] In a second aspect, a rule verification device for custom annotations is provided, and the rule verification device includes: a data acquisition module, an annotation judgment module, a rule determination module and a data verification module.
[0017] Among them, the data acquisition module is used to obtain the target field data of the target position in the electronic form; wherein the target position is the target row and / or target column in the target page of the electronic form; the annotation judgment module is used to detect whether the target field data of the target position has a corresponding custom annotation based on the Java reflection API technology; the rule determination module is used to obtain the attribute configuration information of the custom annotation if the target field data of the target position has a corresponding custom annotation, determine the verification tool according to the verification type, and determine the verification rule according to the verification rule attribute value; the attribute configuration information includes the verification type and the verification rule attribute value; the data verification module is used to perform data verification on the target field data of the target position according to the verification tool and the verification rule to obtain the verification result.
[0018] In a third aspect, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of any method in the above method embodiments are implemented.
[0019] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any method in the above method embodiments are implemented.
[0020] The above-mentioned rule verification method, device, computer equipment and storage medium of custom annotation obtain the target field data of the target position in the electronic form; wherein the target position is the target row and / or target column in the target page of the electronic form; then, based on the Java reflection API technology, detect whether the target field data of the target position has the corresponding custom annotation; then, if the target field data of the target position has the corresponding custom annotation, obtain the attribute configuration information of the custom annotation, determine the verification tool according to the verification type, and determine the verification rule according to the verification rule attribute value; the attribute configuration information includes the verification type and the verification rule attribute value; finally, perform data verification on the target field data of the target position according to the verification tool and the verification rule to obtain the verification result, thereby improving the convenience, flexibility, accuracy and efficiency of rule verification, so that the rule verification rule enhances the scalability and flexible configuration through the custom annotation, and also decouples the rule verification code to improve the maintainability of the business code, simplify the development process, and facilitate testing and debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 An application environment diagram of a rule verification method for custom annotations in an embodiment;
[0022] Figure 2 A first flow chart of a rule verification method for custom annotations in an embodiment;
[0023] Figure 3 A schematic diagram of a process for obtaining target field data at a target location in an electronic form in one embodiment;
[0024] Figure 4 A second flow chart of a rule verification method for custom annotations in one embodiment;
[0025] Figure 5 A third flow chart of a rule verification method for custom annotations in one embodiment;
[0026] Figure 6 A schematic diagram of a process of outputting verification failure warning information to an electronic form import terminal in one embodiment;
[0027] Figure 7 A fourth flow chart of a rule verification method for custom annotations in one embodiment;
[0028] Figure 8 A structural block diagram of a rule verification device for custom annotations in an embodiment;
[0029] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0031] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0033] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first resistor may be referred to as a second resistor, and similarly, a second resistor may be referred to as a first resistor. Both the first resistor and the second resistor are resistors, but they are not the same resistor.
[0034] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if the connected circuits, modules, units, etc. have electrical signals or data transmission between each other.
[0035] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" etc. specify the presence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof.
[0036] The rule verification method for custom annotations provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0037] In one embodiment, Figure 2 As shown, a custom annotation rule verification method is provided, which is applied to Figure 1 The server in is taken as an example to illustrate, including the following steps 201 to 204.
[0038] Step 201, obtaining target field data at a target position in an electronic form.
[0039] The target position is a target row and / or target column in a target page of a spreadsheet; the specific target position can be to locate the target row in the target page of the spreadsheet first, and then locate the target column corresponding to the target row through the target row; or to locate the target column first, and then locate the target row corresponding to the target row through the target column; it can be understood that the spreadsheet can be but not limited to an Excel document; the target page can be but not limited to any page in the spreadsheet, the target row can be but not limited to any row in the target page, and the target column can be but not limited to any column in the target row in the target page. Specifically, the server can obtain the target field data of the target position in the spreadsheet.
[0040] In one embodiment, if Figure 3 As shown, obtaining target field data at a target position in an electronic form includes steps 301 to 303 .
[0041] Step 301, in response to the electronic table import operation, the electronic table is traversed and read to obtain the corresponding source code;
[0042] Step 302, traverse and parse the source code to obtain the corresponding field data to be verified;
[0043] Step 303: Based on the Java reflection API technology (Application Programming Interface), the field data to be checked is traversed and extracted to obtain the target field data of the corresponding target position.
[0044] Specifically, when the server recognizes that the electronic form import terminal performs an import operation on the electronic form, the electronic form is traversed and read to obtain the corresponding source code; then, the source code is traversed and parsed to obtain the corresponding field data to be checked; then, based on the Java reflection API technology, the field data to be checked is traversed and extracted to obtain the target field data at the corresponding target location, thereby improving the efficiency and convenience of obtaining the target field data at the target location in the electronic form, and thus improving the efficiency and convenience of rule verification of custom annotations.
[0045] In a specific example, when the server recognizes that the import terminal of the electronic form is performing an import operation on the electronic form, based on the Apache POI function database, the WorkbookFactory.create() method is used to create a Workbook object from the file stream of the electronic form, and then the target page, target row and target column are traversed to complete the reading process to obtain the corresponding source code; then, the corresponding target row object in each target page is traversed, and then each target column object in each target row is traversed, and the source code is traversed and parsed using the Cell.getCellType() method, getStringCellValue() method and getNumericalCellValue() method to obtain the corresponding field data to be checked; then, based on the Java reflection API technology, the field name of the field data to be checked is traversed and extracted to obtain the target field data of the corresponding target position, that is, the value of the field data to be checked corresponding to the target position. The above is only a specific example, and it is flexibly set according to user needs in actual applications, and is not limited here.
[0046] In this embodiment, in response to the import operation of the electronic form, the electronic form is traversed and read to obtain the corresponding source code; then, the source code is traversed and parsed to obtain the corresponding field data to be checked; then, based on the Java reflection API technology, the field data to be checked is traversed and extracted to obtain the target field data at the corresponding target position, which improves the efficiency and convenience of obtaining the target field data at the target position in the electronic form, and also improves the efficiency and convenience of rule verification of custom annotations.
[0047] Step 202: Based on the Java reflection API technology, it is detected whether the target field data at the target location has a corresponding custom annotation.
[0048] Specifically, the server can detect whether there is a corresponding custom annotation in the target field data of the target location based on the Java reflection API technology.
[0049] In a specific example, the Java reflection API technology is used again to check whether there is an @ExcelValue annotation on the target field data at the target location, and obtain the attribute value of the annotation; the above is only a specific example, and the actual application can be flexibly set according to user needs and is not limited here.
[0050] Step 203: If the target field data at the target location has a corresponding custom annotation, obtain the property configuration information of the custom annotation, determine the verification tool according to the verification type, and determine the verification rule according to the verification rule property value.
[0051] Among them, the attribute configuration information includes the validation type and the validation rule attribute value. The validation tools include conditional judgment validation tools, regular expression validation tools and custom validator validation tools. Specifically, when the target field data at the target location has a corresponding custom annotation, the server obtains the attribute configuration information of the custom annotation, determines the validation tool according to the validation type, and determines the validation rule according to the validation rule attribute value, thereby improving the flexible configuration of the validation rule.
[0052] In a specific example, the conditional validation tool uses statements such as loops, ifelse, or swi tch to execute different validation logics according to the type attribute of the annotation. If the validation type is format validation, you may need to use a Java regular expression validation tool. For complex validation rules, you can create a regular expression validation tool. The above are only specific examples. In actual applications, they are flexibly set according to user needs and are not limited here.
[0053] In a specific example, the rule verification method further includes: in response to the creation operation of the expression verification tool, generating and storing the expression verification tool. The above are only specific examples, and in actual applications, they are flexibly set according to user needs and are not limited here.
[0054] In a specific example, the above-mentioned rule verification method also includes: in response to the configuration operation of the custom annotation, generating and storing the custom annotation; in response to the modification operation of the custom annotation, generating and storing the custom annotation after the modification operation; that is, as the business develops and changes, the verification rules can be added or modified by adding or modifying the custom annotation at will, thereby improving the efficiency, scalability and accuracy of the rule verification method.
[0055] In one embodiment, if Figure 4 As shown, the above rule verification method also includes step 401.
[0056] Step 401, if the target field data at the target location does not have a corresponding custom annotation, obtain the data processing method of the target field data at the target location, and obtain the corresponding data processing result after processing the target field data at the target location according to the data processing method.
[0057] Specifically, when the server does not have a corresponding custom annotation for the target field data at the target location, when obtaining the data processing method of the target field data at the target location, the target field data at the target location is processed according to the data processing method to obtain the corresponding data processing result, thereby improving the convenience and efficiency of the rule verification method.
[0058] In this embodiment, if there is no corresponding custom annotation for the target field data at the target location, the data processing mode of the target field data at the target location is obtained, and the target field data at the target location is processed according to the data processing mode to obtain the corresponding data processing result, thereby improving the convenience and efficiency of the rule verification method.
[0059] Step 204: perform data verification on the target field data of the target location according to the verification tool and verification rules to obtain a verification result.
[0060] Specifically, the verification results include verification pass and verification fail. The server can perform data verification on the target field data of the target location according to the verification tool and verification rules to obtain the verification results, thereby improving the convenience, flexibility, accuracy and efficiency of rule verification, making the rule verification rules more scalable and flexible through custom annotations, and also decoupling the rule verification code to improve the maintainability of the business code, simplify the development process, and facilitate testing and debugging.
[0061] In the rule verification method of the above-mentioned custom annotation, the target field data of the target position in the electronic form is obtained; wherein the target position is the target row and / or target column in the target page of the electronic form; then, based on the Java reflection API technology, it is detected whether the target field data of the target position has a corresponding custom annotation; then, if the target field data of the target position has a corresponding custom annotation, the attribute configuration information of the custom annotation is obtained, the verification tool is determined according to the verification type, and the verification rule is determined according to the verification rule attribute value; the attribute configuration information includes the verification type and the verification rule attribute value; finally, the target field data of the target position is verified according to the verification tool and the verification rule to obtain the verification result, thereby improving the convenience, flexibility, accuracy and efficiency of the rule verification, so that the rule verification rule enhances the scalability and flexible configuration through the custom annotation, and also decouples the rule verification code to improve the maintainability of the business code, simplify the development process, and facilitate testing and debugging.
[0062] In one embodiment, if Figure 5 As shown, the verification result includes verification passed; the above rule verification method also includes step 501.
[0063] Step 501, in response to the verification result being a verification pass, obtaining a data processing mode of the target field data at the target location, and performing data processing on the target field data at the target location according to the data processing mode to obtain a corresponding data processing result.
[0064] Specifically, when the server identifies that the verification result is passed, it can obtain the data processing mode of the target field data at the target location, and obtain the corresponding data processing result after performing data processing on the target field data at the target location according to the data processing mode, thereby improving the efficiency and convenience of rule verification, and also improving the efficiency and convenience of data processing.
[0065] In one embodiment, if Figure 5 As shown, the verification result includes verification failure; the above rule verification method also includes step 502.
[0066] Step 502: In response to the verification result being a verification failure, outputting verification failure warning information to the electronic form import terminal.
[0067] Specifically, when the server identifies that the verification result is a verification failure, it can output verification failure warning information to the electronic form import terminal, which is convenient for adjusting and maintaining the electronic form and improves the efficiency and convenience of rule verification.
[0068] In this embodiment, in response to the verification result being a verification failure, verification failure warning information is output to the electronic form import terminal, which facilitates adjustment and maintenance of the electronic form and improves the efficiency and convenience of rule verification.
[0069] In one embodiment, if Figure 6 As shown, outputting verification failure warning information to the electronic form import terminal includes: step 601 to step 604.
[0070] Step 601, obtaining the verification failure alarm type of the electronic form.
[0071] The verification failure alarm types include verification failure multiple alarms and verification failure centralized alarms. The server can obtain the verification failure alarm type of the electronic form.
[0072] In a specific example, the verification failure alarm type can be determined by the verification failure alarm type flag of the electronic form, and the verification failure alarm type of the electronic form can also be generated in response to the configuration operation of the verification failure alarm type of the electronic form. The above is only a specific example, and it is flexibly set according to user needs in actual applications, and is not limited here.
[0073] Step 602: In response to the verification failure alarm type being verification failure multiple alarms, outputting first alarm information to the electronic form import terminal.
[0074] The first alarm information is used to indicate that the target field data at the target location has failed to be verified. The server may output the first alarm information to the electronic form import terminal when the verification failure alarm type is a verification failure multiple alarm.
[0075] Step 603: In response to the verification failure alarm type being a verification failure centralized alarm, the first alarm information is recorded in a first alarm log.
[0076] Step 604: in response to the target field data at each target position corresponding to the target row completing verification, output a first alarm log to the electronic spreadsheet import terminal.
[0077] Specifically, when the server identifies that the verification failure alarm type is a verification failure centralized alarm, the server can record the first alarm information to the first alarm log; then, when it is identified that the target field data at each target position corresponding to the target row has completed the verification, the server outputs the first alarm log to the spreadsheet import terminal, thereby improving the convenience and efficiency of verification result processing.
[0078] In this embodiment, the verification failure alarm type of the electronic form is obtained; then, in response to the verification failure alarm type being a verification failure multiple alarm, a first alarm message is output to the electronic form import terminal; then, in response to the verification failure alarm type being a verification failure centralized alarm, the first alarm message is recorded in a first alarm log; finally, in response to the completion of verification of the target field data at each target position corresponding to the target row, a first alarm log is output to the electronic form import terminal, thereby improving the convenience and efficiency of verification result processing and providing corresponding verification failure alarm methods for different business data.
[0079] In one embodiment, if Figure 7 As shown, the above rule verification method also includes steps 701 to 704.
[0080] Step 701: In response to the existence of a rule verification program anomaly, determine a risk level of the rule verification program anomaly.
[0081] The risk level includes high risk and low risk; specifically, when the server identifies that there is an abnormality in the rule verification program, it can determine the risk level of the abnormality in the rule verification program.
[0082] Step 702: In response to the risk level being high risk, outputting verification program abnormality warning information to the electronic form import terminal.
[0083] The verification program abnormality warning information is used to indicate that there is a rule verification program abnormality. When the server identifies that the risk level is high risk, it can directly output the verification program abnormality warning information to the electronic form import terminal.
[0084] Step 703: In response to the risk level being low risk, the verification program abnormality alarm information is recorded in a second alarm log.
[0085] Step 704 , in response to the target field data at each target position corresponding to the target row completing verification, output a second alarm log to the electronic spreadsheet import terminal.
[0086] Among them, when the server identifies that the risk level is low risk, the verification program abnormal alarm information is recorded in the second alarm log; then, when the target field data of each target position corresponding to the target row is identified to complete the verification, the second alarm log is output to the spreadsheet import terminal, which improves the convenience and efficiency of verification program exception handling and provides corresponding verification program abnormal alarm methods for different business data.
[0087] In this embodiment, in response to the existence of a rule verification program exception, the risk level of the rule verification program exception is determined; then, in response to the risk level being high risk, verification program exception alarm information is output to the electronic spreadsheet import terminal; then, in response to the risk level being low risk, the verification program exception alarm information is recorded in a second alarm log; finally, in response to the completion of the verification of the target field data at each target position corresponding to the target row, the second alarm log is output to the electronic spreadsheet import terminal, thereby improving the convenience and efficiency of verification program exception handling and providing a corresponding verification program exception alarm method for different business data.
[0088] It should be understood that although Figure 2-7 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-7 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0089] Second, as Figure 8 As shown, a rule verification device for custom annotations is provided, and the rule verification device includes: a data acquisition module 810, an annotation judgment module 820, a rule determination module 830 and a data verification module 840.
[0090] Among them, the data acquisition module 810 is used to obtain the target field data of the target position in the electronic form; wherein the target position is the target row and / or target column in the target page of the electronic form; the annotation judgment module 820 is used to detect whether the target field data at the target position has a corresponding custom annotation based on the Java reflection API technology; the rule determination module 830 is used to obtain the attribute configuration information of the custom annotation if the target field data at the target position has a corresponding custom annotation, determine the verification tool according to the verification type, and determine the verification rule according to the verification rule attribute value; the attribute configuration information includes the verification type and the verification rule attribute value; the data verification module 840 is used to perform data verification on the target field data at the target position according to the verification tool and the verification rule to obtain the verification result.
[0091] In one embodiment, the data acquisition module 810 includes a data acquisition unit.
[0092] Among them, the data acquisition unit is used to respond to the import operation of the spreadsheet, traverse and read the spreadsheet to obtain the corresponding source code; the data acquisition unit is used to traverse and parse the source code to obtain the corresponding field data to be checked; the data acquisition unit is used to traverse and extract the field data to be checked based on the Java reflection API technology to obtain the target field data of the corresponding target location.
[0093] In one embodiment, the annotation judgment module 820 is also used to obtain the data processing method of the target field data at the target location if there is no corresponding custom annotation for the target field data at the target location, so as to process the target field data at the target location according to the data processing method to obtain the corresponding data processing result.
[0094] In one of the embodiments, the verification result includes a verification pass; the above-mentioned rule verification device also includes a verification result processing module.
[0095] Among them, the verification result processing module is used to obtain the data processing mode of the target field data at the target location in response to the verification result being verification passed, so as to obtain the corresponding data processing result after data processing the target field data at the target location according to the data processing mode.
[0096] In one of the embodiments, the verification result includes a verification failure; the rule verification device further includes a verification result processing module for outputting a verification failure alarm message to the electronic spreadsheet import terminal in response to the verification result being a verification failure.
[0097] In one of the embodiments, the verification result processing module includes a verification failure processing unit.
[0098] Among them, the verification failure processing unit is used to obtain the verification failure alarm type of the electronic form; the verification failure alarm type includes verification failure multiple alarms and verification failure centralized alarms; the verification failure processing unit is used to output a first alarm message to the electronic form import terminal in response to the verification failure alarm type being verification failure multiple alarms; the first alarm message is used to characterize the verification failure of the target field data at the target position; the verification failure processing unit is used to record the first alarm message to the first alarm log in response to the verification failure alarm type being verification failure centralized alarm; the verification failure processing unit is used to output a first alarm log to the electronic form import terminal in response to the completion of verification of the target field data at each target position corresponding to the target row.
[0099] In one of the embodiments, the rule checking device further includes a program exception handling module.
[0100] Among them, the program exception handling module is used to determine the risk level of the rule verification program exception in response to the existence of the rule verification program exception; wherein the risk level includes high risk and low risk; the program exception handling module is used to output the verification program exception alarm information to the electronic spreadsheet import terminal in response to the risk level being high risk; the verification program exception alarm information is used to characterize the existence of the rule verification program exception; the program exception handling module is used to record the verification program exception alarm information to the second alarm log in response to the risk level being low risk; the program exception handling module is used to output the second alarm log to the electronic spreadsheet import terminal in response to the completion of the verification of the target field data of each target position corresponding to the target row.
[0101] For the specific definition of the rule verification device for custom annotations, please refer to the definition of the rule verification method for custom annotations above, which will not be repeated here. Each module in the above-mentioned rule verification device for custom annotations can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0102] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store target field data at a target location in a spreadsheet. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a rule verification method for custom annotations is implemented.
[0103] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In a third aspect, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of any method in the above method embodiments are implemented.
[0105] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any method in the above method embodiments are implemented.
[0106] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0107] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0108] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A rule verification method for a custom annotation, the rule verification method comprising: Acquire target field data of a target position in an electronic form; wherein the target position is a target row and / or a target column in a target page of the electronic form; Based on the Java reflection API technology, detect whether the target field data at the target location has a corresponding custom annotation; If the target field data at the target location has the corresponding custom annotation, obtain the property configuration information of the custom annotation, determine the verification tool according to the verification type, and determine the verification rule according to the verification rule attribute value; the property configuration information includes the verification type and the verification rule attribute value; The target field data of the target location is verified according to the verification tool and the verification rule to obtain a verification result.
2. The method according to claim 1, characterized in that The step of obtaining target field data at a target position in the electronic form includes: In response to the electronic table import operation, the electronic table is traversed and read to obtain corresponding source code; The source code is traversed and parsed to obtain corresponding field data to be verified; Based on the Java reflection API technology, the field data to be checked is traversed and field extraction processing is performed to obtain the target field data corresponding to the target position.
3. The method according to claim 1, characterized in that The rule verification method further includes: If the target field data at the target location does not have the corresponding custom annotation, the data processing method of the target field data at the target location is obtained, and the target field data at the target location is processed according to the data processing method to obtain the corresponding data processing result.
4. The method according to claim 1, characterized in that: The verification result includes verification passed; the rule verification method also includes: In response to the verification result being that the verification is passed, a data processing mode of the target field data at the target location is obtained, so as to obtain a corresponding data processing result after data processing is performed on the target field data at the target location according to the data processing mode.
5. The method according to claim 1, characterized in that The verification result includes a verification failure; and the rule verification method further includes: In response to the verification result being the verification failure, outputting verification failure warning information to the electronic form importing terminal.
6. The method according to claim 5, characterized in that The step of outputting verification failure warning information to the electronic form import terminal includes: Acquire the verification failure alarm type of the electronic form; the verification failure alarm type includes verification failure multiple alarms and verification failure centralized alarms; In response to the verification failure alarm type being the verification failure multiple alarm, outputting first alarm information to the electronic form import terminal; the first alarm information is used to indicate that the verification of the target field data at the target location has failed; In response to the verification failure alarm type being the verification failure centralized alarm, recording the first alarm information into a first alarm log; In response to the target field data of each target position corresponding to the target row completing verification, the first alarm log is output to the electronic form import terminal.
7. The method according to claim 1, characterized in that The rule verification method further includes: In response to the existence of a rule verification program anomaly, determining a risk level of the rule verification program anomaly; wherein the risk level includes a high risk and a low risk; In response to the risk level being the high risk, outputting verification program abnormality warning information to the electronic form import terminal; the verification program abnormality warning information is used to indicate that the rule verification program abnormality exists; In response to the risk level being the low risk, recording the verification program abnormality alarm information into a second alarm log; In response to the target field data of each target position corresponding to the target row completing verification, the second alarm log is output to the electronic form import terminal.
8. A rule verification device for custom annotations, characterized in that: The rule checking device comprises: A data acquisition module, used to acquire target field data at a target position in an electronic form; wherein the target position is a target row and / or target column in a target page of the electronic form; An annotation judgment module is used to detect whether the target field data at the target location has a corresponding custom annotation based on the Java reflection API technology; A rule determination module, for obtaining the attribute configuration information of the custom annotation if the target field data at the target location has the corresponding custom annotation, determining the verification tool according to the verification type, and determining the verification rule according to the verification rule attribute value; the attribute configuration information includes the verification type and the verification rule attribute value; The data verification module is used to perform data verification on the target field data of the target location according to the verification tool and the verification rule to obtain a verification result.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
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.
