CN113781034A - Cache-based accounting and checking method - Google Patents

Cache-based accounting and checking method Download PDF

Info

Publication number
CN113781034A
CN113781034A CN202111148951.XA CN202111148951A CN113781034A CN 113781034 A CN113781034 A CN 113781034A CN 202111148951 A CN202111148951 A CN 202111148951A CN 113781034 A CN113781034 A CN 113781034A
Authority
CN
China
Prior art keywords
transaction
information
account
cache
obtaining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111148951.XA
Other languages
Chinese (zh)
Other versions
CN113781034B (en
Inventor
王城
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Handpal Information Technology Service Co ltd
Original Assignee
Shanghai Handpal Information Technology Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Handpal Information Technology Service Co ltd filed Critical Shanghai Handpal Information Technology Service Co ltd
Priority to CN202111148951.XA priority Critical patent/CN113781034B/en
Publication of CN113781034A publication Critical patent/CN113781034A/en
Application granted granted Critical
Publication of CN113781034B publication Critical patent/CN113781034B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • G06Q20/102Bill distribution or payments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Economics (AREA)
  • Theoretical Computer Science (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a cache-based accounting and checking method, wherein the method comprises the following steps: obtaining first transaction type information and first transaction account information; obtaining first transaction process information based on the first transaction type information and the first transaction account information; judging whether the first transaction is successful or not according to the first transaction process information; if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage; acquiring account balance information of the first transaction account information according to the first transaction amount information; and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database. The method solves the technical problems that in the prior art, in the scene of single account large concurrency, due to the limitation of transactions and locks, the service processing amount and the processing speed are greatly reduced, and the scene requirement cannot be met.

Description

Cache-based accounting and checking method
Technical Field
The invention relates to the field of account billing, in particular to a cache-based billing and checking method and system.
Background
In a synchronous accounting scene with balance limit, the conventional general method is to utilize the affairs of a database and a locking mechanism to achieve deduction without exceeding the limit, and the method can meet the requirement in a service scene with low concurrency pressure.
However, in the process of implementing the technical solution of the invention in the embodiments of the present application, the inventors of the present application find that the above-mentioned technology has at least the following technical problems:
in the prior art, in a scene with large concurrency of a single account, due to the limitation of transactions and locks, the service processing amount and the processing speed are greatly reduced, and the technical problem that the scene requirement cannot be met is solved.
Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the application aims to solve the technical problems that in a scene with large concurrency of a single account, due to the limitation of transactions and locks, the service processing capacity and the processing speed are greatly reduced, and the scene requirement cannot be met in the prior art by providing a cache-based accounting and checking method and system. By designing the technical effects that the transaction processing speed is improved through the cache, the account balance is synchronized to the database at regular time, and meanwhile, the defect of the reliability of the cache relative to the database is made up by monitoring and checking, so that the cache failure is prevented, and the requirements of high efficiency, stability and safety consistency on account bookkeeping and checking are met.
In one aspect, an embodiment of the present application provides a cache-based billing and inspection method, where the method includes: obtaining first transaction type information and first transaction account information; obtaining first transaction process information based on the first transaction type information and the first transaction account information; judging whether the first transaction is successful or not according to the first transaction process information; if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage; acquiring account balance information of the first transaction account information according to the first transaction amount information; and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database.
In another aspect, the present application further provides a cache-based billing and inspection system, wherein the system includes: a first obtaining unit: the first obtaining unit is used for obtaining first transaction type information and first transaction account information; a second obtaining unit: the second obtaining unit is used for obtaining first transaction process information based on the first transaction type information and the first transaction account information; a first judgment unit: the first judging unit is used for judging whether the first transaction is successful according to the first transaction progress information; a third obtaining unit: the third obtaining unit is used for obtaining a corresponding first transaction record if the first transaction is successful, and uploading the first transaction record to a database for storage; a fourth obtaining unit: the fourth obtaining unit is used for obtaining account balance information of the first transaction account information according to the first transaction amount information; a first uploading unit: the first uploading unit is used for synchronously uploading the account balance information to the database for storage and performing timing check on the transaction information in the database.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
obtaining first transaction type information and first transaction account information; obtaining first transaction process information based on the first transaction type information and the first transaction account information; judging whether the first transaction is successful or not according to the first transaction process information; if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage; acquiring account balance information of the first transaction account information according to the first transaction amount information; and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database. By designing the technical effects that the transaction processing speed is improved through the cache, the account balance is synchronized to the database at regular time, and meanwhile, the defect of the reliability of the cache relative to the database is made up by monitoring and checking, so that the cache failure is prevented, and the requirements of high efficiency, stability and safety consistency on account bookkeeping and checking are met.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a flow chart of a cache-based billing and inspection method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating a unified transaction flow of a cache-based billing and inspection method according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating a transaction result monitoring method based on a cache billing and inspection method according to an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart illustrating sequential difference calculation of the transaction records to be verified according to an embodiment of the present application based on a cached accounting and checking method;
FIG. 5 is a schematic flow chart illustrating account fund information if the first transaction account information does not exist in the cache according to an embodiment of the present application;
FIG. 6 is a flow chart illustrating a method for cache-based accounting and checking if no private serial number exists in the cache according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a cache-based billing and inspection system according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an exemplary electronic device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a cache-based bookkeeping and checking method and system, and solves the technical problems that in a scene with large concurrency of a single account in the prior art, due to the limitation of transactions and locks, the service processing capacity and the processing speed are greatly reduced, and the scene requirement cannot be met. By designing the technical effects that the transaction processing speed is improved through the cache, the account balance is synchronized to the database at regular time, and meanwhile, the defect of the reliability of the cache relative to the database is made up by monitoring and checking, so that the cache failure is prevented, and the requirements of high efficiency, stability and safety consistency on account bookkeeping and checking are met.
Hereinafter, example embodiments according to the present application will be described in detail with reference to the accompanying drawings. It should be apparent that the described embodiments are merely some embodiments of the present application and not all embodiments of the present application, and it should be understood that the present application is not limited to the example embodiments described herein.
Summary of the application
In a synchronous accounting scene with balance limit, the conventional general method is to utilize the affairs of a database and a locking mechanism to achieve deduction without exceeding the limit, and the method can meet the requirement in a service scene with low concurrency pressure. In the prior art, in a scene with large concurrency of a single account, due to the limitation of transactions and locks, the service processing amount and the processing speed are greatly reduced, and the requirement of the scene cannot be met.
In view of the above technical problems, the technical solution provided by the present application has the following general idea:
the embodiment of the application provides a cache-based accounting and checking method, wherein the method comprises the following steps: obtaining first transaction type information and first transaction account information; obtaining first transaction process information based on the first transaction type information and the first transaction account information; judging whether the first transaction is successful or not according to the first transaction process information; if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage; acquiring account balance information of the first transaction account information according to the first transaction amount information; and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database.
For better understanding of the above technical solutions, the following detailed descriptions will be provided in conjunction with the drawings and the detailed description of the embodiments.
Example one
As shown in fig. 1, an embodiment of the present application provides a cache-based accounting and checking method, where the method includes:
step S100: obtaining first transaction type information and first transaction account information;
step S200: obtaining first transaction process information based on the first transaction type information and the first transaction account information;
specifically, in a synchronous billing scenario with balance restrictions, it has been common practice in the past to utilize database transactions and locking mechanisms to achieve deductions without overrun. The method can meet the requirements in the scene of processing the services with low concurrency pressure, but in the scene of large concurrency of a single account, due to the limitation of transactions and locks, the service processing capacity and the processing speed are greatly reduced, and the requirements of the scene cannot be met. Therefore, the embodiment of the application designs a method for improving the transaction processing speed through the cache, thereby meeting the requirement of a large concurrency scene. The first transaction type information can be understood as the transaction type of a bank account, including payment transaction, refund transaction, recharge transaction and the like, the first transaction account information can be understood as the bank account of the user, and further first transaction process information is obtained based on the first transaction type information and the first transaction account information, wherein the first transaction process information is whether the transaction of the user is completed or not, whether the transaction is successful or not and the like.
Step S300: judging whether the first transaction is successful or not according to the first transaction process information;
step S400: if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage;
specifically, it is known that obtaining the first transaction progress information further may determine whether the first transaction is successful, that is, whether the first transaction is complete, where a deduction transaction is taken as an example to explain, if the user's account deduction transaction is successful, a corresponding first transaction record may be obtained, where the first transaction record includes information such as a deduction time, a deduction amount, an account balance, and a transaction serial number, and the first transaction record is further uploaded to a database to be stored, it should be noted that the whole transaction process may be packaged in a single-thread cache, where Redis is taken as an example to explain, Redis is an open source (BSD permission), and a data structure server stored in a memory may be used as a database, a cache, and a message queue agent. It supports data types such as strings, hash tables, lists, collections, ordered collections, bitmaps, Hyperlogs, etc. Built-in copy, Lua script, LRU eviction, transaction, and different levels of disk persistence functionality, while providing high availability via Redis Sentiel and automatic partitioning via Redis Cluster.
Step S500: acquiring account balance information of the first transaction account information according to the first transaction amount information;
step S600: and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database.
Specifically, the first transaction amount information is the transaction amount of the deduction transaction currently performed, account balance information of the first transaction account information, that is, the current account balance of the user after the deduction is successful, can be obtained based on the first transaction amount information, and then the account balance information is synchronously uploaded to the database for storage, so as to prevent cache invalidation and obtain the account balance when cache needs to be reloaded.
Further, as shown in fig. 2, the embodiment of the present application further includes:
step S310: determining whether account fund information of the first transaction account information exists in the cache;
step S320: if the account fund information of the first transaction account information exists in the cache, judging whether a serial number special for monitoring exists in the cache;
step S330: if the special serial number for monitoring exists in the cache, finishing first transaction action information according to the first transaction type information, and increasing the monitoring serial number of the first transaction process information;
step S340: obtaining a first transaction result according to the first transaction action information and the monitoring serial number information, wherein the first transaction result comprises balance information after transaction;
step S350: judging whether the balance information after the transaction is legal or not;
step S360: and if the balance information after the transaction is legal, uploading the first transaction result to the database for storage.
Specifically, when determining whether the current transaction is successful, further, it may be determined whether the account fund information of the first transaction account information exists in the cache, because when the account information is unknown, the related transaction cannot be performed on the account, if the account fund information of the first transaction account information exists in the cache, that is, the account information is known, it may be further determined whether a special serial number for monitoring exists in the cache, the serial number may record the account transaction of the user, if the special serial number for monitoring exists in the cache, that is, the existing transaction environment meets the established requirement, and further, according to the first transaction type information, the first transaction action information is completed, that is, the deduction transaction of the account is completed, and meanwhile, when completing an account transaction, the monitoring serial number of the first transaction progress information needs to be correspondingly incremented, increasing 1 each time to ensure the orderliness of the transaction by utilizing the characteristic of single-thread efficient operation, and further obtaining a first transaction result after the transaction is finished, wherein the first transaction result comprises account balance information after transaction, and further judges whether the balance information after transaction is legal or not, i.e. whether the actual balance after the transaction is matched with the due balance of the account, if the difference value between the actual balance and the due balance is 0, a match is indicated, whereas if there is less than 0 or a threshold limit exceeded, the transaction is not legitimate, if the balance information after the transaction is legal, uploading the first transaction result to the database for storage, the transaction action (incrBy)) and the monitoring flow number increasing action (incr) are completed in one transaction session, and the response result is returned, so that the follow-up of each flow in the account transaction process is ensured.
Further, as shown in fig. 3, the embodiment of the present application further includes:
step S710: based on the database, the monitoring unit loads and obtains a transaction checking catalog;
step S720: obtaining the last transaction checking information according to the transaction checking catalog;
step S730: according to the last transaction checking information, loading transaction records to be checked of the transaction checking catalog in batches and in sequence;
step S740: carrying out sequential difference calculation on the transaction records to be checked to obtain a first difference calculation result;
step S750: judging whether the first difference calculation result reaches a preset difference calculation result or not;
step S760: and if the first difference calculation result does not reach the preset difference calculation result, carrying out reverse transaction reversal on the transaction record to be checked.
Specifically, when checking the transaction results of a single account with a large number of concurrent accounts, checking may be performed based on a monitoring unit, further, based on the database, the monitoring unit loads and obtains a transaction checking directory, that is, the monitoring unit loads and obtains the transaction results to be checked from the database to generate the transaction checking directory, and simultaneously, according to the transaction checking directory, obtains last-time checked transaction information, which is a transaction checked last time of last task processing, generally, processes the transaction record result of each batch, and stores the serial number of the last transaction of the batch as a punctuation in a task, so that the transaction records of the accounts are sequentially loaded in batches from the punctuation of the task each time of running until the transaction result is close to the transaction generated recently by the system, that is, the transaction record to be checked, and then carrying out sequential difference calculation on the transaction records to be checked, wherein the first difference calculation result is the difference calculation result, and further judging whether the first difference calculation result reaches a preset difference calculation result, namely judging whether the first difference calculation result is legal or not and is 0 or not, if the first difference calculation result is illegal, sending the transaction records with problems (the difference c is not 0) to a manager in other forms such as mail and the like for determination and subsequent operation, and carrying out reverse transaction correction on the transaction records to be checked. By carrying out reverse transaction correction on the transaction record to be checked, the transaction with problems can be checked and corrected, and further the account transaction result is ensured to be checked at regular time.
Further, as shown in fig. 4, the step S740 of performing sequential difference calculation on the transaction records to be verified further includes:
step S741: obtaining a current transaction record according to the transaction record to be checked;
step S742: acquiring balance information before transaction of the next transaction, and recording the balance information as a1;
step S743: acquiring account balance information before transaction of the current transaction record, and recording the account balance information as a;
step S744: acquiring the transaction amount information of the current transaction record, and recording the transaction amount information as b;
step S745: obtaining current transaction balance information, marked as c, according to the balance information a1 before the transaction, the account balance information a before the transaction and the transaction amount information b, wherein: c-a 1- (a + b) or c-a 1- (a-b).
Specifically, in order to perform sequential difference calculation on the transaction records to be checked, further, a current transaction record may be obtained according to the transaction records to be checked, that is, the current transaction record includes the amount, type, and the like of the current transaction, and meanwhile, pre-transaction balance information a1 of the next transaction, pre-transaction account balance information a of the current transaction record, and transaction amount information b of the current transaction record may be obtained, based on which current transaction difference information, which is denoted as c, may be obtained, where: specifically, if the current transaction type is a refund transaction, the current transaction difference information may be recorded as c 1- (a + b), and conversely, if the current transaction type is a payment transaction, the current transaction difference information may be recorded as c 1- (a-b), so that, based on the sequential difference calculation performed on the transaction records to be verified, the verification check may be performed on transactions with a difference c different from 0.
Further, as shown in fig. 5, the step S310 of determining whether the account fund information of the first transaction account information exists in the cache further includes:
step S311: if account fund information of the first transaction account information does not exist in the cache, generating a first asynchronous locking instruction;
step S312: and loading account fund information of the first transaction account information from the database according to the first asynchronous locking instruction.
Specifically, when it is determined whether the account fund information of the first transaction account information exists in the cache, if the account fund information of the first transaction account information does not exist in the cache, and when the account fund information is unknown, the transaction cannot be performed on the current account, the account fund information of the first transaction account information may be loaded from the database according to the first asynchronous locking instruction, and the refund transaction or the payment transaction and the like may be performed on the current account in an asynchronous loading manner.
Further, as shown in fig. 6, the determining whether the monitor-dedicated serial number exists in the cache further includes, in step S320:
step S321: if the monitoring special serial number does not exist in the cache, generating a second asynchronous locking instruction;
step S322: loading the serial number special for monitoring from the database according to the second asynchronous locking instruction;
step S323: sending the monitor-specific serial number to the cache.
Specifically, when it is determined whether the serial number dedicated for monitoring in the cache exists, if the serial number dedicated for monitoring in the cache does not exist, the current transaction cannot be recorded and monitored, the serial number dedicated for monitoring can be loaded from the database according to the second asynchronous locking instruction, and meanwhile, the serial number dedicated for monitoring is sent to the cache, the current transaction is continued, and the current transaction is recorded and monitored.
Compared with the prior art, the invention has the following beneficial effects:
1. obtaining first transaction type information and first transaction account information; obtaining first transaction process information based on the first transaction type information and the first transaction account information; judging whether the first transaction is successful or not according to the first transaction process information; if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage; acquiring account balance information of the first transaction account information according to the first transaction amount information; and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database. By designing the technical effects that the transaction processing speed is improved through the cache, the account balance is synchronized to the database at regular time, and meanwhile, the defect of the reliability of the cache relative to the database is made up by monitoring and checking, so that the cache failure is prevented, and the requirements of high efficiency, stability and safety consistency on account bookkeeping and checking are met.
Example two
Based on the same inventive concept as the cache-based accounting and checking method in the foregoing embodiment, the present invention further provides a cache-based accounting and checking system, as shown in fig. 7, the system includes:
the first obtaining unit 11: the first obtaining unit 11 is configured to obtain first transaction type information and first transaction account information;
the second obtaining unit 12: the second obtaining unit 12 is configured to obtain first transaction progress information based on the first transaction type information and the first transaction account information;
the first judgment unit 13: the first judging unit 13 is configured to judge whether the first transaction is successful according to the first transaction progress information;
the third obtaining unit 14: the third obtaining unit 14 is configured to obtain a corresponding first transaction record if the first transaction is successful, and upload the first transaction record to a database for storage;
the fourth obtaining unit 15: the fourth obtaining unit 15 is configured to obtain account balance information of the first transaction account information according to the first transaction amount information;
the first upload unit 16: the first uploading unit 16 is configured to upload the account balance information to the database synchronously for storage, and perform timing check on the transaction information in the database.
Further, the system further comprises:
a second judgment unit: the second judging unit is used for judging whether account fund information of the first transaction account information exists in the cache;
a third judging unit: the third judging unit is used for judging whether the serial number special for monitoring exists in the cache if the account fund information of the first transaction account information exists in the cache;
a first completion unit: the first completion unit is used for completing first transaction action information according to the first transaction type information and increasing the monitoring serial number of the first transaction progress information if the monitoring special serial number exists in the cache;
a fifth obtaining unit: the fifth obtaining unit is used for obtaining a first transaction result according to the first transaction action information and the monitoring serial number information, wherein the first transaction result comprises balance information after transaction;
a fourth judging unit: the fourth judging unit is used for judging whether the balance information after the transaction is legal or not;
a second uploading unit: and the second uploading unit is used for uploading the first transaction result to the database for storage if the balance information after the transaction is legal.
Further, the system further comprises:
a sixth obtaining unit: the sixth obtaining unit is used for loading a transaction checking directory based on the database;
a seventh obtaining unit: the seventh obtaining unit is used for obtaining the transaction information of the last time check according to the transaction check catalog;
a first loading unit: the first loading unit is used for loading the transaction records to be checked of the transaction checking catalog in batches according to the last transaction checking information;
the first calculation unit: the first calculating unit is used for carrying out sequential difference calculation on the transaction records to be checked to obtain a first difference calculating result;
a fifth judging unit: the fifth judging unit is used for judging whether the first difference calculation result reaches a preset difference calculation result or not;
a first punching unit: the first transaction record checking unit is used for checking the transaction records to be checked in a reverse transaction mode if the first difference calculation result does not reach the preset difference calculation result.
Further, the system further comprises:
an eighth obtaining unit: the eighth obtaining unit is used for obtaining the current transaction record according to the transaction record to be checked;
a ninth obtaining unit: the ninth obtaining unit is used for obtaining the balance information before the next transaction, which is recorded as a1;
a tenth obtaining unit: the tenth obtaining unit is configured to obtain the account balance information before transaction of the current transaction record, which is marked as a;
an eleventh obtaining unit: the eleventh obtaining unit is used for obtaining the transaction amount information of the current transaction record, and the transaction amount information is marked as b;
a twelfth obtaining unit: the twelfth obtaining unit is configured to obtain current transaction balance information, denoted as c, according to the pre-transaction balance information a1, the pre-transaction account balance information a, and the transaction amount information b of the next transaction, where: c-a 1- (a + b) or c-a 1- (a-b).
Further, the system further comprises:
a first generation unit: the first generating unit is used for generating a first asynchronous locking instruction if account fund information of the first transaction account information does not exist in the cache;
a second loading unit: the second loading unit is used for loading account fund information of the first transaction account information from the database according to the first asynchronous locking instruction.
Further, the system further comprises:
a second generation unit: the second generating unit is used for generating a second asynchronous locking instruction if the monitoring special serial number does not exist in the cache;
a third loading unit: the third loading unit is used for loading the serial number special for monitoring from the database according to the second asynchronous locking instruction;
a first transmission unit: the first sending unit is configured to send the monitoring-dedicated serial number to the cache.
Various changes and embodiments of the aforementioned cache-based accounting and checking method in the first embodiment of fig. 1 are also applicable to the cache-based accounting and checking system in this embodiment, and a detailed description of the cache-based accounting and checking method will be clear to those skilled in the art, so that a detailed description thereof is omitted for brevity of the description.
EXAMPLE III
The electronic apparatus of the embodiment of the present application is described below with reference to fig. 8.
Fig. 8 illustrates a schematic structural diagram of an electronic device according to an embodiment of the present application.
Based on the inventive concept of a cache-based accounting and checking method as described in the previous embodiments, the present invention further provides a cache-based accounting and checking system, on which a computer program is stored, which when executed by a processor implements the steps of any one of the methods of the cache-based accounting and checking system described above.
Where in fig. 8 a bus architecture (represented by bus 300), bus 300 may include any number of interconnected buses and bridges, bus 300 linking together various circuits including one or more processors, represented by processor 302, and memory, represented by memory 304. The bus 300 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 305 provides an interface between the bus 300 and the receiver 301 and transmitter 303. The receiver 301 and the transmitter 303 may be the same element, i.e., a transceiver, providing a means for communicating with various other systems over a transmission medium. The processor 302 is responsible for managing the bus 300 and general processing, and the memory 304 may be used for storing data used by the processor 302 in performing operations.
The embodiment of the application provides a cache-based accounting and checking method, wherein the method comprises the following steps: obtaining first transaction type information and first transaction account information; obtaining first transaction process information based on the first transaction type information and the first transaction account information; judging whether the first transaction is successful or not according to the first transaction process information; if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage; acquiring account balance information of the first transaction account information according to the first transaction amount information; and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a system for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction system which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (8)

1. A cache-based billing and inspection method, wherein the method comprises:
obtaining first transaction type information and first transaction account information;
obtaining first transaction process information based on the first transaction type information and the first transaction account information;
judging whether the first transaction is successful or not according to the first transaction process information;
if the first transaction is successful, acquiring a corresponding first transaction record, and uploading the first transaction record to a database for storage;
acquiring account balance information of the first transaction account information according to the first transaction amount information;
and synchronously uploading the account balance information to the database for storage, and performing timing check on the transaction information in the database.
2. The method of claim 1, wherein the method further comprises:
determining whether account fund information of the first transaction account information exists in the cache;
if the account fund information of the first transaction account information exists in the cache, judging whether a serial number special for monitoring exists in the cache;
if the special serial number for monitoring exists in the cache, finishing first transaction action information according to the first transaction type information, and increasing the monitoring serial number of the first transaction process information;
obtaining a first transaction result according to the first transaction action information and the monitoring serial number information, wherein the first transaction result comprises balance information after transaction;
judging whether the balance information after the transaction is legal or not;
and if the balance information after the transaction is legal, uploading the first transaction result to the database for storage.
3. The method of claim 2, wherein the method further comprises:
based on the database, the monitoring unit loads and obtains a transaction checking catalog;
obtaining the last transaction checking information according to the transaction checking catalog;
according to the last transaction checking information, loading transaction records to be checked of the transaction checking catalog in batches and in sequence;
carrying out sequential difference calculation on the transaction records to be checked to obtain a first difference calculation result;
judging whether the first difference calculation result reaches a preset difference calculation result or not;
and if the first difference calculation result does not reach the preset difference calculation result, carrying out reverse transaction reversal on the transaction record to be checked.
4. The method of claim 3, wherein said performing a sequential deficit calculation on said transaction records to be collated further comprises:
obtaining a current transaction record according to the transaction record to be checked;
acquiring balance information before transaction of the next transaction, and recording the balance information as a1;
acquiring account balance information before transaction of the current transaction record, and recording the account balance information as a;
acquiring the transaction amount information of the current transaction record, and recording the transaction amount information as b;
obtaining current transaction balance information, marked as c, according to the balance information a1 before the transaction, the account balance information a before the transaction and the transaction amount information b, wherein: c = a1- (a + b) or c = a1- (a-b).
5. The method of claim 2, wherein the determining whether account fund information for the first transaction account information is present in the cache further comprises:
if account fund information of the first transaction account information does not exist in the cache, generating a first asynchronous locking instruction;
and loading account fund information of the first transaction account information from the database according to the first asynchronous locking instruction.
6. The method of claim 2, wherein said determining whether a monitor private serial number exists in said cache further comprises:
if the monitoring special serial number does not exist in the cache, generating a second asynchronous locking instruction;
loading the serial number special for monitoring from the database according to the second asynchronous locking instruction;
sending the monitor-specific serial number to the cache.
7. A cache-based billing and inspection system, wherein the system comprises:
a first obtaining unit: the first obtaining unit is used for obtaining first transaction type information and first transaction account information;
a second obtaining unit: the second obtaining unit is used for obtaining first transaction process information based on the first transaction type information and the first transaction account information;
a first judgment unit: the first judging unit is used for judging whether the first transaction is successful according to the first transaction progress information;
a third obtaining unit: the third obtaining unit is used for obtaining a corresponding first transaction record if the first transaction is successful, and uploading the first transaction record to a database for storage;
a fourth obtaining unit: the fourth obtaining unit is used for obtaining account balance information of the first transaction account information according to the first transaction amount information;
a first uploading unit: the first uploading unit is used for synchronously uploading the account balance information to the database for storage and performing timing check on the transaction information in the database.
8. A cache-based accounting and inspection system comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-6 when executing the program.
CN202111148951.XA 2021-09-29 2021-09-29 Billing and checking method based on cache Active CN113781034B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111148951.XA CN113781034B (en) 2021-09-29 2021-09-29 Billing and checking method based on cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111148951.XA CN113781034B (en) 2021-09-29 2021-09-29 Billing and checking method based on cache

Publications (2)

Publication Number Publication Date
CN113781034A true CN113781034A (en) 2021-12-10
CN113781034B CN113781034B (en) 2024-04-30

Family

ID=78854288

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111148951.XA Active CN113781034B (en) 2021-09-29 2021-09-29 Billing and checking method based on cache

Country Status (1)

Country Link
CN (1) CN113781034B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003178242A (en) * 2001-12-13 2003-06-27 Fujitsu Ltd Transaction processing method and transaction processing system
CN101620703A (en) * 2008-07-04 2010-01-06 阿里巴巴集团控股有限公司 Buffer bookkeeping method and device
CN106934025A (en) * 2017-03-13 2017-07-07 广州爱九游信息技术有限公司 A kind of account data management method, device and server
CN108335091A (en) * 2018-01-26 2018-07-27 深圳盛付通科技有限公司 A kind of method and system keeping account balance consistency in the case where high concurrent pays scene
CN109615514A (en) * 2018-11-27 2019-04-12 宝付网络科技(上海)有限公司 Hot spot account trading system and method
CN110659971A (en) * 2018-06-29 2020-01-07 马上消费金融股份有限公司 Transaction data processing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003178242A (en) * 2001-12-13 2003-06-27 Fujitsu Ltd Transaction processing method and transaction processing system
CN101620703A (en) * 2008-07-04 2010-01-06 阿里巴巴集团控股有限公司 Buffer bookkeeping method and device
CN106934025A (en) * 2017-03-13 2017-07-07 广州爱九游信息技术有限公司 A kind of account data management method, device and server
CN108335091A (en) * 2018-01-26 2018-07-27 深圳盛付通科技有限公司 A kind of method and system keeping account balance consistency in the case where high concurrent pays scene
CN110659971A (en) * 2018-06-29 2020-01-07 马上消费金融股份有限公司 Transaction data processing method and device
CN109615514A (en) * 2018-11-27 2019-04-12 宝付网络科技(上海)有限公司 Hot spot account trading system and method

Also Published As

Publication number Publication date
CN113781034B (en) 2024-04-30

Similar Documents

Publication Publication Date Title
US11521275B2 (en) Blockchain-based transaction processing method, apparatus, and electronic device
EP3816910A1 (en) Blockchain-based transaction processing method and apparatus, and electronic device
CN109614262B (en) Service checking method, device and computer readable storage medium
US20210049715A1 (en) Blockchain-based data procesing method, apparatus, and electronic device
US11250395B2 (en) Blockchain-based transaction processing methods and apparatuses and electronic devices
US20200202396A1 (en) Blockchain-based invoice creation method apparatus, and electronic device
CN110163691B (en) Invoice creating method and device based on block chain and electronic equipment
EP3905172A1 (en) Blockchain-based invoice voiding method and apparatus, and electronic device
CN110968437A (en) Method, device, equipment and medium for parallel execution of single contract based on Java intelligent contract
WO2019196257A1 (en) Automatic repayment method and system, and terminal device
WO2020149899A1 (en) Protecting against data loss
US11106811B2 (en) Object storage for guaranteed content for backup and retention
CN112613288B (en) Method, device, computer equipment and storage medium for generating bill
US20230385891A1 (en) Prototype message service
CN113312259A (en) Interface testing method and device
CN112749072A (en) Method and device for testing cloud storage system storing training data
CN113781034B (en) Billing and checking method based on cache
CN113313594B (en) Order processing method, order processing device, electronic equipment, storage medium and program product
CN112199716B (en) Block chain block-out method, device, equipment and storage medium
US20170364418A1 (en) Integrity of transactional memory of card computing devices in case of card tear events
CN113449023A (en) Service processing method and device and electronic equipment
CN111797590A (en) Data checking method, device and equipment
CN110930206A (en) Invoice matching method and device and storage medium
CN110750550A (en) Data verification method, data verification device, storage medium and electronic equipment
US20150254098A1 (en) Transaction processing apparatus and distributed processing system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant