[go: up one dir, main page]

CN113744056A - An idempotent method and device for online transactions - Google Patents

An idempotent method and device for online transactions Download PDF

Info

Publication number
CN113744056A
CN113744056A CN202111046356.5A CN202111046356A CN113744056A CN 113744056 A CN113744056 A CN 113744056A CN 202111046356 A CN202111046356 A CN 202111046356A CN 113744056 A CN113744056 A CN 113744056A
Authority
CN
China
Prior art keywords
transaction
idempotent
serial number
processing
idempotency
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.)
Pending
Application number
CN202111046356.5A
Other languages
Chinese (zh)
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.)
Liaoning Zhenxing Bank Co ltd
Original Assignee
Liaoning Zhenxing Bank 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 Liaoning Zhenxing Bank Co ltd filed Critical Liaoning Zhenxing Bank Co ltd
Priority to CN202111046356.5A priority Critical patent/CN113744056A/en
Publication of CN113744056A publication Critical patent/CN113744056A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • G06F7/552Powers or roots, e.g. Pythagorean sums
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/12Accounting
    • G06Q40/125Finance or payroll

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Mathematical Optimization (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明涉及联机交易幂等技术领域,公开了一种联机交易幂等的装置,包括交易幂等检测表、交易有效检测模块和交易幂等控制模块,还公开了一种联机交易幂等的方法,包括以下步骤:S11、查询交易幂等检查表;S12、查找当前交易流水号的记录;S13、登记交易状态、处理结果以及响应报文;S14、判断登记操作失败原因;S15、再次查询交易幂等检查表;S16、判断交易状态;S17、返回“交易已冲正”或响应报文。本发明设置交易幂等检测表、交易有效检测模块、交易幂等控制模块,正确、高效地处理金融领域的原交易、冲正交易、查证交易等交易种类的关联关系,满足交易幂等的要求;即可支持业务无侵入的交易幂等,也可以通过交易层的定制实现场景特定的交易幂等。

Figure 202111046356

The invention relates to the technical field of online transaction idempotency, and discloses an online transaction idempotent device, including a transaction idempotent detection table, a transaction effective detection module and a transaction idempotent control module, and also discloses an online transaction idempotency method. , including the following steps: S11, query the transaction idempotency check table; S12, find the record of the current transaction serial number; S13, register the transaction status, processing result and response message; S14, determine the reason for the failure of the registration operation; S15, query the transaction again Idempotent check table; S16, judge the transaction status; S17, return "the transaction has been reversed" or a response message. The invention sets up a transaction idempotent detection table, a transaction effective detection module, and a transaction idempotent control module, so as to correctly and efficiently handle the relationship between the original transaction, reverse transaction, verification transaction and other transaction types in the financial field, and meet the requirements of transaction idempotency ; It can support non-intrusive transaction idempotency of business, and can also realize scene-specific transaction idempotency through the customization of transaction layer.

Figure 202111046356

Description

Online transaction idempotent method and device
Technical Field
The invention relates to the technical field of online transaction idempotency, in particular to a method and a device for online transaction idempotency.
Background
Idempotent is a mathematical concept that means that the result of an n-th mathematical operation is equal to the result of a 1-th mathematical operation, such as: 1-12=14=…=1nThis is a law that exists objectively; trading powerThe term "on-line transaction processing system" refers to an on-line transaction processing system in which the processing results of one or more requests for the same transaction are consistent, which is not a naturally occurring rule but needs to be carefully designed, accurately implemented, and precisely tested for ultimate achievement.
Generally speaking, there are several important issues to achieve an idempotent goal in an online transaction processing system: 1) identifying and authenticating the transaction, namely how to identify and authenticate that multiple requests correspond to the same business transaction; 2) if the processing of multiple requests belonging to the same business transaction is guaranteed to be consistent.
According to the difference between the processing mode and the processing effect, the transactions provided by the online transaction processing system can be classified into three types: ordinary transactions, transactions for making corrections and verification transactions; wherein, Normal transaction (Normal transaction), i.e. Normal transaction, such as opening an account, selling an account, depositing, drawing, freezing, thawing, information maintenance, etc., usually such transaction will leave a transaction detail (i.e. a "trace"); the Reversal transaction (i.e. normal reverse transaction) needs to explicitly specify the normal transaction (also called as original transaction) to be reversed, and usually the Reversal transaction "erases" the trace left by the original transaction "; checking transaction (Check transaction), that is, when the original transaction state is unknown, the original transaction state can be inquired and determined by checking transaction, and the corresponding original transaction needs to be formulated definitely.
In an online transaction processing system, the difficulty of idempotent transactions is to correctly process the relationship between ordinary transactions, correcting transactions and verifying transactions, especially in high concurrency situations.
The prior art can adopt a token and a distributed lock to realize idempotent trading; the token is generated by an online transaction processing system, distributed to the client and transmitted back by the client in the transaction request; the online transaction processing system detects the legality and uniqueness of the transaction request by means of the token in the transaction request; the control of the distributed lock is combined, so that the same transaction is prevented from being processed for multiple times, and the transaction idempotency is realized;
however, in the prior art, the token is used as a judgment standard for transaction uniqueness, and the life cycle management of the token involves complex processes such as generation, distribution, return, verification, deletion and the like, which is not suitable for an online transaction processing scene; in the prior art, only the idempotent processing between the original transactions is realized, and the idempotent processing between the original transactions and the conflict transaction, and between the original transactions and the verification transaction cannot be realized. This is not suitable for financial class online transaction processing scenarios.
Disclosure of Invention
The invention aims to provide a method and a device for online trading idempotent to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
an on-line transaction idempotent method and device comprises a transaction idempotent detection table, a transaction effective detection module and a transaction idempotent control module.
As a still further scheme of the invention: the key field definition of the transaction idempotent detection table comprises field names, field types and field description definitions, wherein the field names comprise transaction codes, peripheral system IDs, transaction serial numbers, request messages, response messages and transaction processing states, and the field types comprise character strings and enumeration values.
An online idempotent trading method, comprising the steps of:
s11, in the online transaction processing system, acquiring the transaction serial number of the transaction from the request message, and inquiring a transaction idempotent check table according to the transaction serial number;
s12, whether a record of the current transaction serial number is found in the transaction power and the like check table through the transaction effective detection module, if the record of the current transaction serial number is not found, the transaction is not processed; and adopting independent transaction to register the related information of the current transaction serial number in the transaction idempotent check table;
s13, after the registration operation of the current transaction serial number is successful, the subsequent service logic is continuously processed through the transaction idempotent control module, after the processing is finished, the transaction state, the processing result and the response message are registered, and the response message is returned;
s14, after the current transaction serial number registration operation fails, judging the failure reason, if the failure reason is the 'unique index conflict' of the transaction serial number field in the transaction power and the like check table, then showing that another request for processing the same transaction serial number is concurrently sent in the system, and the subsequent processing is needed; otherwise, error reporting is needed for system exception errors;
s15, after the current transaction pipelining operation fails to be registered and the 'unique index conflict' is reported in error; inquiring the transaction idempotent check table according to the transaction serial number; for the found transaction, judging whether the transaction state is 'forward transaction' or 'checking transaction'; if yes, the record is inserted by the first processed forward transaction or the checking transaction, and the transaction failure and the original transaction are returned, or the transaction failure and the original transaction are checked; otherwise, the record is inserted by the original transaction processed first and returns to the transaction processing;
s16, searching a transaction idempotent check table in the step S11 to find a record; judging whether the transaction state is 'forward transaction' or 'checking transaction'; if yes, the record is inserted by the first processed forward transaction or the checking transaction, and the transaction failure and the original transaction are returned, or the transaction failure and the original transaction are checked; otherwise, the record is inserted by the original transaction processed first, and further identification and judgment are carried out; if the transaction state is 'processing', returning to 'transaction processing';
s17, if the original transaction state processed in the step S16 is 'reversal success', returning to 'transaction reversal'; otherwise, if the transaction is processed normally, returning to the original transaction response message.
As a still further scheme of the invention: in the step S11: any one transaction must contain a transaction serial number, and any one serial number can only correspond to one transaction, and any two different transactions must correspond to two different transaction serial numbers.
As a still further scheme of the invention: the independent transaction in the step S12 is a transaction completely independent from the business processing master transaction, and its commit or rollback operation only affects its internal operations and data, but has no effect on the master transaction.
Compared with the prior art, the invention has the beneficial effects that:
the invention sets a detection table of transaction powers, a detection module of transaction effectiveness, a control module of transaction powers and the like, correctly and efficiently processes the incidence relation of the transaction types of original transaction, forward transaction, checking transaction and the like in the financial field, and meets the requirements of transaction powers and the like; the invention can support business non-intrusive transaction idempotent, and can also realize scene specific transaction idempotent through customization of the transaction layer.
Drawings
FIG. 1 is a flow chart of the transaction state of an online idempotent method;
FIG. 2 is a schematic flow chart of an online idempotent trading method using a serial number trading method;
FIG. 3 is a schematic flow chart of a method for online transaction idempotent using a request message;
FIG. 4 is a schematic flow chart of a method for online idempotent exchange using a scene customization method;
FIG. 5 is a logic flow diagram for using scenario customization in an online idempotent approach;
FIG. 6 is a diagram of transaction configuration table definitions and exemplary values in an online idempotent method;
FIG. 7 is a diagram of a trade registry definition and exemplary values in an online idempotent method;
FIG. 8 is a schematic flow chart of processing mode selection in an online idempotent method;
FIG. 9 is a schematic diagram illustrating a logic flow of the method for online trading idempotent;
FIG. 10 is a logic flow diagram illustrating verification of an online idempotent method.
Detailed Description
The embodiment of the invention discloses a method and a device for online transaction idempotent, and the device for online transaction idempotent is characterized by comprising a transaction idempotent detection table, a transaction effective detection module and a transaction idempotent control module.
Preferably, the key field definition of the transaction idempotent detection table includes definitions of field names, field types and field descriptions, where the field names include transaction codes, peripheral system IDs, transaction serial numbers, request messages, response messages, transaction processing states, field type strings and enumeration values.
The key field definitions of the transaction idempotent look-up table are shown in the following table:
TABLE 1 Critical field description of transaction idempotent checklist
Figure BDA0003250800530000041
Example one
In this embodiment, the transaction sequence number is used to identify the uniqueness of the transaction, and in fig. 2, an online idempotent method comprises the following steps:
s11, in 101-in the online transaction processing system, acquiring a transaction serial number of the transaction from the request message, and inquiring a transaction idempotent check table according to the transaction serial number;
s12, in 102, through the transaction validity detection module, whether the record of the current transaction serial number is found in the transaction idempotent check table, if the record of the current transaction serial number is not found, the transaction is never processed; and adopting independent transaction to register the related information of the current transaction serial number in the transaction idempotent check table;
s13, in 103, after the registration operation of the current transaction serial number is successful, the subsequent service logic is continuously processed through the transaction idempotent control module, after the processing is finished, the transaction state, the processing result and the response message are registered, and the response message is returned;
s14, in 104, after the current transaction serial number registration operation fails, judging the failure reason, if the failure reason is 'unique index conflict' of the transaction serial number field in the transaction power and the like check table, indicating that another request for processing the same transaction serial number is concurrently sent in the system, and subsequent processing is needed; otherwise, error reporting is needed for system exception errors;
s15, at 105-after registering that the current transaction pipelining failed, error reporting "unique index conflict"; inquiring the transaction idempotent check table according to the transaction serial number; for the found transaction, judging whether the transaction state is 'forward transaction' or 'checking transaction'; if yes, the record is inserted by the first processed forward transaction or the checking transaction, and the transaction failure and the original transaction are returned, or the transaction failure and the original transaction are checked; otherwise, the record is inserted by the original transaction processed first and returns to the transaction processing;
s16, in 106, in 101 in S11, searching a transaction idempotent check table to find a record; judging whether the transaction state is 'forward transaction' or 'checking transaction'; if yes, the record is inserted by the first processed forward transaction or the checking transaction, and the transaction failure and the original transaction are returned, or the transaction failure and the original transaction are checked; otherwise, the record is inserted by the original transaction processed first, and further identification and judgment are carried out; if the transaction state is 'processing', returning to 'transaction processing';
s17, in 107, if the original transaction state processed in 106 in the step S16 is 'positive reversal success', returning to 'transaction positive reversal'; otherwise, if the transaction is processed normally, returning to the original transaction response message.
Preferably, in step S11: any one transaction must contain a transaction serial number, and any one serial number can only correspond to one transaction, and any two different transactions must correspond to two different transaction serial numbers.
Preferably, the independent transaction in step S12 is a transaction completely independent from the business processing master transaction, and its commit or rollback operation only affects its internal operations and data, but has no effect on the master transaction.
Example two
The transaction uniqueness is identified by comparing the transaction request messages, and as illustrated from the difference between fig. 3 and fig. 2, in fig. 3, the implementation method includes the following steps:
s21, in 201, when the transaction serial number is obtained from the request message, the original transaction record can not be found from the transaction idempotent check table according to the transaction serial number, which indicates that the transaction is not processed;
registering the related information of the current transaction serial number to a transaction power-like check list, wherein the operation fails, and the failure reason is judged to be 'unique index conflict'; inquiring the transaction power check table again to obtain the original transaction information, and judging whether the transaction is positive transaction or checking the insertion of the transaction; this means that the record is the original transaction insert that was processed first;
taking out the request message of the original transaction and comparing the request message with the current request message; if the two transaction serial numbers are inconsistent, the situation that one transaction serial number corresponds to two different transactions is shown, and the transaction failure is reported in error, and other same serial requests exist; if the two requests match, the transaction processing returns to the step of transaction processing, which means that the two requests correspond to the same transaction.
S22, in 202, the trade serial number is obtained from the request message, and the original trade record is found from the trade idempotent checking table according to the trade serial number. This indicates that the transaction has been processed;
acquiring original transaction information, and judging whether the transaction is a forward transaction or a check transaction insertion; this means that the record is the original transaction insert that was processed first;
taking out the request message of the original transaction and comparing the request message with the current request message; if the two transaction serial numbers are inconsistent, the situation that one transaction serial number corresponds to two different transactions is shown, and the transaction failure is reported in error, and other same serial requests exist; if the two requests are consistent, the two requests correspond to the same transaction, and further judgment and processing are needed.
It can thus be derived: compared with fig. 2 (i.e., embodiment one), fig. 3 (embodiment two) can recognize the case where "one transaction serial number corresponds to two different transactions".
EXAMPLE III
The transaction uniqueness is identified in a scene-customized manner, which is illustrated from the perspective of the difference between fig. 4 and fig. 3, in fig. 4, the implementation method includes the following steps:
s31, in 301, acquiring a transaction serial number from the request message, and according to the transaction serial number, the original transaction record cannot be found from the transaction idempotent check table; this indicates that the transaction has never been processed;
registering the related information of the current transaction serial number to a transaction power-like check list, wherein the operation fails, and the failure reason is judged to be 'unique index conflict'; and inquiring the transaction idempotent check list again to obtain the original transaction information, and judging whether the transaction is positive transaction or checking the insertion of the transaction. This means that the record is the original transaction insert that was processed first;
taking out the request message of the original transaction and comparing the request message with the current request message; if the two requests are consistent with each other, the two requests correspond to the same transaction, and the transaction is returned to the transaction processing; if the transaction request is inconsistent with the original transaction request, a customization logic is called according to the transaction scene to judge the original transaction request and the current request;
if the scene customization logic judgment result is inconsistent, returning 'transaction failure, existence of other same flow requests'; otherwise, returning to the transaction processing;
s32, in 302, acquiring a transaction serial number from the request message, and finding an original transaction record from the transaction idempotent check table according to the transaction serial number; this indicates that the transaction has been processed;
acquiring original transaction information, and judging whether the transaction is a forward transaction or a check transaction insertion; this means that the record is the original transaction insert that was processed first;
taking out the request message of the original transaction and comparing the request message with the current request message; if the two requests are consistent, the two requests correspond to the same transaction, and further judgment and processing are needed; if the transaction request is inconsistent with the original transaction request, a customization logic is called according to the transaction scene to judge the original transaction request and the current request;
if the scene customization logic judgment result is inconsistent, returning 'transaction failure, existence of other same flow requests'; otherwise, further judgment processing is required.
In fig. 5, a "transaction power-equivalent scene configuration table" needs to be set in a decision logic selection flow in a scene customization transaction power-equivalent mode, and fig. 5 mainly configures a mapping relationship from a transaction code, a peripheral system ID to a transaction power-equivalent processing class; the transaction idempotent processing class can realize different request consistency judgment logics respectively based on transaction codes, peripheral systems and other scene specific factors; for example, for the transaction code "002", the peripheral system 418535 needs to use "SceneProcessor 02" for determination, and the peripheral system "020101" needs to use "SceneProcessor 03" for determination;
in 401, according to the transaction code and the peripheral system ID obtained from the request, inquiring a transaction idempotent scene configuration table to obtain a transaction idempotent processing class; then, the original transaction request and the current request are transmitted, the instance of the processing class is called, and consistency judgment is carried out.
The selection and decision logic of the invention for three modes, namely, which mode of the first embodiment, the second embodiment and the third embodiment is used in what scene if management, selection and decision are made, needs to be explained;
first, hierarchy of trading idempotent: the hierarchy of the transaction idempotent processing mode in the invention comprises two levels: a peripheral system layer (also called a channel layer) and a transaction layer (also called a system layer);
the transaction power processing mode of the transaction layer or the system layer is set in the transaction configuration table; a processing mode of the transaction idempotent which represents the default support of the transaction; as shown in fig. 6, in addition to the three modes of the first, second and third embodiments, there is a "0-raised" mode;
the transaction idempotent processing mode of the peripheral system layer or the channel layer is set in a transaction registry; representing the processing mode adopted by a certain peripheral system when a certain transaction is called; as shown in fig. 7, a null-idempotent in the transaction configuration table option is added.
Second, strategy of trading idempotent: in terms of the priority of the transaction idempotent processing mode, the priority of a peripheral system layer is higher than that of a transaction layer; the transaction layer's processing mode will only be used when the peripheral system layer is configured as null-in an idempotent mode with transaction configuration table; as shown in fig. 8;
in fig. 8, the procedure of the selection flow of the idempotent transaction method is as follows:
in 501, acquiring a transaction code and a peripheral system ID from the transaction request, inquiring a transaction registry according to the transaction code and the peripheral system ID, and acquiring an idempotent processing mode of a peripheral system layer; judging that the peripheral system layer idempotent mode is null; if not, processing according to the idempotent mode of the peripheral system layer;
in 502, the peripheral system layer idempotent mode is null, a transaction configuration table is inquired according to a transaction code, a default idempotent processing mode of a transaction layer is obtained, and processing is carried out according to the idempotent mode of the transaction layer.
The relevant logics of forward trade clearing and transaction checking in the invention are as follows:
unlike ordinary transactions, there are two transaction serial numbers for transactions of correction and verification: the self-transaction serial number and the target transaction serial number; the idempotent logic of the self-transaction serial number conforms to the mode set forth above; the contents explained here mainly include processing of forward trade, checking trade and target trade serial number;
the processing flow of the transaction sequence number of the hedge transaction to the target transaction is shown in fig. 9;
in fig. 9, the logic flow steps for the transaction are as follows:
in 601, acquiring a target transaction serial flow from the request, and inquiring a transaction idempotent check table according to a target transaction serial number;
in 602, if the relevant information of the target transaction serial number is not found, the relevant information of the target transaction serial number is registered in the checking table for inquiring transaction idempotent, and the state is 'transaction failure, positive already';
if the registration operation is successful, returning to 'original transaction failure'; if the registration operation fails, whether the failure reason is 'unique index conflict' of the transaction power check table is judged. If not, return "system error"; if yes, the check is inquired again;
in 603-determination and processing of the status of the target transaction;
at 604-after confirming that the state of the target transaction is normal, performing traffic reversal logic;
in 605-the transaction status with the new transaction idempotent checklist is "positive successful".
Processing of the target transaction serial number by the verification transaction, as shown in FIG. 10;
in FIG. 10, the logic flow steps for verifying a transaction are as follows:
in 701-obtain the target transaction serial from the request, query the transaction idempotent look-up table according to the target transaction serial number.
In 702-if the relevant information of the target transaction serial number is not found, the relevant information of the target transaction serial number is registered to the checking table for inquiring transaction power and the like, and the state is 'transaction failure, verified';
if the registration operation is successful, returning to 'original transaction failure'; if the registration operation fails, judging whether the failure reason is 'unique index conflict' of the transaction power and other check tables; if not, return "system error"; if yes, the check is inquired again;
in 703-identification and determination of the transaction status of the target transaction.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention are equivalent to or changed within the technical scope of the present invention.

