Document generation method, device and electronic equipment

By using RDMA technology and distributed platform to perform file conversion tasks in parallel in office file format conversion, the problems of low efficiency and poor accuracy of file format conversion in traditional technology are solved, and efficient and accurate large-scale file format conversion is achieved.

CN118673891BActive Publication Date: 2025-02-25SHENZHEN HAIGUI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410742695.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2025-02-25
Estimated Expiration
2044-06-11

AI Technical Summary

Technical Problem

Traditional office file format conversion methods face performance bottlenecks when dealing with large-scale file format conversion, and cannot meet the needs of high concurrency and rapid response, especially in enterprise-level applications, which are difficult to meet stricter file conversion speed and accuracy requirements.

Method used

The preset development tool uses RDMA technology to obtain template configuration data of the original file from the cloud server, generate document templates, and obtain key content data. Based on these data, file conversion tasks are generated. The distributed platform performs these tasks in parallel to realize file conversion.

Benefits of technology

It reduces the copying of data between the kernel and user space, reduces network communication delay, improves the accuracy and efficiency of file conversion, and can meet the high concurrency and fast response requirements during large-scale file format conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673891B_ABST
    Figure CN118673891B_ABST
Patent Text Reader

Abstract

The present invention provides a document generation method, device and electronic device, wherein a preset development tool obtains template configuration data of each original file from a cloud server based on RDMA technology; generates a document template corresponding to each original file based on the template configuration data; obtains the first key content data corresponding to each original file, and generates a file conversion task corresponding to each original file based on the original file type and converted file type corresponding to each original file and the obtained first key content data and document template; and a distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document with a converted file type. The present invention can alleviate the problems of low efficiency and poor precision of file format conversion in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a document generation method, device and electronic equipment. Background Art

[0002] In office scenarios involving legal documents, since legal documents usually need to be uploaded to a specific electronic system in a specific format, format conversion of legal documents is an important requirement in daily office work. The traditional way of converting office file formats is usually to directly use the interface on a single server for operation. This operation method faces significant performance bottlenecks when processing large-scale file format conversions and cannot meet the needs of high concurrency and fast response, especially in enterprise-level applications. It is difficult to meet more stringent requirements in terms of file conversion speed and file conversion accuracy. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a document generation method, device and electronic device to alleviate the problem of low efficiency and poor accuracy of file format conversion in related technologies.

[0004] In a first aspect, an embodiment of the present invention provides a document generation method, the method comprising: a preset development tool obtains template configuration data of each original file from a cloud server based on RDMA technology; wherein the template configuration data is generated after the preset development tool configures the template information of the corresponding original file, and the template information includes the template style, template variables and template parameters of the corresponding original file; a document template corresponding to each original file is generated based on the template configuration data; wherein the document template is configured with the template information of the corresponding original file; the first key content data corresponding to each original file is obtained, and a file conversion task corresponding to each original file is generated based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template; the distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document with the converted file type.

[0005] In a second aspect, an embodiment of the present invention further provides a document generation device, the device comprising: a data acquisition module, used for a preset development tool to obtain template configuration data of each original file from a cloud server based on RDMA technology; wherein the template configuration data is generated after the preset development tool configures the template information of the corresponding original file, and the template information includes the template style, template variables and template parameters of the corresponding original file; a template generation module, used to generate a document template corresponding to each original file based on the template configuration data; wherein the document template is configured with the template information of the corresponding original file; a task generation module, used to obtain the first key content data corresponding to each original file, and generate a file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template; a task execution module, used for a distributed platform to execute the obtained file conversion tasks in parallel to convert each original file into a corresponding document with a converted file type.

[0006] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the document generation method described in the first aspect above.

[0007] The embodiment of the present invention provides a document generation method, device and electronic device, wherein a preset development tool obtains template configuration data of each original file from a cloud server based on RDMA technology; generates a document template corresponding to each original file based on the template configuration data; obtains the first key content data corresponding to each original file, and generates a file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template; and a distributed platform executes the obtained file conversion task in parallel to convert each original file into a corresponding document with the converted file type. With the above technology, since the template configuration data of the original file is obtained based on RDMA technology, the copying of data between the kernel and the user space can be reduced, data transmission can be realized directly at the application layer, and network communication delay can be significantly reduced; and the template information of the preset development tool is introduced to configure the original file and obtain the corresponding template configuration data, which can ensure the consistency of the relevant content before and after the file conversion, thereby improving the accuracy of the file conversion; in addition, by executing the file conversion task in parallel on the distributed platform, load balancing can be achieved to break through the performance bottleneck of single-point file conversion, and the requirements of high concurrency and rapid response during large-scale file format conversion can be met, thereby improving the efficiency of file format conversion.

[0008] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0009] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0011] Figure 1 A schematic diagram of a flow chart of a document generation method in an embodiment of the present invention;

