Message compensation processing method and device, electronic equipment and storage medium

By obtaining the processing status of payment messages and the number of retry retrys, locking and automatic reissue are carried out, the problem of low timeliness of bank transaction compensation processing is solved, and efficient automatic reissue is achieved, saving labor costs and improving transactions are improved. Timeliness.

CN119473644APending Publication Date: 2025-02-18BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411603348.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

Under the distributed microservice architecture, the compensation processing of bank transactions is low in time, and it requires manual query and reissue data, which consumes human resources and is inefficient.

Method used

By obtaining the payment packet processing status and compensation retry count in the database, performing lock processing, re-initiating a transaction request, updating the processing status and retry count, and releasing the lock, automatic reissue processing is achieved.

Benefits of technology

It improves the timeliness of compensation transactions, saves labor costs, avoids repeated transaction processing, and ensures the uniqueness and efficiency of transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473644A_ABST
    Figure CN119473644A_ABST
Patent Text Reader

Abstract

The invention provides a message compensation processing method and device, electronic equipment and a storage medium. The method can be used in financial field. The method comprises the following steps: acquiring a processing state of a payment message in a database; if the transaction processing state of the payment message is to-be-processed, obtaining the number of compensation retry times of the payment message; performing locking processing on the payment message according to the compensation retry times; a transaction request is initiated again, and a new processing result is obtained; according to the new processing result, updating the transaction processing state and the number of times of compensation retry of the payment message to obtain a new transaction processing state and a new number of times of compensation retry, and performing lock release processing on the payment message; and forwarding a new processing result according to the new transaction processing state and the new compensation retry times. The single node in the cluster obtains the transaction needing to be compensated and retransmitted according to setting, synchronous locking is carried out when the data is compensated, so that other nodes in the cluster are prevented from processing the transaction, automatic retransmitting processing is achieved, and the timeliness of the compensation transaction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the financial field, and in particular to a message compensation processing method, device, electronic device and storage medium. Background Art

[0002] Under the distributed microservice architecture, the completion of a transaction usually involves the calling of one or more microservices. At the same time, due to the long transaction chain of the bank, it is sometimes necessary to manually query the reissue data, which consumes human resources and has low efficiency, affecting the effectiveness of the transaction.

[0003] Therefore, how to improve the timeliness of compensation transactions is an urgent problem to be solved. Summary of the invention

[0004] The present application provides a message compensation processing method, device, electronic device and storage medium, so as to achieve the effect of improving the timeliness of compensation transactions.

[0005] In a first aspect, the present application provides a method for compensating a message, comprising:

[0006] Obtaining the processing status of each payment message stored in the database, wherein the processing status includes untransacted, pending or completed;

[0007] If the transaction processing status of the payment message is pending, obtaining the number of compensation retries of the payment message;

[0008] Locking the payment message according to the number of compensation retries;

[0009] Re-initiating a transaction request for the payment message to obtain a new processing result;

[0010] Update the transaction processing status and the number of compensation retries of the payment message according to the new processing result, obtain a new transaction processing status and a new number of compensation retries, and release the lock of the payment message;

[0011] The new processing result is forwarded according to the new transaction processing status and the new number of compensation retries.

[0012] In one implementation, the locking process of the payment message according to the number of compensation retries includes:

[0013] Determining whether the number of compensation retries is less than a preset number;

[0014] If the number of compensation retries is less than the preset number, locking the payment message;

[0015] If the number of compensation retries is greater than or equal to the preset number, the processing of the payment message is terminated.

[0016] In one implementation, before locking the payment message, the method further includes:

[0017] Obtain the latest compensation retry time and current time of the payment message;

[0018] If the time interval between the latest compensation retry time of the payment message and the current time is greater than the preset time interval, the payment message is locked.

[0019] In one implementation, before locking the payment message, the method includes:

[0020] Obtain the time of the first compensation retry of the payment message;

[0021] If the time interval between the first compensation retry time of the payment message and the current time is less than a preset maximum time limit, the payment message is locked.

[0022] In one implementation, forwarding the new processing result according to the new transaction processing state and the new number of compensation retries includes:

[0023] If the new transaction processing status is completed, forwarding the new processing result, the new processing result indicating that the transaction processing is successful;

[0024] If the new transaction processing status is pending, and the new number of compensation retries is greater than or equal to the preset number, forwarding the new processing result, the new processing result indicating that the transaction processing failed;

[0025] If the new transaction processing status is pending, and the new number of compensation retries is less than the preset number, the processing of the payment message is terminated.

[0026] In one implementation, before obtaining the processing status of each payment message stored in the database, the method further includes:

[0027] Obtaining the payment message and storing the payment message in a database;

[0028] Configuring an initial processing state and an initial compensation retry count of the payment message, wherein the initial processing state is used to indicate that the transaction of the payment message is not processed;

[0029] Transaction processing is performed on the payment message to obtain a processing result, and the initial processing state is updated according to the processing result to obtain the processing state.

[0030] In one implementation, obtaining the processing status of each payment message stored in the database includes:

[0031] The database is scanned according to a preset number of single scans to obtain a processing status of each payment message scanned by the single scan number.

[0032] In a second aspect, the present application further provides a message compensation processing device, including:

[0033] A first acquisition module, used to acquire the processing status of each payment message stored in the database, wherein the processing status includes untransacted, pending or completed;

[0034] A second acquisition module, configured to acquire the number of compensation retries of the payment message if the transaction processing status of the payment message is pending;

[0035] A compensation module, used for locking the payment message according to the number of compensation retries;

[0036] The compensation module is further used to re-initiate the transaction request of the payment message and obtain a new processing result;

[0037] A business processing module, used for updating the transaction processing status and the number of compensation retries of the payment message according to the new processing result, and obtaining a new transaction processing status and a new number of compensation retries;

[0038] The compensation module is further used to release the lock of the payment message;

[0039] The communication module is used to forward the new processing result according to the new transaction processing status and the new number of compensation retries.

[0040] In a third aspect, the present application further provides an electronic device, comprising: a memory, a processor;

[0041] The memory stores computer-executable instructions;

[0042] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0044] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0045] The present application provides a method, device, electronic device and storage medium for compensating message processing, the method comprising: obtaining the processing status of each payment message stored in a database, the processing status including untransacted, pending or completed; if the transaction processing status of the payment message is pending, obtaining the number of compensation retries of the payment message; according to the number of compensation retries, locking the payment message; re-initiating a transaction request for the payment message to obtain a new processing result; updating the transaction processing status and the number of compensation retries of the payment message according to the new processing result, obtaining a new transaction processing status and a new number of compensation retries, and releasing the lock processing of the payment message; forwarding the new processing result according to the new transaction processing status and the new number of compensation retries. Through the method of the present application, a single node in a cluster obtains a transaction that needs to be compensated and resent according to the setting, and locks synchronously when performing compensation operations on the data to avoid other nodes in the cluster from processing the transaction. After locking, compensation resends, updates the status, and realizes automatic reissue processing, saving labor costs and improving the timeliness of compensation transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0047] Figure 1 Schematic diagram of the process of the compensation processing method of the message provided in this application Figure 1 ;

[0048] Figure 2 Schematic diagram of the process of the compensation processing method of the message provided in this application Figure 2 ;

[0049] Figure 3 Schematic diagram of the process of the compensation processing method of the message provided in this application Figure 3 ;

[0050] Figure 4 A schematic diagram of the structure of a message compensation processing device provided by the present application;

[0051] Figure 5 A schematic diagram of the structure of the electronic device provided in this application.

[0052] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0053] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0054] The existing application layer service re-issuance mostly chooses manual methods, and the timeliness of discovering missed messages is poor, resulting in a waste of a lot of manpower and time costs.

[0055] In view of the above problems, by designing an automatic reissue mechanism, time and labor costs are saved. At the same time, the time, number of reissues, and frequency of reissues can be controlled to improve the timeliness of compensation transactions.

[0056] It should be noted that the message compensation processing method and device provided in the present application can be used in the financial field, and can also be used in any field other than the financial field. The application field of the message compensation processing method and device of the present application is not limited.

[0057] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0058] Figure 1 Schematic diagram of the process of the compensation processing method of the message provided in this application Figure 1 ,like Figure 1 As shown, the method includes:

[0059] S101. Obtain the processing status of each payment message stored in the database, where the processing status includes untransacted, pending or completed.

[0060] The database stores various payment messages. The transaction status of payment messages in the database includes: untransacted, pending, and completed. Untransacted refers to messages that have not been processed, pending refers to messages that have not yet issued transaction results, and completed refers to messages that have issued transaction results. Completed includes two specific states: successful transaction and failed transaction. The payment message is also associated with the number of compensation retries for the transaction. The number of compensation retries for untransacted is 0, the number of compensation retries for one transaction is 1, the number of compensation retries for two transactions is 2, and so on.

[0061] In a specific implementation, the database is scanned according to the unprocessed transaction status and auxiliary conditions to obtain the processing status of multiple messages within a scanned number of items. The auxiliary conditions may be one or more of a time limit, a lock value limit, or a compensation number limit.

[0062] S102: If the transaction processing status of the payment message is pending, obtain the number of compensation retries of the payment message.

[0063] If the transaction processing status of any payment message obtained is pending, it means that the transaction was not successful. Then it is necessary to determine whether a compensatory retry is required, so the compensatory retry count of the payment message is obtained.

[0064] S103. Lock the payment message according to the number of compensation retries.

[0065] In this step, whether the compensation transaction conditions are met is determined according to the number of compensation retries. If the compensation transaction conditions are met, the payment message is locked.

[0066] In one implementation, the compensation transaction condition is whether the number of compensation retries is less than a preset number.

[0067] If the number of compensation retries is less than the preset number;

[0068] If the number of compensation retries is less than the preset number, it means that the payment message needs to be re-traded. In order to prevent other nodes from processing the payment message, the payment message needs to be locked. Specifically, the lock value identifier of the payment message can be modified, for example, the lock value identifier is 01, which means locked; the lock value identifier is 00, which means released.

[0069] If the number of compensation retries is greater than or equal to the preset number, it means that the number of compensation retries has reached the preset retry upper limit and no further compensation processing is required, then the processing of the payment message is terminated without locking.

[0070] S104: Re-initiate a transaction request for the payment message and obtain a new processing result.

[0071] In this step, for the payment message that meets the compensation transaction conditions, a transaction request is re-initiated according to the payment message to obtain the processing result of the new transaction.

[0072] S105. Update the transaction processing status and the number of compensation retries of the payment message according to the new processing result, obtain a new transaction processing status and a new number of compensation retries, and release the lock of the payment message.

[0073] In this step, according to the new processing result, the number of compensation retries is increased by one to obtain a new number of compensation retries. According to the new processing result, the transaction processing status of the payment message is updated. If the new processing result indicates that the transaction is successful or failed, the updated transaction processing status is completed; if the new processing result indicates that the transaction is unclear, the updated transaction processing status is still pending.

[0074] After updating the transaction processing status and the number of compensation retries, the lock is released so that other nodes can process the message.

[0075] S106. Forward the new processing result according to the new transaction processing status and the new number of compensation retries.

[0076] In this step, if the new transaction processing status is completed, the new processing result is forwarded, and the new processing result indicates that the transaction processing is successful.

[0077] If the new transaction processing status is pending, and the new compensation retry times are greater than or equal to the preset times, indicating that the compensation times exceed the preset times, the new processing result is forwarded, and the new processing result indicates that the transaction processing failed.

[0078] If the new transaction processing status is pending, and the new compensation retry times are less than the preset times, it means that the compensation times have not exceeded the preset times, and the subsequent processing can continue, then the current processing operation of the payment message is terminated.

