File processing method, device and server

By obtaining the target file path and performing verification processing through a data verification plugin, the problem of non-compliant files caused by poor browser compatibility is solved, the accuracy of data processing is improved, and it is a file upload solution applicable to multiple browsers.

CN116383153BActive Publication Date: 2026-06-02INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-04-11
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, Internet Explorer and domestic browsers can only upload target files using their respective default plugins, resulting in non-compliant target files and affecting the accuracy of subsequent data processing.

Method used

The path of the target file is obtained by using a preset data verification plugin, and verification is performed. If it meets the preset rules, the file is uploaded. The file is imported into memory and converted into binary data using asynchronous tasks and FileReader objects. The xlsx plugin is used for further verification, and verification result information is generated.

Benefits of technology

It achieves compatibility across different browsers, ensures the compliance of uploaded files, improves the accuracy of subsequent data processing, has a short development cycle, low cost, and is applicable to multiple browsers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383153B_ABST
    Figure CN116383153B_ABST
Patent Text Reader

Abstract

The application provides a file processing method and device and a server, relates to data processing technology, and the method comprises the following steps: in response to an import operation for a target file, obtaining a target path of the target file according to a preset data verification plug-in. According to the preset data verification plug-in, the target file under the target path is subjected to verification processing to obtain verification result information. If it is determined that the verification result information represents that the data in the target file meets preset data rule information, the target file is uploaded to complete the verification processing of the target file. The method of the application can realize excel file import, analysis and uploading based on the preset plug-in, and has the advantages of simple scheme, short development cycle, low implementation cost, fast online completion, strong compatibility and the like, and solves the technical problems of poor browser compatibility and low accuracy of subsequent data processing caused by non-compliant uploaded target files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to data processing technology, and more particularly to a file processing method, apparatus, and server. Background Technology

[0002] Currently, office terminals need to perform operations such as parsing and uploading imported target files during their use.

[0003] In the current technology, both Internet Explorer and domestic browsers can only upload target files using their respective default plugins.

[0004] However, in the existing technology, since both Internet Explorer and domestic browsers can only upload target files using their respective default plugins, there may be issues with the uploaded target files not being compliant, which could lead to low accuracy in subsequent processing based on such target files. Summary of the Invention

[0005] This application provides a file processing method, apparatus, and server to solve the technical problems of poor browser compatibility and low accuracy of subsequent data processing due to non-compliant uploaded target files.

[0006] Firstly, this application provides a document processing method, including:

[0007] In response to an import operation on a target file, the target path of the target file is obtained based on a preset data verification plugin;

[0008] The target file under the target path is verified by the preset data verification plugin to obtain verification result information; if it is determined that the verification result information indicates that the data in the target file conforms to the preset data rule information, the target file is uploaded to complete the verification and uploading process of the target file.

[0009] Further, the step of verifying the target file under the target path according to the preset data verification plugin to obtain verification result information includes:

[0010] An asynchronous task is constructed based on the asynchronous function object built into the preset data verification plugin;

[0011] The data validation function corresponding to the data validation plugin and the target path are passed into the asynchronous task, and the asynchronous task is started.

[0012] During the execution of the asynchronous task, based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data;

[0013] The binary data is verified to obtain the verification result information.

[0014] Further, the binary data is subjected to verification processing to obtain verification result information, including:

[0015] Based on a preset callback function, the binary data is converted into an unsigned integer array that can be accessed using array indices through a preset browser object;

[0016] The unsigned integer array is traversed, each character object in the unsigned integer array is converted into a string, and the strings corresponding to each character object are concatenated into a target string object;

[0017] The target string object is read according to the preset xlsx plugin, and the target string object is converted to obtain the array to be verified; wherein, the array to be verified contains each sheet in the target file and each data cell in each sheet;

[0018] The array to be verified is subjected to verification processing to obtain verification result information.

[0019] Furthermore, the step of responding to an import operation on a target file by obtaining the target file's target path according to a preset data verification plugin includes:

[0020] In response to an import operation on a target file, a preset document element is obtained based on a preset data verification plugin; wherein the preset document element is used to indicate the location of the target path of the target file;

[0021] Based on the location of the target path, obtain the target path of the target file.

[0022] Furthermore, the method also includes:

[0023] The memory information of the target file under the target path is obtained according to the preset data verification plugin.

[0024] Further, based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data, including:

[0025] If it is determined that the memory information of the target file is less than or equal to the preset file memory threshold, then based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data.

[0026] Furthermore, the preset data validation plugin is a jQuery plugin; the target file type includes an Excel file.

[0027] Furthermore, the method also includes:

[0028] If it is determined that the verification result information indicates that the data in the target file does not conform to the preset data rules information, a prompt message is generated; wherein, the prompt message is used to indicate that the target file upload failed and the erroneous data that caused the upload failure.

[0029] Secondly, this application provides a document processing apparatus, comprising:

[0030] The first acquisition unit is used to obtain the target path of the target file according to the preset data verification plugin in response to the import operation of the target file;

[0031] The verification unit is used to verify the target file under the target path according to the preset data verification plugin and obtain the verification result information.

[0032] The upload unit is used to upload the target file if it is determined that the verification result information indicates that the data in the target file conforms to the preset data rule information, so as to complete the verification and upload process of the target file.

[0033] Further, the verification unit includes:

[0034] The construction module is used to construct an asynchronous task based on the asynchronous function object built into the preset data verification plugin;

[0035] The upload module is used to pass the data verification function corresponding to the data verification plugin and the target path to the asynchronous task, and start the asynchronous task;

[0036] The import module is used to import the target file in the target path into memory based on the data verification function and the FileReader object during the execution of the asynchronous task, and convert it into binary data.

[0037] The verification module is used to perform verification processing on the binary data to obtain verification result information.

[0038] Furthermore, the verification module includes:

[0039] The first conversion submodule is used to convert the binary data into an unsigned integer array that can be accessed by array subscripts based on a preset callback function and a preset browser object.

[0040] The second conversion submodule is used to traverse the unsigned integer array, convert each character object in the unsigned integer array into a string, and concatenate the strings corresponding to each character object into a target string object;

[0041] The third conversion submodule is used to read the target string object according to the preset xlsx plugin, and convert the target string object to obtain the array to be verified; wherein, the array to be verified contains each sheet in the target file and each data cell in each sheet;

[0042] The verification submodule is used to perform verification processing on the array to be verified and obtain verification result information.

[0043] Further, the first acquisition unit includes:

[0044] The first acquisition module is used to acquire preset document elements according to a preset data verification plugin in response to an import operation on the target file; wherein the preset document elements are used to indicate the location of the target path of the target file.

[0045] The second acquisition module is used to acquire the target path of the target file based on the location of the target path.

[0046] Furthermore, the device also includes:

[0047] The second acquisition unit is used to acquire the memory information of the target file under the target path according to the preset data verification plugin.

[0048] Furthermore, the import module is specifically used for:

[0049] If it is determined that the memory information of the target file is less than or equal to the preset file memory threshold, then based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data.

[0050] Furthermore, the preset data validation plugin is a jQuery plugin; the target file type includes an Excel file.

[0051] Furthermore, the device also includes:

[0052] The prompting unit is used to generate a prompting message if it is determined that the verification result information indicates that the data in the target file does not conform to the preset data rule information; wherein, the prompting message is used to indicate that the target file upload failed and the erroneous data that caused the upload failure.

[0053] Thirdly, this application provides a server, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the method described in the first aspect.

[0054] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect.

[0055] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0056] This application provides a file processing method, apparatus, and server. In response to an import operation on a target file, the method obtains the target file's target path using a preset data verification plugin. The target file under the target path is then verified using the preset data verification plugin to obtain verification result information. If the verification result information indicates that the data in the target file conforms to preset data rules, the target file is uploaded to complete the target file verification process. Specifically, this method obtains the target file's target path using a preset data verification plugin, retrieves the target file under the target path using the same plugin, and verifies the target file to obtain verification result information. The verification result information is then judged to determine whether the data in the target file conforms to preset data rules. If the verification result information indicates that the data in the target file conforms to preset data rules, the data in the target file is determined to be compliant and legal, and the target file is then uploaded to complete the target file verification and upload process. Therefore, the preset data validation plugin can realize the import, parsing and uploading of Excel files. The solution is simple, the development cycle is short, the implementation cost is low, and it can be quickly launched. The data validation plugin has strong compatibility and is suitable for various types of browsers. It solves the technical problems of poor browser compatibility and the low accuracy of subsequent data processing due to non-compliant uploaded target files. Attached Figure Description

[0057] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0058] Figure 1 A flowchart illustrating a document processing method provided in an embodiment of this application;

[0059] Figure 2 A flowchart illustrating another document processing method provided in this application embodiment;

[0060] Figure 3 A flowchart illustrating yet another document processing method provided in this application embodiment;