[0012] Figure 2 This is an interactive example diagram of the document generation process in an embodiment of the present invention;

[0013] Figure 3 It is a structural schematic diagram of a document generation device in an embodiment of the present invention;

[0014] Figure 4 The figure is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0016] Currently, in office scenarios involving legal documents, the traditional office file format conversion method is usually to directly use the interface on a single server for operation. This operation method faces significant performance bottlenecks when processing large-scale file format conversions and cannot meet the needs of high concurrency and rapid response, especially in enterprise-level applications. It is difficult to meet more stringent requirements in terms of file conversion speed and file conversion accuracy.

[0017] Based on this, the document generation method, device and electronic device provided by the present invention can alleviate the problems of low efficiency and poor accuracy of file format conversion in related technologies.

[0018] To facilitate understanding of this embodiment, a document generation method disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method may include the following steps:

[0019] Step S102: The preset development tool obtains the template configuration data of each original file from the cloud server based on the RDMA technology.

[0020] The template configuration data may be generated by configuring the template information of the corresponding original file with a preset development tool.

[0021] RDMA (Remote Direct Memory Access) stands for Remote Direct Memory Access. The preset development tool can be a development tool on the software used to open the original file. The RDMA technology can be used to transmit data between the preset development tool and the cloud server, so that the preset development tool can directly read the template configuration data stored on the cloud server remotely without causing any impact on the operating system of the cloud server, thereby reducing the data copy between the kernel and the user space, thereby significantly reducing the network communication delay between the preset development tool and the cloud server.

[0022] The template information may include the template style, template variables, template parameters, etc. of the corresponding original file, which are not limited. For example, the template style may include the font, font size, font shape, font color, paragraph format, header and footer styles set according to the document requirements, the template variables may include the name, address, telephone number and other variables set according to the content that needs to be filled in the document, and the template parameters may include the total price, discount, tax and other parameters set according to the content that needs to be calculated in the document.

[0023] Step S104: Generate a document template corresponding to each original file based on the template configuration data.

[0024] Among them, the document template can be configured with the template information of the corresponding original document.

[0025] Step S106, obtaining the first key content data corresponding to each original file, and generating the file conversion task corresponding to each original file based on the original file type and converted file type corresponding to each original file and the obtained first key content data and the document template.

[0026] Since the contents of the original documents in scenarios involving legal documents are usually divided into relatively important key contents (such as required contents such as date and name) and other relatively unimportant contents, the relevant key data can be customized as the first key content data based on the key contents contained in the original documents. The first key content data can be obtained through manual input, direct copying or other methods. The method of obtaining the first key content data is not limited here.

[0027] For an original file to be format-converted, when the first key content data, original file type and converted file type corresponding to the original file are known and the document template corresponding to the original file is obtained, these existing first key content data, original file type, converted file type and document template can be used to generate a file conversion task for converting the original file from the corresponding original file type to the corresponding converted file type; when it is necessary to convert multiple original files from the original file type to the converted file type, corresponding file conversion tasks can be generated for each original file respectively, thereby obtaining multiple file conversion tasks, that is, the file conversion tasks are in a one-to-one correspondence with the original files.

[0028] Step S108, the distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document of the converted file type.

[0029] In actual application, in order to achieve load balancing and break through the performance bottleneck of single-point file conversion, a distributed platform with a distributed framework structure can be introduced to execute multiple file conversion tasks in parallel through the distributed platform, thereby realizing batch format conversion of original files, thereby improving the overall efficiency of large-scale file format conversion.

[0030] The embodiment of the present invention provides a document generation method, wherein a preset development tool obtains template configuration data of each original file from a cloud server based on RDMA technology; generates a document template corresponding to each original file based on the template configuration data; obtains the first key content data corresponding to each original file, and generates a file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template; and a distributed platform executes the obtained file conversion task in parallel to convert each original file into a corresponding document with the converted file type. With the above technology, since the template configuration data of the original file is obtained based on RDMA technology, the copying of data between the kernel and the user space can be reduced, data transmission can be realized directly at the application layer, and network communication delay can be significantly reduced; and the template information of the preset development tool configuration original file is introduced to obtain the corresponding template configuration data, which can ensure the consistency of the relevant content before and after the file conversion, thereby improving the accuracy of the file conversion; in addition, by executing the file conversion task in parallel on the distributed platform, load balancing can be achieved to break through the performance bottleneck of single-point file conversion, and the requirements of high concurrency and rapid response during large-scale file format conversion can be met, thereby improving the efficiency of file format conversion.

[0031] As a possible implementation, the original file type may be in word format, the converted file type may be in pdf format, and the preset development tool may be a VSTO development tool; based on this, the document generation method may further include: calling the interface provided by the VSTO development tool to configure corresponding template information for each original file to generate corresponding template configuration data, and storing the obtained template configuration data of each original file to the cloud server based on RDMA technology.

