Transaction Data Sequential Synchronization Method, Control Device, and Storage Medium

Through distributed locking mechanism and blocking queue technology, the synchronization order of forward and reverse data is controlled, and the fund loss problem caused by reverse data reaching the post-system before forward data in the prior art is solved, achieving consistency of system status.

CN116204582BActive Publication Date: 2025-07-08BEIJING JIEHUI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211722920.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2025-07-08
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

The existing transaction data synchronization method. During the hashing process and library table task scanning process, reverse data may arrive at the back-end business system before forward data, resulting in the risk of merchant capital loss.

Method used

The distributed locking mechanism and blocking queue technology are adopted to ensure that the forward data is fully synchronized in the post-system, and then the reverse data is processed, and different blocking queues are stored in different blocking queues through product types and modulo to control the order of forward and reverse processing.

Benefits of technology

In the case of batch data synchronization, the strong sequence of forward data and reverse state changes are achieved, ensuring the consistency of the state of the front and rear systems, and avoiding merchant capital losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116204582B_ABST
    Figure CN116204582B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data synchronization, and specifically provides a method for sequentially synchronizing transaction data, a control device, and a storage medium, aiming to solve the problem that reverse data arrives at the post-service system before forward data during transaction data synchronization. For this purpose, the reverse processing operation steps in the present invention include: in response to the reverse processing operation, the pre-service system updates all or part of the forward data under this service code to the reverse state and sends a reverse operation notification to the data synchronization system; the data synchronization system hashes the reverse data according to the service code, stores it in the reverse operation library table of the data synchronization system, and sets a distributed judgment on whether all or part of the forward data under this service code has been synchronized to the post-service system. If so, the task scanning library table of the data synchronization system batch extracts the reverse data and processes each piece of data; the reverse processing interface of the post-service system is called, and the post-service system is changed to the reverse state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data synchronization, and specifically provides a method for sequentially synchronizing transaction data, a control device, and a storage medium. Background Art

[0002] In order to expand its own traffic, in addition to marketing on the local APP, a merchant also needs to settle in a larger platform, such as JD.com or Meituan. When a discount promotion is carried out on certain products on the local APP, it is also necessary to synchronize to the corresponding products on other platforms and carry out the same discount promotion. In this scenario, there is a need for marketing synchronization.

[0003] When performing cross-system interaction between the merchant's local APP and other platforms, there are scenarios of batch data synchronization for forward and reverse processing business processes. For each piece of associated data, it is necessary to ensure the sequentiality of forward and reverse processing, that is, creation should be done first, and cancellation should be after creation.

[0004] However, in the existing processing flow, if the amount of data under a certain business code exceeds ten thousand, during the hashing process and the library table task scanning process, it is easy for reverse data to reach the post-service system before forward data, ultimately resulting in inconsistent states between the pre-service system and the post-service system, thus posing a risk of merchant capital loss.

[0005] Correspondingly, there is a need in the art for a new solution for the method of sequentially synchronizing transaction data to solve the above problems. Summary of the Invention

[0006] In order to overcome the above-mentioned defects, the present invention is proposed to provide a solution to solve or at least partially solve the technical problem that during the existing transaction data synchronization, in the hashing process and the library table task scanning process, due to reverse data reaching the post-service system before forward data, merchant capital loss is caused.

[0007] In a first aspect, the present invention provides a method for sequentially synchronizing transaction data, which is applied to a merchant promotion processing platform. The merchant promotion processing platform includes a pre-service system, a data synchronization system, and a post-service system;

[0008] The method includes a forward processing operation and a reverse processing operation.

[0009] The forward processing operation includes:

[0010] S100: In response to the forward processing operation, the pre-service system generates a business code and forward data under the business code, and sends a forward synchronization data notification to the data synchronization system;

[0011] S110: The data synchronization system hashes the forward data according to the business code and stores it in the forward operation library table in the data synchronization system.

[0012] S120: The task scanning library table of the data synchronization system extracts the forward data and processes each piece of data;

[0013] S130: Call the forward processing interface of the post - business system to complete data synchronization;

[0014] The reverse processing operation includes:

[0015] S200: In response to the reverse processing operation, the pre - business system updates all or part of the forward data under this business code to the reverse state and sends a reverse operation notice to the data synchronization system;

[0016] S210: The data synchronization system hashes the reverse data according to the business code, stores it in the reverse operation library table of the data synchronization system, and sets a distributed lock for the reverse data;

[0017] S220: Determine whether all or part of the forward data under this business code has been synchronized to the post - business system. If so, execute step S230;

[0018] S230: The task scanning library table of the data synchronization system batch - extracts the reverse data and processes each piece of data;

[0019] S240: Call the reverse processing interface of the post - business system, and the post - business system is changed to the reverse state.

[0020] In a technical solution of the above - mentioned transaction data sequential synchronization method, the forward processing operation further includes:

[0021] S111: When hashing the forward data, divide the forward data according to the commodity type, and store the forward data in different blocking queues according to the division result;

[0022] The reverse processing operation further includes:

[0023] S211: When hashing the reverse data, divide the reverse data according to the commodity type, and according to the division result, store the reverse data in different blocking queues. The forward data and the reverse data under the same commodity type are stored in the same blocking queue.

[0024] In a technical solution of the above - mentioned transaction data sequential synchronization method, a thread is started for each blocking queue to process tasks,

[0025] The forward processing operation includes:

[0026] S112: Obtain a piece of data from the blocking queue;

[0027] S113: Determine whether the data is positive data. If so, execute step S120;

[0028] S121: Query whether there is reverse data for this service code in the pre - service system. If not, execute step S130; if so, execute step S122;

[0029] S122: Do not perform positive data synchronization, and mark the positive data as not requiring synchronization in the data synchronization system.

[0030] In a technical solution of the above - mentioned sequential synchronization method for transaction data, the reverse processing operation includes:

[0031] S212: Obtain a piece of data from the blocking queue;

[0032] S213: Determine whether the data is reverse data. If so, execute step S230;

[0033] S241: Determine whether the post - service system is updated successfully. If so, end the process; if not, execute step S242;

[0034] S242: Query in the data synchronization system whether the positive data is marked as not requiring synchronization. If so, end the process; if not, execute step S243;

[0035] S243: Put the reverse data back into the blocking queue.

[0036] In a technical solution of the above - mentioned sequential synchronization method for transaction data, the processing of each piece of data includes:

[0037] Perform data filtering and screening, service conversion, and logical field completion processing on the positive data or reverse data.

[0038] In a technical solution of the above - mentioned sequential synchronization method for transaction data, the positive data includes the product name, type, and product code in the positive state, and the reverse data includes the product name, type, and product code in the reverse state.

[0039] In a technical solution of the above - mentioned sequential synchronization method for transaction data, the division of the positive data according to the product category includes taking the modulus according to the product type or product code to divide the positive data;

[0040] The division of the reverse data according to the product category includes taking the modulus according to the product type or product code to divide the reverse data.

[0041] In a technical solution of the above transaction data sequential synchronization method, a persistent storage medium is used to store data in different blocking queues.

[0042] In a second aspect, the present invention provides a control device, comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, and the program codes are suitable for being loaded and run by the processor to execute the transaction data sequential synchronization method.

[0043] In a fourth aspect, the present invention provides a computer-readable storage medium storing a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the transaction data sequential synchronization method.

[0044] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:

[0045] In the technical solution of the present invention, the data synchronization system uses a lock mechanism for reverse data, and after all forward data are synchronized to the back-end system, reverse data processing is performed. The execution order of the forward process and the reverse process is controlled in the business coding dimension. In the batch data synchronization scenario, the strong sequentiality of the forward data and reverse state changes is achieved, the state consistency of the front-end system and the back-end system is guaranteed, and the technical problem of merchant capital loss caused by the reverse data arriving at the back-end business system before the forward data during the hash process and the library table task scanning process when synchronizing the existing transaction data is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0047] Figure 1 This is a flow chart of the main steps of forward processing in the transaction data sequential synchronization method according to Embodiment 1 of the present invention;

[0048] Figure 2 This is a flow chart of the main steps of reverse processing in the transaction data sequential synchronization method according to Embodiment 1 of the present invention;

[0049] Figure 3 This is a flow chart of the main steps of forward processing in the transaction data sequential synchronization method according to Embodiment 2 of the present invention;

[0050] Figure 4 This is a flow chart of the main steps of reverse processing in the transaction data sequential synchronization method according to Embodiment 2 of the present invention;

[0051] Figure 5 It is a schematic diagram of the main structural block diagram of the control device for the transaction data sequential synchronization method according to the present invention. Specific embodiments

[0052] Some embodiments of the present invention will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0053] In the description of the present invention, "module" and "processor" may include hardware, software, or a combination of both. A module may include a hardware circuit, various suitable sensors, communication ports, memory, and may also include a software part, such as program code, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, in hardware, or in a combination of both. The non-transitory computer-readable storage medium includes any suitable medium for storing program code, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and so on. The term "A and / or B" represents all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a meaning similar to "A and / or B" and may include only A, only B, or A and B. The singular terms "a" and "this" may also include the plural form.

[0054] Some terms related to the present invention will be explained here first.

[0055] Forward processing: The data generation process, such as creating promotional offer data, generating and paying an order.

[0056] Reverse processing: The state change generated by forward processing, such as removing a promotional offer, order refund, etc.

[0057] Forward data: The data generated by forward processing, with a forward state.

[0058] Reverse data: The data whose state changes to a reverse state after reverse processing.

[0059] Business code: The unique business identifier generated by forward processing. One business code may correspond to multiple forward data and reverse data, such as the id of the same batch of commodity promotion activities, etc.

[0060] Processing type: Forward processing (positive processing), reverse processing (negative processing).

[0061] Hash: A business code and business type of the front-end system correspond to a batch of forward or reverse processing data. The hashing process is a process of cyclically and batch-back-checking the front-end business system through an interface call method to obtain all synchronous data of this business code and processing type.

[0062] The present invention provides a method for synchronizing transaction data in sequence, which is applied to a merchant promotion processing platform. The merchant promotion processing platform includes a front-end business system, a data synchronization system, and a back-end business system, wherein,

[0063] Front-end business system (front-end system, such as a payment system): A background system for users or operations to perform forward processing and reverse processing, collecting original forward processing and reverse processing data, and sending a business code and processing type (forward and reverse processing) to the synchronization system to notify the synchronization system that data synchronization can be performed.

[0064] Data synchronization system (synchronization system): Receiving the synchronization notification from the front-end system, performing hashing to obtain positive / negative data, and after operations such as filtering and screening, business conversion, and logical field completion, calling the interface of the back-end business system to perform data synchronization.

[0065] Back-end business system (back-end system, such as a clearing and settlement system): Providing forward processing and reverse processing interfaces, receiving requests from the data synchronization system, storing positive data during forward processing, updating the status of positive data to a reverse status during reverse processing, and returning a success or failure response.

[0066] Embodiment 1

[0067] As Figure 1 shown, the forward processing operations include:

[0068] S100: In response to the forward processing operation, the front-end business system generates a business code and positive data under the business code, and sends a forward synchronization data notification to the data synchronization system;

[0069] In this embodiment, the merchant operation performs a forward processing operation. The front-end business system generates a business code (i.e., a promotion ID) and positive data (such as 10,000 product information (name, type (snacks, beverages, fruits, etc.), product code (SKU))), and a 20% discount is uniformly applied to these 10,000 products, corresponding to one promotion ID), and sends the business code and positive data to the data synchronization system through Mq or an interface.

[0070] S110: The data synchronization system hashes the positive data according to the business code and stores it in the positive operation library table in the data synchronization system;

[0071] In one embodiment, after receiving a request, the data synchronization system obtains the service code, hashes the forward data according to the service code. That is, after obtaining the promotion ID, it queries 10,000 pieces of product data from the front-end business system in batches. For example, if it retrieves 200 pieces each time, it will perform a database storage operation until all product data has been stored in the forward operation database table of the synchronization system.

[0072] S120: The task of the data synchronization system scans the database table to extract forward data and processes each piece of data.

[0073] In one embodiment, the processing of each piece of data includes data filtering and screening, service conversion, and logical field completion processing for the forward data.

[0074] S130: Invoke the forward processing interface of the back-end business system to complete data synchronization.

[0075] As Figure 2 shown, the reverse processing operation includes:

[0076] S200: In response to the reverse processing operation, the front-end business system updates all or part of the forward data under this service code to the reverse state and sends a reverse operation notification to the data synchronization system.

