Excel file analysis method, electronic equipment, storage medium and program product

By using annotations in Excel files to maintain the relationship between worksheets, entity classes, fields and table headers, the problem of inability to adapt to changes in worksheets and column order when parsing Excel files in the existing technology is solved, and high-quality parsing and data are achieved Verification reduces maintenance costs.

CN119476221APending Publication Date: 2025-02-18BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411521569.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

When parsing Excel files with multiple worksheets, the prior art cannot adapt to changes in worksheet order and column order, resulting in inconsistent with the expected content.

Method used

By adding the first annotation between the worksheet and the entity class in the Excel file, maintain the relationship between the worksheet and the entity class; add the second annotation between the entity class field and the Excel table header, maintain the relationship between the field and the table header, thereby Generate the corresponding class collection and data collection, determine the entity class corresponding to the array, and perform data checksum assignment.

Benefits of technology

It realizes high-quality Excel file parsing under changes in worksheet order and column order, reducing the cost of maintaining Excel files and improving data quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119476221A_ABST
    Figure CN119476221A_ABST
Patent Text Reader

Abstract

The invention relates to an Excel file analysis method, electronic equipment, a storage medium and a program product. The method comprises the steps that entity classes which are defined for worksheets of an Excel file and have first annotations and second annotations which are added to fields in declarations of the entity classes are obtained; generating a class set with the first annotation as a main key and the entity class as a value; the first annotation comprises an identifier of the worksheet; generating an array corresponding to the worksheet based on each row of data of the worksheet; generating a data set taking the identifier of the worksheet as a main key and the array as a value based on the identifier and the array of the worksheet; based on the class set and the data set, determining an entity class corresponding to the array; on the basis of the second annotation corresponding to the entity class, verifying the value of the field in the corresponding array, and in response to verification passing, assigning the value to the corresponding field in the entity class on the basis of the array; the second annotation comprises the name of the field and the corresponding verification rule. The analysis quality can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data analysis, and more specifically, to an Excel file analysis method, electronic device, storage medium and program product. Background Art

[0002] In the process of conducting business through the business system, a large number of Excel files are usually imported. Because the data formats in Excel files from different sources may be quite different, or the Excel data to be imported is not standardized, the Excel files need to be parsed before the data is entered into the database.

[0003] When parsing an Excel file with multiple worksheets, the prior art uses the getSheetAt(i) method to obtain the content of a worksheet, and uses the getCell(j) method to obtain the column content, where i is the page number of the worksheet and j is the column number.

[0004] However, this method is only applicable to scenarios where the order of worksheets and the order of columns are fixed. When the order of worksheets or the order of columns changes, the parsed content may be inconsistent with the expected content. Summary of the invention

[0005] The present application is provided to solve the above problems existing in the prior art. According to an Excel file parsing method, electronic device, storage medium and program product of the embodiment of the present application, it is applicable to the scenario where the worksheet order or column order is changed, and can improve the parsing quality.

[0006] In a first aspect, the present application provides an Excel file parsing method, comprising:

[0007] Obtain an entity class with a first annotation that is pre-defined for each worksheet of the Excel file;

[0008] Based on the first annotation added to the entity class, a class set is generated with the first annotation as the primary key and the entity class as the value; wherein the first annotation includes: an identifier of the worksheet;

[0009] Based on each row of data in the worksheet, generate an array corresponding to the worksheet;

[0010] Based on the identification of the worksheet and its corresponding array, generate a data set with the identification of the worksheet as a primary key and the array as a value;

[0011] Based on the class set and the data set, determining the entity class corresponding to the array;

[0012] Get the second annotation added to the field in the declaration of the entity class;

[0013] Based on the second annotation corresponding to the entity class, the value of the field in the corresponding array is verified, and in response to the verification passing, the corresponding field in the entity class is assigned a value based on the array; wherein the second annotation includes: the name of the field and its corresponding verification rule.

[0014] In a second aspect, the present application provides an Excel file parsing device, comprising:

[0015] An acquisition module is configured to acquire an entity class with a first annotation that is pre-defined for each worksheet of the Excel file;

[0016] A generating module is configured to generate, based on a first annotation added to the entity class, a class set with the first annotation as a primary key and the entity class as a value; wherein the first annotation includes: an identifier of the worksheet; based on each row of data in the worksheet, generate an array corresponding to the worksheet; based on the identifier of the worksheet and its corresponding array, generate a data set with the identifier of the worksheet as a primary key and the array as a value;

