An implementation method and device for circumventing repeated internet invoicing
By introducing Redis caching and RabbitMQ message queues into the internet invoicing system, combined with database optimistic locking, the problem of duplicate invoice issuance was solved, achieving efficient data interception and reduced system pressure.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AISINO CORPORATION
- Filing Date
- 2022-11-17
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies in online invoicing systems have failed to effectively prevent duplicate invoices, resulting in high system load and the need for frequent database interactions.
By introducing a Redis caching mechanism and a RabbitMQ message queue, duplicate requests are intercepted at the initial stage of the invoicing process through multiple duplicate data interception mechanisms, and data locking is performed using database optimistic locking and caching mechanisms.
This effectively avoids duplicate invoices, reduces the frequency of database operations, lowers the pressure on the system server, and improves data security and cleanliness.
Smart Images

Figure CN115757490B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and more particularly, to an implementation method and device for avoiding repeated internet invoice issuing. BACKGROUND
[0002] With the proposal of the concept of internet invoice issuing, one-stop invoice issuing technology also emerges as the times require. In order to implement internet one-stop invoice issuing, different business systems need to be connected. If there is no restriction on repeated invoice issuing, the same invoice will be issued multiple times, that is, repeated invoice issuing. In order to avoid such situations, the existing technology is to screen out a unique invoice after identifying repeated invoices in multiple systems. The method is to first load a first invoice with an index number in a predetermined time period, then search another invoice with the same index number from the database, and if found, replace the other invoice with the first invoice; and delete the first invoice considered to have been compared from the database. This method performs invoice deduplication after the invoice issuing is completed, which needs to repeatedly operate the database and brings great pressure to the system. SUMMARY
[0003] In view of the deficiencies of the prior art, the present application provides an implementation method and device for avoiding repeated internet invoice issuing.
[0004] According to one aspect of the present application, an implementation method for avoiding repeated internet invoice issuing is provided, comprising:
[0005] receiving a service request for issuing an invoice from a user terminal, and parsing an invoice number to be issued from a request message;
[0006] accessing a Redis server, and using a cache mechanism to intercept repeated requests for the invoice to be issued according to the invoice number;
[0007] in the case where the repeated request interception is passed, intercepting data of the invoice to be issued in a cache list of a database according to the invoice number;
[0008] in the case where the data interception is passed, intercepting repeated data of the invoice to be issued through a RabbitMQ message queue according to the invoice number;
[0009] in the case where the repeated data interception is passed, intercepting repeated issuing of the invoice to be issued in an issuing list of the database, and in the case where the repeated issuing interception is passed, completing the issuing of the invoice to be issued and sending it to the user terminal.
[0010] Optionally, the operation of accessing the Redis server and using the cache mechanism to intercept repeated requests for the invoice to be issued according to the invoice number comprises:
[0011] obtaining the business request cache information of the Redis server according to the bill number;
[0012] In the case that the business request cache information is empty, the business request to be invoiced is cached in the Redis server;
[0013] In the case that the cache information exists, the business request is intercepted.
[0014] Optionally, the operation of intercepting the data to be invoiced according to the bill number in the cache list of the database comprises:
[0015] According to the bill number, the bill information of the data to be invoiced is queried in the cache list, and in the case that the bill information is not locked, an optimistic lock is added to the data to be invoiced in the cache list;
[0016] In the case that the bill information is locked, the business request is intercepted.
[0017] Optionally, the operation of intercepting the repeated data to be invoiced comprises:
[0018] According to the bill number, it is queried whether the data to be invoiced exists in the RabbitMQ message queue, and in the case that the data to be invoiced does not exist, the data to be invoiced is added to the RabbitMQ message queue;
[0019] In the case that the data to be invoiced exists, the business request is intercepted.
[0020] Optionally, in the case that the repeated data interception passes, the operation of intercepting the repeated invoicing of the data to be invoiced in the issuing list of the database comprises:
[0021] The data to be invoiced is taken out from the RabbitMQ message queue, and is queried in the issuing list in the database, and in the case that the already invoiced information corresponding to the data to be invoiced is not queried, the data to be invoiced is issued;
[0022] In the case that the already invoiced information corresponding to the data to be invoiced is queried, the business request is intercepted.
[0023] Optionally, after the operation of completing the issuance of the data to be invoiced and sending to the user terminal, further comprising:
[0024] The cache information of the data to be invoiced is deleted from the Redis server;
[0025] The information of the data to be invoiced is deleted from the cache list of the database.
[0026] According to another aspect of the present application, an implementation device for avoiding repeated invoicing on the Internet is provided, comprising:
[0027] The analysis module is configured to receive a service request for issuing an invoice from a user terminal, and analyze a document number to be invoiced from a request message;
[0028] The repeated request interception module is configured to access a Redis server, and intercept a repeated request for the document to be invoiced according to the document number by using a cache mechanism.
[0029] The data interception module is configured to intercept data of the document to be invoiced in a cache list of a database according to the document number when the repeated request interception passes.
[0030] The repeated data interception module is configured to intercept repeated data of the document to be invoiced by using a RabbitMQ message queue according to the document number when the data interception passes.
[0031] The repeated invoice interception module is configured to intercept a repeated invoice of the document to be invoiced in an invoice list of the database, and complete the issuance of the document to be invoiced and send the document to the user terminal when the repeated data interception passes.
[0032] According to another aspect of the present application, a computer readable storage medium is provided, which stores a computer program for executing the method according to any one of the above aspects of the present application.
[0033] According to another aspect of the present application, an electronic device is provided, which comprises a processor, a memory for storing executable instructions of the processor, and the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method according to any one of the above aspects of the present application.
[0034] Therefore, the method provided by the present application introduces Redis and a RabbitMQ message queue into an Internet invoicing system to form a one-stop invoicing mode, and the repeated data operation interception is performed in an initial stage of an invoicing process, multiple repeated data interception mechanisms are set to effectively avoid the repeated issuance of invoices, so that the data is more secure and effective, and the database data is more neat. Since this mode does not need frequent interaction between a system program and a database, the pressure on a system server is effectively reduced. BRIEF DESCRIPTION OF DRAWINGS
[0035] The exemplary embodiments of the present application can be more completely understood by reference to the following drawings:
[0036] Figure 1 is a flowchart of an implementation method for avoiding repeated issuance of invoices on the Internet according to an exemplary embodiment of the present application;
[0037] Figure 2A configuration interface diagram of a virtual host provided by the RabbitMQ in an exemplary embodiment of the present application;
[0038] Figure 3 A configuration interface diagram of a virtual host provided by the RabbitMQ in an exemplary embodiment of the present application;
[0039] Figure 4 A configuration interface diagram of an exchange provided by the RabbitMQ in an exemplary embodiment of the present application;
[0040] Figure 5 A configuration interface diagram of a queue bound to an exchange provided by the RabbitMQ in an exemplary embodiment of the present application;
[0041] Figure 6 A configuration interface diagram of a queue provided by the RabbitMQ in an exemplary embodiment of the present application;
[0042] Figure 7 A structure diagram of an implementation device for avoiding repeated Internet invoices.
[0043] Figure 8 A structure of an electronic device. DETAILED DESCRIPTION
[0044] Hereinafter, example embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part but not all of the embodiments of the present application, and thus cannot be used to limit the scope of the present application. Various embodiments of the present application can be implemented in other specific forms without departing from the spirit of the present application.
[0045] It should be noted that: unless otherwise specifically stated, the relative arrangement, numerical expressions and values of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0046] Those skilled in the art can understand that the terms "first", "second" and the like in the embodiments of the present application are only used to distinguish different steps, devices or modules, and do not represent any specific technical meaning, nor do they represent the inherent logical order.
[0047] It should also be understood that in the embodiments of the present application, "a plurality of" can mean two or more, and "at least one" can mean one, two or more.
[0048] It should also be understood that for any component, data or structure mentioned in the embodiments of the present application, unless specifically limited or given a contrary implication by the context, it can be understood as one or more in general.
[0049] In addition, the term "and / or" in the present application is only used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. In addition, the character " / " in the present application generally represents an "or" relationship between the front and rear associated objects.
[0050] It should also be understood that the description of the present application for each embodiment emphasizes the differences between each embodiment, and the same or similar parts can be referred to each other, and for the sake of brevity, will not be repeated.
[0051] At the same time, it should be understood that, for the convenience of description, the size of each part shown in the drawings is not drawn according to the actual proportional relationship.
[0052] The following description of at least one example embodiment is merely illustrative in nature and is in no way intended to limit the application or its application or use.
[0053] The techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail, but in appropriate cases, the techniques, methods, and devices should be considered as part of the specification.
[0054] It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0055] Embodiments of the present application can be applied to terminal devices, computer systems, servers and other electronic devices, which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with terminal devices, computer systems, servers and other electronic devices include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems and distributed cloud computing technology environments including any of the above systems, etc.
[0056] Electronic devices such as terminal devices, computer systems, servers, and the like can be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules can include routines, programs, objects, components, logic, data structures, and the like that perform particular tasks or implement particular abstract data types. Computer systems / server can be practiced in distributed cloud computing environments with other computer systems coupled via communication networks. The program modules can be stored in the local or remote computer system memory devices including memory storage devices.
[0057] Exemplary method
[0058] Figure 1 Fig. 1 is a flowchart illustrating an implementation method for avoiding repeated invoice issuing on the Internet according to an exemplary embodiment of the present application. The present embodiment can be applied on electronic devices such as Figure 1 As shown in Fig. 1, the implementation method 100 for avoiding repeated invoice issuing on the Internet includes the following steps:
[0059] Step 101, receiving a service request for issuing an invoice from a user terminal, and parsing a document number to be invoiced from the request message;
[0060] Step 102, accessing a Redis server, and using a cache mechanism to intercept a repeated request for the document to be invoiced according to the document number;
[0061] Step 103, in the case that the repeated request interception is passed, intercepting data for the document to be invoiced in a cache list of a database according to the document number;
[0062] Step 104, in the case that the data interception is passed, intercepting repeated data for the document to be invoiced through a RabbitMQ message queue according to the document number;
[0063] Step 105, in the case that the repeated data interception is passed, intercepting repeated issuing for the document to be invoiced in an issuing list of the database, and in the case that the repeated issuing interception is passed, completing the issuing of the document to be invoiced and sending it to the user terminal.
[0064] Optionally, the operation of accessing the Redis server and using the cache mechanism to intercept the repeated request for the document to be invoiced according to the document number includes:
[0065] Obtaining service request cache information of the Redis server according to the document number;
[0066] In the case that the service request cache information is empty, caching the service request for the document to be invoiced in the Redis server;
[0067] Intercept the business request in the case of existing cache information.
[0068] Optionally, the operation of intercepting the data to be invoiced in the cache list of the database according to the invoice number comprises:
[0069] According to the invoice number, the invoice information to be invoiced is queried in the cache list, and an optimistic lock is added to the invoice to be invoiced in the cache list in the case of unlocked invoice information.
[0070] Intercept the business request in the case of locked invoice information.
[0071] Optionally, the operation of intercepting the repeated data to be invoiced through the RabbitMQ message queue comprises:
[0072] According to the invoice number, it is queried whether the invoice to be invoiced exists in the RabbitMQ message queue, and the invoice to be invoiced is added to the RabbitMQ message queue in the case of non-existing invoice to be invoiced.
[0073] Intercept the business request in the case of existing invoice to be invoiced.
[0074] Optionally, the operation of intercepting the repeated invoicing to be invoiced in the issuing list of the database in the case of passing repeated data interception comprises:
[0075] The invoice to be invoiced is taken out from the RabbitMQ message queue, and is queried in the issuing list in the database, and the invoice to be invoiced is invoiced in the case of not querying the corresponding invoiced information.
[0076] Intercept the business request in the case of querying the corresponding invoiced information.
[0077] Optionally, after the operation of completing the invoicing of the invoice to be invoiced and sending it to the user terminal, it further comprises:
[0078] The cache information of the invoice to be invoiced is deleted from the Redis server.
[0079] The information of the invoice to be invoiced is deleted from the cache list of the database.
[0080] Specifically, the Redis server is used to cache the invoice number in the billing request, and the invoice number is a unique value in the system. The VAT system determines whether the invoice is being processed by querying whether there is cached data in Redis. The Internet billing request interface of the VAT system is called by the different business systems of various enterprises. The VAT system first parses the received Internet invoice request message to obtain the invoice number, and then accesses the Redis server to obtain the cached information according to the invoice number. If the information can be obtained, the VAT system intercepts the Internet billing request through the first interception mechanism and returns a prompt message that the invoice is being processed. If the data cannot be obtained, the invoice number is cached in Redis, and the Redis cache information of the invoice is cleared after the background invoice billing is completed.
[0081] After the request passes through the first interception mechanism, the corresponding related invoice data in the database is queried, the data is placed in the cache after being queried, and the database data is added with an optimistic lock, and the data is marked as a locked state. Then, the VAT system performs the second interception mechanism to intercept and judge whether the data in the cache is in a locked state. If the data is in a locked state, the request is intercepted and a prompt message that the data is locked and cannot be operated is returned. The data is unlocked after the background invoice billing is completed.
[0082] After the request passes through the second interception mechanism, the VAT system acts as a RabbitMQ producer, i.e., a data sender (producer). Before sending the message, an attribute is generated, which can carry a lot of information, one of which uses the invoice number as a unique MessageId. Then, when sending the message to the exchange, the attribute is carried to perform the third interception mechanism. If the MessageId already exists in the message queue, the current data is discarded.
[0083] After the data passes through the third interception mechanism, it waits for the system to automatically bill, and then a message queue listening program listens to the queue to obtain the invoice data for processing. At this time, the last interception is performed to check whether the invoice has been issued. If the invoice has been issued in the database, the issuance of the invoice is abandoned. If the invoice has not been issued, the billing process is performed. After the entire billing process is completed, the data is unlocked to release the operation permission of the data.
[0084] The configuration steps of the RabbitMQ message queue are as follows:
[0085] Step 1: Create a virtual host virtual-host with the name DJ007MQ (interface as shown in Figure 2 ). Then authorize the user to access the virtual machine (interface as shown in Figure 3 );
[0086] Step 2: Add the exchange name exchangeCredit, set the type of exchange to direct, forward the message to the Queue with the specified Routingkey, and the Routingkey resolution rule is exact match (interface as Figure 4 ) Then bind the Queue, name djCreditInsurance (interface as Figure 5 ) ;
[0087] Step 3: Add the Queue name djCreditInsurance, which is a Queue used to store messages, and the messages sent by the producer will be placed in the Queue, and the consumer will also take the messages from the Queue. (interface as Figure 6 ).
[0088] Thus, in the present application, 1, Redis and AMQP technology are used at the same time, and the repeated data request invoicing interception is realized through the cache mechanism and the message unique mechanism; 2, the RabbitMQ middleware is integrated, so that the invoicing request is queued for processing, which greatly relieves the pressure of the system in high concurrency, and effectively intercepts the repeated data. 3, the database optimistic lock is used for data locking.
[0089] The purpose of the present application is to emphasize that the business of avoiding repeated invoicing is placed in the beginning stage of the invoicing process, and the Redis (RemoteDictionaryServer) technology and the AMQP (Advanced Message Queuing Protocol) technology are combined to realize the limitation of repeated invoices from the beginning of invoicing, so that the loophole of repeated invoicing is fundamentally solved, the number of dirty data in the database is reduced, and the database data is more neat.
[0090] Therefore, the method provided by the present application introduces Redis and AMQP technology into the Internet invoicing system to form a one-stop invoicing mode, and the data repeated operation interception is performed in the initial stage of the invoicing process, the multiple repeated data interception mechanism is set, the occurrence of repeated invoicing is effectively avoided, the data is more safe and effective, the database data is more neat, and since this way does not need frequent interaction between the system program and the database, the pressure of the system server is effectively reduced.
[0091] Exemplary apparatus
[0092] Figure 7 It is a structure schematic view of the implementation device for avoiding repeated invoicing of the Internet provided by an exemplary embodiment of the present application. As shown in Figure 7 , the device 700 comprises:
[0093] The analysis module 710 is configured to receive a service request for issuing an invoice from a user terminal, and analyze a document number to be invoiced from the request message;
[0094] The repeated request interception module 720 is configured to access a Redis server, and intercept a repeated request for the document to be invoiced by using a cache mechanism according to the document number.
[0095] The data interception module 730 is configured to, in a case where the repeated request interception passes, intercept data of the document to be invoiced in a cache list of a database according to the document number.
[0096] The repeated data interception module 740 is configured to, in a case where the data interception passes, intercept repeated data of the document to be invoiced by using a RabbitMQ message queue according to the document number.
[0097] The repeated issuance interception module 750 is configured to, in a case where the repeated data interception passes, intercept repeated issuance of the document to be invoiced in an issuance list of the database, and complete issuance of the document to be invoiced and send the document to the user terminal in a case where the repeated issuance interception passes.
[0098] Optionally, the repeated request interception module comprises:
[0099] The acquisition sub-module is configured to acquire service request cache information of the Redis server according to the document number.
[0100] The cache sub-module is configured to, in a case where the service request cache information is empty, cache the service request for the document to be invoiced in the Redis server.
[0101] The first interception sub-module is configured to, in a case where the cache information exists, intercept the service request.
[0102] Optionally, the data interception module 730 comprises:
[0103] The first adding sub-module is configured to query document information of the document to be invoiced in the cache list according to the document number, and add an optimistic lock to the document to be invoiced in the cache list in a case where the document information is not locked.
[0104] The second interception sub-module is configured to, in a case where the document information is locked, intercept the service request.
[0105] Optionally, the repeated data interception module 740 comprises:
[0106] The second adding sub-module is configured to query whether the document to be invoiced exists in the RabbitMQ message queue according to the document number, and add the document to be invoiced to the RabbitMQ message queue in a case where the document to be invoiced does not exist.
[0107] The third intercepting sub-module is configured to intercept the service request in the case that the invoice to be developed exists.
[0108] Optionally, the repeated issuing intercepting module 750 comprises:
[0109] The issuing sub-module is configured to take out the invoice to be developed from the RabbitMQ message queue, and query the invoice to be developed in the issuing list in the database, and issue the invoice to be developed in the case that no developed invoice information corresponding to the invoice to be developed is queried.
[0110] The fourth intercepting sub-module is configured to intercept the service request in the case that the developed invoice information corresponding to the invoice to be developed is queried.
[0111] Optionally, after the operation of completing the issuing of the invoice to be developed and sending to the user terminal, the apparatus 700 further comprises:
[0112] The first deleting module is configured to delete the cache information of the invoice to be developed from the Redis server.
[0113] The second deleting module is configured to delete the information of the invoice to be developed from the cache list in the database.
[0114] Exemplary electronic device
[0115] Figure 8 Figure 8 illustrates an example of an electronic device according to an example embodiment of the present application. As shown in Figure 8, the electronic device 80 comprises one or more processors 81 and a memory 82. Figure 8
[0116] The processor 81 can be a central processing unit (CPU) or other form of processing unit that has data processing and / or instruction execution capabilities, and can control other components in the electronic device to perform desired functions.
[0117] The memory 82 can comprise one or more computer program products that can comprise various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory, for example, can include random access memory (RAM), cache memory, and / or the like. The non-volatile memory, for example, can include read-only memory (ROM), hard disk, flash memory, and / or the like. One or more computer program instructions can be stored on the computer-readable storage media, and the processor 81 can run the program instructions to implement the methods of the software programs of the embodiments of the present application described above and / or other desired functions. In one example, the electronic device can further comprise an input device 83 and an output device 84, and these components are interconnected by a bus system and / or other forms of connection mechanism (not shown).
[0118] Further, the input device 83 can include, for example, a keyboard, a mouse, and the like.
[0119] The output device 84 can output various information to the outside. The output device 84 can include, for example, a display, a speaker, a printer, and a communication network and a remote output device connected thereto, and the like.
[0120] Of course, in order to simplify, Figure 8 Only some of the components of the electronic device related to the present application are shown in FIG. 8, and components such as a bus, an input / output interface, and the like are omitted. In addition to this, the electronic device can include any other appropriate components according to the specific application.
[0121] Exemplary computer program product and computer readable storage medium
[0122] In addition to the above-mentioned methods and devices, embodiments of the present application can also be a computer program product including computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the methods according to various embodiments of the present application described in the above "Exemplary Methods" section of the specification.
[0123] The computer program product can be written in any combination of one or more programming languages, including an object-oriented programming language such as Java, C++, and the like, and conventional procedural programming languages, such as the "C" programming language, or the like. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
[0124] In addition, embodiments of the present application can also be a computer readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the method of information mining on the history change record according to various embodiments of the present application described in the above "Exemplary Methods" section of the specification.
[0125] The computer readable storage medium can be any combination of one or more computer readable medium(s). The computer readable medium can be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, or apparatus or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0126] The above generally describes the basic principles of the application in connection with specific embodiments. It should be noted that the advantages, benefits, effects, and the like mentioned in the present application are only examples and are not limiting, and these advantages, benefits, effects, and the like cannot be considered as necessary for each embodiment of the present application. In addition, the above specific details disclosed are only for the purpose of example and understanding, and are not limiting, and the above details do not limit the present application to be necessarily implemented with the above specific details.
[0127] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts between each embodiment can be understood by mutual reference. For system embodiments, since they basically correspond to method embodiments, the description is relatively simple, and the relevant parts can be understood by referring to the part of the method embodiment.
[0128] The block diagrams of the devices, systems, apparatuses, systems involved in the present application are only illustrative examples and are not intended to require or imply that the connection, arrangement, configuration must be as shown in the block diagram. As those skilled in the art will recognize, these devices, systems, apparatuses, systems can be connected, arranged, configured in any manner. Words such as "include", "contain", "have", and the like are open-ended words, mean "including but not limited to", and can be used interchangeably. The words "or" and "and" used herein mean the word "and / or", and can be used interchangeably unless the context clearly indicates otherwise. The word "such as" used herein means the phrase "such as but not limited to", and can be used interchangeably.
[0129] The methods and systems of the present application can be implemented in a number of ways. For example, the methods and systems of the present application can be implemented via software, hardware, firmware, or any combination of software, hardware, and firmware. The above described order of steps for the methods is merely illustrative, and the steps of the methods of the present application are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, the present application can also be implemented as a program recorded on a recording medium, which includes machine readable instructions for implementing the methods according to the present application. Thus, the present application also covers recording media storing programs for executing the methods according to the present application.
[0130] It is also important to note that the systems, devices and methods of the present application can be embodied in a variety of forms without departing from the spirit of the application. Specifically, the systems, devices and methods of the present application can be implemented using hardware, software, firmware, or any combination thereof. In some embodiments, the systems, devices and methods of the present application can be implemented as computer programs or program code containing instructions for implementing the methods of the present application. It will be appreciated that such computer programs or program code can be implemented in a plurality of forms, including, but not limited to, a prior art programming language, such as assembly language, a higher level procedural language such as C, or higher level object oriented language such as C++. Additionally, it will be appreciated that the present application can be implemented as a program or programs stored on a recording medium, which includes machine readable instructions for implementing the methods according to the present application.
[0131] The above description is given for the sake of example and description and is not intended to be limiting. Furthermore, the description does not limit the scope of the embodiments to the forms disclosed herein. Although various example aspects and embodiments have been discussed, those of skill in the art will recognize that certain variations, modifications, additions, and sub-combinations are possible without departing from the scope of the application.
Claims
1. A method for circumventing Internet duplicate invoice generation, comprising: The method comprises the following steps: receiving a service request for issuing an invoice from a user terminal, and parsing a document number to be invoiced from a request message; accessing a Redis server, and performing repeated request interception on the to-be-invoiced document according to the document number by using a cache mechanism; in a case where the repeated request interception is passed, performing data interception on the to-be-invoiced document in a cache list of a database according to the document number; in a case where the data interception is passed, performing repeated data interception on the to-be-invoiced document by using a RabbitMQ message queue according to the document number; in a case where the repeated data interception is passed, performing repeated issuance interception on the to-be-invoiced document in an issuance list of the database, and in a case where the repeated issuance interception is passed, completing issuance of the to-be-invoiced document and sending the to-be-invoiced document to the user terminal; the operation of accessing the Redis server and performing repeated request interception on the to-be-invoiced document according to the document number by using the cache mechanism comprises the following steps: obtaining service request cache information of the Redis server according to the document number; in a case where the service request cache information is empty, caching the service request of the to-be-invoiced document in the Redis server; in a case where the cache information exists, intercepting the service request; the operation of performing repeated data interception on the to-be-invoiced document by using the RabbitMQ message queue comprises the following steps: querying whether the to-be-invoiced document exists in the RabbitMQ message queue according to the document number, and in a case where the to-be-invoiced document does not exist, adding the to-be-invoiced document to the RabbitMQ message queue; in a case where the to-be-invoiced document exists, intercepting the service request.
2. The method of claim 1, wherein, the operation of performing data interception on the to-be-invoiced document in the cache list of the database according to the document number comprises the following steps: querying document information of the to-be-invoiced document in the cache list according to the document number, and in a case where the document information is not locked, adding an optimistic lock to the to-be-invoiced document in the cache list; in a case where the document information is locked, intercepting the service request.
3. The method of claim 1, wherein, the operation of performing repeated issuance interception on the to-be-invoiced document in the issuance list of the database in a case where the repeated data interception is passed comprises the following steps: taking out the to-be-invoiced document from the RabbitMQ message queue, and querying in the issuance list in the database, and in a case where no already-invoiced document information corresponding to the to-be-invoiced document is queried, issuing the to-be-invoiced document; in a case where the already-invoiced document information corresponding to the to-be-invoiced document is queried, intercepting the service request.
4. The method of claim 1, wherein, after the operation of completing issuance of the to-be-invoiced document and sending the to-be-invoiced document to the user terminal, the following operations are further included: deleting cache information of the to-be-invoiced document from the Redis server; deleting information of the to-be-invoiced document from the cache list of the database.
5. An apparatus for circumventing Internet duplicate invoice generation, comprising: The method comprises the following steps: a parsing module is configured to receive a service request for issuing an invoice from a user terminal, and parse a document number to be invoiced from a request message; The repeated request interception module is configured to access a Redis server, and perform repeated request interception on the to-be-invoiced bill according to the bill number by using a cache mechanism. The data interception module is configured to, when the repeated request interception passes, perform data interception on the to-be-invoiced bill in a cache list of a database according to the bill number. The repeated data interception module is configured to, when the data interception passes, perform repeated data interception on the to-be-invoiced bill by using a RabbitMQ message queue according to the bill number. The repeated invoicing interception module is configured to, when the repeated data interception passes, perform repeated invoicing interception on the to-be-invoiced bill in an invoicing list of the database, and complete the invoicing of the to-be-invoiced bill and send the to-be-invoiced bill to the user terminal when the repeated invoicing interception passes. The repeated request interception module comprises: The obtaining submodule is configured to obtain business request cache information of the Redis server according to the bill number. The cache submodule is configured to cache the business request of the to-be-invoiced bill in the Redis server when the business request cache information is empty. The first interception submodule is configured to intercept the business request when the cache information exists. The repeated data interception module comprises: The repeated data interception module is configured to, according to the bill number, query whether the to-be-invoiced bill exists in the RabbitMQ message queue, and add the to-be-invoiced bill to the RabbitMQ message queue when the to-be-invoiced bill does not exist. The repeated data interception module is configured to intercept the business request when the to-be-invoiced bill exists.
6. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program is configured to execute the method in any one of claims 1-4.
7. An electronic device, comprising: The electronic device comprises: A processor; A memory configured to store executable instructions of the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method in any one of claims 1-4. The electronic device comprises: A processor; A memory configured to store executable instructions of the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method in any one of claims 1-4.
Citation Information
Patent Citations
Invoice generation method and device
CN110880131A
Invoice generation method and device, electronic equipment and storage medium
CN115271835A