Receipt data structure transformation method and system

By converting document data into JSON format and then into value object data, and performing persistence operations and differentiated processing, the problem of lack of standardized data structure in the existing technology is solved, and the transformation of document data structure and efficiency improvement are achieved.

CN120804028APending Publication Date: 2025-10-17YONYOU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510796139.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The existing technology lacks a standardized data structure with one master and multiple children and grandchildren, which makes it difficult to transform the data structure of documents such as purchase orders and makes it impossible to effectively record the cost details corresponding to the material information.

Method used

By obtaining the original data information of the document, converting it into JSON format, and converting it into value object data, including table header, table body and sub-table data, performing persistence operations, determining the difference data and making changes, ensuring data consistency and reducing redundancy.

Benefits of technology

It has achieved the transformation of document data structure, reduced data transmission volume, improved efficiency, ensured data legitimacy and consistency, and simplified the development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804028A_ABST
    Figure CN120804028A_ABST
Patent Text Reader

Abstract

The invention provides a method and a system for transforming a document data structure. The method for transforming the document data structure comprises the following steps: acquiring first data information of a first document; performing format conversion on the first data information to obtain second data information; the second data information is converted into corresponding value object data, and the value object data comprises header data, table body data and grandchild table data; according to the value object data and preset business logic, persistence operation is carried out on data in a database, and the persistence operation comprises insertion operation, updating operation and deletion operation; determining difference data according to the data in the database after the persistence operation and the first data information; and changing the first document according to the difference data to obtain a target document. According to the method, the format conversion, the data conversion, the persistence operation and the differentiation operation are sequentially carried out on the original document, so that the data structure of the original document is transformed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a reconstruction method and system of a data structure of a document. BACKGROUND

[0002] In the development process of procurement costs, the data structure of the original purchase order and other one-main-multiple-sub documents needs to be reconstructed, and a grandchild table is added under the sub table recording material information to record the cost details corresponding to the material information. However, in the related art, there is no standardized and universal one-main-multiple-sub-multiple-grandchild data structure available for use. Therefore, a reconstruction method of a data structure of a document is needed to reconstruct the data structure of the document. SUMMARY

[0003] The present application is intended to at least solve one of the problems existing in the prior art or related art.

[0004] To this end, a first aspect of the present application provides a reconstruction method of a data structure of a document.

[0005] A second aspect of the present application provides a reconstruction system of a data structure of a document.

[0006] Therefore, according to the first aspect of the present application, a reconstruction method of a data structure of a document is provided, which comprises: obtaining first data information of a first document; performing format conversion on the first data information to obtain second data information; converting the second data information into corresponding value object data, wherein the value object data comprises: table header data, table body data and grandchild table data; performing a persistent operation on the data in the database according to the value object data and a preset business logic, wherein the persistent operation comprises: an insertion operation, an update operation and a deletion operation; determining difference data according to the data in the database after the persistent operation and the first data information; and changing the first document according to the difference data to obtain a target document.

[0007] The application provides a reconstruction method of a bill data structure, which mainly comprises the following steps: first, obtaining first data information of a first bill, wherein the first data information refers to an original data structure of the first bill, such as a table header main table form, a table body sub-table form and a grandchild table data form; then, performing format conversion on the first data information to obtain second data information, wherein the format of the second data information can be a JSON (JavaScript Object Notation, a lightweight data exchange format) format, that is, the first data information is converted into JSON data; then, converting the second data information into corresponding value object data, wherein the value object (Value Object, VO) is an important concept in object-oriented programming and domain-driven design, and is mainly used for representing and encapsulating a group of related data as an indivisible whole unit; the value object data mainly comprises table header data, table body data and grandchild table data, that is, the table header main table form, the table body sub-table form and the grandchild table data form included in the second data information are respectively converted into corresponding table header data, table body data and grandchild table data; by converting the data structure, i.e., the table header main table form, the table body sub-table form and the grandchild table data form, into corresponding value object data, on the one hand, redundancy fields can be avoided, and on the other hand, data legality can be ensured. After obtaining the value object data, a persistent operation is performed on data in a database according to the value object data and a preset business logic, wherein the persistent operation comprises an insertion operation, an update operation and a deletion operation, that is, after the data conversion is completed, the value object data is inserted into the database according to the preset business logic, or data in the database is updated according to the value object data, or data in the database is deleted according to the value object, and by performing the persistent operation on the database according to the value object, the data consistency of the main table, the sub-table and the grandchild table is ensured. Then, the data in the database after the persistent operation is compared with the first data information, so that difference data, i.e., inconsistent fields, between the two is determined, and the difference data is extracted from the database, and finally, the first bill is changed according to the difference data to obtain a target bill. By determining the difference data, the data transmission amount can be reduced, the efficiency can be improved, and the first bill only needs to be partially changed. By sequentially performing format conversion, data conversion, persistent operation and difference operation on the original bill, the reconstruction of the data structure of the original bill is realized.

[0008] In some technical solutions, the step of converting the second data information into corresponding value object data comprises: obtaining each item of data in the second data information; judging a data category to which each item of data belongs, wherein the data category comprises table header data, table body data and grandchild table data; and converting each item of data into corresponding value object data according to the data category to which the item of data belongs.

[0009] In the technical solution, the step of converting the second data information into corresponding value object data comprises: firstly obtaining each item of data in the second data information, i.e. parsing the JSON data, cyclically reading each item of data in the JSON data, and then judging the data category to which each item of data belongs, wherein the data category comprises: table header data, table body data and grandchild table data. After each item of data in the JSON data is read, it is judged whether the value of the current item belongs to the table header data, the table body data or the grandchild table data, and finally the corresponding value object data is converted according to the data category to which each item of data belongs. By converting the JSON data into corresponding value object data, the standardization of the data structure can be realized, and the format of complex forms is unified through layering (main table, subtable, grandchild table) and value object. The code redundancy can be reduced and the data conversion efficiency can be improved through template-driven dynamic mapping. Meanwhile, the data consistency is ensured by using the immutability of the value object and the verification logic to avoid data pollution.