[0061] Figure 4 This is a schematic diagram of the structure of a document processing device provided in an embodiment of this application;

[0062] Figure 5 This is a schematic diagram of another document processing apparatus provided in an embodiment of this application;

[0063] Figure 6 This is a schematic diagram of the structure of a server provided in an embodiment of this application.

[0064] The accompanying drawings have illustrated specific embodiments of this disclosure, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this disclosure to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0065] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure.

[0066] Currently, with technological advancements, office desktop terminals need to be 100% domestically produced. This involves modifications based on the Chromium kernel to adapt and support domestic operating systems (UOS + 360 Security Browser and Kylin OS + QiAnXin Trusted Browser), while also ensuring verification for Win10 + Microsoft Edge browser. Because the controls for handling Excel files specific to Internet Explorer are incompatible with domestic browsers, and traditional financial scenarios involve numerous Excel upload and import functions, new alternative solutions need to be researched.

[0067] In one example, an office terminal, during its deployment, needs to perform operations such as parsing and uploading imported target files. Currently, both Internet Explorer and domestic browsers can only upload target files using their respective default plugins. However, because these browsers rely on default plugins, the uploaded target files may not be compliant, leading to lower accuracy in subsequent processing based on these files.

[0068] This application provides a document processing method, apparatus, and server, which aims to solve the above-mentioned technical problems of the prior art.

[0069] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0070] Figure 1 This is a flowchart illustrating a file processing method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method includes:

[0071] Step 101: In response to the import operation for the target file, obtain the target path of the target file according to the preset data verification plugin.

[0072] For example, the execution entity in this embodiment can be a server. First, the server deploys a browser. In the browser, the user can select and import the target file using the import button. The import is mainly based on the file selection capabilities provided by the browser's native elements, supporting the selection of various file types. Therefore, the browser also has the ability to determine whether the selected file is the target file. If the selected file is not the target file, the user needs to be prompted to import the correct file. In addition, since the native method of obtaining the file memory object has compatibility issues in some browsers, a preset data validation plugin needs to be introduced into the browser page. Based on this preset data validation plugin, the document element responsible for uploading on the page is obtained, and the target path of the target file selected by the user, the memory occupied by the target file, etc., are obtained based on the obtained document element. The preset data validation plugin can be a jQuery plugin, etc. jQuery is a fast and concise JavaScript framework with unique chained syntax and a concise and clear multi-functional interface, and has efficient and flexible CSS selectors; the target file type includes Excel files, etc.

[0073] In this step, in response to an import operation on an Excel file, the server can obtain the target path of the Excel file using the jQuery plugin.

[0074] Step 102: According to the preset data verification plugin, the target file under the target path is verified to obtain the verification result information.

[0075] For example, a preset data verification plugin is used to verify the target file. The server obtains the target file in the target path according to the preset data verification plugin, performs verification processing on the target file in the target path, and obtains the verification result information.

[0076] Step 103: If the verification result information indicates that the data in the target file conforms to the preset data rules, then upload the target file to complete the verification process of the target file.

[0077] For example, the server judges the verification result information, which indicates whether the data in the target file conforms to the preset data rules information. If it is determined that the verification result information indicates that the data in the target file conforms to the preset data rules information, then the data in the target file is determined to be compliant and legal, and the target file is then uploaded to complete the verification and uploading process of the target file.

[0078] In this embodiment, in response to an import operation on a target file, the target path of the target file is obtained according to a preset data verification plugin. The target file under the target path is then verified using the preset data verification plugin to obtain verification result information. If the verification result information indicates that the data in the target file conforms to preset data rules, the target file is uploaded to complete the target file verification process. In this solution, the target path of the target file is obtained using the preset data verification plugin, the target file under the target path is obtained using the preset data verification plugin, and the target file under the target path is verified to obtain verification result information. The verification result information is judged to indicate whether the data in the target file conforms to preset data rules. If the verification result information indicates that the data in the target file conforms to preset data rules, the data in the target file is determined to be compliant and legal, and the target file is then uploaded to complete the target file verification and upload process. Therefore, based on the preset data verification plugin, Excel file import, parsing, and uploading can be achieved. The solution is simple, has a short development cycle, low implementation cost, and can be quickly deployed. The data verification plugin has strong compatibility and is suitable for various types of browsers, solving the technical problems of poor browser compatibility and low accuracy in subsequent data processing due to non-compliant uploaded target files.

[0079] Figure 2 A flowchart illustrating another file processing method provided in this application embodiment is shown below. Figure 2 As shown, the method includes:

[0080] Step 201: In response to the import operation for the target file, obtain the preset document elements according to the preset data verification plugin; wherein, the preset document elements are used to indicate the location of the target path of the target file.

[0081] In one example, the default data validation plugin is a jQuery plugin; the target file type includes Excel files.

[0082] For example, document elements can partition a browser page. Therefore, the default document element is used to indicate the target path of the target file; that is, the default document element is the document element responsible for uploading. If the user selects an Excel file and imports it using the import button, the server responds to the import operation for the Excel file by retrieving the document element responsible for uploading using the jQuery plugin.

[0083] Step 202: Obtain the target path of the target file based on the location of the target path.

[0084] For example, the server obtains the target path of the Excel file based on the location of the target path indicated by the document element responsible for uploading.

[0085] Step 203: Obtain the memory information of the target file under the target path according to the preset data verification plugin.

[0086] For example, the server can obtain the memory usage information of the target file under the target path based on the jQuery plugin.

[0087] Step 204: Construct an asynchronous task based on the asynchronous function object built into the preset data validation plugin.

[0088] For example, because data validation and uploading occur in parallel in domestic browsers, the file may be imported to the backend before validation is complete. Therefore, a method is needed to change these two parallel steps to be executed serially. Thus, the server can construct an asynchronous task based on the asynchronous function object built into the jQuery plugin.

[0089] Step 205: Pass the data validation function and target path corresponding to the data validation plugin into the asynchronous task, and start the asynchronous task.

[0090] For example, the server passes the data validation function corresponding to the data validation plugin and the target path to the asynchronous task, and starts the asynchronous task.

[0091] Step 206: During the execution of the asynchronous task, based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data.

[0092] In one example, step 206 includes: if it is determined that the memory information of the target file is less than or equal to a preset file memory threshold, then based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data.

[0093] For example, the server executes and listens for asynchronous tasks. During the execution of the asynchronous task, it determines whether the memory information of the target file is less than or equal to a preset file memory threshold. The file memory threshold is a preset value used to limit the import of excessively large files. If it is determined that the memory information of the target file is less than or equal to the preset file memory threshold, the target file in the target path is imported into memory based on the data verification function and the browser's native FileReader object, and converted into binary data. The FileReader object allows the web application to asynchronously read the content stored on the user's computer or the raw data buffer.

[0094] Step 207: Perform verification processing on the binary data to obtain the verification result information.

[0095] In one example, step 207 includes: based on a preset callback function, converting binary data into an unsigned integer array accessible by array indices using a preset browser object; iterating through the unsigned integer array, converting each character object in the array into a string, and concatenating the strings corresponding to each character object into a target string object; reading the target string object according to a preset xlsx plugin, and converting the target string object to obtain the array to be verified; wherein, the array to be verified contains each sheet in the target file and each data cell in each sheet; performing verification processing on the array to be verified to obtain verification result information.

[0096] For example, the server listens for the FileReader object's read completion event and performs content parsing and compliance checks within the event's predefined callback function. Specifically, in this callback function, the binary data is first converted into an unsigned integer array accessible by array indices using a browser object. Then, the unsigned integer array is iterated through, each character object in the array is converted into a string, and the strings corresponding to each character object are concatenated into a target string object. At this point, the Excel file object has been converted into a target string object. Finally, the xlsx plugin is used to read this target string object and convert it into a verification array. This verification array contains each sheet in the Excel file and each data cell within each sheet. The xlsx plugin is a script that processes Excel files. Then, the data in each cell of the Excel file can be accessed, and the data's validity and compliance can be checked to obtain the verification result information.

[0097] Step 208: If the verification result information indicates that the data in the target file conforms to the preset data rules, then upload the target file to complete the verification and upload process of the target file.

[0098] For example, the server listens for task execution events, which include execution success and execution failure events. If it is determined that the verification result information indicates that the data in the target file conforms to the preset data rules information, the server listens for the execution success event and then automatically calls the form submission event of the traditional code to complete the upload, thus completing the verification and upload processing of the target file.

[0099] Step 209: If the verification result information indicates that the data in the target file does not conform to the preset data rule information, a prompt message is generated; the prompt message is used to indicate that the target file upload failed and the erroneous data that caused the upload failure.

[0100] For example, if it is determined that the verification result information indicates that the data in the target file does not conform to the preset data rule information, an execution failure event is detected, and an error is thrown and the user is prompted that the upload failed.

