Microservice-based digital invoice generation method, device, equipment, and storage medium

By breaking down the invoice generation process into microservice modules, automatic verification and generation are achieved, solving the problems of low efficiency and anomalies in traditional invoice generation, and improving the success rate and efficiency of invoice generation.

CN117635249BActive Publication Date: 2025-10-28YGSOFT INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311688771.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-08
Publication Date
2025-10-28
Estimated Expiration
2043-12-08

AI Technical Summary

Technical Problem

Traditional invoice generation methods are inefficient, prone to errors, and can lead to invoice generation anomalies when problems occur at multiple stages, thus failing to meet the needs of digitalization.

Method used

By adopting a microservice architecture, the generation process of digital invoices is broken down into multiple service modules, including invoice coding, generation, and compensation microservices, to achieve automatic verification and automatic generation.

Benefits of technology

It improves the efficiency and success rate of invoice generation, reduces the risk of errors in manual verification, simplifies the process, and reduces reliance on tax control equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117635249B_ABST
    Figure CN117635249B_ABST
Patent Text Reader

Abstract

This application belongs to the field of digital invoices and relates to a microservice-based digital invoice generation method. The method includes obtaining the digital invoice to be generated and a digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice, and a compensation microservice; receiving a digital invoice issuance terminal request, verifying the rationality of the digital invoice based on the issuance terminal request, and obtaining a verification result; calling the invoice coding microservice to assign a code to the digital invoice based on the verification result, obtaining a digital invoice number; obtaining a digital invoice template, calling the invoice generation microservice to generate an invoice based on the digital invoice template and digital invoice number, obtaining an initial digital invoice; and using the compensation microservice to compensate the initial digital invoice for the number of times and time, obtaining a target digital invoice. This application also provides a microservice-based digital invoice generation device, computer equipment, and storage medium. This application can improve the efficiency and success rate of invoice generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of digital electronic tickets, and in particular to a method, apparatus, device and storage medium for generating digital electronic tickets based on microservices. Background Technology

[0002] With the rapid development of the internet and information automation technologies, more and more industries are joining the trend of building information automation systems based on the internet. This development of information technology is also bringing about a profound revolution in traditional tax management. The rise and rapid development of e-commerce means that paper invoices can no longer meet the demand for speed, making the widespread adoption of digital electronic invoices urgent.

[0003] Traditionally, invoices are generated through paper tickets or electronic invoice systems.

[0004] However, this traditional invoice generation method requires a significant amount of manpower to manually verify different business data before issuing invoices. Furthermore, it necessitates the use of dedicated tax control equipment during invoice generation, making the process cumbersome and inefficient. Since multiple stages of the invoicing system are deployed within a single service, a problem in any stage can lead to invoice generation anomalies. Moreover, during the verification process, issues such as failed verification at the central office or errors in manual verification can prevent invoices from being issued, resulting in a lower success rate for invoice generation. Summary of the Invention

[0005] This invention provides a microservice-based method, apparatus, device, and storage medium for generating digital invoices, the main purpose of which is to improve the efficiency and success rate of invoice generation.

[0006] To address the aforementioned technical problems, this application provides a microservice-based method for generating digital tickets, employing the following technical solution:

[0007] Obtain the digital invoice to be generated and the digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice, and a compensation microservice;

[0008] Receive the digital invoice issuance terminal request, verify the rationality of the digital invoice according to the issuance terminal request, and obtain the verification result;

[0009] Based on the verification result, the invoice coding microservice is invoked to assign a code to the digital invoice, thereby obtaining the digital invoice number;

[0010] Obtain the digital invoice template, and based on the digital invoice template and the digital invoice number, call the invoice generation microservice to generate the invoice and obtain the initial digital invoice;

[0011] The initial number of electronic tickets is compensated for in terms of both frequency and time using the compensation microservice to obtain the target number of electronic tickets.

[0012] Furthermore, the step of calling the invoice coding microservice to assign a code to the digital invoice based on the verification result to obtain the digital invoice number includes:

[0013] Based on the verification result, the system receives a coding terminal request for the digital invoice, calls the invoice coding microservice to code the digital invoice according to the coding terminal request, and obtains the coding result.

[0014] Check whether the coding result of the digital invoice was successful;

[0015] If the coding result is successful, the digital invoice number assigned by the invoice coding microservice to the digital invoice will be returned.

