Disclosure of Invention
In view of the above, it is necessary to provide a variable processing method, a variable processing apparatus, a computer device, and a storage medium capable of improving the wind control efficiency.
A method of variable processing, the method comprising:
if a variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and is used for calculating target variable data;
compiling the computation logic template into a custom function in response to the compiling instruction, compiling the configuration parameters and the filtering conditions into a data acquisition expression based on a preset data source, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system;
if a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
In one embodiment, the preset data source further includes local storage data of the local service system and message data acquired from the unified database.
In one embodiment, obtaining variable data on which target variable data is calculated through a data obtaining expression includes:
analyzing the data acquisition expression to obtain a variable list which is depended by the target variable data and is to be calculated;
based on the variable list, variable data on which the target variable data depends is calculated.
In one embodiment, calculating the variable data on which the target variable data depends based on the variable list comprises:
determining a variable dependency relationship in a variable list;
and sequentially calculating the variables in the variable list based on the variable dependency relationship to obtain the variable data on which the target variable data depends.
In one embodiment, sequentially calculating the variables in the variable list based on the variable dependency relationship includes:
recording the variables in the variable list into two types, namely a first type variable and a second type variable respectively, wherein the calculation process of the second type variable depends on the calculation result of the first type variable;
and calculating the first kind of variable, and calculating the second kind of variable based on the calculation result of the first kind of variable.
In one embodiment, calculating the first type of variable includes:
dividing the first class of variables into three subclasses of variables; the three subclass variables are respectively a variable calculated based on local storage data of the local service system, a variable calculated based on variable data called by other service systems in real time and a variable calculated based on context data of the calculation request;
and based on the variable dependency relationship, sequentially calculating each variable under the three subclasses in parallel.
In one embodiment, calculating variable data on which the target variable data depends based on the variable list includes:
if the variable meeting the preset condition exists in the variable list, when the preset time point corresponding to the preset condition is reached, the variable meeting the preset condition is calculated, and the variable data on which the target variable data depends is obtained, wherein the preset condition is used for indicating the variable required to be calculated when the preset time point is reached.
A variable processing apparatus, the apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for displaying a variable configuration interface when detecting a variable configuration request in a local service system, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and is used for calculating target variable data;
the compiling module is used for responding to the compiling instruction, compiling the calculation logic template into a self-defined function, compiling the configuration parameters and the filtering conditions into a data acquisition expression based on a preset data source, wherein the preset data source at least comprises variable data called from other service systems except the local service system in real time;
and the second acquisition module is used for acquiring the variable data depended on when the target variable data is calculated through the data acquisition expression when the calculation request for the target variable data is detected, and calculating the acquired variable data based on the custom function to obtain the target variable data.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
if a variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and is used for calculating target variable data;
compiling the computation logic template into a custom function in response to the compiling instruction, compiling the configuration parameters and the filtering conditions into a data acquisition expression based on a preset data source, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system;
if a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
if a variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and is used for calculating target variable data;
compiling the computation logic template into a custom function in response to the compiling instruction, compiling the configuration parameters and the filtering conditions into a data acquisition expression based on a preset data source, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system;
if a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
According to the variable processing method, the variable processing device, the computer equipment and the storage medium, the preset data source is not limited to only using the unified database by all the service systems, but the respective variable data can be called among different service systems in real time, so that the phenomenon that the burden is increased due to the fact that the data are all obtained from the unified database can be avoided, and the efficiency of obtaining the variable data can be improved. Therefore, the wind control efficiency can be improved. In addition, variable data of other service systems can be called in real time, and can be calculated before other service systems, or can be calculated and provided by other service systems in real time without self calculation of the local service system, so that the efficiency of acquiring the variable data by the local service system can be improved, and the wind control efficiency can be improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various terms, but these terms are not limited by these terms unless otherwise specified. These terms are only used to distinguish one term from another. For example, the third preset threshold and the fourth preset threshold may be the same or different without departing from the scope of the present application.
With the rapid development of internet finance, the financial service mode is diversified. In the field of wind control, a label or a value is generally processed according to user information, user behavior, environmental information, equipment information, external credit worthiness and the like, so that risk management and control are performed. The above mentioned data are variable data, which are used as the basis for wind control, and the wind control strategy is a specific product generated based on the variable data. With cluster splitting and micro-service transformation of the system, a lot of data is dispersed in each service system along with domain splitting, which can hinder the processing process of variable data.
In the related art, data of each service system is generally synchronized to a unified database, and variable processing is performed based on the unified database. All data need to be read from the unified database, and when variable data are more, data reading burden is increased, so that reading is slowed, calculation efficiency is reduced, and the whole wind control efficiency is affected.
In view of the above problems, the embodiments of the present application provide a variable processing method, which can be applied in the application environment shown in fig. 1. The terminal 102 displays a variable configuration interface locally, provides an input device, and is connected to the local service system, the server 104 corresponds to other service systems except the local service system, and the terminal 102 communicates with the server 104 through a network. Taking an example that the terminal 102 and the server 104 cooperate to execute the variable processing method provided in the embodiment of the present application, if the terminal 102 detects a variable configuration request locally, a variable configuration interface is displayed for a user to configure a target variable. After the target variable is configured, if the target variable configured by the user needs to be used, variable data can be called from other business systems in real time based on the configuration information to calculate the target variable configured by the user, so as to obtain the target variable data.
The servers may be independent physical servers, server clusters or distributed systems formed by a plurality of physical servers, or cloud servers providing cloud computing services, and the servers may have respective data storage systems to store data. The terminal may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, a smart television, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
In some embodiments, referring to fig. 2, a variable processing method is provided. Taking the application of the method to the terminal 102 in fig. 1 as an example, the method includes the following steps:
202. if the variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and the configuration information is used for calculating target variable data.
In the above steps, the local service system may refer to a local server connected to the terminal 102 instead of the local server, or refer to the terminal 102 directly, which is not limited in this embodiment of the present application. In fact, in the field of wind control, it is also possible to use the basic service data of the local service system, which is usually located on a local server, when calculating the variable data. The variable configuration request may be initiated by a user (e.g., a service person), the variable configuration interface is a visual interface, and may include a text box and a selection box for the user to input information, and the text box and the selection box may be displayed by the terminal 102, a specific example may refer to fig. 3, and the embodiment of the present application does not specifically limit the arrangement and the included content of the variable configuration interface.
The calculation logic template can be used for specifying which calculation is to be performed, the configuration parameter is a constant parameter specifically used in the calculation, and the filtering condition is used as a screening basis for subsequently obtaining variable data on which the target variable data depends. In FIG. 3, the user may select the type of computation logic template, such as a summation computation, via a drop-down option. The user may also configure parameters such as time slice 30 days in fig. 3, etc. It should be noted that the filtering condition may include, in addition to the lookup table item (for example, in fig. 3, the amount successfully paid by the order as a result of the query operation is the lookup table item), a data type of the lookup table item, for example, a character string type in fig. 3. After the user inputs the configuration information, the terminal 102 may obtain the configuration information.
204. And in response to the compiling instruction, compiling the configuration parameters and the filtering conditions into data acquisition expressions and compiling the calculation logic templates into custom functions based on a preset data source, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system.
The compiling instruction may be triggered by a user, for example, after the user completes configuration on the variable configuration interface, the compiling instruction may be triggered by a compiling instruction triggering element in the variable configuration interface. The terminal 102 may respond to the compiling instruction after detecting it. The default data source may be provided by other business systems, it being understood that business systems other than the local business system are also provided with variable data. When the local service system performs variable calculation, it may need to rely on already calculated variable data of other service systems, or calculate corresponding variable data in real time by other service systems according to already configured variables, so as to be used by the local service system.
The data acquisition expression may be an SQL (Structured Query Language) expression. The custom function may refer to processing logic for further calculating data acquired by the data acquisition expression, such as statistical logic of the latest consecutive times or calculation logic for acquiring a distance based on longitude and latitude, which is not specifically limited in this embodiment of the present application. The custom function may be included in the data obtaining expression, and this is not specifically limited in this embodiment of the present application.
206. If a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
Wherein the calculation request may be triggered by the user through the terminal 102. If the target variable is needed in the service processing process of the local service system, the calculation request can also be triggered. In addition, if other business systems need to use the target variable, the calculation request may also be triggered, which is not specifically limited in the embodiment of the present application. It will be appreciated that in either case, the computation request may be passed on as triggered by the respective interface. The variable data depended on when the target variable data are calculated can be used as a data base of a calculation process, and the user-defined function is used as processing logic, so that the target variable data can be calculated.
According to the method provided by the embodiment of the application, the preset data source is not limited to only using the unified database by all the service systems, but the variable data of each service system can be called in real time, so that the phenomenon that the data are obtained from the unified database to cause burden increase can be avoided, and the efficiency of obtaining the variable data can be improved. Therefore, the wind control efficiency can be improved. In addition, variable data of other service systems can be called in real time, and can be calculated before other service systems, or can be calculated and provided by other service systems in real time without self calculation of the local service system, so that the efficiency of acquiring the variable data by the local service system can be improved, and the wind control efficiency can be improved.
In some embodiments, referring to fig. 4, a variable processing method is provided. Taking the application of the method to the terminal 102 in fig. 1 as an example, the method includes the following steps:
402. if the variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and the configuration information is used for calculating target variable data.
The process can refer to the description of the above embodiments, and is not described herein again.
404. And compiling the calculation logic template into a custom function in response to the compiling instruction, replacing reserved parameters in the data acquisition template with configuration parameters based on a preset data source, combining the preset data source, the filtering condition and the replaced data acquisition template to obtain a data acquisition expression, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system.
It is understood that there are some reserved parameters in the data acquisition template, for example, the "xxx" in the "select xxx from service" in the SQL template is the reserved parameter, and in actual implementation, the configuration parameter may replace the reserved parameter. The preset data source, namely the corresponding "service" in the SQL template, may refer to variable data called in real time from other service systems.
406. If a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
The process can refer to the description of the above embodiments, and is not described herein again.
According to the method provided by the embodiment of the application, as the business logic is subjected to new abstraction and templating in the variable processing process, a user only needs to configure parameters, calculate logic templates and filter conditions respectively based on own requirements, and can subsequently and automatically combine variables to realize variable processing without researching and developing corresponding products again through a series of processes such as coding, verifying and releasing products based on the requirements by research and development personnel, so that the variable processing efficiency can be improved.
In some embodiments, the default data source further includes locally stored data of the local service system and message data obtained from the unified database. The local storage data of the local service system is historical data stored in the previous variable processing process, and the message data acquired from the unified database is variable data of the local service system based on demand self-checking.
According to the method provided by the embodiment of the application, the data sources can be various, so that the increase of burden caused by the fact that data are all obtained from a unified database can be avoided, and the efficiency of obtaining variable data can be improved. Therefore, the wind control efficiency can be improved. In addition, variable data can be obtained from the local storage data, so that the previous processing result can be recycled, and repeated processing is avoided, thereby improving the efficiency of obtaining the variable data by the local service system and further improving the wind control efficiency.
In some embodiments, the method for obtaining variable data depended on when calculating target variable data through a data obtaining expression is not specifically limited in the embodiments of the present application, and includes but is not limited to: analyzing the data acquisition expression to obtain a variable list which is depended by the target variable data and is to be calculated; based on the variable list, variable data on which the target variable data depends is calculated.
Since the data obtaining expression may represent variable data that needs to be requested, for example, xxx in "select xxx from service" is the requested variable data, the variable data that is requested when the target variable data is calculated may be determined by the data obtaining expression. Thus, a list of variables can be composed from these requested variable data. It should be noted that the variable list may be formed by variable names of the requested variable data, and the "list" in the variable list may be a variable name set. After determining the variable lists, the variable data in the variable lists may be calculated first, and then the target variable data may be calculated.
According to the method provided by the embodiment of the application, the parameters selected during parameter configuration can be automatically analyzed according to the data acquisition expression, so that the efficiency of acquiring variable data can be improved.
In some embodiments, the method for calculating the variable data on which the target variable data depends based on the variable list is not specifically limited in the embodiments of the present application, and includes but is not limited to: determining a variable dependency relationship in a variable list; and sequentially calculating the variables in the variable list based on the variable dependency relationship to obtain the variable data on which the target variable data depends.
It can be understood that some variables need to be processed after some previous variables are processed, that is, the variables are processed depending on the variable data obtained by the previous variables. Therefore, when calculating the variable data on which the target variable data depends, the dependency relationship of the variable data is determined first, and the variable data on which the target variable data depends can be calculated sequentially.
According to the method provided by the embodiment of the application, the variable data can be calculated in sequence based on the dependency relationship, so that the data source of each variable data is clear, and links with calculation errors can be conveniently indexed when the calculation errors occur subsequently. In addition, due to the dependency relationship, the previously calculated variable data can be multiplexed, and the processing efficiency of the variable data is improved.
In some embodiments, the method for sequentially calculating variables in the variable list based on the variable dependency relationship is not specifically limited in the embodiments of the present application, and includes but is not limited to: recording the variables in the variable list into two types, namely a first type variable and a second type variable respectively, wherein the calculation process of the second type variable depends on the calculation result of the first type variable; and calculating the first kind of variable, and calculating the second kind of variable based on the calculation result of the first kind of variable.
The first type of variables refer to directly-obtainable or directly-obtainable variable data, and directly-calculable variables, and the second type of variables refer to variables that can be calculated after some variables in the first type of variables are calculated. In addition, the calculation processes of the first type variable and the second type variable may correspond to different processing logics according to requirements, such as the above-mentioned statistical logic of the latest continuous times or the calculation logic of obtaining the distance based on the longitude and latitude, and the like, which is not specifically limited in this application.
According to the method provided by the embodiment of the application, the variable data can be calculated in sequence based on the dependency relationship, so that the data source of each variable data is clear, and links with calculation errors can be conveniently indexed when the calculation errors occur subsequently. In addition, due to the dependency relationship, the previously calculated variable data can be multiplexed, and the processing efficiency of the variable data is improved.
In some embodiments, the method for calculating the first type variable is not specifically limited in the embodiments of the present application, and includes but is not limited to: dividing the first class of variables into three subclasses of variables; the three subclass variables are respectively a variable calculated based on local storage data of the local service system, a variable calculated based on variable data called by other service systems in real time and a variable calculated based on context data of the calculation request; and based on the variable dependency relationship, sequentially calculating each variable under the three subclasses in parallel.
The variable calculated based on the local storage data of the local service system is a variable calculated based on historical data saved in a previous variable processing process of the local service system. It will be appreciated that since the locally stored historical data is directly available, naturally these variables can be calculated without relying on other variable data. The variable calculated based on the variable data called by other service systems in real time is a variable calculated based on historical data saved in the previous variable processing process of other service systems or variable data obtained by processing the real-time variable of other service systems. It will be appreciated that historical data stored by other business systems may be obtained directly. And even if other business systems need real-time variable processing, the other business systems can synchronously execute the processing after receiving the request, so that the acquisition efficiency of the subclass variable of the type can not be influenced.
Since the variable processing procedure is not an independent procedure, generally, a plurality of variable processing procedures are involved in a certain business processing procedure, so that for a certain variable, it may only correspond to a certain variable processing procedure in the business processing procedure. Thus, a business process may require processing multiple variables, and more than one calculation may be required for processing the variables. For a certain calculation request and the variable requested to be processed by the calculation request, the context data of the calculation request is the context variable processing procedure corresponding to the processing procedure of the variable in the business processing procedure. It will be appreciated that there will also typically be some variable data available to the context variable process for calculating the variable, and that this variable data will also typically be available directly from the context variable process.
According to the method provided by the embodiment of the application, the variable data can be calculated in sequence based on the dependency relationship, so that the data source of each variable data is clear, and links with calculation errors can be conveniently indexed when the calculation errors occur subsequently. In addition, due to the dependency relationship, the previously calculated variable data can be multiplexed, and the processing efficiency of the variable data is improved. Moreover, the variable data can be classified finely, so that the variable data which can be directly obtained is determined, repeated processing is avoided, and the processing efficiency of the variable data can be improved.
In some embodiments, the method for calculating the variable data on which the target variable data depends based on the variable list is not specifically limited in this embodiment of the application, and includes, but is not limited to: if the variable meeting the preset condition exists in the variable list, when the preset time point corresponding to the preset condition is reached, the variable meeting the preset condition is calculated, and the variable data on which the target variable data depends is obtained, wherein the preset condition is used for indicating the variable required to be calculated when the preset time point is reached.
It will be appreciated that some variables may be calculated in advance under certain circumstances of triggering. For example, if it is determined that a certain user will review all expenses of the user in the last month, all expenses of the user in the last month can be prepared in advance when the completion of the user login is detected. Therefore, in the embodiment of the present application, the preset time point may be preset. Usually, in the business operation process of the user, before a certain variable data is needed, there may be some trigger operations, and these trigger operations correspond to the preset time point. For example, the detection of the user login completion in the above example may be a preset time point. When the preset time point is triggered, which variables need to be calculated can be determined in advance. For example, the determination may be based on the operation habit of the user, or based on the logic of the business operation flow (e.g., certain variable data is inevitably used in the subsequent process of certain business operation flows).
Based on the above description, if the variables to be calculated when the preset time point is reached exist in the variable list, the variables can be calculated in advance when the preset time point is reached, so as to prepare for the subsequent variable processing process in advance. It should be noted that, since the same variables are also variables, the variables triggered and calculated by the preset time point may refer to the method flows mentioned in the above embodiments, and are not described herein again.
According to the method provided by the embodiment of the application, the preset time point can be preset, and in the variable processing process, when the preset time point is triggered, variable data required for the follow-up variable processing process are prepared in advance, so that the processing efficiency of the variable data can be improved.
Based on the description of the above embodiments, for convenience of understanding, the variable processing process is now exemplified by taking the variable logic defined in the actual interface as an example, specifically:
(1) firstly, abstracting a common variable data calculation method into a calculation logic template, wherein a part of adjustable parameters are reserved in the template for configuration of a user. For example, the statistical user historical transaction total amount can be abstracted into a historical statistical template, and fields including statistical number of days, statistical amount, and filter conditions (e.g., success or failure, channel or merchant, etc.) can be reserved.
(2) Parameters are configured by the user at the interface, such as the selection of the amount of successful transactions for 30 days, etc., and the selection of the filter conditions to define the variables.
(3) If the configuration information of the user is checked and passed manually, the user can select to compile, so that the configuration information is compiled into an SQL expression (which can contain a custom function), and the SQL expression is published and run.
(4) When the interface calls the needed variable, the business system analyzes the SQL expression and automatically prepares the dependent data according to the definition of the SQL expression.
(5) And executing the SQL expression according to the prepared data depended on, and outputting a calculation result.
The above process is a main process of variable processing, and in an actual implementation process, a process of compiling configuration information into an SQL expression specifically includes the following steps:
(1) a fixed template SQL (structured query language), namely a data acquisition expression, is predefined, and interface parameters are replaced by parameters in the SQL during compiling.
(2) The compiled SQL expressions may be different for different data sources. For example, compiled SQL computed based on request message is select xxx from current, computed based on historical data is select xxx from history, computed based on service query other system data is select xxx from service.
(3) The SQL expression supports standard SQL syntax, and can be packaged into a self-defined function for realizing some complex logics, so that the logics which cannot be supported by the SQL before can be realized. For example, the lastRepeat function may implement statistical logic for the most recent consecutive times, the distance function may implement logic for calculating distance based on latitude and longitude, and so on.
In addition, the data preparation and execution calculation of the variables are realized as shown in fig. 5, and the specific processes are as follows:
(1) converting the request into a standard, computationally-convenient context object;
(2) and resolving a variable list required to be calculated by the request, wherein the variable list comprises the variable specified by interface transfer and the variable which should be calculated at the current time point configured in advance. When obtaining the variables, the variables can be obtained according to the variable classification, for example, all the variables in a certain classification are obtained; alternatively, the variable set may be obtained, for example, obtaining variables in specific variable sets; or, obtaining the variable according to a variable type, for example, obtaining a variable of a specific variable type; it should be noted that, the variables that should be calculated at the current time point configured in advance also correspond to the preset time points in the above embodiments, and the process may be asynchronous processing;
(3) and automatically analyzing the variables on which the variables need to be calculated in the last step depend according to the variable templates and the parameters selected during the definition of the variables.
(4) Variables are classified into 4 categories according to their data sources and their dependencies. The first type is a variable calculated based on historical data, the second type is a variable needing to acquire external system data based on service calling, the third type is a variable based on request context data and independent of the former two types of variables, and the fourth type is a variable dependent on the former 3 types of variables. Wherein, the dependency relationship is reflected in the precedence order of the calculation processing, and the depended variable is processed first. Based on the dependency relationship, the data source is clear, and the multiplexing of the data can be realized.
(5) And starting a plurality of threads in parallel to calculate the previous 3 types of variables. In the calculation, the first step is to prepare data, such as querying historical data, or to invoke an external service. The second step orders the variables according to the dependencies. The third step performs variable calculations using the prepared data in order.
(6) And after the previous 3 types of variables are all calculated, starting to execute the calculation of the 4 th type of variables.
It should be understood that although the steps in the flowcharts of fig. 1, 2 and 3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1, 2, and 3 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least some of the other steps.
It should be noted that the technical solutions described above may be implemented as independent embodiments in actual implementation processes, or may be combined with each other and implemented as combined embodiments. In addition, when the contents of the embodiments of the present invention are described above, the different embodiments are described according to the corresponding sequence only based on the idea of convenient description, for example, the sequence of the data flow is adopted, and the execution sequence between the different embodiments is not limited. Accordingly, in the actual implementation process, if it is necessary to implement multiple embodiments provided by the present invention, the execution sequence provided in the embodiments of the present invention is not necessarily required, but the execution sequence between different embodiments may be arranged according to requirements.
In connection with the above-described embodiments, in one embodiment, as shown in fig. 6, there is provided a variable processing apparatus including: a first obtaining module 602, a compiling module 604 and a second obtaining module 606, wherein:
a first obtaining module 602, configured to display a variable configuration interface when detecting a variable configuration request in a local service system, and obtain configuration information input by a user in the variable configuration interface, where the configuration information includes configuration parameters, a computation logic template, and a filtering condition, and the configuration information is used to compute target variable data;
a compiling module 604, configured to, in response to the compiling instruction, compile the computation logic template into a custom function, and compile the configuration parameters and the filtering conditions into a data obtaining expression based on a preset data source, where the preset data source at least includes variable data called in real time from other service systems except the local service system;
the second obtaining module 606 is configured to, when a calculation request for target variable data is detected, obtain, through the data obtaining expression, variable data on which the target variable data depends when the target variable data is calculated, and calculate the obtained variable data based on the custom function to obtain the target variable data.
In one embodiment, the default data source further includes locally stored data of the local service system and message data obtained from the unified database.
In one embodiment, the second obtaining module 606 includes:
the analysis unit is used for analyzing the data acquisition expression to obtain a variable list which is depended by the target variable data and is to be calculated;
a calculation unit for calculating, based on the variable list, variable data on which the target variable data depends.
The determining subunit is used for determining the variable dependency relationship in the variable list;
a calculating subunit, configured to sequentially calculate variables in the variable list based on the variable dependency relationship, so as to obtain variable data on which the target variable data depends
In one embodiment, the calculating subunit is configured to mark the variables in the variable list as two types, which are respectively a first type variable and a second type variable, and a calculating process of the second type variable depends on a calculating result of the first type variable; and calculating the first kind of variable, and calculating the second kind of variable based on the calculation result of the first kind of variable.
In one embodiment, the computing subunit is configured to divide the first class of variables into three subclasses of variables; the three subclass variables are respectively a variable calculated based on local storage data of the local service system, a variable calculated based on variable data called by other service systems in real time and a variable calculated based on context data of the calculation request; and based on the variable dependency relationship, sequentially calculating each variable under the three subclasses in parallel.
In an embodiment, the calculating unit is configured to, when there is a variable that meets a preset condition in the variable list, calculate the variable that meets the preset condition when a preset time point corresponding to the preset condition is reached, to obtain variable data on which the target variable data depends, where the preset condition is used to indicate a variable that needs to be calculated when the preset time point is reached.
According to the device provided by the embodiment of the invention, the preset data source is not limited to only using the unified database by all the service systems, but the variable data of each service system can be called in real time, so that the phenomenon that the burden is increased due to the fact that the data are all acquired from the unified database can be avoided, and the efficiency of acquiring the variable data can be improved. Therefore, the wind control efficiency can be improved. In addition, variable data of other service systems can be called in real time, and can be calculated before other service systems, or can be calculated and provided by other service systems in real time without self calculation of the local service system, so that the efficiency of acquiring the variable data by the local service system can be improved, and the wind control efficiency can be improved.
For the specific limitations of the variable processing device, reference may be made to the limitations of the variable processing method above, and details are not repeated here. The modules in the variable processing device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing the preset threshold value. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a variable processing method.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
if a variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and is used for calculating target variable data;
compiling the computation logic template into a custom function in response to the compiling instruction, compiling the configuration parameters and the filtering conditions into a data acquisition expression based on a preset data source, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system;
if a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
In one embodiment, when the processor executes the computer program, the predetermined data source further includes locally stored data of the local service system and message data obtained from the unified database.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
analyzing the data acquisition expression to obtain a variable list which is depended by the target variable data and is to be calculated;
based on the variable list, variable data on which the target variable data depends is calculated.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining a variable dependency relationship in a variable list;
and sequentially calculating the variables in the variable list based on the variable dependency relationship to obtain the variable data on which the target variable data depends.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
recording the variables in the variable list into two types, namely a first type variable and a second type variable respectively, wherein the calculation process of the second type variable depends on the calculation result of the first type variable;
and calculating the first kind of variable, and calculating the second kind of variable based on the calculation result of the first kind of variable.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
dividing the first class of variables into three subclasses of variables; the three subclass variables are respectively a variable calculated based on local storage data of the local service system, a variable calculated based on variable data called by other service systems in real time and a variable calculated based on context data of the calculation request;
and based on the variable dependency relationship, sequentially calculating each variable under the three subclasses in parallel.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the variable meeting the preset condition exists in the variable list, when the preset time point corresponding to the preset condition is reached, the variable meeting the preset condition is calculated, and the variable data on which the target variable data depends is obtained, wherein the preset condition is used for indicating the variable required to be calculated when the preset time point is reached.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
if a variable configuration request is detected in the local service system, displaying a variable configuration interface, and acquiring configuration information input by a user in the variable configuration interface, wherein the configuration information comprises configuration parameters, a calculation logic template and a filtering condition, and is used for calculating target variable data;
compiling the computation logic template into a custom function in response to the compiling instruction, compiling the configuration parameters and the filtering conditions into a data acquisition expression based on a preset data source, wherein the preset data source at least comprises variable data called in real time from other service systems except the local service system;
if a calculation request for the target variable data is detected, variable data depended on when the target variable data is calculated is obtained through a data obtaining expression, and the obtained variable data is calculated based on a custom function to obtain the target variable data.
In one embodiment, the predetermined data source further comprises locally stored data of the local business system and message data obtained from the unified database when the computer program is executed by the processor.
In one embodiment, the computer program when executed by the processor further performs the steps of:
analyzing the data acquisition expression to obtain a variable list which is depended by the target variable data and is to be calculated;
based on the variable list, variable data on which the target variable data depends is calculated.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining a variable dependency relationship in a variable list;
and sequentially calculating the variables in the variable list based on the variable dependency relationship to obtain the variable data on which the target variable data depends.
In one embodiment, the computer program when executed by the processor further performs the steps of:
recording the variables in the variable list into two types, namely a first type variable and a second type variable respectively, wherein the calculation process of the second type variable depends on the calculation result of the first type variable;
and calculating the first kind of variable, and calculating the second kind of variable based on the calculation result of the first kind of variable.
In one embodiment, the computer program when executed by the processor further performs the steps of:
dividing the first class of variables into three subclasses of variables; the three subclass variables are respectively a variable calculated based on local storage data of the local service system, a variable calculated based on variable data called by other service systems in real time and a variable calculated based on context data of the calculation request;
and based on the variable dependency relationship, sequentially calculating each variable under the three subclasses in parallel.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the variable meeting the preset condition exists in the variable list, when the preset time point corresponding to the preset condition is reached, the variable meeting the preset condition is calculated, and the variable data on which the target variable data depends is obtained, wherein the preset condition is used for indicating the variable required to be calculated when the preset time point is reached.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.