[0077] In this embodiment, when receiving the reverse processing operation command, for the service code generated by a certain forward process, all or part of the forward data is reversed. The front-end business system updates all or part of the forward data under this service code to the reverse state and sends a reverse operation notification to the data synchronization system through Mq or an interface.

[0078] S210: The data synchronization system hashes the reverse data according to the service code, stores it in the reverse operation database table of the data synchronization system, and sets a distributed lock for the reverse data.

[0079] In one embodiment, after receiving the reverse processing notification, query the front-end system for hashing and store it in the reverse operation database table of the synchronization system. The hashing process is the same as the hashing process of the above forward processing and will not be elaborated here.

[0080] S220: Determine whether all or part of the forward data under this service code has been synchronized to the back-end business system. If so, execute step S230.

[0081] In this embodiment, the data synchronization system uses a lock mechanism for the reverse data. After all forward data has been synchronized to the back-end system, the reverse data is processed. This controls the execution order of the forward process and the reverse process at the service code dimension to ensure the strong sequentiality of the forward data and reverse state changes.

[0082] S230: The task scanning library table of the data synchronization system extracts reverse data in batches and processes each piece of data.

[0083] In one embodiment, the processing of each piece of data includes data filtering and screening, business transformation, and logical field completion processing on the reverse data.

[0084] S240: Invoke the reverse processing interface of the post - business system, and the post - business system changes to the reverse state.

[0085] Embodiment 2

[0086] In order to further improve the strength and timeliness of data synchronization, based on Embodiment 1, it is further improved, and the improved solution is as follows.

[0087] As Figure 3 shown, the forward processing operations include:

[0088] S100: In response to the forward processing operation, the pre - business system generates a business code and forward data under the business code, and sends a forward synchronization data notification to the data synchronization system;

[0089] In this embodiment, the merchant operation performs a forward processing operation. The pre - business system generates a business code (i.e., promotion ID) and forward data (for example, 10,000 pieces of product information (name, type (snacks, beverages, fruits, etc.), product code (SKU))), and these 10,000 products are uniformly discounted by 20%. Then, corresponding to one promotion ID, the business code and forward data are sent to the data synchronization system through Mq or an interface.

[0090] S110: The data synchronization system hashes the forward data according to the business code and stores it in the forward operation library table in the data synchronization system;

[0091] In one embodiment, after receiving the request, the data synchronization system obtains the business code, hashes the forward data according to the business code. That is, after obtaining the promotion ID, it batches queries the 10,000 pieces of product data from the pre - business system. For example, each time it retrieves 200 pieces and stores them in the database once until all product data falls into the forward operation library table of the synchronization system.

[0092] S111: When hashing the forward data, divide the forward data according to the product category, and store the forward data in different blocking queues according to the division result;

[0093] In this embodiment, while hashing, modulo operation is performed according to a certain business field in the product category (included in the forward data) and stored in the blocking queue, including modulo operation according to the product type or according to the product code.

[0094] In one embodiment, the commodity type is selected for modulo operation, and for different types, they are stored in different blocking queues; for example, snacks are in one queue, and beverages are in another queue. Preferably, even for different varieties of beverages, they can be placed in different queues. For example, beer and liquor belong to different queues, and the same applies to snacks. This operation has the risk of data loss due to system crash in memory. In this embodiment, storage media with persistence such as mq or redis list are used.

[0095] In one embodiment, selecting the commodity code for modulo operation can avoid the problem of data skew. That is, among the 10,000 commodity data, the snack category accounts for the majority, for example, more than 90%, then the data volume in a certain blocking queue will be backlogged.

[0096] S112: Each blocking queue starts a thread to process tasks and fetches one piece of data from the blocking queue;

[0097] S113: Determine whether the data is positive data. If so, execute step S120;

[0098] S120: The task scanning library table of the data synchronization system extracts positive data and processes each piece of data;

[0099] In one embodiment, the processing of each piece of data includes data filtering and screening, service conversion, and logical field completion processing for the positive data.

[0100] S121: Query whether there is reverse data for this service code in the pre - business system. If not, execute step S130; if so, execute step S122;

[0101] S122: Do not perform positive data synchronization and mark the positive data in the data synchronization system as not requiring synchronization.

[0102] S130: Call the positive processing interface of the post - business system to complete data synchronization;

[0103] In this embodiment, before sending a positive processing request to the post - business system, the status of this data in the pre - business system is queried inversely, that is, query whether this commodity in the merchant system has cancelled the promotion. If it is still in the positive state, that is, still in the promotion, then continue the synchronization; otherwise, if it is in the reverse state, there is no need for synchronization. At the same time, the data synchronization system records that this positive data does not require synchronization for use in the reverse processing process.

[0104] In this embodiment, the forward process adds a process of querying the reverse status: before the forward process calls the post - system for synchronization, add a step of querying the status of the pre - system to determine whether it is in the forward state at this time. If it is in the forward state, perform normal synchronization. Otherwise, it means that the pre - system has sent a reverse operation, but the processing point in the synchronization system is unknown. At this time, the forward synchronization has lost its meaning and can be skipped. At the same time, record that the forward data has not been synchronized for use in the reverse process.

[0105] As Figure 4 shown, the reverse processing operation includes:

[0106] S200: In response to the reverse processing operation, the pre - business system updates all or part of the forward data under this business code to the reverse state and sends a reverse operation notice to the data synchronization system;

[0107] In this embodiment, when receiving the reverse processing operation command, for the business code generated by a certain forward process, perform all or part of the forward data reverse operation. The pre - business system updates all or part of the forward data under this business code to the reverse state and sends a reverse operation notice to the data synchronization system through Mq or an interface.

[0108] S210: The data synchronization system hashes the reverse data according to the business code, stores it in the reverse operation library table of the data synchronization system, and sets a distributed lock for the reverse data;

[0109] In one embodiment, after receiving the reverse processing notice, query the pre - system for hashing and store it in the reverse operation library table of the synchronization system. The hashing process is the same as the hashing process of the above - mentioned forward processing and will not be elaborated here.

[0110] S211: When hashing the reverse data, divide the reverse data according to the commodity type. According to the division result, store the reverse data in different blocking queues. The forward data and reverse data under the same commodity type are stored in the same blocking queue.

[0111] In this embodiment, while hashing, store it in the blocking queue according to the modulus of a certain business field in the commodity type (included in the reverse data). The modulus - taking method is the same as the modulus - taking method of the above - mentioned forward processing and will not be elaborated here. After processing, the forward data and reverse data under the same division result are in the same blocking queue.

[0112] In this embodiment, the forward data and the reverse data share a blocking queue for sorting: after the forward process and the reverse process store the original process into the storage table, the task scans the database table, which is optimized to store the data into the corresponding queue after taking the modulus of a certain business field. In this way, it can be ensured that the forward data and the reverse data of the associated data are allocated to the same queue, and most of the associated data can be ensured to have the forward data before and the reverse data after in the same queue during the hashing process. However, the problem of data order disorder caused by the speed of hashing has not been fundamentally solved, and there may be a situation where the reverse data is before the forward data.

[0113] S212: Each blocking queue starts a thread to process tasks and obtains a piece of data from the blocking queue;

[0114] S213: Determine whether the data is reverse data. If so, execute step S230;

[0115] S220: Determine whether all or part of the forward data under this business code has been synchronized to the subsequent business system. If so, execute step S230;

[0116] S230: The task of the data synchronization system scans the database table to batch extract reverse data and processes each piece of data.

[0117] In one embodiment, the processing of each piece of data includes data filtering and screening, business conversion, and logical field completion processing for the reverse data.

[0118] S240: Call the reverse processing interface of the subsequent business system, and the subsequent business system changes to the reverse state.

[0119] S241: Determine whether the subsequent business system is updated successfully. If so, the process ends. If not, execute step S242;

[0120] S242: Query in the data synchronization system whether the forward data is marked as not requiring synchronization. If so, the process ends. If not, execute step S243;

[0121] S243: Put the reverse data back into the blocking queue.

[0122] In this embodiment, after sending a reverse status change request to the subsequent business system, the subsequent business system makes a judgment on the response to this request. Assume that other platform systems judge that the cancellation of the promotion is successful, then the update is successful and the process ends; if the return information such as failure or non-existence of positive data is returned, it means that the promotion has not been created on other platform systems yet. At this time, through step S242, first query whether the data synchronization system records that this data of positive data does not need to be synchronized. If the record is found, it means that the positive data does not need to be synchronized and the reverse transaction does not need to be synchronized either, and the process ends. If no record is found, it means that the positive process has not been processed or not processed completely. It may be due to system performance issues that the positive transaction has not been hashed yet, while the reverse transaction has been hashed. For example, the merchant just created a discount and then regretted it and immediately cancelled it. Then this reverse data is re-entered into the blocking queue for retry. As long as other platform systems return that the promotion does not exist, it will be retried until the promotion is successfully created. At this time, other platform systems will no longer return that the promotion does not exist.

[0123] In this embodiment, in order to avoid the situation where the reverse in the subsequent system is faster than the forward synchronization in extreme cases; when the synchronization system performs a reverse query on the front-end system and shows a forward status, the subsequent system synchronization process is then blocked. At this time, the front-end system initiates reverse processing, and the synchronization system quickly processes it and calls the reverse operation of the subsequent system to complete. After that, the forward process is unblocked and the forward synchronization is successful. Thus, a situation where the states of the front-end system and the subsequent system are inconsistent is caused. A retry mechanism is added to the reverse process. In the reverse process, when the synchronization system calls the subsequent system, if a failure or non-existence of positive data occurs, query the record of unsynchronized positive data recorded in the data synchronization system. If found, the reverse process does not need to be synchronized at this time. Otherwise, this reverse data is put into the blocking queue again for cyclic retry. When the positive data has been hashed, the reverse retry data will eventually be queued after the positive data, which ensures the final sequentiality.

[0124] In this embodiment, through three measures of blocking queue + reverse query + retry, the sequential synchronization of transaction data is better realized, and the sequentiality of positive data and reverse data is ensured. Initially deposited into the blocking queue, it replaces the database table to ensure the consistency of some associated data; the reverse query in the positive process filters a large amount of positive process data that does not need to be synchronized, and records the positive data that does not need to be synchronized, avoiding useless retries in the reverse process; the retry in the reverse process depends on the blocking queue to complete the realization of the final sequentiality.

[0125] Compared with Embodiment 1, this embodiment has the following advantages:

[0126] Fine control strength and good timeliness: The sequentiality is controlled in the dimensions of forward data and reverse data, and non-associated data do not affect each other. In a distributed scenario, with the same server hardware devices, the system performance is stable. Even if the time interval between forward and reverse operations is very small, in most scenarios, forward data is synchronized before reverse data. For this part of the data, after the forward data is synchronized, the reverse data will be synchronized soon, without relying on the completion of all forward data synchronization, reducing the processing time of the forward and reverse processes of associated data. It is superior to the lock mechanism in scenarios where high timeliness of reverse operations is required.

[0127] Strong adaptability to changes in the front-end system: The lock mechanism solution strictly depends on business coding and is hashed in the synchronization system. If the forward data is hashed and distributed in the front-end system, the synchronization system will not be able to know the hashing completion flag of the front-end system, and problems will occur with unlocking. This solution can adapt to the hashing timing. Whether the hashing occurs in the front-end system, in the synchronization system, or the forward data is hashed in the front-end system and the reverse data is hashed in the synchronization system, it can be adapted.

[0128] It should be noted that although the above embodiments describe the various steps in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders, and these variations are all within the protection scope of the present invention.

[0129] Furthermore, the present invention also provides a control device. As Figure 5 shown, in an embodiment of a control device according to the present invention, the control device includes a processor and a storage device. The storage device can be configured to store a program for executing the transaction data sequential synchronization method of the above method embodiment, and the processor can be configured to execute the program in the storage device. The program includes, but is not limited to, the program for executing the transaction data sequential synchronization method of the above method embodiment. For the sake of convenience of description, only the parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present invention. The control device can be a control device formed by various electronic devices.

[0130] Furthermore, the present invention also provides a computer-readable storage medium. In an embodiment of the computer-readable storage medium according to the present invention, the computer-readable storage medium may be configured to store a program for executing the transaction data sequence synchronization method in the above method embodiment, and this program can be loaded and run by a processor to implement the above transaction data sequence synchronization method. For ease of description, only parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present invention. The computer-readable storage medium may be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiments of the present invention is a non-transitory computer-readable storage medium.

[0131] So far, the technical solution of the present invention has been described in conjunction with the preferred embodiments shown in the drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present invention.

Claims

1. A method for sequential synchronization of transaction data, which is applied to a merchant promotion processing platform. The merchant promotion processing platform includes a front-end business system, a data synchronization system, and a back-end business system; It is characterized in that The method includes a forward processing operation and a reverse processing operation, The forward processing operation includes: S100: In response to the forward processing operation, the front-end business system generates a business code and forward data under the business code, and sends a forward synchronization data notification to the data synchronization system; S110: The data synchronization system hashes the forward data according to the business code and stores it in the forward operation library table in the data synchronization system; S120: The task of the data synchronization system scans the library table to extract the forward data and processes each piece of data; S130: Invoke the forward processing interface of the back-end business system to complete data synchronization; The reverse processing operation includes: S200: In response to the reverse processing operation, the front-end business system updates all or part of the forward data under this business code to the reverse state and sends a reverse operation notification to the data synchronization system; S210: The data synchronization system hashes the reverse data according to the business code, stores it in the reverse operation library table of the data synchronization system, and sets a distributed lock for the reverse data; S220: Determine whether all or part of the forward data under this business code has been synchronized to the back-end business system. If so, execute step S230; S230: The task of the data synchronization system scans the library table to batch extract the reverse data and processes each piece of data; S240: Invoke the reverse processing interface of the back-end business system, and the back-end business system changes to the reverse state.

2. The method for sequential synchronization of transaction data according to claim 1, wherein, The forward processing operation further includes: S111: When hashing the forward data, divide the forward data according to the commodity type, and store the forward data in different blocking queues according to the division result; The reverse processing operation further includes: S211: When hashing the reverse data, divide the reverse data according to the commodity type, and store the reverse data in different blocking queues according to the division result. The forward data and the reverse data under the same commodity type are stored in the same blocking queue.

3. The transaction data sequential synchronization method according to claim 2, wherein Start a thread for each blocking queue to process tasks, The forward processing operation includes: S112: Obtain a piece of data from the blocking queue; S113: Determine whether the data is forward data. If so, execute step S120; S121: Query whether there is reverse data under this business code in the front-end business system. If not, execute step S130. If so, execute step S122; S122: Do not perform forward data synchronization and mark the forward data as not requiring synchronization in the data synchronization system.

4. The transaction data sequential synchronization method according to claim 3, wherein The reverse processing operation includes: S212: Obtain a piece of data from the blocking queue; S213: Determine whether the data is reverse data. If so, execute step S230; S241: Determine whether the back-end business system has been successfully updated. If so, the process ends. If not, execute step S242; S242: Query in the data synchronization system whether the forward data is marked as not requiring synchronization. If so, end the process; if not, execute step S243; S243: Put the reverse data back into the blocking queue.

5. The transaction data sequential synchronization method according to claim 1, wherein The processing of each piece of data includes: Performing data filtering and screening, service conversion, and logical field completion processing on the forward data or reverse data.

6. The method for sequentially synchronizing transaction data according to claim 2, wherein The forward data includes the product name, type, and product code in the forward state, and the reverse data includes the product name, type, and product code in the reverse state.

7. The transaction data sequential synchronization method according to claim 6, wherein The division of the forward data according to the product category includes taking the modulus according to the product type or product code to divide the forward data; The division of the reverse data according to the product category includes taking the modulus according to the product type or product code to divide the reverse data.

8. The transaction data sequential synchronization method according to claim 2, wherein Use a persistent storage medium to store data into different blocking queues.

9. A control device, comprising a processor and a storage device, the storage device being adapted to store a plurality of program codes, characterized in that, The program code is suitable for being loaded and run by the processor to execute the transaction data sequential synchronization method according to any one of claims 1 to 8.

10. A computer-readable storage medium storing multiple program codes, characterized in that, The program code is suitable for being loaded and run by the processor to execute the transaction data sequential synchronization method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Brokerage trader core transaction data synchronization system and method

    CN114595071A

  • System and methods for querying the distribution path of product units within a supply chain

    US20190258991A1