[0016] If the coding result fails, the invoice coding microservice is invoked to update the digital invoice number inventory, obtain the cache information of the digital invoice, and reassign the digital invoice to the digital invoice from the digital invoice number inventory based on the cache information, thereby obtaining the digital invoice number.

[0017] Furthermore, the step of calling the invoice generation microservice to generate an initial digital invoice based on the digital invoice style and the digital invoice number includes:

[0018] Receive a request from the digital ticket generation terminal, and obtain the digital ticket generation template according to the request;

[0019] Based on the generated template, the digital invoice style, and the digital invoice number, the invoice generation microservice is invoked to generate a digital invoice file from the digital invoice.

[0020] The digital ticket document is signed and stamped to obtain the initial digital ticket.

[0021] Furthermore, the step of using the compensation microservice to compensate the initial number of electronic tickets for the number of times and the time to obtain the target number of electronic tickets includes:

[0022] When the status of the initial number of electronic tickets is identified as a successful status, the initial number of electronic tickets is used as the target number of electronic tickets;

[0023] When the status of the initial electronic ticket is identified as a failure, it is determined whether the number of failures and the failure retry time of the initial electronic ticket meet preset conditions.

[0024] If the number of failures or the failure retry time does not meet the preset conditions, it is determined that the electronic ticket cannot be generated;

[0025] When the number of failures and the failure retry time meet the preset conditions, the data ticket is regenerated until the data ticket is successfully generated, and the target data ticket is obtained.

[0026] Furthermore, the step of verifying the rationality of the digital invoice based on the request from the issuing terminal, and obtaining the verification result, includes:

[0027] The invoice type of the digital invoice is obtained according to the request from the issuing terminal, and the invoice style of the digital invoice is obtained based on the invoice type;

[0028] Determine whether the invoice format conforms to preset rules;

[0029] If the invoice format conforms to the preset rules, the verification result of the digital invoice is determined to be successful.

[0030] If the invoice format does not conform to the preset rules, the verification result of the digital invoice is determined to be that the verification failed.

[0031] Furthermore, before obtaining the digital electricity ticket to be generated and the digital electricity ticket generation microservice, the method further includes:

[0032] Identify the dependencies between the invoice coding microservice, the invoice generation microservice, and the compensation microservice;

[0033] The digital ticket generation microservice is constructed based on the aforementioned dependencies.

[0034] Furthermore, after receiving the digital invoice issuance terminal request, and before verifying the reasonableness of the digital invoice according to the issuance terminal request, the method further includes:

[0035] Extract the request message of the terminal request and verify whether the request message is valid;

[0036] If the request message is invalid, it is determined that the terminal request response has failed.

[0037] If the request message is valid, then the terminal request response is deemed successful.

[0038] To address the aforementioned technical problems, this application also provides a microservice-based digital ticket generation device, which employs the following technical solution:

[0039] The acquisition module is used to acquire the digital invoice to be generated and the digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice, and a compensation microservice;

[0040] The verification module is used to receive the issuance terminal request of the digital invoice, verify the rationality of the digital invoice according to the issuance terminal request, and obtain the verification result.

[0041] The coding module is used to call the invoice coding microservice to code the digital invoice according to the verification result, so as to obtain the digital invoice number;

[0042] The generation module is used to obtain the digital invoice template, and based on the digital invoice template and the digital invoice number, call the invoice generation microservice to generate the invoice, thus obtaining an initial digital invoice; and

[0043] The compensation module is used to perform frequency and time compensation on the initial number of electronic tickets using the compensation microservice to obtain the target number of electronic tickets.

[0044] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:

[0045] Memory, storing at least one computer program; and

[0046] The processor executes the computer program stored in the memory to implement the microservice-based digital ticket generation described above.

[0047] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:

[0048] The computer-readable storage medium stores at least one computer program, which is executed by a processor in an electronic device to implement the microservice-based digital ticket generation described above.

[0049] Compared with the prior art, this application has the following main advantages:

[0050] In this embodiment, the process first involves obtaining the digital invoice to be generated and the digital invoice generation microservice. Using microservices to generate the digital invoice breaks down the generation process into multiple service modules, reducing the likelihood of errors during generation. By verifying the rationality of the digital invoice, a verification result is obtained, enabling automatic verification and avoiding errors that are prone to occur during manual verification, thus improving the success rate of subsequent invoice generation. Secondly, based on the verification result, the invoice coding microservice is invoked to assign a code to the digital invoice, obtaining a digital invoice number, which determines the unique identifier of the digital invoice. Then, based on the digital invoice style and number, the invoice generation microservice is invoked to generate the invoice, achieving automatic generation, reducing manpower, eliminating the need for tax control equipment, simplifying the invoice generation process, and improving efficiency. Finally, by utilizing a compensation microservice to compensate the initial digital invoice for the number of attempts and time, the target digital invoice is obtained, reducing the likelihood of verification failures at the tax authority level and improving the success rate of invoice generation. Therefore, the microservice-based digital invoice generation method, apparatus, device, and storage medium proposed in this invention can improve the efficiency and success rate of invoice generation. Attached Figure Description

[0051] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0052] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;

[0053] Figure 2 This is a flowchart of one implementation of the microservice-based digital ticket generation method according to this application;

[0054] Figure 3 This is a structural diagram of an embodiment of the control terminal in the microservice-based digital ticket generation system according to this application;

[0055] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation

[0056] The data format determination method provided in this invention is applied to a data processing system. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing specific embodiments only and is not intended to limit the application. The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or accompanying drawings of this application are used to distinguish different objects, not to describe a specific order.

[0057] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0058] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0059] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0060] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social online platform software.

[0061] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.

[0062] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.

[0063] It should be noted that the microservice-based digital ticket generation method provided in this application is generally executed by a server / terminal device, and correspondingly, the microservice-based digital ticket generation system is generally set up in the server / terminal device.

[0064] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0065] Continue to refer to Figure 2 The diagram illustrates a flowchart of an embodiment of the microservice-based digital invoice generation method proposed in this application. The microservice-based digital invoice generation method includes the following steps:

[0066] S210. Obtain the digital invoice to be generated and the digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice, and a compensation microservice.

[0067] In this embodiment of the application, the digital invoice is a fully digitized electronic invoice with the same legal effect as a paper invoice. It has the characteristics of not existing in paper form, not requiring media support, and not needing to be applied for and issued. The digital invoice includes information such as dynamic QR code, invoice number, invoice date, buyer information, seller information, project name, specifications, unit, quantity, unit price, and amount.

[0068] The digital invoice generation microservice is a cluster of microservices including an invoice coding microservice, an invoice generation microservice, and a compensation microservice. Each microservice is a small, single service with business functions, and each microservice has its own processing and lightweight communication mechanism. It can be deployed on one or more servers. The purpose of the digital invoice generation microservice is to deploy the multiple stages of digital invoice issuance in different microservices, so as to avoid invoice generation anomalies caused by problems in one stage, and thus ensure the success rate of invoice generation.

[0069] In an optional embodiment of this application, before obtaining the digital electricity ticket to be generated and the digital electricity ticket generation microservice, the method further includes:

[0070] Identify the dependencies between the invoice coding microservice, the invoice generation microservice, and the compensation microservice;

[0071] The digital ticket generation microservice is constructed based on the aforementioned dependencies.

[0072] The dependency relationship can be obtained from the function call relationship between microservices corresponding to the entity type based on the entity type of the microservice.

[0073] Specifically, in this embodiment, lexical analysis is first performed on the software source code of the invoice coding microservice, the invoice generation microservice, and the compensation microservice to obtain the entity types corresponding to the invoice coding microservice, the invoice generation microservice, and the compensation microservice. Then, by identifying the function call relationships between the entity types corresponding to the invoice coding microservice, the invoice generation microservice, and the compensation microservice, the dependency relationships between the microservices corresponding to the entity types are determined based on the call relationships.

[0074] Furthermore, in this embodiment of the application, a microservice system is built based on Spring Cloud, and the registration of the invoice coding microservice, the invoice generation microservice, and the compensation microservice is implemented through a microservice registry center (such as Nacos). The digital invoice generation microservice is constructed according to the dependency relationship.

[0075] S220. Receive the issuance terminal request of the digital invoice, verify the rationality of the digital invoice according to the issuance terminal request, and obtain the verification result.

[0076] In this embodiment of the application, the terminal issuance request refers to the digital invoice issuance request sent by the client terminal; the reasonableness refers to whether the invoice style corresponding to the invoice type of the digital invoice conforms to the style of the invoice type corresponding to the standard digital invoice; the verification result includes verification pass and verification fail results.

[0077] In an optional embodiment of this application, after receiving the issuance terminal request for the digital invoice and before verifying the reasonableness of the digital invoice according to the issuance terminal request, the method further includes:

[0078] Extract the request message of the terminal request and verify whether the request message is valid;

[0079] If the request message is invalid, it is determined that the terminal request response has failed.

[0080] If the request message is valid, then the terminal request response is deemed successful.

[0081] The request message is an HTTP message from the client terminal. An HTTP message is a string of text consisting of multiple lines of data. The validity of the request message can be verified using a pre-written JAR package. The validity includes whether the requested string of text is within a specified range, whether the requested URL is valid, and whether the attribute values ​​in the request message header and message body contain the correct client terminal information.

[0082] In this embodiment of the application, an invalid request message indicates that the request sent by the client terminal may have been tampered with, making the request unresponsive and requiring the client terminal to resubmit the request for issuing the electronic bill; a valid request message indicates that the request sent by the client terminal has not been tampered with and can be responded to.

[0083] In this embodiment of the application, after receiving the terminal request for issuing the digital invoice, by extracting the request message of the terminal request and verifying whether the request message is valid, the request parameters can be prevented from being intercepted and tampered with, thus ensuring the security of the terminal request.

[0084] As an embodiment of the present invention, the step of verifying the rationality of the digital invoice based on the request from the issuing terminal and obtaining the verification result includes:

[0085] The invoice type of the digital invoice is obtained according to the request from the issuing terminal, and the invoice style of the digital invoice is obtained based on the invoice type;

[0086] Determine whether the invoice format conforms to preset rules;

[0087] If the invoice format conforms to the preset rules, the verification result of the digital invoice is determined to be successful.

[0088] If the invoice format does not conform to the preset rules, the verification result of the digital invoice is determined to be that the verification failed.

[0089] The invoice types include digitized electronic special invoices and digitized electronic general invoices; the invoice style refers to the invoice style corresponding to different invoice types, including the style content such as whether the invoice is empty, character length, number length, data format, number precision, buyer, seller, tax amount and amount, all of which need to be checked one by one.

[0090] In this embodiment of the application, the determination of whether the invoice style conforms to the preset rules can be achieved by a pre-built verification engine or verification component. The preset rules are to compare the invoice styles corresponding to different invoice types with the styles corresponding to the standard invoice type one by one. Therefore, the preset rules also include verification rules for style content such as non-empty, character length, number length, data format, number precision, buyer, seller, tax amount and amount on the invoice.

[0091] In this embodiment of the application, if the invoice style does not conform to the preset rules, it means that the digital invoice verification has failed, indicating that the invoice type of the digital invoice issuance request has been incorrect or that the issuance request is duplicated. In order to avoid invalid requests occupying digital invoice issuance resources, an error message is returned for requests that fail verification, so as to improve the efficiency of subsequent digital invoice generation.

[0092] S230. Based on the verification result, the invoice coding microservice is called to assign a code to the digital invoice, thereby obtaining the digital invoice number.

[0093] In this embodiment of the application, the digital invoice number refers to a 20-digit invoice number that uniquely identifies a digital electronic invoice.

[0094] As an embodiment of this application, the step of calling the invoice coding microservice to assign a code to the digital invoice based on the verification result to obtain the digital invoice number includes:

[0095] Based on the verification result, the system receives a coding terminal request for the digital invoice, calls the invoice coding microservice to code the digital invoice according to the coding terminal request, and obtains the coding result.

[0096] Check whether the coding result of the digital invoice was successful;

[0097] If the coding result is successful, the digital invoice number assigned by the invoice coding microservice to the digital invoice will be returned.

[0098] If the coding result fails, the invoice coding microservice is invoked to update the digital invoice number inventory, obtain the cache information of the digital invoice, and reassign the digital invoice to the digital invoice from the digital invoice number inventory based on the cache information, thereby obtaining the digital invoice number.

[0099] The code assignment terminal request is a code assignment request initiated by the client terminal. When the invoice code assignment microservice receives the code assignment terminal request, it applies for the invoice number of the digital electronic invoice from the tax bureau and assigns the invoice number to the digital electronic invoice.

[0100] In this embodiment of the application, the coding result refers to the coding result of the coding microservice on the digital invoice, including coding success and coding failure results; when the coding result is successful, it means that the invoice number is successfully assigned, and the invoice number is used as the digital invoice number of the digital invoice.

[0101] Furthermore, if the coding fails, it may be because all the invoice numbers applied for by the digital invoice generation microservice from the tax bureau have been issued. It is necessary to use the update lock of the invoice coding microservice to apply for new invoice numbers from the tax bureau to update the invoice number inventory, and store the updated numbers in Redis with the storage structure of appid + taxpayer identification number. Then, use the query lock of the invoice coding microservice to look up the new invoice number storage structure in Redis to obtain the new invoice number, reassign the new invoice number to the digital invoice, and use the new invoice number as the digital invoice number of the digital invoice.

[0102] In this embodiment of the application, by querying whether the coding result of the digital invoice is successful and assigning the corresponding digital invoice number, it is possible to ensure that the assigned digital invoice number is unique and that the digital invoice number segment resources are not reused. At the same time, a digital invoice number segment recycling mechanism is added to reclaim the number segment for subsequent digital invoices in the case of failure to issue invoices, thereby improving the success rate of subsequent invoice generation.

[0103] S240. Obtain the digital invoice style, and call the invoice generation microservice to generate the invoice based on the digital invoice style and the digital invoice number to obtain the initial digital invoice.

[0104] In this embodiment, the digital invoice style is determined based on the invoice type, including information such as invoice date, buyer information, seller information, project name, specifications, unit, quantity, unit price, and amount. The function of the invoice generation microservice is to generate digital invoices based on the digital invoice style and digital invoice number.

[0105] As an embodiment of this application, the step of calling the invoice generation microservice to generate an initial digital invoice based on the digital invoice style and the digital invoice number to obtain the initial digital invoice includes:

[0106] Receive a request from the digital ticket generation terminal, and process the request according to the digital ticket generation terminal request.

[0107] Obtain the template for generating the digital ticket;

[0108] Based on the generated template, the digital invoice style, and the digital invoice number, the invoice generation microservice is invoked to generate a digital invoice file from the digital invoice.

[0109] The digital ticket document is signed and stamped to obtain the initial digital ticket.

[0110] The generated template refers to a standard template that combines different invoice styles and invoice numbers based on different invoice types.

[0111] In one embodiment of this application, the PDFUtil of the invoice generation microservice is called according to the generation template, the digital electronic invoice style and the digital electronic invoice number to generate a PDF file of the digital electronic invoice, i.e., the digital electronic invoice file. Further, the electronic signature service is used to call the electronic signature service to electronically sign the PDF file of the digital electronic invoice to generate an initial digital electronic invoice.

[0112] In this embodiment of the application, by signing the digital invoice file to obtain the initial digital invoice, the validity, legality, and immutability of the digital electronic invoice PDF file can be guaranteed, thereby improving the security of the generated initial digital invoice.

[0113] S250. The initial number of electronic tickets is compensated for in terms of frequency and time using the compensation microservice to obtain the target number of electronic tickets.

[0114] In this embodiment of the application, the function of the compensation microservice is to compensate for the re-issuance time and number of re-issuances of initial digital invoices that fail to be issued, thereby further improving the success rate of digital invoice generation.

[0115] As an embodiment of this application, the step of using the compensation microservice to perform frequency and time compensation on the initial number of electronic tickets to obtain the target number of electronic tickets includes:

[0116] When the status of the initial number of electronic tickets is identified as a successful status, the initial number of electronic tickets is used as the target number of electronic tickets;

[0117] When the status of the initial electronic ticket is identified as a failure, it is determined whether the number of failures and the failure retry time of the initial electronic ticket meet preset conditions.

[0118] If the number of failures or the failure retry time does not meet the preset conditions, it is determined that the electronic ticket cannot be generated;

[0119] When the number of failures and the failure retry time meet the preset conditions, the data ticket is regenerated until the data ticket is successfully generated, and the target data ticket is obtained.

[0120] The preset conditions are pre-defined retry count and retry time values, the specific values ​​of which are determined based on the actual business scenario. For example, the retry count can be 5 times, and the retry time can be within 24 hours from the time of the electronic invoice issuance application.

[0121] Furthermore, in this embodiment of the application, when the initial digital ticket is identified as being in a failed state, and when the number of failures and the retry time meet preset conditions, the digital ticket is regenerated until the digital ticket is successfully generated, thus obtaining the target digital ticket. The reason for the failure to generate the digital ticket may be due to errors in manual verification or failure of manual verification at the central office. Appropriately allocating retry time and retry counts to compensate for this can ensure the normal generation of the digital ticket and avoid situations where the digital ticket cannot be issued due to failure of verification at the central office or errors in manual verification during the verification process, thereby further improving the success rate of digital ticket generation.

[0122] Compared with the prior art, the embodiments of this application have the following main advantages:

[0123] In this embodiment, the process begins by acquiring the digital invoice to be generated and the digital invoice generation microservice. Using microservices to generate the digital invoice breaks down the generation process into multiple service modules, reducing the likelihood of errors during generation. By verifying the rationality of the digital invoice, a verification result is obtained, enabling automatic verification and avoiding errors that are prone to occur during manual verification, thus improving the success rate of subsequent invoice generation. Secondly, based on the verification result, the invoice coding microservice is invoked to assign a code to the digital invoice, obtaining a digital invoice number, which determines the unique identifier of the digital invoice. Then, based on the digital invoice style and number, the invoice generation microservice is invoked to generate the invoice, achieving automatic generation, reducing manpower, eliminating the need for tax control equipment, simplifying the invoice generation process, and improving efficiency. Finally, by utilizing a compensation microservice to compensate the initial digital invoice for the number of attempts and time, the target digital invoice is obtained, reducing the likelihood of verification failures at the tax authority level and improving the success rate of invoice generation. Therefore, the microservice-based digital invoice generation method proposed in this embodiment can improve the efficiency and success rate of invoice generation.

[0124] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

[0125] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0126] Further reference Figure 3 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of a microservice-based digital ticket generation device 310, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0127] This invention provides a microservice-based digital invoice generation system, the microservice-based digital invoice generation system comprising:

[0128] The acquisition module 311 is used to acquire the digital invoice to be generated and the digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice and a compensation microservice;

[0129] The verification module 312 is used to receive the issuance terminal request of the digital invoice, verify the rationality of the digital invoice according to the issuance terminal request, and obtain the verification result.

[0130] The coding module 313 is used to call the invoice coding microservice to code the digital invoice according to the verification result, so as to obtain the digital invoice number;

[0131] Generation module 314 is used to obtain the digital invoice template, and based on the digital invoice template and the digital invoice number, call the invoice generation microservice to generate an invoice from the digital invoice, thereby obtaining an initial digital invoice; and

[0132] The compensation module 315 is used to perform frequency and time compensation on the initial number of electronic tickets using the compensation microservice to obtain the target number of electronic tickets.

[0133] The acquisition module is further used for:

[0134] The identification submodule is used to identify the dependencies between the invoice coding microservice, the invoice generation microservice, and the compensation microservice.

[0135] A submodule is constructed to build the digital ticket generation microservice based on the dependencies.

[0136] The verification module is further used for:

[0137] The extraction submodule is used to extract the request message of the terminal request and verify whether the request message is valid.

[0138] The first response submodule is used to determine that the terminal request response fails when the request message is invalid.

[0139] The second response submodule is used to determine that the terminal request response is successful if the request message is valid.

[0140] The verification module also includes:

[0141] The acquisition submodule is used to obtain the invoice type of the digital invoice according to the request of the issuing terminal, and obtain the invoice style of the digital invoice based on the invoice type;

[0142] The judgment submodule is used to determine whether the invoice style conforms to preset rules;

[0143] The first verification submodule is used to determine that the verification result of the digital invoice is passed when the invoice style meets the preset rules;

[0144] The second verification submodule is used to determine that the verification result of the digital invoice is "verification failed" when the invoice style does not conform to the preset rules.

[0145] The coding module also includes:

[0146] The coding submodule is used to receive a coding terminal request from the digital invoice based on the verification result, and to call the invoice coding microservice to code the digital invoice based on the coding terminal request, so as to obtain the coding result.

[0147] The query submodule is used to query whether the coding result of the digital ticket was successful;

[0148] The number acquisition submodule is used to return the digital invoice number assigned by the invoice coding microservice when the coding result is successful.

[0149] The re-coding submodule is used to call the invoice coding microservice to update the digital invoice number inventory when the coding result fails, obtain the cache information of the digital invoice, and re-assign the digital invoice number from the digital invoice number inventory using the invoice coding microservice based on the cache information, thereby obtaining the digital invoice number.

[0150] The generation module further includes:

[0151] The receiving submodule is used to receive the digital ticket generation terminal request and obtain the digital ticket generation template according to the generation terminal request.

[0152] The submodule is invoked to call the invoice generation microservice to generate a digital invoice file based on the generated template, the digital invoice style, and the digital invoice number.

[0153] The signing submodule is used to sign the digital ticket document to obtain the initial digital ticket.

[0154] The compensation module also includes:

[0155] The first identification submodule is used to identify the initial number of electronic tickets as the target number of electronic tickets when the status of the initial number of electronic tickets is a successful status.

[0156] The second identification submodule is used to identify whether the number of failures and the failure retry time of the initial number of electronic tickets meet preset conditions when the status of the initial number of electronic tickets is a failure status.

[0157] The first generation submodule is used to determine that the electronic ticket cannot be generated if the number of failures or the failure retry time does not meet the preset conditions.

[0158] The second generation submodule is used to regenerate the digital ticket when the number of failures and the failure retry time meet preset conditions, until the digital ticket is successfully generated and the target digital ticket is obtained.

[0159] Compared with the prior art, the embodiments of this application have the following main advantages:

[0160] In this embodiment, the process first involves obtaining the digital invoice to be generated and the digital invoice generation microservice. Using microservices to generate the digital invoice breaks down the generation process into multiple service modules, reducing the likelihood of errors during generation. By verifying the rationality of the digital invoice, a verification result is obtained, enabling automatic verification and avoiding errors that are prone to occur during manual verification, thus improving the success rate of subsequent invoice generation. Secondly, based on the verification result, the invoice coding microservice is invoked to assign a code to the digital invoice, obtaining a digital invoice number, which determines the unique identifier of the digital invoice. Then, based on the digital invoice style and number, the invoice generation microservice is invoked to generate the invoice, achieving automatic generation, reducing manpower, eliminating the need for tax control equipment, simplifying the invoice generation process, and improving efficiency. Finally, by utilizing a compensation microservice to compensate the initial digital invoice for the number of attempts and time, the target digital invoice is obtained, reducing the chance of verification failure at the tax authority and improving the success rate of invoice generation. Therefore, the microservice-based digital invoice generation device proposed in this embodiment can improve the efficiency and success rate of invoice generation.

[0161] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0162] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0163] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.

[0164] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as the program code of a microservice-based digital ticket generation method. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.

[0165] In some embodiments, the processor 42 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run program code stored in the memory 41 or process data, for example, to run the program code of the microservice-based digital ticket generation method.

[0166] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.

[0167] This application also provides another embodiment, namely, providing a computer-readable storage medium storing the microservice-based digital ticket generation method program, which can be executed by at least one processor to perform the steps of the microservice-based digital ticket generation method as described above.

[0168] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware online platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0169] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0170] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.

Claims

1. A microservice-based method for generating digital tickets, characterized in that, Includes the following steps: Obtain the digital invoice to be generated and the digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice, and a compensation microservice; Receive the digital invoice issuance terminal request, verify the rationality of the digital invoice according to the issuance terminal request, and obtain the verification result; Based on the verification result, the invoice coding microservice is invoked to assign a code to the digital invoice, thereby obtaining the digital invoice number; Obtain the digital invoice template, and based on the digital invoice template and the digital invoice number, call the invoice generation microservice to generate the invoice and obtain the initial digital invoice; The initial number of electronic tickets is compensated for in terms of both frequency and time using the compensation microservice to obtain the target number of electronic tickets; The step of calling the invoice coding microservice based on the verification result to assign a code to the digital invoice and obtain the digital invoice number includes: Based on the verification result, the system receives a coding terminal request for the digital invoice, calls the invoice coding microservice to code the digital invoice according to the coding terminal request, and obtains the coding result. Check whether the coding result of the digital invoice was successful; If the coding result is successful, the digital invoice number assigned by the invoice coding microservice to the digital invoice will be returned. If the coding result fails, the invoice coding microservice is called to update the digital invoice number inventory, obtain the cache information of the digital invoice, and reassign the digital invoice to the digital invoice from the digital invoice number inventory based on the cache information, thereby obtaining the digital invoice number. The step of using the compensation microservice to compensate the initial number of electronic tickets for both frequency and time, to obtain the target number of electronic tickets, includes: When the status of the initial number of electronic tickets is identified as a successful status, the initial number of electronic tickets is used as the target number of electronic tickets; When the status of the initial electronic ticket is identified as a failure, it is determined whether the number of failures and the failure retry time of the initial electronic ticket meet preset conditions. If the number of failures or the failure retry time does not meet the preset conditions, it is determined that the electronic ticket cannot be generated; When the number of failures and the failure retry time meet the preset conditions, the data ticket is regenerated until the data ticket is successfully generated, and the target data ticket is obtained.

2. The microservice-based digital ticket generation method according to claim 1, characterized in that, The process of calling the invoice generation microservice to generate an initial digital invoice based on the digital invoice style and the digital invoice number, includes: Receive a request from the digital ticket generation terminal, and obtain the digital ticket generation template according to the request; Based on the generated template, the digital invoice style, and the digital invoice number, the invoice generation microservice is invoked to generate a digital invoice file from the digital invoice. The digital ticket document is signed and stamped to obtain the initial digital ticket.

3. The microservice-based digital ticket generation method according to any one of claims 1-2, characterized in that, The step of verifying the rationality of the digital invoice based on the terminal request and obtaining the verification result includes: The invoice type of the digital invoice is obtained according to the request from the issuing terminal, and the invoice style of the digital invoice is obtained based on the invoice type; Determine whether the invoice format conforms to preset rules; If the invoice format conforms to the preset rules, the verification result of the digital invoice is determined to be successful. If the invoice format does not conform to the preset rules, the verification result of the digital invoice is determined to be that the verification failed.

4. The microservice-based digital ticket generation method according to any one of claims 1-2, characterized in that, Before obtaining the digital electricity ticket to be generated and the digital electricity ticket generation microservice, the method further includes: Identify the dependencies between the invoice coding microservice, the invoice generation microservice, and the compensation microservice; The digital ticket generation microservice is constructed based on the aforementioned dependencies.

5. The microservice-based digital ticket generation method according to any one of claims 1-2, characterized in that, After receiving the issuance terminal request for the digital invoice, and before verifying the reasonableness of the digital invoice according to the issuance terminal request, the method further includes: Extract the request message of the terminal request and verify whether the request message is valid; If the request message is invalid, it is determined that the terminal request response has failed. If the request message is valid, then the terminal request response is deemed successful.

6. A microservice-based digital ticket generation device, characterized in that, include: The acquisition module is used to acquire the digital invoice to be generated and the digital invoice generation microservice, wherein the digital invoice generation microservice includes an invoice coding microservice, an invoice generation microservice, and a compensation microservice; The verification module is used to receive the issuance terminal request of the digital invoice, verify the rationality of the digital invoice according to the issuance terminal request, and obtain the verification result. The coding module is used to call the invoice coding microservice to code the digital invoice according to the verification result, so as to obtain the digital invoice number; The generation module is used to obtain the digital invoice template, and based on the digital invoice template and the digital invoice number, call the invoice generation microservice to generate the invoice, thus obtaining an initial digital invoice; and The compensation module is used to perform frequency and time compensation on the initial number of electronic tickets using the compensation microservice to obtain the target number of electronic tickets; The coding module further includes: a coding submodule, a query submodule, a number retrieval submodule, and a recoding submodule, wherein: The coding submodule is used to receive a coding terminal request from the digital invoice based on the verification result, and to call the invoice coding microservice to code the digital invoice based on the coding terminal request, thereby obtaining the coding result. The query submodule is used to query whether the coding result of the digital ticket was successful; The number acquisition submodule is used to return the digital invoice number assigned by the invoice coding microservice when the coding result is successful. The re-coding submodule is used to call the invoice coding microservice to update the digital invoice number inventory when the coding result fails, obtain the cache information of the digital invoice, and reassign the digital invoice number from the digital invoice number inventory using the invoice coding microservice based on the cache information to obtain the digital invoice number. The compensation module further includes: a first identification submodule, a second identification submodule, a first generation submodule, and a second generation submodule, wherein: The first identification submodule is used to identify the initial number of electronic tickets as the target number of electronic tickets when the status of the initial number of electronic tickets is a successful status; The second identification submodule is used to identify whether the number of failures and the failure retry time of the initial number of electronic tickets meet preset conditions when the status of the initial number of electronic tickets is a failure status. The first generation submodule is used to determine that the electronic ticket cannot be generated if the number of failures or the failure retry time does not meet the preset conditions. The second generation submodule is used to regenerate the digital ticket when the number of failures and the failure retry time meet preset conditions, until the digital ticket is successfully generated and the target digital ticket is obtained.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the microservice-based digital ticket generation method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the microservice-based digital ticket generation method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Electronic invoice making out system apparatus

    CN106530021A

  • Automatic invoicing method, device and equipment for full-electricity invoices and storage medium

    CN116757762A