Electronic invoice generation method and device, electronic equipment and computer program product
By receiving order requests, determining target templates, splitting tasks in the electronic invoice generation system, and generating electronic invoices using parallel processing algorithms, the current system generation speed, inflexible templates and relying on external resources is solved, and efficient, stable and customizable electronic invoice generation is achieved.
Patent Information
- Application Number
- CN202510182695.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-13
AI Technical Summary
The current electronic invoice generation system relies on an external PDF rendering engine, resulting in slow generation speed, lack of flexibility in templates, and excessive dependence on external resources, affecting system stability.
By receiving order requests, determining the target template based on the preset template library, building a task queue and splitting it into data analysis, formatting and rendering subtasks, and using parallel processing algorithms to generate electronic invoices to reduce dependence on external resources.
It improves the speed and efficiency of electronic invoice generation, enhances the flexibility of templates and the stability of the system, can effectively handle high concurrent requests and reduces system failures caused by external resource fluctuations.
Smart Images

Figure CN119991235A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic invoices, and in particular to a method and device for generating electronic invoices, an electronic device and a computer program product. Background Art
[0002] With the rapid development of e-commerce and digital office, electronic invoices have become an indispensable part of transactions. However, the current electronic invoice generation system still faces the following problems:
[0003] (1) Current electronic invoice generation systems rely on external PDF rendering engines that have limited processing power, resulting in slow generation of individual PDF files. This delay not only affects the user experience, but also limits the system’s ability to handle a large number of concurrent requests.
[0004] (2) Current electronic invoice templates are usually inflexible and difficult to meet the personalized needs of different enterprises and users. The design of the templates and the way they process data are static and fixed, and cannot be dynamically adjusted according to real-time data and specific business logic.
[0005] (3) The current electronic invoice generation system is overly dependent on external PDF rendering engines and other third-party services, which makes the system stability vulnerable to fluctuations in external resources. For example, unstable network connections and unavailability of third-party services may lead to the failure of the entire invoice generation process.
[0006] Therefore, there is an urgent need for a new electronic invoice generation method that can provide a highly customizable electronic invoice generation experience while maintaining high efficiency and compliance, and reduce dependence on external resources, so as to build a more stable and reliable electronic invoice generation system.
[0007] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0008] The embodiments of the present invention provide a method and device for generating an electronic invoice, an electronic device and a computer program product, so as to at least solve the technical problem of slow speed of generating electronic invoices in the related art.
[0009] According to one aspect of an embodiment of the present invention, there is provided a method for generating an electronic invoice, comprising: receiving a plurality of order requests, wherein each order request comprises: at least one electronic invoice data set to be generated; determining a target template for each electronic invoice data set to be generated based on a preset template library; for each order request, constructing a task queue corresponding to the order request, and constructing flow tasks of the number of data in the task queue according to the number of data of the electronic invoice data set to be generated contained in the order request; based on the target template, processing the flow tasks in each task queue using a parallel processing algorithm, and generating a set of electronic invoices corresponding to each order request, wherein the set of electronic invoices comprises: at least one electronic invoice.
[0010] Furthermore, before receiving multiple order requests, it also includes: building a standard template for each business scenario; based on the data features corresponding to the business scenario, determining the field set in the standard template corresponding to each data feature and the filling rules corresponding to each field in the field set, to obtain predefined templates, wherein each predefined template is associated with a business scenario and a data feature; and building a preset template library based on all predefined templates.
[0011] Furthermore, based on the preset template library, the step of determining a target template for each electronic invoice data set to be generated includes: determining a target business scenario involved in an order request corresponding to the electronic invoice data set to be generated, and analyzing the electronic invoice data set to be generated to determine target data characteristics; based on the target business scenario and target data characteristics, determining the target template from the preset template library.
[0012] Furthermore, based on the data quantity of the electronic invoice data set to be generated contained in the order request, the step of constructing a pipeline task of the data quantity in the task queue includes: for each electronic invoice data set to be generated, splitting the invoice generation task corresponding to the electronic invoice data set to be generated into a data parsing subtask, a formatting subtask and a rendering subtask; constructing the pipeline task of the electronic invoice data set to be generated according to the order of the data parsing subtask, the formatting subtask and the rendering subtask; adding all the pipeline tasks to the task queue corresponding to the order request to which the electronic invoice data set to be generated belongs.
[0013] Furthermore, before a parallel processing algorithm is used to process the pipeline tasks in each task queue based on a target template and a set of electronic invoices corresponding to each order request is generated, it also includes: for each order request, determining a system interface for receiving the order request; based on the type of the system interface, determining a priority level of the order request; and determining an order request scheduling level based on the priority level of the order request, the number of idle processors in the system, and the preset completion time carried by each order request.
[0014] Furthermore, after determining the scheduling level of the order request, it also includes: scheduling the system idle processor for the task queue corresponding to each order request in turn based on the scheduling level of each order request; using the system idle processor to process all the pipeline tasks in the task queue; and releasing the system idle processor when all the pipeline tasks in the task queue are processed.
[0015] Furthermore, the system idle processor includes: multiple processing threads, based on the target template, using a parallel processing algorithm to process the pipeline tasks in each task queue, and generating a set of electronic invoices corresponding to each order request, including: using the system idle processor to parallelly process the data parsing subtasks in all the pipeline tasks in the task queue, wherein the data parsing subtask is used to parse the electronic invoice data set to be generated to obtain the initial data; for the pipeline tasks after the data parsing subtask is processed, using the system idle processor to process the formatting subtask in the pipeline task, wherein the formatting subtask is used to format the initial data to obtain the target data; for the pipeline tasks after the formatting subtask is processed, using the system idle processor to process the rendering subtask in the pipeline task, wherein the rendering subtask is used to fill the target data into the target template corresponding to the pipeline task to obtain the electronic invoice; when all the rendering subtasks in all the pipeline tasks are processed, all the obtained electronic invoices are merged to generate a set of electronic invoices corresponding to the order request.
[0016] According to another aspect of an embodiment of the present invention, there is also provided an electronic invoice generation device, comprising: a receiving unit, configured to receive a plurality of order requests, wherein each order request comprises: at least one electronic invoice data set to be generated; a determining unit, configured to determine a target template for each electronic invoice data set to be generated based on a preset template library; a constructing unit, configured to construct a task queue corresponding to each order request, and to construct a flow task of the data quantity in the task queue according to the data quantity of the electronic invoice data set to be generated contained in the order request; and a processing unit, configured to process the flow tasks in each task queue using a parallel processing algorithm based on the target template, and to generate an electronic invoice set corresponding to each order request, wherein the electronic invoice set comprises: at least one electronic invoice.
[0017] Furthermore, the generating device also includes: a first building module, used to build a standard template for each business scenario before receiving multiple order requests; a first determination module, used to determine the field set in the standard template corresponding to each data feature and the filling rule corresponding to each field in the field set based on the data features corresponding to the business scenario, to obtain a predefined template, wherein each predefined template is associated with a business scenario and a data feature; and a second building module, used to build a preset template library based on all predefined templates.
[0018] Furthermore, the determination unit includes: a second determination module, used to determine the target business scenario involved in the order request corresponding to the electronic invoice data set to be generated, and analyze the electronic invoice data set to be generated to determine the target data characteristics; a third determination module, used to determine the target template from the preset template library based on the target business scenario and the target data characteristics.
[0019] Furthermore, the construction unit includes: a first splitting module, used to split the invoice generation task corresponding to the electronic invoice data set to be generated into a data parsing subtask, a formatting subtask and a rendering subtask for each electronic invoice data set to be generated; a third construction module, used to construct the pipeline task of the electronic invoice data set to be generated according to the order of the data parsing subtask, the formatting subtask and the rendering subtask; a first adding module, used to add all the pipeline tasks to the task queue corresponding to the order request to which the electronic invoice data set to be generated belongs.
[0020] Furthermore, the generating device also includes: a fourth determination module, which is used to determine the system interface for receiving the order request for each order request before processing the pipeline tasks in each task queue based on the target template and using a parallel processing algorithm to generate a set of electronic invoices corresponding to each order request; a fifth determination module, which is used to determine the priority of the order request based on the type of the system interface; and a sixth determination module, which is used to determine the scheduling level of the order request based on the priority of the order request, the number of idle processors in the system, and the preset completion time carried by each order request.
[0021] Furthermore, the generating device also includes: a first scheduling module, which is used to schedule the system idle processor for the task queue corresponding to each order request in turn based on the scheduling level of each order request after determining the scheduling level of the order request; a first processing module, which is used to use the system idle processor to process all the pipeline tasks in the task queue; and a first releasing module, which is used to release the system idle processor when all the pipeline tasks in the task queue are processed.
[0022] Furthermore, the system idle processor includes: multiple processing threads, and the processing unit includes: a second processing module, which is used to use the system idle processor to parallelly process the data parsing subtasks in all the pipeline tasks in the task queue, wherein the data parsing subtask is used to parse the electronic invoice data set to be generated to obtain the initial data; a third processing module, which is used to use the system idle processor to process the formatting subtask in the pipeline task for the pipeline task that has completed the data parsing subtask processing, wherein the formatting subtask is used to format the initial data to obtain the target data; a fourth processing module, which is used to use the system idle processor to process the rendering subtask in the pipeline task for the pipeline task that has completed the formatting subtask processing, wherein the rendering subtask is used to fill the target data into the target template corresponding to the pipeline task to obtain the electronic invoice; a first merging module, which is used to merge all the obtained electronic invoices when all the rendering subtasks in all the pipeline tasks have been processed, and generate an electronic invoice set corresponding to the order request.
[0023] According to another aspect of an embodiment of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, any one of the above-mentioned methods for generating an electronic invoice is implemented.
[0024] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement any one of the above-mentioned methods for generating electronic invoices.
[0025] In the present invention, multiple order requests are received, and based on a preset template library, a target template is determined for each electronic invoice data set to be generated. For each order request, a task queue corresponding to the order request is constructed, and according to the data quantity of the electronic invoice data set to be generated contained in the order request, a flow task of the data quantity is constructed in the task queue. Based on the target template, a parallel processing algorithm is used to process the flow tasks in each task queue, and an electronic invoice set corresponding to each order request is generated, thereby solving the technical problem of slow speed of generating electronic invoices in related technologies.
[0026] In the present invention, by matching a suitable target template to each electronic invoice data set to be generated in the received order request, and building a corresponding task queue for each order request, each electronic invoice generation task of the order request in the task queue is then split into multiple subtasks to build a flow task corresponding to each electronic invoice generation task. Based on the corresponding target template, the flow tasks in each task queue are processed in parallel, so that the electronic invoice set corresponding to the order request can be generated quickly and accurately, thereby achieving the technical effect of improving the efficiency of electronic invoice generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0028] Figure 1 is a flow chart of an optional method for generating an electronic invoice according to an embodiment of the present invention;
[0029] Figure 2 is a schematic diagram of an optional electronic invoice rapid generation process according to an embodiment of the present invention;
[0030] Figure 3 is a schematic diagram of an optional electronic invoice generation device according to an embodiment of the present invention;
[0031] Figure 4 The present invention is a hardware structure block diagram of an electronic device (or mobile device) for a method for generating an electronic invoice according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set between the system and the relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0035] The present invention proposes a method for rapid generation of intelligent PDF files based on self-developed template design and management, which can improve the speed of PDF file generation, overcome the processing power limitation caused by the current electronic invoice generation system relying on an external PDF rendering engine, and achieve rapid response and high concurrent processing capabilities. In addition, the flexibility and customization level of the template are enhanced, and the electronic invoice template can be dynamically adjusted according to real-time data and specific business logic to meet the personalized needs of users. In addition, the system stability is enhanced, the dependence on external resources and services is reduced, and it can effectively deal with problems such as network fluctuations and third-party service interruptions. At the same time, the compliance of electronic invoice generation is ensured, the electronic invoice generation standards are strictly observed, and the security of data transmission and storage is improved.
[0036] The present invention is described in detail below in conjunction with various embodiments.
[0037] Embodiment 1
[0038] According to an embodiment of the present invention, an embodiment of a method for generating an electronic invoice is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0039] Figure 1 is a flow chart of an optional method for generating an electronic invoice according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0040] Step S101: receiving multiple order requests, wherein each order request includes: at least one electronic invoice data set to be generated.
[0041] In an embodiment of the present invention, an electronic invoice generation system is proposed. The electronic invoice generation system can be split into multiple independent modules using a microservice architecture to facilitate deployment and upgrade. In addition, container technology can be used to ensure the uniformity and simplicity of different deployment environments. In this embodiment, the electronic invoice generation system can be modularly designed to speed up the development of new functions, simplify the access of third-party services, and decouple modules, thereby enhancing the overall stability and maintenance efficiency of the system.
[0042] In an embodiment of the present invention, the electronic invoice generation system can be connected to various trading systems (e.g., power trading systems) to receive order requests sent by various trading systems. Here, each order request contains at least one electronic invoice data set to be generated, which contains all necessary information required to generate the electronic invoice, such as detailed information of the buyer and seller, transaction amount, commodity details, etc.
[0043] For example, the electricity trading system processes thousands of electricity transactions every day. After the user completes the payment, each transaction automatically generates an order request containing invoice data, which is then submitted to the electronic invoice generation system.
[0044] Step S102: determining a target template for each electronic invoice data set to be generated based on a preset template library.
[0045] In the embodiment of the present invention, a template library (i.e., a preset template library) can be pre-configured in the electronic invoice generation system, and the template library contains a variety of preset electronic invoice templates. Each template is optimized for a specific invoice type and application scenario. After receiving the electronic invoice data set, the electronic invoice generation system can automatically analyze the data characteristics and application requirements, and thus select the most suitable template from the template library as the target template.
[0046] For example, if the order request involves an ordinary invoice, select a template suitable for the ordinary invoice from the template library; if the order request involves a special value-added tax invoice, select the corresponding special invoice template.
[0047] Step S103: for each order request, a task queue corresponding to the order request is constructed, and according to the data quantity of the electronic invoice data set to be generated contained in the order request, a flow task of the data quantity is constructed in the task queue.
[0048] In an embodiment of the present invention, the electronic invoice generation system can build a corresponding task queue for each order request, and then split the electronic invoice generation task corresponding to each electronic invoice data set to be generated in the order request into smaller units and put them into the task queue, forming a flow task corresponding to each electronic invoice generation task.
[0049] In an embodiment of the present invention, the number of pipeline tasks in each task queue is equal to the number of data in the electronic invoice data set to be generated contained in the order request. Each pipeline task is responsible for generating an electronic invoice. The pipeline tasks in the same task queue can be executed in parallel.
[0050] In this embodiment, by decomposing and queuing tasks, the electronic invoice generation system can efficiently manage the processing flow and ensure orderly and rapid response even in a high-concurrency environment.
[0051] Step S104, based on the target template, a parallel processing algorithm is used to process the pipeline tasks in each task queue to generate an electronic invoice set corresponding to each order request, wherein the electronic invoice set includes: at least one electronic invoice.
[0052] In the embodiment of the present invention, the electronic invoice generation system adopts a parallel processing algorithm, and simultaneously processes the pipeline tasks in the task queue through multi-threading, multi-process or distributed computing technologies. Each pipeline task generates a PDF file of the electronic invoice according to its target template using data filling and formatting technology. The processed electronic invoice files are collected together to form an electronic invoice set, which corresponds to the original order request.
[0053] In this embodiment, by processing pipeline tasks in parallel, the speed of generating electronic invoices can be improved, so that the electronic invoice generation system can quickly respond to and effectively process a large number of order requests, while ensuring the integrity of each request and the accuracy of the data.
[0054] In summary, it is possible to match a suitable target template to each electronic invoice data set to be generated in the received order request, build a corresponding task queue for each order request, and then split each electronic invoice generation task of the order request in the task queue into multiple subtasks to build a pipeline task corresponding to each electronic invoice generation task. Based on the corresponding target template, the pipeline tasks in each task queue are processed in parallel, so that the electronic invoice set corresponding to the order request can be generated quickly and accurately, achieving the technical effect of improving the efficiency of electronic invoice generation, thereby solving the technical problem of slow electronic invoice generation in related technologies.
[0055] In order to improve the accuracy of constructing a preset template library, in the method for generating an electronic invoice provided in Example 1 of the present application, before receiving multiple order requests, a standard template is constructed for each business scenario; based on the data features corresponding to the business scenarios, a field set in the standard template corresponding to each data feature and a filling rule corresponding to each field in the field set are determined to obtain predefined templates, wherein each predefined template is associated with a business scenario and a data feature; and a preset template library is constructed based on all predefined templates.
[0056] In the embodiment of the present invention, the electronic invoice generation system can design and construct a series of standard templates for various business scenarios such as power trading, retail sales, and service provision. Each template contains the basic layout, style, and key fields of the electronic invoice in a specific scenario to meet the invoice format requirements of different business scenarios. For example, the template in the power trading scenario may contain specific fields such as power consumption, electricity price, and service fee, while the template in the retail sales scenario may contain fields such as product name, unit price, and quantity.
[0057] In the embodiment of the present invention, based on the standard template, a specific field set can be defined for the data feature of each business scenario. At the same time, a detailed filling rule is set for each field in the field set to obtain a predefined template associated with the business scenario and the data feature.
[0058] Here, data features refer to the specific attributes of electronic invoice data in a certain business scenario, that is, the length, structure, and type of the field value corresponding to the field in the business scenario. Filling rules refer to the data processing logic set for each field in the field set, including data validation, format conversion, and calculation rules.
[0059] For example, for electricity trading scenarios, a set of fields is defined, including "purchaser taxpayer identification number", "electricity consumption", "unit price", "total price", etc., and the value logic is set for each field. For example, the calculation rule for the "total price" field is "electricity consumption" multiplied by "unit price".
[0060] In the embodiment of the present invention, predefined templates of all business scenarios can be integrated to build a comprehensive preset template library. This template library not only contains standard templates for various business scenarios, but also adjusts the field set of each template and the filling rules of each field according to the data characteristics corresponding to various business scenarios, so that the electronic invoice generation system can quickly locate and select the most suitable template for electronic invoice generation when receiving an order request.
[0061] For example, assuming that the electronic invoice generation system receives an order request involving electricity services, a predefined template for the electricity transaction scenario can be extracted from the preset template library for data filling and formatting.
[0062] In this embodiment, by constructing predefined templates and a preset template library, customized template designs can be provided for different business scenarios to ensure high efficiency and accuracy in the generation of electronic invoices.
[0063] In order to improve the accuracy of determining the target template for the electronic invoice data set to be generated, in the electronic invoice generation method provided in Example 1 of the present application, the target business scenario involved in the order request corresponding to the electronic invoice data set to be generated is determined, and the electronic invoice data set to be generated is analyzed to determine the target data characteristics; based on the target business scenario and the target data characteristics, the target template is determined from the preset template library.
[0064] In an embodiment of the present invention, after receiving an order request, the metadata in the order request (the metadata is key information describing the nature and content of the order request, such as transaction type, transaction amount, commodity or service type, etc.) can be analyzed to determine the specific business scenario (i.e., target business scenario) to which the order request belongs. Business scenarios may include, but are not limited to: electricity trading, retail sales, service provision, etc., each of which has its own specific data structure and invoice format requirements. For example, by analyzing the metadata in the order request, it is found that it includes fields such as "amount of electricity purchased" and "electricity fee", thereby determining that the order request belongs to the electricity trading scenario.
[0065] Then, the electronic invoice dataset to be generated is analyzed, and the key data features (i.e., target data features) therein are extracted, so as to select the target template that best meets the current needs from the preset template library according to the target business scenario and target data features of the electronic invoice dataset to be generated. In this way, it can be ensured that the template that best meets the scenario and features is provided for each electronic invoice dataset to be generated, thereby generating an electronic invoice that fully meets the needs.
[0066] In this embodiment, the intelligent selection and efficient matching of electronic invoice templates can be achieved, ensuring that each electronic invoice is generated based on the template that best suits the current business scenario and data characteristics. This not only improves the quality and efficiency of electronic invoice generation, but also simplifies the user's operation process and reduces errors and delays caused by template mismatch.
[0067] In order to improve the accuracy of constructing pipeline tasks, in the electronic invoice generation method provided in Example 1 of the present application, for each electronic invoice data set to be generated, the invoice generation task corresponding to the electronic invoice data set to be generated is split into a data parsing subtask, a formatting subtask and a rendering subtask; according to the order of the data parsing subtask, the formatting subtask and the rendering subtask, the pipeline task of the electronic invoice data set to be generated is constructed; and all pipeline tasks are added to the task queue corresponding to the order request to which the electronic invoice data set to be generated belongs.
[0068] In an embodiment of the present invention, after receiving the electronic invoice data set in the order request, the invoice generation task corresponding to the electronic invoice data set to be generated can be decomposed into three subtasks: data parsing, formatting, and PDF rendering. Among them, the data parsing subtask is used to convert the original data into a structured format that can be understood by the system; the formatting subtask performs layout and style processing on the data according to the determined template to ensure that each data is accurately placed in the corresponding position of the template; the rendering subtask converts the formatted data into the final PDF file to complete the generation of the electronic invoice. In this way, through task splitting, professional division of labor and optimization in the process of electronic invoice generation can be achieved, ensuring that each processing stage can play the best performance.
[0069] In the embodiment of the present invention, based on the task splitting, a pipeline task processing flow (i.e., pipeline task) is constructed in the order of data parsing, formatting, and rendering. Each task of generating an electronic invoice data set follows this pipeline sequence, starting from data parsing until the rendering of the PDF file is completed. The construction of the pipeline enables multiple subtasks to be connected in series in the most optimized way to form an efficient data processing chain, which can ensure the consistency and efficiency of data processing, and each subtask can be seamlessly connected, reducing processing delays and errors.
[0070] Then, all pipeline tasks are added to the task queue corresponding to the order request to which the electronic invoice dataset to be generated belongs. The task queue is created based on the order request and is used to store and schedule all pipeline tasks to be processed. In this way, the priority and order of task execution can be managed efficiently, ensuring that data processing accuracy and system response timeliness can be maintained even when processing large-scale concurrent requests.
[0071] In this embodiment, refined management of the electronic invoice generation process is achieved, and the electronic invoice data set in each order request can be accurately and efficiently parsed, formatted and rendered. Task splitting and pipeline construction ensure the professionalism of data processing, while the scheduling of task queues ensures the stability and response speed of the system in a high-concurrency environment. This processing method based on subtask pipelines not only improves the efficiency of electronic invoice generation, but also ensures the accuracy of invoice content. At the same time, it also optimizes the utilization of system resources and reduces overall operating costs, providing an efficient and reliable electronic invoice generation solution for high-traffic business scenarios such as power trading systems.
[0072] In order to improve the accuracy of determining the scheduling level of order requests, in the method for generating electronic invoices provided in Example 1 of the present application, before a parallel processing algorithm is used to process the pipeline tasks in each task queue based on a target template to generate a set of electronic invoices corresponding to each order request, for each order request, a system interface for receiving the order request is determined; based on the type of the system interface, the priority level of the order request is determined; based on the priority level of the order request, the number of idle processors in the system and the preset completion time carried by each order request, the scheduling level of the order request is determined.
[0073] In an embodiment of the present invention, the electronic invoice generation system can provide multiple types of interfaces to the third-party transaction system, and the priority of each type of interface can be pre-set. For example, the electronic invoice generation system has interface A, interface B, and interface C. The priority of interface A is greater than that of interface B, and the priority of interface B is greater than that of interface C. Then, the order request generated by the transaction system that calls interface A has the highest priority.
[0074] In an embodiment of the present invention, when receiving an order request, the electronic invoice generation system can first clarify through which interface the order request is received. There may be multiple types of interfaces, such as Web API (Web Application Programming Interface), internal message queue or external data push, etc., and each interface corresponds to different business scenarios or data processing requirements. Then, according to the type of system interface receiving the order request, a priority level can be automatically calculated and assigned to each order request. The priority level can be determined based on the priority level pre-set by the interface, or it can be determined based on the business importance pre-determined by the interface, the urgency of the data, or other predefined rules. For example, if the order request is received through a high-priority Web API interface directly associated with the power trading system, then this batch of order requests will be given a higher priority.
[0075] In an embodiment of the present invention, after determining the priority level of the order request \l ambda_i, the scheduling level P(i) of the order request is further calculated in combination with the number of idle processors R_j in the current system and the preset completion time T_k of each order request. The scheduling level will affect the scheduling order of the order request in the task queue, ensuring that the system can reasonably allocate processing resources according to the current resource status and task requirements, thereby improving the overall processing efficiency. The calculation formula of the scheduling level P(i) of the order request is as follows: P(i) = f(\l ambda_i, R_j, T_k).
[0076] For example, for a high-priority order request, if the preset completion time is short and the current system has multiple idle processors, then its scheduling level will be very high and it will be preferentially scheduled to the processor for parallel processing.
[0077] In this embodiment, intelligent scheduling and priority management of order requests are implemented, ensuring that high-priority orders can be processed quickly. At the same time, the allocation of system resources is optimized and the efficiency of parallel processing is maximized. This dynamic scheduling strategy based on interface type, priority level and system resource status not only improves the speed of electronic invoice generation, but also enhances the system's responsiveness and resource utilization efficiency. It is particularly critical for business scenarios such as power trading systems with high concurrency and multiple scenarios. It effectively improves the system's service quality and user experience, while also reducing the cost increase caused by resource waste, achieving a win-win situation in economic benefits and user experience.
[0078] In order to ensure that urgent order requests are processed with priority, in the method for generating electronic invoices provided in Example 1 of the present application, after determining the scheduling level of the order request, the system idle processor is scheduled for the task queue corresponding to each order request in turn based on the scheduling level of each order request; the system idle processor is used to process all the flow tasks in the task queue; and when all the flow tasks in the task queue are processed, the system idle processor is released.
[0079] In an embodiment of the present invention, processor dynamic scheduling can be performed according to the scheduling level of each order request. Order requests with high scheduling levels will have priority in obtaining the resources of the system idle processors (i.e., processors that are currently not assigned tasks and can be used to process new tasks) to execute the pipeline tasks in their task queues. This scheduling method ensures that critical and urgent tasks can be processed in a timely manner and enhances the responsiveness of the system. For example, if a batch of urgent invoice generation order requests in the power trading system are assigned the highest scheduling level, the system will immediately schedule multiple idle processors to process these requests simultaneously to speed up the processing.
[0080] In the embodiment of the present invention, if a processor is assigned to a specific order request, it will start processing all pipeline tasks in the task queue corresponding to the order request. These tasks include data parsing, formatting, and rendering. Through the parallel processing algorithm and the collaborative work of multiple processors, the pipeline tasks in the task queue can be completed at the fastest speed, significantly improving the efficiency of electronic invoice generation. For example, after the processor is scheduled, the system uses multi-threading technology to parallel process data parsing, formatting, and rendering tasks, and the average generation time of each electronic invoice is only 200 milliseconds.
[0081] In the embodiment of the present invention, when all the pipeline tasks in the task queue corresponding to the order request are processed, the system will automatically identify and release the processor resources previously allocated to the queue, so that it becomes the system idle processor again and can be used for scheduling other order requests. This resource release mechanism realizes the effective recycling of processor resources, avoids resource waste, and ensures the stable operation of the system in a high-concurrency environment. For example, after the pipeline task of an order request is completed, the system immediately releases the processor resources for processing the next order request with a lower scheduling level, thereby realizing efficient utilization of resources.
[0082] In this embodiment, intelligent processor scheduling and resource release based on scheduling level are implemented to ensure the priority execution of key tasks, while improving the efficiency of electronic invoice generation through parallel processing algorithms. This dynamic resource management strategy not only optimizes the utilization of system resources and reduces resource waste, but also improves the order processing speed and user experience in business scenarios such as power trading systems.
[0083] Optionally, the system idle processor includes: multiple processing threads. In order to improve the accuracy of generating the electronic invoice set corresponding to each order request, in the method for generating electronic invoices provided in the first embodiment of the present application, the system idle processor is used to parallelly process the data parsing subtasks in all pipeline tasks in the task queue, wherein the data parsing subtask is used to parse the electronic invoice data set to be generated to obtain the initial data; for the pipeline tasks that have been processed by the data parsing subtask, the system idle processor is used to process the formatting subtask in the pipeline task, wherein the formatting subtask is used to format the initial data to obtain the target data; for the pipeline tasks that have been processed by the formatting subtask, the system idle processor is used to process the rendering subtask in the pipeline task, wherein the rendering subtask is used to fill the target data into the target template corresponding to the pipeline task to obtain the electronic invoice; when all rendering subtasks in all pipeline tasks have been processed, all the obtained electronic invoices are merged to generate the electronic invoice set corresponding to the order request.
[0084] In an embodiment of the present invention, the system idle processor includes: multiple processing threads, so that the multiple processing threads are used to process pipeline tasks in parallel. In this embodiment, for the same pipeline task, each processing thread needs to process each subtask in sequence according to the subtask order in the pipeline task. In the process of processing multiple pipeline tasks in parallel, the multiple processing threads can process different subtasks in different pipeline tasks at the same time.
[0085] In an embodiment of the present invention, a processing thread of a system idle processor scheduled to a task queue can be used to independently and parallelly process the data parsing subtask of each pipeline task in the task queue, thereby speeding up the data parsing. The data parsing subtask is mainly used to parse the electronic invoice data set to be generated and convert it into an initial data format that the system can understand for subsequent processing. For example, in an electricity trading system, the data parsing subtask will parse the original data such as the amount of electricity purchased, the amount of electricity bill, and the information of both buyers and sellers to convert the original data into structured initial data for further processing.
[0086] In an embodiment of the present invention, for the pipeline task that has completed the processing of the data parsing subtask, the processing thread will be used to continue processing the formatting subtask. The formatting subtask is used to perform layout and style processing on the initial data to generate the target data. Then, for the pipeline task that has completed the processing of the formatting subtask, the processing thread will be used to continue processing the rendering subtask. The rendering subtask is used to convert the target data into the PDF format of the electronic invoice (that is, fill the target data into the target template corresponding to the pipeline task to obtain the electronic invoice). Through parallel processing, the system can render multiple electronic invoices at the same time, thereby shortening the conversion time from data to PDF files.
[0087] In the embodiment of the present invention, if the rendering subtasks in all pipeline tasks are processed, the system will automatically collect all generated electronic invoices and merge them into a unified electronic invoice set. This set contains the PDF files of all electronic invoices in the order request, which is convenient for subsequent management and distribution.
[0088] For example, an order request for an electricity trading system may contain thousands of electronic invoices. The system will generate these PDF files one by one and automatically merge them into a complete set of electronic invoices after completion.
[0089] In this embodiment, multiple processing threads in the system idle processor are used to achieve efficient parallel processing of data parsing, formatting and rendering subtasks in the process of electronic invoice generation, thereby improving the speed and accuracy of electronic invoice generation. At the same time, by merging the generated electronic invoices, a unified electronic invoice collection is constructed, which strengthens the centralized management and batch distribution capabilities of electronic invoices. In addition, the efficient use and dynamic scheduling of system resources also ensure the stable operation of the system, and can maintain good performance in the face of high concurrency and large-scale data processing.
[0090] Figure 2 is a schematic diagram of an optional electronic invoice rapid generation process according to an embodiment of the present invention, such as Figure 2 As shown, the following process is included:
[0091] (1) Data reception: The electronic invoice generation system receives the electronic invoice data set to be generated from multiple sources.
[0092] (2) Analyze data characteristics and application scenarios: Determine the most suitable processing strategy and data structure by analyzing the data.
[0093] (3) Select the optimal template: Based on the data analysis results, select the appropriate electronic invoice template.
[0094] (4) Initialize the pipeline and task queue: Set up the data processing pipeline and break down the tasks into smaller units and put them into the task queue.
[0095] (5) Task allocation and scheduling: Use a dynamic scheduling algorithm to allocate tasks to different processors in real time based on system resources and task characteristics.
[0096] (6) Parallel processing of tasks: Each processor fills and formats the data of the task in parallel.
[0097] (7) Merge results and create PDF: Merge the parallel processed data and generate an electronic invoice in PDF format according to the selected template.
[0098] (8) Verify compliance: Check whether the generated electronic invoice meets the specified standards.
[0099] (9) Output the final PDF invoice: Output the generated PDF electronic invoice to the target storage or directly provide it to the user.
[0100] Another optional specific implementation is described in detail below.
[0101] Assume that the power trading system needs to process a large number of online power payment transactions every day. To ensure that users can obtain electronic invoices in a timely manner, the power trading system needs to generate electronic invoices (ordinary invoices) or electronic invoices (VAT special invoices) for all orders on that day at the end of each working day.
[0102] In order to improve efficiency and response speed and realize efficient and accurate electronic invoice generation, the power trading system can use the electronic invoice generation system proposed in this embodiment to generate electronic invoices.
[0103] In an embodiment of the present invention, the order management system of the power trading system pushes a batch of order data to be processed to the electronic invoice generation system every hour. The data includes but is not limited to: the purchaser's tax number, transaction amount and other information.
[0104] Optionally, a message queue can be used to buffer and distribute the stream of order data from the order management system.
[0105] Then, the electronic invoice generation system can analyze the structure and format of the data, pre-process the data, identify common invoice information fields, verify whether the data is complete, etc., to ensure data integrity and consistency. After that, based on the order type and data characteristics, the electronic invoice generation system can automatically select the most appropriate PDF invoice template.
[0106] In an embodiment of the present invention, each order data can be decomposed into independent tasks (i.e., data parsing, formatting, PDF rendering, etc.) and added to the task queue. Then, the load balancer is used to dynamically allocate tasks to idle server nodes. And priority queues can be introduced to ensure that urgent and high-value tasks are given priority. After that, task execution is distributed among servers through multi-threading and multi-process technology, invoice templates are intelligently filled, and PDF files are generated. In addition, a centralized logging and error handling mechanism is provided to ensure data consistency and integrity.
[0107] In the embodiment of the present invention, the generated invoice needs to be automatically reviewed, and real-time compliance checks can be embedded in each processing stage to ensure that all information meets the standards and prevent the generation of illegal invoices. The invoices that pass the review are sent to the customer via email and are also saved in the database for query.
[0108] In the embodiment of the present invention, through template design and management, the unification of electronic invoice formats can be promoted, the confusion and errors caused by format differences can be reduced, and the efficiency of information exchange can be improved. In addition, through parallelization and efficient algorithms, the waiting time and processing bottlenecks can be reduced, the speed of generating electronic invoices can be improved, and the needs of multiple concurrent users can be met. In addition, the introduction of independent value rule configuration and intelligent template selection mechanism can improve the degree of data processing automation and reduce the human error rate.
[0109] The following is a detailed description in conjunction with another embodiment.
[0110] Embodiment 2
[0111] The electronic invoice generation device provided in this embodiment includes multiple implementation units, each of which corresponds to each implementation step in the above-mentioned embodiment 1.
[0112] Figure 3 is a schematic diagram of an optional electronic invoice generation device according to an embodiment of the present invention, such as Figure 2 As shown, the generating device may include: a receiving unit 30, a determining unit 31, a constructing unit 32, and a processing unit 33.
[0113] The receiving unit 30 is used to receive multiple order requests, wherein each order request includes: at least one electronic invoice data set to be generated;
[0114] A determination unit 31, configured to determine a target template for each electronic invoice data set to be generated based on a preset template library;
[0115] A construction unit 32 is used to construct a task queue corresponding to each order request, and to construct a flow task of the data quantity in the task queue according to the data quantity of the electronic invoice data set to be generated contained in the order request;
[0116] The processing unit 33 is used to process the pipeline tasks in each task queue based on the target template by using a parallel processing algorithm to generate an electronic invoice set corresponding to each order request, wherein the electronic invoice set includes: at least one electronic invoice.
[0117] The above-mentioned generation device can match a suitable target template to each electronic invoice data set to be generated in the received order request, and build a corresponding task queue for each order request, and then split each electronic invoice generation task of the order request into multiple subtasks in the task queue to build a pipeline task corresponding to each electronic invoice generation task. Based on the corresponding target template, the pipeline tasks in each task queue are processed in parallel, and the electronic invoice set corresponding to the order request can be generated quickly and accurately, thereby achieving the technical effect of improving the efficiency of electronic invoice generation, and thus solving the technical problem of slow electronic invoice generation in related technologies.
[0118] Optionally, the generating device also includes: a first construction module, used to construct a standard template for each business scenario before receiving multiple order requests; a first determination module, used to determine the field set in the standard template corresponding to each data feature and the filling rule corresponding to each field in the field set based on the data features corresponding to the business scenario, to obtain a predefined template, wherein each predefined template is associated with a business scenario and a data feature; and a second construction module, used to construct a preset template library based on all predefined templates.
[0119] Optionally, the determination unit includes: a second determination module, used to determine the target business scenario involved in the order request corresponding to the electronic invoice data set to be generated, and analyze the electronic invoice data set to be generated to determine the target data characteristics; a third determination module, used to determine the target template from a preset template library based on the target business scenario and the target data characteristics.
[0120] Optionally, the construction unit includes: a first splitting module, used to split the invoice generation task corresponding to the electronic invoice data set to be generated into a data parsing subtask, a formatting subtask and a rendering subtask for each electronic invoice data set to be generated; a third construction module, used to construct the pipeline task of the electronic invoice data set to be generated according to the order of the data parsing subtask, the formatting subtask and the rendering subtask; a first adding module, used to add all pipeline tasks to the task queue corresponding to the order request to which the electronic invoice data set to be generated belongs.
[0121] Optionally, the generating device further includes: a fourth determination module, which is used to determine, for each order request, a system interface for receiving the order request before processing the pipeline tasks in each task queue based on a target template and using a parallel processing algorithm to generate a set of electronic invoices corresponding to each order request; a fifth determination module, which is used to determine the priority of the order request based on the type of the system interface; and a sixth determination module, which is used to determine the scheduling level of the order request based on the priority of the order request, the number of idle processors in the system, and the preset completion time carried by each order request.
[0122] Optionally, the generating device also includes: a first scheduling module, which is used to schedule the system idle processor for the task queue corresponding to each order request in turn based on the scheduling level of each order request after determining the scheduling level of the order request; a first processing module, which is used to use the system idle processor to process all the pipeline tasks in the task queue; and a first releasing module, which is used to release the system idle processor when all the pipeline tasks in the task queue are processed.
[0123] Optionally, the system idle processor includes: multiple processing threads, and the processing unit includes: a second processing module, which is used to use the system idle processor to parallelly process data parsing subtasks in all pipeline tasks in the task queue, wherein the data parsing subtask is used to parse the electronic invoice data set to be generated to obtain initial data; a third processing module, which is used to use the system idle processor to process formatting subtasks in pipeline tasks for pipeline tasks that have completed processing of the data parsing subtask, wherein the formatting subtask is used to format the initial data to obtain target data; a fourth processing module, which is used to use the system idle processor to process rendering subtasks in pipeline tasks for pipeline tasks that have completed processing of the formatting subtask, wherein the rendering subtask is used to fill the target data into a target template corresponding to the pipeline task to obtain an electronic invoice; a first merging module, which is used to merge all the obtained electronic invoices when all the rendering subtasks in all pipeline tasks have been processed, and generate an electronic invoice set corresponding to the order request.
[0124] The above-mentioned generating device may also include a processor and a memory. The above-mentioned receiving unit 30, determining unit 31, constructing unit 32, processing unit 33, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0125] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters are adjusted to process the pipeline tasks in each task queue based on the target template using a parallel processing algorithm to generate an electronic invoice set corresponding to each order request.
[0126] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (fl ash RAM), and the memory includes at least one storage chip.
[0127] The present invention also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: receiving multiple order requests, determining a target template for each electronic invoice data set to be generated based on a preset template library, for each order request, building a task queue corresponding to the order request, and based on the number of data in the electronic invoice data set to be generated contained in the order request, building a flow task of the number of data in the task queue, based on the target template, using a parallel processing algorithm to process the flow tasks in each task queue, and generating an electronic invoice set corresponding to each order request.
[0128] According to another aspect of an embodiment of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, any one of the above-mentioned methods for generating an electronic invoice is implemented.
[0129] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned method for generating electronic invoices.
[0130] Figure 4 FIG. 1 is a hardware structure block diagram of an electronic device (or mobile device) for generating an electronic invoice according to an embodiment of the present invention. Figure 4 As shown, the electronic device may include one or more processors (e.g., Figure 4 The processor 402a, processor 402b, ..., processor 402n, etc., which may include but are not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 404 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown.
[0131] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0132] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.
[0133] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0134] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0135] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0136] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0137] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for 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 method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0138] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for generating an electronic invoice, characterized in that: include: Receiving a plurality of order requests, wherein each of the order requests comprises: at least one electronic invoice data set to be generated; Based on a preset template library, determining a target template for each electronic invoice data set to be generated; For each of the order requests, a task queue corresponding to the order request is constructed, and according to the data quantity of the electronic invoice data set to be generated contained in the order request, a flow task of the data quantity is constructed in the task queue; Based on the target template, a parallel processing algorithm is used to process the pipeline tasks in each of the task queues to generate an electronic invoice set corresponding to each order request, wherein the electronic invoice set includes: at least one electronic invoice.
2. The generation method according to claim 1, characterized in that: Before receiving multiple order requests, also include: Build standard templates for each business scenario; Based on the data features corresponding to the business scenarios, determine a field set in the standard template corresponding to each of the data features and a filling rule corresponding to each field in the field set to obtain a predefined template, wherein each of the predefined templates is associated with the business scenario and the data features; Based on all the predefined templates, the preset template library is constructed.
3. The generation method according to claim 1, characterized in that: The step of determining a target template for each electronic invoice data set to be generated based on a preset template library includes: Determine a target business scenario involved in the order request corresponding to the electronic invoice dataset to be generated, and analyze the electronic invoice dataset to be generated to determine target data features; Based on the target business scenario and the target data characteristics, the target template is determined from the preset template library.
4. The generation method according to claim 1, characterized in that: According to the data quantity of the electronic invoice data set to be generated contained in the order request, the step of constructing a pipeline task of the data quantity in the task queue includes: For each of the electronic invoice data sets to be generated, splitting the invoice generation task corresponding to the electronic invoice data set to be generated into a data parsing subtask, a formatting subtask and a rendering subtask; According to the order of the data parsing subtask, the formatting subtask and the rendering subtask, the pipeline task of the electronic invoice data set to be generated is constructed; All the pipeline tasks are added to the task queue corresponding to the order request to which the electronic invoice data set to be generated belongs.
5. The generation method according to claim 1, characterized in that: Before the process of processing the pipeline tasks in each of the task queues using a parallel processing algorithm based on the target template to generate an electronic invoice set corresponding to each order request, the process further includes: For each of the order requests, determining a system interface for receiving the order request; Determining a priority level of the order request based on the type of the system interface; The order request scheduling level is determined based on the priority level of the order request, the number of idle processors in the system, and the preset completion time carried by each order request.
6. The generation method according to claim 5, characterized in that: After determining the order request scheduling level, the method further includes: Based on the scheduling level of each order request, scheduling a system idle processor for the task queue corresponding to each order request in turn; Using the system idle processor to process all the pipeline tasks in the task queue; When all the pipeline tasks in the task queue are processed completely, the system idle processor is released.
7. The generation method according to claim 4, characterized in that: The system idle processor includes: a plurality of processing threads, based on the target template, using a parallel processing algorithm to process the pipeline tasks in each of the task queues, and generating a set of electronic invoices corresponding to each of the order requests, including: Using the system idle processor to process the data parsing subtasks in all the pipeline tasks in the task queue in parallel, wherein the data parsing subtasks are used to parse the electronic invoice data set to be generated to obtain initial data; For the pipeline task completed by the data parsing subtask, the system idle processor is used to process the formatting subtask in the pipeline task, wherein the formatting subtask is used to format the initial data to obtain target data; For the pipeline task completed by the formatting subtask, the system idle processor is used to process the rendering subtask in the pipeline task, wherein the rendering subtask is used to fill the target data into the target template corresponding to the pipeline task to obtain the electronic invoice; When all the rendering subtasks in all the pipeline tasks are processed, all the obtained electronic invoices are merged to generate the electronic invoice set corresponding to the order request.
8. An electronic invoice generation device, characterized in that: include: A receiving unit, configured to receive a plurality of order requests, wherein each of the order requests comprises: at least one electronic invoice data set to be generated; A determination unit, configured to determine a target template for each electronic invoice data set to be generated based on a preset template library; A construction unit, configured to construct, for each order request, a task queue corresponding to the order request, and construct, in the task queue, flow tasks of the data quantity according to the data quantity of the electronic invoice data set to be generated contained in the order request; A processing unit is used to process the pipeline tasks in each of the task queues based on the target template using a parallel processing algorithm to generate an electronic invoice set corresponding to each order request, wherein the electronic invoice set includes: at least one electronic invoice.
9. A computer program product, characterized in that The invention comprises a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating an electronic invoice according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: The invention comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating an electronic invoice as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-thread parallel financial flow generation method and system
CN105590253A
Massive building pattern spot feature rapid calculation method and system
CN110874271A
Task scheduling processing method and device, electronic equipment and storage medium
CN111813554A
Invoice system service deployment verification method and device, electronic equipment and storage medium
CN114445157A
Electronic invoice input method and device, electronic equipment and readable storage medium
CN116883982A