[0017] A determination module, configured to determine an entity class corresponding to the array based on the class set and the data set;

[0018] A verification module is configured to obtain a second annotation added to a field in the declaration of the entity class; based on the second annotation corresponding to the entity class, verify the value of the field in the corresponding array, and in response to the verification passing, assign a value to the corresponding field in the entity class based on the array; wherein the second annotation includes: the name of the field and its corresponding verification rule.

[0019] In a third aspect, the present application provides an electronic device, including:

[0020] one or more processors;

[0021] a storage device for storing one or more programs,

[0022] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.

[0023] In a fourth aspect, the present application provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above embodiments.

[0024] In a fifth aspect, the present application provides a computer program product, including a computer program / instruction, which implements the method described in any of the above embodiments when the computer program / instruction is executed by a processor.

[0025] The beneficial effects of the embodiments of the present application are: the relationship between each entity class and the worksheet is maintained through the first annotation, and the relationship between the entity class field and the column of the worksheet is maintained through the second annotation, that is, the second annotation can maintain the relationship between the entity class field and the header of the worksheet, which not only meets the parsing requirements of multiple worksheets, but also the parsing process is not affected by the changes in the order of the worksheet and the order of the columns, reducing the cost of maintaining Excel files. Verifying the data based on the second annotation can improve the quality of the data obtained by parsing. Through the first annotation and the second annotation, the parsing process is simplified, and there is no need to write corresponding code for the Excel file, reducing code redundancy. If the worksheet or the header is modified, it is only necessary to adjust the first annotation or the second annotation, without rewriting the parsing code, and the scalability is high. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In the drawings, which are not necessarily drawn to scale, the same reference numerals may describe similar parts in different views. The same reference numerals with letter suffixes or different letter suffixes may represent different instances of similar parts. The accompanying drawings generally illustrate various embodiments by way of example and not limitation, and together with the specification and claims, are used to illustrate the disclosed embodiments. When appropriate, the same reference numerals are used throughout the drawings to refer to the same or similar parts. Such embodiments are illustrative and are not intended to be exhaustive or exclusive embodiments of the present apparatus or method.

[0027] Figure 1 This is a flowchart of an Excel file parsing method provided by an embodiment of the present application;

[0028] Figure 2 is a flowchart of an Excel file parsing method provided by another embodiment of the present application;

[0029] Figure 3 It is a schematic diagram of an Excel file parsing device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the technical solution of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. The embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific embodiments, but are not intended to limit the present application. The terms "first", "second" and "third" used in the present application are only intended to distinguish the corresponding features, do not represent the need for such an order, and do not necessarily represent only the singular form.

[0031] like Figure 1 As shown, the embodiment of the present application provides an Excel file parsing method, including:

[0032] Step 101: Obtain an entity class with a first annotation that is pre-defined for each worksheet of an Excel file.

[0033] A worksheet is a sheet page. For each sheet page, an entity class is customized. The entity class defines the structure of the database data. The first annotation @ExcelSheet is added to the entity class. The annotation attributes are identifiers such as the sheet page name or sheet page number.

[0034] Step 102: Based on the first annotation added to the entity class, generate a class set with the first annotation as the primary key and the entity class as the value; wherein the first annotation includes: an identifier of the worksheet.

[0035] For example, generate a classMap whose key is the sheet value name and value is the class collection of the corresponding entity class.

[0036] Step 103: Generate an array corresponding to the worksheet based on the data in each row of the worksheet.

[0037] In actual scenarios, each row of data corresponds to an element of an array, or multiple rows of data correspond to an element of an array. This step parses each sheet page into an array to speed up the subsequent parsing process. The format of the array can be determined according to business needs. For example, the array in this embodiment is a JSONArray array.

[0038] Step 104: Based on the worksheet identifier and its corresponding array, generate a data set with the worksheet identifier as the primary key and the array as the value.

[0039] For example, generate a data collection dataMap whose key is the sheet page name and value is the JSONArray array.

[0040] Step 105: Based on the class set and the data set, determine the entity class corresponding to the array.

[0041] Step 106: Obtain a second annotation added to the field in the declaration of the entity class; wherein the second annotation includes: the name of the field and its corresponding validation rule.

[0042] Add the second annotation @ExcelImport to the fields in the entity class. Through the name of the field in @ExcelImport, the correspondence between the fields of the entity class and the table header can be maintained.

[0043] The validation rule can be set by setting the annotation attribute of the second annotation and the attribute value. For example, the annotation attribute of the second annotation includes a maximum length maxLength, and its value is 11. Then the length of the field value cannot exceed 11, otherwise, the validation fails.

[0044] Step 107: Based on the second annotation corresponding to the entity class, verify the value of the field in the corresponding array, and in response to the verification passing, assign a value to the corresponding field in the entity class based on the array.

[0045] For example, if a second annotation is added to the age field in the entity class, the value of the age field in the array needs to be verified based on the second annotation.

[0046] The embodiment of the present application maintains the relationship between each entity class and the worksheet through the first annotation, and maintains the relationship between the entity class field and the Excel header through the second annotation, which not only meets the parsing requirements of multiple worksheets, but also the parsing process is not affected by changes in the order of the worksheets and the order of the columns, reducing the cost of maintaining Excel files. Verifying the data based on the second annotation can improve the quality of the data obtained by parsing. Through the first annotation and the second annotation, the parsing process is simplified, and there is no need to write corresponding code for the Excel file, reducing code redundancy. If the worksheet or header is modified, it is only necessary to adjust the first annotation or the second annotation, without rewriting the parsing code, and the scalability is high.

[0047] In one embodiment of the present application, an array corresponding to the worksheet is generated based on each row of data in the worksheet, including:

[0048] Based on the header data of the worksheet, generate a header set with the header column number as the primary key and the header data as the value;

[0049] Based on the header set, traverse other rows of data in the worksheet and generate data objects corresponding to other rows of data;

[0050] Generate an array corresponding to the worksheet based on the data object corresponding to the worksheet.

[0051] The data object includes the row number and the correspondence between the header name and the column data. For example, the data object is {rowNum:1,"age":12}, where rowNum is the row number, age is the header name, and 12 is the field value corresponding to age in the sheet page.

[0052] This embodiment records the row number and the data corresponding to the table header through the data object JSONObject, and generates arrays corresponding to different worksheets through the data object, which can improve the parsing efficiency.

[0053] In one embodiment of the present application, based on the second annotation corresponding to the entity class, checking the value of the field in the corresponding array, and in response to the verification passing, assigning a value to the corresponding field in the entity class based on the array, includes:

[0054] For each data object in the array: based on the name of the field in the second annotation, obtain the value of the field in the data object; check whether the value of the field satisfies the verification rule corresponding to the field; in response to satisfying the verification rule, assign a value to the corresponding field in the entity class based on the value of the field in the data object.

[0055] Since the data object corresponds to the row data, the present embodiment traverses each data object to verify the marked fields in each row data, which can improve the parsing efficiency. In actual scenarios, the fields marked by the second annotation can be adjusted according to actual needs to facilitate the verification of different fields. If the verification rules are met, it means that the value of the field in the data object is reliable and subsequent business operations can be performed. In actual scenarios, only one or more fields in the row data can be verified, or all fields of the row data can be verified. The present embodiment traverses according to data objects, and can also traverse according to fields, such as for each field, verifying whether the field in different data objects meets the verification rules.

[0056] In one embodiment of the present application, the verification rules include: any one or more of: the field is filled, the length of the field value is less than a set length threshold, the field value does not exist in the database, and the field value matches the field type.

[0057] In some business scenarios, some fields are mandatory, so you can use validation rules to verify that the fields are filled. In addition, you can also verify the length of the field value and whether the same field value exists in the database.

[0058] Because different field types may have different formats for their field values, you can verify whether the field value is compliant by checking whether the field value matches the field type. For example, if the field type is gender, the field value has two field values, one for male and the other for female. If a place name such as Chengdu appears, the field value does not match the field type.

[0059] In one embodiment of the present application, the verification rules include: the value of the field does not exist in the database;

[0060] Check whether the value of the field meets the validation rules corresponding to the field, including:

[0061] Check whether the value of the field exists in the verification set; if it exists in the verification set, the verification rule is not satisfied; otherwise, the verification rule is satisfied;

[0062] After assigning values ​​to corresponding fields in the entity class based on the values ​​of the fields in the data object, the method further includes: adding the entity data obtained by the assignment to the database, and adding the names and values ​​of the fields to the verification set.

[0063] This embodiment stores the values ​​of the fields that have passed the verification in the database. In order to avoid duplicate storage and waste of database resources, a verification set is set to verify whether the value of the field has been stored in the database. The verification set stores the values ​​of the fields that have been stored in the database. The verification set can avoid unnecessary access to the database.

[0064] In one embodiment of the present application, the method further includes: in response to failure of the verification, sending prompt information for the array to the user, so that the user can modify the data of the array based on the prompt information.

[0065] If the verification fails, it may mean that the data format does not meet the requirements or an error occurs. At this time, the user needs to be prompted to modify the data. The prompt information may include information such as the row number, field name or sheet page number of the data that failed the verification.

[0066] In one embodiment of the present application, obtaining an entity class with a first annotation pre-defined for each worksheet of an Excel file includes: based on a reflection mechanism, obtaining an entity class with a first annotation pre-defined for each worksheet of an Excel file.

[0067] In one embodiment of the present application, obtaining a second annotation added to a field in a declaration of an entity class includes: obtaining the second annotation added to the field in the declaration of the entity class based on a reflection mechanism.

[0068] In the above two embodiments, the annotation information is obtained through the reflection mechanism, which has unique advantages such as dynamic, enhanced and framework development foundation. In actual scenarios, getter methods, BeanUtils tool classes, etc. can also be used to obtain annotation information.

[0069] like Figure 2 As shown, the embodiment of the present application provides an Excel file parsing method, including:

[0070] Step 201: Based on the reflection mechanism, obtain the entity class with the first annotation that is pre-defined for each worksheet of the Excel file.

[0071] Predefine a unit information entity class orgInfo, add the first annotation @ExcelSheet to the orgInfo class, set the annotation attribute to unit information, add the second annotation @ExcelImport to the orgName field in the orgInfo class, the second annotation includes the unit name and validation rules, the validation rules are set through the attributes and their attribute values, such as @ExcelImport: value = "unit name", maxLength = 11, required = true, unique = true. Among them, value is used to indicate the name of the field, required = true is used to indicate that the field has been filled, and unique = true is used to indicate that the value of the field does not exist in the database.

[0072] Similar to orgInfo, an application information entity class appInfo is pre-defined, the first annotation @ExcelSheet is added to the appInfo class, and the annotation attribute is set to application information. The second annotation @ExcelImport is added to the appName field in the appInfo class, such as @ExcelImport: value = "application name", maxLength = 11, required = true, unique = true.

[0073] Get the orgInfo class with the first annotation through the reflection mechanism.

[0074] Step 202: Based on the first annotation added to the entity class, generate a class set with the first annotation as the primary key and the entity class as the value; wherein the first annotation includes: an identifier of the worksheet.

[0075] Generate a classMap whose key is the first annotation and value is the class collection of the corresponding entity class.

[0076] Step 203: Based on the header data of the worksheet, generate a header set with the header column number as the primary key and the header data as the value.

[0077] Get the Excel file to be parsed, traverse each sheet page, get the sheet header data, that is, the first row of data on the sheet page, and generate a header collection headMap with the key being the header column number and the value being the header data.

[0078] Step 204: traverse other rows of data in the worksheet based on the header set, and generate data objects corresponding to other rows of data.

[0079] Traverse all rows of data except the header, get the header data according to the column number, and form a data object jsonObject containing rowNum = row number, header name = column data, that is, each row of data will form a jsonObject.

[0080] Step 205: Generate an array corresponding to the worksheet based on the data object corresponding to the worksheet.

[0081] By traversing the sheet pages, each sheet page is converted into an array JSONArray.

[0082] Step 206: Based on the worksheet identifier and its corresponding array, generate a data set with the worksheet identifier as the primary key and the array as the value.

[0083] According to the sheet page name, a data set dataMap is formed with the key being the sheet page name and the value being the JSONArray.

[0084] Step 207: Based on the class set and the data set, determine the entity class corresponding to the array.

[0085] Traverse the dataMap and obtain the corresponding entity class in the classMap through the key in the dataMap, that is, the sheet page name.

[0086] Step 208: Based on the reflection mechanism, obtain the second annotation added to the field in the declaration of the entity class; wherein the second annotation includes: the name of the field and its corresponding verification rule.

[0087] Get the appInfo class with the first annotation through the reflection mechanism.

[0088] Step 209: For each data object in the array: based on the name of the field in the second annotation, obtain the value of the field in the data object; check whether the value of the field satisfies the verification rule corresponding to the field; in response to satisfying the verification rule, execute step 210, otherwise, execute step 211.

[0089] Traverse the value in dataMap, i.e. JSONArray, to obtain each jsonObject. Obtain the value of the field corresponding to the jsonObject through the value of the second annotation, i.e. the header name, and verify the value based on the verification rules.

[0090] Step 210: assign values ​​to corresponding fields in the entity class based on the values ​​of the fields in the data object, and store the assigned entity data in a database table.

