Electronic bill consolidation accounting method, device, equipment and medium
By combining and combining the to-process charging bills in memory, generating the combined bills and sending them to the database, the problem of inefficient accounting system processing when users are centrally charged in the electric vehicle industry is solved, and efficient bill accounting and Database pressure reduction.
Patent Information
- Application Number
- CN202411578776.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-07
AI Technical Summary
In the electric vehicle industry, when users are charging in a centralized manner, the accounting system receives a large number of charging bills, resulting in inefficient database processing and prone to blockage in the processing process.
The electronic bill merged accounting method is adopted to combine and merge the electronic bills to be processed in memory, generate the combined electronic bills and send them to the database for accounting, which improves processing efficiency and reduces the pressure of database processing.
When a large number of pending electronic bills are received, the accounting efficiency of electronic bills is improved through merge processing, the processing pressure of the database is reduced, and the processing process is avoided.
Smart Images

Figure CN119067796B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an electronic bill consolidation accounting method, device, equipment and medium. Background Art
[0002] With the continuous development of the electric vehicle industry, users' demand for charging is gradually increasing. Since users' choice of charging time is affected by factors such as working hours and charging costs, it is easy for a large number of charging bills to be submitted within a certain period of time.
[0003] At present, the database records charging bills one by one. Therefore, when a large number of charging bills are received in a short period of time, the processing efficiency is low and the processing process is prone to blockage. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide an electronic bill merging accounting method, which can preferentially group and merge a large number of unprocessed electronic bills in the memory when a large number of unprocessed electronic bills are received in a short period of time, and send the merged electronic bills to the database for accounting, thereby improving the processing efficiency of the electronic bills and reducing the processing pressure on the database.
[0005] In a first aspect, an embodiment of the present invention provides an electronic bill consolidation accounting method, which is applied to a server and includes:
[0006] Sequentially acquiring account lock information of at least one to-be-processed electronic bill group; wherein the to-be-processed electronic bill group includes at least one to-be-processed electronic bill, and the account lock information set for each to-be-processed electronic bill is the same;
[0007] In the case where the account lock information is successfully obtained, initial bill information and initial version information corresponding to the electronic bill group to be processed are obtained;
[0008] Reading bill information of the first electronic bill to be processed in the group of electronic bills to be processed;
[0009] Accumulate the billing amount in the billing information and the billing amount in the initial billing information, update the accumulated amount as the billing amount in the initial billing information, and update the initial version information;
[0010] According to a preset sequence, the next electronic bill is updated as the first electronic bill to be processed, and the process of returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed is performed;
[0011] Until there is no unprocessed first electronic bill to be processed in the electronic bill group to be processed, the updated initial bill information is sent to the database as the combined bill information so that the database records the combined bill information, and the account lock information is released.
[0012] In a preferred embodiment of the present invention, before sequentially obtaining the account lock information of at least one electronic bill group to be processed, the following steps are included:
[0013] Obtaining bill information of at least one pending electronic bill;
[0014] In the case where the accounting thread is occupied, setting corresponding account lock information for each of the electronic bills to be processed according to the account information of each of the electronic bills to be processed;
[0015] The electronic bills to be processed are grouped according to the account lock information corresponding to the electronic bills to be processed to obtain at least one electronic bill group to be processed.
[0016] In a preferred embodiment of the present invention, after obtaining the bill information of at least one electronic bill to be processed, the method further includes:
[0017] When the accounting thread is idle, using the accounting thread, according to the reception time of each of the electronic bills to be processed, the bill information of the first electronic bill to be processed is sent to the database, so that the database records the bill information of the first electronic bill to be processed;
[0018] The other pending electronic bills except the first pending electronic bill are stored in the memory of the server, and the accounting thread is released.
[0019] In a preferred embodiment of the present invention, before the account lock information is successfully obtained, the following steps are also included:
[0020] If the account lock information acquisition fails, obtain the account lock status;
[0021] When the account lock state is downtime, obtaining the number of electronic bill groups to be processed;
[0022] According to the number of the electronic bill groups to be processed, at least one synchronous accounting thread for parallel execution is established; wherein the number of the synchronous accounting threads is the same as the number of the electronic bill groups to be processed, and one synchronous accounting thread corresponds to one electronic bill group to be processed;
[0023] For each synchronous accounting thread, the bill information of each to-be-processed electronic bill in the corresponding to-be-processed electronic bill group is recorded in the database.
[0024] In a preferred embodiment of the present invention, the above-mentioned recording the bill information of each to-be-processed electronic bill in the corresponding to-be-processed electronic bill group in the database includes:
[0025] Reading the bill information of each electronic bill to be processed in the corresponding electronic bill group to be processed in sequence;
[0026] The bill information of the electronic bill to be processed is sent to a database so that the database records the bill information of the electronic bill to be processed.
[0027] In a preferred embodiment of the present invention, in the case where the account lock information acquisition fails, after acquiring the account lock status, the following steps are performed:
[0028] When the account lock state is locked, return to the step of sequentially acquiring the account lock information of the at least one to-be-processed electronic bill group.
[0029] In a second aspect, an embodiment of the present invention further provides an electronic bill consolidation accounting device, comprising:
[0030] An account lock acquisition module, used to sequentially acquire account lock information of at least one to-be-processed electronic bill group; wherein the to-be-processed electronic bill group includes at least one to-be-processed electronic bill, and the account lock information set for each to-be-processed electronic bill is the same;
[0031] An initial information acquisition module, configured to acquire initial bill information and initial version information corresponding to the electronic bill group to be processed if the account lock information is successfully acquired;
[0032] A bill information acquisition module, used for reading bill information of the first electronic bill to be processed in the group of electronic bills to be processed;
[0033] A bill merging module, used to accumulate the billing amount in the billing information and the billing amount in the initial billing information, update the accumulated amount to the billing amount in the initial billing information, and update the initial version information;
[0034] A return module, used for updating the next electronic bill to the first electronic bill to be processed according to a preset sequence, and returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed;
[0035] The bill recording module is used to send the updated initial bill information as the combined bill information to the database until there is no unprocessed first electronic bill in the group of electronic bills to be processed, so that the database can record the combined bill information, and release the account lock information.
[0036] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the electronic bill consolidation accounting method of the first aspect mentioned above.
[0037] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the electronic bill consolidation accounting method of the first aspect mentioned above.
[0038] The embodiments of the present invention bring the following beneficial effects:
[0039] The embodiment of the present invention provides an electronic bill merging accounting method, which processes electronic bill groups to be processed as units. When the account lock is successfully acquired, the electronic bills to be processed in the electronic bill groups to be processed are merged and the merged bill information is recorded. When a large number of electronic bills to be processed are received, the large number of electronic bills to be processed can be preferentially grouped and merged in the memory, and the merged electronic bills are sent to the database for accounting. This can improve the processing efficiency of electronic bills, reduce the processing pressure of the database, and effectively avoid the situation where the database is blocked in the processing process.
[0040] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.
[0041] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A flowchart of an electronic bill consolidation accounting method provided by an embodiment of the present invention;
[0044] Figure 2 Another electronic bill consolidation accounting method provided by the embodiment of the present invention Figure 1 ;
[0045] Figure 3 Another electronic bill consolidation accounting method provided by the embodiment of the present invention Figure 2 ;
[0046] Figure 4 A schematic diagram of the structure of an electronic bill consolidation accounting device provided by an embodiment of the present invention;
[0047] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] With the continuous development of the electric vehicle industry, users' demand for charging piles is gradually increasing. Since users' choice of charging time is affected by factors such as commuting time and operation mode, it is easy for concentrated charging to occur within a certain period of time, and at this time, a large number of charging bills will be submitted to the accounting system.
[0050] At present, the accounting processing method for charging bills is to process them one by one, that is, when the accounting system receives the electronic bill, it will process the electronic bill in real time through the database and record the processing results in the database. Therefore, when the accounting system receives a large number of charging bills in a short period of time, the processing pressure of the database increases sharply. Affected by the database processing capacity, it is easy to be blocked, which seriously affects the processing efficiency of the electronic bill. Therefore, it is necessary to reduce the processing pressure of the database to improve the efficiency of electronic bill recording.
[0051] Based on this, an electronic bill consolidation accounting method provided by an embodiment of the present invention can consolidate and record the bill information of the bills to be processed based on the electronic bill group to be processed, greatly reducing the amount of data that needs to be processed by the database, thereby achieving the purpose of reducing the processing pressure of the database and improving the efficiency of electronic bill recording.
[0052] To facilitate understanding of this embodiment, a method for merging electronic bills disclosed in an embodiment of the present invention is first introduced in detail.
[0053] Example 1
[0054] The embodiment of the present invention provides an electronic bill consolidation accounting method, which is applied to a server and is suitable for a situation where an accounting system receives a large number of electronic bills to be processed in a short period of time. Figure 1 The flowchart of an electronic bill consolidation accounting method provided by an embodiment of the present invention. Figure 1 As shown, the electronic bill consolidation accounting method may include the following steps:
[0055] Step S101, sequentially obtaining account lock information of at least one electronic bill group to be processed.
[0056] A pending electronic bill refers to an electronic bill received by the accounting system and waiting to be recorded in the database. An electronic bill can be a bill generated when a user pays, or a bill generated when a user receives payment. In this embodiment, the electronic bill can be an electronic bill generated when a user charges a vehicle at a charging station, or it can be an electronic bill generated when a user consumes in other scenarios such as shopping. A pending electronic bill group refers to a set of pending electronic bills formed by at least one pending electronic bill. In this embodiment, a pending electronic bill group is a plurality of pending electronic bills submitted under the same account. Exemplarily, when a user pays the amount in an electronic bill, it is necessary to determine the account to pay. Different users can use the same account for payment, and the pending electronic bills paid using the same account are treated as a pending electronic bill group.
[0057] The account lock information is used to lock the database thread that processes the pending electronic bill group. It is understandable that when the database processes the pending electronic bill group, it establishes an accounting thread for the pending electronic bill group, and the number of accounting threads is one, that is, the database processes one pending electronic bill group at a time. The accounting thread can be locked by obtaining the account lock information, indicating that the database is processing the pending electronic bill group. The account locks of different pending electronic bill groups are different, and the account lock information set for each pending electronic bill in the same pending electronic bill group is the same.
[0058] Specifically, when the accounting system receives a large number of electronic bills in a short period of time, it will store the received electronic bills in the server memory as pending electronic bills, and at the same time feedback accounting information to the user to prompt the user that the electronic bills have been accounted. When the accounting system is idle or in use, the pending electronic bills are processed. The server groups the pending electronic bills in the process of storing the pending electronic bills to form a pending electronic bill group, and one pending electronic bill group corresponds to one account lock information. Exemplarily, in the process of storing the electronic bills in the memory, the Redis service can be used to assign account lock information to each pending electronic bill. It can be understood that the pending electronic bill contains account information. For multiple pending electronic bills with the same account information, the assigned account lock information is the same, and multiple pending electronic bills with the same account lock information are regarded as a pending electronic bill group. The number of pending electronic bill groups is at least one, and the account lock information of each pending single bill group is obtained in sequence according to the arrangement order of the pending electronic bill groups. Among them, the arrangement order of the pending electronic bill groups can be determined according to the time when the accounting system receives each pending electronic bill in the pending electronic bill group. For example, first, in the electronic bill group to be processed, the receiving time of each electronic bill to be processed is compared, and the earliest receiving time is selected as the receiving time of the electronic bill group to be processed. Then, the receiving time of the electronic bill group to be processed is sorted in chronological order, and the order is used as the arrangement order of the electronic bill group to be processed.
[0059] Step S102, when the account lock information is successfully obtained, the initial bill information and initial version information corresponding to the electronic bill group to be processed are obtained.
[0060] Successful acquisition of account lock information indicates that the accounting thread is idle and the database is not processing electronic bills. At this time, the accounting thread can record the pending electronic bill group corresponding to the account lock information. Failure to obtain account lock information indicates that the accounting thread is occupied and the database is processing electronic bills. At this time, the accounting thread cannot record the pending electronic bill group corresponding to the account lock information and needs to wait for the database to complete the processing of the electronic bills before re-acquiring the account lock information of the pending electronic bill group.
[0061] The initial bill information is used to record the merging result of each pending electronic bill in the pending electronic bill group. The bill information refers to the content stored in the electronic bill. Exemplarily, the bill information at least includes: customer type, account information and billing amount, etc. Among them, the customer type refers to the user information submitted by the user when using the billing system. Exemplarily, the customer type can be an individual or an enterprise. The account information refers to the account provided by the user for paying the billing amount. The billing amount refers to the amount that the user needs to pay. In the initial bill information, the billing amount can be set to a default value of 0. The account information and customer type in the initial bill information can be set according to the bill information of the pending electronic bill in the pending electronic bill group. Specifically, the account information and customer type of any pending electronic bill in the pending electronic bill group can be used as the account information and customer type of the initial bill information. The initial version information is used to describe the version of the initial bill information. It can be understood that in the process of merging the pending electronic bills in the pending electronic bill group, the initial version information is updated once each time a pending electronic bill is merged. The initial version information can be set according to actual conditions.
[0062] Specifically, when the account lock information is successfully obtained, the pending electronic bill group corresponding to the account lock is determined, and the initial bill information and initial version information corresponding to the pending electronic bill group are set according to the bill information of any pending electronic bill in the pending electronic bill group.
[0063] Step S103, reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed.
[0064] The first pending electronic bill refers to the pending electronic bill that the accounting system first receives in the pending electronic bill group. It is understood that when receiving the pending electronic bill, the accounting system records the receiving time of each pending electronic bill, sorts the pending electronic bills in the pending electronic bill group in the order of receiving time, and reads the bill information of the first pending electronic bill in the pending electronic bill group in the order of arrangement.
[0065] Step S104, the accounting amount in the billing information is accumulated with the accounting amount in the initial billing information, the accumulated amount is updated as the accounting amount in the initial billing information, and the initial version information is updated.
[0066] Accumulation means adding the accounting amount in the initial billing information to the accounting amount in the billing information. If the pending electronic bill is a bill generated when the user pays, the accounting amount is a positive number. If the pending electronic bill is a bill generated when the user receives payment, the accounting amount is a negative number.
[0067] Specifically, the account amount in the first electronic bill to be processed is added to the account amount in the initial bill information to obtain the addition result, that is, the cumulative amount, and the cumulative amount is used as the account amount in the initial bill information to update the initial bill information and update the initial version information. Exemplarily, the initial version information is 0, and updating the initial version information can be to update the initial version information to 1. The update rule of the initial version information can be set according to the actual situation.
[0068] Step S105, updating the next electronic bill to be processed as the first electronic bill to be processed according to the preset sequence, and returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed.
[0069] The preset order refers to the order in which the electronic bills to be processed in the electronic bill group to be processed are sorted in the order of the time of receipt. The next electronic bill refers to the electronic bill to be processed that is arranged after the first electronic bill to be processed according to the preset order. Specifically, after the first electronic bill to be processed is processed, the electronic bill to be processed that is arranged after the first electronic bill to be processed is updated to the first electronic bill to be processed, and the process returns to step S103.
[0070] Step S106, until there is no unprocessed first electronic bill in the electronic bill group to be processed, the updated initial bill information is sent to the database as the combined bill information, so that the database records the combined bill information, and the account lock information is released.
[0071] The unprocessed first pending electronic bill refers to the first pending electronic bill that has not been accumulated with the billing amount in the initial bill information. If there is no unprocessed first pending electronic bill in the pending electronic bill group, it means that all pending electronic bills in the pending electronic bill group have been merged. At this time, the initial bill information obtained in step S104 is the bill information obtained after the merger of each pending bill in the pending electronic bill group is completed, that is, the merged bill information.
[0072] Specifically, when there is no unprocessed first electronic bill to be processed in the electronic bill group to be processed, the updated initial bill information is sent to the database as the consolidated bill information. After receiving the consolidated bill information, the database queries the balance corresponding to the account information according to the account information in the consolidated bill information, accumulates the balance with the accounting amount in the consolidated bill information, and stores the accumulated result as the new balance in the database to realize the database's recording of the consolidated bill information. After the recording is completed, the account lock information is released to prompt the accounting system that the database has completed the processing of the electronic bill group to be processed.
[0073] Furthermore, before the updated initial bill information is sent to the database as the consolidated bill information, the consolidated bill information can be verified. The verification rules can be determined according to the actual situation. Exemplarily, the pending bill information also includes index information. It can be understood that for an electronic bill, there is a unique index. When a user submits an electronic bill to the accounting system, the same electronic bill may be submitted repeatedly. In this case, the duplicate pending electronic bill information can be deleted through the index information. When verifying the consolidated bill information, the pending electronic bills that have been merged can be checked through the index information to determine whether the index information of the pending electronic bills that have been merged is the same. If they are the same, it indicates that there is duplicated pending electronic bill information and the consolidated bill information is wrong. If they are different, it indicates that the consolidated bill information is correct.
[0074] By verifying the consolidated bill information, the accuracy of the consolidated bill information can be improved.
[0075] The electronic bill merging accounting method provided in the embodiment of the present invention processes the electronic bill group to be processed as a unit. When the account lock is successfully acquired, the electronic bills to be processed in the electronic bill group to be processed are merged and the merged bill information is recorded. When a large number of electronic bills to be processed are received, the data that needs to be recorded in the database can be greatly reduced, and fast accounting processing can be achieved, thereby improving the accounting efficiency of electronic bills, reducing the processing pressure of the database, and effectively avoiding the occurrence of processing process blockage.
[0076] Example 2
[0077] An embodiment of the present invention also provides another method for merging electronic bills; this method is implemented on the basis of the method in the above embodiment; this method focuses on describing the specific implementation method before sequentially obtaining the account lock information of at least one electronic bill group to be processed.
[0078] Figure 2 Another electronic bill consolidation accounting method provided by the embodiment of the present invention Figure 1 ,like Figure 2 As shown, the electronic bill consolidation accounting method may include the following steps:
[0079] Step S201, obtaining bill information of at least one electronic bill to be processed.
[0080] Unprocessed electronic bills refer to bills that the accounting system has received and needs to process. Bill information refers to the content of the electronic bill. Bill information at least includes: customer type, account information and bill amount, etc.
[0081] Specifically, the accounting system will receive the electronic bill sent by the user, and the electronic bill carries the bill information. It is understandable that when the user uses the charging pile to charge the electric vehicle, the user sends the electronic bill to the accounting system after the charging is completed. The accounting system can receive electronic bills sent by different users at the same time.
[0082] Step S202: when the accounting thread is occupied, corresponding account lock information is set for each of the electronic bills to be processed according to the account information of each of the electronic bills to be processed.
[0083] Specifically, when the accounting thread is occupied, the account information of the pending electronic bill can be obtained, and the account lock information can be allocated to the pending electronic bill according to the account information of the pending electronic bill through the Redis (Remote Dictionary Server) service. The account information corresponds to the account lock information, and the account information of the pending electronic bill is different, and the account lock information is different.
[0084] Step S203: grouping the electronic bills to be processed according to the account lock information corresponding to the electronic bills to be processed to obtain at least one electronic bill group to be processed.
[0085] Specifically, according to the account lock information corresponding to each to-be-processed electronic bill, the to-be-processed electronic bills with the same account lock information are grouped together to obtain at least one to-be-processed electronic bill group.
[0086] Furthermore, after obtaining the billing information of at least one pending electronic bill, it also includes: when the accounting thread is idle, using the accounting thread, according to the reception time of each pending electronic bill, sending the billing information of the first pending electronic bill to the database, so that the database can record the billing information of the first pending electronic bill; storing other pending electronic bills except the first pending electronic bill in the memory of the server, and releasing the accounting thread.
[0087] Among them, the accounting thread is idle, indicating that the database is not processing the electronic bill. The accounting thread is occupied, and the accounting thread is used to read the bill information of the first electronic bill to be processed in a preset order. Among them, the preset order can be the order of arrangement obtained by sorting each electronic bill to be processed according to the reception time of each electronic bill to be processed, or it can be the order of arrangement obtained by sorting each electronic bill to be processed according to other sorting rules. The bill information of the first electronic bill to be processed is sent to the database. After receiving the bill information of the first electronic bill to be processed, the database queries the balance corresponding to the account information according to the account information in the bill information, accumulates the balance and the accounting amount in the bill information, and stores the accumulated result as the new balance in the database to realize the database recording of the bill information. For other electronic bills to be processed except the first electronic bill to be processed, they are stored in the server memory, and the accounting thread is released to prompt the accounting system that the database has completed the processing of the electronic bill to be processed.
[0088] Step S204, sequentially obtain account lock information of at least one electronic bill group to be processed.
[0089] Step S205, when the account lock information is successfully obtained, the initial bill information and initial version information corresponding to the electronic bill group to be processed are obtained.
[0090] Step S206, reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed.
[0091] Step S207, the accounting amount in the billing information is accumulated with the accounting amount in the initial billing information, the accumulated amount is updated as the accounting amount in the initial billing information, and the initial version information is updated.
[0092] Step S208: updating the next electronic bill to be processed as the first electronic bill to be processed according to a preset sequence, and returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed.
[0093] Step S209, until there is no unprocessed first electronic bill to be processed in the electronic bill group to be processed, the updated initial bill information is sent to the database as the combined bill information, so that the database records the combined bill information, and the account lock information is released.
[0094] The electronic bill consolidation accounting method provided by the embodiment of the present invention realizes that when the accounting thread is occupied, the received electronic bill information is directly grouped to generate a pending electronic bill group, and the processing is performed after the subsequent account lock is successfully obtained, which effectively avoids the situation that the database processes multiple pending electronic bill groups in parallel and reduces the processing pressure of the database. When the accounting thread is idle, the first pending electronic bill can be recorded first, and other pending electronic bills can be stored in the memory, and then processed after the subsequent account lock is successfully obtained, which improves the flexibility of the electronic bill consolidation accounting method. The processing process of the first pending electronic bill can skip the account lock acquisition operation, which can effectively avoid the situation that the account lock acquisition fails and the account cannot be quickly recorded, simplifies the processing process of the first pending electronic bill, and improves the efficiency of accounting processing.
[0095] Example 3
[0096] The embodiment of the present invention also provides another electronic bill merging accounting method; this method is implemented on the basis of the method in the above embodiment; this method focuses on describing the specific implementation method in the case where the account lock information acquisition fails.
[0097] Figure 3 Another electronic bill consolidation accounting method provided by the embodiment of the present invention Figure 2 ,like Figure 3 As shown, the electronic bill consolidation accounting method may include the following steps:
[0098] Step S301, sequentially obtain account lock information of at least one electronic bill group to be processed.
[0099] Step S302: if the account lock information acquisition fails, the account lock status is acquired.
[0100] The account lock status is used to describe the reasons that cause the account lock to be abnormal. It can be understood that when the account lock is normal, the server can obtain the account lock information, and when the account lock is abnormal, the server cannot obtain the account lock information.
[0101] Step S303, when the account lock status is downtime, obtain the number of electronic bill groups to be processed.
[0102] The account lock status is down, which is used to describe that the reason for the failure to obtain the account information is the downtime of the Redis service. At this time, if the reason for the failure to obtain the account lock information is the downtime of the Redis service, that is, the account lock status is down, the server can count the electronic bill groups to be processed and obtain the number of electronic bill groups to be processed.
[0103] Step S304: establishing at least one synchronous accounting thread for parallel execution according to the number of electronic bill groups to be processed.
[0104] The number of synchronous accounting threads is the same as the number of electronic bill groups to be processed, and one synchronous accounting thread corresponds to one electronic bill group to be processed.
[0105] Specifically, according to the number of electronic bill groups to be processed, a corresponding synchronous accounting thread is established for each electronic bill group to be processed, so as to process each electronic bill group to be processed in parallel.
[0106] Step S305: for each synchronous accounting thread, the bill information of each to-be-processed electronic bill in the corresponding to-be-processed electronic bill group is recorded in the database.
[0107] For each synchronous accounting thread, the billing information of each pending electronic bill is sent to the database in turn according to a preset order. After the database receives the billing information of the pending electronic bill, it records the billing information of the pending electronic bill in the database.
[0108] Specifically, for each synchronous accounting thread, step A 1 -Step A 2 , perform synchronous accounting processing on the electronic bill group to be processed.
[0109] Step A 1 , read the bill information of each pending electronic bill in the corresponding pending electronic bill group in turn.
[0110] Specifically, for the pending electronic bill group processed by the synchronous accounting thread, the accounting system reads the bill information of each pending electronic bill in the pending electronic bill group from the memory in sequence. The reading order of the accounting system, that is, the order of reading the bill information of the pending electronic bill from the memory, can be the order of sorting the pending electronic bills in the pending electronic bill group according to the receiving time of each pending electronic bill, or the order of sorting the pending electronic bills according to other sorting rules.
[0111] Step A 2 , sending the billing information of the electronic bill to be processed to a database so that the database can record the billing information of the electronic bill to be processed.
[0112] The billing information of the electronic bills to be processed is sent to the database in the order in which the accounting system reads them. After receiving the billing information of the electronic bills to be processed, the database queries the balance corresponding to the account information based on the account information in the billing information, accumulates the balance with the accounting amount in the billing information, and stores the accumulated result as the new balance in the database, thereby realizing the database recording of the billing information.
[0113] Step S306, when the account lock state is locked, return to the step of sequentially acquiring the account lock information of the at least one to-be-processed electronic bill group.
[0114] The account lock status is locked, which is used to describe that the reason for the failure to obtain the account information is that the account lock is not released when the Redis service is restarted. At this time, if the account lock information fails to be obtained, the Redis service can be restarted again and the execution of step S301 can be returned, or the heartbeat processing can be set to re-initiate the accounting task through the heartbeat detection, that is, return to the execution of step S301.
[0115] Step S307, when the account lock information is successfully obtained, the initial bill information and initial version information corresponding to the electronic bill group to be processed are obtained.
[0116] Step S308: Read the bill information of the first electronic bill to be processed in the group of electronic bills to be processed.
[0117] Step S309, the accounting amount in the billing information is accumulated with the accounting amount in the initial billing information, the accumulated amount is updated as the accounting amount in the initial billing information, and the initial version information is updated.
[0118] Step S310: updating the next electronic bill to be processed as the first electronic bill to be processed according to a preset sequence, and returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed.
[0119] Step S311, until there is no unprocessed first electronic bill in the electronic bill group to be processed, the updated initial bill information is sent to the database as the combined bill information, so that the database records the combined bill information, and the account lock information is released.
[0120] The electronic bill consolidation accounting method provided by the embodiment of the present invention can skip the process of obtaining the account lock information when the account lock information fails to be obtained, and directly perform parallel processing on each group of electronic bills to be processed, thereby increasing the flexibility of the electronic bill consolidation accounting method. In the case of a failure in obtaining the account lock information, the accounting processing can be continued in a variety of ways, thereby improving the adaptability of the electronic bill consolidation accounting method to different situations. The parallel processing of each group of electronic bills to be processed is achieved through parallel processing accounting threads, thereby improving the processing efficiency of the group of electronic bills to be processed.
[0121] Example 4
[0122] Corresponding to the above method embodiment, the embodiment of the present invention provides an electronic bill consolidation accounting device, which is applied to a server. Figure 4 A schematic diagram of the structure of an electronic bill consolidation accounting device provided by an embodiment of the present invention, such as Figure 4 As shown, the electronic bill consolidation accounting device may include:
[0123] The account lock acquisition module 401 is used to sequentially acquire the account lock information of at least one to-be-processed electronic bill group; wherein the to-be-processed electronic bill group includes at least one to-be-processed electronic bill, and the account lock information set for each to-be-processed electronic bill is the same;
[0124] An initial information acquisition module 402 is used to acquire initial bill information and initial version information corresponding to the electronic bill group to be processed when the account lock information is successfully acquired;
[0125] The bill information acquisition module 403 is used to read the bill information of the first electronic bill to be processed in the electronic bill group to be processed;
[0126] The bill merging module 404 is used to accumulate the billing amount in the billing information and the billing amount in the initial billing information, update the accumulated amount to the billing amount in the initial billing information, and update the initial version information;
[0127] Return module 405, used for updating the next electronic bill to be the first electronic bill to be processed according to a preset sequence, and returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed;
[0128] The bill recording module 406 is used to send the updated initial bill information as the combined bill information to the database until there is no unprocessed first electronic bill in the group of electronic bills to be processed, so that the database can record the combined bill information, and release the account lock information.
[0129] The electronic bill consolidation accounting device provided by the embodiment of the present invention processes electronic bill groups to be processed as units. When the account lock is successfully obtained, the electronic bills to be processed in the electronic bill group to be processed are consolidated and processed, and the consolidated bill information is recorded. When a large number of electronic bills to be processed are received, the data that needs to be recorded in the database can be greatly reduced, and fast accounting processing can be achieved, thereby improving the accounting efficiency of electronic bills, reducing the processing pressure of the database, and effectively avoiding the occurrence of processing process blockage. By obtaining the account lock of the electronic bill group to be processed, when the account lock is successfully obtained, the electronic bills to be processed in the electronic bill group to be processed are consolidated and processed, thereby improving the accuracy of the accounting process.
[0130] In some embodiments, the electronic bill consolidation accounting device further includes:
[0131] A bill acquisition module, used to acquire bill information of at least one electronic bill to be processed;
[0132] A lock information setting module, used for setting corresponding account lock information for each of the electronic bills to be processed according to the account information of each of the electronic bills to be processed when the accounting thread is occupied;
[0133] The grouping module is used to group the electronic bills to be processed according to the account lock information corresponding to each electronic bill to be processed to obtain at least one electronic bill group to be processed.
[0134] In some embodiments, the electronic bill consolidation accounting device further includes:
[0135] An accounting module, configured to use the accounting thread to send the billing information of the first electronic bill to be processed to a database according to the receiving time of each electronic bill to be processed, so that the database can record the billing information of the first electronic bill to be processed;
[0136] The storage module is used to store the other pending electronic bills except the first pending electronic bill in the memory of the server and release the accounting thread.
[0137] In some embodiments, the electronic bill consolidation accounting device further includes:
[0138] A lock status acquisition module, used to acquire the account lock status when the account lock information acquisition fails;
[0139] A bill group quantity acquisition module, used to acquire the number of electronic bill groups to be processed when the account lock status is down;
[0140] A synchronization thread establishment module, used to establish at least one synchronization accounting thread for parallel execution according to the number of the electronic bill groups to be processed; wherein the number of the synchronization accounting threads is the same as the number of the electronic bill groups to be processed, and one synchronization accounting thread corresponds to one electronic bill group to be processed;
[0141] The synchronous accounting module is used to record the bill information of each pending electronic bill in the corresponding pending electronic bill group in the database for each synchronous accounting thread.
[0142] In some embodiments, the synchronous accounting module further includes:
[0143] A bill information reading unit, used to sequentially read bill information of each to-be-processed electronic bill in the corresponding to-be-processed electronic bill group;
[0144] The bill information of the electronic bill to be processed is sent to a database so that the database records the bill information of the electronic bill to be processed.
[0145] In some embodiments, the electronic bill consolidation accounting device further includes:
[0146] The return module is used to return to the step of sequentially acquiring the account lock information of the at least one to-be-processed electronic bill group when the account lock state is locked.
[0147] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0148] Example 5
[0149] The embodiment of the present invention also provides an electronic device for executing the above-mentioned electronic bill consolidation accounting method; see Figure 5 A structural schematic diagram of an electronic device is shown, which includes a memory 500 and a processor 501, wherein the memory 500 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 501 to implement the above-mentioned electronic bill consolidation accounting method.
[0150] Further, Figure 5 The electronic device shown further includes a bus 502 and a communication interface 503 , and the processor 501 , the communication interface 503 and the memory 500 are connected via the bus 502 .
[0151] The memory 500 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 503 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 502 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0152] The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 500, and the processor 501 reads the information in the memory 500 and completes the steps of the method of the above embodiment in combination with its hardware.
[0153] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned electronic bill consolidation accounting method. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0154] The computer program product for the method of electronic bill consolidation provided in the embodiment of the present invention includes a computer-readable storage medium storing a non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0155] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0156] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0158] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0159] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that can be executed by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.
[0160] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. An electronic bill consolidation accounting method, characterized in that: Applicable to servers, including: Sequentially acquiring account lock information of at least one to-be-processed electronic bill group; wherein the to-be-processed electronic bill group includes at least one to-be-processed electronic bill, and the account lock information set for each to-be-processed electronic bill is the same; In the case where the account lock information is successfully obtained, initial bill information and initial version information corresponding to the electronic bill group to be processed are obtained; Reading bill information of the first electronic bill to be processed in the group of electronic bills to be processed; Accumulate the billing amount in the billing information and the billing amount in the initial billing information, update the accumulated amount as the billing amount in the initial billing information, and update the initial version information; According to a preset sequence, the next electronic bill is updated as the first electronic bill to be processed, and the process of returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed is performed; Until there is no unprocessed first electronic bill to be processed in the electronic bill group to be processed, the updated initial bill information is sent to the database as the combined bill information so that the database records the combined bill information, and the account lock information is released.
2. The method according to claim 1, characterized in that Before sequentially obtaining the account lock information of at least one electronic bill group to be processed, the method further includes: Obtaining bill information of at least one pending electronic bill; In the case where the accounting thread is occupied, setting corresponding account lock information for each of the electronic bills to be processed according to the account information of each of the electronic bills to be processed; The electronic bills to be processed are grouped according to the account lock information corresponding to the electronic bills to be processed to obtain at least one electronic bill group to be processed.
3. The method according to claim 2, characterized in that After obtaining bill information of at least one electronic bill to be processed, the method further includes: When the accounting thread is idle, using the accounting thread, according to the reception time of each of the electronic bills to be processed, the bill information of the first electronic bill to be processed is sent to the database, so that the database records the bill information of the first electronic bill to be processed; The other pending electronic bills except the first pending electronic bill are stored in the memory of the server, and the accounting thread is released.
4. The method according to claim 1, characterized in that: Before the account lock information is successfully obtained, the method further includes: In case the account lock information acquisition fails, acquiring the account lock status; When the account lock state is downtime, obtaining the number of electronic bill groups to be processed; According to the number of the electronic bill groups to be processed, at least one synchronous accounting thread for parallel execution is established; wherein the number of the synchronous accounting threads is the same as the number of the electronic bill groups to be processed, and one synchronous accounting thread corresponds to one electronic bill group to be processed; For each synchronous accounting thread, the bill information of each to-be-processed electronic bill in the corresponding to-be-processed electronic bill group is recorded in the database.
5. The method according to claim 4, characterized in that The step of recording the bill information of each electronic bill to be processed in the corresponding electronic bill group to be processed in the database includes: Reading the bill information of each electronic bill to be processed in the corresponding electronic bill group to be processed in sequence; The bill information of the electronic bill to be processed is sent to a database so that the database records the bill information of the electronic bill to be processed.
6. The method according to claim 4, characterized in that In the case where the account lock information acquisition fails, after acquiring the account lock status, the method further includes: When the account lock state is locked, return to the step of sequentially acquiring the account lock information of the at least one to-be-processed electronic bill group.
7. An electronic bill consolidation accounting device, characterized in that: Applicable to servers, including: An account lock acquisition module, used to sequentially acquire account lock information of at least one to-be-processed electronic bill group; wherein the to-be-processed electronic bill group includes at least one to-be-processed electronic bill, and the account lock information set for each to-be-processed electronic bill is the same; An initial information acquisition module, configured to acquire initial bill information and initial version information corresponding to the electronic bill group to be processed if the account lock information is successfully acquired; A bill information acquisition module, used for reading bill information of the first electronic bill to be processed in the group of electronic bills to be processed; A bill merging module, used to accumulate the billing amount in the billing information and the billing amount in the initial billing information, update the accumulated amount to the billing amount in the initial billing information, and update the initial version information; A return module, used for updating the next electronic bill to the first electronic bill to be processed according to a preset sequence, and returning to the step of reading the bill information of the first electronic bill to be processed in the group of electronic bills to be processed; The bill recording module is used to send the updated initial bill information as the combined bill information to the database until there is no unprocessed first electronic bill in the group of electronic bills to be processed, so that the database can record the combined bill information, and release the account lock information.
8. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the electronic bill consolidation accounting method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the electronic bill consolidation accounting method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the electronic bill consolidation accounting method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Bill cancel-after-verification method and device and electronic device
CN110766540A
Payment method, device, equipment, medium and product
CN115222383A