[0032] For an original file in a word format, the interface provided by the VSTO development tool on the word software can be called in advance to configure the template style, template variables, template parameters, etc. of the original file, and the template configuration data of the original file can be generated based on the configured data. The VSTO development tool then uses the RDMA technology to save the template configuration data of the original file to the cloud server, so that the VSTO development tool can subsequently read the required template configuration data from the cloud server using the RDMA technology.

[0033] As a possible implementation, the above-mentioned distributed platform may include multiple distributed nodes that can execute file conversion tasks; based on this, before performing the above-mentioned step S108 (i.e., the distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document with the converted file type), a file conversion request for the file conversion task corresponding to each original file may also be sent to the distributed platform. The above-mentioned step S108 may include: the distributed platform assigns the file conversion task corresponding to each received file conversion request to the corresponding target distributed node based on a preset first task scheduling algorithm, and each target distributed node assigned with the file conversion task executes its assigned one or more file conversion tasks in parallel based on a preset second task scheduling algorithm to convert each original file into a corresponding document.

[0034] Each target distributed node is assigned one or more file conversion tasks, and different target distributed nodes are assigned different file conversion tasks.

[0035] Exemplarily, each file conversion task may have a corresponding task priority; based on this, the step of allocating the file conversion task corresponding to each received file conversion request to the corresponding target distributed node based on the preset first task scheduling algorithm performed by the distributed platform may include:

[0036] (1) Monitor the number of file conversion tasks currently assigned to each target distributed node. If the number of tasks currently corresponding to the target distributed node exceeds a preset number threshold, add a first identifier to the target distributed node indicating that the file conversion task cannot be further assigned, and stop the file conversion task assignment to the target distributed node.

[0037] For a certain target distributed node, each time a file conversion task is assigned to the target distributed node, the task identifier of the file conversion task (such as task ID, task name, etc.) will be bound to the target distributed node. Since the file conversion task execution capability of the target distributed node is limited, a quantity threshold can be set in advance. When assigning file conversion tasks to the target distributed node, the number of tasks currently assigned to the target distributed node can be compared with the quantity threshold. If the current number of tasks does not exceed the quantity threshold, it means that the target distributed node is able to execute more file conversion tasks. In order to make full use of the computing resources of the target distributed node, more file conversion tasks can continue to be assigned to the target distributed node for execution. If the current number of tasks exceeds the quantity threshold, it means that the target distributed node is difficult or unable to execute more file conversion tasks. In order to ensure that the computing resources required for the target distributed node to execute its currently assigned file conversion tasks are sufficient, the file conversion tasks can be stopped from being assigned to the target distributed node. In addition, in order to distinguish whether the corresponding target distributed node can continue to allocate file conversion tasks, a first identifier can be added to the target distributed node when the current number of tasks of the corresponding target distributed node exceeds the corresponding number threshold, thereby facilitating identification through the first identifier that the target distributed node cannot continue to allocate file conversion tasks.

[0038] (2) Dynamically adjust the distribution of file conversion tasks among target distributed nodes based on task priorities.

[0039] After all existing file conversion tasks are assigned to multiple target distributed nodes, in order to further achieve load balancing, the file conversion tasks assigned to each target distributed node can be dynamically adjusted in combination with the task priority, thereby avoiding overloading of a single target distributed node when executing its assigned file conversion task. Therefore, this load balancing strategy can further improve the stability of the distributed platform in executing existing file conversion tasks.

[0040] Exemplarily, the steps performed by the distributed platform in which each target distributed node assigned with a file conversion task executes its assigned one or more file conversion tasks in parallel based on a preset second task scheduling algorithm may include: for each target distributed node assigned with a file conversion task, dynamically adjusting the computing resource occupancy of the target distributed node when executing each file conversion task currently assigned to it based on the task priority.

[0041] Taking a target distributed node as an example, after multiple file conversion tasks are assigned to the target distributed node, the computing resource occupancy of the target distributed node during each file conversion task can be monitored in real time when the target distributed node executes its assigned file conversion tasks in parallel, and the computing resource occupancy size of each file conversion task can be adjusted according to the priority, so that the computing resources currently occupied by the target distributed node can be used as much as possible to execute file conversion tasks with higher priority, thereby facilitating the faster execution of file conversion tasks with higher priority.

[0042] As a possible implementation, the step S106 of generating the file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template may include:

[0043] Step 1: The word template engine uses the obtained first key content data and the document template to add corresponding first identification information to each original file.

[0044] The first identification information is used to identify the first filling position of the first key content data corresponding to the corresponding original file in the corresponding document template.

