CN116012146A - Event-based forehead center data asynchronous calculation method and system - Google Patents

Event-based forehead center data asynchronous calculation method and system Download PDF

Info

Publication number
CN116012146A
CN116012146A CN202310071893.8A CN202310071893A CN116012146A CN 116012146 A CN116012146 A CN 116012146A CN 202310071893 A CN202310071893 A CN 202310071893A CN 116012146 A CN116012146 A CN 116012146A
Authority
CN
China
Prior art keywords
data
event
credit
updating
quota
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310071893.8A
Other languages
Chinese (zh)
Inventor
史红哲
郎森淼
叶建梁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vision Credit Financial Technology Co ltd
Original Assignee
Vision Credit Financial Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vision Credit Financial Technology Co ltd filed Critical Vision Credit Financial Technology Co ltd
Priority to CN202310071893.8A priority Critical patent/CN116012146A/en
Publication of CN116012146A publication Critical patent/CN116012146A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention discloses an event-based line center data asynchronous calculation method and system, wherein the method comprises the following steps of S1, obtaining user line change and generating line change events; s2, updating the limit change event into a data table under the same transaction; s3, the step of calling an interface to asynchronously send the user id information to a message queue of a message consumer; s4, the step of calculating all product limit information under the current user name again is used for calling the background interface of the consumer message. According to the event-based limit center data asynchronous calculation method and system disclosed by the invention, on one hand, the problems of reduced performance of the database caused by slower interface response, overlong lock occupation time in the database and the like when the flow is relatively large are prevented by simplifying the number of the tables, and on the other hand, the concurrency capacity of the corresponding interfaces and the TPS of the system are improved, so that the whole system can bear higher flow and concurrency.

Description

Event-based forehead center data asynchronous calculation method and system
Technical Field
The invention relates to the field of computers, in particular to an event-based method and an event-based system for asynchronously calculating data of a quota center.
Background
In an enterprise financial credit scene, interfaces related to real-time calculation of the credit amount, such as offer, pay-off, repayment, credit and the like, are related to a plurality of tables in data processing, and have the conditions of complex calculation, large transactions and the like, so that when the flow is relatively large, the problems of slow response of the interfaces, overlong lock occupation time in a database and the like, which cause the performance reduction of the database and the like, exist.
However, in the prior art, the simple lateral expansion of the interfaces causes excessive pressure in terms of enterprise funds and operation and maintenance, and how to improve concurrency capacity of the corresponding interfaces and TPS (Transaction processing systems, transaction processing system) of the system, so that the whole system can bear higher flow and concurrency, which becomes a problem to be solved urgently.
Disclosure of Invention
The invention aims to provide an event-based method and an event-based system for asynchronously calculating the data of a quota center.
The invention provides an event-based limit center data asynchronous calculation method, which comprises the following steps:
s1, acquiring user quota change and generating a quota change event;
s2, updating the limit change event into a data table under the same transaction;
s3, the step of calling an interface to asynchronously send the user id information to a message queue of a message consumer;
s4, the step of calculating all product limit information under the current user name again is used for calling the background interface of the consumer message.
Preferably, the step S2 is used for updating the credit change event into the data table under the same transaction, and includes:
s21 is used for judging the precondition of the line change event, if no corresponding index record exists in the data table, corresponding index data is newly added in the line change statistical information table and the processing identification table, and if the corresponding index record exists in the data table, the line change statistical information table and the processing identification table are updated.
Preferably, the step S4 is configured to invoke the consumer message backend interface to recalculate all product quota information under the current user name, and includes:
s41, a step for acquiring a user quota change event from a message queue;
s42, submitting the user credit change event to a credit thread pool for parameter analysis, and generating analysis data;
s43 is used for calling a quota processing logic interface to calculate the analysis data, and the formula is as follows:
Figure BDA0004064988040000021
Figure BDA0004064988040000022
a step of generating calculated data;
s44, updating the calculated data into the business record table and the limit change statistical information table, and updating the identification in the processing identification table.
Preferably, the event-based quota-center data asynchronous calculation method provided by the invention further comprises the following steps:
and a step of judging whether a credit change event exists, if not, performing synchronous calculation, updating the calculated credit information into the data table, and if so, directly inquiring the credit information and updating the credit information into the data table.
The event-based quota-centric data asynchronous computing system provided in this embodiment includes the following modules:
s1, a module for acquiring the user quota change and generating a quota change event;
s2, a module for updating the limit change event to a data table under the same transaction;
s3, a module for calling an interface to asynchronously send the user id information to a message queue of a message consumer;
s4, a module for calling a consumer message background interface to recalculate all product limit information under the current user name.
Preferably, the step S2 is configured to update the credit change event to a data table under the same transaction, and includes:
s21 is used for judging the precondition of the line change event, if no corresponding index record exists in the data table, corresponding index data is newly added in the line change statistical information table and the processing identification table, and if the corresponding index record exists in the data table, the sub-module is used for updating the line change statistical information table and the processing identification table.
Preferably, the S4 is a module for calling the consumer message background interface to recalculate all product quota information under the current user name, including:
s41 is used for obtaining a sub-module of the user quota change event from the message queue;
s42 is used for submitting the user quota change event to a quota thread pool for parameter analysis and generating a submodule for analyzing data;
s43 is used for calling a quota processing logic interface to calculate the analysis data, and the formula is as follows:
Figure BDA0004064988040000023
Figure BDA0004064988040000024
a sub-module that generates calculated data;
s44 is used for updating the calculated data into the business record table and the limit change statistical information table, and updating the sub-module for processing the identification in the identification table.
Preferably, the event-based quota-centric data asynchronous computing system provided by the present invention further comprises:
and the sub-module is used for judging whether a credit change event exists, if not, carrying out synchronous calculation, updating the calculated credit information into the data table, and if so, directly inquiring the credit information and updating the credit information into the data table.
According to the event-based quota center data asynchronous calculation method and system, on one hand, the number of tables is simplified, the problems that the number of the tables is large, complex calculation, large transactions and the like are involved in data processing, when the flow is relatively large, interface response is slow, the occupied time of a lock in a database is too long and the like, so that the performance of the database is reduced are solved, on the other hand, only the quota change event is asynchronously pushed to a message consumer to asynchronously calculate the back stage of the queue waiting message consumer, and therefore the concurrency capacity of the corresponding interface and the TPS of the system are improved, and the whole system can bear higher flow and concurrency.
Drawings
FIG. 1 is a flowchart of an event-based method for asynchronous computation of credit center data according to an embodiment of the invention;
fig. 2 is a calculation formula diagram of the maximum credit limit according to an embodiment of the invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
As shown in fig. 1-2, the event-based quota-center data asynchronous calculation method provided in this embodiment includes the following steps:
s1, acquiring user quota change and generating a quota change event;
s2, updating the limit change event into a data table under the same transaction;
s3, the step of calling an interface to asynchronously send the user id information to a message queue of a message consumer;
s4, the step of calculating all product limit information under the current user name again is used for calling the background interface of the consumer message.
Those skilled in the art will appreciate that the borrowing, repayment, freezing, offer, product line points, etc. for each id user are referred to as line change events. The method comprises the steps of simplifying the storage operations of complex business logic, credit calculation, new addition or update of a large number of tables and the like in an interface to only operate three tables of a most basic business record table, a credit change statistical information table and a processing identification table, reducing the operation of the large number of tables between the database and the database as much as possible, and reducing the duration of a data resource lock of the database.
It can be understood by those skilled in the art that modifying the quota calculation service logic, in order to decouple the association between the calculation logic and the interface and consider the factors that the event message data needs to be persistent, a rabitmq message middleware is introduced, after the original processing interface stores the core data, the corresponding client id information is sent to the message queue, the whole interface service is completed, and then successful response data is returned.
Further, the step S2 is configured to update the credit change event to a data table under the same transaction, including:
s21 is used for judging the precondition of the line change event, if no corresponding index record exists in the data table, corresponding index data is newly added in the line change statistical information table and the processing identification table, and if the corresponding index record exists in the data table, the line change statistical information table and the processing identification table are updated.
Those skilled in the art will appreciate that the service record table records the current event record, including clients, products, event types, event amounts, and other information such as the current service serial number (unique identifier) is used for interfacing idempotent, preventing repeated submission, and creating events, updating time, etc., and the later table can be used for checking functions, etc. The credit change statistical information table is used for recording all change total credit information of the current user. The processing identification table records the occurrence information of the limit event and the identification flag (indicating whether the event is processed or not), the flag bit is set to be processed after the background processing is finished, and the flag bit is updated to be processed when a new event comes in. In terms of indexing, three tables are added with a unique identification index of the customer plus product dimension. In terms of consistency of data, operations for three tables in code logic must be in the same database transaction. The operations of the credit change statistical information table and the processing identification table are newly recorded, the data is newly added when the corresponding index data is not contained in the table, and the corresponding data is updated when the corresponding unique index record is contained (including the processing identification is set as unprocessed, the credit change information and the like), so that the record of the core data only relates to three tables, the interface service logic is simplified, the number of the tables is reduced, and the tables related to the transaction are reduced to three.
Further, the step S4 is configured to invoke the consumer message backend interface to recalculate all product quota information under the current user name, and includes:
s41, a step for acquiring a user quota change event from a message queue;
s42, submitting the user credit change event to a credit thread pool for parameter analysis, and generating analysis data;
s43 is used for calling the quota processing logic interfaceThe port calculates the analytic data, and the formula is:
Figure BDA0004064988040000051
Figure BDA0004064988040000052
a step of generating calculated data;
s44, updating the calculated data into the business record table and the limit change statistical information table, and updating the identification in the processing identification table.
Those skilled in the art will appreciate that A, B, E, F, G, X represents a different product; a1 and B1 respectively represent successful marketing limits of the product: and the information consumer background consumes the user id transmitted from the front in real time, then recalculates all product limit information under the clients, configures a plurality of consumers, sets a small number of message delivery quantity, prevents message data from being backlogged on one consumer, and is convenient for fully utilizing the resources of the plurality of consumers. In order to fully utilize the performance of the multi-core CPU, a thread pool for specially calculating the quota task is introduced into a consumer, the quota calculation is submitted to the thread pool as a task, and the thread pool is responsible for executing business logic of the task.
Further, the event-based quota-center data asynchronous calculation method provided in this embodiment further includes:
and a step of judging whether a credit change event exists, if not, performing synchronous calculation, updating the calculated credit information into the data table, and if so, directly inquiring the credit information and updating the credit information into the data table.
As can be appreciated by those skilled in the art, for the aspect of inquiring the credit, whether event information exists is judged before inquiring the credit, if so, synchronous calculation is performed, and then the credit information is responded, so that the correctness of the credit information is ensured.
Example two
The event-based quota-centric data asynchronous computing system provided in this embodiment includes the following modules:
s1, a module for acquiring the user quota change and generating a quota change event;
s2, a module for updating the limit change event to a data table under the same transaction;
s3, a module for calling an interface to asynchronously send the user id information to a message queue of a message consumer;
s4, a module for calling a consumer message background interface to recalculate all product limit information under the current user name.
Those skilled in the art will appreciate that the borrowing, repayment, freezing, offer, product line points, etc. for each id user are referred to as line change events. The method comprises the steps of simplifying the storage operations of complex business logic, credit calculation, new addition or update of a large number of tables and the like in an interface to only operate three tables of a most basic business record table, a credit change statistical information table and a processing identification table, reducing the operation of the large number of tables between the database and the database as much as possible, and reducing the duration of a data resource lock of the database.
It can be understood by those skilled in the art that modifying the quota calculation service logic, in order to decouple the association between the calculation logic and the interface and consider the factors that the event message data needs to be persistent, a rabitmq message middleware is introduced, after the original processing interface stores the core data, the corresponding client id information is sent to the message queue, the whole interface service is completed, and then successful response data is returned.
Further, the step S2 is configured to update the credit change event to a data table under the same transaction, and includes:
s21 is used for judging the precondition of the line change event, if no corresponding index record exists in the data table, corresponding index data is newly added in the line change statistical information table and the processing identification table, and if the corresponding index record exists in the data table, the sub-module is used for updating the line change statistical information table and the processing identification table.
Those skilled in the art will appreciate that the service record table records the current event record, including clients, products, event types, event amounts, and other information such as the current service serial number (unique identifier) is used for interfacing idempotent, preventing repeated submission, and creating events, updating time, etc., and the later table can be used for checking functions, etc. The credit change statistical information table is used for recording all change total credit information of the current user. The processing identification table records the occurrence information of the limit event and the identification flag (indicating whether the event is processed or not), the flag bit is set to be processed after the background processing is finished, the flag bit is updated to be processed when a new event comes in, and in order to prevent the concurrent operation from covering data, the table adopts an optimistic lock processing system added with a version field, so that the performance is improved. In terms of indexing, three tables are added with a unique identification index of the customer plus product dimension. In terms of consistency of data, operations for three tables in code logic must be in the same database transaction. The operations of the credit change statistical information table and the processing identification table are newly recorded, the data is newly added when the corresponding index data is not contained in the table, and the corresponding data is updated when the corresponding unique index record is contained (including the processing identification is set as unprocessed, the credit change information and the like), so that the record of the core data only relates to three tables, the interface service logic is simplified, the number of the tables is reduced, and the tables related to the transaction are reduced to three.
Further, the S4 is a module for calling the consumer message background interface to recalculate all product quota information under the current user name, including:
s41 is used for obtaining a sub-module of the user quota change event from the message queue;
s42 is used for submitting the user quota change event to a quota thread pool for parameter analysis and generating a submodule for analyzing data;
s43 is used for calling a quota processing logic interface to calculate the analysis data, and the formula is as follows:
Figure BDA0004064988040000071
/>
Figure BDA0004064988040000072
a sub-module that generates calculated data;
s44 is used for updating the calculated data into the business record table and the limit change statistical information table, and updating the sub-module for processing the identification in the identification table.
Those skilled in the art will appreciate that A, B, E, F, G, X represents a different product; a1 and B1 respectively represent successful marketing limits of the product: and the information consumer background consumes the user id transmitted from the front in real time, then recalculates all product limit information under the clients, configures a plurality of consumers, sets a small number of message delivery quantity, prevents message data from being backlogged on one consumer, and is convenient for fully utilizing the resources of the plurality of consumers. In order to fully utilize the performance of the multi-core CPU, a thread pool for specially calculating the quota task is introduced into a consumer, the quota calculation is submitted to the thread pool as a task, and the thread pool is responsible for executing business logic of the task.
Further, the event-based quota-centric data asynchronous computing system provided in this embodiment further includes:
and the sub-module is used for judging whether a credit change event exists, if not, carrying out synchronous calculation, updating the calculated credit information into the data table, and if so, directly inquiring the credit information and updating the credit information into the data table.
As can be appreciated by those skilled in the art, for the aspect of inquiring the credit, whether event information exists is judged before inquiring the credit, if so, synchronous calculation is performed, and then the credit information is responded, so that the correctness of the credit information is ensured.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. An event-based forehead center data asynchronous calculation method is characterized by comprising the following steps:
s1, acquiring user quota change and generating a quota change event;
s2, updating the limit change event into a data table under the same transaction;
s3, the step of calling an interface to asynchronously send the user id information to a message queue of a message consumer;
s4, the step of calculating all product limit information under the current user name again is used for calling the background interface of the consumer message.
2. The event-based forehead centre data asynchronous calculation method according to claim 1, wherein S2 is used to update the forehead change event into the data table under the same transaction, including:
s21 is used for judging the precondition of the line change event, if no corresponding index record exists in the data table, corresponding index data is newly added in the line change statistical information table and the processing identification table, and if the corresponding index record exists in the data table, the line change statistical information table and the processing identification table are updated.
3. The event-based credit-centric data asynchronous calculation method according to claim 2, wherein S4 is for invoking a consumer message backend interface to recalculate all product credit information under the current user name, comprising:
s41, a step for acquiring a user quota change event from a message queue;
s42, submitting the user credit change event to a credit thread pool for parameter analysis, and generating analysis data;
s43 is used for calling a quota processing logic interface to calculate the analysis data, and the formula is as follows:
Figure FDA0004064988030000011
Figure FDA0004064988030000012
a step of generating calculated data;
s44, updating the calculated data into the business record table and the limit change statistical information table, and updating the identification in the processing identification table.
4. The event-based limit center data asynchronous calculation method as recited in claim 3 further comprising:
and a step of judging whether a credit change event exists, if not, performing synchronous calculation, updating the calculated credit information into the data table, and if so, directly inquiring the credit information and updating the credit information into the data table.
5. An event-based forehead centre data asynchronous computing system, comprising the following modules:
s1, a module for acquiring the user quota change and generating a quota change event;
s2, a module for updating the limit change event to a data table under the same transaction;
s3, a module for calling an interface to asynchronously send the user id information to a message queue of a message consumer;
s4, a module for calling a consumer message background interface to recalculate all product limit information under the current user name.
6. The event-based, line centric data asynchronous computing system of claim 5, wherein S2 is configured to update the line change event to a data table under the same transaction, comprising:
s21 is used for judging the precondition of the line change event, if no corresponding index record exists in the data table, corresponding index data is newly added in the line change statistical information table and the processing identification table, and if the corresponding index record exists in the data table, the sub-module is used for updating the line change statistical information table and the processing identification table.
7. The event based credit center data asynchronous computing system of claim 6, wherein S4 is a module for invoking a consumer message backend interface to recalculate all product credit information under the current user name, comprising:
s41 is used for obtaining a sub-module of the user quota change event from the message queue;
s42 is used for submitting the user quota change event to a quota thread pool for parameter analysis and generating a submodule for analyzing data;
s43 is used for calling a quota processing logic interface to calculate the analysis data, and the formula is as follows:
Figure FDA0004064988030000021
Figure FDA0004064988030000022
a sub-module that generates calculated data;
s44 is used for updating the calculated data into the business record table and the limit change statistical information table, and updating the sub-module for processing the identification in the identification table.
8. The event-based, limit center data asynchronous computing system of claim 7, further comprising:
and the sub-module is used for judging whether a credit change event exists, if not, carrying out synchronous calculation, updating the calculated credit information into the data table, and if so, directly inquiring the credit information and updating the credit information into the data table.
CN202310071893.8A 2023-02-07 2023-02-07 Event-based forehead center data asynchronous calculation method and system Pending CN116012146A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310071893.8A CN116012146A (en) 2023-02-07 2023-02-07 Event-based forehead center data asynchronous calculation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310071893.8A CN116012146A (en) 2023-02-07 2023-02-07 Event-based forehead center data asynchronous calculation method and system

Publications (1)

Publication Number Publication Date
CN116012146A true CN116012146A (en) 2023-04-25

Family

ID=86026779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310071893.8A Pending CN116012146A (en) 2023-02-07 2023-02-07 Event-based forehead center data asynchronous calculation method and system

Country Status (1)

Country Link
CN (1) CN116012146A (en)

Similar Documents

Publication Publication Date Title
US8825798B1 (en) Business event tracking system
CN107464151B (en) Order data processing method and device for high-concurrency service
CN111339073A (en) Real-time data processing method and device, electronic equipment and readable storage medium
CN111125106B (en) Batch running task execution method, device, server and storage medium
CN110389989B (en) Data processing method, device and equipment
CN111429241A (en) Accounting processing method and device
CN111610979A (en) API gateway subjected to persistence and coupling degree optimization and method thereof
CN110889754B (en) Method for improving processing efficiency of non-overdraft hot spot account
CN112363902A (en) Business process monitoring method and device, computer equipment and storage medium
CN110489418B (en) Data aggregation method and system
CN113256355B (en) Method, device, medium, equipment and system for determining integral rights and interests in real time
CN113034178A (en) Multi-system integral calculation method and device, terminal equipment and storage medium
CN112905677A (en) Data processing method and device, service processing system and computer equipment
CN116012146A (en) Event-based forehead center data asynchronous calculation method and system
US8229946B1 (en) Business rules application parallel processing system
CN114218303B (en) Transaction data processing system, processing method, medium and equipment
CN112181380B (en) Credit product multi-product parallel development system and credit granting, payment and repayment method thereof
CN114217790A (en) Interface scheduling method and device, electronic equipment and medium
CN113391933A (en) Method for processing fund
CN111444212A (en) Unified accounting method and device based on accounting system and accounting system
CN112418670A (en) Case allocation method, device, equipment and medium
CN116756460B (en) Combined data acquisition method and device and related equipment
CN113326401B (en) Method and system for generating field blood relationship
CN114969082A (en) Method, device, equipment and computer readable medium for processing service data
CN116450659A (en) Transaction information accounting method, device, equipment and medium based on distributed system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination