CN107783861B - Transaction rollback method, device, storage medium and computer equipment - Google Patents

Transaction rollback method, device, storage medium and computer equipment Download PDF

Info

Publication number
CN107783861B
CN107783861B CN201710643873.8A CN201710643873A CN107783861B CN 107783861 B CN107783861 B CN 107783861B CN 201710643873 A CN201710643873 A CN 201710643873A CN 107783861 B CN107783861 B CN 107783861B
Authority
CN
China
Prior art keywords
transaction
rollback
state
target
data
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.)
Active
Application number
CN201710643873.8A
Other languages
Chinese (zh)
Other versions
CN107783861A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201710643873.8A priority Critical patent/CN107783861B/en
Publication of CN107783861A publication Critical patent/CN107783861A/en
Priority to PCT/CN2018/088569 priority patent/WO2019024583A1/en
Application granted granted Critical
Publication of CN107783861B publication Critical patent/CN107783861B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • 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

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention relates to a transaction rollback method, which comprises the following steps: receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode; if the rollback mode is partial rollback carrying a screening condition and a transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier; detecting a transaction state of the target transaction; and if the transaction state of the target transaction is processed, rolling back the target transaction. By adopting the method, the transaction rollback efficiency can be improved. In addition, a transaction rollback method, a transaction rollback device, a storage medium and a computer device are also provided.

Description

Transaction rollback method, device, storage medium and computer equipment
Technical Field
The invention relates to the technical field of computers, in particular to a transaction rollback method, a transaction rollback device, a transaction rollback storage medium and computer equipment.
Background
Transaction rollback refers to that after a client directly or indirectly conducts product trading on the internet (such as fund transaction), data obtained after the transaction is executed becomes meaningless due to changes of transaction parameters and the like (for example, when the net value of a unit of the fund transaction on the day changes, the fund share purchased by the user changes, and the fund share obtained by originally executing the fund transaction is no longer useful), so that the data obtained after the transaction is required to be restored to the last correct state.
The traditional transaction rollback method is to perform full rollback on batch transactions after all received batch transactions are executed. However, when the number of batch transactions is large, the transaction full rollback takes a long time, making the transaction rollback inefficient.
Disclosure of Invention
The embodiment of the invention provides a transaction rollback method, a transaction rollback device, a storage medium and computer equipment, which can improve the transaction rollback efficiency.
A transaction rollback method, the method comprising:
receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode;
if the rollback mode is partial rollback carrying a screening condition and a transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier;
detecting a transaction state of the target transaction;
and if the transaction state of the target transaction is processed, rolling back the target transaction.
In one embodiment, the screening criteria includes at least one of a transaction product and a transaction user.
In one embodiment, the rolling back the target transaction includes: changing the data written into the database in the execution process of the target transaction into the data before the target transaction is executed; and modifying the transaction state of the target transaction into a pending state.
In one embodiment, the method further comprises: if the rollback mode is partial rollback with transaction data, analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier; if the transaction product identification is consistent with the preset additional transaction product identification in comparison, and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in a database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date; and rolling back the transaction to be rolled back.
In one embodiment, the method further comprises: if the rollback mode is full rollback with transaction batch identification, acquiring the transaction corresponding to the transaction batch identification; detecting a transaction state of the target transaction; and if the transaction state of the target transaction is processed, rolling back the transaction corresponding to the transaction batch identifier.
A data rollback apparatus, the apparatus comprising:
the transaction rollback instruction receiving module is used for receiving a transaction rollback instruction, and the transaction rollback instruction carries a rollback mode;
the transaction screening module is used for screening out target transactions meeting the screening conditions from the transactions corresponding to the transaction batch identifications if the rollback mode is partial rollback carrying the screening conditions and the transaction batch identifications;
the transaction state detection module is used for detecting the transaction state of the target transaction;
and the transaction rollback module is used for rolling back the target transaction if the transaction state of the target transaction is processed.
In one embodiment, the transaction rollback module is configured to change data written into a database during execution of the target transaction into data before execution of the target transaction; and modifying the transaction state of the target transaction into a pending state.
In one embodiment, the transaction rollback module is further configured to, if the rollback mode is partial rollback with transaction data, analyze the transaction data to obtain a transaction product identifier, a transaction application date, and a transaction product holding user identifier; if the transaction product identification is consistent with the preset additional transaction product identification in comparison, and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in a database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date; and rolling back the transaction to be rolled back.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode;
if the rollback mode is partial rollback carrying a screening condition and a transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier;
detecting a transaction state of the target transaction;
and if the transaction state of the target transaction is processed, rolling back the target transaction.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode;
if the rollback mode is partial rollback carrying a screening condition and a transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier;
detecting a transaction state of the target transaction;
and if the transaction state of the target transaction is processed, rolling back the target transaction.
According to the transaction rollback method, the transaction rollback device, the storage medium and the computer equipment, the transaction rollback instruction is received, the transaction rollback instruction carries the rollback mode, if the rollback mode is partial rollback carrying the screening condition and the transaction batch identification, target transactions meeting the screening condition are screened from the transactions corresponding to the transaction batch identification, the transaction state of the target transactions is detected, and if the transaction state of the target transactions is processed, the target transactions are rolled back. When the batch transaction is being executed or is completed, the parameters of part of transactions in the batch transaction are found to be changed, and only the part of transactions need to be rolled back.
Drawings
FIG. 1 is a diagram of an application environment for a transaction rollback method in one embodiment;
FIG. 2 is an internal block diagram of a server in one embodiment;
FIG. 3 is a flow diagram of a transaction rollback method in one embodiment;
FIG. 4 is a flow diagram of a target transaction rollback method in one embodiment;
FIG. 5 is a flow diagram of a method for partial rollback of an additional entry transaction in one embodiment;
FIG. 6 is a flow diagram of a batch transaction full rollback method in one embodiment;
FIG. 7 is a flow diagram of a transaction rollback method in another embodiment;
fig. 8 is a block diagram of the structure of a transaction rollback apparatus in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The transaction rollback method provided by the embodiment of the invention can be applied to the environment shown in fig. 1. Referring to fig. 1, the server 102 receives a transaction rollback instruction sent by the terminal 104. Specifically, the server 102 communicates with the terminal 104 through a network, the server 102 receives a transaction rollback instruction sent by the terminal 104, and the transaction rollback instruction carries a rollback mode; if the rollback mode is partial rollback carrying the screening condition and the transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier; detecting a transaction state of a target transaction; and if the transaction state of the target transaction is processed, rolling back the target transaction. The terminal includes, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, portable wearable devices, and the like. It should be noted that the transaction rollback method provided by the embodiment of the present invention may also be implemented only through the server 102.
In one embodiment, as shown in fig. 2, there is further provided a server, where the server includes a processor, a non-volatile storage medium, an internal memory, and a network connection port, which are connected by a system bus, and the non-volatile storage medium stores therein an operating system and computer-executable instructions for implementing the medical service reservation method provided in this embodiment. The processor is used for improving the calculation and control capacity and supporting the operation of the whole server. The internal memory is used to provide an environment for the operating system and the execution of computer-executable instructions in the non-volatile storage medium. The network interface is used for network communication with the terminal. Those skilled in the art will appreciate that the architecture shown in fig. 2 is a block diagram of only a portion of the architecture associated with the subject application, and does not constitute a limitation on the servers to which the subject application applies, and in particular that a server may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
In one embodiment, as shown in fig. 3, there is provided a transaction rollback method, which is described as applied to a server as in fig. 2, including:
step 302, receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode.
The transaction rollback means that after a client directly or indirectly performs product trading on the internet (for example, fund transaction), data obtained after the transaction is executed becomes meaningless due to changes of transaction parameters and the like (for example, when the net value of a unit of the fund buying transaction on the same day changes, the share of the fund purchased by the user changes, and the share of the fund obtained by originally executing the fund transaction is no longer useful), so that the data obtained after the transaction is required to be restored to the last correct state.
The transaction rollback instruction may be an instruction for presetting timing start, or an instruction initiated by an operator in real time through a terminal. In an embodiment, the server starts a preset transaction rollback instruction according to a preset start time, for example, the transaction rollback instruction is started at 5 pm and 6 pm of 25 th in 2017, the transaction rollback instruction carries data indicating a rollback mode, and if the transaction rollback instruction carries a screening condition and a transaction batch identifier, the rollback mode is partial rollback in the transaction corresponding to the transaction batch identifier, and if the transaction rollback instruction only carries the transaction batch identifier, the rollback mode is full rollback of the transaction corresponding to the transaction batch identifier. In other embodiments, the terminal operator first enters data indicating the rollback mode, and specifically, may select a dimension of the filter condition in a given filter condition drop-down list, and then enter a specific filter form corresponding to the dimension of the filter condition in a text box, such as the selected dimension of the filter condition being a transaction product, entering a transaction product name or a transaction product identifier in the text box, and/or entering (or selecting) a batch identifier in which the transaction to be rolled back is located in a given batch identifier input box (or selection box), and then sending a transaction rollback instruction to the server by clicking a "send" button.
The rollback mode includes full rollback and partial rollback. The full rollback refers to rolling back the received batch transaction data, wherein the batch transaction data may be transaction data with a transaction application date as a batch identifier. Specifically, the transaction application date may be a specific date (e.g., 7/month 2 of 2017) or a time range (e.g., 6/month 2 of 2017 to 7/month 2 of 2017).
And 304, if the rollback mode is partial rollback which carries the screening condition and the transaction batch identifier, screening out target transactions which meet the screening condition from the transactions corresponding to the transaction batch identifier.
The screening conditions are based on actual transaction requirements. In this embodiment, the filtering condition includes at least one of two dimensions of a transaction product and a transaction user. Specifically, the expression form of the trading product may be a trading product name, a trading product type, or a trading product identifier (such as a product code); the expression form of the transaction user can be a transaction product holding user name, or a transaction product holding user identifier (such as a user identification number) and the like. It should be noted that the screening conditions are not limited to the screening conditions of two dimensions of the transaction product and the transaction user listed in this embodiment, and in this embodiment, screening conditions of other dimensions may also be formulated according to actual transaction requirements.
The transaction lot identifier is used to uniquely identify the received batch transaction, and specifically may be a transaction application date, such as the lot 20170405, or a variant of a string based on the transaction application date, such as the lots 20170405001 and 20170405002, or a transaction lot identifier generated by a custom rule, such as the lot S342209A. In addition, the number of received transaction batch identifiers is not limited, and may be one or more.
The target transactions are screened out from the transactions stored in the server based on the screening criteria and the transaction batch identification. The transactions stored by the server are obtained from a sales platform such as a bank. For example, if the screening condition is a fund product identification of 004282 and the transaction lot identification of 20160504, then the target transaction is a fund transaction in which the user purchased or redeemed the fund product identification of 004282 in a fund transaction conducted on the day of 2016, 5, 4; or the screening condition is that the fund transaction holds the user identifier of 342401196802058475, the transaction batch identifiers are 20160504, 20160505 and 20160506, and the target transaction is the fund transaction which is carried out by the user with the user identifier of 342401196802058475 in 2016, 5-month-4-2016 to 5-month-2016, 6-three days.
At step 306, the transaction status of the target transaction is detected.
For transaction products with large transaction amount, transaction data are processed by adopting a multi-thread parallel execution mode, so that after target transactions are screened out, the transaction state of the target transactions also needs to be detected. The transaction state comprises three states of pending, processing and processed. Specifically, after the server receives transaction data carrying a transaction batch identifier uploaded by a terminal, the transaction data is stored in a database and marked as a to-be-processed state; the server detects whether the transaction in the pending state is in the database or not at regular time, if so, the processing state of the transaction is changed into the processing state, and the transaction is executed according to a preset transaction execution rule; when the transaction is successfully executed, such as in a fund purchase transaction, the server successfully writes the fund share of the fund transaction into the database and sends the fund share to the user terminal, and the processing state of the transaction is changed into the processed state.
In this embodiment, after the target transaction meeting the screening condition is found out from the received batch transactions, the transaction state of the target transaction needs to be detected, and corresponding subsequent operations are performed according to the transaction state.
Step 308, if the transaction status of the target transaction is processed, rolling back the target transaction.
In this embodiment, if the transaction state of the target transaction is processed, it indicates that the target transaction is in the executing batch transaction, and the target transaction is processed, the target transaction can be rolled back, and there is no influence on the non-target transaction in the batch transaction still in the executing state; or the batch transaction of the batch of the target exchange is processed, the target transaction can be rolled back. In addition, after the target transaction rollback is successful, the target transaction needs to be re-executed according to the changed value of the transaction execution parameter, so that the server sends data obtained after the target transaction is re-executed to the terminal. For example, a client spends 2000 yuan in 7/3/2017 to purchase a fund, the server acquires that the unit net worth of the fund is 1 yuan/share in 7/3/2017, informs the client that 2000 shares of the fund are purchased, and the unit net worth of the fund is 1.5 yuan/share in 8/3/2017, so that the server is required to perform transaction rollback, change the account assets of the client in 8/3/2017 into the total account assets in 6/3/2017, namely empty, and re-read the unit net worth data of the fund in 8/3/2017, thereby calculating that the client owns 3000 yuan.
In this embodiment, after the batch transaction is being executed or is completed, it is found that parameters of part of the received batch transaction are changed, and only the part of the transaction needs to be rolled back.
In one embodiment, as shown in FIG. 4, the step of rolling back the target transaction includes:
step 318, changing the data written into the database during the execution process of the target transaction into the data before the target transaction is executed.
The execution flow of the transaction is preset, and the data written into the database in the execution process of the transaction is determined. For example, the execution flow of each fund transaction is as follows: reading the fund transaction type, if the fund transaction type is purchase, reading the fund transaction amount, obtaining the unit net value of the fund transaction application date provided by the fund net value interface, calculating the user holding share according to the fund transaction amount and the unit net value, calculating the current user holding share according to the calculated user holding share and the pre-stored user historical holding share, obtaining the current unit net value of the fund, and calculating the current asset net value according to the current user holding share and the current unit net value; if the fund transaction type is redeemed, the share held by the user is read, the unit net value of the fund transaction application date provided by the fund net value interface is obtained, the redeemed amount of the user is calculated according to the share held by the user and the unit net value, the current unit net value of the fund is obtained, and the current equity is calculated according to the current unit net value of the fund and the pre-stored historical share held by the user. Thus, the data written to the database during execution of the fund transaction is the user's share or the user's redemption amount. Then, for rollback of the target transaction, the value corresponding to the user's share (fund transaction type is purchase) or the value corresponding to the user's redeemed amount (fund transaction type is redemption) written into the database during the execution of the target transaction needs to be modified to be null before the execution of the transaction, and the current net asset value is changed to be the historical net asset value before the execution of the transaction.
Step 328, modify the transaction status of the target transaction to a pending status.
After the target transaction is executed, the transaction state is changed to a "processed" state. Then, for rollback of the target transaction, the transaction state needs to be modified to a "pending" state.
In the embodiment, the rollback of the target transaction is realized through the program codes, instead of the rollback of the target transaction through the database, when the rollback of the target transaction has a problem, the error position can be positioned in real time, so that the problem is solved in time, the data rollback is carried out again, and the timeliness of transaction processing is ensured.
In one embodiment, as shown in fig. 5, after step 308, the method further includes:
step 502, if the rollback mode is partial rollback with transaction data, analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier.
In this embodiment, the transaction data is generated by a user directly or indirectly performing a trade transaction operation via the internet. For example, the fund transaction data includes: the fund holds user identification, fund transaction type, fund identification, fund transaction application date, transaction amount or user hold share, etc.
And step 504, if the transaction product identification is consistent with the preset additional transaction product identification in comparison and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in the database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date.
In this embodiment, if the transaction product identifier is consistent with the preset additional transaction product identifier, it is indicated that the transaction product is a transaction product capable of performing additional transaction data operation, and the transaction application date is earlier than the current date of the system, which indicates that additional transaction data of the transaction product is currently required to be performed. Then, after the transaction data of the transaction product is additionally recorded in the system, all transaction data after the additional transaction application date need to be rolled back before executing the additional transaction data.
For example, for some low volume fund products, the system does not perform batch transactions every day, but rather performs post-transaction subsidies. Taking the transaction application date as the transaction batch identifier as an example, the following description is made: when the transaction with the transaction batch identifier 20170605 is entered first and the transaction with the transaction batch identifier 20170302 is entered later, transaction data rollback is performed before the transaction with the transaction batch identifier 20170302 is executed, that is, the transaction data with the transaction batch identifier 20170605 is restored to the state with the transaction batch identifier 20170301.
At step 506, the transaction to be rolled back is rolled back.
In the embodiment, a single-thread execution mode is adopted for processing the transaction data with a smaller transaction amount, so that before the additional transaction is executed, the transaction data to be rolled back needs to be directly rolled back after the transaction to be rolled back is determined, namely, a data value written into a database in the execution process of the transaction to be rolled back is changed into a data value before the transaction to be rolled back is executed, and the transaction state of the transaction to be rolled back is modified into a state to be processed.
In the embodiment, the rollback method for partial rollback of the transaction product with large transaction amount is provided, and the rollback method for partial rollback of the transaction product with small transaction amount due to the additional transaction is also provided, so that the system can perform rollback in different modes according to the transaction amount of the transaction product, and the flexibility of transaction rollback is improved.
In one embodiment, as shown in fig. 6, after step 308, the method further includes:
step 602, if the rollback mode is full rollback with the transaction batch identifier, obtaining the transaction corresponding to the transaction batch identifier.
Similarly, the transaction batch identifier is used to uniquely identify the received batch transaction, and specifically may be a transaction application date, or a variant of a character string based on the transaction application date, or a transaction batch identifier generated by a custom rule, or the like. In addition, the number of received transaction batch identifiers is not limited, and may be one or more.
At step 604, the transaction status of the transaction corresponding to the transaction batch identifier is detected.
Similarly, for a transaction product with a large transaction amount, the transaction data is processed in the multi-thread parallel execution mode, and therefore, after a transaction corresponding to the transaction batch identifier is acquired, the transaction state of the transaction needs to be detected. The transaction state comprises three states of pending, processing and processed.
In step 606, if the transaction status of the transaction corresponding to the transaction batch identifier is processed, the transaction corresponding to the transaction batch identifier is rolled back.
When only the transaction batch identifier is received and the transaction state of the transaction corresponding to the transaction identifier is determined to be processed, rolling back the batch transaction corresponding to the received transaction batch identifier: changing the data written into the database in the execution process of the transaction corresponding to the transaction batch identifier into the data before the transaction corresponding to the transaction batch identifier is executed; and modifying the transaction state corresponding to the transaction batch identifier into a to-be-processed state.
In this embodiment, a rollback method that can perform partial rollback on transaction products with large transaction amounts is provided, and a rollback method that can perform full rollback on received batch transaction data is also provided, so that the system can perform rollback in different ways, and flexibility of transaction rollback is improved.
In one embodiment, as shown in fig. 7, another transaction rollback method is provided, comprising:
step 702, receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode.
Similarly, the transaction rollback instruction may be an instruction for presetting timing start, or an instruction initiated by an operator in real time through a terminal; the rollback mode includes full rollback and partial rollback.
And 704, if the rollback mode is partial rollback which carries the screening condition and the transaction batch identifier, screening out target transactions which meet the screening condition from the transactions corresponding to the transaction batch identifier.
The screening conditions are based on actual transaction requirements. In this embodiment, the filtering condition includes at least one of two dimensions of a transaction product and a transaction user. Specifically, the expression form of the trading product may be a trading product name, a trading product type, or a trading product identifier, etc.; the expression form of the transaction user can be a transaction product holding user name, or a transaction product holding user identifier and the like. It should be noted that the screening conditions are not limited to the screening conditions of two dimensions of the transaction product and the transaction user listed in this embodiment, and in this embodiment, screening conditions of other dimensions may also be formulated according to actual transaction requirements.
The transaction batch identifier is used to uniquely identify the received batch transaction. In this embodiment, the number of received transaction batch identifiers is not limited, and may be one or more.
At step 706, the transaction status of the target transaction is detected.
For transaction products with large transaction amount, transaction data are processed by adopting a multi-thread parallel execution mode, so that after target transactions meeting the screening condition are found out from received batch transactions, the transaction state of the target transactions needs to be detected, and corresponding subsequent operations are carried out according to the transaction state.
At step 708, if the transaction status of the target transaction is processed, the target transaction is rolled back.
The transaction state comprises three states of pending, processing and processed. The rollback may be performed only after the target transaction execution is complete.
And step 710, if the rollback mode is partial rollback with transaction data, analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier.
The transaction data is data generated by the user directly or indirectly conducting trading transaction operations through the internet. For example, the fund transaction data includes: the fund holds user identification, fund transaction type, fund identification, fund transaction application date, transaction amount or user hold share, etc.
And 712, if the transaction product identification is consistent with the preset additional transaction product identification in comparison and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in the database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date.
If the trade product identification is consistent with the preset additional trade product identification, the trade product is a trade product capable of conducting trade data additional record operation, and the trade application date is earlier than the current date of the system, and the current additional record of the trade data of the trade product is needed. Then, after the transaction data of the transaction product is additionally recorded in the system, all transaction data after the additional transaction application date need to be rolled back before executing the additional transaction data.
At step 714, the transaction to be rolled back is rolled back.
The processing of the transaction data with a small transaction amount adopts a single-thread execution mode, so that before the additional recording transaction is executed, the transaction data to be rolled back needs to be directly rolled back after the transaction to be rolled back is determined.
In step 716, if the rollback mode is full rollback with the transaction batch identifier, the transaction corresponding to the transaction batch identifier is obtained.
When only the transaction batch identifier is received, it is indicated that the transaction corresponding to the transaction batch identifier needs to be rolled back in a full amount currently.
At step 718, the transaction status of the transaction corresponding to the transaction batch identifier is detected.
For a transaction product with a large transaction amount, a multi-thread parallel execution mode is adopted to process transaction data, so that after a transaction corresponding to a transaction batch identifier is acquired, the transaction state of the transaction needs to be detected.
In step 720, if the transaction status of the transaction corresponding to the transaction batch identifier is processed, the transaction corresponding to the transaction batch identifier is rolled back.
And after the transaction corresponding to the received transaction batch identifier is obtained and the transaction state of the transaction corresponding to the transaction identifier is determined to be processed, rolling back the transaction in full.
In this embodiment, a rollback method for performing partial rollback on a transaction product with a large transaction amount, a rollback method for performing partial rollback on a transaction product with a small transaction amount due to entry-added transactions, and a rollback method for performing full rollback on received batch transaction data are provided, so that the system can perform rollback in different ways according to the transaction amount of the transaction product, and flexibility of transaction rollback is improved.
In one embodiment, as shown in fig. 8, there is provided a transaction rollback apparatus comprising:
the transaction rollback instruction receiving module 802 is configured to receive a transaction rollback instruction, where the transaction rollback instruction carries a rollback mode.
And the transaction screening module 804 is configured to screen out a target transaction meeting the screening condition from the transactions corresponding to the transaction batch identifier if the rollback mode is partial rollback carrying the screening condition and the transaction batch identifier.
And a transaction state detection module 806, configured to detect a transaction state of the target transaction.
The transaction rollback module 808 is configured to rollback the target transaction if the transaction state of the target transaction is processed.
In one embodiment, the filtering condition includes at least one of a transaction product and a transaction product holding user.
In one embodiment, the transaction rollback module 808 is configured to change the data written to the database during the execution of the target transaction to the data before the execution of the target transaction; and modifying the transaction state of the target transaction into a pending state.
In one embodiment, the transaction rollback module 808 is further configured to, if the rollback mode is partial rollback with transaction data, analyze the transaction data to obtain a transaction product identifier, a transaction application date, and a transaction product holding user identifier; if the transaction product identification is consistent with the preset additional transaction product identification in comparison and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in the database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date; and rolling back the transaction to be rolled back.
In one embodiment, the transaction rollback module 808 is further configured to obtain the transaction corresponding to the transaction batch identifier if the rollback mode is full rollback with the transaction batch identifier; and detecting the transaction state of the transaction corresponding to the transaction batch identifier, and rolling back the transaction corresponding to the transaction batch identifier if the transaction state of the transaction corresponding to the transaction batch identifier is processed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, performs the steps of:
receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode;
if the rollback mode is partial rollback carrying the screening condition and the transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier;
detecting a transaction state of a target transaction;
and if the transaction state of the target transaction is processed, rolling back the target transaction.
In one embodiment, the screening criteria includes at least one of a transaction product and a transaction user.
In one embodiment, the step performed by the processor of rolling back the target transaction includes: changing the data written into the database in the execution process of the target transaction into the data before the target transaction is executed; and modifying the transaction state of the target transaction into a pending state.
In one embodiment, the program executed by the processor further comprises the steps of: if the rollback mode is partial rollback with transaction data, analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier; if the transaction product identification is consistent with the preset additional transaction product identification in comparison and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in the database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date; and rolling back the transaction to be rolled back.
In one embodiment, the processor-executed program executed by the processor further comprises the steps of: if the rollback mode is full rollback with the transaction batch identification, acquiring the transaction corresponding to the transaction batch identification; and detecting the transaction state of the transaction corresponding to the transaction batch identifier, and rolling back the transaction corresponding to the transaction batch identifier if the transaction state of the transaction corresponding to the transaction batch identifier is processed.
In one embodiment, a computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode;
if the rollback mode is partial rollback carrying the screening condition and the transaction batch identifier, screening out target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier;
detecting a transaction state of a target transaction;
and if the transaction state of the target transaction is processed, rolling back the target transaction.
In one embodiment, the screening criteria includes at least one of a transaction product and a transaction user.
In one embodiment, the step performed by the processor of rolling back the target transaction includes: changing the data written into the database in the execution process of the target transaction into the data before the target transaction is executed; and modifying the transaction state of the target transaction into a pending state.
In one embodiment, the program executed by the processor further comprises the steps of: if the rollback mode is partial rollback with transaction data, analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier; if the transaction product identification is consistent with the preset additional transaction product identification in comparison and the transaction application date is earlier than the current date, searching for the transaction to be rolled back which is stored in the database, identical to the transaction product identification and the transaction product holding user identification and has the transaction application date later than the transaction application date; and rolling back the transaction to be rolled back.
In one embodiment, the processor-executed program executed by the processor further comprises the steps of: if the rollback mode is full rollback with batch identification, acquiring the transaction corresponding to the batch identification; and detecting the transaction state of the transaction corresponding to the transaction batch identifier, and rolling back the transaction corresponding to the transaction batch identifier if the transaction state of the transaction corresponding to the transaction batch identifier is processed.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (8)

1. A transaction rollback method, the method comprising:
receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode, and the transaction refers to the transaction of product buying and selling directly or indirectly on the Internet by a client;
if the rollback mode is partial rollback which carries a screening condition and a transaction batch identifier, screening target transactions meeting the screening condition from the transactions corresponding to the transaction batch identifier, wherein the screening condition comprises at least one of transaction products and transaction users;
detecting a transaction state of the target transaction;
if the transaction state of the target transaction is processed, rolling back the target transaction;
the step of detecting the transaction status of the target transaction comprises: processing transaction data by adopting a multithreading parallel execution mode, storing the transaction data into a database after receiving the transaction data which is uploaded by a terminal and carries a transaction batch identifier, and marking the transaction data as a to-be-processed state; detecting whether the transaction in the pending state is in the database or not at regular time, if so, changing the processing state of the transaction into a processing state, executing the transaction according to a preset transaction execution rule, and changing the processing state of the transaction into a processed state when the transaction is successfully executed;
if the rollback mode is partial rollback with transaction data, analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier;
if the transaction product identification is consistent with the preset additional transaction product identification in comparison, and the transaction application date is earlier than the current date, searching for the transaction to be rolled back, which is stored in a database, is the same as the transaction product identification and the transaction product holding user identification, and the transaction application date is later than the transaction application date corresponding to the transaction product identification;
and rolling back the transaction to be rolled back.
2. The method of claim 1, wherein rolling back the target transaction comprises:
changing the data written into the database in the execution process of the target transaction into the data before the target transaction is executed;
and modifying the transaction state of the target transaction into a pending state.
3. The method of claim 1, further comprising:
if the rollback mode is full rollback with transaction batch identification, acquiring the transaction corresponding to the transaction batch identification;
detecting the transaction state of the transaction corresponding to the transaction batch identifier;
and if the transaction state of the transaction corresponding to the transaction batch identifier is processed, rolling back the transaction corresponding to the transaction batch identifier.
4. A transaction rollback apparatus, wherein the apparatus comprises:
the transaction rollback instruction receiving module is used for receiving a transaction rollback instruction, wherein the transaction rollback instruction carries a rollback mode, and the transaction refers to the transaction of a client for directly or indirectly buying and selling products on the Internet;
the transaction screening module is used for screening target transactions meeting screening conditions from the transactions corresponding to the transaction batch identifications if the rollback mode is partial rollback carrying the screening conditions and the transaction batch identifications, wherein the screening conditions comprise at least one of transaction products and transaction users;
the transaction state detection module is used for detecting the transaction state of the target transaction;
the transaction rollback module is used for rolling back the target transaction if the transaction state of the target transaction is processed;
the transaction state detection module is also used for processing transaction data by adopting a multithreading parallel execution mode, storing the transaction data into a database after receiving the transaction data which is uploaded by a terminal and carries a transaction batch identifier, and marking the transaction data as a to-be-processed state; detecting whether the transaction in the pending state is in the database or not at regular time, if so, changing the processing state of the transaction into a processing state, executing the transaction according to a preset transaction execution rule, and changing the processing state of the transaction into a processed state when the transaction is successfully executed;
the transaction rollback module is further used for analyzing the transaction data to obtain a transaction product identifier, a transaction application date and a transaction product holding user identifier if the rollback mode is partial rollback with transaction data; if the transaction product identification is consistent with the preset additional transaction product identification in comparison, and the transaction application date is earlier than the current date, searching for the transaction to be rolled back, which is stored in a database, is the same as the transaction product identification and the transaction product holding user identification, and the transaction application date is later than the transaction application date corresponding to the transaction product identification; and rolling back the transaction to be rolled back.
5. The apparatus of claim 4, wherein the transaction rollback module is configured to change data written into a database during execution of the target transaction into data before execution of the target transaction; and modifying the transaction state of the target transaction into a pending state.
6. The apparatus according to claim 4, wherein the transaction rollback module is further configured to obtain the transaction corresponding to the transaction batch identifier if the rollback mode is full rollback with a transaction batch identifier; detecting the transaction state of the transaction corresponding to the transaction batch identifier; and if the transaction state of the transaction corresponding to the transaction batch identifier is processed, rolling back the transaction corresponding to the transaction batch identifier.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 3.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to any one of claims 1 to 3 when executing the computer program.
CN201710643873.8A 2017-07-31 2017-07-31 Transaction rollback method, device, storage medium and computer equipment Active CN107783861B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710643873.8A CN107783861B (en) 2017-07-31 2017-07-31 Transaction rollback method, device, storage medium and computer equipment
PCT/CN2018/088569 WO2019024583A1 (en) 2017-07-31 2018-05-27 Transaction rollback method and apparatus, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710643873.8A CN107783861B (en) 2017-07-31 2017-07-31 Transaction rollback method, device, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN107783861A CN107783861A (en) 2018-03-09
CN107783861B true CN107783861B (en) 2020-11-24

Family

ID=61437725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710643873.8A Active CN107783861B (en) 2017-07-31 2017-07-31 Transaction rollback method, device, storage medium and computer equipment

Country Status (2)

Country Link
CN (1) CN107783861B (en)
WO (1) WO2019024583A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107783861B (en) * 2017-07-31 2020-11-24 平安科技(深圳)有限公司 Transaction rollback method, device, storage medium and computer equipment
CN109240735B (en) * 2018-07-27 2021-09-24 平安科技(深圳)有限公司 Requirement rollback scheme filling method and device, terminal and readable storage medium
CN109493230B (en) * 2018-12-28 2020-09-15 中国银行股份有限公司 Supplementary recording method and device for unilateral transaction
CN109885422B (en) * 2018-12-29 2024-01-12 贝壳技术有限公司 Data rollback method and device for configuration platform in real estate transaction system
CN112598520B (en) * 2020-12-28 2024-06-11 中国农业银行股份有限公司 Transaction management method, device, electronic equipment and storage medium
CN113744056A (en) * 2021-09-07 2021-12-03 辽宁振兴银行股份有限公司 Online transaction idempotent method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794138A (en) * 2014-01-22 2015-07-22 深圳市沃信科技有限公司 Method, device and system for determining database transaction result
CN105659204A (en) * 2013-08-13 2016-06-08 经度事业闪存公司 Method and apparatus for performing annotated atomic write operations

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571850B (en) * 2010-12-24 2014-08-06 中国移动通信集团山东有限公司 Transaction committing system, method and equipment
JP5978008B2 (en) * 2012-05-29 2016-08-24 みずほ情報総研株式会社 Transaction management system, transaction management method, and transaction management program
US9104630B1 (en) * 2012-10-24 2015-08-11 Google Inc. Online account reset, rollback, and backup
CN103077019B (en) * 2012-12-27 2016-07-06 中国建设银行股份有限公司 A kind of graphical parameter batch maintenance method and device
CN105989133B (en) * 2015-02-25 2019-10-01 阿里巴巴集团控股有限公司 Transaction methods and device
CN106991606B (en) * 2017-03-29 2020-09-18 恒生电子股份有限公司 Transaction data processing method and device
CN107783861B (en) * 2017-07-31 2020-11-24 平安科技(深圳)有限公司 Transaction rollback method, device, storage medium and computer equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105659204A (en) * 2013-08-13 2016-06-08 经度事业闪存公司 Method and apparatus for performing annotated atomic write operations
CN104794138A (en) * 2014-01-22 2015-07-22 深圳市沃信科技有限公司 Method, device and system for determining database transaction result

Also Published As

Publication number Publication date
WO2019024583A1 (en) 2019-02-07
CN107783861A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
CN107783861B (en) Transaction rollback method, device, storage medium and computer equipment
KR102260569B1 (en) Apparatus and method for recommending user customized finalcial goods
WO2019080662A1 (en) Information recommendation method, device and apparatus
CN108399565A (en) Financial product recommendation apparatus, method and computer readable storage medium
CN107784504B (en) Method for generating return visit event of client and terminal equipment
CN103703436A (en) Data processing device, data processing method, data processing program, and computer-readable recording medium which records program
US10607204B2 (en) Support messages based on merchant account context
US20230206333A1 (en) Systems and methods for measurement of data to provide decision support
US20140046708A1 (en) Systems and methods for determining a cloud-based customer lifetime value
CN114116802A (en) Data processing method, device, equipment and storage medium of Flink computing framework
CN108229925B (en) Data matching method and system for electronic receipt
US20160300203A1 (en) Settlement system, server device, terminal device, recording medium, method and program
CN110838041B (en) Virtual resource activity processing method and device, computer equipment and storage medium
JP6947185B2 (en) Anomaly detectors, control methods, and programs
CN114186961A (en) Business approval process configuration method and device, computer equipment and storage medium
CN114169780A (en) Service processing method, device and storage medium
US10096045B2 (en) Tying objective ratings to online items
CN116467525A (en) Recommendation method, device, equipment and storage medium of business products
CN114493821B (en) Data verification and cancellation method and device, computer equipment and storage medium
CN110264211B (en) Wind control method, system, device and equipment
CN110750558A (en) Financial data management method, device, computer equipment and storage medium
CN115170313A (en) Transaction risk determination method and device and server
CN117033768A (en) Carbon emission information recommendation method, device and equipment based on financial client
CN118396626A (en) Transaction quota processing method, device, computer equipment and storage medium
CN118035052A (en) Breakpoint event processing method and device and computer equipment

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