Claims (5)

1.一种联机交易幂等的装置,其特征在于,包括交易幂等检测表、交易有效检测模块和交易幂等控制模块。1. An online transaction idempotent device, characterized in that it comprises a transaction idempotent detection table, a transaction effective detection module and a transaction idempotent control module. 2.根据权利要求1所述的一种联机交易幂等的装置,其特征在于,所述交易幂等检测表的关键字段定义包括字段名称、字段类型和字段说明的定义,所述字段名称包括交易码、外围系统ID、交易流水号、请求报文、响应报文和交易处理状态,所述字段类型字符串和枚举值。2 . The device for online transaction idempotence according to claim 1 , wherein the key field definitions of the transaction idempotency detection table include definitions of field names, field types and field descriptions, and the field names Including transaction code, peripheral system ID, transaction serial number, request message, response message and transaction processing status, the field type string and enumeration value. 3.一种实现权利要求1所述的联机交易幂等的方法,其特征在于,包括以下步骤:3. A method for realizing online transaction idempotency according to claim 1, characterized in that, comprising the following steps: S11、在联机交易处理系统中,从请求报文中获取交易的交易流水号,根据交易流水号查询交易幂等检查表;S11. In the online transaction processing system, obtain the transaction serial number of the transaction from the request message, and query the transaction idempotency check table according to the transaction serial number; S12、通过交易有效检测模块在交易幂等检查表中是否找到当前交易流水号的记录,若没有找到当前交易流水号的记录,则说明该交易从未被处理过;并采用独立事务向交易幂等检查表中登记当前交易流水号相关信息;S12. Whether the record of the current transaction serial number is found in the transaction idempotency check table through the transaction validity detection module, if no record of the current transaction serial number is found, it means that the transaction has never been processed; and an independent transaction is used to report to the transaction power Register the relevant information of the current transaction serial number in the checklist; S13、在当前交易流水号登记操作成功之后,通过交易幂等控制模块继续处理后续的业务逻辑,处理完毕之后,登记交易状态、处理结果以及响应报文,返回响应报文;S13, after the current transaction serial number registration operation is successful, continue to process the subsequent business logic through the transaction idempotent control module, and after the processing is completed, register the transaction status, the processing result and the response message, and return the response message; S14、在当前交易流水号登记操作失败之后,判断失败原因,若失败原因是交易幂等检查表中的交易流水号字段的“唯一索引冲突”,则说明系统中正并发处理相同交易流水号的另一个请求,需要进行后续处理;否则,需要报错系统异常错误;S14. After the current transaction serial number registration operation fails, determine the reason for the failure. If the failure reason is the "unique index conflict" in the transaction serial number field in the transaction idempotency check table, it means that the system is concurrently processing another transaction with the same serial number. A request needs to be processed later; otherwise, an error system exception error needs to be reported; S15、在登记当前交易流水操作失败,报错“唯一索引冲突”之后;再次根据交易流水号查询交易幂等检查表;针对找到的交易,判断交易状态是否为“冲正交易”或“查证交易”;如果是,则说明该记录是由先处理的冲正交易或查证交易插入的,则返回“交易失败,原交易已冲正”或“交易失败,原交易已被查证”;否则,说明该记录是由先处理的原交易插入的,返回“交易处理中”;S15. After the registration of the current transaction flow operation fails and an error of "unique index conflict" is reported; query the transaction idempotency check table according to the transaction serial number again; for the found transaction, determine whether the transaction status is "reversed transaction" or "verified transaction" ; if it is, it means that the record is inserted by the reversal transaction or verification transaction processed first, and returns "transaction failed, the original transaction has been reversed" or "transaction failed, the original transaction has been verified"; otherwise, it indicates that the The record is inserted by the original transaction processed first, and returns "transaction processing"; S16、在S11步骤中查找交易幂等检查表,找到记录;判断交易状态是否为“冲正交易”或“查证交易”;如果是,则说明该记录是由先处理的冲正交易或查证交易插入的,则返回“交易失败,原交易已冲正”或“交易失败,原交易已被查证”;否则,说明该记录是由先处理的原交易插入的,进一步识别判断;若交易状态是否为“处理中”,则返回“交易处理中”;S16, in step S11, look up the transaction idempotency check table, and find the record; determine whether the transaction status is "reversal transaction" or "verification transaction"; if so, it means that the record is a reversal transaction or verification transaction processed first If it is inserted, it will return "transaction failed, the original transaction has been reversed" or "transaction failed, the original transaction has been verified"; otherwise, it indicates that the record was inserted by the original transaction processed first, and further identification and judgment; if the transaction status is whether If it is "processing", it will return "transaction processing"; S17、若S16步骤中处理的原交易状态为“冲正成功”,则返回“交易已冲正”;否则,说明交易已经被正常处理,则返回原交易响应报文。S17. If the status of the original transaction processed in step S16 is "successful reversal", return "transaction has been reversed"; otherwise, it means that the transaction has been processed normally, and return the original transaction response message. 4.根据权利要求3所述的一种联机交易幂等的方法,其特征在于,在所述S11步骤中:任何一笔交易都必须包含交易流水号,且任意一个流水号只能对应一笔交易,任意两笔不同交易必须对应两个不同交易流水号。4. The method for idempotent online transaction according to claim 3, characterized in that, in the step S11: any transaction must contain a transaction serial number, and any serial number can only correspond to one transaction For transactions, any two different transactions must correspond to two different transaction serial numbers. 5.根据权利要求3所述的一种联机交易幂等的方法,其特征在于,所述S12步骤中的独立事务是指与业务处理主事务完全独立的事务,其提交或回滚操作仅影响其内部的操作和数据,而对主事务无影响。5. The method for idempotent online transaction according to claim 3, wherein the independent transaction in the step S12 refers to a transaction that is completely independent from the business processing main transaction, and its commit or rollback operation only affects the Its internal operations and data have no effect on the main transaction.
CN202111046356.5A 2021-09-07 2021-09-07 An idempotent method and device for online transactions Pending CN113744056A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111046356.5A CN113744056A (en) 2021-09-07 2021-09-07 An idempotent method and device for online transactions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111046356.5A CN113744056A (en) 2021-09-07 2021-09-07 An idempotent method and device for online transactions

Publications (1)

Publication Number Publication Date
CN113744056A true CN113744056A (en) 2021-12-03

Family

ID=78736753

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111046356.5A Pending CN113744056A (en) 2021-09-07 2021-09-07 An idempotent method and device for online transactions

Country Status (1)

Country Link
CN (1) CN113744056A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114331661A (en) * 2022-01-12 2022-04-12 平安科技(深圳)有限公司 Data verification method and device, electronic equipment and storage medium
CN115713419A (en) * 2022-11-29 2023-02-24 上海通联金融服务有限公司 Method for generating unique serial number in high concurrency scene

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140164776A1 (en) * 2012-02-20 2014-06-12 Lock Box Pty Ltd Cryptographic method and system
CN104794138A (en) * 2014-01-22 2015-07-22 深圳市沃信科技有限公司 Method, device and system for determining database transaction result
CN105447757A (en) * 2015-11-20 2016-03-30 中国建设银行股份有限公司 Method and system for keeping consistency of transaction information
CN107609793A (en) * 2017-10-09 2018-01-19 税友软件集团股份有限公司 A kind of method and device of process for producing transaction system abnormality
CN107783861A (en) * 2017-07-31 2018-03-09 平安科技(深圳)有限公司 transaction rollback method, device, storage medium and computer equipment
CN108009916A (en) * 2017-12-27 2018-05-08 福建省农村信用社联合社 A kind of method and system of the universal payment book keeping operation based on affairs dynamic adjustment
CN108805569A (en) * 2018-05-29 2018-11-13 阿里巴巴集团控股有限公司 Transaction processing method and device, electronic equipment based on block chain
CN109063027A (en) * 2018-07-16 2018-12-21 阿里巴巴集团控股有限公司 A kind of method and device for business processing
CN111241112A (en) * 2019-12-27 2020-06-05 山大地纬软件股份有限公司 Micro-service call supervision system and method for guaranteeing idempotent
CN111369350A (en) * 2020-03-31 2020-07-03 中国建设银行股份有限公司 Orthogonal punching easy processing method and device
CN111383089A (en) * 2020-03-17 2020-07-07 中国建设银行股份有限公司 Account adjusting method, account adjusting device, terminal equipment and storage medium
CN111459575A (en) * 2020-03-31 2020-07-28 中国银行股份有限公司 Call request processing method and device and computer storage medium
CN111626858A (en) * 2020-05-28 2020-09-04 北京金山云网络技术有限公司 Processing method and device for transaction, electronic equipment and computer readable medium
CN111651244A (en) * 2020-07-01 2020-09-11 中国银行股份有限公司 Processing system for distributed transactions
CN112613993A (en) * 2020-12-26 2021-04-06 中电金信软件有限公司 Transaction data processing method and device, computer equipment and storage medium
CN112967140A (en) * 2021-03-26 2021-06-15 武汉众邦银行股份有限公司 Hot account transaction data processing method based on asynchronous posting of timed tasks

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140164776A1 (en) * 2012-02-20 2014-06-12 Lock Box Pty Ltd Cryptographic method and system
CN104794138A (en) * 2014-01-22 2015-07-22 深圳市沃信科技有限公司 Method, device and system for determining database transaction result
CN105447757A (en) * 2015-11-20 2016-03-30 中国建设银行股份有限公司 Method and system for keeping consistency of transaction information
CN107783861A (en) * 2017-07-31 2018-03-09 平安科技(深圳)有限公司 transaction rollback method, device, storage medium and computer equipment
CN107609793A (en) * 2017-10-09 2018-01-19 税友软件集团股份有限公司 A kind of method and device of process for producing transaction system abnormality
CN108009916A (en) * 2017-12-27 2018-05-08 福建省农村信用社联合社 A kind of method and system of the universal payment book keeping operation based on affairs dynamic adjustment
CN108805569A (en) * 2018-05-29 2018-11-13 阿里巴巴集团控股有限公司 Transaction processing method and device, electronic equipment based on block chain
CN109063027A (en) * 2018-07-16 2018-12-21 阿里巴巴集团控股有限公司 A kind of method and device for business processing
CN111241112A (en) * 2019-12-27 2020-06-05 山大地纬软件股份有限公司 Micro-service call supervision system and method for guaranteeing idempotent
CN111383089A (en) * 2020-03-17 2020-07-07 中国建设银行股份有限公司 Account adjusting method, account adjusting device, terminal equipment and storage medium
CN111369350A (en) * 2020-03-31 2020-07-03 中国建设银行股份有限公司 Orthogonal punching easy processing method and device
CN111459575A (en) * 2020-03-31 2020-07-28 中国银行股份有限公司 Call request processing method and device and computer storage medium
CN111626858A (en) * 2020-05-28 2020-09-04 北京金山云网络技术有限公司 Processing method and device for transaction, electronic equipment and computer readable medium
CN111651244A (en) * 2020-07-01 2020-09-11 中国银行股份有限公司 Processing system for distributed transactions
CN112613993A (en) * 2020-12-26 2021-04-06 中电金信软件有限公司 Transaction data processing method and device, computer equipment and storage medium
CN112967140A (en) * 2021-03-26 2021-06-15 武汉众邦银行股份有限公司 Hot account transaction data processing method based on asynchronous posting of timed tasks

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
刘微: "基于微服务的预付卡系统的研究与设计", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 02, pages 138 - 419 *
知乎: "谈谈异常(二)", Retrieved from the Internet <URL:https://zhuanlan.zhihu.com/p/19861292> *
黄龙: "吉林电信融合支付平台系统的设计研究", 《中国优秀硕士学位论文全文数据库信息科技辑》, no. 09, pages 138 - 58 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114331661A (en) * 2022-01-12 2022-04-12 平安科技(深圳)有限公司 Data verification method and device, electronic equipment and storage medium
CN115713419A (en) * 2022-11-29 2023-02-24 上海通联金融服务有限公司 Method for generating unique serial number in high concurrency scene