[0079] The present embodiment provides a compensation processing method for a message, the method comprising: obtaining the processing status of each payment message stored in a database, the processing status including untransacted, pending or completed; if the transaction processing status of the payment message is pending, then obtaining the compensation retry number of the payment message; according to the compensation retry number, locking the payment message; re-initiating a transaction request for the payment message to obtain a new processing result; updating the transaction processing status and the compensation retry number of the payment message according to the new processing result, obtaining a new transaction processing status and a new compensation retry number, and releasing the lock processing for the payment message; forwarding the new processing result according to the new transaction processing status and the new compensation retry number. Through the method of the present application, a single node in a cluster obtains a transaction that needs to be compensated and resent according to the setting, and synchronously locks when performing compensation operations on the data to avoid other nodes in the cluster from processing the transaction, and after locking, performs compensation resending, updates the status, and realizes automatic resending processing, saving labor costs, and improving the timeliness of compensation transactions.

[0080] The entire message logic compensation operation is deployed on multiple clusters. Each node in the multiple clusters can scan simultaneously, which can improve the overall efficiency. In this process, each node may scan duplicate messages to be compensated. Therefore, before actually calling the business processing module, it is necessary to lock to ensure the uniqueness of the operation compensation transaction to avoid duplication, and then query again whether the operation meets the operation conditions, and call the business processing module to perform related operations. This method improves the operation efficiency of the entire compensation operation while ensuring the uniqueness of the transaction.

[0081] In the above step S103, the compensation transaction condition not only defines the upper limit of the number of compensation retries, but also can set the limit of the time interval between two compensations and / or the limit of the compensation time limit. The following is an example to introduce how to determine whether the compensation transaction condition is met.

[0082] Figure 2 Schematic diagram of the process of the compensation processing method of the message provided in this application Figure 2 ,like Figure 2 As shown, the method includes:

[0083] S1031. Obtain the time of the latest compensation retry of the payment message and the current time.

[0084] S1032: Determine a first time interval between the latest compensation retry time of the payment message and the current time.

[0085] S1033: Determine whether the first time interval is greater than a preset time interval.

[0086] If it is greater than the preset time interval, execute step S1034.

[0087] If it is less than the preset time interval, the execution step is executed S1039.

[0088] The time interval can be set to 1 hour, 2 hours, or 3 hours. Compensation is performed only once within a time interval to avoid waste of resources caused by repeated sending.

[0089] S1034. Obtain the time of the first compensation retry of the payment message.

[0090] S1035. Determine a second time interval between the time of the first compensation retry of the payment message and the current time;

[0091] S1036: Determine whether the second time interval is less than a preset maximum time limit.

[0092] If it is less than the maximum time limit, execute step S1037.

[0093] If it is greater than or equal to the maximum time limit, the execution step is executed S1039.

[0094] The maximum time limit can be set to 24 hours, 48 ​​hours, or 12 hours. Payment transactions that have not been successfully compensated after the time limit do not need to be compensated.

[0095] S1037. Determine whether the number of compensation retries is less than a preset number.

[0096] If the number of compensation retries is less than the preset number, execute S1038.

[0097] If the number of compensation retries is greater than or equal to the preset number, execute S1039.

[0098] S1038: The payment message is locked.

[0099] S1039. End the processing of the payment message.

[0100] The message compensation processing method provided in this embodiment can avoid frequent retries in a short period of time (such as network interruptions that cannot be repaired quickly) and perform invalid compensation by setting time intervals; by limiting the maximum time limit, on the one hand, it can ensure the timeliness of message retransmission, and on the other hand, it can avoid scanning large amounts of data and sending historical meaningless data.

[0101] The following is an introduction using a specific example.

[0102] Figure 3 Schematic diagram of the process of the compensation processing method of the message provided in this application Figure 3 ,like Figure 3 As shown, the method includes:

[0103] 1. The back-end system sends the message to the data preprocessing module.

[0104] The message usually contains the core information of the transaction, such as transaction type, transaction amount, transaction time, etc. Ensure that the message can be received correctly and the data format and content meet expectations.

[0105] 2. The data preprocessing module receives the message sent by the back-end system, stores it in the warehouse, and records the transaction status as pending status U, the warehouse receiving time, timestamp, and the number of compensation retries as 0.

[0106] 3. The business processing module processes the message. Once the processing is completed, the transaction is set to the final state, otherwise the entire transaction is rolled back.