[0010] In some technical solutions, optionally, the step of obtaining the first data information of the first form comprises: determining a first operation of the user on the first form, wherein the first operation comprises: a save operation and an edit operation; when the first operation is the save operation, taking all the data information in the first form as the first data information; and when the first operation is the edit operation, obtaining third data information edited by the user and fourth data information associated with the third data information, and taking the third data information and the fourth data information as the first data information.

[0011] In the technical solution, the step of obtaining the first data information of the first form comprises: firstly determining a first operation of the user on the first form, wherein the first operation comprises: a save operation and an edit operation; when the first operation is the save operation, taking all the data information in the first form as the first data information; and when the first operation is the edit operation, obtaining third data information edited by the user and fourth data information associated with the third data information, and taking the third data information and the fourth data information as the first data information.

[0012] In some embodiments, the step of changing the first invoice according to the difference data to obtain the target invoice comprises: converting the difference data into fifth data information; obtaining preset template data; processing the fifth data information according to the preset template data to obtain sixth data information; and changing the first invoice according to the sixth data information to obtain the target invoice.

[0013] In this embodiment, the step of changing the first invoice according to the difference data to obtain the target invoice comprises: first converting the difference data into fifth data information, wherein the difference data is extracted from the database, and the difference data is converted into JSON data, i.e. the fifth data information, after being extracted; then obtaining preset template data, wherein the preset template data refers to the template of the target invoice; then processing the fifth data information according to the preset template data to obtain sixth data information, for example, the format of the fifth data information can be converted again according to the data format in the preset template data, into data information conforming to the format of the target invoice, so as to obtain data information that can be displayed on the target invoice; and finally changing the first invoice according to the sixth data information, thereby obtaining the target invoice. By converting the difference data and processing the difference data according to the preset template data, the integrity of the data in the target invoice is ensured.

[0014] In some embodiments, the step of processing the fifth data information according to the preset template data to obtain the sixth data information comprises: determining a first preset formula according to the preset template data; and processing the fifth data information according to the first preset formula to obtain the sixth data information.

[0015] In the technical solution, the step of processing the fifth data information according to the preset template data to obtain the sixth data information comprises: firstly determining a first preset formula according to the preset template data. After the first preset formula is obtained, the fifth data information is processed according to the first preset formula, for example, some data information in the fifth data information is subjected to addition, subtraction, multiplication, division and other operation according to the first preset formula, so as to obtain the sixth data information. The first preset formula is a formula configured by the preset template data. Specifically, the first preset formula can be a data calculation formula and a condition judgment formula. The data operation formula can be data operation or date processing on some data in the fifth data information, for example, the data operation formula can be: total amount = unit price × quantity, wherein the total amount is data in the sixth data information, and the unit price and the quantity are data in the fifth data information. The condition judgment formula can obtain different sixth data information according to different conditions of data in the fifth data information, for example, the condition judgment formula can be: if the amount is greater than 100,000, it is marked as a large order, otherwise it is a normal order, wherein the amount is data in the fifth data information, and the large order and the normal order are data in the sixth data information. Further, the first preset formula can also be a formatting formula and an association mapping formula. The data format in the fifth data information can be converted by the formatting formula, and the data in multiple fifth data information can be associated by the association mapping formula. The fifth data information is processed and translated according to the preset formula configured by the preset template data, so that the obtained sixth data information can meet the requirements of the document, and the first document is conveniently changed according to the sixth data information.

[0016] According to a second aspect of the present application, a system for modifying a document data structure is provided, comprising a first acquisition module configured to acquire first data information of a first document; a first processing module configured to perform format conversion on the first data information to obtain second data information; a second processing module configured to convert the second data information into corresponding value object data, wherein the value object data comprises: header data, table body data, and grandchild table data; a third processing module configured to perform a persistent operation on data in a database according to the value object data and a preset business logic, wherein the persistent operation comprises: an insertion operation, an update operation, and a deletion operation; a first determination module configured to determine difference data according to the data in the database after the persistent operation and the first data information; and a first change module configured to change the first document according to the difference data to obtain a target document.

[0017] The bill data structure reconstruction system provided by the application mainly comprises a first acquisition module, a first processing module, a second processing module, a third processing module, a first determination module and a first change module. The first acquisition module can acquire first data information of a first bill, wherein the first data information refers to the original data structure of the first bill, such as the table header main table form, the table body sub-table form and the grandchild table data form. The first processing module converts the first data information into second data information, wherein the format of the second data information can be JSON (JavaScript Object Notation, a lightweight data exchange format), that is, the first data information is converted into JSON data. The second processing module converts the second data information into corresponding value object data, wherein the value object (Value Object, VO) is an important concept in object-oriented programming and domain-driven design, mainly used to represent and encapsulate a set of related data as an indivisible whole unit. The value object data mainly includes table header data, table body data and grandchild table data, that is, the table header main table form, the table body sub-table form and the grandchild table data form included in the second data information are respectively converted into corresponding table header data, table body data and grandchild table data. By converting the data structure, that is, the table header main table form, the table body sub-table form and the grandchild table data form into corresponding value object data, on the one hand, redundant fields can be avoided, and on the other hand, data legality can be ensured. After obtaining the value object data, the third processing module performs a persistent operation on the data in the database according to the value object data and a preset business logic, wherein the persistent operation includes an insertion operation, an update operation and a deletion operation, that is, after the data conversion is completed, the value object data is inserted into the database according to the preset business logic, or the data in the database is updated according to the value object data, or the data in the database is deleted according to the value object, and the data consistency of the main table, the sub-table and the grandchild table is ensured by performing the persistent operation on the database according to the value object. Then the first determination module compares the data in the database after the persistent operation with the first data information, thereby determining the difference data, that is, the inconsistent fields, between the two, and extracting the difference data from the database, and finally the first change module changes the first bill according to the difference data to obtain a target bill. By determining the difference data, the data transmission amount can be reduced, the efficiency can be improved, and the first bill only needs to be partially changed. The application realizes the reconstruction of the data structure of the original bill by sequentially converting the format, data, persistent operation and difference operation of the original bill.

[0018] In some embodiments, the second processing module comprises: a second obtaining module, configured to obtain each item of data in the second data information; a judging module, configured to judge a data category to which each item of data belongs, wherein the data category comprises: table header data, table body data, and grandchild table data; and a fourth processing module, configured to convert each item of data into corresponding value object data according to the data category to which each item of data belongs.

[0019] In the technical solution, the second processing module comprises: a second obtaining module, a judging module, and a fourth processing module. The second obtaining module can obtain each item of data in the second data information, that is, the JSON data is parsed, and each item of data in the JSON data is read in a loop. Then, the judging module judges a data category to which each item of data belongs, wherein the data category comprises: table header data, table body data, and grandchild table data. After each item of data in the JSON data is read, it is judged whether the value of the current item belongs to table header data, table body data, or grandchild table data. Finally, the fourth processing module converts each item of data into corresponding value object data according to the data category to which each item of data belongs. By converting the JSON data into corresponding value object data, the normalization of the data structure can be realized, and the format of complex single documents can be unified through layering (main table, subtable, grandchild table) and value objects. The code redundancy can be reduced and the data conversion efficiency can be improved through dynamic mapping driven by templates. Meanwhile, the data consistency can be ensured by avoiding data pollution and using the immutability and verification logic of value objects.

[0020] In some embodiments, the first obtaining module comprises: a second determining module, configured to determine a first operation of the user on the first single document, wherein the first operation comprises: a save operation and an edit operation; a fifth processing module, configured to, when the first operation is the save operation, take all data information in the first single document as the first data information; and a sixth processing module, configured to, when the first operation is the edit operation, obtain third data information edited by the user and fourth data information associated with the third data information, and take the third data information and the fourth data information as the first data information.

[0021] In the technical solution, the first obtaining module comprises a second determining module, a fifth processing module and a sixth processing module. The second determining module can determine the first operation of the user on the first document, wherein the first operation comprises a save operation and an edit operation. After the user operates the document on the page, the operation of the user is analyzed to determine whether the user performs the save operation or the edit operation. When the first operation is the save operation, it indicates that the user wants to save the entire first document, and therefore the fifth processing module takes all the data information in the first document as the first data information. When the first operation is the edit operation, it indicates that the user only processes part of the content in the first document, and therefore the sixth processing module needs to obtain the third data information edited by the user and the fourth data information associated with the third data information, and finally processes the first data information by combining the third data information and the fourth data information. Further, when obtaining the first data information, the main table data and the sub-table data are first obtained, wherein the main table data is the header data and the sub-table data is the body data. Then, the grandchild table data is obtained separately, the data is filtered according to different operations of the user, and finally the grandchild table data is assembled into the main table data and the sub-table data to obtain the final first data information. By taking different data information as the first data information according to different operations of the user, the data transmission amount can be reduced and the efficiency can be improved.

[0022] In some technical solutions, the first changing module comprises a seventh processing module, a third obtaining module and an eighth processing module. The seventh processing module is configured to perform format conversion on the difference data to obtain the fifth data information. The third obtaining module is configured to obtain preset template data. The eighth processing module is configured to process the fifth data information according to the preset template data to obtain the sixth data information. The second changing module is configured to change the first document according to the sixth data information to obtain the target document.

[0023] In the technical solution, the first sending module comprises a seventh processing module, a third obtaining module, an eighth processing module and a second changing module. The seventh processing module can perform format conversion on the difference data to obtain the fifth data information. Since the difference data is extracted from the database, the difference data is converted into JSON data, i.e. the fifth data information, after the difference data is extracted. Then, the third obtaining module obtains preset template data, wherein the preset template data refers to the template of the target document. Then, the eighth processing module processes the fifth data information according to the preset template data to obtain the sixth data information. For example, the format of the fifth data information can be converted again according to the data format in the preset template data, so as to obtain data information conforming to the format of the target document, which can be displayed on the target document. Finally, the second changing module changes the first document according to the sixth data information, so as to obtain the target document. By performing format conversion on the difference data and processing the difference data according to the preset template data, the integrity of the data in the target document is ensured.

[0024] In some technical solutions, the eighth processing module comprises a third determining module and a ninth processing module. The third determining module is configured to determine a first preset formula according to the preset template data. The ninth processing module is configured to process the fifth data information according to the first preset formula to obtain the sixth data information.

[0025] In the technical solution, the eighth processing module comprises a third determination module and a ninth processing module. The third determination module first determines a first preset formula according to preset template data. After obtaining the first preset formula, the ninth processing module processes the fifth data information according to the first preset formula, for example, performs addition, subtraction, multiplication, division and other operation operations on some data information in the fifth data information according to the first preset formula, to obtain sixth data information, wherein the first preset formula is a formula configured by the preset template data, and specifically, the first preset formula can be a data calculation formula and a condition judgment formula, wherein the data operation formula can be data operation or date processing on some data in the fifth data information, for example, the data operation formula can be: total amount = unit price x quantity, wherein the total amount is data in the sixth data information, and the unit price and the quantity are data in the fifth data information. The condition judgment formula can obtain different sixth data information according to different conditions of the data in the fifth data information, for example, the condition judgment formula can be: if the amount is greater than 100,000, mark it as a large order, otherwise as a normal order, wherein the amount is data in the fifth data information, and the large order and the normal order are data in the sixth data information. Further, the first preset formula can also be a formatting formula and an association mapping formula, the data format in the fifth data information can be converted through the formatting formula, and the data in multiple fifth data information can be associated through the association mapping formula. By processing and translating the fifth data information according to the preset formula configured by the preset template data, the obtained sixth data information can meet the requirements of the document, and then it is convenient to change the first document according to the sixth data information.

[0026] Additional aspects and advantages of the application will become apparent from the following description with reference to the drawings. BRIEF DESCRIPTION OF DRAWINGS

[0027] The above and / or additional aspects and advantages of the present application will become apparent and be readily understood from the following description, taken in conjunction with the accompanying drawings, in which: Figure 1 A flowchart of a document data structure modification method according to an embodiment of the present application is shown; Figure 2 A flowchart of a step of converting second data information into corresponding value object data in a document data structure modification method according to an embodiment of the present application is shown; Figure 3 A flowchart of a step of obtaining first data information of a first document in a document data structure modification method according to an embodiment of the present application is shown; Figure 4A flow chart of a step of changing the first document according to the difference data to obtain a target document in the reconstruction method of the document data structure of one embodiment of the present application is shown; Figure 5 A flow chart of a step of processing the fifth data information according to the preset template data to obtain sixth data information in the reconstruction method of the document data structure of one embodiment of the present application is shown; Figure 6 A schematic block diagram of the reconstruction system of the document data structure of one embodiment of the present application is shown; Figure 7 A schematic block diagram of the second processing module in the reconstruction system of the document data structure of one embodiment of the present application is shown; Figure 8 A schematic block diagram of the first acquisition module in the reconstruction system of the document data structure of one embodiment of the present application is shown; Figure 9 A schematic block diagram of the first changing module in the reconstruction system of the document data structure of one embodiment of the present application is shown; Figure 10 A schematic block diagram of the eighth processing module in the reconstruction system of the document data structure of one embodiment of the present application is shown; Figure 11 A schematic diagram of the front-end medium in the reconstruction method of the document data structure of one embodiment of the present application is shown; Figure 12 A schematic diagram of the back-end medium in the reconstruction method of the document data structure of one embodiment of the present application is shown; Figure 13 A schematic diagram of the reconstruction method of the document data structure of one embodiment of the present application is shown. DETAILED DESCRIPTION

[0028] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0029] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application, however, the present application can also be implemented in other ways different from those described herein, therefore, the scope of protection of the present application is not limited to the specific embodiments disclosed below.

[0030] Figure 1 A flow chart of the reconstruction method of the document data structure of one embodiment of the present application is shown. Wherein, the method comprises: Step 102: acquiring first data information of a first document; Step 104: format conversion is conducted on the first data information to obtain second data information; Step 106: the second data information is converted into corresponding value object data, wherein the value object data includes table header data, table body data and grandchild table data; Step 108: a persistent operation is conducted on the data in the database according to the value object data and preset business logic, wherein the persistent operation includes an insertion operation, an update operation and a deletion operation; Step 110: difference data is determined according to the data in the database after the persistent operation and the first data information; Step 112: a target bill is obtained by changing the first bill according to the difference data.

[0031] The bill data structure reconstruction method provided by the application mainly comprises the following steps: first, obtaining first data information of a first bill, wherein the first data information refers to the original data structure of the first bill, such as the table header main table form, the table body sub-table form, and the grandchild table data form; then, performing format conversion on the first data information to obtain second data information, wherein the format of the second data information can be JSON (JavaScript Object Notation, a lightweight data exchange format), that is, the first data information is converted into JSON data; then, converting the second data information into corresponding value object data, wherein the value object (Value Object, VO) is an important concept in object-oriented programming and domain-driven design, and is mainly used to represent and encapsulate a set of related data as an indivisible whole unit; the value object data mainly comprises table header data, table body data, and grandchild table data, that is, the table header main table form, the table body sub-table form, and the grandchild table data form included in the second data information are respectively converted into corresponding table header data, table body data, and grandchild table data; by converting the data structure, that is, the table header main table form, the table body sub-table form, and the grandchild table data form into corresponding value object data, on the one hand, redundancy fields can be avoided, and on the other hand, data legality can be ensured. After obtaining the value object data, performing a persistent operation on the data in the database according to the value object data and a preset business logic, wherein the persistent operation comprises an insertion operation, an update operation, and a deletion operation, that is, after the data conversion is completed, the value object data is inserted into the database according to the preset business logic, or the data in the database is updated according to the value object data, or the data in the database is deleted according to the value object, and by performing the persistent operation on the database according to the value object, the data consistency of the main table, the sub-table, and the grandchild table is ensured. Then, comparing the data in the database after the persistent operation with the first data information to determine the difference data, that is, the inconsistent fields, and extracting the difference data from the database, and finally, changing the first bill according to the difference data to obtain a target bill. By determining the difference data, the data transmission amount can be reduced, the efficiency can be improved, and the first bill only needs to be partially changed. The application realizes the reconstruction of the data structure of the original bill by sequentially performing format conversion, data conversion, persistent operation, and differential operation on the original bill.

[0032] Figure 2 A flowchart of the step of converting the second data information into corresponding value object data in the bill data structure reconstruction method of one embodiment of the application is shown; wherein the step of converting the second data information into corresponding value object data comprises: Step 202: obtaining each item of data in the second data information; Step 204: judging the data category to which each item of data belongs, wherein the data category includes table header data, table body data and grandchild table data; Step 206: converting into corresponding value object data according to the data category to which each item of data belongs.

[0033] In this embodiment, the step of converting the second data information into corresponding value object data includes: firstly obtaining each item of data in the second data information, i.e. parsing the JSON data, cyclically reading each item of data in the JSON data, and then judging the data category to which each item of data belongs, wherein the data category includes table header data, table body data and grandchild table data. After each item of data in the JSON data is read, it is judged whether the value of the current item belongs to table header data, table body data or grandchild table data, and finally converted into corresponding value object data according to the data category to which each item of data belongs. By converting the JSON data into corresponding value object data, the normalization of the data structure can be realized, and the format of complex single bills is unified through layering (main table, sub-table, grandchild table) and value object. The code redundancy can be reduced and the data conversion efficiency can be improved through template-driven dynamic mapping. Meanwhile, the data consistency can be ensured by avoiding data pollution and using the immutability and verification logic of the value object.

[0034] Figure 3 FIG. 1 shows a flowchart of the step of obtaining the first data information of the first single bill in the reconstruction method of the single bill data structure of one embodiment of the present application; wherein the step of obtaining the first data information of the first single bill includes: Step 302: determining the first operation of the user on the first single bill, wherein the first operation includes a save operation and an edit operation; Step 304: when the first operation is the save operation, taking all the data information in the first single bill as the first data information; Step 306: when the first operation is the edit operation, obtaining the third data information edited by the user and the fourth data information associated with the third data information, and taking the third data information and the fourth data information as the first data information.

[0035] In the embodiment, the step of acquiring the first data information of the first document comprises: firstly determining a first operation of the user on the first document, wherein the first operation comprises: a save operation and an edit operation; when the user operates the document on the page, the operation of the user is analyzed to determine whether the user performs the save operation or the edit operation. When the first operation is the save operation, it is indicated that the user wants to save the entire first document, and therefore all the data information in the first document is taken as the first data information. When the first operation is the edit operation, it is indicated that the user only processes part of the content in the first document, and therefore the third data information edited by the user and the fourth data information associated with the third data information need to be acquired, and finally the third data information and the fourth data information are processed with the first data information. Further, when the first data information is acquired, it further comprises: firstly acquiring main table data and sub-table data, wherein the main table data is the header data, and the sub-table data is the body data; then acquiring the grandchild table data, filtering the data according to different operations of the user, and finally assembling the grandchild table data into the main table data and the sub-table data to obtain the final first data information. By taking different data information as the first data information according to different operations of the user, the data transmission amount can be reduced, and the efficiency can be improved.

[0036] Figure 4 A flowchart of a step of modifying a document data structure according to a difference data to obtain a target document in an embodiment of the application is shown; wherein the step of modifying the first document according to the difference data to obtain the target document comprises: Step 402: converting the difference data to obtain fifth data information; Step 404: acquiring preset template data; Step 406: processing the fifth data information according to the preset template data to obtain sixth data information; Step 408: modifying the first document according to the sixth data information to obtain the target document.

[0037] In this embodiment, the step of modifying a first document based on difference data to obtain a target document includes: first, converting the difference data into a fifth data message. Since the difference data is extracted from a database, the difference data is converted back into JSON data, i.e., the fifth data message, after extraction. Preset template data is obtained, where the preset template data refers to a template for the target document. The fifth data message is then processed based on the preset template data to obtain a sixth data message. For example, the format of the fifth data message may be further converted based on the data format in the preset template data to conform to the format of the target document, thereby obtaining data information that can be displayed on the target document. Finally, the first document is modified based on the sixth data message to obtain the target document. By converting the difference data into a format and processing the difference data based on the preset template data, the integrity of the data in the target document is ensured.

[0038] Figure 5 A flow chart illustrating the steps of processing fifth data information according to preset template data to obtain sixth data information in a document data structure modification method according to an embodiment of the present invention is provided. The steps of processing the fifth data information according to the preset template data to obtain the sixth data information include: Step 502: Determine a first preset formula according to preset template data; Step 504: Process the fifth data information according to the first preset formula to obtain sixth data information.

[0039] In this embodiment, the step of processing the fifth data information according to the preset template data to obtain the sixth data information includes: first determining a first preset formula according to the preset template data. After obtaining the first preset formula, the fifth data information is processed according to the first preset formula, for example, some data information in the fifth data information is operated by addition, subtraction, multiplication and division according to the first preset formula, so as to obtain the sixth data information. The first preset formula is a formula configured by the preset template data, specifically, the first preset formula can be a data calculation formula and a condition judgment formula, etc., wherein the data operation formula can be data operation or date processing on some data in the fifth data information, for example, the data operation formula can be: total amount = unit price x quantity, wherein the total amount is data in the sixth data information, and the unit price and the quantity are data in the fifth data information. The condition judgment formula can obtain different sixth data information according to different conditions of data in the fifth data information, for example, the condition judgment formula can be: if the amount > 100,000, mark it as a large order, otherwise, it is a normal order, wherein the amount is data in the fifth data information, and the large order and the normal order are data in the sixth data information. Further, the first preset formula can also be a formatting formula and an association mapping formula, the data format in the fifth data information can be converted through the formatting formula, and the data in multiple fifth data information can be associated through the association mapping formula. By processing and translating the fifth data information according to the preset formula configured by the preset template data, the obtained sixth data information can meet the requirements of the document, and then it is convenient to change the first document according to the sixth data information.

[0040] Exemplarily, the processing method of the document data structure provided by the present application specifies a master multi-child multi-grandchild data structure medium, solves the conversion of front-end data and back-end data of the master multi-child multi-grandchild data and the problem of differentiation and persistence of the master multi-child multi-grandchild data. The present application provides front-end and back-end two kinds of data structure media for the master multi-child multi-grandchild data to cope with different scenes of front-end and back-end. The front-end data is displayed in the form of a master multi-child multi-grandchild card, and the back-end data is displayed in the form of an aggregated VO. The child table associated with the grandchild table needs to record the information of the grandchild table through a method of implementing a public interface. Specifically, as shown in Figure 11 The front-end data, i.e. the first data information, is displayed in the form of a master multi-child multi-grandchild card, and the card includes a table header form, a table body table and a grandchild table. As shown in Figure 12As shown, the backend data, i.e. value object data, is presented in the form of an aggregated VO, including a master table VO, a child table VO, and a grandchild table associated with the child table, which needs to record the information of the grandchild table through a method implementing a public interface, including the entity of the grandchild table, the entity class full class name of the grandchild table, and the attribute name in the grandchild table recording the unique identifier of the child table. Then the application provides a method for converting the front-end and back-end data of one master and multiple children and multiple grandchildren, including front-end data assembly, JSON parsing (reading and writing), data conversion, and translation, and through a series of processes combined with the recorded grandchild table information in the medium, the front-end and back-end data of one master and multiple children and multiple grandchildren are converted. Finally, for the problem of data differentiation and persistence of one master and multiple children and multiple grandchildren, the application provides a corresponding persistence scheme, including insertion, update, and deletion, all of which treat the data of one master and multiple children and multiple grandchildren as one master and multiple children, and then perform separate persistent processing on the associated grandchild table through the recorded grandchild table information in the medium. At the same time, in order to reduce the amount of data transmitted between the front-end and the back-end, the data transmitted by the front-end and the data returned by the back-end are usually differentiated, and only the changed data is returned to the front-end, and the unchanged data is not transmitted. When differentiating, first, the front-end master and child table data are filtered to remove data that does not need to be transmitted, then the master and child table data are differentiated, and then the grandchild table is taken out according to the recorded grandchild table information in the child table and the grandchild table is differentiated.

