Implementation method, equipment and device for feeding back EXCEL import result and medium
By performing two verifications on the EXCEL table data, determining the target data entity set and uploading it to the file server, the problem of poor data import stability and user experience in the prior art is solved, and higher data import stability and user experience are achieved.
Patent Information
- Application Number
- CN202411587761.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-28
AI Technical Summary
When processing EXCEL table data that fails to pass verification, the user experience is poor and the stability of data import is reduced, which cannot effectively solve the problem of data inconsistency during the import process.
By obtaining the data entity of each row of EXCEL table data, performing two verifications, determining the target data entity set, converting it into a table file data stream, and uploading it to the file server to return the file download link to the front end of the web page.
It improves the stability of data import, improves the user experience, and reduces the inconsistency between the data filled in by users and the final imported data.
Smart Images

Figure CN119538887A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, device, apparatus, and storage medium for providing feedback on imported EXCEL results. Background Technology
[0002] In related technologies, importing or updating data in batches by uploading tables is a common function in various systems. However, when the read data fails to pass validation, the quality of the handling solution plays a crucial role in the user experience and the stable operation of the system.
[0003] For data that fails validation, the system currently uses two common methods: one is to display an error message explaining why the data failed, and the other is to skip the data and only save or update valid data. With the first approach, if the imported data contains a large number of invalid rows, users need to modify and upload the table data multiple times until all data is valid, resulting in a poor user experience. The second approach, on the other hand, can easily lead to discrepancies between the amount of data entered by the user and the final amount of data imported or updated, causing a decrease in data import stability.
[0004] In summary, the problems with the relevant technologies urgently need to be addressed. Summary of the Invention
[0005] The purpose of this application is to at least partially solve one of the technical problems existing in the related art.
[0006] Therefore, one objective of this application is to provide a method, device, apparatus, and medium for providing feedback on Excel import results, which can improve data import stability and enhance user experience.
[0007] To achieve the above-mentioned technical objectives, the technical solutions adopted in the embodiments of this application include:
[0008] A method for providing feedback on imported Excel results includes: obtaining data entities for each row of Excel table data in a list collection; the data entity includes several data attributes; performing two validations on each data entity based on the several data attributes to determine a target data entity set corresponding to the Excel table data; the target data entity set is used to store data entities that failed validation; converting the target data entity set into a table file data stream; and uploading the table file data stream to a file server so that the file server returns a file download link to the webpage frontend.
[0009] This application discloses a method for providing feedback on Excel import results. The method obtains the data entity of each row of Excel table data from a list collection. Each data entity includes several data attributes. Based on these attributes, each data entity undergoes two validations to determine the target data entity set corresponding to the Excel table data. The target data entity set stores the data entities that failed validation. The target data entity set is converted into a table file data stream and uploaded to a file server, allowing the file server to return a file download link to the webpage. This method performs two validations on the data entities of each row of Excel table data in the list collection. After validation, a target data entity set including multiple data entities that failed validation is determined. The target data entity set is then converted into a table file data stream and uploaded to a file server, allowing the file server to return a file download link to the webpage. Users can confirm successful Excel table data import based on the link. Furthermore, the two validations reduce the possibility of discrepancies between the user-entered data and the final imported or updated data, improving the stability of the data import process.
[0010] In addition, the method for implementing feedback EXCEL import results according to the above embodiments of this application may also have the following additional technical features:
[0011] Furthermore, in one embodiment of this application, the step of performing two verifications on each data entity based on several data attributes to determine the target data entity set corresponding to the EXCEL table data includes: obtaining data attribute values through reflection based on the data attributes; performing a first verification on each data entity based on the data attribute values to obtain a first verification result; performing a second verification on the data entity based on the data attributes to obtain a second verification result; traversing and verifying all data entities, and determining the target data entity set corresponding to the EXCEL table data based on the first verification result and the second verification result of each data entity.
[0012] Further, in one embodiment of this application, the step of traversing and verifying all the data entities, and determining the target data entity set corresponding to the EXCEL table data based on the first verification result and the second verification result of each data entity, includes:
[0013] Iterate through and verify all the data entities, and determine the data entities whose first verification result is verification failure or whose second verification result is verification failure as the target data entities;
[0014] The set of target data entities is defined as the target data entity set.
[0015] Furthermore, in one embodiment of this application, the step of performing a first verification on each data entity based on the data attribute value to obtain a first verification result includes:
[0016] Parse user-configured custom annotations to determine the preset data format corresponding to each data attribute value;
[0017] If the data format of any of the data attribute values of the data entity is different from the preset data format, the first verification result is determined to be a verification failure.
[0018] If the data format of all the data attribute values of the data entity is the same as the preset format, the first verification result is determined to be a successful verification.
[0019] Furthermore, in one embodiment of this application, the step of performing a second verification on the data entity based on the data attributes to obtain a second verification result includes:
[0020] Call the database query function interface to query all built-in data attributes of the database;
[0021] If any of the data attributes corresponding to the data entity is the same as any of the built-in data attributes, the second verification result is determined to be a successful verification.
[0022] If any one of the data attributes corresponding to the data entity is different from all the built-in data attributes, the second verification result is determined to be a verification failure.
[0023] Furthermore, in one embodiment of this application, the step of converting the target data entity set into a table file data stream and uploading the table file data stream to a file server so that the file server returns a file download link to the webpage frontend includes: saving all data corresponding to the target data entity set as error data entities and adding the error data entities to the result set in the BaseExcelDTO base class; determining that the result set is not an empty set, converting the result set into the table file data stream and saving it to the file server so that the file server returns a file download link to the webpage frontend.
[0024] Furthermore, in one embodiment of this application, the method further includes: generating a download prompt message and sending it to the webpage frontend in response to a preset operation performed by the user on the webpage frontend.
[0025] On the other hand, embodiments of this application provide an apparatus for implementing feedback of Excel import results, including:
[0026] The acquisition module is used to acquire the data entity of each row of the EXCEL table data in the list collection; the data entity includes several data attributes;
[0027] The first processing module is used to perform two verifications on each data entity based on several data attributes to determine the target data entity set corresponding to the EXCEL table data; the target data entity set is used to store the data entities that failed the verification.
[0028] The second processing module is used to convert the target data entity set into a table file data stream and upload the table file data stream to a file server so that the file server returns a file download link to the web page frontend.
[0029] On the other hand, embodiments of this application provide a computer device, including:
[0030] At least one processor;
[0031] At least one memory for storing at least one program;
[0032] When the at least one program is executed by the at least one processor, the at least one processor implements the above-described method for providing feedback on the Excel import results.
[0033] On the other hand, embodiments of this application also provide a computer-readable storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the above-described method for implementing feedback EXCEL import results.
[0034] The advantages and beneficial effects of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application:
[0035] This application discloses a method for providing feedback on Excel import results. The method obtains the data entity of each row of Excel table data from a list collection. Each data entity includes several data attributes. Based on these attributes, each data entity undergoes two validations to determine the target data entity set corresponding to the Excel table data. The target data entity set stores the data entities that failed validation. The target data entity set is converted into a table file data stream and uploaded to a file server, allowing the file server to return a file download link to the webpage. This method performs two validations on the data entities of each row of Excel table data in the list collection. After validation, a target data entity set including multiple data entities that failed validation is determined. The target data entity set is then converted into a table file data stream and uploaded to a file server, allowing the file server to return a file download link to the webpage. Users can confirm successful Excel table data import based on the link. Furthermore, the two validations reduce the possibility of discrepancies between the user-entered data and the final imported or updated data, improving the stability of the data import process. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following description is provided with accompanying drawings of the relevant technical solutions in the embodiments of this application or the prior art. It should be understood that the accompanying drawings described below are only for the purpose of clearly illustrating some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0037] Figure 1 This is a schematic diagram illustrating the steps of a method for providing feedback on imported EXCEL results in an embodiment of this application.
[0038] Figure 2 This is a schematic diagram illustrating the steps in this application embodiment to determine the target data entity set corresponding to EXCEL table data by performing two verifications on each data entity based on several data attributes.
[0039] Figure 3 This is a schematic diagram illustrating the steps in this application embodiment to perform a first verification on each data entity based on data attribute values and obtain a first verification result.
[0040] Figure 4 This is a schematic diagram illustrating the steps of performing a second verification on a data entity based on data attributes to obtain a second verification result, as provided in this embodiment of the application.
[0041] Figure 5This is a schematic diagram illustrating the steps of converting a target data entity set into a table file data stream and uploading the table file data stream to a file server so that the file server returns a file download link to the webpage frontend, as provided in the embodiments of this application.
[0042] Figure 6 This is a flowchart illustrating another method for implementing feedback of Excel import results provided in this application embodiment;
[0043] Figure 7 This is a schematic diagram of the structure of a device for implementing feedback of EXCEL import results provided in an embodiment of this application;
[0044] Figure 8 This is a schematic diagram of a computer device structure for a system that provides feedback on Excel import results, as provided in an embodiment of this application. Detailed Implementation
[0045] The present application will be further described below with reference to the accompanying drawings and specific embodiments. The described embodiments should not be considered as limitations on the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0046] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0048] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0049] BaseExcelDTO: BaseExcelDTO is a commonly used base class in Excel data processing. It's primarily used to uniformly store row number fields, facilitating the tracking and recording of each row's information during Excel data processing. BaseExcelDTO typically serves as the base class for processing Excel data. By defining a row number field (e.g., rowNumber), it ensures that the row number of each row is known when processing data in an Excel file. This is extremely useful for data validation and error logging. Applications of BaseExcelDTO include: Data validation: When processing Excel data, BaseExcelDTO can be used as a data carrier, combined with validation logic (e.g., the BusinessValidator interface) to validate each row. If validation fails, the error message can be recorded near the corresponding row number field for subsequent error handling. Error logging: During data import, if formatting errors or missing data are encountered, the erroneous data and its corresponding row number can be recorded, generating an import result class (e.g., ImportResult) for user viewing and processing. Data tracking: When processing complex Excel data, it's sometimes necessary to track the source and destination of the data. By adding a row number field to each row of data, it is easy to track the specific location of the data, thereby improving the accuracy and efficiency of data processing.
[0050] EasyExcel: EasyExcel is a simple, memory-efficient open-source Java-based Excel file reader / writer project developed by Alibaba. Key features of EasyExcel include: Low memory usage: When processing large Excel files, EasyExcel can read and write rows without loading the entire file into memory, significantly reducing memory consumption. This makes EasyExcel more efficient when processing large Excel files and avoids memory overflow issues. High-efficiency processing: EasyExcel optimizes read and write operations, typically offering faster processing speeds than traditional Excel libraries (such as Apache POI). Concise API: EasyExcel provides a concise API, making read and write operations more intuitive and convenient. Developers can easily implement Excel file read and write operations through annotations and configuration. Support for complex data models: EasyExcel supports mapping Excel columns directly to Java entity fields using annotations, simplifying the data conversion process. It also supports custom data format conversions to meet the needs of different scenarios.
[0051] In related technologies, importing or updating data in batches by uploading tables is a common function in various systems. However, when the read data fails to pass validation, the quality of the handling solution plays a crucial role in the user experience and the stable operation of the system.
[0052] For data that fails validation, the system currently uses two common methods: one is to display an error message explaining why the data failed, and the other is to skip the data and only save or update valid data. With the first approach, if the imported data contains a large number of invalid rows, users need to modify and upload the table data multiple times until all data is valid, resulting in a poor user experience. The second approach, on the other hand, can easily lead to discrepancies between the amount of data entered by the user and the final amount of data imported or updated, causing a decrease in data import stability.
[0053] In summary, the problems with the relevant technologies urgently need to be addressed.
[0054] To address the aforementioned technical problems, this application provides a method for implementing feedback on Excel import results. (Refer to...) Figure 1 , Figure 1 This is a flowchart illustrating the implementation steps of the method for providing feedback on imported Excel results in this application. Figure 1 In this process, the step may include, but is not limited to, steps S101 to S103.
[0055] S101. Retrieve the data entity of each row of the EXCEL table data in the list collection; the data entity includes several data attributes.
[0056] Understandably, a list collection can be a user-defined data set. The Excel spreadsheet data in the list collection can be obtained by importing an Excel spreadsheet into the list collection via EasyExcel. The Excel spreadsheet data can be divided into several rows, each corresponding to a data entity, and each data entity can include several data attributes. The number of data entities can be one, two, or more; the specific number is not limited here.
[0057] In some optional embodiments of this application, the processor can establish a wired or wireless connection with the hardware device carrying the database. Alternatively, it can establish a wireless connection with a cloud database. After establishing the connection, the processor can retrieve the data entity of each row of the Excel spreadsheet data in the list collection from the database. Each data entity may include several data attributes.
[0058] It is understood that the aforementioned limited connection methods may include the connection between the mobile device and the processing module, as well as the connection between the processing module and hardware devices and other wired connections between the processing module and other known or future-developed devices; while the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (Ultra Wide Band) connections and other known or future-developed wireless connection methods.
[0059] S102. Based on several data attributes, perform two verifications on each data entity to determine the target data entity set corresponding to the EXCEL table data; the target data entity set is used to store the data entities that failed the verification.
[0060] Understandably, each data attribute of every data entity needs to undergo two validations: a basic validation and a business validation. The basic validation primarily checks whether the data in the data entity conforms to user-defined rules, while the business validation primarily checks whether the data attribute of the data entity is in a preset database. The target data entity set consists of only the data entities that failed the validation; the number of these entities can be one, two, or more, and the specific number is not limited here.
[0061] In some feasible embodiments of the application, the processor can perform two verifications on each data entity based on several data attributes to determine the target data entity set corresponding to the EXCEL table data. The target data entity set can be used to store the data entities that failed the verification.
[0062] S103. Convert the target data entity set into a table file data stream, and upload the table file data stream to the file server so that the file server returns a file download link to the web page frontend.
[0063] In some feasible embodiments of this application, the processor can convert the target data entity set into a table file data stream and upload the table file data stream to a file server so that the file server returns a file download link to the web page frontend.
[0064] For example, all data entities for a complete row validation are saved in the `ErrorRow` entity, which mainly contains the row number and the corresponding data entity. This is then added to the `result` collection in the `BaseExcelDTO` base class. After reading, the `result` collection is checked for emptiness. If the collection is not empty, it indicates the presence of erroneous data entities. Therefore, the `result` needs to be saved to a file server in tabular form, and its download link is obtained and saved to the `downloadUrl` property of the base class. Finally, when the user uses the data, they can externally determine whether the batch data import was successful by checking if the `downloadUrl` collection in the base class is empty. If it fails, the returned `downloadUrl` will also display the row numbers of all erroneous data entities and the corresponding error reasons.
[0065] In other embodiments of this application, the processor can obtain data entities from a list collection, where each row of the Excel spreadsheet data may include 4-6 data attributes. Based on these 4-6 data attributes, each data entity undergoes a basic validation and a business validation. After these two validations, the processor can determine a target data entity set corresponding to the Excel spreadsheet data, which may include multiple data entities that failed validation. After obtaining the target data entity set, the processor can convert the target data entity set into a spreadsheet file data stream and upload the spreadsheet file data stream to a file server, so that the file server returns a file download link to the webpage frontend.
[0066] In summary, this application's embodiment provides a method for providing feedback on Excel import results. This method obtains the data entity of each row of Excel table data from a list collection. Each data entity may include several data attributes. Based on these attributes, each data entity undergoes two validations to determine the target data entity set corresponding to the Excel table data. This target data entity set stores the data entities that failed validation. The processor can convert the target data entity set into a table file data stream and upload the table file data stream to a file server, allowing the file server to return a file download link to the webpage frontend. This method performs two validations on the data entities of each row of Excel table data in the list collection. After validation, it determines a target data entity set that may include multiple data entities that failed validation. Then, it converts the target data entity set into a table file data stream and uploads the table file data stream to a file server, allowing the file server to return a file download link to the webpage frontend. Users can confirm successful Excel table data import based on the link on the frontend. Furthermore, the two validations reduce the possibility of discrepancies between the user-entered data and the final imported or updated data, improving the stability of the data import process.
[0067] Furthermore, referring to Figure 2 , Figure 2 This is a schematic diagram illustrating the steps in this application embodiment to determine the target data entity set corresponding to the EXCEL table data by performing two verifications on each data entity based on several data attributes. Figure 2 In this context, this step may specifically include, but is not limited to, steps S201-S204.
[0068] S201. Based on the data attributes, obtain the data attribute values through reflection.
[0069] S202. Based on the data attribute values, perform the first verification on each data entity to obtain the first verification result.
[0070] S203. Based on the data attributes, perform a second verification on the data entity to obtain the second verification result.
[0071] S204. Iterate through and verify all data entities. Based on the first verification result and the second verification result of each data entity, determine the target data entity set corresponding to the data in the Excel spreadsheet.
[0072] Understandably, in Excel spreadsheets, a data attribute can correspond to a data attribute value. For example, if the data attribute is age, it can usually correspond to a data attribute value consisting of 1-2 digits. Of course, the data attribute value can be presented as a binary number. If the data attribute is time, it can usually correspond to a data attribute value of XX, XX, XX representing year, month, and day, which can also be presented as a binary number.
[0073] In some feasible embodiments of this application, the processor can first obtain the data attribute value through reflection based on the data attribute. After obtaining the data attribute, the processor can perform a first verification on each data entity based on the data attribute value to obtain a first verification result. Then, based on the data attribute, a second verification is performed on the data entity to obtain a second verification result. Having obtained two verification structures for a data entity, the processor can iterate through and verify all data entities to obtain the corresponding first verification result and the corresponding second verification result for all data entities. Based on the corresponding first verification result and the corresponding second verification result for all data entities, the target data entity set corresponding to the EXCEL table data is determined.
[0074] Furthermore, in this embodiment of the application, the step of traversing and verifying all data entities and determining the target data entity set corresponding to the EXCEL table data based on the first verification result and the second verification result of each data entity may specifically include, but is not limited to, steps S301 to S302.
[0075] S301. Traverse and verify all the data entities, and determine the data entities whose first verification result is verification failure or whose second verification result is verification failure as target data entities.
[0076] S302. The set of target data entities is determined as the target data entity set.
[0077] In some feasible embodiments of this application, the processor can iterate through and verify all data entities. During this process, for any given data entity, if both the first and second verification results are verification failures, or if the first verification result is verification success and the second verification result is verification failure, the processor can determine the target data entity set as the set of each data entity corresponding to the second verification result. If the first verification result is verification failure and the second verification result is verification success, the processor can determine the target data entity set as the set of each data entity corresponding to the verification failure in the above three cases.
[0078] For example, the processor can verify all 100 data entities. Among these 100 data entities, the number of data entities whose first verification result is verification failure and whose second verification result is verification failure is 40, the number of data entities whose first verification result is verification success and whose second verification result is verification failure is 20, and if the number of entities whose first verification result is verification failure and whose second verification result is verification success is 10, then it can be finally determined that there are 70 data entities in the target data entity set.
[0079] The processor can verify all 90 data entities. Among these 90 data entities, the number of data entities whose first verification result is a failure and whose second verification result is a failure is 0, the number of data entities whose first verification result is a success and whose second verification result is a failure is 20, and the number of entities whose first verification result is a failure and whose second verification result is a success is 10. Then, it can be finally determined that there are 30 data entities in the target data entity set.
[0080] The processor can verify all 70 data entities. Among these 70 data entities, the number of data entities whose first verification result is a failure and whose second verification result is a failure is 40, the number of data entities whose first verification result is a success and whose second verification result is a failure is 0, and if the number of entities whose first verification result is a failure and whose second verification result is a success is 10, then it can be finally determined that there are 50 data entities in the target data entity set.
[0081] The processor can verify all 80 data entities. Among these 80 data entities, 40 data entities have both a first verification result of failure and a second verification result of failure, 20 data entities have both a first verification result of success and a second verification result of failure, and if the number of entities with both a first verification result of failure and a second verification result of success is 0, then it can be finally determined that there are 60 data entities in the target data entity set.
[0082] Furthermore, referring to Figure 3 , Figure 3 This diagram illustrates the steps involved in performing an initial validation on each data entity based on its attribute values, yielding the first validation result. Figure 3 In this process, the step may include, but is not limited to, steps S401 to S402, or steps S401 to S403.
[0083] S401. Parse the user-configured custom annotations and determine the preset data format corresponding to each data attribute value.
[0084] S402. If the data format of any data attribute value of a data entity is different from the preset data format, the first verification result is determined to be a verification failure.
[0085] S403. If the data format of all data attribute values of a data entity is the same as the preset format, the first verification result is determined to be successful.
[0086] It is understandable that user-configured custom annotations can include several preset data formats, each corresponding to a data attribute value. Each data attribute value, in turn, corresponds to a data attribute. For example, if the data attribute is time, the data format of the data attribute value can be up to A characters long.
[0087] In some feasible embodiments of this application, the processor can parse user-configured custom annotations to determine the preset data format corresponding to each data attribute value. If the data format of any data attribute value of any data entity is different from the preset data format, the second verification result is determined to be a verification failure. If the data formats of all data attribute values of any data entity are the same as the preset format, the second verification result is determined to be a verification success. For example, if the data attribute is length, and the data format of the data attribute value is at most B characters long, if the processor parses the user-configured custom annotations and obtains that the preset data format corresponding to each data attribute value is B characters long, then the processor can determine that the first verification result is a verification success; if the processor parses the user-configured custom annotations and obtains that the preset data format corresponding to each data attribute value is C characters long, then the processor can determine that the first verification result is a verification failure.
[0088] Furthermore, referring to Figure 4 , Figure 4 This diagram illustrates the steps involved in performing a second validation on a data entity based on its attributes, to obtain the second validation result. Figure 4 In this process, the step may include, but is not limited to, steps S501-S502 or steps S501 and S503.
[0089] S501. Call the database query function interface to query all built-in data attributes of the database.
[0090] S502. If any data attribute corresponding to a data entity is the same as any built-in data attribute, the second verification result is determined to be successful.
[0091] S503. If any data attribute corresponding to a data entity is different from all built-in data attributes, the second verification result is determined to be a verification failure.
[0092] In some feasible embodiments of this application, the processor can call the database query function interface to query all built-in data attributes of the database. If any data attribute corresponding to any data entity is the same as any built-in data attribute, the processor can determine that the second verification result is successful. If any data attribute corresponding to any data entity is different from all built-in data attributes, the second verification result is determined to be unsuccessful.
[0093] For example, the processor can call the database query function interface to query all built-in data attributes of the database, obtaining three data attributes a, b, and c. If any data attribute c corresponding to any data entity is the same as any one of a, b, and c, then the second verification result is determined to be successful. If any data attribute d corresponding to any data entity is different from any one of a, b, and c, then the second verification result is determined to be unsuccessful.
[0094] Furthermore, referring to Figure 5 , Figure 5 This diagram illustrates the steps involved in converting a target set of data entities into a tabular file data stream, uploading the tabular file data stream to a file server, and having the file server return a file download link to the webpage frontend. Figure 5 In this process, the step may include, but is not limited to, steps S601-S602.
[0095] S601. Save all data corresponding to the target data entity set as error data entities, and add the error data entities to the result set in the BaseExcelDTO base class.
[0096] S602. Determine that the result set is not empty, convert the result set into a table file data stream and save it to the file server, so that the file server returns a file download link to the webpage frontend.
[0097] In some feasible embodiments of this application, the processor can save all data corresponding to the target data entity set as error data entities and add the error data entities to the result set in the BaseExcelDTO base class. After obtaining the result set, the processor can determine whether the result set is empty. If it is not empty, the processor can convert the result set into a tabular file data stream and save it to the file server, so that the file server returns a file download link to the web page frontend. After the file download link is transmitted to the web page frontend, the web page frontend can prompt the user to download the file based on the response code and response information generated by the user's operation. After the user obtains the downloaded file, they can delete the error data in the downloaded file. After deleting the error data in the downloaded file, the user can re-upload the downloaded file.
[0098] Understandably, when a failed data entity is not stored, the result set can be empty.
[0099] Furthermore, the method for implementing feedback on the imported EXCEL results may also include step S104.
[0100] S104. In response to the user's preset operation on the webpage front end, generate a download prompt message and send it to the webpage front end.
[0101] In some embodiments of this application, the processor can obtain data entities from a list collection, where each row of an Excel spreadsheet can include several data attributes. After obtaining these data entities, the processor can perform basic and business validations on each data entity based on these attributes to determine a target data entity set that includes multiple data entities that failed validations. Once the target data entity set is obtained, the processor can convert it into a spreadsheet file data stream and upload it to a file server, causing the file server to return a file download link to the webpage. After the file download link reaches the webpage, the user can perform a preset operation on the webpage, and the processor can generate a download prompt message and send it to the webpage. This preset operation can be either generating a response code or generating response information.
[0102] The following description, in conjunction with the accompanying drawings, explains the method for implementing the feedback EXCEL import results in this application:
[0103] Reference Figure 6This embodiment primarily uses EasyExcel and a file server to handle issues related to uploaded spreadsheet data errors. The general process is as follows: when a data validation error occurs, the original validation result is written to the spreadsheet via EasyExcel and uploaded to the file server for users to download and view. Users simply need to delete the data in the spreadsheet that resulted in invalid validation and then re-upload the spreadsheet.
[0104] Specifically, the execution flow of this embodiment may include:
[0105] ① The user imports a table, and EasyExcel reads the table data into a list collection.
[0106] ② Iterate through the list to validate the entities in the collection, and write the validation results into the additional fields defined by the entity.
[0107] ③ If the validation fails, the data will be written into a spreadsheet file data stream using EasyExcel.
[0108] ④ Use the file server's API interface to upload the table file data stream to the file server and return the file download link to the front end.
[0109] ⑤ The front-end prompts the user to download the file based on the response code and response information.
[0110] ⑥ After deleting illegal data from the downloaded file, the user re-uploads the downloaded file.
[0111] The data entity verification process in this embodiment may include:
[0112] (1) Verification problem
[0113] When using tables to input data, we often receive data using the String data type. String data typically requires both basic validation and business validation. Basic validation mainly involves checking if the attribute values are empty, skipping rows where all attribute values are empty, and verifying that attribute values conform to a preset format (e.g., whether the time or length exceeds a preset length). Business validation, on the other hand, usually checks if the entered data attributes exist in the database.
[0114] (2) Verification method, wherein the verification method may include steps a to f.
[0115] a. Define a base class containing a list of data to read, an external function interface for querying the database, a collection of error messages for storing the validation process, an API interface for uploading spreadsheet files, the obtained download link, and a base class BaseExcelDTO, as follows:
[0116]
[0117] b. Custom annotations are used to specify how to validate entity attributes in the read collection and apply them to the attributes of the read entity. For example, the Person entity is as follows:
[0118]
[0119]
[0120] c. During the process of reading data entities into a list, we read one row of data corresponding to one entity, and use reflection to obtain the custom annotations on each attribute of this entity and the value read by that attribute.
[0121] d. All error data entities for the entire row validation will be saved into the ErrorRow entity, which mainly contains the row number and the corresponding error data entity, and then added to the result collection in the BaseExcelDTO base class.
[0122] e. After reading, check if the result set is empty. If it is not empty, it indicates the presence of erroneous data entities. Therefore, the result should be saved to a file server in tabular form, and its download link should be obtained and saved to the `downloadUrl` property of the base class.
[0123] f. In final use, we can determine whether the batch data import was successful by checking if the download link in the base class is empty. If it fails, we can also use the returned download link to inform the user of the line number of all the erroneous data entities and the corresponding error reason.
[0124] In summary, this application can display user-uploaded data errors and their causes by downloading files, allowing users to complete batch data import or update within two table uploads. This application only briefly downloads the table files uploaded to the file server when user-uploaded data encounters a validation error; after that, it has no other use. Therefore, a 5-minute file expiration time can be set to avoid wasting file server storage space. The code in this application that writes the list collection data to the table file when a validation error occurs, then uploads the table file to the server and returns the file download path, can be extracted into a common utility class using generics for use in the system's table data import function, improving code reusability. The code in this application that reads the uploaded table data into a list collection and validates each entity in the list collection can selectively utilize thread pools and thread utility classes to enable multi-threaded validation based on the size of the collection, improving response speed. This application's approach of using EasyExcel and the file server to return a download link for the table data validation results has the following advantages:
[0125] (1) This application allows users to find all errors without having to upload and modify the form multiple times.
[0126] (2) This application can reduce the phenomenon of inconsistency between imported data from tables and data changed in the database.
[0127] (3) After using the solution described in this application, when there are errors in the table data, the user only needs to upload the table twice and modify the table once to accurately complete the table data import function, which can greatly improve the user's experience in using the table batch data import function.
[0128] (4) If any page in the system of this application has an error in the import function, the download link can be returned directly using the utility class. There is no need to worry about wasting the storage space of the file server or reducing the performance of the system response to this interface.
[0129] In addition, refer to Figure 7 ,exist Figure 7This application embodiment also provides an implementation device for providing feedback on EXCEL import results. This device may include: an acquisition module 1001, a first processing module 1002, and a second processing module 1003. In this embodiment, the acquisition module 1001 may be connected to the first processing module 1002. The first processing module 1002 may be connected to the second processing module 1003. The acquisition module 1001 may be used to acquire the data entity of each row of EXCEL table data in a list collection; the data entity may include several data attributes. The first processing module 1002 may be used to perform two verifications on each data entity based on the several data attributes to determine the target data entity set corresponding to the EXCEL table data. The target data entity set is used to store the data entities that failed the verification. The second processing module 1003 may be used to convert the target data entity set into a table file data stream and upload the table file data stream to a file server, so that the file server returns a file download link to the webpage frontend.
[0130] Furthermore, in some feasible embodiments of this application, an apparatus for providing feedback on Excel import results may further include a third processing module 1004. In this embodiment, the acquisition module 1001 may be connected to the first processing module 1002. The first processing module 1002 may be connected to the second processing module 1003. The second processing module 1003 may be connected to the third processing module 1004. The third processing module 1004 may be used to generate download prompt information and send it to the webpage frontend in response to a user's preset operation on the webpage frontend.
[0131] It should be noted that the acquisition module 1001 can be any integrated circuit module or microprocessor module obtained by integrating a chip with processing functions and its peripheral circuits using existing integration technology. Similarly, the first processing module 1002 can also be any integrated circuit module or microprocessor module obtained by integrating a chip with processing functions and its peripheral circuits using existing integration technology. The first processing module 1002 may also include one or more memories. These memories can be used to store the target data entity set corresponding to the determined EXCEL spreadsheet data. The third processing module 1004 may also include one or more memories. These memories can be used to store download prompt information.
[0132] In some embodiments of this application, the acquisition module 1001 can be located in the same gateway or a device with a processor as the first processing module 1002 and the second processing module 1003. The acquisition module 1001 can acquire the data entity of each row of the EXCEL table data in the list collection through its own processor's internal chip; the first data entity can include several data attributes. The first processing module 1002 can perform two verifications on each data entity based on the several data attributes to determine the target data entity set corresponding to the EXCEL table data. The target data entity set is used to store the data entities that failed verification. The second processing module 1003 can convert the target data entity set into a table file data stream and upload the table file data stream to a file server so that the file server returns a file download link to the webpage frontend. The acquisition module 1001 can be any module connected to the gateway or the processor inside the device. The acquisition module 1001 can transmit the acquired data to the processor through a wired or wireless connection to the processor of the first processing module 1002. The processor of the first processing module 1002 can process the data through its internal chip to determine the target data entity set corresponding to the EXCEL table data, which may include multiple data entities that failed verification. The second processing module 1003 can convert the target data entity set into a tabular file data stream and upload the tabular file data stream to a file server, so that the file server returns a file download link to the webpage frontend. The specific device connection methods and device settings of the acquisition module 1001, the first processing module 1002, the second processing module 1003, and the third processing module 1004 are not limited.
[0133] In summary, the apparatus disclosed in this application for providing feedback on Excel import results involves an acquisition module 1001 acquiring data entities, each row of Excel table data in a list collection, which may include several data attributes. A first processing module 1002 performs two verifications on each data entity based on the several data attributes, determining a target data entity set that may include multiple data entities that failed verification. A second processing module 1003 converts the target data entity set into a table file data stream and uploads the table file data stream to a file server, allowing the file server to return a file download link to the webpage. This apparatus performs two verifications on the data entities in each row of the Excel table data in the list collection, determines a target data entity set that may include multiple data entities that failed verification, converts the target data entity set into a table file data stream, and uploads the table file data stream to a file server, allowing the file server to return a file download link to the webpage. Users can confirm successful import of the Excel table data based on the link on the webpage. Furthermore, the two verifications reduce the possibility of discrepancies between the user-entered data and the final imported or updated data, improving the stability of the data import process.
[0134] Reference Figure 8 This application also discloses a computer device, which may include:
[0135] At least one processor 1011;
[0136] At least one memory 1012 is used to store at least one program;
[0137] When at least one program is executed by at least one processor 1011, causing at least one processor 1012 to perform as follows: Figure 1 The example shown illustrates an implementation method for providing feedback on imported Excel results.
[0138] It is understandable that, such as Figure 1 The embodiments of the feedback EXCEL import results shown are all applicable to the embodiments of this computer device. The specific functions implemented by the embodiments of this computer device are the same as those shown below. Figure 1 The implementation method for providing feedback on imported Excel results is the same as the example shown, and the beneficial effects achieved are the same as those described. Figure 1 The beneficial effects achieved by the embodiment of the method for implementing feedback on Excel import results shown are also the same.
[0139] This application also discloses a computer-readable storage medium storing a processor-executable program, which, when executed by a processor, is used to implement, for example... Figure 1The example shown illustrates an implementation method for providing feedback on imported Excel results.
[0140] It is understandable that, such as Figure 1 The embodiments of the feedback method for importing Excel results shown are all applicable to the embodiments of this computer-readable storage medium. The specific functions implemented by the embodiments of this computer-readable storage medium are the same as those shown below. Figure 1 The implementation method for providing feedback on imported Excel results is the same as the example shown, and the beneficial effects achieved are the same as those described above. Figure 1 The beneficial effects achieved by the implementation method of the feedback EXCEL import results shown in the example are also the same.
[0141] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this application are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0142] Furthermore, although this application is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding this application. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional technology for an engineer. Therefore, those skilled in the art can implement the application set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of this application, which is determined by the full scope of the appended claims and their equivalents.
[0143] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and may include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0144] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system that may include a processor, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0145] More specific examples (a non-exhaustive list) of computer-readable media may include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0146] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0147] In the foregoing description of this specification, the references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0148] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
[0149] The foregoing has provided a detailed description of the preferred embodiments of this application. However, this application is not limited to these embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
[0150] In the description of this specification, the references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0151] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for feeding back EXCEL import results, characterized in that: include: Get the data entity of each row of the EXCEL table data in the list collection; the data entity includes several data attributes; According to a number of the data attributes, each of the data entities is verified twice to determine a target data entity set corresponding to the EXCEL table data; the target data entity set is used to store data entities that fail verification; The target data entity set is converted into a table file data stream, and the table file data stream is uploaded to a file server, so that the file server returns a file download link to a web page front end.
2. The method for implementing feedback of EXCEL import results according to claim 1, characterized in that: The step of performing two checks on each of the data entities according to the plurality of data attributes to determine a target data entity set corresponding to the EXCEL table data includes: According to the data attribute, the data attribute value is obtained by reflection; Performing a first verification on each of the data entities according to the data attribute value to obtain a first verification result; According to the data attribute, the data entity is verified for the second time to obtain a second verification result; All the data entities are traversed and verified, and a target data entity set corresponding to the EXCEL table data is determined according to the first verification result of each of the data entities and the second verification result of each of the data entities.
3. The method for implementing feedback of EXCEL import results according to claim 2, characterized in that: The traversing and verifying all the data entities, and determining the target data entity set corresponding to the EXCEL table data according to the first verification result of each of the data entities and the second verification result of each of the data entities, includes: Traversing and verifying all the data entities, and determining the data entity corresponding to which the first verification result is a verification failure or the second verification result is a verification failure as the target data entity; A set of the target data entities is determined as a target data entity set.
4. The method for implementing feedback of EXCEL import results according to claim 2, characterized in that: The first verification is performed on each of the data entities according to the data attribute value to obtain a first verification result, including: Parse the custom annotations configured by the user and determine the preset data format corresponding to each data attribute value; If the data format of any of the data attribute values of the data entity is different from the preset data format, determining that the first verification result is a verification failure; If the data formats of all the data attribute values of the data entity are the same as the preset format, it is determined that the first verification result is a successful verification.
5. The method for implementing feedback of EXCEL import results according to claim 2, characterized in that: The performing a second verification on the data entity according to the data attribute to obtain a second verification result includes: Call the database query function interface to query all built-in data attributes of the database; If any one of the data attributes corresponding to the data entity is the same as any one of the built-in data attributes, determining that the second verification result is a verification success; If any one of the data attributes corresponding to the data entity is different from all the built-in data attributes, it is determined that the second verification result is a verification failure.
6. The method for implementing feedback of EXCEL import results according to claim 1, characterized in that: The step of converting the target data entity set into a table file data stream, and uploading the table file data stream to a file server so that the file server returns a file download link to a web page front end, includes: Save all data corresponding to the target data entity set as error data entities, and add the error data entities to the result set in the BaseExcelDTO base class; Determine that the result set is not an empty set, convert the result set into the table file data stream and save it to the file server, so that the file server returns a file download link to the web page front end.
7. The method for implementing feedback of EXCEL import results according to claim 1, characterized in that: The method further comprises: In response to a preset operation of the user on the web page front end, download prompt information is generated and sent to the web page front end.
8. A device for feeding back EXCEL import results, characterized in that: include: The acquisition module is used to acquire the data entity of each row of the EXCEL table data in the list set; the data entity includes several data attributes; A first processing module is used to perform two checks on each of the data entities according to a number of the data attributes to determine a target data entity set corresponding to the EXCEL table data; the target data entity set is used to store data entities that fail the check; The second processing module is used to convert the target data entity set into a table file data stream, and upload the table file data stream to a file server, so that the file server returns a file download link to the web page front end.
9. A computer device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method for feeding back the EXCEL import result as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to implement the method for feeding back EXCEL import results as described in any one of claims 1 to 7 when executed by the processor.