Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The same reference numerals denote the same or similar parts in the drawings, and thus, a repetitive description thereof will be omitted.
The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations or operations have not been shown or described in detail to avoid obscuring aspects of the invention.
The drawings are merely schematic illustrations of the present invention, in which the same reference numerals denote the same or similar parts, and thus, a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and steps, nor do they necessarily have to be performed in the order described. For example, some steps may be decomposed, and some steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The following detailed description of exemplary embodiments of the invention refers to the accompanying drawings.
FIG. 1 is a system block diagram illustrating a method and apparatus for financial data processing according to an exemplary embodiment.
The server 105 may be a server providing various services, such as a back-office management server (for example only) providing support for a financial data processing system operated by a user with the terminal device 101, 102, 103. The background management server may analyze and otherwise process the received data such as the financial data processing request, and feed back a processing result (for example, a notification of successful deduction, a remaining amount, just an example) to the terminal device.
The server 105 may, for example, obtain a financial data processing request, the processing request including account information and a processing amount; server 105 may determine a first account in a distributed cache, for example, from the account information; server 105 may, for example, determine whether the remaining amount in the first account is greater than or equal to the processing amount. Server 105 may, for example, deduct the processing amount from the remaining amount when the remaining amount is equal to or greater than the processing amount.
The server 105 may be a server of one entity, or may be composed of a plurality of servers, for example, and a part of the server 105 may be used as a financial data processing task submitting system in the present application, for example, to obtain a task to be performed with financial data processing; and a portion of the server 105 may also be used, for example, as a financial data processing system in the present application, for obtaining a financial data processing request, the processing request including account information and a processing amount; determining a first account in a distributed cache according to the account information; judging whether the remaining amount in the first account is greater than or equal to the processing amount; and when the remaining amount is equal to or greater than the processing amount, deducting the processing amount from the remaining amount.
It should be noted that the method for processing financial data provided by the embodiment of the present application may be executed by the server 105, and accordingly, a device for processing financial data may be disposed in the server 105. And the requesting end provided to the user for submitting the financial data processing task and the financial data processing result is generally located in the terminal device 101, 102, 103.
FIG. 2 is a flow diagram illustrating a method of financial data processing according to an exemplary embodiment. According to the financial data processing method shown in fig. 2, the concurrency and timeliness of financial data processing can be improved on the premise of ensuring data security. Next, a financial data processing method in an exemplary embodiment of the present application will be explained with reference to fig. 2.
In step S210, a financial data processing request is obtained, the processing request including account information and a processing amount. The processing amount may be, for example, a payout amount, i.e., an amount value to be deducted from the current account, but the present invention is not limited to a specific form of the processing amount, and may also be, for example, an income amount, i.e., an amount value to be added to the current account.
In step S220, a first account is determined in the distributed cache according to the account information. The distributed cache is managed and controlled by one server, and a plurality of client nodes store data, and can process a large amount of dynamic data. With the expansion of local computer systems to distributed systems, distributed caching has found widespread use in the field of distributed computing. In the exemplary embodiment, a portion of the balance may be locked from each account and account information and balance information may be synchronized into a distributed cache to enable concurrent processing of financial data.
The first account is an account recorded in the distributed cache and matched with the account information, for example, the account information is a unique code, and accordingly, an account with the same code can be searched in the cache, that is, the first account can be determined in the distributed cache. However, the specific form of the account information is not particularly limited in the present invention, for example, the account information may also be other unique identifiers of the user, such as an identification number, a bank card number, and the like.
According to an example embodiment, it may be determined whether a first account corresponding to the account information exists in a distributed cache; and when the first account corresponding to the account information does not exist in the distributed cache, creating the first account. At initialization state, all account information may be synchronized in the distributed cache and a predetermined number of frozen amounts may be frozen for distributed parallel computing. When the account information is a new application account, the account information may not be recorded in the distributed cache. In the above case, a first account corresponding to the account information may be created in the distributed cache to complete the following steps.
According to an example embodiment, creating the first account may include: freezing a predetermined number of frozen amounts in a second account based on the processing amount; using the frozen amount as the remaining amount of the first account; and creating the first account. And recording the actual fund status of the account corresponding to the account information by the second account, wherein the actual fund status of the account corresponding to the account information can be recorded in a database. The predetermined number of frozen sums may be, for example, a value 10 times the processing sum, but the predetermined number of frozen sums is not particularly limited in the present invention, and it is only necessary to ensure that the predetermined number of frozen sums is greater than or equal to the processing sum. In this example embodiment, a portion of the amount in the second account may be frozen and synchronized into the distributed cache to enable distributed parallel computing of financial data processing.
In step S230, it is determined whether the remaining amount in the first account is equal to or greater than the processing amount. When the processing amount is the expenditure amount, in order to ensure that the deduction is successful in the first account corresponding to the distributed cache, the step needs to be carried out to ensure the normal operation of the deduction.
In step S240, when the remaining amount is equal to or larger than the processing amount, the processing amount is deducted from the remaining amount. According to an example embodiment, the remaining amount in the first account is updated when the remaining amount is less than the processing amount.
Wherein the remaining amount in the first account may be updated by: freezing a predetermined number of frozen amounts in a second account based on the processing amount; and updating the remaining amount by the frozen amount. For example, when the remaining amount is 10 and the processing amount is 100, a frozen amount 10 times the processing amount, that is, 1000, may be frozen in the second account, and the remaining amount is updated by the frozen amount of 1000, that is, the remaining amount is 1010, but the present invention is not limited to a specific value of the frozen amount, and may also be other values larger than the processing amount.
Wherein the processing amount may also be deducted from the remaining amount of the first account. As in the previous example, the remaining amount is 1010 and the processing amount is 100, and after the deduction operation is performed, the remaining amount of the first account is 910.
According to example embodiments, the status of the first account in the distributed cache may also be updated periodically. The method comprises the steps of firstly collecting all deduction records in the distributed cache, updating a second account in the database according to the deduction records, and distributing the frozen amount for the distributed cache again.
According to the financial data processing method, the distributed cache is associated with the database, and concurrent financial data processing is completed in the distributed cache, so that the concurrency capability and timeliness of financial data processing can be improved on the premise of ensuring data security.
FIG. 3 is a flow diagram illustrating a method of financial data processing according to an exemplary embodiment. Referring to fig. 3, a method of creating a first account in a distributed cache may include:
step S310, freezing a preset amount of frozen money in the second account according to the processing money. And recording the actual fund status of the account corresponding to the account information by the second account, wherein the actual fund status of the account corresponding to the account information can be recorded in a database. The second account may record the current real balance of the user, and may choose to freeze the balance of the user's predetermined amount as the frozen amount. The predetermined amount may be, for example, a predetermined multiple of the current amount to be processed, for example, 10 times, but the predetermined amount is not particularly limited in the present invention.
And step S320, taking the frozen amount as the remaining amount of the first account. The first account is an account which is recorded in the distributed cache and corresponds to the second account, and the remaining amount is recorded on the account, namely the frozen amount in the second account. According to an example embodiment, the remaining amount of the first account may be updated periodically. The updating mode can firstly return the residual amount of all the first accounts to the database to replace the frozen amount in the second account; and reapplies the frozen amount in the second account as the updated remaining amount of the first account.
Step S330, creating the first account. The first account can be created in the distributed cache according to the account information of the first account and the corresponding remaining amount. The account information for the first account may be obtained via a financial data processing request.
FIG. 4 is a flow chart illustrating a method of financial data processing according to another exemplary embodiment. Referring to fig. 4, the financial data processing method may include:
step S410, when receiving the financial data processing request, searching whether the current account, namely the first account, is cached in the distributed cache, and if so, executing step S420; if not, a first account is created in the cache, and step S440 is performed. The financial data processing request comprises account information and processing amount, and the account information can be used as a key word for searching the current account in the distributed cache. The processing amount may be an amount to be deducted from the current account, but the present invention is not limited thereto, and the processing amount may also be an amount to be earned from the current account, i.e. an amount to be added.
Step S420, determining whether the remaining amount of the first account in the cache is greater than or equal to the processing amount, if so, executing step S450, and ending the process. If not, step S430 is performed. When the processed amount is the income amount, the remaining amount can be directly subjected to collection operation, and the flow is ended after a notification of successful collection is returned.
And step S430, unfreezing and deducting the deducted money amount in the first account in the distributed cache, and returning the deducted money amount to the second account. The step can be that the residual amount of the first account is returned to the second account, the frozen amount of the second account is unfrozen and deducted by the second account according to the deduction condition of the residual amount, and the residual amount after deduction is recovered.
Step S440, applying for a frozen fund in the second account according to the account information and placing the fund into the corresponding first account in the distributed cache. The specific amount of the fund may be, for example, 10 times the processing amount or other value greater than or equal to the processing amount, which is not limited in the present invention.
And step S450, executing the cache deduction and returning a notice of successful deduction of the user.
According to the financial data processing method, the distributed cache is associated with the database, and concurrent financial data processing is completed in the distributed cache, so that the concurrency capability and timeliness of financial data processing can be improved on the premise of ensuring data security. In conclusion, the financial data processing method of the application utilizes the high concurrency of the distributed cache to complete the quick response of the real-time transaction; when the balance of the distributed cache is insufficient, the balance of the database is summarized and updated, and the balance of the distributed cache is reapplied, so that strong consistency of data is realized, and the fund security of a user can be ensured. By combining the distributed cache and the database, high concurrency is guaranteed, and data safety is also guaranteed.
FIG. 5 is a block diagram illustrating a financial data processing apparatus according to an exemplary embodiment. Referring to fig. 5, the financial data processing apparatus may include: a request module 510, a cache module 520, a determination module 530, and a processing module 540.
In the financial data processing device, the request module 510 is configured to obtain a financial data processing request, where the processing request includes account information and a processing amount. The processing amount may be, for example, a payout amount, i.e., an amount value to be deducted from the current account, but the present invention is not limited to a specific form of the processing amount, and may also be, for example, an income amount, i.e., an amount value to be added to the current account.
The cache module 520 is configured to determine a first account in the distributed cache according to the account information. The distributed cache is managed and controlled by one server, and a plurality of client nodes store data, and can process a large amount of dynamic data. With the expansion of local computer systems to distributed systems, distributed caching has found widespread use in the field of distributed computing. In the exemplary embodiment, a portion of the balance may be locked from each account and account information and balance information may be synchronized into a distributed cache to enable concurrent processing of financial data.
According to an example embodiment, the cache module 520 may be further configured to determine whether a first account corresponding to the account information exists in the distributed cache; and when the first account corresponding to the account information does not exist in the distributed cache, creating the first account.
According to an example embodiment, the caching module 520 may be further configured to freeze a predetermined number of frozen amounts in the second account based on the processing amount; using the frozen amount as the remaining amount of the first account; and creating the first account. And recording the actual fund status of the account corresponding to the account information by the second account, wherein the actual fund status of the account corresponding to the account information can be recorded in a database.
The determining module 530 is configured to determine whether the remaining amount in the first account is greater than or equal to the processing amount. When the processing amount is the expenditure amount, in order to ensure that the deduction is successful in the first account corresponding to the distributed cache, the step needs to be carried out to ensure the normal operation of the deduction.
The processing module 540 is configured to deduct the processing amount from the remaining amount when the remaining amount is greater than or equal to the processing amount. According to an example embodiment, the processing module 540 may be further configured to update the remaining amount in the first account when the remaining amount is less than the processing amount. Wherein the remaining amount in the first account may be updated by: freezing a predetermined number of frozen amounts in a second account based on the processing amount; and updating the remaining amount by the frozen amount.
According to financial data processing apparatus of this application, through being correlated with distributed cache and database to accomplish the financial data processing of concurrent formula in distributed cache, can improve financial data processing's concurrent ability and ageing under the prerequisite of guaranteeing data security.
FIG. 6 is an architecture diagram illustrating a financial data processing apparatus according to another exemplary embodiment. Referring to fig. 6, the financial data processing apparatus may include an account balance real-time processing module 610, an account balance cache processing module 620, a timing compensation processing module 630, a database 640, and a customer withdrawal module 650.
In the financial data processing device, the account balance real-time processing module 610 is used to implement 2 functions, one of which is to accept the client financial data processing request and forward it to the account balance cache processing module for processing. The second is to execute the balance operation of the database 640 storing the actual information of the user, and accept the request of the account balance cache processing module 620 or the timing compensation processing module 630 to summarize and update the database 640.
The account balance cache processing module 620 is configured to process the financial data processing request, and mainly has the functions of applying for the remaining amount in the cache (i.e., the frozen amount), withdrawing the balance cache (i.e., deducting the processing amount), and summarizing and updating the balance.
The timing compensation processing module 630 is configured to periodically check a balance processing condition and a cache state of the cache application, and call the balance real-time processing module to refresh the balance of the user when the cache expires, so as to prevent the balance of the user from being distorted due to problems such as cache abnormality.
The database 640 is used to store actual information of all users, i.e. account information of the second account. The customer withdrawal module 650 is used for the customer to submit a financial data processing request, wherein the request includes account information and a processing amount. The database 640 may be, for example, a Mysql database, but the present invention is not limited thereto.
According to financial data processing apparatus of this application, through being correlated with distributed cache and database to accomplish the financial data processing of concurrent formula in distributed cache, can improve financial data processing's concurrent ability and ageing under the prerequisite of guaranteeing data security. The financial data processing device of the application freezes partial balance of a user and synchronizes frozen money into a distributed cache by combining the cache with a database; and when a withdrawal request exists, the withdrawal is realized by updating the distributed cache. Due to the high performance of the distributed cache, the concurrency of financial data processing can be greatly improved. And when the cached funds are consumed, performing one-time operation on the database to update the balance, and simultaneously applying for the cached balance again.
FIG. 7 is a block diagram illustrating an electronic device for merchandise recommendation, according to an example embodiment.
An electronic device 700 according to this embodiment of the present application is described below with reference to fig. 7. The electronic device 700 shown in fig. 7 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. For example, the central processing unit 701 may perform the steps as shown in one or more of fig. 2, 3, 4.
In the RAM 703, various programs and data necessary for system operation, such as account information, a processing amount, a remaining amount, and the like, are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a touch screen, a keyboard, and the like; an output section 707 including a display such as a Liquid Crystal Display (LCD) and a speaker; a storage section 708 including a flash memory or the like; and a communication section 709 including such as a wireless network card, a high-speed network card, and the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711, such as a semiconductor memory, a magnetic disk, or the like, is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution of the embodiment of the present invention may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computing device (which may be a personal computer, a server, a mobile terminal, or a smart device, etc.) to execute the method according to the embodiment of the present invention, such as the steps shown in one or more of fig. 2, fig. 3, and fig. 4.
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It is to be understood that the invention is not limited to the details of construction, arrangement of drawings, or method of implementation, which have been set forth herein, but on the contrary, is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.