[0091] Step 211: Send prompt information for the array to the user, so that the user can modify the data of the array based on the prompt information.

[0092] If the verification fails, the line number and error data prompt message of the unverified line can be returned for the user to modify.

[0093] The embodiment of the present application maintains the relationship between each entity class and sheet page through the first annotation, which not only meets the needs of multi-sheet page parsing, but also does not require a fixed sheet page order. The second annotation maintains the relationship between the entity class field and the header, and does not require a fixed column order, thereby reducing the labor cost caused by maintaining the table.

[0094] Use the reflection mechanism to obtain annotation information, verify the data type, length, uniqueness, required field, mapping relationship, etc. to improve the quality of the parsed data. Before the data is stored in the database, the table data is uniquely verified. There is no need to query the database to see if the data already exists, which avoids frequent database queries and reduces database pressure.

[0095] Through the first annotation and the second annotation, the parsing process is simplified. You only need to maintain the entity first annotation @ExcelSheet corresponding to the sheet page, and the second annotation @ExcelImport corresponding to the header. There is no need to rewrite the corresponding code when the order of the sheet pages changes, which reduces code redundancy. If the sheet page or header of the table is modified or deleted, you only need to modify the first annotation and the second annotation, which has high scalability.

[0096] like Figure 3 As shown, an embodiment of the present invention provides an Excel file parsing device, comprising:

[0097] The acquisition module 301 is configured to acquire an entity class with a first annotation that is pre-defined for each worksheet of the Excel file;

[0098] The generating module 302 is configured to generate a class set with the first annotation as the primary key and the entity class as the value based on the first annotation added to the entity class; wherein the first annotation includes: an identifier of the worksheet; based on each row of data in the worksheet, generate an array corresponding to the worksheet; based on the identifier of the worksheet and its corresponding array, generate a data set with the identifier of the worksheet as the primary key and the array as the value;

[0099] A determination module 303 is configured to determine an entity class corresponding to the array based on the class set and the data set;

[0100] The verification module 304 is configured to obtain the second annotation added to the field in the declaration of the entity class; based on the second annotation corresponding to the entity class, verify the value of the field in the corresponding array, and in response to the verification passing, assign a value to the corresponding field in the entity class based on the array; wherein the second annotation includes: the name of the field and its corresponding verification rule.

[0101] In one embodiment of the present application, the generation module 302 is configured to generate a header set based on the header data of the worksheet, with the header column number as the primary key and the header data as the value; traverse other rows of data in the worksheet based on the header set to generate data objects corresponding to the other rows of data; and generate an array corresponding to the worksheet based on the data object corresponding to the worksheet.

[0102] In one embodiment of the present application, the verification module 304 is configured to, for each data object in the array: obtain the value of the field in the data object based on the name of the field in the second annotation; verify whether the value of the field satisfies the verification rule corresponding to the field; and in response to satisfying the verification rule, assign a value to the corresponding field in the entity class based on the value of the field in the data object.

[0103] In one embodiment of the present application, the verification rules include: any one or more of: the field is filled, the length of the field value is less than a set length threshold, the field value does not exist in the database, and the field value matches the field type.

[0104] In one embodiment of the present application, the verification rules include: the value of the field does not exist in the database;

[0105] The verification module 304 is configured to verify whether the value of the field exists in the verification set; if it exists in the verification set, the verification rule is not satisfied, otherwise, the verification rule is satisfied; the entity data obtained by the assignment is added to the database, and the name of the field and its value are added to the verification set.

[0106] In one embodiment of the present application, the verification module 304 is configured to send a prompt message for the array to the user in response to failure of the verification, so that the user can modify the data of the array based on the prompt message.

[0107] In one embodiment of the present application, the acquisition module 301 is configured to acquire, based on a reflection mechanism, an entity class with a first annotation that is pre-defined for each worksheet of the Excel file.

[0108] In one embodiment of the present application, the verification module 304 is configured to obtain the second annotation added to the field in the declaration of the entity class based on the reflection mechanism.

[0109] An embodiment of the present application provides an electronic device, including:

[0110] one or more processors;

[0111] a storage device for storing one or more programs,

[0112] When one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.

[0113] An embodiment of the present application provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, a method as described in any of the above embodiments is implemented.

[0114] In addition, although exemplary embodiments have been described herein, the scope includes any and all embodiments based on the present application with equivalent elements, modifications, omissions, combinations (e.g., various embodiments intersecting schemes), adaptations or changes. Although several embodiments are listed and described for the wireless communication method and the wireless communication component, it should be noted that the method details involved in the description of the wireless communication component can also be incorporated into the various embodiments of the wireless communication method, and vice versa.