[0041] Exemplarily, as Figure 13As shown, the present application introduces the specific process of the present application by a data processing device. The data processing device includes five parts: front-end data assembly, JSON parsing, data conversion, persistence and differentiation. When the user operates the document on the page, the front end assembles different data according to the scene, wherein the assembled data is the first data information. Specifically, when the user operation is save, the complete data is assembled, that is, all the data in the document is taken as the first data information. When the user operation is edit, the edited data and the associated data are assembled, that is, the data edited by the user and the data related to the data are taken as the first data information. When assembling data, the data of the main table and the sub-table is obtained first, and then the data of the grandchild table is obtained separately. According to the difference of the use scene, that is, the difference of the user operation, the data is filtered, and then the grandchild table data is put into the main table data and the sub-table data to complete the assembly. After the front-end data, that is, the first data information is assembled, it is transmitted to the back-end through Ajax (Asynchronous JavaScript and XML, a technology for asynchronous interaction between the background and the server, local updating of the page). The data transmission between the front-end and the back-end of the one main multi-sub multi-grandchild data is in the form of JSON, and the device needs to convert the data after the back-end receives the data. Specifically, when converting the data, the JSON data needs to be converted into a one main multi-sub multi-grandchild card first, and a JSON parser is used to read the JSON data and convert it into a one main multi-sub multi-grandchild card, or the one main multi-sub multi-grandchild card data is converted into JSON data. The JSON parser reads each item in the JSON through the iterator loop, judges whether the value of the current item belongs to the table header data or the table body data, or the grandchild table data, and converts it into the corresponding entity VO (Value Object) through the reader. The process of converting the one main multi-sub multi-grandchild card into JSON is opposite. Further, when converting the data, the corresponding preset template data needs to be queried first, and the data conversion between the front-end and the back-end is performed through the information in the template, and the data is assembled according to different data structures. If the data is converted from the back-end to the front-end, the device will also perform data processing and data translation according to the formula configured by the template after the conversion is completed. After the data conversion is completed, the corresponding business logic is executed according to the value object data, wherein the device involving the persistence operation also provides the corresponding tools including insertion, update and deletion. When implementing the business logic, the corresponding tools can be called to implement the persistence operation, that is, the original database can be inserted, updated and deleted according to the value object data. After the business logic is executed, the front-end data, that is, the first data information, and the data in the database after the persistence operation, that is, the processed back-end data, are differentiated to reduce the amount of data transmission between the front-end and the back-end. After the differentiation, the device reconverts the medium into JSON through the JSON parser and transmits it to the front-end for rendering, that is, updates the first document, so as to obtain the target document, and the data processing device ends.

[0042] The related art does not have a standard and convenient carrying medium for data of a master-multi-sub-multi-grandson structure, and the front-end conversion, data processing and the like of the data of the master-multi-sub-multi-grandson structure are also developed by self-processing. The present application effectively supplements the gap in this aspect, and for development, only business logic needs to be concerned, and the manpower and time in data structure and data processing are greatly reduced; for products, the scalability of the products is greatly improved, and the expansion of the functions of existing products is simpler, and the data processing is more efficient.

[0043] Figure 6 A schematic block diagram of a reconstruction system of a document data structure of one embodiment of the present application is shown, wherein the reconstruction system of the document data structure 60 comprises: A first acquisition module 602 is configured to acquire first data information of a first document; A first processing module 604 is configured to perform format conversion on the first data information to obtain second data information; A second processing module 606 is configured to convert the second data information into corresponding value object data, wherein the value object data comprises table header data, table body data and grandchild table data; A third processing module 608 is configured to perform a persistent operation on data in a database according to the value object data and a preset business logic, wherein the persistent operation comprises an insertion operation, an update operation and a deletion operation; A first determination module 610 is configured to determine difference data according to the data in the database after the persistent operation and the first data information; A first change module 612 is configured to change the first document according to the difference data to obtain a target document.

[0044] The bill data structure reconstruction system 60 provided by the application mainly comprises a first acquisition module 602, a first processing module 604, a second processing module 606, a third processing module 608, a first determination module 610 and a first change module 612. The first acquisition module 602 can acquire first data information of a first bill, wherein the first data information refers to the original data structure of the first bill, such as the table header main table form, the table body sub-table form and the grandchild table data form. The first processing module 604 converts the first data information into second data information, wherein the format of the second data information can be JSON (JavaScript Object Notation, a lightweight data exchange format), that is, the first data information is converted into JSON data. The second processing module 606 converts the second data information into corresponding value object data, wherein the value object (Value Object, VO) is an important concept in object-oriented programming and domain-driven design, mainly used to represent and encapsulate a set of related data as an indivisible whole unit. The value object data mainly comprises table header data, table body data and grandchild table data, that is, the table header main table form, the table body sub-table form and the grandchild table data form included in the second data information are respectively converted into corresponding table header data, table body data and grandchild table data. By converting the data structure, that is, the table header main table form, the table body sub-table form and the grandchild table data form into corresponding value object data, on the one hand, the redundancy field can be avoided, and on the other hand, the data legality can be ensured. After obtaining the value object data, the third processing module 608 performs a persistent operation on the data in the database according to the value object data and a preset business logic, wherein the persistent operation comprises an insertion operation, an update operation and a deletion operation, that is, after the data conversion is completed, the value object data is inserted into the database according to the preset business logic, or the data in the database is updated according to the value object data, or the data in the database is deleted according to the value object, and by performing the persistent operation on the database according to the value object, the data consistency of the main table, the sub-table and the grandchild table is ensured. Then the first determination module 610 compares the data in the database after the persistent operation with the first data information, so as to determine the difference data, that is, the inconsistent fields, between the two, and extracts the difference data in the database, and finally the first change module 612 changes the first bill according to the difference data to obtain a target bill. By determining the difference data, the data transmission amount can be reduced, the efficiency can be improved, and the first bill only needs to be partially changed. The application realizes the reconstruction of the data structure of the original bill by sequentially performing format conversion, data conversion, persistent operation and differential operation on the original bill.