[0045] For an original file in a word format, you can first use the VSTO development tool to use RDMA technology to read the template configuration data of the original file (such as template style, template variables, template parameters, etc.) from the cloud server, and then generate a document template corresponding to the original file based on this part of the template configuration data. After that, the word template engine uses the generated document template and the key content data obtained by manual input for rendering, and adds corresponding identification information to the original file during the rendering process to indicate the filling position of this part of the key content data in the document template.

[0046] Step 2: for each original file, a corresponding file conversion task of converting the word format into the pdf format is generated for the original file based on the first identification information corresponding to the original file.

[0047] Continuing with the previous example, after the word template engine uses the corresponding document template and the corresponding key content data to add corresponding identification information to an original file in a word format, this added identification information can be used as part of the task information to generate a file conversion task corresponding to the original file, which is to convert the word format into a pdf format. The task information of the file conversion task can also include the task identifier, the timestamp corresponding to the task generation time, the template style, template variables, template parameters, the document template identifier, etc.

[0048] As a possible implementation, each file conversion task may carry its corresponding template information, first key content data and first identification information; based on this, the above-mentioned step S108 of converting each original file into a corresponding document with a converted file type may include: for each original file, generating the second key content data corresponding to the original file based on the first identification information, template information and first key content data corresponding to the original file, and then filling the second key content data corresponding to the original file into the document template corresponding to the original file to generate the document corresponding to the original file.

[0049] Exemplarily, the template information may further include first configuration data of template variables corresponding to the corresponding original file and second configuration data of template parameters corresponding to the corresponding original file; the step of generating second key content data corresponding to the original file based on the first identification information, template information and first key content data corresponding to the original file by the distributed platform for each original file may include:

[0050] Step a1: Generate corresponding second identification information for the original file based on the first identification information and the first configuration data corresponding to the original file.

[0051] The second identification information is used to identify the second filling position of the template variable corresponding to the corresponding original file in the corresponding document template. The second identification information may include a symbol identification, a color identification, a graphic identification, a font identification, etc., which is not limited.

[0052] Continuing with the previous example, when the distributed platform executes a file conversion task corresponding to an original file, since the file conversion task carries corresponding template information and first identification information, the distributed platform can determine the second filling position of this part of the template variables in the corresponding document template based on the first configuration data of the template variables in the template information carried by the file conversion task and the first identification information carried by the file conversion task, and then generate the second identification information corresponding to the original file to identify the determined second filling position.

[0053] Step a2: generating corresponding template parameter value information for the original file based on the second configuration data and the first key content data corresponding to the original file.

[0054] The template parameter value information includes the value of the template parameter corresponding to the corresponding original file.

[0055] Continuing with the previous example, when the distributed platform executes a file conversion task corresponding to an original file, it can calculate the value of this part of the template parameters based on the second configuration data of the template parameters in the template information carried by the file conversion task and the first key content data carried by the file conversion task, and then generate the template parameter value information corresponding to the original file.

[0056] Step a3: generating second key content data corresponding to the original file based on the second identification information corresponding to the original file, the template parameter value information and the first key content data.

[0057] Continuing with the previous example, when the distributed platform executes a file conversion task corresponding to an original file, after obtaining the second identification information and template parameter value information corresponding to the original file, it can determine the third filling position of the second key data to be generated in the document template corresponding to the original file based on the obtained second identification information, and generate the second key content data corresponding to the original file based on the determined third filling position and the calculated template parameter value and the first key content data carried by the file conversion task, so that the generated second key content data can be subsequently filled into the third filling position in the document template corresponding to the original file to generate the document corresponding to the original file.

[0058] As a possible implementation method, the above-mentioned document generation method may also include: establishing a communication connection between the distributed platform and the cloud server through the QUIC protocol; and the distributed platform stores the obtained document in the cloud server.

[0059] In actual application, in order to improve the speed of establishing communication connections and the efficiency and reliability of data transmission, the QUIC protocol can be used to establish communication connections between each target distributed node in the distributed platform and the cloud server, so that each target distributed node can convert the corresponding original file into the corresponding document and send the obtained document to the cloud server for storage.

[0060] In actual application, connection multiplexing and heartbeat mechanisms can also be implemented on the communication connections established through the QUIC protocol to maintain a long connection state, thereby reducing the overhead of connection establishment and disconnection.

[0061] For ease of understanding, the operation of the above document generation method is described below using a specific application as an example.

[0062] Take the scenario of converting a word file into a pdf document as an example, see Figure 2As shown, the document generation process is mainly implemented by the cloud 20 (i.e., cloud server), multiple clients (i.e., multiple distributed nodes, including client 1, client 2, ..., client n), and VSTO toolkit 211 and word template engine 212 configured on word software 21. The multiple clients form a distributed task scheduling system 22 (i.e., distributed platform) with a distributed processing architecture. The document generation process mainly includes the following steps:

[0063] The first step is to create a document template.

