A business processing method and device
Through the service middle layer, the locking and unlocking of account information in the distributed system and pushing the service data to the service processing center for processing, the existing distributed transaction solutions in terms of high concurrency and data consistency are solved, and more efficient business processing performance and consistency management are achieved.
Patent Information
- Application Number
- CN202510120673.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-01-24
AI Technical Summary
The existing distributed phased transaction solutions have problems such as large consumption of communication resources, high development complexity, poor fault tolerance, and low performance, which are difficult to meet the needs of high concurrent transaction processing and data consistency.
The service middle layer performs locking operation on the account information of any business subsystem, and pushes the service data of the locked account information to the service processing center for processing. After the processing is successful, the account information unlocking operation is performed to realize the serialization of business processing.
Improves the consistency and fault tolerance of data processing, reduces the direct access pressure of data sources, improves overall business processing performance, and simplifies development complexity.
Smart Images

Figure CN119557365B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed data processing, and in particular to a business processing method and device. Background Art
[0002] At present, big data processing is applied in application systems in different fields. For example, in the financial field, with the rapid growth of financial data volume and the update and iteration of data types, the processing of financial big data has higher requirements for data operations such as high-concurrency transaction processing, data consistency, and concurrency control.
[0003] Currently, distributed phased transaction solutions (such as two-phase commit, three-phase commit, Try-Confirm-Cancel, etc.) are usually used in big data processing to achieve transaction concurrency and data consistency; however, the existing distributed phased transaction solutions have many problems such as large communication resource consumption, high development complexity, poor fault tolerance, and low performance. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a business processing method and device, which can use a business middle layer to perform a locking operation on the account information of any business subsystem, and push the business data corresponding to the locked account information to a business processing center to perform business processing in response to a business processing request of the business subsystem, and perform an account information unlocking operation after the business processing is successful. The embodiment of the present invention realizes the serialization of business processing through the interaction between the business middle layer and other components, improves the refined management of data processing consistency and fault tolerance, and improves the overall business processing performance by reducing the direct access pressure of the data source.
[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a business processing method is provided, characterized in that it is applied to a business middle layer, comprising: receiving an account information locking request sent by any business subsystem for account information to be processed, adding the account information to a preset business control table to lock the account information, and returning the locking result to the business subsystem; receiving a business processing request for the account information from the business subsystem, searching for a target business interface that matches the business subsystem from a plurality of business processing interfaces; wherein the business processing request is sent by the business subsystem when it is determined that the locking result is successful; using the target business interface to lock the account information; The business data of the account information is pushed to the business processing center so that the business processing operation is completed through the business processing center; the business processing result sent by the business processing center is received, and when it is determined that the business processing result indicates a processing failure, the business result identifier in the preset business control table is changed to a set code, otherwise the business result identifier is changed to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table, and determines the business processing result according to the business result identifier; when an account information unlocking request sent by the business subsystem is received, or when it is determined that the business processing result indicates a success, the account information is unlocked.
[0006] Optionally, after adding the account information to the preset business control table to perform a locking operation on the account information, the process further includes: adding the account information, locking status and locking result corresponding to the locking operation to a preset business record table; and in the case where the locking result indicates a failure, using the preset business record table to record the failure information corresponding to the locking result.
[0007] Optionally, after pushing the business data of the account information to a business processing center using the target business interface, the method further includes: adding the target business interface, the account information, the business data and the business processing result to a preset business record table.
[0008] Optionally, upon receiving an account information unlocking request sent by the business subsystem, or upon determining that the business processing result indicates success, unlocking the account information includes: upon receiving an account information unlocking request sent by the business subsystem, removing the account information from the preset business control table to unlock the account information, and returning the unlocking result corresponding to the unlocking operation to the business subsystem; wherein the account information unlocking request is sent by the business subsystem when it is determined that the business data processed by the account information has not passed the legitimacy verification; upon determining that the business processing result indicates success, changing the locking state of the account information in the preset business control table to unlocked.
[0009] Optionally, the business processing method further includes: adding the account information, unlocking status and unlocking result corresponding to the unlocking operation on the account information to a preset business record table.
[0010] Optionally, before adding the account information to the preset business control table, it further includes: constructing an account unique index based on the account information, and constructing a business unique index based on the business information corresponding to the business subsystem; adding the business unique index, the account unique index and the account information to the preset business control table accordingly; enabling the business subsystem to query the business result identifier from the preset business control table includes: enabling the business subsystem to query the business result identifier from the preset business control table through a joint index composed of the business unique index and the account unique index.
[0011] Optionally, in the case where there are multiple account information to be processed, a locking request for multiple account information sent by any business subsystem is received, and the multiple account information is added to the preset business control table in sequence to lock the multiple account information, and the locking result corresponding to each account information is returned to the business subsystem; a business data processing request corresponding to the multiple account information is received from the business subsystem, and a target business interface matching the business subsystem is searched from multiple business processing interfaces; and the business data corresponding to the account information is pushed to the business processing center in sequence by using the target business interface in the order of the account information in the preset business control table, so as to complete the business processing operation through the business processing center.
[0012] Optionally, after using the target business interface to push the business data corresponding to the account information to the business processing center in sequence according to the order of the account information in the preset business control table to complete the business processing operation through the business processing center, it further includes: for each account information, obtaining the business processing result corresponding to the account information, and executing the step of changing the business result identifier corresponding to the account information in the preset business control table to a set code when the business processing result indicates a processing failure, otherwise changing the business result identifier corresponding to the account information to a current timestamp; so that the business subsystem queries the preset business control table through an asynchronous thread, obtains the business result identifier corresponding to each account information from the preset business control table, determines the business processing result corresponding to the account information according to the business result identifier, and executes the business operation corresponding to the business processing result according to the business processing result.
[0013] To achieve the above object, according to a second aspect of an embodiment of the present invention, a business processing device is provided, characterized in that it is applied to a business middle layer and comprises: an account locking module, a data sending module and a result processing module; wherein,
[0014] The account locking module is used to receive an account information locking request sent by any business subsystem for account information to be processed, add the account information to a preset business control table to lock the account information, and return the locking result to the business subsystem;
[0015] The data sending module is used to receive a business processing request from the business subsystem for the account information, and search for a target business interface matching the business subsystem from a plurality of business processing interfaces; wherein the business processing request is sent by the business subsystem when the locking result is determined to be successful; and the business data of the account information is pushed to the business processing center by using the target business interface, so as to complete the business processing operation through the business processing center;
[0016] The processing result module is used to receive the business processing result sent by the business processing center, and when it is determined that the business processing result indicates a processing failure, change the business result identifier in the preset business control table to a set code, otherwise change the business result identifier to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table and determines the business processing result according to the business result identifier; unlock the account information when receiving an account information unlocking request sent by the business subsystem, or when it is determined that the business processing result indicates a success.
[0017] Optionally, the business processing device is used to add the account information to a preset business control table to lock the account information, and further includes: adding the account information, locking status and locking result corresponding to the locking operation to a preset business record table; in the case where the locking result indicates a failure, using the preset business record table to record the failure information corresponding to the locking result.
[0018] Optionally, the business processing device is used to push the business data of the account information to the business processing center using the target business interface, further including: adding the target business interface, the account information, the business data and the business processing result to a preset business record table.
[0019] Optionally, the business processing device is used to unlock the account information upon receiving an account information unlocking request sent by the business subsystem, or upon determining that the business processing result indicates success, including: upon receiving an account information unlocking request sent by the business subsystem, removing the account information from the preset business control table to unlock the account information, and returning the unlocking result corresponding to the unlocking operation to the business subsystem; wherein the account information unlocking request is sent by the business subsystem when it is determined that the business data processed by the account information has not passed the legitimacy verification; upon determining that the business processing result indicates success, changing the locking state of the account information in the preset business control table to unlocked.
[0020] Optionally, the business processing device is further used to add the account information, unlocking status and unlocking result corresponding to the unlocking operation on the account information to a preset business record table.
[0021] Optionally, the business processing device is used to further include, before adding the account information to the preset business control table: constructing an account unique index based on the account information, and constructing a business unique index based on the business information corresponding to the business subsystem; adding the business unique index, the account unique index and the account information to the preset business control table accordingly; so that the business subsystem can query the business result identifier from the preset business control table, including: enabling the business subsystem to query the business result identifier from the preset business control table through a joint index composed of the business unique index and the account unique index.
[0022] Optionally, the business processing device is used to receive locking requests for multiple account information sent by any business subsystem when there are multiple account information to be processed, add the multiple account information to the preset business control table in sequence to lock the multiple account information, and return the locking result corresponding to each account information to the business subsystem; receive business data processing requests corresponding to the multiple account information sent by the business subsystem, search for a target business interface matching the business subsystem from multiple business processing interfaces; and use the target business interface to push the business data corresponding to the account information to the business processing center in sequence according to the order of the account information in the preset business control table, so as to complete the business processing operation through the business processing center.
[0023] Optionally, the business processing device is used to push the business data corresponding to the account information to the business processing center in sequence by using the target business interface in the order of the account information in the preset business control table, so as to complete the business processing operation through the business processing center, and further includes: for each account information, obtaining the business processing result corresponding to the account information, and executing the steps of changing the business result identifier corresponding to the account information in the preset business control table to a set code when the business processing result indicates a processing failure, otherwise changing the business result identifier corresponding to the account information to a current timestamp; so that the business subsystem queries the preset business control table through an asynchronous thread, obtains the business result identifier corresponding to each account information from the preset business control table, determines the business processing result corresponding to the account information according to the business result identifier, and executes the business operation corresponding to the business processing result according to the business processing result.
[0024] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for business processing, characterized in that it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any method as described in the above-mentioned business processing method.
[0025] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, a method as described in any of the above-mentioned business processing methods is implemented.
[0026] To achieve the above-mentioned purpose, according to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, characterized in that when the computer program is executed by a processor, any one of the above-mentioned business processing methods is implemented.
[0027] An embodiment of the above invention has the following advantages or beneficial effects: it can use the business middle layer to perform the locking operation on the account information of any business subsystem, and push the business data corresponding to the locked account information to the business processing center to perform business processing in response to the business processing request of the business subsystem, and perform the account information unlocking operation after the business processing is successful. The embodiment of the present invention realizes the serialization of business processing through the interaction between the business middle layer and other components, improves the refined management of data processing consistency and fault tolerance, and improves the overall business processing performance by reducing the direct access pressure of the data source, and reduces the complexity and difficulty of development.
[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0030] Figure 1 It is a flowchart of a business processing method provided by an embodiment of the present invention;
[0031] Figure 2 This is a schematic diagram of a business processing flow provided by an embodiment of the present invention;
[0032] Figure 3 It is another business processing flow diagram provided by an embodiment of the present invention;
[0033] Figure 4 is a schematic diagram of the structure of a service processing device provided by an embodiment of the present invention;
[0034] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0035] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0037] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0038] Existing distributed phased transaction solutions currently used include:
[0039] 1) Two-Phase Commit (2PC) has the following problems:
[0040] a. There are system blocking and performance bottleneck problems: In two-phase commit, submission can only be made when all participants are ready and confirmed, and the coordinator will send the commit command. While the participants are waiting for the coordinator's instructions, if some participants take a long time to respond or fail, the entire system may be blocked, affecting performance.
[0041] b. There is a single point failure risk: Since the coordinator plays a key role in the protocol, if the coordinator fails, the entire transaction will fail.
[0042] c. High consumption of communication resources: Since global broadcast messages need to be made multiple times during the two-phase commit process to ensure communication between the coordinator and all participants, the network bandwidth usage is increased.
[0043] d. High development difficulty and complexity: Achieving transaction consistency across multiple nodes requires a lot of state management and error handling, especially for handling network partitions, timeouts, and retry logic.
[0044] 2) Three-Phase Commit (3PC) has the following problems:
[0045] a. There is a problem of more communication resource consumption: Compared with two-phase commit, three-phase commit introduces a pre-commit phase, which results in more message transmission times overall, thereby increasing network bandwidth consumption.
[0046] b. Increased implementation complexity: The three-phase commit protocol adds the preparation phase, pre-commit phase, and commit phase, requiring more complex coordination logic and state management, which increases the difficulty of implementation and maintenance.
[0047] c. Increased transaction response time: The added pre-commit phase causes the overall transaction execution time to be longer, resulting in slower response speed, especially in high-load or high-latency network environments.
[0048] d. Higher development difficulty and complexity: Due to the need to develop detailed coordination logic and state management and ensure the atomicity and correctness of each stage, handling fault recovery and re-coordination increases the complexity of programming.
[0049] 3) TCC (Try-Confirm-Cancel) has the following problems:
[0050] a. Complex implementation and maintenance: Since the TCC mode requires implementing the corresponding Try, Confirm, and Cancel steps for each operation and ensuring the idempotence and consistency of the operation, the complexity of development and maintenance is increased.
[0051] b. The compensation mechanism is too dependent on business logic: Since compensation operations need to rely on specific business logic to be implemented, in complex business scenarios, the compensation logic will be difficult to handle or cannot be accurately rolled back.
[0052] c. Resource overhead caused by distributed locks: Resources need to be locked in the Try phase. If the waiting time is long or resource contention is serious, the overall performance of the system will be affected.
[0053] d. High development difficulty and complexity: Due to the need to achieve idempotence and consistency of transaction operations, especially when designing compensation logic, an overall understanding of the business process is required, which increases the difficulty and complexity of development work.
[0054] 4) The existing SAGA (Service Activity) technology has the following problems: a. Consistency delay: Since SAGA technology relies on compensating transactions to achieve eventual consistency, if a subtransaction fails, the executed operations need to be rolled back, which will result in a longer time to achieve consistency. b. Complex compensation logic: Since each subtransaction requires a corresponding compensating transaction, it not only increases the implementation complexity, but also requires that the compensation operation can accurately restore the existing changes, which greatly increases the implementation complexity of complex business processes; c. Difficult global error handling: When a subtransaction fails, how to effectively roll back all previous successful subtransactions requires precise error handling and compensation mechanisms, which easily makes the error handling logic complicated and difficult to maintain; d. High development difficulty: Since it is necessary to define and implement the compensation logic of each subtransaction, and at the same time ensure the idempotence and consistency of the compensation operation, it increases the development difficulty.
[0055] In view of this, if Figure 1 As shown, an embodiment of the present invention provides a service processing method, which may include the following steps:
[0056] Any one or more methods in the embodiments of the present invention are applied to the service middle layer.
[0057] The business middle layer is an independent middle layer of multiple business subsystems. It can separate the business processed by the business subsystem from the business operations of the business processing center, so that the business subsystem does not need to implement the submission operation of business data after the business logic of the processor itself, but can be completed through the interaction between the business middle layer and the business center; and the business middle layer is used to lock and unlock the accounts of the business subsystem to keep the business in sequence and implement serial operations to achieve data consistency.
[0058] In the embodiment of the present invention, the business subsystems are various business branches of the business system, processing different business functions, and the business data processed by each business function is uniformly submitted through the business middle layer.
[0059] The business system of the embodiment of the present invention may be any one or more business fields, for example: a logistics industry application system, an e-commerce application system, a financial product application system, etc.
[0060] Step S101: receiving an account information locking request sent by any business subsystem for account information to be processed, adding the account information to a preset business control table to lock the account information, and returning the locking result to the business subsystem.
[0061] Specifically, in an embodiment of the present invention, account information is a business object processed by one or more business subsystems. For example, for a financial product application system, its business subsystems include: holding registration subsystem, equity distribution subsystem, freezing subsystem, share transfer subsystem, restricted transfer subsystem, etc.; multiple different business subsystems can perform business operations corresponding to their business subsystems on the same or multiple business objects (account information). For example, for account A, the equity distribution subsystem performs the equity distribution business for account A, and its business data is the equity distribution data; the share transfer subsystem performs the share transfer business for account A, and its business data is the share transfer data, etc. For another example, for an e-commerce mall application system, multiple business subsystems include an order subsystem, an inventory subsystem, a payment subsystem, etc.; for a logistics industry application system, multiple business subsystems include a warehousing subsystem, a transportation subsystem, etc.
[0062] Furthermore, the embodiment of the present invention utilizes the business middle layer to perform serialization and serialization management on multiple business operations of an account, thereby overcoming data conflicts and consistency problems caused by concurrent transactions, and ensuring the isolation of system transaction processing and data consistency.
[0063] Furthermore, after the business subsystem completes the account information processing and before submitting the business data, it sends an account information locking request to the business middle layer.
[0064] The intermediate business layer adds the account information to the preset business control table to lock the account information; wherein, the preset business control table includes multiple fields for storing account information and business information. For example, for financial data settlement business, the preset business control table includes: auto-increment primary key, business number, business sub-sequence number, bilateral settlement identifier, business type, securities code, holder code, control identifier, creation time, etc.
[0065] Furthermore, the locking result is returned to the business subsystem; wherein, a successful locking indicates that the write operation of writing the account information and business information to be processed by a certain business subsystem into the preset business control table is successful. A failed locking indicates that the write operation of the preset business control table fails, and the possible reasons for the failure include: unique index conflict, failure to write the data table operation, and network return timeout; wherein RPC (Remote Procedure Call) can be used to execute the process of writing data into the preset business control table. Furthermore, the business subsystem can send a corresponding error prompt to the front end (or client) etc. in the case where the locking result indicates a failure.
[0066] Furthermore, after adding the account information to the preset business control table to perform a locking operation on the account information, it further includes: adding the account information, locking status and locking result corresponding to the locking operation to the preset business record table; and in the case where the locking result indicates a failure, using the preset business record table to record the failure information corresponding to the locking result.
[0067] In the embodiment of the present invention, the preset business record table is used to record the account information and locking status of the business subsystem operation. If the locking result indicates a failure, the preset business record table can also be used to record the failure information corresponding to the locking result. By recording the tracks and status of different business operations through the business record table, a detailed locking processing log can be obtained.
[0068] Step S102: Receive a business processing request from the business subsystem for the account information, and search for a target business interface that matches the business subsystem from a plurality of business processing interfaces; wherein the business processing request is sent by the business subsystem when it is determined that the locking result is successful; and use the target business interface to push the business data of the account information to a business processing center to complete the business processing operation through the business processing center.
[0069] Specifically, the business subsystem sends a business processing request when determining that the locking result is successful, that is, the business processing request is sent by the business subsystem when determining that the locking result is successful.
[0070] The intermediate business layer receives the business processing request of the business subsystem for the account information, searches for a target business interface matching the business subsystem from a plurality of business processing interfaces, and uses the target business interface to push the business data of the account information to the business processing center to complete the business processing operation through the business processing center.
[0071] Specifically, different business subsystems correspond to different business processing interface APIs (Application Programming Interfaces), and different APIs may have different method names (or interface names), or the same method name (or interface name) but different parameters, etc. Among them, the list of different business processing interface APIs corresponding to different business subsystems can be stored in a data source or file to provide query and acquisition of the business middle layer.
[0072] The business middle layer searches for a target business interface that matches the business subsystem from a variety of business processing interfaces based on the subsystem identifier of the business subsystem, and further uses the target business interface to push the business data of the account information to the business processing center to complete the business processing operation through the business processing center. For example: the business subsystem is a stock trading business, and for account x, the business data is the stock trading data of account x. The business middle layer searches for a target business interface (such as STOCK123) that matches the stock trading business from a variety of business processing interfaces, and pushes the stock trading data corresponding to account x to the business processing center by calling the target business interface, thereby submitting the data. Furthermore, the business processing center completes the submission (such as delivery) operation of the business data through various operations such as writing a business change table and recording business data.
[0073] Step S103: Receive the business processing result sent by the business processing center, and if it is determined that the business processing result indicates a processing failure, change the business result identifier in the preset business control table to a set code, otherwise change the business result identifier to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table and determines the business processing result based on the business result identifier.
[0074] Specifically, the business middle layer receives the business processing result sent by the business processing center, and the business processing result is success or failure. The possible reasons for failure include: failure to write the business processing center data table, business processing result return network abnormality, etc. If it is determined that the business processing result is a failure, the business result identifier in the preset business control table is changed to a set code, otherwise the business result identifier is changed to the current timestamp.
[0075] Furthermore, the business subsystem queries the business result identifier from a preset business control table, and determines the business processing result according to the business result identifier; or, the intermediate business layer directly sends the business processing result to the business subsystem.
[0076] Specifically, the business result identifier in the preset business control table is used to identify the business processing result, and its default value may be a setting code, such as 99991231235959. The setting code may be any preset code, or may be a timestamp representing the expiration of the lock time of the account information. When the business processing result is determined to be successful, the business result identifier is updated to the current timestamp, such as the current timestamp is 20241127193200232, which represents that the business processing is successful at 2024 / 11 / 27 19:32:00.232; and it also represents that the account information is locked to the transaction completion time point. When the business processing result is determined to be a failure, the business result identifier is updated and set to 99991231235959. The data of the business result identifier can directly determine whether the business processing result is successful or failed.
[0077] Furthermore, after the business data of the account information is pushed to the business processing center by using the target business interface, it further includes: adding the target business interface, the account information, the business data and the business processing result to a preset business record table.
[0078] In an embodiment of the present invention, a preset business record table is used to record account information, business data and business processing results processed by the business subsystem. The business record table records data and results of different business processes, thereby obtaining a detailed log of the business processing.
[0079] Step S104: when receiving the account information unlocking request sent by the business subsystem, or when determining that the business processing result indicates success, unlocking the account information.
[0080] Specifically, in two cases, the intermediate service layer performs an unlocking operation on the account information.
[0081] The first case: upon receiving an account information unlocking request sent by the business subsystem.
[0082] Specifically, upon receiving the account information unlocking request sent by the business subsystem, the account information is removed from the preset business control table to unlock the account information, and the unlocking result corresponding to the unlocking operation is returned to the business subsystem; wherein the account information unlocking request is sent by the business subsystem when it is determined that the business data processed by the account information has not passed the legality verification. The business subsystem performs legality verification on the business data, for example, for the business subsystem of the stock trading of the stock account, assuming that the business data is to sell 2,000 shares, the business subsystem determines that the business data has not passed the legality verification when it determines that the number of stocks held in the account information is 1,000 shares, and further initiates an unlocking request for the account information to delete the account information from the preset business control table.
[0083] The second situation: determining that the business processing result indicates success.
[0084] Specifically, when it is determined that the business processing result indicates success, the lock state of the account information in the preset business control table is changed to unlock. The lock state can be a field in the preset business control table, and different field values are used to identify the lock state or unlock state.
[0085] The embodiment of the present invention improves the refinement of processing business data and improves the fault tolerance of business processing by performing different unlocking operations according to different situations.
[0086] Furthermore, the account information, unlocking status and the unlocking result corresponding to the unlocking operation on the account information are added to a preset business record table.
[0087] The embodiment of the present invention uses a preset business control table of the intermediate business layer to execute locking, unlocking, business result tracking and management operations on the account information of a certain business subsystem based on information changes of the account information, thereby overcoming the data conflict and consistency management problems of distributed transaction operations, and can achieve isolation and serial management of business processing by different subsystems, while reducing the pressure on the database caused by direct operation of the database by each business subsystem.
[0088] Furthermore, the embodiment of the present invention records the operation process for account information, business data, etc. through a preset business record table of the intermediate business layer, including various detailed information corresponding to the locking process, the business data push process, and the unlocking process, thereby improving the time-series log for subsequent analysis and business backtracking and improving the maintainability of business processing.
[0089] like Figure 2As shown, an embodiment of the present invention provides a business processing flow, the architecture of which includes: a business subsystem 200A, a business middle layer 200B and a business processing center 200C.
[0090] like Figure 2 As shown, the data interaction between different components is represented by dotted arrows, and the process within each component is represented by solid arrows.
[0091] The process may include the following steps:
[0092] Step S201: When there is a need to submit business data, the business subsystem 200A sends an account information lock request for the account information to be processed, and the business middle layer 200B adds the account information to the preset business control table (i.e., writes the preset business control table) to lock the account information, and returns the locking result to the business subsystem. Specifically, before sending the locking request to the business middle layer, the business subsystem can generate a business number for the business to be processed through interaction with the control center, and write the business number into its own business track table to track the processing of the business under different operations (lock, submit, unlock).
[0093] The business middle layer 200B adds the account information, locking status and locking result corresponding to the locking operation to the preset business record table (i.e., writes the preset business record table); if the locking result indicates success, the locking status is recorded; if the locking result indicates failure, the failure information corresponding to the locking result is recorded using the preset business record table.
[0094] Step S202: When the business subsystem 200A determines that the locking result is successful, it further determines the legitimacy verification result of the business data processed by the account information. When it is determined that the business data has not passed the legitimacy verification, it sends the account information unlocking request. If it passes the legitimacy verification, it sends the business processing request and further executes step S203.
[0095] Furthermore, when the business middle layer 200B receives the account information unlocking request sent by the business subsystem 200A, it removes the account information from the preset business control table to unlock the account information, and further adds the account information, unlocking status and unlocking result corresponding to the unlocking operation of the account information to the preset business record table; and returns the unlocking result corresponding to the unlocking operation to the business subsystem.
[0096] The business subsystem 200A may update the business track table according to the unlocking result to track and record detailed information during the business operation.
[0097] Step S203: The business middle layer 200B receives the business processing request of the business subsystem 200A for the account information, and searches for a target business interface that matches the business subsystem from a plurality of business processing interfaces; wherein the business processing request is sent by the business subsystem when it is determined that the locking result is successful; and the business data of the account information is pushed to the business processing center 200C using the target business interface, so as to complete the business processing operation through the business processing center 200C. After the processing operation is completed, the business processing center may also write into the business record table according to the specific operation information corresponding to the processing operation.
[0098] The business middle layer 200B receives the business processing result sent by the business processing center, and when it is determined that the business processing result indicates a processing failure, changes the business result identifier in the preset business control table to a set code, otherwise changes the business result identifier to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table, and determines the business processing result according to the business result identifier; or when the processing account information is one, the business middle layer 200B directly returns the business processing result to the business subsystem 200A.
[0099] When it is determined that the business processing result indicates success, the account information is unlocked. Specifically, the lock state of the account information in the preset business control table is changed to unlocked.
[0100] Furthermore, the target service interface, the account information, the service data and the service processing result are added to a preset service record table.
[0101] Furthermore, when the business subsystem 200A determines that the business processing result is successful, it updates its own business acceptance table, otherwise it returns "business processing exception" to the front end or client that initiated the business.
[0102] Through the description of steps S201 to S203, the embodiment of the present invention isolates the business subsystem and the business processing center through the business middle layer, overcomes the data conflict and consistency management problems of distributed transaction operations, can achieve isolation and serial management of business processing by different subsystems, and at the same time reduces the pressure on the database caused by each business subsystem directly operating the database.
[0103] It is understandable that the serial numbers of step S201 to step S203 are merely examples and do not constitute a limitation on the order.
[0104] like Figure 3As shown, an embodiment of the present invention provides a business processing flow, the architecture of which includes: a business subsystem 300A, a business middle layer 300B and a business processing center 300C.
[0105] like Figure 3 As shown, the data interaction between different components is represented by dotted arrows, and the process within each component is represented by solid arrows.
[0106] The process may include the following steps: This process is for batch business processing.
[0107] Step S301: When there is a need to submit business data, the business subsystem 300A sends an account information locking request for the account information to be processed. When there are multiple account information to be processed (i.e., batch processing), the business middle layer 300B receives the locking requests for multiple account information sent by any business subsystem, adds the multiple account information to the preset business control table in sequence, performs locking operations on the multiple account information, and returns the locking results corresponding to each account information to the business subsystem;
[0108] The business middle layer 300B also adds the account information, locking status and locking result corresponding to the locking operation to a preset business record table; if the locking result indicates a failure, the preset business record table is used to record the failure information corresponding to the locking result.
[0109] Step S302: When the business subsystem 300A determines that the locking result is successful, it further determines the legitimacy verification result of the business data processed by the account information. If it is determined that the business data has not passed the legitimacy verification, it sends the account information unlocking request. If it passes the legitimacy verification, it sends the business processing request to execute step S303.
[0110] Furthermore, upon receiving the account information unlocking request sent by the business subsystem 300A, the business middle layer 300B removes the account information from the preset business control table to unlock the account information, and returns the unlocking result corresponding to the unlocking operation to the business subsystem.
[0111] When the business middle layer 300B receives the account information unlocking request sent by the business subsystem 300A, it removes the account information from the preset business control table to unlock the account information, and further adds the account information, unlocking status and unlocking result corresponding to the unlocking operation of the account information to the preset business record table.
[0112] Furthermore, the unlocking result corresponding to the unlocking operation is returned to the business subsystem; the business subsystem 300A can update the business track table according to the unlocking result to track and record detailed information during the business operation.
[0113] Step S303: The business middle layer 300B receives the business data processing request corresponding to the multiple account information sent by the business subsystem 300A, and searches for a target business interface matching the business subsystem from multiple business processing interfaces; using the target business interface, the business data corresponding to the account information is pushed to the business processing center 300C in sequence according to the order of the account information in the preset business control table, so as to complete the business processing operation through the business processing center 300C.
[0114] Furthermore, the business middle layer 300B obtains the business processing result corresponding to each account information, and executes the steps of changing the business result identifier corresponding to the account information in the preset business control table to a setting code when the business processing result indicates a processing failure, otherwise changing the business result identifier corresponding to the account information to a current timestamp; and adding the target business interface, the account information, the business data and the business processing result to the preset business record table (i.e., writing the preset business record table).
[0115] Further, the business subsystem 300A starts an asynchronous process, queries a preset business control table through an asynchronous thread, obtains a business result identifier corresponding to each of the account information from the preset business control table, determines a business processing result corresponding to the account information according to the business result identifier, and performs a business operation corresponding to the business processing result according to the business processing result. Specifically, if the business result identifier corresponding to the acquired account information is a set code, the business processing result is determined to be a failure, and if the business result identifier corresponding to the acquired account information is a current timestamp, the business processing result is determined to be a success.
[0116] Furthermore, when it is determined that the business processing result indicates success, the account information is unlocked. Specifically, the lock state of the account information in the preset business control table is changed to unlocked (ie, the preset business control table is changed and unlocked).
[0117] Furthermore, if the business subsystem 300A determines that the business processing result is successful, it executes the step of updating its own business acceptance table, otherwise it sends a prompt message indicating that the business processing failed to the front end or the client, etc. That is, the business subsystem queries the preset business control table through an asynchronous thread, obtains the business result identifier corresponding to each of the account information from the preset business control table, determines the business processing result corresponding to the account information according to the business result identifier, and executes the business operation corresponding to the business processing result according to the business processing result.
[0118] Furthermore, in an embodiment of the present invention, before adding the account information to the preset business control table, an account unique index is constructed based on the account information, and a business unique index is constructed based on the business information corresponding to the business subsystem; the business unique index, the account unique index and the account information are added to the preset business control table accordingly; so as to enable the business subsystem to query the business result identifier from the preset business control table, including: enabling the business subsystem to query the business result identifier from the preset business control table through a joint index composed of the business unique index and the account unique index.
[0119] Taking the financial data settlement business as an example, the account information includes the securities code, holder code, business result identification, etc.; the business information includes: business number, business sub-sequence number, bilateral settlement identification, etc.; then a unique account index is constructed based on the account information, and a unique business index is constructed based on the business information corresponding to the business subsystem; and the two indexes are added to the preset business control table.
[0120] When the business subsystem queries the business result identifier in the preset business control table, the joint index composed of the business unique index and the account unique index can be used to perform the step of querying the business result identifier from the preset business control table, thereby improving the query efficiency of the business subsystem in the case of batch business processing.
[0121] By building an index, each business can be uniquely identified and the operations of a single account can be serialized, so that each business is unique and consistent during execution.
[0122] In the embodiment of the present invention, in a high-concurrency environment, the business middle layer effectively manages multiple transactions running simultaneously through strategies such as batch locking and batch business processing, reduces lock contention, and improves the performance and data security of the system under high-concurrency operations.
[0123] It is understandable that the serial numbers of step S301 to step S303 are merely examples and do not constitute a limitation on the order.
[0124] like Figure 4 As shown, the embodiment of the present invention provides a business process 400, including: an account locking module 401, a data sending module 402 and a processing result module 403; wherein,
[0125] The account locking module 401 is used to receive an account information locking request sent by any business subsystem for account information to be processed, add the account information to a preset business control table to lock the account information, and return the locking result to the business subsystem;
[0126] The data sending module 402 is used to receive the business processing request of the business subsystem for the account information, and search for a target business interface matching the business subsystem from multiple business processing interfaces; wherein the business processing request is sent by the business subsystem when the locking result is determined to be successful; and the business data of the account information is pushed to the business processing center by using the target business interface, so as to complete the business processing operation through the business processing center;
[0127] The processing result module 403 is used to receive the business processing result sent by the business processing center, and when it is determined that the business processing result indicates a processing failure, change the business result identifier in the preset business control table to a set code, otherwise change the business result identifier to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table and determines the business processing result according to the business result identifier; unlock the account information when receiving an account information unlocking request sent by the business subsystem, or when it is determined that the business processing result indicates a success.
[0128] An embodiment of the present invention also provides an electronic device for business processing, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0129] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.
[0130] An embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, any one of the above-mentioned business processing methods is implemented.
[0131] Figure 5 An exemplary system architecture 500 is shown to which the service processing method or service processing device according to the embodiment of the present invention can be applied.
[0132] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0133] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, 503, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients.
[0134] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0135] Server 505 may be a server that provides various services, such as a background management server that provides support for client applications used by users using terminal devices 501, 502, and 503. The background management server may process received service processing requests and feed back data corresponding to service processing results to the terminal device.
[0136] It should be noted that the service processing method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the service processing device is generally disposed in the server 505 .
[0137] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0138] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0139] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0140] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0141] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0142] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0143] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0144] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be set in a processor. For example, they may be described as: a processor includes an account locking module, a data sending module, and a result processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the account locking module may also be described as a "module that receives an account information locking request and performs a locking operation on the account information."
[0145] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: being able to use the business middle layer to perform a locking operation on the account information of any business subsystem, and pushing the business data corresponding to the locked account information to the business processing center for the business processing request of the business subsystem to perform business processing, and performing an account information unlocking operation after the business processing is successful. The embodiment of the present invention realizes the serialization of business processing through the interaction between the business middle layer and other components, improves the refined management of data processing consistency and fault tolerance, and improves the overall business processing performance by reducing the direct access pressure of the data source.
[0146] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A business processing method, characterized in that: Applied to the business middle layer, including: Receiving an account information locking request sent by any business subsystem for account information to be processed, adding the account information to a preset business control table to perform a locking operation on the account information, and returning the locking result to the business subsystem; receiving a business processing request from the business subsystem for the account information, and searching for a target business interface matching the business subsystem from a plurality of business processing interfaces; wherein the business processing request is sent by the business subsystem when determining that the locking result is successful; Pushing the business data of the account information to a business processing center by using the target business interface, so as to complete the business processing operation through the business processing center; receiving the business processing result sent by the business processing center, and if it is determined that the business processing result indicates a processing failure, changing the business result identifier in the preset business control table to a setting code, otherwise changing the business result identifier to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table, and determines the business processing result according to the business result identifier; When an account information unlocking request sent by the business subsystem is received, or when it is determined that the business processing result indicates success, the account information is unlocked.
2. The method according to claim 1, characterized in that After adding the account information to the preset business control table to lock the account information, the method further includes: Adding the account information, locking status and locking result corresponding to the locking operation to a preset business record table; In the case where the locking result indicates a failure, the preset business record table is used to record the failure information corresponding to the locking result.
3. The method according to claim 1, characterized in that After pushing the business data of the account information to the business processing center using the target business interface, further comprising: The target service interface, the account information, the service data and the service processing result are added to a preset service record table.
4. The method according to claim 1, characterized in that: The unlocking of the account information upon receiving the account information unlocking request sent by the business subsystem, or upon determining that the business processing result indicates success, comprises: Upon receiving the account information unlocking request sent by the business subsystem, the account information is removed from the preset business control table to unlock the account information, and an unlocking result corresponding to the unlocking operation is returned to the business subsystem; wherein the account information unlocking request is sent by the business subsystem when it is determined that the business data processed by the account information has not passed the legitimacy verification; When it is determined that the business processing result indicates success, the lock state of the account information in the preset business control table is changed to unlock.
5. The method according to claim 4, characterized in that Further including: The account information, unlocking status and the unlocking result corresponding to the unlocking operation on the account information are added to the preset business record table.
6. The method according to claim 1, characterized in that Before adding the account information to the preset business control table, the method further includes: Building an account unique index based on the account information, and building a business unique index based on the business information corresponding to the business subsystem; Adding the service unique index, the account unique index and the account information to the preset service control table accordingly; The method of enabling the business subsystem to query the business result identifier from the preset business control table includes: The business subsystem is enabled to query the business result identifier from the preset business control table through a joint index formed by combining the business unique index and the account unique index.
7. The method according to claim 1, characterized in that Further including: In the case where there are multiple account information to be processed, Receive a locking request for multiple account information sent by any business subsystem, add the multiple account information to the preset business control table in sequence, perform a locking operation on the multiple account information, and return a locking result corresponding to each account information to the business subsystem; Receive a business data processing request corresponding to the multiple account information sent by the business subsystem, and search for a target business interface matching the business subsystem from multiple business processing interfaces; use the target business interface to push the business data corresponding to the account information to the business processing center in sequence according to the order of the account information in the preset business control table, so as to complete the business processing operation through the business processing center.
8. The method according to claim 7, characterized in that After the target service interface is used to push the service data corresponding to the account information to the service processing center in sequence according to the order of the account information in the preset service control table, so as to complete the service processing operation through the service processing center, the method further includes: For each account information, obtain the business processing result corresponding to the account information, and perform the steps of changing the business result identifier corresponding to the account information in the preset business control table to a setting code if the business processing result indicates that the processing fails, or changing the business result identifier corresponding to the account information to a current timestamp otherwise; The business subsystem queries the preset business control table through an asynchronous thread, obtains the business result identifier corresponding to each account information from the preset business control table, determines the business processing result corresponding to the account information according to the business result identifier, and executes the business operation corresponding to the business processing result according to the business processing result.
9. A service processing device, characterized in that: Applied to the business middle layer, including: account locking module, data sending module and result processing module; among them, The account locking module is used to receive an account information locking request sent by any business subsystem for account information to be processed, add the account information to a preset business control table to lock the account information, and return the locking result to the business subsystem; The data sending module is used to receive a business processing request from the business subsystem for the account information, and search for a target business interface matching the business subsystem from a plurality of business processing interfaces; wherein the business processing request is sent by the business subsystem when the locking result is determined to be successful; and the business data of the account information is pushed to the business processing center by using the target business interface, so as to complete the business processing operation through the business processing center; The processing result module is used to receive the business processing result sent by the business processing center, and when it is determined that the business processing result indicates a processing failure, change the business result identifier in the preset business control table to a set code, otherwise change the business result identifier to a current timestamp; so that the business subsystem queries the business result identifier from the preset business control table and determines the business processing result according to the business result identifier; unlock the account information when receiving an account information unlocking request sent by the business subsystem, or when it is determined that the business processing result indicates a success.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Distributed transaction processing method on basis of shared storage pool
CN103399894A
Distributed transaction processing method and system, and related device
WO2022206426A1