A method and device for storing flush data
By using the transaction identifier as the second primary key identifier in the reversal data table, the problem of coupling in the reversal data table structure of different businesses is solved, achieving unified storage and efficient maintenance, simplifying data structure design, and reducing system maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-09
- Publication Date
- 2026-04-14
AI Technical Summary
Because the reversal data table structures of different business operations are highly coupled, the maintenance of the reversal data table is difficult, and the data structure needs to be frequently modified when business requirements change, which affects the stability and scalability of the system.
The transaction identifier is used as the second primary key identifier. Business data is stored in the reversal data table. The reversal data is uniquely identified by the transaction identifier, thereby decoupling the business data from the reversal data table and storing the reversal data of different businesses in a unified manner.
It reduces the maintenance difficulty of the reversal data table, improves storage efficiency, simplifies table structure design, reduces the coupling between business logic and technical modules, and enhances the system's inclusiveness and scalability.
Smart Images

Figure CN114706858B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a method and apparatus for storing corrected data. Background Technology
[0002] In the daily business processes of the financial industry, users can perform financial operations on their accounts, such as deposits, loans, and withdrawals, according to business needs, thus generating positive transactions. Due to specific reasons (such as human error, system misprocessing, etc.), it may be necessary to reverse positive transactions (also known as reverse transactions) to ensure the accuracy of core business data.
[0003] In related technologies, financial information systems store business data tables with multiple fields (columns), each row representing a single business data entry, identified by a primary key. Additionally, the system also stores reversal data tables corresponding to each business transaction. These tables include fields such as the primary key identifier of the relevant business data, the data before modification, and the data after modification. This allows the system to revert (modify) business data tables based on the information stored in the reversal data tables when processing reversal transaction requests. Since the actual range of updated fields differs for different business transactions, the structure of the reversal data tables varies, resulting in a high degree of coupling between the reversal data table structure and the business logic.
[0004] However, different business needs in related technologies require different reversal data tables, making the maintenance of reversal data tables quite difficult. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, apparatus, server equipment, computer-readable storage medium, and computer program product for storing reversal data that can reduce the maintenance difficulty of reversal data tables, in order to address the above-mentioned technical problems.
[0006] Firstly, this application provides a method for storing reversal data. The method includes:
[0007] Receive positive transaction requests;
[0008] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0009] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0010] In one embodiment, determining the transaction identifier corresponding to the positive transaction request and storing the first business data in the reversal data table using the transaction identifier as the second primary key identifier includes:
[0011] If it is determined that the positive transaction request meets the conditions for a reverse transaction, the transaction identifier corresponding to the positive transaction request is determined;
[0012] Using the transaction identifier as the second primary key identifier, the first business data is stored in the reversal data table.
[0013] In one embodiment, the reversal data table further includes a timestamp field;
[0014] The step of storing the first business data in the reversal data table using the transaction identifier as the second primary key identifier includes:
[0015] Using the transaction identifier as the second primary key identifier, the first business data and the request timestamp of the positive transaction business request are stored in the reversal data table.
[0016] In one embodiment, the method further includes:
[0017] Upon receiving a reversal transaction request, the corresponding reversal data is queried from the reversal data table based on the transaction identifier of the positive transaction corresponding to the reversal request.
[0018] Determine the target primary key identifier corresponding to the business data field in the reversal data;
[0019] Based on the target primary key identifier, the corresponding second business data is queried in the business data table; the reversal data table contains the correspondence between transaction identifiers and business data.
[0020] Replace the second business data in the business data table with the business data corresponding to the business data field of the reversal data.
[0021] In one embodiment, replacing the second business data in the business data table with the first business data includes:
[0022] Based on the timestamp field in the reversal data, the reversal order of the reversal transaction requests is determined by sorting them in reverse order of the timestamps.
[0023] If the reversal order is determined to be the reversal order corresponding to the reversal transaction business request, the second business data in the business data table is replaced with the business data field of the reversal data.
[0024] In one embodiment, the method further includes:
[0025] The second business data is synchronized to the associated business system to enable business data synchronization between the business systems.
[0026] Secondly, this application also provides a storage device for correction data. The device includes:
[0027] The receiving module is used to receive positive transaction requests;
[0028] The query module is used to query the corresponding first business data in the business data table before the execution of the positive transaction business request based on the first primary key identifier information carried in the positive transaction business request.
[0029] The storage module is used to determine the transaction identifier corresponding to the positive transaction business request, and use the transaction identifier as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0030] Thirdly, this application also provides a server device. The server device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0031] Receive positive transaction requests;
[0032] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0033] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0034] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0035] Receive positive transaction requests;
[0036] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0037] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0038] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0039] Receive positive transaction requests;
[0040] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0041] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0042] The aforementioned historical business data storage method, device, server equipment, storage medium, and computer program product, by using the transaction identifier as the second primary key identifier to store the first business data in the reversal data table, ensures that different positive transactions of different businesses are uniquely identified by the transaction identifier, decoupling the business from the reversal data table, thereby storing the reversal data of different businesses in the same reversal data table, reducing the maintenance difficulty of the reversal data table. Attached Figure Description
[0043] Figure 1 This is an application environment diagram illustrating a method for storing reversal data according to an embodiment of this application;
[0044] Figure 2 This is a flowchart illustrating a method for storing reversal data according to an embodiment of this application;
[0045] Figure 3 This is a structural block diagram of a storage device for reversing data according to one embodiment of this application;
[0046] Figure 4 This is an internal structure diagram of a server device in one embodiment. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0048] In related technologies, a typical technical implementation of reversing orthogonal data storage is as follows: for the business data entity fields manipulated by the current business transaction, a reversing data entity that closely matches it is designed to record the process of business data change. When a reverse transaction occurs, the data is restored on-site based on these reversing data records in reverse order of timestamps.
[0049] Because different business transactions manipulate different fields of business data, the data structures of the reverse data entities before and after the registration change are also different. Therefore, each transaction needs to set up a data on-site saving step that is tied to its own business logic. This saving method determines that different business transactions need to be equipped with a specific reverse transaction in order to update the key business data content back to the initial state.
[0050] Table 1 shows the business data table presented in this application:
[0051] Table 1 Business Data Table
[0052]
[0053] The table below shows the reversal data after two withdrawal transactions as illustrated in this application:
[0054] Table 2 Reversal Data Table for Cash Withdrawal Transactions
[0055]
[0056] At this time, the account balance in the business data table for the business data record idA1 is 1003.23, and the account balance for the business data record idA3 is 708.99.
[0057] The table below shows the reversal data for the transaction in this application where the interest rate is modified while the account balance is also modified:
[0058] Table 3. Reversal Data Table for Transactions Involving Both Interest Rate and Account Balance Modification.
[0059]
[0060] At this time, the account balance of the business data record idA2 in the business data table is 1063.22 and the interest rate is 0.45%.
[0061] The business transactions in Table 2 will modify one field of the corresponding business data in the business data table, namely the account balance field. The business transactions in Table 3 will modify two fields of the corresponding business data in the business data table, namely the account balance field and the interest rate field.
[0062] When the financial information system receives a positive transaction request, it retrieves the corresponding business data in the business data table based on the primary key identifier of the business data to be modified carried in the positive transaction request, and creates a reversal record in the corresponding reversal data table with the primary key identifier as the identifier. After each field of the business data is modified, the reversal business data table saves the content of the field before and after the modification.
[0063] When the financial information system receives a reversal transaction request corresponding to a positive transaction, it retrieves the corresponding business data in the business data table based on the primary key identifier carried in the reversal transaction request, and then retrieves the corresponding reversal data in the reversal data table for that transaction. Then, based on the contents of each field of the positive transaction pair before and after modification stored in the reversal data table, the system modifies the business data in the business data table to complete the reversal of the positive transaction.
[0064] As shown in Tables 2 and 3, the fields of the reversal data table are different for different business operations. In other words, the structure of the reversal data is different for different business operations.
[0065] The above are merely illustrative examples of business data tables and reversal data tables in related technologies. In actual applications, the business data tables involved are more numerous, contain more fields, and encompass more business processes. When the business requirements of a particular business change, resulting in changes to the fields modified in the business data, the corresponding reversal data table needs to be modified (by adding or deleting fields).
[0066] From a micro perspective, when the amount of business data is large, the data structure for reversal data needs to be designed based on the scope of the fields involved in the business data. When changes in business requirements cause the range of fields in the updated business data to increase or decrease, the data structure and corresponding data storage logic of the reversal data need to be frequently and specifically modified. This will trigger data migration between the old and new reversal data, which will impact the stability of data storage and significantly increase the maintenance costs of the system.
[0067] From a macro perspective, restoring data to its original state is essentially a technical activity. When there is a large amount of business data and similar recovery actions are performed, the lack of a unified maintenance and coordination mechanism can increase system complexity and thus affect the scalability of the business system.
[0068] Based on this, this application proposes a method for storing reversal data. Upon receiving a positive transaction request, the method queries the corresponding first business data in the business data table prior to the execution of the positive transaction request, based on the first primary key identifier information carried in the positive transaction request. The method then determines the transaction identifier corresponding to the positive transaction request and uses this transaction identifier as the second primary key identifier to store the queried first business data in the reversal data table. The reversal data table is used to store the correspondence between transaction identifiers and business data, and includes a second primary key identifier field and a business data field.
[0069] The method for storing reversal data in this application simplifies the structure of the reversal data table, improves the storage efficiency of the reversal data, avoids the maintenance of the reversal business data table when business is updated, and increases the inclusiveness of business updates.
[0070] The method for storing correction data provided in this application embodiment can be applied to, for example... Figure 1 On server 104 in the application environment shown, Figure 1 This application illustrates the structure of a financial information system. Users or business personnel can use terminal 102 to communicate with the server of the financial information system via a communication network to complete related business transactions. Terminal 102 communicates with server 104 via the network. A data storage system can store business data and reversal data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server device or a server cluster composed of multiple server devices.
[0071] The following section provides a detailed description of a method for storing reversal data as illustrated in this application. For example... Figure 2 The diagram shown is a flowchart illustrating a method for storing reversal data according to an embodiment of this application, including the following steps:
[0072] Step 201: Receive positive transaction requests.
[0073] In one embodiment, a user or business personnel performs relevant business operations on a terminal, causing the terminal to construct a corresponding positive transaction business request, which is then sent to a server device in a financial information system via a communication network. This allows the server device in the financial information system to add, delete, or modify the stored business data according to the request.
[0074] A positive transaction request typically modifies a specific piece of business data, carrying the primary key identifier of that data and information about the fields to be modified. For example, a positive transaction request for user A's withdrawal modifies the balance in user A's business data, carrying the primary key identifier (user A's ID or account number, etc.) and the modification information (updating the balance to the current balance minus the withdrawal amount). Similarly, a positive transaction request for user C's deposit modifies the balance in user C's business data, carrying the primary key identifier (user A's ID or account number, etc.) and the modification information (updating the balance to the current balance plus the deposit amount).
[0075] Step 203: Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request.
[0076] In one embodiment, after receiving a positive transaction request sent by a user or business personnel through a terminal, the server device parses the positive transaction request to determine the first primary key identifier carried in the positive transaction. When parsing the positive transaction request, the server device can read the content carried in the positive transaction request according to an agreed-upon structure. For example, the first byte of the positive transaction request might represent the business type, the second and third bytes the first primary key identifier, and the fourth to tenth bytes the modification information. Alternatively, start and end characters can be pre-defined, with different start and end characters corresponding to different content, before reading the content carried in the positive transaction request.
[0077] Those skilled in the art can configure the positive transaction request according to actual business changes, and the server device can obtain the first primary key identifier from the positive transaction request.
[0078] In one embodiment, after receiving a positive transaction service request sent by the terminal, the server device parses the positive transaction service request, determines the modification information carried by the positive transaction service request, and before modifying the corresponding business data in the business data table according to the modification information carried by the positive transaction service request, that is, before the positive transaction service request is executed, the server device queries the corresponding first business data in the business data table according to the first primary key identifier information carried by the positive transaction service request.
[0079] The first primary key identifier is used to identify a piece of business data in the business data table. The first business data is the business data retrieved from the business data table based on the first primary key identifier carried in the transaction request, before any modification is made to the business data in the table based on the modification information carried in the transaction request. For example, if the transaction request modifies the balance field of the business data with primary key id6 to 400, while leaving other fields unchanged, before the transaction request is executed, the balance of the business data with primary key id6 in the business data table is 600. Therefore, before modifying the business data in the business data table based on the modification information carried in the transaction request, the balance field in the business data retrieved based on the primary key information carried in the transaction request will be 600, not 400.
[0080] It should be noted that the first business data retrieved is the entire row of data stored in the business data table with the first primary key as the primary key identifier, rather than business data composed of a few fields in the business data table.
[0081] Step 205: Determine the transaction identifier corresponding to the positive transaction business request, and use the transaction identifier as the second primary key identifier to store the queried first business data in the reversal data table.
[0082] The reversal data table stores the correspondence between transaction identifiers and business data, including a secondary primary key identifier field and a business data field. The secondary primary key identifier (transaction identifier) is used to identify a reversal record and can also uniquely identify a positive transaction operation.
[0083] In practical applications, financial information systems generate transaction sequence numbers with each positive transaction operation, serving as the transaction identifier for that positive transaction. This positive transaction identifier uniquely identifies a specific business operation within the financial information system. Therefore, in one embodiment, the server device generates a transaction sequence number for each positive transaction business request, which is then determined as the transaction identifier for that positive transaction request.
[0084] It should be noted that when the server device stores the first business data in the reversal data table, it does not need to determine the specific content of each field of the first business data. It can directly store the first business data as a whole in the reversal data table.
[0085] As shown in Table 4, this is the reversal data table corresponding to the reversal data storage method shown in this application:
[0086] Table 4 Correction Data Table
[0087]
[0088]
[0089] The structure of the reversal data table shown in this application differs from that of the business data table only in that it has an additional second primary key identifier field, namely, the transaction identifier field.
[0090] In one embodiment, the server device uses the transaction identifier of the positive transaction business request as the second primary key identifier, stores the first business data in the reversal data table, and then modifies the first business data in the business data table according to the modification information carried by the positive transaction business request to obtain the second business data.
[0091] First, the proposed method for storing reversal data uses the transaction identifier corresponding to the positive transaction request as the second primary key for all positive transaction requests from different businesses. The unchanged first business data is stored in the reversal data table. Therefore, it is no longer necessary to customize the reversal data storage logic for each positive transaction of each business, nor is it necessary to build a corresponding reversal data table for each business. Even if the range of updated fields in the business data changes due to changes in business requirements, the storage process of the reversal data for that business does not need to be modified, which greatly reduces the maintenance cost of storing reversal data. This effect is particularly obvious in business systems with frequently changing requirements.
[0092] Secondly, the storage method for reversal data in this application simplifies the table structure design of the reversal data table. The data structure of the business data completely determines the data structure of the reversal data. The data structure of the reversal data only has one more field than the data structure of the business data, namely the transaction identifier, which significantly reduces the design complexity of the table structure.
[0093] Finally, the reversal data storage method of this application reduces the coupling between business logic and technical modules. This application can directly lock a unique reversal data record through a transaction identifier, preventing changes in the access method and content of the reversal data due to different positive transaction businesses or changes in the business logic of the same positive transaction. This eliminates the coupling factor of business logic in the technical modules.
[0094] In daily financial operations, not all requests require reversal. For example, a request might modify the username field or the reserved mobile phone number field in the business data. These requests do not involve the core data of the financial business. In other words, they do not involve the financial business and therefore do not have a reversal requirement in the financial system sense, so there is no need to save the corresponding reversal data.
[0095] Therefore, in one embodiment, step 205 specifically includes:
[0096] If it is determined that the positive transaction request meets the conditions for the reverse transaction, the transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reverse data table.
[0097] In one embodiment, the server device can be pre-configured with business types that meet the conditions for reversal transactions, such as deposits and withdrawals. If the server device determines that the business type of the positive transaction request meets the conditions for reversal transactions, it further determines the business identifier of the positive transaction.
[0098] In one embodiment, the server device can parse a positive transaction request to obtain the modification information carried by the request. Based on this modification information, it can determine whether the modified fields in the request involve core financial business fields. For example, changes to a username or registered mobile number do not involve core financial business, so these fields are not core financial business fields. However, changes to balances or interest rates do involve core financial business, so these fields are core business fields. If the server device determines that the modified fields in the positive transaction request involve core financial business fields, it determines that the request meets the conditions for a reversal transaction and saves the corresponding reversal data. If the server device determines that the modified fields do not involve core financial business fields, it determines that the request does not meet the conditions for a reversal transaction and does not save the corresponding reversal data.
[0099] In this embodiment, only the business data corresponding to positive transaction requests that may need to be reversed is saved, thereby reducing the saving of unnecessary reverse business data.
[0100] Furthermore, in practical applications, multiple reversal transaction requests may be received simultaneously. To preserve the correctness of the business logic, the requests are processed in reverse order according to the chronological order of the corresponding positive transactions. That is, while multiple positive transactions occur sequentially, the initiation of reversals must be reversed and ordered. For example, if the order of positive transactions is A→B→C, then the order of reversal transactions must follow C→B→A. Failure to follow this order will result in meaningless and erroneous business data being generated by the system. Therefore, in one embodiment, the aforementioned reversal data table also includes a timestamp field. Step 205 specifically includes:
[0101] Determine the transaction identifier corresponding to the transaction business request, use the transaction identifier as the second primary key identifier, and store the first business data and the request timestamp of the positive transaction business request in the reversal data table.
[0102] As shown in Table 5, this is the correction data table corresponding to another correction data storage method shown in this specification:
[0103] Table 5 Correction Data Table
[0104]
[0105] In this embodiment, the reversal data table stores the timestamps of each positive transaction request, so that the server device can determine the execution process of each positive transaction.
[0106] In one embodiment, the method for storing reversal data may further include:
[0107] Step 207: Upon receiving a reverse transaction request, query the corresponding reverse data in the reverse data table based on the transaction identifier of the positive transaction corresponding to the reverse transaction request.
[0108] Specifically, a reversal transaction request is specific to a particular positive transaction request. If no positive transaction request has been executed, there will be no reversal transaction request. That is, when the server receives a reversal transaction request, the server has already executed the corresponding positive transaction request.
[0109] In one embodiment, the terminal directly constructs a reversal transaction request containing the transaction identifier of a positive transaction and sends it to the server device to initiate a reversal transaction for that positive transaction. The server device parses the reversal transaction request to obtain the transaction identifier carried by the reversal transaction, that is, the transaction identifier of the positive transaction corresponding to the reversal transaction request.
[0110] Step 209: Determine the target primary key identifier carried by the business data field in the reversal data.
[0111] In one embodiment, after the server device queries the reversal data corresponding to the reversal transaction business request based on the transaction identifier, it reads the first business data in the business data field of the queried reversal data and determines the target primary key identifier in the primary key identifier field of the first business data.
[0112] Specifically, the server device determines the positive transaction targeted by the reversal transaction business request based on the transaction identifier, and determines the business data targeted by the reversal transaction business request based on the target primary key identifier in the primary key identifier field of the first business data in the business data field of the queried reversal data.
[0113] Step 211: Based on the determined target primary key identifier, query the corresponding second business data in the business data table.
[0114] The first business data stored in the reversal data table is the business data corresponding to the target primary key identifier stored in the business data table before the execution of the positive transaction business request for the reversal transaction business request. The second business data stored in the business data table is the business data corresponding to the target primary key identifier stored in the business data table after the execution of the positive transaction business request for the reversal transaction business request.
[0115] In one embodiment, the server device identifies the target primary key as the match and queries the business data table for matching second business data.
[0116] The second business data is also business data that only contains the content of all fields.
[0117] Step 213: Replace the second business data in the business data table with the business data field of the reversal data.
[0118] In one embodiment, after the server device finds the second business data corresponding to the target primary key identifier in the business data table, it directly replaces the second business data in the business data table with the business data field of the queried reversal data.
[0119] For example, the server device retrieves the following reversal data based on a reversal transaction request: Second primary key identifier field: AS0002, Business data fields: [Field 1: id5, Field 2: 000005, Field 3: 0.5%, Field 4: 26634.1]. Then, based on the target primary key identifier id5 carried in the business data fields, the second business data retrieved from the business data table is: Field 1: id5, Field 2: 000005, Field 3: 0.5%, Field 4: 20634.1. After directly replacing the second business data in the business data table with the business data fields of the retrieved reversal data, the business data corresponding to the primary key identifier id5 in the business data table becomes: Field 1: id5, Field 2: 000005, Field 3: 0.5%, Field 4: 26634.1.
[0120] In related technologies, different reversal data are identified by the primary key identifier and timestamp in the business data. Therefore, business personnel need to perform reversal transactions in the operation interface corresponding to the positive transaction. The operation entry point for reversal transactions is different for different businesses.
[0121] In this embodiment, the reversal transaction processes for various positive transactions are integrated into a common reversal transaction process. When a positive transaction needs to be reversed, the terminal only needs to construct a reversal transaction request carrying the transaction identifier of that positive transaction and send it to the server device. This optimizes the business processing flow and reduces operational risks. Therefore, business personnel only need to determine the transaction identifier of the positive transaction on the terminal to reverse the corresponding positive transaction. This reduces the time cost for business personnel, lowers the probability of errors, and the single operation entry point for reversal transactions also facilitates centralized management of operational risks.
[0122] In one embodiment, step 213 may specifically include:
[0123] Step 2131: Based on the timestamp field in the reversal data, sort the data in reverse order of timestamps to determine the reversal order of the reversal transaction request.
[0124] In one embodiment, the server device may receive multiple reversal transaction requests simultaneously, meaning it initiates reversal transaction requests for multiple positive transactions concurrently. In this case, for each reversal transaction request, the server device queries the corresponding reversal data in the reversal data table based on the transaction identifier of the positive transaction request corresponding to that reversal request. Then, based on the timestamp field of the reversal data corresponding to each reversal transaction request, the server device determines the initiation order of the positive transaction requests for each reversal transaction request, and arranges them in reverse order to obtain the reversal order of each reversal transaction request.
[0125] Step 2133: If the reversal order is determined to be the reversal order corresponding to the reversal transaction business request, replace the second business data in the business data table with the business data field of the queried reversal data.
[0126] In one embodiment, after determining the reversal order of multiple reversal transaction service requests, i.e., the execution order of the multiple reversal transaction service requests, the server device processes each reversal transaction service request in sequence. For each reversal service request, when the server device determines that the reversal order corresponds to the reversal order of the reversal service request, it replaces the second business data in the business data table with the business data field of the reversal data.
[0127] When positive transaction requests are executed, they are usually executed sequentially: first positive transaction request A, then positive transaction request B, and finally positive transaction request C. Reversal transactions are executed in the opposite order: first reverse request C, then reverse request B, and finally reverse request A. The execution is arranged in reverse order based on timestamps to align with the business logic requirements.
[0128] In one embodiment, the above method further includes:
[0129] The second business data is synchronized to the related business system to enable business data synchronization between the business systems.
[0130] In one embodiment, since the execution of the reversal transaction business request will modify the business data in the business data table, in order to ensure the consistency of data between various systems at the business level, the modified second business data needs to be synchronized to the related business system so that the related business system can modify the relevant data of the system.
[0131] Among these, the associated business system can be a service provider system. When the business data of the financial information system changes, the business data displayed to the user by the service provider system needs to be updated accordingly to ensure the accuracy of the business data viewed by the user. Therefore, when the business data of the financial information system changes, the server equipment of the financial information system will synchronize the updated secondary business data to the service provider system. The associated business system can also be other systems that depend on the business data, which are not listed in this application.
[0132] The above is a detailed description of the method for storing offsetting data in this application. It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the steps or stages in other steps.
[0133] Based on the same inventive concept, this application also provides a storage device for reversing data to implement the above-described method for storing reversing data. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the storage device for reversing data provided below can be found in the limitations of the method for storing reversing data described above, and will not be repeated here.
[0134] In one embodiment, such as Figure 3 As shown, a storage device for reversal data is provided, comprising: a receiving module 301, a query module 303, and a storage module 305, wherein:
[0135] Receiver module 301 is used to receive positive transaction requests;
[0136] The query module 303 is used to query the corresponding first business data in the business data table before the execution of the positive transaction business request based on the first primary key identifier information carried in the positive transaction business request.
[0137] The storage module 305 is used to determine the transaction identifier corresponding to the positive transaction business request, and use the transaction identifier as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0138] In one embodiment, the storage module 305 described above is specifically used for:
[0139] If it is determined that the positive transaction request meets the conditions for a reverse transaction, the transaction identifier corresponding to the positive transaction request is determined;
[0140] Using the transaction identifier as the second primary key identifier, the first business data is stored in the reversal data table.
[0141] In one embodiment, the reversal data table further includes a timestamp field; in this case, the aforementioned storage module 305 is specifically used for:
[0142] The transaction identifier corresponding to the positive transaction business request is determined, and the transaction identifier is used as the second primary key identifier. The first business data and the request timestamp of the positive transaction business request are stored in the reversal data table.
[0143] In one embodiment, the above-described apparatus further includes:
[0144] Reversal data query module 307 (not shown in the figure): When a reversal transaction request is received, the module queries the corresponding reversal data in the reversal data table according to the transaction identifier of the positive transaction corresponding to the reversal transaction request.
[0145] Target primary key identifier determination module 309 (not shown in the figure): determines the target primary key identifier corresponding to the business data field in the reversal data;
[0146] Second business data query module 311 (not shown in the figure): used to query the corresponding second business data in the business data table according to the target primary key identifier; the reversal data table contains the correspondence between transaction identifiers and business data;
[0147] Replacement module 313 (not shown in the figure): used to replace the second business data in the business data table with the business data corresponding to the business data field of the reversal data.
[0148] In one embodiment, the replacement module 313 described above is specifically used for:
[0149] Based on the timestamp field in the reversal data, the reversal order of the reversal transaction requests is determined by sorting them in reverse order of the timestamps.
[0150] If the reversal order is determined to be the reversal order corresponding to the reversal transaction business request, the second business data in the business data table is replaced with the business data field of the reversal data.
[0151] In one embodiment, the device further includes:
[0152] Association module 315 (not shown in the figure): used to synchronize the second business data to the associated business system so as to synchronize business data between business systems.
[0153] Each module in the aforementioned storage device for the correction data can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a server device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0154] In one embodiment, a server device is provided, the internal structure of which can be shown as follows: Figure 4 As shown, the server device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores reversal data and business data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for storing reversal data.
[0155] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0156] In one embodiment, a server device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0157] Receive positive transaction requests;
[0158] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0159] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0160] In one embodiment, the processor executes the steps in the above-described method embodiments when executing a computer program.
[0161] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0162] Receive positive transaction requests;
[0163] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0164] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0165] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0166] Receive positive transaction requests;
[0167] Based on the first primary key identifier information carried in the positive transaction business request, query the corresponding first business data in the business data table before the execution of the positive transaction business request;
[0168] The transaction identifier corresponding to the positive transaction request is determined, and the transaction identifier is used as the second primary key identifier to store the first business data in the reversal data table; wherein, the reversal data table is used to store the correspondence between the transaction identifier and the business data.
[0169] In one embodiment, the computer program, when executed by a processor, implements the steps in the above method embodiments.
[0170] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0171] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0172] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0173] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for storing reversal data, characterized in that, The method includes: Receive positive transaction requests; Based on the first primary key identifier information carried in the positive transaction business request, the corresponding first business data is queried in the business data table before the positive transaction business request is executed. The first business data is a whole row of data stored in the business data table with the first primary key identifier as the primary key identifier, and the first primary key identifier is the account or ID information used to uniquely identify a piece of business data in the business data table. Determine whether the positive transaction request meets the conditions for a reverse transaction; the conditions for a reverse transaction are that the positive transaction request involves modifying a core financial business field in the business data table, and the core financial business field includes at least one of the following: account balance field, interest rate field, and remaining interest-free limit field. If the positive transaction request meets the conditions for the reverse transaction, the transaction identifier corresponding to the positive transaction request is determined. The transaction identifier is a unique transaction sequence number generated by the financial information system along with the positive transaction operation, which is used to uniquely identify a positive transaction operation. Using the transaction identifier as the second primary key identifier, the first business data is stored in the reversal data table; wherein, the reversal data table includes a second primary key identifier field and a business data field, used to store the correspondence between the transaction identifier and the business data, and the structure of the reversal data table is the same as that of the business data table except for the addition of the second primary key identifier field. The reversal data table is a general data table shared by all business types and its table structure is not adjusted with changes in business types. Upon receiving a reversal transaction request, the corresponding reversal data is queried from the reversal data table based on the transaction identifier of the positive transaction corresponding to the reversal request. Determine the target primary key identifier corresponding to the business data field in the reversal data; Based on the target primary key identifier, the corresponding second business data is queried in the business data table; the reversal data table contains the correspondence between transaction identifiers and business data. The second business data in the business data table is replaced with the business data corresponding to the business data field of the reversal data, and the replacement process directly overwrites the entire row of the second business data without distinguishing the specific fields in the business data.
2. The method according to claim 1, characterized in that, The reversal data table also includes a timestamp field; The step of storing the first business data in the reversal data table using the transaction identifier as the second primary key identifier includes: Using the transaction identifier as the second primary key identifier, the first business data and the request timestamp of the positive transaction business request are stored in the reversal data table.
3. The method according to claim 1, characterized in that, The step of replacing the second business data in the business data table with the first business data includes: Based on the timestamp field in the reversal data, the reversal order of the reversal transaction requests is determined by sorting them in reverse order of the timestamps. If the reversal order is determined to be the reversal order corresponding to the reversal transaction business request, the second business data in the business data table is replaced with the business data field of the reversal data.
4. The method according to claim 1, characterized in that, The method further includes: The second business data is synchronized to the associated business system to enable business data synchronization between the business systems.
5. A storage device for correction data, characterized in that, The device includes: The receiving module is used to receive positive transaction requests; The query module is used to query the corresponding first business data in the business data table before the execution of the positive transaction business request based on the first primary key identifier information carried by the positive transaction business request. The first business data is a whole row of data stored in the business data table with the first primary key identifier as the primary key identifier, and the first primary key identifier is the account or ID information used to uniquely identify a piece of business data in the business data table. A storage module is used to determine whether the positive transaction request meets the conditions for a reversal transaction. The conditions for a reversal transaction are that the positive transaction request involves modifying a core financial business field in a business data table. The core financial business field includes at least one of an account balance field, an interest rate field, and an interest-free remaining limit field. If the positive transaction request meets the conditions for a reversal transaction, a transaction identifier corresponding to the positive transaction request is determined. The transaction identifier is a unique transaction sequence number generated by the financial information system along with the positive transaction operation, used to uniquely identify a positive transaction operation. The first business data is stored in a reversal data table using the transaction identifier as a second primary key identifier. The reversal data table includes a second primary key identifier field and a business data field, used to store the correspondence between the transaction identifier and the business data. The structure of the reversal data table is the same as that of the business data table, except for the addition of the second primary key identifier field. The reversal data table is a general data table shared by all business types and its structure is not adjusted with changes in business types. The reversal data query module is used to query the corresponding reversal data in the reversal data table based on the transaction identifier of the positive transaction corresponding to the reversal business request when a reversal transaction business request is received. The target primary key identifier determination module is used to determine the target primary key identifier corresponding to the business data field in the reversal data; The second business data query module is used to query the corresponding second business data in the business data table based on the target primary key identifier; the reversal data table contains the correspondence between transaction identifiers and business data. The replacement module is used to replace the second business data in the business data table with the business data corresponding to the business data field of the reversal data, and the replacement process directly overwrites the entire row of the second business data without distinguishing the specific fields in the business data.
6. A server device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Transaction data processing method and device, computer equipment and storage medium
CN112613993A