[0107] In this step, the business processing module processes the received message (payment or forwarding), and after the processing is completed, the processing final state is updated to success S or failure F. If the processing fails, the entire transaction is rolled back to the pending state U, and the timestamp is updated.

[0108] 4. The compensation module scans the messages that meet the conditions according to the compensation transaction conditions.

[0109] In this step, the number of single scans scanned by a single node in the preset scanning cluster is first obtained, and the database is scanned according to the preset number of single scans to obtain the processing status of each payment message scanned by the single scan number. After scanning, the message that meets the compensation transaction conditions is determined, wherein the compensation transaction conditions have been introduced in the above embodiment and will not be repeated here.

[0110] If the scan is successful and there is a pending transaction, the node will be locked and a compensation transaction will be re-initiated for the data. The compensation process may include retrying the payment or forwarding operation depending on the specific message.

[0111] 5. After the compensation module determines the amount to be compensated, it calls the business processing module for processing.

[0112] 6. Regardless of whether the transaction is completed, the timestamp and compensation retry count are updated.

[0113] 7. All transaction processing is completed and the lock is released.

[0114] After all transactions are processed, the lock is released to allow other threads or modules to process other transactions.

[0115] 8. Inform the communication module of the final status of the transaction and forward the result.

[0116] 9. Notify the back-end transaction results.

[0117] After notifying the back-end system, subsequent processing may be triggered, such as logging, account settlement and other operations.

[0118] This example involves the collaborative work of multiple modules. In a multi-module, multi-threaded concurrent environment, it ensures the correct processing of messages and the consistency of transaction status, while compensating for failed transactions.

[0119] Figure 4 A schematic diagram of the structure of a message compensation processing device provided in this application, such as Figure 4 As shown, each module is concentrated in one device. The message compensation processing device 400 provided in this embodiment includes:

[0120] A first acquisition module 401 is used to acquire the processing status of each payment message stored in the database, wherein the processing status includes untransacted, pending or completed;

[0121] A second acquisition module 402 is used to acquire the number of compensation retries of the payment message if the transaction processing status of the payment message is pending;

[0122] The compensation module 403 is used to:

[0123] Locking the payment message according to the number of compensation retries;

[0124] Re-initiate the transaction request for the payment message.

[0125] The business processing module 404 is used to obtain a new processing result, and update the transaction processing status and the number of compensation retries of the payment message according to the new processing result, so as to obtain a new transaction processing status and a new number of compensation retries.

[0126] The compensation module 403 is also used to release the lock of the payment message after the transaction processing is completed;

[0127] The communication module 405 is used to forward the new processing result according to the new transaction processing status and the new compensation retry number.

[0128] Optionally, the compensation module 403 is further used for:

[0129] Determining whether the number of compensation retries is less than a preset number;

[0130] If the number of compensation retries is less than the preset number, locking the payment message;

[0131] If the number of compensation retries is greater than or equal to the preset number, the processing of the payment message is terminated.

[0132] Optionally, the compensation module 403 is further used for:

[0133] Obtain the latest compensation retry time and current time of the payment message;

[0134] If the time interval between the latest compensation retry time of the payment message and the current time is greater than the preset time interval, the payment message is locked.

[0135] Optionally, the compensation module 403 is further used for:

[0136] Obtaining the time of the first compensation retry of the payment message;

[0137] If the time interval between the first compensation retry time of the payment message and the current time is less than a preset maximum time limit, the payment message is locked.

[0138] Optionally, the business processing module 404 is further used to:

[0139] If the new transaction processing status is completed, forwarding the new processing result, the new processing result indicating that the transaction processing is successful;

[0140] If the new transaction processing status is pending, and the new number of compensation retries is greater than or equal to the preset number, forwarding the new processing result, the new processing result indicating that the transaction processing failed;

[0141] If the new transaction processing status is pending, and the new compensation retry times are less than the preset times, the processing of the payment message is terminated.

[0142] Optionally, the device further includes a data preprocessing module 406, and the data preprocessing module 406 is used to:

[0143] Obtaining the payment message and storing the payment message in a database;

[0144] Configuring an initial processing state and an initial compensation retry count of the payment message, wherein the initial processing state is used to indicate that the transaction of the payment message is not processed;

[0145] Transaction processing is performed on the payment message to obtain a processing result, and the initial processing state is updated according to the processing result to obtain the processing state.

[0146] Optionally, the first acquisition module 401 is specifically used for:

[0147] The database is scanned according to a preset number of single scans to obtain a processing status of each payment message scanned by the single scan number.

[0148] The message compensation processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0149] Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.

[0150] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.

[0151] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0152] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0153] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0154] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0155] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0156] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0157] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0158] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0159] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0161] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0162] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0163] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0164] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application, are not limited to the precise structures described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A message compensation processing method, characterized in that: include: Obtaining the processing status of each payment message stored in the database, wherein the processing status includes untransacted, pending or completed; If the transaction processing status of the payment message is pending, obtaining the number of compensation retries of the payment message; Locking the payment message according to the number of compensation retries; Re-initiating a transaction request for the payment message to obtain a new processing result; Update the transaction processing status and the number of compensation retries of the payment message according to the new processing result, obtain a new transaction processing status and a new number of compensation retries, and release the lock of the payment message; The new processing result is forwarded according to the new transaction processing status and the new number of compensation retries.

2. The method according to claim 1, characterized in that The locking process of the payment message according to the number of compensation retries includes: Determining whether the number of compensation retries is less than a preset number; If the number of compensation retries is less than the preset number, locking the payment message; If the number of compensation retries is greater than or equal to the preset number, the processing of the payment message is terminated.

3. The method according to claim 2, characterized in that Before locking the payment message, the method further includes: Obtain the latest compensation retry time and current time of the payment message; If the time interval between the latest compensation retry time of the payment message and the current time is greater than the preset time interval, the payment message is locked.

4. The method according to claim 3, characterized in that Before locking the payment message, the method includes: Obtain the time of the first compensation retry of the payment message; If the time interval between the first compensation retry time of the payment message and the current time is less than a preset maximum time limit, the payment message is locked.

5. The method according to any one of claims 2 to 4, characterized in that: The forwarding of the new processing result according to the new transaction processing state and the new number of compensation retries includes: If the new transaction processing status is completed, forwarding the new processing result, the new processing result indicating that the transaction processing is successful; If the new transaction processing status is pending, and the new number of compensation retries is greater than or equal to the preset number, forwarding the new processing result, the new processing result indicating that the transaction processing failed; If the new transaction processing status is pending, and the new number of compensation retries is less than the preset number, the processing of the payment message is terminated.

6. The method according to any one of claims 1 to 4, characterized in that: Before obtaining the processing status of each payment message stored in the database, the method further includes: Obtaining the payment message and storing the payment message in a database; Configuring an initial processing state and an initial compensation retry count of the payment message, wherein the initial processing state is used to indicate that the transaction of the payment message is not processed; Transaction processing is performed on the payment message to obtain a processing result, and the initial processing state is updated according to the processing result to obtain the processing state.

7. The method according to any one of claims 1 to 4, characterized in that: The obtaining of the processing status of each payment message stored in the database includes: The database is scanned according to a preset number of single scans to obtain a processing status of each payment message scanned by the single scan number.

8. A message compensation processing device, characterized in that: include: A first acquisition module, used to acquire the processing status of each payment message stored in the database, wherein the processing status includes untransacted, pending or completed; A second acquisition module, configured to acquire the number of compensation retries of the payment message if the transaction processing status of the payment message is pending; A compensation module, used for locking the payment message according to the number of compensation retries; The compensation module is further used to re-initiate the transaction request of the payment message and obtain a new processing result; A business processing module, used for updating the transaction processing status and the number of compensation retries of the payment message according to the new processing result, and obtaining a new transaction processing status and a new number of compensation retries; The compensation module is further used to release the lock of the payment message; The communication module is used to forward the new processing result according to the new transaction processing status and the new number of compensation retries.

9. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.