[0045] Figure 7A schematic block diagram of a second processing module in a reconstruction system of a data structure of a bill is shown, wherein the second processing module 606 comprises: A second obtaining module 6062 is configured to obtain each item of data in the second data information. A judging module 6064 is configured to judge a data category to which each item of data belongs, wherein the data category comprises: table header data, table body data and grandchild table data. A fourth processing module 6066 is configured to convert each item of data into corresponding value object data according to the data category to which each item of data belongs.

[0046] In this embodiment, the second processing module 606 comprises: the second obtaining module 6062, the judging module 6064 and the fourth processing module 6066. The second obtaining module 6062 can obtain each item of data in the second data information, that is, the JSON data is parsed, each item of data in the JSON data is read in a loop, and then the judging module 6064 judges the data category to which each item of data belongs, wherein the data category comprises: table header data, table body data and grandchild table data. After each item of data in the JSON data is read, it is judged whether the value of the current item belongs to the table header data, the table body data or the grandchild table data, and finally the fourth processing module 6066 converts each item of data into corresponding value object data according to the data category to which each item of data belongs. By converting the JSON data into corresponding value object data, the standardization of the data structure can be realized, and the format of the complex bill is unified through layering (main table, sub-table, grandchild table) and value object. The code redundancy can be reduced and the data conversion efficiency can be improved through dynamic mapping driven by the template. Meanwhile, the data consistency is ensured by using the immutability of the value object and the verification logic to avoid data pollution.

[0047] Figure 8 A schematic block diagram of a first obtaining module in a reconstruction system of a data structure of a bill is shown, wherein the first obtaining module 602 comprises: A second determining module 6022 is configured to determine a first operation of a user on a first bill, wherein the first operation comprises: a save operation and an edit operation. A fifth processing module 6024 is configured to, when the first operation is the save operation, take all data information in the first bill as the first data information. A sixth processing module 6026 is configured to, when the first operation is the edit operation, obtain third data information edited by the user and fourth data information associated with the third data information, and take the third data information and the fourth data information as the first data information.

[0048] In this embodiment, the first obtaining module 602 comprises: a second determining module 6022, a fifth processing module 6024 and a sixth processing module 6026. The second determining module 6022 can determine the first operation of the user on the first document, wherein the first operation comprises a save operation and an edit operation. After the user operates the document on the page, the operation of the user is analyzed to determine whether the user performs the save operation or the edit operation. When the first operation is the save operation, it is indicated that the user wants to save the entire first document, and therefore the fifth processing module 6024 takes all the data information in the first document as the first data information. When the first operation is the edit operation, it is indicated that the user only processes part of the content in the first document, and therefore the sixth processing module 6026 needs to obtain the third data information edited by the user and the fourth data information associated with the third data information, and finally processes the first data information by taking the third data information and the fourth data information. Further, when obtaining the first data information, the main table data and the sub-table data are first obtained, wherein the main table data is the header data and the sub-table data is the body data. Then, the grandchild table data is obtained separately, the data is filtered according to different operations of the user, and the grandchild table data is placed in the main table data and the sub-table data to complete assembly to obtain the final first data information. By taking different data information as the first data information according to different operations of the user, the data transmission amount can be reduced and the efficiency can be improved.

[0049] Figure 9 A schematic block diagram of the first changing module in the reconstruction system of the document data structure of one embodiment of the present application is shown. The first changing module 612 comprises: The seventh processing module 6122 is configured to perform format conversion on the difference data to obtain the fifth data information. The third obtaining module 6124 is configured to obtain preset template data. The eighth processing module 6126 is configured to process the fifth data information according to the preset template data to obtain the sixth data information. The second changing module 6128 is configured to change the first document according to the sixth data information to obtain a target document.

[0050] In this embodiment, the first sending module comprises a seventh processing module 6122, a third obtaining module 6124, an eighth processing module 6126 and a second changing module 6128. The seventh processing module 6122 can perform format conversion on the difference data to obtain the fifth data information. Since the difference data is extracted from the database, the difference data is converted into JSON data, i.e. the fifth data information, after the difference data is extracted. Then, the third obtaining module 6124 obtains preset template data, wherein the preset template data refers to the template of the target document. Then, the eighth processing module 6126 processes the fifth data information according to the preset template data to obtain the sixth data information. For example, the format of the fifth data information can be converted again according to the data format in the preset template data, so as to obtain data information conforming to the format of the target document. The fifth data information can also be processed according to the configuration formula in the preset template data, so as to obtain data information that can be displayed on the target document. Finally, the second changing module 6128 changes the first document according to the sixth data information, so as to obtain the target document. By performing format conversion on the difference data and processing the difference data according to the preset template data, the integrity of the data in the target document is ensured.

[0051] Figure 10 A schematic block diagram of the eighth processing module in the reconstruction system of the document data structure of one embodiment of the present application is shown. The eighth processing module 6126 comprises: a third determining module 6130 configured to determine a first preset formula according to the preset template data; a ninth processing module 6132 configured to process the fifth data information according to the first preset formula to obtain the sixth data information.