[0064] A communication connection between the cloud 20 and the word software 21 can be established in advance; the user can use the VSTO toolkit 211 to create a document template as needed, including setting a template style, setting template variables, and setting template parameters.

[0065] The operation method to set the template style is as follows: In the word software, set the style according to the needs of the document, including font, font size, font shape, font color, paragraph format, headers and footers, etc.

[0066] The operation method for setting template variables is: in the word software, set corresponding variables according to the content that needs to be filled in the document, such as name, address, phone number, etc.

[0067] The operation method for setting template parameters is: in the word software, set the corresponding parameters for the content that needs to be calculated in the document, such as total price, discount, tax, etc.

[0068] The second step is to configure the template information.

[0069] The user can import the prepared document template into the VSTO toolkit 211, and use the VSTO toolkit 211 to configure the template information (ie, template variables and template parameters) of each imported document template, including configuring template variables and configuring template parameters.

[0070] The operation method of importing a template may be: importing the prepared document template into the VSTO toolkit 211, so that the VSTO toolkit 211 can recognize and use the imported document template.

[0071] The operation method of configuring the template variables may be: configuring the template variables (such as name, address, telephone number, etc.) set in the document template in the VSTO toolkit 211 to generate configuration information of the template variables (including the first configuration data).

[0072] The operation method of configuring the template parameters may be: configuring the template parameters (such as total price, discount, tax, etc.) set in the document template in the VSTO toolkit 211 to generate configuration information of the template parameters (including the second configuration data).

[0073] After the user configures the template information in the VSTO toolkit 211 , the user can use the VSTO toolkit 211 to save the obtained configuration information to the cloud 20 using the RDMA technology.

[0074] The third step is to generate the document content.

[0075] The user can use the VSTO toolkit 211 to read the required configuration information from the cloud 20 using RDMA technology, and use the word template engine 212 to generate document content according to the obtained configuration information. The document content generation process mainly includes filling in template variables and calculating template parameter values.

[0076] The operation method of filling the template variables may be: according to the configuration information of the template variables, the data to be filled in the document may be replaced with the corresponding actual content through the word template engine 212. For example, the template variables to be filled may be identified by using specific tags or placeholders in the document template, and then the original data corresponding to these template variables in the word format file to be converted may be replaced with the corresponding actual data.

[0077] The operation mode of calculating the template parameter value can be: according to the configuration information of the template parameter, calculate the value of the template parameter that needs to be calculated in the document. For example, if the document needs to contain calculation results such as the sum or average of certain values, the corresponding calculation rules can be configured through the template parameters, and these calculation results can be calculated when generating the document content.

[0078] The user can use the word template engine 212 to combine the filled template variables and the calculated template parameter values ​​to generate the final document content.

[0079] The fourth step is to generate file conversion tasks.

[0080] The user can generate a corresponding file conversion task from word format to pdf format for each word format file to be converted in the word software based on the obtained document template, configuration information and document content.

[0081] The fifth step is to perform file conversion tasks to generate documents.

[0082] The user can use word software to send a task execution request for each file conversion task to the distributed task scheduling system 22, and the distributed task scheduling system 22 schedules multiple clients to execute the file conversion tasks corresponding to the received task execution requests.

[0083] The distributed task scheduling system 22 introduces a two-level scheduling mechanism when scheduling multiple clients to execute file conversion tasks. The first-level scheduling mechanism globally schedules the distribution of file conversion tasks among different clients, and the second-level scheduling mechanism locally schedules the execution of file conversion tasks within a single client. The introduction of the two-level scheduling mechanism can balance the global computing resource utilization and local task execution efficiency of the distributed task scheduling system 22.

[0084] Both the first-level scheduling mechanism and the second-level scheduling mechanism can adopt a scheduling algorithm based on deep reinforcement learning. The scheduling algorithm learns the optimal scheduling strategy by interacting with the environment to automatically adapt to load changes and efficiently assign tasks to the most suitable nodes for execution.

[0085] The distributed task scheduling system 22 can also implement further load balancing strategies when scheduling multiple clients to execute file conversion tasks, such as dynamically adjusting the allocation and execution status of file conversion tasks based on task priority, resource consumption and historical execution time to avoid overloading a single client.

[0086] The execution result of each file conversion task is the corresponding document in PDF format. The execution process of each file conversion task may include: calling the COM interface provided by the VSTO toolkit 211 to insert the corresponding document content into the corresponding position of the corresponding document template to generate a complete document.

[0087] In actual application, the Prometheus+Grafana monitoring system can also be integrated into the distributed task scheduling system 22 to collect the performance indicators of the distributed task scheduling system 22 (such as CPU usage, memory usage, network throughput, etc.) in real time through the monitoring system, and then dynamically adjust the computing resource allocation of the distributed task scheduling system 22. Machine learning and other technologies can also be used to predict the performance of the distributed task scheduling system 22 to deal with potential performance bottlenecks and scalability issues in advance.

[0088] Step 6: Save the document.

[0089] The communication connection between the distributed task scheduling system 22 and the cloud 20 can be established through the QUIC protocol; each client that performs the file conversion task calls the COM interface provided by the VSTO toolkit 211 to convert the word format file into a pdf format document, and then uploads the obtained document back to the cloud 20 for storage using the RDMA technology. When uploading the document back to the cloud 20 for storage, efficient binary stream transmission and intelligent caching strategies can be used to reduce bandwidth usage and improve the security and speed of data transmission.

[0090] In summary, the working principle of the above document generation method is mainly as follows: use the word template engine to set the content to be filled in the document as template variables and template parameters, and then fill in the corresponding content directly according to the template variables and template parameters when generating the document; when configuring the template information, import the document template and configure the corresponding template variables and template parameters; when generating the document content, automatically fill in the template variables and calculate the template parameter values ​​according to the configured template information, and finally generate the complete document content.

[0091] By adopting the above-mentioned document generation method, complex balance is achieved through a distributed task scheduling system, thereby solving the problem of single-point performance bottlenecks; by integrating the VSTO toolkit with local word resources, users can directly operate on the word software and use the native interface of the word software to convert the word format to the pdf format, thereby bypassing network delays and helping to improve the accuracy and speed of converting the word format to the pdf format, while keeping the word format to pdf format function tightly integrated with the existing resources of the word software; by connecting to the cloud, full-chain automation from request to delivery is achieved, thereby improving the user experience; due to the high scalability of the VSTO toolkit, it is easy to add new functions or adjust the file size applicable to the word format to pdf format function, thereby being able to adapt to different business scenarios.

[0092] Based on the above document generation method, the embodiment of the present invention also provides a document generation device, see Figure 3 As shown, the device may include the following modules:

[0093] The data acquisition module 302 is used for the preset development tool to obtain the template configuration data of each original file from the cloud server based on the RDMA technology; wherein the template configuration data is generated after the preset development tool configures the template information of the corresponding original file, and the template information includes the template style, template variables and template parameters of the corresponding original file.

[0094] The template generation module 304 is used to generate a document template corresponding to each original file based on the template configuration data; wherein the document template is configured with template information of the corresponding original file.

[0095] The task generation module 306 is used to obtain the first key content data corresponding to each original file, and generate the file conversion task corresponding to each original file based on the original file type and converted file type corresponding to each original file and the obtained first key content data and document template.

[0096] The task execution module 308 is used for the distributed platform to execute the obtained file conversion tasks in parallel to convert each original file into a corresponding document of the converted file type.

[0097] A document generation device provided by an embodiment of the present invention obtains the template configuration data of the original file based on the RDMA technology, thereby reducing the copying of data between the kernel and the user space, directly realizing data transmission at the application layer, and significantly reducing network communication delays; and introduces a preset development tool to configure the template information of the original file and obtain the corresponding template configuration data, which can ensure the consistency of related content before and after file conversion, thereby improving the accuracy of file conversion; in addition, by executing file conversion tasks in parallel on a distributed platform, load balancing can be achieved to break through the performance bottleneck of single-point file conversion, and can meet the requirements of high concurrency and rapid response during large-scale file format conversion, thereby improving the efficiency of file format conversion.

[0098] The above original file type can be in word format, the above converted file type can be in pdf format, and the above preset development tool can be VSTO development tool; based on this, see Figure 3 As shown, the device may also include:

[0099] The configuration storage module 310 is used to: call the interface provided by the VSTO development tool to configure corresponding template information for each original file to generate corresponding template configuration data, and store the obtained template configuration data of each original file to the cloud server based on RDMA technology.

[0100] The above-mentioned distributed platform may include multiple distributed nodes for executing file conversion tasks; based on this, see Figure 3 As shown, the device may also include:

[0101] The file conversion request module 312 is used to send a file conversion request for a file conversion task corresponding to each original file to the distributed platform.

[0102] The above-mentioned task execution module 308 can also be used for: the distributed platform assigns the file conversion task corresponding to each received file conversion request to the corresponding target distributed node based on the preset first task scheduling algorithm, and each target distributed node assigned with the file conversion task executes its assigned one or more file conversion tasks in parallel based on the preset second task scheduling algorithm to convert each original file into a corresponding document; wherein each target distributed node is assigned with one or more file conversion tasks, and different target distributed nodes are assigned with different file conversion tasks.

[0103] Each file conversion task can have a corresponding task priority; based on this, the above-mentioned task execution module 308 can also be used for the distributed platform to perform the following operations: monitor the number of tasks currently assigned to each target distributed node for file conversion tasks, and if the number of tasks currently corresponding to the target distributed node exceeds a preset number threshold, add a first identifier to the target distributed node indicating that the file conversion task cannot be further assigned, and stop the file conversion task assignment to the target distributed node; dynamically adjust the assignment of file conversion tasks between each target distributed node based on the task priority.

[0104] The task execution module 308 can also be used for the distributed platform to perform the following operations: for each target distributed node assigned a file conversion task, dynamically adjust the computing resource occupancy of the target distributed node when executing each currently assigned file conversion task based on the task priority.

[0105] The above-mentioned task generation module 306 can also be used for: the word template engine uses the obtained first key content data and the document template to add corresponding first identification information to each original file; wherein the first identification information is used to identify the first filling position of the first key content data corresponding to the corresponding original file in the corresponding document template; for each original file, based on the first identification information corresponding to the original file, a corresponding file conversion task from word format to pdf format is generated for the original file.

[0106] Each file conversion task can carry its corresponding template information and first identification information; based on this, the above-mentioned task execution module 308 can also be used for the distributed platform to perform the following operations: for each original file, the second key content data corresponding to the original file is generated based on the first identification information, template information and first key content data corresponding to the original file, and then the second key content data corresponding to the original file is filled into the document template corresponding to the original file to generate the document corresponding to the original file.

[0107] The above-mentioned template information may also include first configuration data of template variables corresponding to the corresponding original file and second configuration data of template parameters corresponding to the corresponding original file; based on this, the above-mentioned task execution module 308 may also be used for the distributed platform to perform the following operations for each original file: based on the first identification information and the first configuration data corresponding to the original file, generate corresponding second identification information for the original file; wherein, the second identification information is used to identify the second filling position of the template variable corresponding to the corresponding original file in the corresponding document template; based on the second configuration data and the first key content data corresponding to the original file, generate corresponding template parameter value information for the original file; wherein, the template parameter value information includes the value of the template parameter corresponding to the corresponding original file; based on the second identification information, template parameter value information and the first key content data corresponding to the original file, generate the second key content data corresponding to the original file.

[0108] See also Figure 3 As shown, the device may also include:

[0109] The connection establishment module 314 is used to establish a communication connection between the distributed platform and the cloud server through the QUIC protocol.

[0110] The document storage module 316 is used for the distributed platform to store the obtained documents in the cloud server.

[0111] The document generation device provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned document generation method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0112] The embodiment of the present invention further provides an electronic device, such as Figure 4 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 41 and a memory 40, the memory 40 stores computer executable instructions that can be executed by the processor 41, and the processor 41 executes the computer executable instructions to implement the above-mentioned document generation method.

[0113] exist Figure 4 In the illustrated embodiment, the electronic device further includes a bus 42 and a communication interface 43 , wherein the processor 41 , the communication interface 43 and the memory 40 are connected via the bus 42 .

[0114] Among them, the memory 40 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 43 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 42 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 42 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0115] The processor 41 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 41 or the instruction in the form of software. The above processor 41 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 41 reads the information in the memory and completes the steps of the document generation method of the aforementioned embodiment in combination with its hardware.

[0116] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present invention.

[0117] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0118] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0119] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A document generation method, characterized in that: The method comprises: The preset development tool obtains the template configuration data of each original file from the cloud server based on the RDMA technology; wherein the template configuration data is generated after the preset development tool configures the template information of the corresponding original file, and the template information includes the template style, template variables and template parameters of the corresponding original file; Generating a document template corresponding to each original file based on the template configuration data; wherein the document template is configured with template information of the corresponding original file; Acquire the first key content data corresponding to each original file, and generate the file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template; The distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document having a converted file type; The distributed platform includes a plurality of distributed nodes capable of executing file conversion tasks; before the distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document having a converted file type, the method further includes: sending a file conversion request for the file conversion task corresponding to each original file to the distributed platform; The distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document of the converted file type, including: the distributed platform assigns the file conversion task corresponding to each received file conversion request to the corresponding target distributed node based on a preset first task scheduling algorithm, and each target distributed node assigned with the file conversion task executes its assigned one or more file conversion tasks in parallel based on a preset second task scheduling algorithm to convert each original file into a corresponding document; wherein each target distributed node is assigned with one or more file conversion tasks, and different target distributed nodes are assigned with different file conversion tasks; Each file conversion task has a corresponding task priority; the file conversion task corresponding to each received file conversion request is assigned to the corresponding target distributed node based on a preset first task scheduling algorithm, including: monitoring the number of tasks currently assigned to each target distributed node, if the number of tasks currently corresponding to the target distributed node exceeds a preset number threshold, adding a first identifier for the target distributed node indicating that the file conversion task cannot be further assigned, and stopping the file conversion task assignment to the target distributed node; dynamically adjusting the assignment of the file conversion task between the target distributed nodes based on the task priority; Each target distributed node assigned with a file conversion task executes one or more assigned file conversion tasks in parallel based on a preset second task scheduling algorithm, including: for each target distributed node assigned with a file conversion task, dynamically adjusting the computing resource occupancy of the target distributed node when executing each currently assigned file conversion task based on the task priority.

2. The method according to claim 1, characterized in that: The original file type is in word format, the converted file type is in pdf format, and the preset development tool is a VSTO development tool; the method further includes: The interface provided by the VSTO development tool is called to configure corresponding template information for each original file to generate corresponding template configuration data, and the template configuration data of each original file obtained is stored in the cloud server based on the RDMA technology.

3. The method according to claim 2, characterized in that Generating a file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template, including: The word template engine uses the obtained first key content data and the document template to add corresponding first identification information to each original file; wherein the first identification information is used to identify the first filling position of the first key content data corresponding to the corresponding original file in the corresponding document template; For each original file, a corresponding file conversion task of converting the word format into the pdf format is generated for the original file based on the first identification information corresponding to the original file.

4. The method according to claim 3, characterized in that Each file conversion task carries its corresponding template information, first key content data and first identification information; converting each original file into a corresponding document of the converted file type includes: For each original file, the second key content data corresponding to the original file is generated based on the first identification information, template information and first key content data corresponding to the original file, and then the second key content data corresponding to the original file is filled into the document template corresponding to the original file to generate the document corresponding to the original file.

5. The method according to claim 4, characterized in that The template information also includes first configuration data of template variables corresponding to the corresponding original file and second configuration data of template parameters corresponding to the corresponding original file; Generating second key content data corresponding to the original file based on the first identification information, template information and first key content data corresponding to the original file includes: Based on the first identification information and the first configuration data corresponding to the original file, corresponding second identification information is generated for the original file; wherein the second identification information is used to identify the second filling position of the template variable corresponding to the corresponding original file in the corresponding document template; Based on the second configuration data and the first key content data corresponding to the original file, generate corresponding template parameter value information for the original file; wherein the template parameter value information includes the value of the template parameter corresponding to the corresponding original file; The second key content data corresponding to the original file is generated based on the second identification information corresponding to the original file, the template parameter value information and the first key content data.

6. The method according to claim 1, characterized in that The method further comprises: Establishing a communication connection between the distributed platform and the cloud server through the QUIC protocol; The distributed platform stores the obtained documents in the cloud server.

7. A document generation device, characterized in that: The device comprises: A data acquisition module is used for the preset development tool to obtain the template configuration data of each original file from the cloud server based on the RDMA technology; wherein the template configuration data is generated after the preset development tool configures the template information of the corresponding original file, and the template information includes the template style, template variables and template parameters of the corresponding original file; A template generation module, used to generate a document template corresponding to each original file based on the template configuration data; wherein the document template is configured with template information of the corresponding original file; A task generation module, used to obtain the first key content data corresponding to each original file, and generate a file conversion task corresponding to each original file based on the original file type and the converted file type corresponding to each original file and the obtained first key content data and the document template; A task execution module, used for executing the obtained file conversion tasks in parallel on the distributed platform to convert each original file into a corresponding document of the converted file type; The distributed platform includes a plurality of distributed nodes capable of executing file conversion tasks; the device further includes: a file conversion request module, configured to send a file conversion request for a file conversion task corresponding to each original file to the distributed platform; The distributed platform executes the obtained file conversion tasks in parallel to convert each original file into a corresponding document of the converted file type, including: the distributed platform assigns the file conversion task corresponding to each received file conversion request to the corresponding target distributed node based on a preset first task scheduling algorithm, and each target distributed node assigned with the file conversion task executes its assigned one or more file conversion tasks in parallel based on a preset second task scheduling algorithm to convert each original file into a corresponding document; wherein each target distributed node is assigned with one or more file conversion tasks, and different target distributed nodes are assigned with different file conversion tasks; Each file conversion task has a corresponding task priority; the file conversion task corresponding to each received file conversion request is assigned to the corresponding target distributed node based on a preset first task scheduling algorithm, including: monitoring the number of tasks currently assigned to each target distributed node, if the number of tasks currently corresponding to the target distributed node exceeds a preset number threshold, adding a first identifier for the target distributed node indicating that the file conversion task cannot be further assigned, and stopping the file conversion task assignment to the target distributed node; dynamically adjusting the assignment of the file conversion task between the target distributed nodes based on the task priority; Each target distributed node assigned with a file conversion task executes one or more assigned file conversion tasks in parallel based on a preset second task scheduling algorithm, including: for each target distributed node assigned with a file conversion task, dynamically adjusting the computing resource occupancy of the target distributed node when executing each currently assigned file conversion task based on the task priority.

8. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Task processing method and device, electronic equipment and computer readable storage medium

    CN113687951A

  • Litigation document generation method, system and device, electronic equipment and storage medium

    CN116090429A