Foreign currency position control method, device and server
By intercepting and parsing SQL statements before transaction execution, obtaining transaction information, and obtaining foreign currency position information from the second server to determine the liquidation funds, the problem of inefficient foreign currency position management methods is solved, real-time control of foreign currency position and more efficient asset-liability management are achieved.
Patent Information
- Application Number
- CN202210099300.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-01-27
AI Technical Summary
The existing foreign currency position management methods mainly rely on post-event supervision, are inefficient and cannot meet the real-time requirements of foreign currency position control.
Before the transaction is executed, the interceptor is used to intercept and parse SQL statements, obtain transaction information, and obtain foreign currency position information at each level of control unit level from the second server to determine the liquidation fund information, thereby deciding whether to continue executing the transaction.
Real-time control of foreign currency positions has been achieved, the efficiency of bank asset and liability management has been improved, and the problem of foreign currency positions being overdrafted exceeding expectations.
Smart Images

Figure CN114418768B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a foreign currency position control method, device and server. Background Art
[0002] For banks, foreign currency is a relatively scarce resource and they currently use differential fund management, that is, the source of foreign currency funds and the use of foreign currency funds are mutually restricted.
[0003] Since foreign currency is a scarce resource, when a bank entity's position is overdrawn, the subordinate bank needs to pay interest to the superior bank at a higher overdraft rate. If it causes an overdraft at the head office level, the head office needs to borrow from peers at a higher cost. Therefore, it is necessary to strictly control the position amount of each bank entity. Traditional foreign currency position management is mainly post-monitoring management, specifically estimating the foreign currency clearing position of Zhisheng. If the estimate of its own position is too optimistic, it will cause insufficient foreign currency clearing funds and form an overdraft risk. The bank can only passively obtain the result that the fund position has been overdrawn after the transaction, which is extremely unfavorable to the bank's liability management.
[0004] Therefore, the above-mentioned post-monitoring management method takes a lot of time, has poor efficiency and real-time performance, and cannot meet the real-time requirements of foreign currency position control. Summary of the invention
[0005] The present application provides a foreign currency position control method, device and server to solve the problem that the existing post-supervision and management method takes a long time, has poor efficiency and real-time performance, and cannot meet the real-time requirements of foreign currency position control.
[0006] In a first aspect, the present application provides a foreign currency position control method, the method comprising: the method is applied to a first server, the method comprising:
[0007] Determine the transaction code of the current transaction according to the transaction request sent by the transaction initiator;
[0008] When it is determined according to the transaction code that the current transaction is a transaction requiring foreign currency position control, the SQL statement executed in the current transaction is intercepted by an interceptor, and the corresponding transaction information is obtained by parsing; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction;
[0009] Obtaining foreign currency position information corresponding to each level of control unit from the second server, and determining clearing fund information of each level of control unit at the end of the current transaction based on the outgoing account information, the bank information, and the foreign currency position information corresponding to each level of control unit;
[0010] Determine whether to continue executing the SQL statement of the current transaction according to the clearing fund information of each level of control unit, and send the transaction result to the transaction initiator.
[0011] Optionally, the transaction request includes a transaction input message; and determining the transaction code of the current transaction according to the transaction request sent by the transaction initiator includes:
[0012] Before the current transaction is executed, the transaction input message is obtained through a pre-created front section;
[0013] The transaction input message is parsed to obtain a transaction code corresponding to the current transaction.
[0014] Optionally, parse to obtain corresponding transaction information, including:
[0015] Extracting the data table name in the intercepted SQL statement; the intercepted SQL statement is intercepted when the interceptor detects that there is an interception mark in the thread variable corresponding to the current transaction; the interception mark is written to the thread variable when determining that the current transaction is a transaction requiring foreign currency position control;
[0016] When it is determined according to the data table name that the data table generated by the SQL statement is a detail data table, the SQL statement executed in the current transaction is parsed to obtain corresponding transaction information.
[0017] The method further comprises:
[0018] Filtering transaction programs with specific annotations from all transaction programs to obtain annotation attributes corresponding to the transaction programs; the transaction programs with specific annotations indicate that the corresponding transactions are transactions that require foreign currency position control; the transaction programs are transaction programs triggered when the online transaction program processes the transactions;
[0019] Acquire a preset transaction code pre-set in the annotation attribute, and store the preset transaction code in a preset location;
[0020] Accordingly, determining, according to the transaction code, that the current transaction is a transaction requiring foreign currency position control includes:
[0021] When the transaction code is one of the preset transaction codes, the current transaction is determined to be a transaction requiring foreign currency position control.
[0022] Optionally, obtaining foreign currency position information corresponding to each level of control unit from the second server, and determining the clearing fund information of each level of control unit at the end of the current transaction according to the outgoing account information, the bank information and the foreign currency position information corresponding to each level of control unit, including:
[0023] acquiring the clearing path data and the set basic control unit level from the second server, determining each upper-level control unit level that needs to perform foreign currency position control according to the bank information, the clearing path data and the basic control unit level, and acquiring the foreign currency position information corresponding to the current level and each upper-level control unit level from the second server;
[0024] For each control unit level, the foreign currency position information corresponding to the control unit level is subtracted from the outgoing information to obtain the clearing fund information corresponding to the control unit level at the end of the current transaction.
[0025] Optionally, determining whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of control unit comprises:
[0026] Determining whether the current transaction meets the overdraft conditions corresponding to the control unit levels at each level according to the clearing fund information at each level of the control unit levels;
[0027] When there is a control unit level that does not meet the overdraft condition, transaction failure information is sent to the transaction initiator through the online transaction program.
[0028] Optionally, judging whether the current transaction satisfies the overdraft conditions corresponding to each level of control unit according to the clearing fund information of each basic control unit level includes:
[0029] For each control unit level, when it is determined that the clearing fund information corresponding to the control unit level is a negative value, the overdraft limit corresponding to the control unit level is obtained;
[0030] Determining whether the absolute value of the clearing funds information is greater than the overdraft limit;
[0031] When the amount is greater than the overdraft limit, it is determined that the current transaction does not satisfy the overdraft condition corresponding to the control unit level.
[0032] In a second aspect, the present invention provides a foreign currency position control device, the device is applied to a first server, and the device includes:
[0033] The acquisition module is used to determine the transaction code of the current transaction according to the transaction request sent by the transaction initiator;
[0034] A parsing module, for, when determining, based on the transaction code, that the current transaction is a transaction requiring foreign currency position control, intercepting the SQL statement executed in the current transaction through an interceptor, and parsing to obtain corresponding transaction information; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction;
[0035] a determination module, configured to obtain foreign currency position information corresponding to each level of control unit from the second server, and determine the clearing fund information of each level of control unit at the end of the current transaction according to the outgoing account information, the bank information and the foreign currency position information corresponding to each level of control unit;
[0036] The determination module is also used to determine whether to continue executing the SQL statement of the current transaction according to the clearing fund information of each level of control unit, and send the transaction result to the transaction initiator.
[0037] In a third aspect, the present application provides a server, comprising: at least one processor and a memory;
[0038] The memory stores computer-executable instructions;
[0039] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method as described in any one of the first aspects.
[0040] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the first aspects is implemented.
[0041] The present invention provides a foreign currency position control method, device and server, the method comprising: determining a transaction code of a current transaction according to a transaction request sent by a transaction initiator; when determining that the current transaction is a transaction requiring foreign currency position control according to the transaction code, intercepting an SQL statement executed in the current transaction by an interceptor, and parsing to obtain corresponding transaction information; the SQL statement is used to generate a data table corresponding to the current transaction; obtaining foreign currency position information corresponding to each level of control unit from a second server, determining clearing fund information of each level of control unit when the current transaction ends according to the outgoing account information, the bank information and the foreign currency position information corresponding to each level of control unit; determining whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of the level of control unit, and sending the transaction result to the transaction initiator, the method can determine whether the requirements of each level of control unit are met according to the transaction information of the current transaction before the current transaction is executed, so as to perform real-time control of foreign currency position funds. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0043] Figure 1 A schematic diagram of an application scenario provided by the present invention;
[0044] Figure 2 A flow chart of a foreign currency position control method provided by the present invention;
[0045] Figure 3 The present invention provides a Figure 2 Flow chart of the processing method of step S203;
[0046] Figure 4 The present invention provides a Figure 2 Flow chart of the processing method of step S204;
[0047] Figure 5 A schematic diagram of an external position control provided by the present invention;
[0048] Figure 6 A schematic diagram of the structure of a foreign currency position control device provided by the present invention;
[0049] Figure 7 A schematic diagram of the hardware structure of a server provided by the present invention. DETAILED DESCRIPTION
[0050] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0052] Figure 1 A schematic diagram of an application scenario provided by the present invention, such as Figure 1 As shown, the method is applied on the first server 102, wherein the user initiates a transaction request in the transaction initiation terminal 101. The transaction initiation terminal 101 may be a mobile bank, an online bank, an ATM machine, a counter, etc., and the user may send a transaction request through the transaction initiation terminal 101. An online transaction device and a foreign currency position control device are provided in the first server 102, wherein the transaction request sent by the user will be processed by the online transaction device, and a SQL statement is sent to the database according to the transaction request information to realize the detailed registration of the transaction information, thereby completing the transaction. However, in order to perform foreign currency position control, the transaction code of the current transaction may be determined in the foreign currency position control device, and when the current transaction is determined to be a transaction requiring foreign currency position control based on the transaction code, the foreign currency position information is obtained from the second server 103, the intercepted SQL statement is parsed, and it is determined whether the current transaction can be continued according to the transaction information and the foreign currency position information, and the judgment result is sent to the online transaction module, so that the online transaction module sends the transaction result to the transaction initiation terminal 101.
[0053] In the prior art, when managing foreign currency positions, it mainly relies on post-supervision, that is, when no intervention is made during the execution of the transaction, when the transaction is completed, the result is that the foreign currency capital position is overdrawn, which is extremely unfavorable for the bank's asset-liability management.
[0054] Based on the above problems, we consider real-time foreign currency position control management during the transaction execution process, that is, while the transaction is in progress, we can make a judgment on whether the transaction will cause an overdraft, thereby improving the efficiency of the bank's asset-liability management. In order to achieve the above real-time foreign currency position control management, before the online transaction executes the transaction request, a front-end is created to obtain the transaction code of the current transaction, and based on the transaction code, it is judged whether the current transaction is a transaction that requires foreign currency position control. In addition, the SQL statement sent to the database in the online transaction is intercepted by the interceptor to obtain the transaction information. Based on the transaction information, it is judged whether the current transaction will cause an overdraft requirement at each upper control unit level, thereby determining whether to continue to execute the current transaction.
[0055] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0056] Figure 2 A flow chart of a foreign currency position control method provided by the present invention is as follows: Figure 2 As shown, the execution subject of the method is a foreign currency position control device, which is set on a first server, and the method includes:
[0057] Step S201: Determine the transaction code of the current transaction according to the transaction request sent by the transaction initiator.
[0058] In this step, the user can send a transaction request through the transaction initiator, for example, the user initiates a foreign currency transfer transaction through the mobile banking. After the transaction request is initiated, the first server will receive the request, and the online transaction device in the first server is responsible for processing the transaction request, wherein the online transaction device stores an online transaction program. For example, the transaction information is obtained, and the transaction information is recorded in the detail table by sending an SQL statement to the database.
[0059] In the above process, it is necessary to determine whether the current transaction is a transaction that requires foreign currency position control. Specifically, before the current transaction is executed, the transaction code of the current transaction is obtained according to the transaction request through the created front facet.
[0060] Optionally, the transaction request includes a transaction input message; and determining the transaction code of the current transaction according to the transaction request sent by the transaction initiator includes:
[0061] Before the current transaction is executed, the transaction input message is obtained through a pre-created front section; the transaction input message is parsed to obtain a transaction code corresponding to the current transaction.
[0062] Among them, creating the front aspect refers to creating a section of code based on aspect-oriented programming, which can obtain the transaction input message of the current transaction, parse the transaction input message, and obtain the transaction code.
[0063] Through the front-end processing method, it is possible to determine whether the current transaction is a transaction that requires foreign currency position control without modifying the original online trading program.
[0064] Step S202: When it is determined according to the transaction code that the current transaction is a transaction requiring foreign currency position control, an SQL statement executed in the current transaction is intercepted by an interceptor, and corresponding transaction information is obtained by parsing; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction.
[0065] Among them, after judging the acquired transaction code, if it is determined that the current transaction is a transaction that requires foreign currency position control, an interception flag can be written to the thread variable corresponding to the current transaction, so that the interceptor can intercept the SQL statement executed by the current transaction. Among them, the SQL statement is used to send to the database and generate different types of data tables corresponding to the current transaction.
[0066] After intercepting the SQL statement, the SQL statement can be obtained, and the SQL statement contains the transaction information of the current transaction. Based on the transaction information, it can be determined whether the current transaction can be continued.
[0067] Specifically, the transaction information includes outgoing information and bank information, wherein the outgoing information refers to the outgoing amount; the bank information refers to the actual transaction bank information and the account opening bank information.
[0068] Step S203, obtaining foreign currency position information corresponding to each level of control unit from the second server, and determining the clearing fund information of each level of control unit at the end of the current transaction based on the outgoing information, the bank information and the foreign currency position information corresponding to each level of control unit.
[0069] At the same time, in order to determine whether the current transaction can continue to be executed, other basic data needs to be obtained. Specifically, the foreign currency position information corresponding to each level of the control unit hierarchy can be obtained from the second server, wherein each level of the control unit hierarchy refers to the level and the superior banks of the bank corresponding to the bank information; the foreign currency position information refers to the foreign currency position balance, that is, the foreign currency position balance that can be used by a certain bank. For example, for the foreign currency US dollar, each bank has the foreign currency position information corresponding to the foreign currency, that is, the balance that can be used. Since the funds of the actual transaction bank and the account opening bank will change at the time of the transaction (although the funds will be cleared in the actual transaction bank and the account opening bank later), it is necessary to determine the clearing funds information of the actual transaction bank and the account opening bank and their respective superior control unit levels.
[0070] After obtaining the above basic data, the clearing funds information of the control unit levels at the end of the current transaction can be determined based on the outgoing information, bank information, and the foreign currency position information corresponding to the control unit levels at the bank information. That is, it is necessary to calculate whether the clearing funds information of the outlet or branch corresponding to the bank information at the end of the transaction meets the overdraft demand, and it is also necessary to calculate whether the clearing funds of the control unit levels at all levels (such as branches, city branches, provincial branches, etc.) that manage and control the outlet or branch at the end of the transaction meet the overdraft demand. Among them, each upper control unit level can be set according to demand.
[0071] For example, when the actual transaction bank or account opening bank is branch D, if the level of foreign currency position control required is the city branch and the provincial branch, the actual city branch is determined to be branch A and the provincial branch is branch B according to the bank information of branch D. Then, the clearing fund information corresponding to branch D, branch A and branch B respectively is calculated at the end of the current transaction.
[0072] Step S204: determine whether to continue executing the current transaction according to the clearing fund information of each level of control unit, and send the transaction result to the transaction initiator.
[0073] Finally, it is determined whether the current transaction can continue to be executed based on the clearing fund information at each level of the control unit. For example, whether the clearing fund information at each level of the control unit meets the overdraft condition. When it is determined that the current transaction can continue to be executed, the intercepted SQL statement is sent to the database to complete the execution process of the current transaction. When it is determined that the current transaction cannot be executed, a transaction error message is sent to the online transaction program to stop the execution of the current transaction, and the transaction failure result is sent to the transaction initiator.
[0074] In this embodiment, the transaction code of the current transaction is determined according to the transaction request sent by the transaction initiator; when it is determined according to the transaction code that the current transaction is a transaction that requires foreign currency position control, the SQL statement executed in the current transaction is intercepted by an interceptor, and the corresponding transaction information is obtained by parsing; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction; the foreign currency position information corresponding to each level of the control unit is obtained from the second server, and the clearing fund information of each level of the control unit at the end of the current transaction is determined according to the account information, the bank information and the foreign currency position information corresponding to each level of the control unit; whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of the control unit is determined, and the transaction result is sent to the transaction initiator, so as to realize real-time control of foreign currency position transactions. In addition, the method can also avoid the problem of foreign currency position overdraft exceeding expectations.
[0075] The following is a detailed description of the process of obtaining transaction information in each of the above processes and determining whether a transaction is a transaction that requires foreign currency position control based on the transaction code.
[0076] Optionally, parse to obtain corresponding transaction information, including:
[0077] Extracting the data table name in the intercepted SQL statement; the intercepted SQL statement is intercepted when the interceptor detects that there is an interception identifier in the thread variable corresponding to the current transaction; the interception identifier is written to the thread variable when the current transaction is determined to be a transaction requiring foreign currency position control; when it is determined according to the data table name that the data table generated by the SQL statement is a detailed data table, parsing the SQL statement executed in the current transaction to obtain corresponding transaction information.
[0078] Among them, when writing SQL statements to the database, it is necessary to pass through the middle-layer MyBatis interceptor, and implement a custom MyBatis interceptor through the Interceptor interface of MyBatis. Therefore, SQL statements can be intercepted through the MyBatis interceptor. Specifically, when an interception flag is detected in the thread variable, it means that the SQL statement needs to be intercepted. Among them, when it is determined in the front-end processing process that the acquired transaction code is a preset transaction code (the preset transaction code corresponds to a transaction that requires foreign currency position control), the operation of writing the interception flag to the thread variable is triggered. Among them, the thread variable corresponds to a transaction, and each transaction processing process is implemented using a thread, by opening up a memory area in the memory to store the data required to execute the transaction.
[0079] After the SQL statement is intercepted, the data table name corresponding to the SQL statement can be obtained. Specifically, the data table name can be obtained by parsing the SQL statement.
[0080] After obtaining the data table name, determine whether the data table is a detailed data table. For example, when the data table name meets the bank's naming specifications for detailed data tables, the data table is determined to be a detailed data table. When it is determined that the data table in the SQL statement is a detailed data table, the transaction information in the SQL statement can be further extracted. Among them, the transaction information includes outgoing information and bank information, among which the outgoing information refers to the amount transferred; the bank information refers to the actual transaction bank information and the account opening bank information. By obtaining the above information, it is convenient to calculate the position control of the transaction.
[0081] The above method of intercepting SQL statements through interception identifiers can accurately intercept SQL statements and accurately obtain transaction information.
[0082] Optionally, the method further includes:
[0083] Filtering transaction programs with specific annotations from all transaction programs to obtain annotation attributes corresponding to the transaction programs; the transaction programs with specific annotations indicate that the corresponding transactions are transactions that require foreign currency position control; the transaction programs are transaction programs triggered when the online transaction program processes the transactions;
[0084] Acquire a preset transaction code pre-set in the annotation attribute, and store the preset transaction code in a preset location;
[0085] Accordingly, determining, according to the transaction code, that the current transaction is a transaction requiring foreign currency position control includes:
[0086] When the transaction code is one of the preset transaction codes, the current transaction is determined to be a transaction requiring foreign currency position control.
[0087] On the basis of the above-mentioned embodiment, the method of determining the preset transaction code is explained. Among them, when the program in the foreign currency position control device in the first server is started, the transaction program with a specific annotation is screened from all pre-written transaction programs. For example, when a preset mark is detected in a transaction program, it means that the transaction program is a transaction program with a specific annotation. Among them, an annotation attribute is set in the specific annotation. Among them, the specific annotation was originally added by the developer when the developer determined that the transaction program was a transaction that required foreign currency position control when developing the transaction program. Among them, a transaction code is set in the annotation attribute, and the transaction code in the annotation attribute is obtained and determined as a preset transaction code, and stored in a preset position in the form of a HashSet. Among them, all transaction programs here are corresponding programs written according to the actual transaction business of the bank. When the online transaction program executes a transaction, it needs to trigger the corresponding transaction program to complete the transaction.
[0088] The above process of determining the preset transaction code by annotation parsing has the advantage of being simple and convenient. For the entire business, developing each transaction program is an indispensable step. By adding annotations at the same time, the preset transaction code can be determined without the user having to manually record the transaction code of each transaction and write it into the memory.
[0089] Correspondingly, after obtaining the transaction code corresponding to the current transaction, the obtained transaction code is compared with the preset transaction code one by one to determine whether the obtained transaction code is one of the preset transaction codes. When the transaction code is one of the preset transaction codes, it is determined that the current transaction is a transaction that requires foreign currency position control.
[0090] The following is a detailed description of the process of calculating the clearing fund information and determining whether to execute the current transaction based on the clearing fund information.
[0091] Figure 3 The present invention provides a Figure 2 Flow chart of the processing method of step S203.
[0092] Optionally, obtaining foreign currency position information corresponding to each level of control unit from the second server, and determining the clearing fund information of each level of control unit at the end of the current transaction according to the outgoing account information, the bank information and the foreign currency position information corresponding to each level of control unit, including:
[0093] Step S301, obtaining the clearing path data and the set basic control unit level from the second server, determining each upper control unit level that needs to perform foreign currency position control according to the bank information, the clearing path data and the basic control unit level, and obtaining the foreign currency position information corresponding to the current level and each upper control unit level from the second server;
[0094] Step S302: for each control unit level, subtract the foreign currency position information corresponding to the control unit level from the outgoing information to obtain the clearing fund information corresponding to the control unit level at the end of the current transaction.
[0095] Among them, when calculating the foreign currency position, it is also necessary to obtain basic data, such as clearing path data and the set basic control unit level. Specifically, it can be obtained from the second server when the program in the foreign currency position control device in the first server is started. The second server can be a database server or a file server. In addition, it can also be a distributed configuration center, etc. Among them, the clearing path data is used to store the upper and lower clearing banks corresponding to each specific bank. The clearing path data is organized in a bidirectional linked list, which can realize the determination of the associated upper and lower clearing banks based on any bank. Among them, the set basic control unit level is the control unit level set by the user according to the needs, for example, it can be a provincial branch, a municipal branch, a sub-branch, an outlet, etc.
[0096] After obtaining the clearing path data and the set basic control unit level, the upper control unit levels corresponding to the bank can be obtained according to the bank information and the clearing path data, and the upper control unit levels that need to be controlled by foreign currency positions can be screened from the upper control unit levels determined to be corresponding to the bank according to the set control unit level. The foreign currency position information corresponding to the current level and the upper control unit levels that need to be controlled by foreign currency positions, that is, the foreign currency balance, is obtained from the second server.
[0097] After determining the foreign currency position information corresponding to the current and upper control unit levels, for each control unit level, the foreign currency position information is subtracted from the outgoing information to obtain the clearing fund information corresponding to the control unit level. For example, when the transaction bank is branch D, the foreign currency position information corresponding to the branch is US$300. If the outgoing amount is US$100, the difference between US$300 and US$100 is calculated, and the clearing fund information corresponding to the branch is US$200; the calculation method for branch A in city and branch B in province is the same.
[0098] By acquiring basic data information from the second server, the upper-level control unit levels for position control and the corresponding foreign currency position information can be accurately and quickly determined, providing a basis for determining the clearing funds information at each control unit level.
[0099] Figure 4 The present invention provides a Figure 2 Flow chart of the processing method of step S204.
[0100] Optionally, determining whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of control unit comprises:
[0101] Step S401: judging whether the current transaction satisfies the overdraft conditions corresponding to the control unit levels at each level according to the clearing fund information of the control unit levels at each level.
[0102] Among them, when determining whether to continue executing the current transaction, it can also be judged based on the clearing funds information of each level of control unit, that is, judging whether the current transaction meets the overdraft conditions corresponding to each level of control unit based on the clearing funds information. Therefore, it is necessary to obtain the overdraft conditions corresponding to each control unit level.
[0103] Optionally, judging whether the current transaction satisfies the overdraft conditions corresponding to each level of control unit according to the clearing fund information of each basic control unit level includes:
[0104] For each control unit level, when it is determined that the clearing fund information corresponding to the control unit level is a negative value, the overdraft limit corresponding to the control unit level is obtained; it is determined whether the absolute value of the clearing fund information is greater than the overdraft limit; when it is greater than the overdraft limit, it is determined that the current transaction does not meet the overdraft condition corresponding to the control unit level.
[0105] Among them, determining whether the overdraft conditions corresponding to each control unit level are met can be achieved by setting the overdraft limit. Specifically, each control unit level corresponds to an overdraft limit. For each control unit level, determine whether the clearing fund information is a negative value. If it is a negative value, it means that it has been overdrawn, and it is necessary to continue to determine whether the clearing fund information exceeds the overdraft limit. Specifically, the overdraft limit can be set to a positive value, and the absolute value of the clearing fund information is obtained. When the absolute value is greater than the overdraft limit, it means that it exceeds the overdraft limit corresponding to the control unit level, that is, the current transaction does not meet the overdraft condition corresponding to the control unit level. For example, when the clearing fund information corresponding to a certain control unit level is determined to be -300, if the overdraft limit corresponding to the control unit level is 200, it means that the current transaction does not meet the overdraft condition corresponding to the control unit level. On the contrary, when the absolute value of the clearing fund information is less than or equal to the overdraft limit, it means that the current transaction meets the overdraft limit corresponding to the control unit level.
[0106] By obtaining the overdraft limit of each control unit level, it is possible to simply and quickly determine whether the clearing fund information meets the overdraft conditions corresponding to each level of control unit level.
[0107] Step S402: When there is a control unit level that does not meet the overdraft condition, a transaction failure message is sent to the transaction initiator through the online transaction program.
[0108] Finally, for the current transaction, when it is determined that there is a control unit level that does not meet the overdraft conditions, it means that the current transaction cannot be executed, and a message indicating that the transaction is abnormal is sent to the online transaction program. When the online transaction program receives the message, it will stop executing the transaction. At the same time, the first server will also send a transaction failure message to the transaction initiator.
[0109] On the contrary, for the current transaction, when it is determined that there is no control unit level that does not meet the overdraft conditions, it means that the current transaction can be executed, and the intercepted SQL statement will be released. The online transaction program continues to execute the SQL statement and other business logic of the current transaction, and when the current transaction is completed, a transaction success message is sent to the transaction initiator, and transaction details can also be sent.
[0110] Figure 5 The figure is a schematic diagram of the external position control provided by the present invention, and the numbers in the figure represent the execution order of the steps. Figure 5 As shown, when the foreign currency position control program is started, it is necessary to parse the specific annotation first to obtain the preset transaction code, and at the same time load the basic data from the second server, and store the basic data and the preset transaction code in the memory. When the transaction initiator initiates the transaction, the online transaction program will first receive the transaction input message. Before processing the transaction input message, the method of the present application obtains the transaction code in the transaction input message by front-end processing, and compares it with the preset transaction code in the memory. When it belongs to the preset transaction code, the thread variable corresponding to the transaction is written with an interception mark. During the execution of the SQL statement, the interceptor will pass through the interceptor. When the interceptor detects that the thread variable has an interception mark, it will intercept and parse the SQL statement, obtain the transaction information of the current transaction, and calculate and control the foreign currency position based on the basic data stored in the memory, thereby intervening in the execution of the online transaction, and sending the final transaction execution result to the transaction initiator. The above process realizes the real-time calculation of whether the current transaction meets the overdraft condition during the transaction execution by creating a front-end and intercepting the SQL statement, and determines whether to continue to execute the transaction according to the judgment result, which can prevent the problem of foreign currency position overdraft exceeding expectations.
[0111] Figure 6 The structure diagram of a foreign currency position control device provided by the present invention is shown in FIG. Figure 6 As shown, the foreign currency position control device 60 of this embodiment is applied to the first server, and the device may include:
[0112] The acquisition module 601 is used to determine the transaction code of the current transaction according to the transaction request sent by the transaction initiator;
[0113] The parsing module 602 is used to intercept the SQL statement executed in the current transaction through an interceptor and parse to obtain corresponding transaction information when determining that the current transaction is a transaction requiring foreign currency position control according to the transaction code; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction;
[0114] The determination module 603 is used to obtain the foreign currency position information corresponding to each level of the control unit from the second server, and determine the clearing fund information of each level of the control unit at the end of the current transaction according to the outgoing information, the bank information and the foreign currency position information corresponding to each level of the control unit;
[0115] The determination module 604 is further used to determine whether to continue executing the SQL statement of the current transaction according to the clearing fund information of each level of control unit, and send the transaction result to the transaction initiator.
[0116] Optionally, the transaction request includes a transaction input message; when the acquisition module 601 determines the transaction code of the current transaction according to the transaction request sent by the transaction initiator, it is specifically used to:
[0117] Before the current transaction is executed, the transaction input message is obtained through a pre-created front section;
[0118] The transaction input message is parsed to obtain a transaction code corresponding to the current transaction.
[0119] Optionally, when parsing and obtaining corresponding transaction information, the parsing module 602 is specifically used to:
[0120] Extracting the data table name in the intercepted SQL statement; the intercepted SQL statement is intercepted when the interceptor detects that there is an interception mark in the thread variable corresponding to the current transaction; the interception mark is written to the thread variable when determining that the current transaction is a transaction requiring foreign currency position control;
[0121] When it is determined according to the data table name that the data table generated by the SQL statement is a detail data table, the SQL statement executed in the current transaction is parsed to obtain corresponding transaction information.
[0122] Optionally, the device further includes an annotation parsing module, specifically configured to:
[0123] Filtering transaction programs with specific annotations from all transaction programs to obtain annotation attributes corresponding to the transaction programs; the transaction programs with specific annotations indicate that the corresponding transactions are transactions that require foreign currency position control; the transaction programs are transaction programs triggered when the online transaction program processes the transactions;
[0124] Acquire a preset transaction code pre-set in the annotation attribute, and store the preset transaction code in a preset location;
[0125] Accordingly, when the parsing module 602 determines, according to the transaction code, that the current transaction is a transaction requiring foreign currency position control, it is specifically configured to:
[0126] When the transaction code is one of the preset transaction codes, the current transaction is determined to be a transaction requiring foreign currency position control.
[0127] Optionally, the determination module 603 obtains foreign currency position information corresponding to each level of control unit from the second server, and determines the clearing fund information of each level of control unit at the end of the current transaction according to the outgoing account information, the bank information and the foreign currency position information corresponding to each level of control unit:
[0128] acquiring the clearing path data and the set basic control unit level from the second server, determining each upper-level control unit level that needs to perform foreign currency position control according to the bank information, the clearing path data and the basic control unit level, and acquiring the foreign currency position information corresponding to the current level and each upper-level control unit level from the second server;
[0129] For each control unit level, the foreign currency position information corresponding to the control unit level is subtracted from the outgoing information to obtain the clearing fund information corresponding to the control unit level at the end of the current transaction.
[0130] Optionally, when determining whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of control unit, the determination module 603 is specifically used to:
[0131] Determining whether the current transaction meets the overdraft conditions corresponding to the control unit levels at each level according to the clearing fund information at each level of the control unit levels;
[0132] When there is a control unit level that does not meet the overdraft condition, information for stopping the execution of the current transaction is sent to the online transaction program, and transaction failure information is sent to the transaction initiator through the online transaction program.
[0133] Optionally, when determining whether the current transaction satisfies the overdraft conditions corresponding to each level of control unit according to the clearing fund information of each basic control unit level, the determination module 603 is specifically used to:
[0134] For each control unit level, when it is determined that the clearing fund information corresponding to the control unit level is a negative value, the overdraft limit corresponding to the control unit level is obtained;
[0135] Determining whether the absolute value of the clearing funds information is greater than the overdraft limit;
[0136] When the amount is greater than the overdraft limit, it is determined that the current transaction does not satisfy the overdraft condition corresponding to the control unit level.
[0137] The foreign currency position control device provided by the present invention can realize the above-mentioned Figures 2 to 5 The foreign currency position control method of the illustrated embodiment has similar implementation principles and technical effects, which will not be described in detail here.
[0138] Figure 7 The hardware structure diagram of a server provided by the present invention is shown in FIG. Figure 7 As shown, the server 70 provided in this embodiment includes: at least one processor 701 and a memory 702. The processor 701 and the memory 702 are connected via a bus 703.
[0139] In the specific implementation process, at least one processor 701 executes the computer execution instructions stored in the memory 702, so that at least one processor 701 executes the foreign currency position control method in the above method embodiment.
[0140] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0141] In the above Figure 7 In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0142] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk storage.
[0143] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0144] The present invention also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the foreign currency position control method of the above method embodiment is implemented.
[0145] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0146] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0147] One embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the present application Figures 2 to 5 The foreign currency position control method provided in any embodiment of the corresponding embodiment.
[0148] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0149] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A foreign currency position control method, characterized in that: The method is applied to a first server, and the method includes: Determine the transaction code of the current transaction according to the transaction request sent by the transaction initiator; When it is determined according to the transaction code that the current transaction is a transaction requiring foreign currency position control, the SQL statement executed in the current transaction is intercepted by an interceptor, and the corresponding transaction information is obtained by parsing; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction; Obtaining foreign currency position information corresponding to each level of control unit from the second server, and determining clearing fund information of each level of control unit at the end of the current transaction based on the outgoing account information, the bank information, and the foreign currency position information corresponding to each level of control unit; Determine whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of control unit, and send the transaction result to the transaction initiator; Parse and obtain the corresponding transaction information, including: Extracting the data table name in the intercepted SQL statement; the intercepted SQL statement is intercepted when the interceptor detects that there is an interception mark in the thread variable corresponding to the current transaction; the interception mark is written to the thread variable when the current transaction is determined to be a transaction requiring foreign currency position control; when it is determined according to the data table name that the data table generated by the SQL statement is a detailed data table, parsing the SQL statement executed in the current transaction to obtain corresponding transaction information; Obtaining foreign currency position information corresponding to each level of control unit from the second server, and determining clearing fund information of each level of control unit at the end of the current transaction according to the outgoing account information, the bank information, and the foreign currency position information corresponding to each level of control unit, including: Acquire the clearing path data and the set basic control unit level from the second server, determine each upper-level control unit level that needs to perform foreign currency position control according to the bank information, the clearing path data and the basic control unit level, and acquire the foreign currency position information corresponding to the current level and each upper-level control unit level from the second server; for each control unit level, subtract the foreign currency position information corresponding to the control unit level from the account information to obtain the clearing fund information corresponding to the control unit level at the end of the current transaction; Determining whether to continue executing the SQL statement of the current transaction according to the clearing fund information of each level of control unit, including: Determine whether the current transaction meets the overdraft conditions corresponding to the control unit levels at each level based on the clearing funds information of the control unit levels at each level; when there is a control unit level that does not meet the overdraft conditions, send transaction failure information to the transaction initiator through the online transaction program.
2. The method according to claim 1, characterized in that The transaction request includes a transaction input message; the determining of the transaction code of the current transaction according to the transaction request sent by the transaction initiator includes: Before the current transaction is executed, the transaction input message is obtained through a pre-created front section; The transaction input message is parsed to obtain a transaction code corresponding to the current transaction.
3. The method according to claim 1, characterized in that The method further comprises: Filtering transaction programs with specific annotations from all transaction programs to obtain annotation attributes corresponding to the transaction programs; the transaction programs with specific annotations indicate that the corresponding transactions are transactions that require foreign currency position control; the transaction programs are transaction programs triggered when the online transaction program processes the transactions; Acquire a preset transaction code pre-set in the annotation attribute, and store the preset transaction code in a preset location; Accordingly, determining, according to the transaction code, that the current transaction is a transaction requiring foreign currency position control includes: When the transaction code is one of the preset transaction codes, the current transaction is determined to be a transaction requiring foreign currency position control.
4. The method according to any one of claims 1 to 3, characterized in that: Judging whether the current transaction meets the overdraft conditions corresponding to the control unit levels at each level according to the clearing fund information at each basic control unit level, including: For each control unit level, when it is determined that the clearing fund information corresponding to the control unit level is a negative value, the overdraft limit corresponding to the control unit level is obtained; Determining whether the absolute value of the clearing funds information is greater than the overdraft limit; When the amount is greater than the overdraft limit, it is determined that the current transaction does not satisfy the overdraft condition corresponding to the control unit level.
5. A foreign currency position control device, characterized in that: The device is applied to a first server, and includes: The acquisition module is used to determine the transaction code of the current transaction according to the transaction request sent by the transaction initiator; A parsing module, for, when determining, based on the transaction code, that the current transaction is a transaction requiring foreign currency position control, intercepting the SQL statement executed in the current transaction through an interceptor, and parsing to obtain corresponding transaction information; the transaction information includes account information and bank information; the SQL statement is used to generate a data table corresponding to the current transaction; a determination module, configured to obtain foreign currency position information corresponding to each level of control unit from the second server, and determine the clearing fund information of each level of control unit at the end of the current transaction according to the outgoing account information, the bank information and the foreign currency position information corresponding to each level of control unit; The determination module is further used to determine whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of the control unit, and send the transaction result to the transaction initiator; When the parsing module parses and obtains the corresponding transaction information, it is specifically used to: Extracting the data table name in the intercepted SQL statement; the intercepted SQL statement is intercepted when the interceptor detects that there is an interception mark in the thread variable corresponding to the current transaction; the interception mark is written to the thread variable when the current transaction is determined to be a transaction requiring foreign currency position control; when it is determined according to the data table name that the data table generated by the SQL statement is a detailed data table, parsing the SQL statement executed in the current transaction to obtain corresponding transaction information; The determination module obtains the foreign currency position information corresponding to each level of control unit from the second server, and determines the clearing fund information of each level of control unit at the end of the current transaction according to the outgoing information, the bank information and the foreign currency position information corresponding to each level of control unit: Acquire the clearing path data and the set basic control unit level from the second server, determine each upper-level control unit level that needs to perform foreign currency position control according to the bank information, the clearing path data and the basic control unit level, and acquire the foreign currency position information corresponding to the current level and each upper-level control unit level from the second server; for each control unit level, subtract the foreign currency position information corresponding to the control unit level from the account information to obtain the clearing fund information corresponding to the control unit level at the end of the current transaction; When the determination module determines whether to continue to execute the SQL statement of the current transaction according to the clearing fund information of each level of the control unit, it is specifically used to: Determine whether the current transaction meets the overdraft conditions corresponding to the control unit levels at each level based on the clearing funds information of the control unit levels at each level; when there is a control unit level that does not meet the overdraft conditions, send transaction failure information to the transaction initiator through the online transaction program.
6. A server, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
System and method for processing foreign currency bank card data based on network
CN101271565A
Large amount charge-off control method and system, and cash management information system
CN106530074A