[0101] In this embodiment, in response to an import operation on a target file, a preset document element is obtained according to a preset data verification plugin; wherein, the preset document element is used to indicate the location of the target file's target path. The target path of the target file is obtained based on the location of the target path. The memory information of the target file under the target path is obtained according to the preset data verification plugin. An asynchronous task is constructed based on the asynchronous function object built into the preset data verification plugin. The data verification function corresponding to the data verification plugin and the target path are passed into the asynchronous task, and the asynchronous task is started. During the execution of the asynchronous task, based on the data verification function and the FileReader object, the target file in the target path is imported into memory and converted into binary data. The binary data is verified to obtain verification result information. If it is determined that the verification result information indicates that the data in the target file conforms to the preset data rules information, the target file is uploaded to complete the target file verification and upload process. If it is determined that the verification result information indicates that the data in the target file does not conform to the preset data rules information, a prompt message is generated; wherein, the prompt message is used to indicate that the target file upload failed and the error data that caused the upload failure. Therefore, the pre-defined data validation plugin enables the import, parsing, and uploading of Excel files. The solution is simple, has a short development cycle, low implementation cost, and can be quickly deployed. The data validation plugin is highly compatible with various browser types, solving the technical problems of poor browser compatibility and the low accuracy of subsequent data processing due to non-compliant uploaded target files. Furthermore, this application utilizes as many native browser capabilities as possible, making it very easy to modify the upload code for traditional Internet Explorer.

[0102] For example, Figure 3 A flowchart illustrating another document processing method provided in this application embodiment is shown below. Figure 3As shown, the process includes: selecting a file using the browser's native object (i.e., the FileReader object); obtaining file characteristic information using jQuery, including the target path; constructing a data validation function; passing both the file characteristic information and the data validation function to the asynchronous task built by the jQuery plugin; if the asynchronous task executes successfully, the browser's native form is submitted to the backend; if the asynchronous task fails, an upload failure message is displayed.

[0103] Figure 4 This is a schematic diagram of the structure of a document processing device provided in an embodiment of this application, as shown below. Figure 4 As shown, the device includes:

[0104] The first acquisition unit 31 is used to obtain the target path of the target file according to the preset data verification plugin in response to the import operation of the target file.

[0105] The verification unit 32 is used to perform verification processing on the target file under the target path according to the preset data verification plugin, and obtain the verification result information.

[0106] Upload unit 33 is used to upload the target file if the verification result information indicates that the data in the target file conforms to the preset data rule information, so as to complete the verification and upload process of the target file.

[0107] The apparatus in this embodiment can execute the technical solutions in the above method. Its specific implementation process and technical principles are the same, and will not be repeated here.

[0108] Figure 5 This is a schematic diagram of another document processing apparatus provided in an embodiment of this application. Figure 4 Based on the illustrated embodiments, as Figure 5 As shown, the verification unit 32 includes:

[0109] The construction module 321 is used to construct an asynchronous task based on the asynchronous function object built into the preset data validation plugin.

[0110] Upload module 322 is used to pass the data verification function and target path corresponding to the data verification plugin to the asynchronous task and start the asynchronous task.

[0111] Import module 323 is used to import the target file in the target path into memory and convert it into binary data based on the data verification function and the FileReader object during the execution of asynchronous tasks.

[0112] The verification module 324 is used to perform verification processing on binary data and obtain verification result information.

[0113] In one example, verification module 324 includes:

[0114] The first conversion submodule 3241 is used to convert binary data into an unsigned integer array that can be accessed by array subscripts based on a preset callback function and a preset browser object.

[0115] The second conversion submodule 3242 is used to traverse the unsigned integer array, convert each character object in the unsigned integer array into a string, and concatenate the strings corresponding to each character object into a target string object.

[0116] The third conversion submodule 3243 is used to read the target string object according to the preset xlsx plugin and convert the target string object to obtain the array to be verified; wherein, the array to be verified contains each sheet in the target file and each data cell in each sheet.

[0117] The verification submodule 3244 is used to perform verification processing on the array to be verified and obtain the verification result information.

[0118] In one example, the first acquisition unit 31 includes:

[0119] The first acquisition module 311 is used to obtain preset document elements according to a preset data verification plugin in response to an import operation on the target file; wherein the preset document elements are used to indicate the location of the target path of the target file.

[0120] The second acquisition module 312 is used to obtain the target path of the target file based on the location of the target path.

[0121] In one example, the device also includes:

[0122] The second acquisition unit 41 is used to acquire the memory information of the target file under the target path according to the preset data verification plugin.