[0115] The elements in the claims are to be interpreted broadly based on the language employed in the claims and are not limited to the examples described in this specification or during the prosecution of the application, which examples are to be interpreted as non-exclusive. Therefore, this specification and examples are intended to be considered as examples only, with the true scope and spirit being indicated by the claims and the full scope of their equivalents.

[0116] The order of each step in the present application is merely exemplary and not restrictive. Without affecting the implementation of the present application (without destroying the required logical relationship between the steps), the execution order of the steps can be adjusted, and the various embodiments obtained after the adjustment still fall within the scope of the present application.

[0117] The above description is intended to be illustrative rather than restrictive. For example, the above examples (or one or more of them) can be used in combination with each other. For example, a person of ordinary skill in the art can use other embodiments when reading the above description. In addition, in the above-mentioned specific embodiments, various features can be grouped together to simplify the application. This should not be interpreted as an intention that a disclosed feature that does not require protection is necessary for any claim. On the contrary, the subject matter of the present invention may be less than all the features of a specific disclosed embodiment. Thus, the claims are incorporated into the specific embodiments as examples or embodiments, wherein each claim is independently used as a separate embodiment, and it is considered that these embodiments can be combined with each other in various combinations or arrangements. The scope of the present invention should be determined with reference to the attached claims and the full scope of equivalent forms granted by these claims.

Claims

1. An Excel file parsing method, characterized in that: include: Obtaining an entity class with a first annotation that is pre-defined for each worksheet of the Excel file, and a second annotation added to a field in a declaration of the entity class; Based on the first annotation added to the entity class, a class set is generated with the first annotation as the primary key and the entity class as the value; wherein the first annotation includes: an identifier of the worksheet; Based on each row of data in the worksheet, generate an array corresponding to the worksheet; Based on the identification of the worksheet and its corresponding array, generate a data set with the identification of the worksheet as a primary key and the array as a value; Based on the class set and the data set, determining the entity class corresponding to the array; Based on the second annotation corresponding to the entity class, the value of the field in the corresponding array is verified, and in response to the verification passing, the corresponding field in the entity class is assigned a value based on the array; wherein the second annotation includes: the name of the field and its corresponding verification rule.

2. The method according to claim 1, characterized in that Based on each row of data in the worksheet, an array corresponding to the worksheet is generated, including: Based on the header data of the worksheet, generate a header set with the header column number as the primary key and the header data as the value; Traverse other rows of data in the worksheet based on the header set to generate data objects corresponding to other rows of data; Based on the data object corresponding to the worksheet, an array corresponding to the worksheet is generated.

3. The method according to claim 2, characterized in that Based on the second annotation corresponding to the entity class, verifying the value of the field in the corresponding array, and in response to passing the verification, assigning a value to the corresponding field in the entity class based on the array, including: For each data object in the array: based on the name of the field in the second annotation, obtain the value of the field in the data object; verify whether the value of the field satisfies the verification rule corresponding to the field; in response to satisfying the verification rule, assign a value to the corresponding field in the entity class based on the value of the field in the data object.

4. The method according to any one of claims 1 to 3, characterized in that: The verification rules include any one or more of: the field is filled, the length of the field value is less than a set length threshold, the field value matches the field type, and the field value does not exist in the database.

5. The method according to claim 3, characterized in that The verification rules include: the value of the field does not exist in the database; Checking whether the value of the field satisfies the verification rule corresponding to the field includes: Check whether the value of the field exists in the check set; if it exists in the check set, the check rule is not satisfied, otherwise, the check rule is satisfied; After assigning a value to a corresponding field in the entity class based on the value of the field in the data object, the method further includes: adding the assigned entity data to the database, and adding the name of the field and its value to the verification set.

6. The method according to claim 1, characterized in that Further including: In response to the verification failing, a prompt message for the array is sent to the user; wherein the prompt message is used to prompt the user to modify the data of the array.

7. The method according to claim 1, characterized in that Acquiring an entity class with a first annotation that is pre-defined for each worksheet of the Excel file, including: acquiring an entity class with a first annotation that is pre-defined for each worksheet of the Excel file based on a reflection mechanism; and / or, Obtaining a second annotation added to a field in a declaration of the entity class includes: obtaining the second annotation added to the field in the declaration of the entity class based on a reflection mechanism.

8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method described in any one of claims 1 to 7 is implemented.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

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