[0052] In this embodiment, the eighth processing module 6126 comprises a third determination module 6130 and a ninth processing module 6132. The third determination module 6130 first determines a first preset formula according to the preset template data. After obtaining the first preset formula, the ninth processing module 6132 processes the fifth data information according to the first preset formula, for example, performs addition, subtraction, multiplication, division and other operation operations on some data information in the fifth data information according to the first preset formula, so as to obtain the sixth data information. The first preset formula is a formula configured by the preset template data, and specifically, the first preset formula can be a data calculation formula and a condition judgment formula, etc. The data operation formula can be data operation or date processing on some data in the fifth data information, for example, the data operation formula can be: total amount = unit price x quantity, wherein the total amount is data in the sixth data information, and the unit price and the quantity are data in the fifth data information. The condition judgment formula can obtain different sixth data information according to different conditions of the data in the fifth data information, for example, the condition judgment formula can be: if the amount > 100,000, mark it as a large order, otherwise as a normal order, wherein the amount is data in the fifth data information, and the large order and the normal order are data in the sixth data information. Further, the first preset formula can also be a formatting formula and an association mapping formula. The data format in the fifth data information can be converted through the formatting formula, and the data in multiple fifth data information can be associated through the association mapping formula. By processing and translating the fifth data information according to the preset formula configured by the preset template data, the obtained sixth data information can meet the requirements of the single bill, and thus it is convenient to change the first single bill according to the sixth data information.

[0053] In the description of this specification, the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance, unless otherwise expressly specified and limited; the terms "connection", "installation", "fixation" and the like should be understood in a broad sense, for example, "connection" can be fixed connection, can also be detachable connection, or integrally connected; can be directly connected, or indirectly connected through an intermediate medium. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0054] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "a specific embodiment" and the like means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0055] The above merely provides the preferred embodiments of the present application, and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the principles and technical scope of the present application shall fall into the scope of the present application.

Claims

1. A method for transforming a document data structure, characterized in that: include: Obtaining first data information of a first document; Converting the first data information into a second data information; Convert the second data information into corresponding value object data, wherein the value object data includes: table header data, table body data, and sub-table data; Performing persistence operations on the data in the database according to the value object data and preset business logic, wherein the persistence operations include: insert operations, update operations, and delete operations; Determine difference data based on the data in the database after the persistence operation and the first data information; The first document is modified according to the difference data to obtain a target document.

2. The method for transforming the document data structure according to claim 1, characterized in that: The step of converting the second data information into corresponding value object data includes: Acquire each item of data in the second data information; Determine the data category to which each data item belongs, wherein the data categories include: table header data, table body data, and sub-table data; Each item of data is converted into the corresponding value object data according to the data category to which it belongs.

3. The method for transforming the document data structure according to claim 1, characterized in that: The step of obtaining the first data information of the first document includes: Determining a first operation of the user on the first document, wherein the first operation includes: a save operation and an edit operation; If the first operation is the save operation, all data information in the first document is used as the first data information; When the first operation is the editing operation, third data information edited by the user and fourth data information associated with the third data information are acquired, and the third data information and the fourth data information are used as the first data information.

4. The method for transforming a document data structure according to any one of claims 1 to 3, characterized in that: The step of modifying the first document according to the difference data to obtain a target document includes: Performing format conversion on the difference data to obtain fifth data information; Get preset template data; Processing the fifth data information according to the preset template data to obtain sixth data information; The first document is modified according to the sixth data information to obtain the target document.

5. The method for transforming the document data structure according to claim 4, characterized in that: The step of processing the fifth data information according to the preset template data to obtain the sixth data information includes: Determine a first preset formula according to the preset template data; The fifth data information is processed according to the first preset formula to obtain the sixth data information.

6. A document data structure transformation system, characterized in that: include: a first acquisition module, configured to acquire first data information of a first document; a first processing module, configured to convert the first data information into a second data information; a second processing module, configured to convert the second data information into corresponding value object data, wherein the value object data includes: table header data, table body data, and sub-table data; A third processing module, configured to perform a persistence operation on the data in the database according to the value object data and preset business logic, wherein the persistence operation includes an insert operation, an update operation, and a delete operation; a first determining module, configured to determine difference data based on the data in the database after the persistence operation and the first data information; The first modification module is used to modify the first document according to the difference data to obtain a target document.

7. The document data structure transformation system according to claim 6, characterized in that: The second processing module includes: a second acquisition module, configured to acquire each item of data in the second data information; A judgment module, the judgment module is used to judge the data category to which each data item belongs, wherein the data category includes: header data, table body data and sub-table data; A fourth processing module is configured to convert each item of data into corresponding value object data according to the data category to which the data belongs.

8. The document data structure transformation system according to claim 6, characterized in that: The first acquisition module includes: a second determining module, the second determining module being configured to determine a first operation performed by the user on the first document, wherein the first operation includes: a save operation and an edit operation; a fifth processing module configured to, based on the first operation being the save operation, use all data information in the first document as the first data information; The sixth processing module is configured to obtain, when the first operation is the editing operation, third data information edited by the user and fourth data information associated with the third data information, and use the third data information and the fourth data information as the first data information.

9. The document data structure transformation system according to any one of claims 6 to 8, characterized in that: The first modification module includes: a seventh processing module, configured to perform format conversion on the difference data to obtain fifth data information; A third acquisition module, the third acquisition module is used to acquire preset template data; an eighth processing module, configured to process the fifth data information according to the preset template data to obtain sixth data information; The second modification module is used to modify the first document according to the sixth data information to obtain the target document.

10. The document data structure transformation system according to claim 9, characterized in that: The eighth processing module includes: a third determining module, configured to determine a first preset formula according to the preset template data; A ninth processing module is configured to process the fifth data information according to the first preset formula to obtain the sixth data information.