Document processing method and device, computer equipment, readable storage medium and program product
By creating and storing document headers and document body objects in a unified data structure, the problem of low document processing efficiency in programming languages is solved, and the efficiency improvement of document processing and resource conservation is achieved.
Patent Information
- Application Number
- CN202411087691.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-15
AI Technical Summary
In programming languages, document processing efficiency is low due to inconsistent operations caused by objects of different data structures, resulting in low business processing efficiency.
Create document headers and document objects through a preset unified data structure, assign values and store them in the database, ensuring the unified data structure and operation methods of document headers and document objects, and simplifying the access process.
It improves the efficiency of document processing, saves computing resources generated by the use of different operating methods of different data structure objects, and simplifies the access process of new documents.
Smart Images

Figure CN118964357A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a document processing method, apparatus, computer equipment, computer-readable storage medium and computer program product. Background Art
[0002] In economic business scenarios, documents are the original data and important basis for accounting. With the development of the times, the access and use of electronic documents have been realized through computer technology. In the process of business processing, documents are usually processed through applications developed in programming languages. For example, in object-oriented programming (OOP), after the application side queries the document from the database, it uses programming language to build an object to carry the document, that is, to represent the document through an entity object, and to process the document through the operation object. An object refers to an entity with state (attributes or data) and behavior (method or function). For example, a document object includes attributes such as document number and document date, as well as behaviors such as addition, deletion, and modification.
[0003] However, programming languages usually have some object data structures, that is, the properties and methods of objects. For example, the properties and value-taking methods of DataTable, DataSet, DataRow in C# language and Map, List in Java language are different. Therefore, objects with different data structures are needed to carry complete documents for business processing, which leads to low business processing efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a document processing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve document processing efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a document processing method, comprising:
[0006] Receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data;
[0007] Based on the preset unified data structure, create a document header object corresponding to the document header data, and assign values to the attribute information of the document header object based on the document header data;
[0008] Based on the unified data structure, create a document body object corresponding to the document body data, and assign attribute information to the document body object based on the document body data;
[0009] Based on the assigned document header object and document body object, obtain the target document object corresponding to the newly added document;
[0010] Based on the target document object, the newly added document data package is stored in the database.
[0011] In a second aspect, the present application also provides a document processing device, comprising:
[0012] A request receiving module is used to receive a new document request; the new document request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data;
[0013] The document header object creation module is used to create a document header object corresponding to the document header data based on a preset unified data structure, and assign attribute information of the document header object based on the document header data;
[0014] A document body object creation module is used to create a document body object corresponding to the document body data based on a unified data structure, and to assign attribute information of the document body object based on the document body data;
[0015] The target document object determination module is used to obtain the target document object corresponding to the newly added document based on the assigned document header object and document body object;
[0016] The document storage module is used to store the newly added document data package into the database based on the target document object.
[0017] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0018] Receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data;
[0019] Based on the preset unified data structure, create a document header object corresponding to the document header data, and assign values to the attribute information of the document header object based on the document header data;
[0020] Based on the unified data structure, create a document body object corresponding to the document body data, and assign attribute information to the document body object based on the document body data;
[0021] Based on the assigned document header object and document body object, obtain the target document object corresponding to the newly added document;
[0022] Based on the target document object, the newly added document data package is stored in the database.
[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0024] Receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data;
[0025] Based on the preset unified data structure, create a document header object corresponding to the document header data, and assign values to the attribute information of the document header object based on the document header data;
[0026] Based on the unified data structure, create a document body object corresponding to the document body data, and assign attribute information to the document body object based on the document body data;
[0027] Based on the assigned document header object and document body object, obtain the target document object corresponding to the newly added document;
[0028] Based on the target document object, the newly added document data package is stored in the database.
[0029] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0030] Receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data;
[0031] Based on the preset unified data structure, create a document header object corresponding to the document header data, and assign values to the attribute information of the document header object based on the document header data;
[0032] Based on the unified data structure, create a document body object corresponding to the document body data, and assign attribute information to the document body object based on the document body data;
[0033] Based on the assigned document header object and document body object, obtain the target document object corresponding to the newly added document;
[0034] Based on the target document object, the newly added document data package is stored in the database.
[0035] The above-mentioned document processing method, device, computer equipment, computer-readable storage medium and computer program product realize the unification of the data structure of the document header object and the document body object by creating a document header object corresponding to the document header data and a document body object corresponding to the document body data according to the document header data and the document body data in the newly added document data using a preset unified data structure; then the target document object corresponding to the newly added document is obtained according to the assigned document header object and the document body object. Since the data structure of the document header object and the document body object in the target document object is unified, the operation method of the document header object and the document body object is unified, that is, the access method of the document header data of the document header object and the document body data of the document body object is unified, which simplifies the access process of the newly added document and improves the processing efficiency of the newly added document. Furthermore, it can also save the computing power resources generated by using different operation methods for objects with different data structures. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 An application environment diagram of a document processing method in an embodiment;
[0038] Figure 2 A schematic diagram of a process flow of a document processing method in one embodiment;
[0039] Figure 3 is a schematic diagram of a target document object in an embodiment;
[0040] Figure 4 A schematic diagram of a collection object of multiple target documents in one embodiment;
[0041] Figure 5 A schematic diagram of changes before and after document data modification in one embodiment;
[0042] Figure 6 A schematic diagram of the data structure of a DynamicObject object in one embodiment;
[0043] Figure 7 A schematic diagram illustrating core members of a DynamicObject object in one embodiment;
[0044] Figure 8 A timing diagram of document business processing in an embodiment;
[0045] Fig. 9 is a structural block diagram of a document processing device in one embodiment;
[0046] Fig.10 is an internal structure diagram of a computer device in one embodiment;
[0047] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] The document processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 receives a request for adding a document; the request for adding a document carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data; the terminal 102 creates a document header object corresponding to the document header data based on a preset unified data structure, and assigns attribute information of the document header object based on the document header data; the terminal 102 creates a document body object corresponding to the document body data based on the unified data structure, and assigns attribute information of the document body object based on the document body data; the terminal 102 obtains the target document object corresponding to the new document based on the assigned document header object and document body object; the terminal 102 stores the new document data packet in the database in the server 104 based on the target document object. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0050] In one embodiment, Figure 2 As shown, a document processing method is provided. This embodiment takes the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0051] Step 202, receiving a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data.
[0052] Among them, the document addition request refers to the request to add a document to the database. A document refers to a certificate obtained or filled in when an economic business occurs, which records the actual situation of the transaction or matter, such as a purchase order, a sales order, etc. A document includes a document header and a document body. The document header contains the basic information of the document, such as the document number, document date, etc., and the document body contains the detailed item information of the document, such as the material number, material name, etc. In the document header, generally one field corresponds to one input content. The input content can be a field or a value, a symbol, an image, etc. For example, the field for the document number corresponds to 202406-001. The document body is generally in the format of a two-dimensional table, and multiple rows can be entered, which are called entries. Each row in the entry is called an entry line. One field in the document body corresponds to multiple input contents. For example, the field for the material number corresponds to the input contents of each entry line, such as XXX-001, XXX-002, etc. A new document refers to a document newly entered by the user through the terminal. The newly added document data packet refers to the data packet generated by the terminal based on the newly added document entered by the user, and is used for the terminal to store the newly added document data packet in the database. The newly added document data packet includes the document header data and document body data of the newly added document. The document header data refers to the data corresponding to the document header in the newly added document data packet. The document body data refers to the data corresponding to the document body in the newly added document data packet. The document header data and the document body data respectively include various fields and corresponding input contents. The document header data and the document body data can be used as the document data of the newly added document.
[0053] Specifically, the terminal interacts with the user through the front-end human-computer interaction device (hereinafter referred to as the front-end device). Generally, the front-end device generates a blank document in response to the document creation instruction triggered by the user, and displays the blank document on the front-end device through a web page. The document creation instruction may include a document type. The front-end device obtains the corresponding document template as a blank document according to the document type. A blank document refers to a document template with blank input content. The front-end device then receives the data entered by the user for the blank document through a web page to obtain a new document, generates a new document data packet according to the document data in the new document, and generates a document addition request according to the new document data packet and sends it to the terminal. Generally, the terminal responds to the document addition request and stores the new document data packet in the memory for processing.
[0054] Step 204: Create a document header object corresponding to the document header data based on the preset unified data structure, and assign attribute information of the document header object based on the document header data.
[0055] Step 206: Create a document body object corresponding to the document body data based on the unified data structure, and assign attribute information to the document body object based on the document body data.
[0056] Among them, the preset unified data structure refers to the data structure of a predefined object that can uniformly carry document data of various data types in a document. The document data of various data types in a document include document header data and document body data, that is, an object using a unified data structure can carry both document header data and document body data in a document. The data structure of an object includes attributes and methods. Attributes refer to the state information of an object, which is used to describe the characteristics of an object, such as attributes such as a document number; methods refer to the behavior of an object, that is, the operations that an object can perform, such as obtaining and modifying the document data carried by the object. Objects carrying document data and object operations can be achieved by predefining the attributes and methods of objects. Objects carrying document data can be achieved by assigning values to the attributes of the object according to the document data, and obtaining an entity object representing the specific content of the document, such as assigning the input content "202406-001" to "document number" to obtain a document object with specific document number content. The document header object refers to the object to be assigned corresponding to the document header. The document body object refers to the object to be assigned corresponding to the document body.
[0057] Specifically, the terminal receives a new document request, stores the new document data packet in the new document request into the memory, and divides the document header data and the document body data into the memory. The terminal creates a document header object corresponding to the document header data according to a preset unified data structure, and searches for the corresponding target data from the document header data according to each attribute information in the document header object, assigns the found target data to the corresponding attribute information, and obtains the assigned document header object. Then the terminal creates a document body object corresponding to the document header data according to a preset unified data structure, and searches for the corresponding target data from the document body data according to each attribute information in the document body object, assigns the found target data to the corresponding attribute information, and obtains the assigned document body object. Since the data structures of the document header object and the document body object are unified, the pre-defined operation method can be used to uniformly operate the assigned document header object and the document body object, such as the value operation method for the document header object is the same as the value operation method for the document body object.
[0058] Step 208: Based on the assigned document header object and document body object, obtain the target document object corresponding to the newly added document.
[0059] Specifically, the terminal establishes an association relationship between the assigned document body object and the document header object, which may be to generate an index of the document body object, write the index into the document header object, and then the terminal encapsulates the associated document header object and document body object to obtain a target document object corresponding to the newly added document. The document body object may also be compressed into the document header object to obtain a target document header object containing the document body object, and the target document object corresponding to the newly added document is obtained according to the target document header object. At this time, the target document object serves as an entity object that carries the newly added document data packet corresponding to the newly added document.
[0060] Step 210: based on the target document object, store the newly added document data package into the database.
[0061] Specifically, the terminal operates the target document object according to the method of a predefined object. It may be that the storage method of the predefined object is reused to uniformly store the document header data carried by the document header object in the target document object into the database, and the document body data carried by the document body object in the target document object is stored into the database, thereby completing the storage of the newly added document data packet in the database.
[0062] In the above document processing method, by using a preset unified data structure to create a document header object corresponding to the document header data and a document body object corresponding to the document body data according to the document header data and the document body data in the newly added document data, the data structure of the document header object and the document body object are unified; then, the target document object corresponding to the newly added document is obtained according to the assigned document header object and the document body object. Since the data structure of the document header object and the document body object in the target document object is unified, the operation method of the document header object and the document body object is unified, that is, the access method of the document header data of the document header object and the document body data of the document body object is unified, which simplifies the access process of the newly added documents and improves the processing efficiency of the newly added documents. Furthermore, it can also save computing resources generated by using different operation methods for objects with different data structures.
[0063] In one embodiment, the newly added document data packet also includes sub-document body data corresponding to the target entry line in the document body data; step 208, based on the assigned document header object and document body object, obtains the target document object corresponding to the newly added document, including:
[0064] Based on the unified data structure, a sub-document body object corresponding to the sub-document body data is created, and attribute information of the sub-document body object is assigned based on the sub-document body data; based on the document ID corresponding to the newly added document, a document body ID corresponding to the document body data and a sub-document body ID corresponding to the sub-document body data are generated;
[0065] Associate the sub-document body ID with the sub-document body object and write it into the document body object;
[0066] Write the document header object based on the document body identifier and the document body object after writing;
[0067] Based on the sub-document body object, the document body object after writing, and the document header object after writing, the target document object corresponding to the newly added document is composed.
[0068] The target entry line refers to the entry line with a sub-document body in the entry of the document body. The sub-document body data refers to the next-level sub-item information corresponding to the item represented by the target entry line. The sub-document body is generally in the format of a two-dimensional table, including sub-entry lines. The sub-document body object refers to the object to be assigned corresponding to the sub-document body.
[0069] Specifically, the newly added document data packet also includes the sub-document body data corresponding to the target entry line. After obtaining the assigned document header object and document body object, the terminal determines the sub-document body data corresponding to the target entry line in the document body according to the hierarchical relationship in the document data in the newly added document data packet. The terminal creates a sub-document body object corresponding to the sub-document body data according to the unified data structure, searches for the corresponding target data in the sub-document body data according to the attribute information in the sub-document body object, assigns the found target data to the sub-document body object, and obtains the assigned sub-document body object. Then the terminal generates the document body identifier corresponding to the document body data and the sub-document body identifier corresponding to the sub-document body data according to the document identifier of the newly added document, and the terminal can also generate the sub-document body identifier corresponding to the sub-document body data according to the line number corresponding to the target entry line. The terminal associates the sub-document body identifier and the sub-document body object and writes them into the document body object, which can be to generate a sub-document body key-value pair according to the sub-document body identifier and the sub-document body object, and write the sub-document body key-value pair into the document body object. Then the terminal associates the document body identifier and the written document body object and writes them into the document header object. It can generate a document body key-value pair based on the document body identifier and the written document body object, and write the document body key-value pair into the document header object. The terminal composes the target document object corresponding to the newly added document with the sub-document body object, the written document body object and the written document header object.
[0070] In one embodiment, a newly added document may include multiple document headers and multiple document bodies. The target entry line in the document body may correspond to multiple sub-document bodies, and the target sub-entry line in the sub-document body may also correspond to one or more subordinate sub-document bodies. When the target sub-entry line in the sub-document body corresponds to one or more subordinate sub-document bodies, a subordinate sub-document body object corresponding to the subordinate sub-document body data is created, and the attribute information of the subordinate sub-document body object is assigned according to the subordinate sub-document body data. Then, a subordinate sub-document body identifier is generated according to the sub-document body identifier of the sub-document body data, and the subordinate sub-document body identifier and the subordinate sub-document body object are associated and written into the sub-document body object. The terminal composes the target document object corresponding to the newly added document according to the document header object, the document body object, the sub-document body object, and the subordinate sub-document body object.
[0071] In this embodiment, the document header data, document body data, sub-document body data and lower-level sub-document body data are carried by an object of a unified data structure, and unified operations on the document header data, document body data, sub-document body data and lower-level sub-document body data can be achieved through object methods. Furthermore, the expansion of multiple document bodies and sub-document bodies in a document can be achieved through the associated storage between objects, thereby improving the document processing efficiency.
[0072] In one embodiment, step 206, based on the unified data structure, creates a document body object corresponding to the document body data, and assigns attribute information of the document body object based on the document body data, including:
[0073] Based on the unified data structure, create entry line objects corresponding to each entry line data in the document body data, and assign attribute information to the entry line objects based on the entry line data;
[0074] Combine the assigned entry line objects to obtain the assigned document body object.
[0075] Specifically, the terminal determines each entry line data according to the document body data, creates entry line objects corresponding to each entry line data according to the unified data structure, and then searches for corresponding target data in the corresponding entry line data according to the attribute information of the entry line object, assigns the found target data to the entry line object, and obtains the assigned entry line objects corresponding to each entry line data. The terminal combines the assigned entry line objects to obtain the assigned document body object.
[0076] In a specific embodiment, Figure 3 The schematic diagram of the target document object shown in the figure shows the relationship between the DynamicObject object and the document. Figure 3In the gray font, because the document data of different documents are different, the attribute information assigned in the object is different, so the objects that carry different document data can be called dynamic objects. DynamicObjectCollection represents a dynamic collection object, which is composed of multiple DynamicObject objects. Figure 3 Gray font in the . Figure 3 The purchase order includes the document header, document body and sub-document body. The document header can carry the document header data through the DynamicObject object; the document body and sub-document body both carry the document body data and sub-document body data through the DynamicObjectCollection collection object, representing the collection of entry line objects for each entry line in the document body, and each entry line carries the corresponding entry line data through DynamicObject, and the collection of sub-entry line objects representing each sub-entry line in the sub-document body, and each sub-entry line carries the corresponding sub-entry line data through DynamicObject. For example:
[0077] Document header object:
[0078] DynamicObject1={"Document Number":"xxx-20240725-001";"Purchase Date":"2024-06-01";"Supplier":"XXX Trading Company"....};
[0079] Each entry line object in the document body:
[0080] DynamicObject1-1={"row number":"1";"material number":"xxx-001"....};
[0081] DynamicObject1-2={"row number":"2";"material number":"xxx-002"....};
[0082] …
[0083] Document body collection object:
[0084] DynamicObjectCollection1={DynamicObject1-1;DynamicObject1-2;…};
[0085] Each sub-entry line object in the sub-document body:
[0086] DynamicObject2-1={"Line number":"1";"Delivery quantity":"4"....};
[0087] DynamicObject2-2={"Line number":"2";"Delivery quantity":"6"....};
[0088] …
[0089] Sub-document collection object:
[0090] DynamicObjectCollection2={DynamicObject2-1;DynamicObject2-2;…}.
[0091] Then the terminal combines the document header object, document body object and sub-document body object into the target document object DynamicObjectA corresponding to the purchase order.
[0092] In a specific embodiment, the document body object is a collection object DynamicObjectCollection1 integrated by various entry line objects. And a sub-document body key-value pair is generated according to the sub-document body identifier and the sub-document body object, wherein the sub-document body identifier can be 001, and the sub-document body object is a collection object DynamicObjectCollection2 integrated by various sub-entry line objects, then the sub-document body key-value pair is: (001, DynamicObjectCollection2={DynamicObject2-1; DynamicObject2-2; ...}). The terminal can write the sub-document body key-value pair into the entry line of line number 1 of the document body, or it can be associated with the entry line of line number 1 of the document body, so that subsequent users can display the corresponding sub-document body data by clicking any field in the entry line of line number 1 of the document body.
[0093] In this embodiment, the complete document data can be carried by the DynamicObject object and the DynamicObjectCollection object, and the unified operation of the document data is implemented through the object method, thereby improving the efficiency of document processing.
[0094] In one embodiment, the document processing method further includes:
[0095] Receive a batch document query request; the batch document query request carries query information;
[0096] Obtain each query document data package from the database based on the query information;
[0097] Based on the unified data structure and each query document data package, the target document object corresponding to each query document data package is obtained;
[0098] The target document objects corresponding to each query document data package are combined to obtain the batch query results corresponding to the batch document query request.
[0099] The query document data package refers to the document data retrieved from the database based on the query information.
[0100] Specifically, the terminal receives a batch document query request sent by the user through the front-end device, and the terminal obtains each query document data packet from the database according to the query information carried in the batch query request. For example, if the query request is to query the purchase order of XXX date, the query information is XXX date and purchase order. The terminal creates query document objects corresponding to each query document data packet according to the unified data structure, and uses the query document data packet to assign the attribute information of the query document object to obtain the target document object corresponding to each query document data packet. Then the terminal combines the target document objects corresponding to each query document data packet, which can be to collect each target document object to obtain a target document collection object. The terminal generates a batch query result corresponding to the batch document query request according to the target document collection object, and then returns the batch query result to the front-end device for display.
[0101] In a specific embodiment, Figure 4 The schematic diagram of the collection object of multiple target documents shown in the figure indicates that the collection object of DynamicObjectCollection carries multiple documents of the same type. Specifically, for the same type of documents, the collection object DynamicObjectCollection of DynamicObject can carry the document data of multiple documents. Figure 4 In the code, the DynamicObject objects are used to carry the document data of purchase orders XXX-202406-001, XXX-202406-002, XXX-202406-003, ..., and then the DynamicObject objects corresponding to each purchase order are collected to obtain the collection object DynamicObjectCollection of multiple purchase orders.
[0102] The terminal also predefines methods of the collection object DynamicObjectCollection, and the terminal can operate the DynamicObject objects of each document in the collection object DynamicObjectCollection through the predefine methods of the collection object DynamicObjectCollection, such as adding the target document object of a single document to the add method of the collection object.
[0103] In this embodiment, the document data of multiple documents can be carried through the DynamicObjectCollection collection object, and the target document objects of multiple documents can be operated through the DynamicObjectCollection collection object, thereby improving the processing efficiency of multiple documents.
[0104] In one embodiment, the document processing method further includes:
[0105] Receive a business processing request; the business processing request carries the target document identifier and business requirement information;
[0106] Obtaining a target document data packet corresponding to the target document identifier from the database, and obtaining a target document object corresponding to the target document data packet based on the unified data structure and the target document data packet;
[0107] Determine business parameters and business processing logic based on business demand information, obtain document data corresponding to the business parameters from the target document object corresponding to the target document data packet, process the document data according to the business processing logic, and obtain the business processing result corresponding to the business processing request.
[0108] The target document ID refers to the document ID of the document data to be extracted. The business requirement information is used to indicate the business processing method, including the required business parameters and business processing logic. The business processing logic refers to the operation logic of the business parameters.
[0109] Specifically, the terminal receives the business processing request sent by the front-end device, and obtains the corresponding target document data packet from the database according to the target document identifier carried in the business processing request. The terminal creates a document object corresponding to the target document data packet according to the unified data structure, and assigns a value to the document object according to the target document data packet to obtain the assigned target document object.
[0110] Then the terminal determines the business parameters and business processing logic according to the business demand information carried in the business processing request, obtains the document data corresponding to the business parameters from the assigned target document object according to the business parameters, and then processes the document data according to the business processing logic to obtain the business processing result corresponding to the business processing request. For example, if it is a business request for calculating the total price of a certain material, the business request carries the target document ID A, the business parameters include "quantity" and "unit price", and the business logic is a product operation, then the assigned target document object DynamicObjectA is obtained according to the target document corresponding to the target document ID A, and the operation process is:
[0111] Total price amount = DynamicObjectA.get("Quantity field") * DynamicObjectA.get("Unit price field").
[0112] Among them, DynamicObjectA represents the target document object after assignment; DynamicObjectA.get() represents the data acquisition method of the pre-defined object, that is, obtaining data from the target document object after assignment.
[0113] In this embodiment, the document data is carried by the data structure of the DynamicObject object, and the operation mode of the document data in the object is unified through the object method, which simplifies the business processing flow and improves the business processing efficiency.
[0114] In one embodiment, the document processing method further includes:
[0115] Receive a document update request; the document update request carries an updated document identifier and updated document data;
[0116] Obtaining from the database a document data packet to be updated corresponding to the updated document identifier, and determining an update position corresponding to the updated document data in the document; the update position includes at least one of the document header and the document body;
[0117] Obtain the sub-document data package corresponding to the update position from the document data package to be updated;
[0118] Call the sub-document object corresponding to the sub-document data package and update the sub-document object based on the updated document data;
[0119] Update the database based on the updated sub-document object.
[0120] The updated document ID refers to the document ID of the document to be updated, and the updated document data refers to the updated data.
[0121] Specifically, the terminal receives a document update request sent by the front-end device, and the document update request carries an updated document identifier and updated document data. The terminal updates the document identifier to obtain a corresponding document data packet to be updated from a database, and the updated data includes an update mark. The terminal determines the update position corresponding to the updated document data in the document according to the update mark, and the update position includes at least one of the document header and the document body, such as updating the supplier in the document header or updating the material name in the document body.
[0122] Then the terminal obtains the sub-document data packet corresponding to the update position from the document data packet to be updated, calls the sub-document object corresponding to the pre-stored sub-document data packet, and then uses the pre-defined object update method to update the corresponding historical data in the sub-document object using the updated document data to obtain the updated sub-document object. Then, the document data in the updated sub-document object is updated to the database through the pre-defined object storage method.
[0123] In a specific embodiment, Figure 5 The diagram of the changes before and after the document data modification shown in the figure represents the operation of DynamicObject in memory. Specifically, the terminal modifies the content of any field in any row of the document header, document body and sub-document body of the purchase order in memory. The objects of the operation are the DynamicObject objects corresponding to the document header, document body entry line and sub-entry line of the sub-document body. The calling method of getting (get) or setting (set) the content of the field of the DynamicObject object is unified. For example:
[0124] Operate the document header to modify the purchase date in the document header:
[0125] Get the purchase date value of the header data packet:
[0126] DynamicObject dyObject =Get the document header data packet.
[0127] Object oldValue = dyObject.Get("Purchase Date");
[0128] Set the purchase date value in the document header data package:
[0129] dyObject.Set("Purchase Date","2024-06-02");
[0130] Operate the entry lines of the document body and modify the unit price and amount of the PC in entry line 2:
[0131] Get the unit price and amount values of the entry line data package in line 2 of the document body:
[0132] DynamicObject dyObject=Get the entry line data package of line 2 of the document body.
[0133] Object oldValue1 = dyObject.Get("unit price");
[0134] Object oldValue2= dyObject.Get("amount");
[0135] Set the unit price and amount values in the entry data of line 2 of the document body:
[0136] dyObject.Set("unit price",5000);
[0137] dyObject.Set("amount",50000);
[0138] Operate the sub-entry lines of the sub-document body and modify the delivery quantity in sub-entry line 1:
[0139] Get the value of the delivery quantity in the sub-entry line data package of line 1 of the sub-document body:
[0140] DynamicObject dyObject=Get the sub-entry line data package of the first line of the sub-document body.
[0141] Object oldValue = dyObject.Get("delivery quantity");
[0142] Modify the value of the delivery quantity in the sub-entry line data package of line 1 of the sub-document body:
[0143] dyObject.Set("Delivery quantity",6);
[0144] In this embodiment, the document header data, document body data and sub-document body data of the document are modified by operating the DynamicObject object, thereby achieving a unified operation method for the target document object, simplifying the document modification process, and improving document processing efficiency.
[0145] In one embodiment, the unified data structure includes attribute information, methods and collection methods; the attribute information is used to create a document object for the document, and the document object includes description information of the document; the method is used to determine the executable operations on the document object; the collection method is used to determine the executable operations on the collection of document objects.
[0146] Specifically, the document object refers to the DynamicObject dynamic object. The members of the DynamicObject dynamic object are composed of properties, methods, and collection methods. Properties, methods, and collection methods are member types of the DynamicObject dynamic object. Different member types correspond to different core members and descriptions, such as Figure 6 The data structure diagram of the DynamicObject object is shown in the figure. The core member refers to the specific information corresponding to the member type, which is used to describe the document object and determine the executable operations of the document object.
[0147] By pre-defining the methods of the DynamicObject object, you can operate the assigned DynamicObject object, such as adding, deleting, modifying and querying data. The core members and methods of the DynamicObject object are as follows: Figure 7 The following is a schematic diagram showing the core members of the DynamicObject object.
[0148] The core members of DynamicObject are described as follows:
[0149] DynamicObjectType: Basic definition:
[0150] name: English name: usually corresponds to a certain entity: document header, document body, sub-document body.
[0151] tableName: entity table name: name usually corresponds to the name of a table storing entities in the database, such as the name of the entity table storing document headers.
[0152] displayName: Display name.
[0153] route: Routing information: represents the database address information of the entity table.
[0154] primaryKey: Primary key information: information that uniquely identifies a data column in an entity table.
[0155] DynamicObjectState: Operation status for the database:
[0156] insert: prepare to insert data into a table in the database.
[0157] delete: prepare to delete the data in a table of the database.
[0158] update: prepare to modify the data in a table of the database.
[0159] query: data retrieved from the database for other objects to call and calculate.
[0160] load: The data queried from the database will be stored in the database again after being modified in the memory.
[0161] DynamicObjectStorage: Data storage for memory:
[0162] init: Initialize the data in the data packet.
[0163] getValue: Get the value of a field in the data packet.
[0164] setValue: Set the value of a field in the data packet.
[0165] clone: Copy the original data packet to a new data packet.
[0166] Map<K,V> data: data storage object: key: field; value: value.
[0167] Properties: Field definition:
[0168] get: Get the information of a certain field.
[0169] set: Set the information of a certain field.
[0170] add: add new field information.
[0171] remove: Delete a field and information.
[0172] containKey: Determines whether a field exists. For example, if the value corresponding to the field is not found in the data packet, it is determined that the field does not exist and the field is deleted from the dynamic object.
[0173] Map<K,V> field: field storage object: key: field; value: field definition information.
[0174] In this embodiment, the dynamic object DynamicObject can be compatible with carrying different data packets such as multiple documents, document headers, single entries, entry lines, sub-document bodies, etc., and the access method is unified through the object operation method. In addition, the DynamicObject object is used to temporarily store data during business operations, thereby achieving a unified operation method, thereby simplifying the document processing process and improving the document processing efficiency.
[0175] In a specific embodiment, Figure 8 The timing diagram of document business processing shown in the figure; the terminal includes the front end and the back end. The front end is a front-end device for interacting with users and providing front-end services for interacting with users; the back end can be the terminal memory, which is used to provide back-end services for document processing and business operations. The terminal interacts with the database through the back-end services. Among them, the document is instantiated in the memory by the dynamic object DynamicObject and then participates in the operation. Instantiation refers to the process of assigning values to the dynamic object DynamicObject. The document processing process is as follows:
[0176] The user initiates a request task for document business processing through the front end, such as a document query request, a document merge request, etc. The front end requests the back end according to the request task; the back end interacts with the database and queries the database for a document; the database returns the data packet of the document to the back end, and the back end temporarily stores the data packet in the memory of the terminal; the back end constructs and instantiates the dynamic object DynamicObject corresponding to the data packet in the memory, and then determines the business parameters of the document business processing requirements according to the request task, obtains the document data corresponding to the business parameters from the instantiated dynamic object DynamicObject to perform business operations and obtain the operation results; the back end updates the dynamic object DynamicObject in the memory according to the operation results, and stores the updated dynamic object DynamicObject in the database; and the back end generates a request result with the updated dynamic object DynamicObject, and returns the request result to the front end; the front end converts the format of the request result according to the display format of the front end device, obtains the document business processing result, and displays the document business processing result.
[0177] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0178] Based on the same inventive concept, the embodiment of the present application also provides a document processing device for implementing the document processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more document processing device embodiments provided below can refer to the limitations on the document processing method above, and will not be repeated here.
[0179] In an exemplary embodiment, Fig. 9 As shown, a document processing device 900 is provided, comprising: a request receiving module 902, a document header object creating module 904, a document body object creating module 906, a target document object determining module 908 and a document storage module 910, wherein:
[0180] The request receiving module 902 is used to receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data;
[0181] The document header object creation module 904 is used to create a document header object corresponding to the document header data based on a preset unified data structure, and assign attribute information of the document header object based on the document header data;
[0182] A document body object creation module 906 is used to create a document body object corresponding to the document body data based on a unified data structure, and assign attribute information of the document body object based on the document body data;
[0183] A target document object determination module 908 is used to obtain a target document object corresponding to the newly added document based on the assigned document header object and document body object;
[0184] The document storage module 910 is used to store the newly added document data package into the database based on the target document object.
[0185] In one embodiment, the newly added document data packet also includes sub-document body data corresponding to the target entry line in the document body data; the target document object determination module 908 is also used to create a sub-document body object corresponding to the sub-document body data based on a unified data structure, and assign attribute information to the sub-document body object based on the sub-document body data; based on the document identifier corresponding to the newly added document, generate a document body identifier corresponding to the document body data and a sub-document body identifier corresponding to the sub-document body data; associate the sub-document body identifier with the sub-document body object and write them into the document body object; associate the document header object with the document body identifier and the written document body object; and form a target document object corresponding to the newly added document based on the sub-document body object, the written document body object and the written document header object.
[0186] In one embodiment, the document body object creation module 906 is also used to create entry line objects corresponding to each entry line data in the document body data based on a unified data structure, assign attribute information of the entry line objects based on the entry line data; and combine the assigned entry line objects to obtain the assigned document body object.
[0187] In one embodiment, the document processing device 900 is also used to receive batch document query requests; the batch document query requests carry query information; based on the query information, each query document data packet is obtained from the database; based on the unified data structure and each query document data packet, the target document object corresponding to each query document data packet is obtained; the target document objects corresponding to each query document data packet are combined to obtain the batch query results corresponding to the batch document query request.
[0188] In one embodiment, the document processing device 900 is also used to receive a business processing request; the business processing request carries a target document identifier and business requirement information; a target document data packet corresponding to the target document identifier is obtained from a database, and a target document object corresponding to the target document data packet is obtained based on a unified data structure and the target document data packet; business parameters and business processing logic are determined based on the business requirement information, document data corresponding to the business parameters are obtained from the target document object corresponding to the target document data packet, and the document data is processed according to the business processing logic to obtain a business processing result corresponding to the business processing request.
[0189] In one embodiment, the document processing device 900 is also used to receive a document update request; the document update request carries an updated document identifier and updated document data; obtains a document data packet to be updated corresponding to the updated document identifier from a database, and determines an update position corresponding to the updated document data in the document; the update position includes at least one of a document header and a document body; obtains a sub-document data packet corresponding to the update position from the document data packet to be updated; calls a sub-document object corresponding to the sub-document data packet, and updates the sub-document object based on the updated document data; and updates the database based on the updated sub-document object.
[0190] In one embodiment, the unified data structure includes attribute information, methods and collection methods; the attribute information is used to create a document object for the document, and the document object includes description information of the document; the method is used to determine the executable operations on the document object; the collection method is used to determine the executable operations on the collection of document objects.
[0191] Each module in the above-mentioned document processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0192] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store document data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a document processing method is implemented.
[0193] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a document processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0194] Those skilled in the art will understand that Figure 10-11The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0195] In an exemplary embodiment, in one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0196] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0197] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0198] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0199] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0200] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0201] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A document processing method, characterized in that: The method comprises: Receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data; Based on a preset unified data structure, a document header object corresponding to the document header data is created, and attribute information of the document header object is assigned based on the document header data; Based on the unified data structure, creating a document body object corresponding to the document body data, and assigning attribute information of the document body object based on the document body data; Based on the assigned document header object and the document body object, obtaining a target document object corresponding to the newly added document; Based on the target document object, the newly added document data package is stored in a database.
2. The method according to claim 1, characterized in that The newly added document data packet also includes sub-document body data corresponding to the target entry line in the document body data; the target document object corresponding to the newly added document is obtained based on the assigned document header object and the document body object, including: Based on the unified data structure, a sub-document body object corresponding to the sub-document body data is created, and attribute information of the sub-document body object is assigned based on the sub-document body data; Based on the document identifier corresponding to the newly added document, generating a document body identifier corresponding to the document body data and a sub-document body identifier corresponding to the sub-document body data; Associating the sub-document body identifier with the sub-document body object and writing it into the document body object; Writing the document header object based on the document body identifier and the document body object after writing; Based on the sub-document body object, the document body object after writing, and the document header object after writing, a target document object corresponding to the newly added document is composed.
3. The method according to claim 1, characterized in that: The step of creating a document body object corresponding to the document body data based on the unified data structure, and assigning a value to attribute information of the document body object based on the document body data includes: Based on the unified data structure, create entry line objects corresponding to each entry line data in the document body data, and assign values to attribute information of the entry line objects based on the entry line data; The entry line objects after the assignment are combined to obtain the document body object after the assignment.
4. The method according to claim 1, characterized in that: The method further comprises: receiving a batch document query request, wherein the batch document query request carries query information; Acquire each query document data packet from the database based on the query information; Based on the unified data structure and the query document data packets, obtaining the target document objects corresponding to the query document data packets; The target document objects corresponding to the query document data packets are combined to obtain a batch query result corresponding to the batch document query request.
5. The method according to claim 1, characterized in that The method further comprises: Receiving a business processing request; the business processing request carries a target document identifier and business requirement information; Acquire a target document data packet corresponding to the target document identifier from the database, and obtain a target document object corresponding to the target document data packet based on the unified data structure and the target document data packet; Determine business parameters and business processing logic based on the business demand information, obtain document data corresponding to the business parameters from the target document object corresponding to the target document data packet, process the document data according to the business processing logic, and obtain a business processing result corresponding to the business processing request.
6. The method according to claim 1, characterized in that The method further comprises: receiving a document update request; the document update request carries an updated document identifier and updated document data; Acquire the document data packet to be updated corresponding to the updated document identifier from the database, and determine the update position corresponding to the updated document data in the document; the update position includes at least one of the document header and the document body; Acquire the sub-document data packet corresponding to the update position from the document data packet to be updated; calling the sub-document object corresponding to the sub-document data package, and updating the sub-document object based on the update document data; The database is updated based on the updated sub-document object.
7. The method according to any one of claims 1 to 6, characterized in that: The unified data structure includes attribute information, methods and collection methods; the attribute information is used to create a document object for a document, and the document object includes description information of the document; the method is used to determine executable operations on the document object; the collection method is used to determine executable operations on the collection of the document object.
8. A document processing device, characterized in that: The device comprises: A request receiving module, configured to receive a document adding request; the document adding request carries a new document data packet corresponding to the new document, and the new document data packet includes document header data and document body data; A document header object creation module, used to create a document header object corresponding to the document header data based on a preset unified data structure, and assign attribute information of the document header object based on the document header data; A document body object creation module, used to create a document body object corresponding to the document body data based on the unified data structure, and assign attribute information of the document body object based on the document body data; A target document object determination module, used for obtaining a target document object corresponding to the newly added document based on the assigned document header object and the document body object; The document storage module is used to store the newly added document data package in a database based on the target document object.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method for generating evidence for keeping account by random service system document
CN101493834A
Order processing method, device and system
CN111583559A
Special-shaped structure JSON (JavaScript Object Notation) conversion mapping method and device, electronic equipment and computer storage medium
CN117873479A
Bill layout data generation method and device, computer equipment and storage medium
CN118261130A