[0123] In one example, module 323 is imported, specifically for:

[0124] If the memory information of the target file is determined to be less than or equal to the preset file memory threshold, then based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data.

[0125] In one example, the default data validation plugin is a jQuery plugin; the target file type includes Excel files.

[0126] In one example, the device also includes:

[0127] The prompting unit 42 is used to generate a prompting message if the verification result information indicates that the data in the target file does not conform to the preset data rule information; wherein, the prompting message is used to indicate that the target file upload failed and the erroneous data that caused the upload failure.

[0128] The apparatus in this embodiment can execute the technical solutions in the above method. Its specific implementation process and technical principles are the same, and will not be repeated here.

[0129] Figure 6 This application provides a schematic diagram of the structure of a server, as shown in the embodiment of the present application. Figure 6 As shown, the server includes: a memory 51 and a processor 52.

[0130] The memory 51 stores a computer program that can run on the processor 52.

[0131] Processor 52 is configured to perform the methods provided in the embodiments described above.

[0132] The server also includes a receiver 53 and a transmitter 54. The receiver 53 is used to receive instructions and data sent by external devices, and the transmitter 54 is used to send instructions and data to external devices.

[0133] This application also provides a non-transitory computer-readable storage medium, which, when the instructions in the storage medium are executed by the processor of a server, enables the server to perform the methods provided in the above embodiments.

[0134] This application also provides a computer program product, which includes: a computer program stored in a readable storage medium, at least one processor of the server can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the server to perform the solution provided in any of the above embodiments.

[0135] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0136] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A file processing method, characterized in that, include: In response to an import operation on a target file, the target path of the target file is obtained based on a preset data verification plugin; An asynchronous task is constructed based on the asynchronous function object built into the preset data verification plugin; The data validation function corresponding to the data validation plugin and the target path are passed into the asynchronous task, and the asynchronous task is started. During the execution of the asynchronous task, based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data; The binary data is verified to obtain the verification result information; If the verification result information indicates that the data in the target file conforms to the preset data rules, then the target file is uploaded to complete the verification and upload process of the target file.

2. The method according to claim 1, characterized in that, The binary data is verified to obtain verification result information, including: Based on a preset callback function, the binary data is converted into an unsigned integer array that can be accessed using array indices through a preset browser object; The unsigned integer array is traversed, each character object in the unsigned integer array is converted into a string, and the strings corresponding to each character object are concatenated into a target string object; The target string object is read according to the preset xlsx plugin, and the target string object is converted to obtain the array to be verified; wherein, the array to be verified contains each sheet in the target file and each data cell in each sheet; The array to be verified is subjected to verification processing to obtain verification result information.

3. The method according to claim 1, characterized in that, The step of responding to an import operation on a target file by obtaining the target path of the target file according to a preset data verification plugin includes: In response to an import operation on a target file, a preset document element is obtained based on a preset data verification plugin; wherein the preset document element is used to indicate the location of the target path of the target file; Based on the location of the target path, obtain the target path of the target file.

4. The method according to any one of claims 1-3, characterized in that, The method further includes: The memory information of the target file under the target path is obtained according to the preset data verification plugin.

5. The method according to claim 4, characterized in that, Based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data, including: If it is determined that the memory information of the target file is less than or equal to the preset file memory threshold, then based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data.

6. The method according to any one of claims 1-3, characterized in that, The preset data validation plugin is a jQuery plugin; the target file type includes Excel files.

7. The method according to any one of claims 1-3, characterized in that, The method further includes: If it is determined that the verification result information indicates that the data in the target file does not conform to the preset data rules information, a prompt message is generated; wherein, the prompt message is used to indicate that the target file upload failed and the erroneous data that caused the upload failure.

8. A document processing device, characterized in that, include: The first acquisition unit is used to obtain the target path of the target file according to the preset data verification plugin in response to the import operation of the target file; The verification unit is used to construct an asynchronous task based on the asynchronous function object built into the preset data verification plugin; The data validation function corresponding to the data validation plugin and the target path are passed into the asynchronous task, and the asynchronous task is started. During the execution of the asynchronous task, based on the data verification function, the target file in the target path is imported into memory according to the FileReader object and converted into binary data; The binary data is subjected to verification processing to obtain verification result information; The upload unit is used to upload the target file if it is determined that the verification result information indicates that the data in the target file conforms to the preset data rule information, so as to complete the verification and upload process of the target file.

9. A server, characterized in that, The method includes a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.

11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-7.