Similar Documents

Publication Publication Date Title
US11588651B2 (en) Blockchain timestamp agreement
US11035903B2 (en) Monitoring of batteries in blockchain networks
CN111008402B (en) Blockchain timestamp protocol
US11151236B2 (en) File verification database system
US10997159B2 (en) Blockchain notification board storing blockchain resources
US20220209948A1 (en) Blockchain notification board storing blockchain resources
CN111343142B (en) Data processing method and device based on block chain network and storage medium
US10671308B2 (en) Private and fault-tolerant storage of segmented data
US12147435B2 (en) Blockchain implementing reliability database
US20200076571A1 (en) Checkpointing for increasing efficiency of a blockchain
US20200112446A1 (en) Blockchain timestamp agreement
US11489672B2 (en) Verification of conditions of a blockchain transaction
US11520773B2 (en) Blockchain notification board storing blockchain resources
US11032083B2 (en) Atomic transactional processing
US20200204376A1 (en) File provenance database system
CN110471982B (en) Data processing method and device based on block chain
CN110990879B (en) Data evidence storing method based on block chain
CN113744056A (en) An idempotent method and device for online transactions
CN109886695A (en) Information sharing method and device and electronic equipment between different blocks chain
US20230306443A1 (en) Method and system for establishing digital identity in international trade
US20200057822A1 (en) Secure url shortening
WO2023273059A1 (en) Device monitoring method, system and apparatus, and computer device and storage medium
CN112000943B (en) Information verification method and central cloud platform based on edge computing and cloud-edge fusion
CN106933888A (en) Database configuration management system
CN101464902A (en) Verification method and system for outsourced database query result

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
CB03 Change of inventor or designer information

Inventor after: Wang Yi

Inventor after: Chen Zipei

Inventor before: Chen Dianyin

Inventor before: Zhang Dequan

CB03 Change of inventor or designer information
RJ01 Rejection of invention patent application after publication

Application publication date: 20211203

RJ01 Rejection of invention patent application after publication