CN112907234B - Decision engine implementation method based on dynamic configuration rules - Google Patents

Decision engine implementation method based on dynamic configuration rules Download PDF

Info

Publication number
CN112907234B
CN112907234B CN202110499415.8A CN202110499415A CN112907234B CN 112907234 B CN112907234 B CN 112907234B CN 202110499415 A CN202110499415 A CN 202110499415A CN 112907234 B CN112907234 B CN 112907234B
Authority
CN
China
Prior art keywords
rule
parameter
execution
pool
result
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.)
Active
Application number
CN202110499415.8A
Other languages
Chinese (zh)
Other versions
CN112907234A (en
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.)
Wuhan Zhongbang Bank Co Ltd
Original Assignee
Wuhan Zhongbang Bank 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 Wuhan Zhongbang Bank Co Ltd filed Critical Wuhan Zhongbang Bank Co Ltd
Priority to CN202110499415.8A priority Critical patent/CN112907234B/en
Publication of CN112907234A publication Critical patent/CN112907234A/en
Application granted granted Critical
Publication of CN112907234B publication Critical patent/CN112907234B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/103Workflow collaboration or project management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/03Credit; Loans; Processing thereof

Abstract

The invention relates to the technical field of information technology, and provides a decision engine implementation method based on dynamic configuration rules. Acquiring a dependent parameter of an association rule according to an input parameter of an execution rule core logic, initializing the dependent parameter to a parameter pool, quoting an entity object from a configuration rule, acquiring entity object data dependent on the association rule, and initializing the entity object data to an entity object data pool; according to the rule number of the association rule, the values of the entity object data pool and the parameter pool are sent to a rule core execution logic Content of the configuration rule, the rule is executed, and a rule execution result is obtained; all the rule execution results form a decision set, if one rule execution result is false, the final decision result is false, otherwise, the final decision result is true.

Description

Decision engine implementation method based on dynamic configuration rules
Technical Field
The invention relates to the technical field of information technology, and provides a decision engine implementation method based on dynamic configuration rules.
Background
In the business process of financial loan, some logic check is needed at many stages. These verification conditions are often adjusted based on factors of policy, internal or external market segments. The traditional processing mode is to modify the source code and re-release the source code on line. The process needs to be subjected to requirement change application, development, testing, acceptance and online, and the whole process needs more manpower and long online period.
The decision engine based on the dynamic configuration rule comprises a decision set, a rule, parameter configuration and object data configuration, and the decision engine finally outputs a decision result, true or false. The rules can be dynamically adjusted and take effect immediately after adjustment. The configuration type of the rule supports calling JAVASCRAPT script, logic expression and JAVA program. And aiming at each key stage of the business process, establishing a corresponding decision set, calling the corresponding decision set at the corresponding stage, and automatically executing the association rule under the decision set by the decision set. If the calibration conditions need to be adjusted in the process of developing the service, the rules under the corresponding decision sets only need to be adjusted. Simple judgment condition adjustment can be completed and put into application in a few minutes without development and online, so that the labor input is reduced, and the period of putting into application can be shortened.
Disclosure of Invention
The invention aims at solving the problem that when the check rule needs to be adjusted in the service flow, the code version does not need to be modified, and the scheme can be immediately effective by modifying the configuration of the decision rule.
In order to solve the technical problems, the invention adopts the following technical scheme:
a decision engine based on dynamically configured rules, comprising the steps of:
step 1: acquiring input parameters, a decision set number Group _ id and a parameter set dataMap transmitted in the calling of a business process;
step 2: traversing all the association rules ruleObjects below the decision set number Group _ id according to the decision set number Group _ id;
and step 3: acquiring a dependent parameter of an association Rule from a configuration Rule reference parameter according to an input parameter Rule _ Param _ In of an execution Rule core logic configured by the association Rule rulObject, and initializing to a parameter pool rulParmpool;
and 4, step 4: according to the value of an input parameter Rule _ Param _ In configured by an association Rule ruleObject, obtaining entity object data on which the association Rule depends from a configuration Rule reference entity object, and initializing to an entity object data pool ruleDatePool;
and 5: according to the rule number of the association rule rulObject, the values of an entity object data pool rulDatePool and a parameter pool rulParamPool are sent to a rule core execution logic Content of the configuration rule, the rule execution is carried out, and a rule execution result is obtained;
6: all the rule execution results form a decision set, if one rule execution result is false, the final decision result is false, otherwise, the final decision result is true;
the decision engine output, which is well known to those skilled in the art, is two values false, true that are used for decision making.
In the above technical solution, step 3 includes the following steps:
the initialization parameter pool rulepampool in step 3 is defined as follows:
step 3.1: inputting a parameter Rule _ Param _ In according to an association Rule rulObject, sequentially traversing the dependent parameters of all association rules, ending an analytic Rule by { $ { "start" } and intercepting a parameter number Param _ id;
step 3.2: and sequentially taking out values corresponding to the configuration of all the dependent parameters according to all the Param _ ids, and putting the values into a parameter pool rulepampool.
In the above technical solution, step 4 includes the following steps:
step 4.1: according to a Rule _ Param _ In input parameter of the Rule object, sequentially traversing all dependent entity object Data of the association Rule, ending the analysis Rule by "# {" begin "}", and intercepting a Data _ id of the object Data number;
step 4.2: finding out corresponding entity Table name Table _ name, entity Table field name Column _ name and query condition Where from the configured entity objects according to Data _ id, combining and de-duplicating the entity Table name Table _ name and the query condition Where to obtain all dependent entity objects, and finally splicing and assembling the Table _ name, the Where and the Column _ name of all dependent entity objects into a database query SQL;
step 4.3: and executing a result set obtained by database query SQL, and sequentially putting the result set into an object Data pool ruleDataPool by taking Data _ id as key and the result set Column _ name as value.
In the above technical solution, step 5 includes the following steps:
step 5.1: execution precondition execution _ Condition for executing association rule ruleObject;
step 5.2: judging whether the Execute _ Condition is null or not, if so, considering that no precondition exists, and directly returning to true; if not, calling a rule engine interpreter ruleExpiain to calculate and Execute an expression result of the precondition execution _ Condition, and returning a corresponding result to be true or false;
step 5.3: if the execution _ Condition result is true, executing step 5.4, otherwise, not executing the rule core execution logic Content to skip the rule object and continue executing the next rule object;
step 5.4: calling a rule engine interpreter rulExplain execution rule core execution logic Content, and if the execution result of the execution rule is true, continuing to execute the next association rule; if the Result is false, judging the processing type Result _ type, if the Result _ type value is '1-mandatory', stopping all subsequent rule execution, otherwise, directly returning the final decision Result to be false.
In the above technical solution, the rule engine interpreter ruleExplain is defined as follows:
step 5.2.1: transmitting the configuration depended by the association Rule ruleObject, a parameter pool ruleParampool, an object data pool ruleDataPool, a parsing Rule Type, a Rule logic Content, an input parameter Rule _ Param _ In and an output parameter Rule _ Param _ Out into a Rule engine interpreter ruleExpiain;
step 5.2.2: : acquiring a corresponding execution engine exeExplain according to the Type;
step 5.2.2.1: if the Type is CLASS, calling a CLASS-JAVA CLASS execution engine exeExpiainlClass;
step 5.2.2.1.1: the Content is divided into two parts, the front part is the name of a ServiceClass execution class, and the rear part is the name of a ServiceMethod method;
step 5.2.2.1.2: acquiring a class instance of the ServiceClass by using SpringContextHolder.
Step 5.2.2.1.3: calling a ServiceMethod method of a ServiceClass by using a JAVA reflection tool class reflocation, and taking an object data pool rulDataPool and a parameter pool rulParampPool as input parameters of the ServiceMethod so that processing logic in the method can call a dependent parameter or an object;
step 5.2.2.1.4: executing the output rule after the ServiceMethod method is executed as true or false;
step 5.2.2.2: if the Type is JS, calling a JS-JAVASCRIPT script execution engine exeExplainJs;
step 5.2.2.2.1: initializing JAVASCRIPT script engine instance script Engine;
step 5.2.2.2.2: dividing an input parameter Rule _ Param _ In into two queues by commas, putting the queue into an object queue by taking the head of "# {" as an object, and putting the queue into a parameter queue by taking the switch of "$ {" as a parameter;
step 5.2.2.2.3: taking object KEY of the object queue, sequentially positioning the object KEY to a specific position in the Content, and replacing the object KEY with a value corresponding to the KEY in an object data pool ruleDataPool;
step 5.2.2.2.4: taking the parameter KEY of the parameter queue, sequentially positioning the parameter KEY to a specific position in the Content, and replacing the specific position with a value corresponding to the KEY in the parameter pool ruleParampool;
step 5.2.2.2.5: executing the Content without the parameter through a script engine instance script engine;
step 5.2.2.2.6: separating the output parameter Rule _ Param _ Out by commas, sequentially taking Out parameters to be output from the execution result of the script Engine, and putting the parameters into a parameter pool rulepampool;
step 5.2.2.2.7: obtaining a rule execution RESULT true or false by using a convention RESULT mark _ RESULT;
step 5.2.2.3: if the Type is BJS, calling a BJS-logic expression execution engine exeExemplinBjs;
step 5.2.2.3.1: initializing JAVASCRIPT script engine instance script Engine;
step 5.2.2.3.2: dividing an input parameter Rule _ Param _ In into two queues by commas, putting the queue into an object queue by taking a # { beginning as an object, and putting the queue into a parameter queue by taking a $ { switch as a parameter;
step 5.2.2.3.3: taking object KEY of the object queue, sequentially positioning the object KEY to a specific position in the Content, and replacing the object KEY with a value corresponding to the KEY in an object data pool ruleDataPool;
step 5.2.2.3.4: taking the parameter KEY of the parameter queue, sequentially positioning the parameter KEY to a specific position in the Content, and replacing the specific position with a value corresponding to the KEY in the parameter pool ruleParampool;
step 5.2.2.3.5: and executing the Content without the parameters by the script engine instance script engine, and outputting the rule execution result as true or false.
In the above technical solution, the rule reference parameters are as follows:
parameter _ id, parameter number, automatic generation;
parameter name, auxiliary understanding parameter meaning;
date _ type: the parameter value type supports STRING-STRING, INT-integer, DOUBLE-numerical value, BOOLEAN-Boolean value and DATE-DATE, and can be converted into a specified type for operation in the rule using process;
value is the specific Value of the setting parameter;
the reference mode of the parameters in the rule is as follows: and $ Param _ id.
In the above technical solution, the configuration rule refers to the entity object as follows:
data _ id: the object data number defines the rule as 'entity object field name';
table _ name: the entity object corresponds to the table name;
column _ name: the field name of the corresponding value in the entity object table name;
where: SQL conditions when querying the entity object;
where _ in _ param: variable parameters referenced in the Where condition;
the reference mode # { Data _ id } of the object Data in the rule.
In the above technical solution, the configuration rule is as follows:
rule _ id is a Rule number and is automatically generated;
rule _ name: rule description is abbreviated;
type: analyzing the rule type, and supporting 3 CLASS-JAVA classes, JS-JAVASCRIPT scripts and BJS-logic expressions;
content, namely, rule core execution logic, if the Type is CLASS, the Content is 'CLASS name, method name', and other scenes are JAVASCRIPT scripts or expressions;
param _ In: content input parameters.
In the above technical solution, the control rule ruleObject is as follows:
group _ id is decision set number;
rule _ id: numbering rules;
name is the Name of the rule;
execution _ Condition: executing the rule to obtain a preset judgment condition which is a logic expression;
sort _ no: executing the rules in the order of the sequence number from low to high under the decision set;
result _ type: when the value is 1, the rule is mandatory, if the value is false, the rule is not executed subsequently, and when the value is 2, the rule is suggestive, if the value is false, prompt information is output, and the subsequent rule is executed continuously;
rule _ Param _ In: input parameters of the execution rule core logic;
rule _ Param _ Out: and executing the output parameters after the rule core logic.
Due to the adoption of the technical scheme, the invention has the following beneficial effects:
in the middle link of the process treatment, logic judgment condition of financial loan, government organization or common company, program modification and production are generally needed when adjustment is needed. But the system related adjustment of a general company has a specified flow: the whole process needs manpower and investment cost and takes a long time. And a decision rule engine is introduced, and the hard coding of the original logic judgment condition can be replaced by the rule and parameter configuration. When adjustment is needed subsequently, parameters or rules can be directly modified in the system, and development, testing, operation and maintenance personnel do not need to spend several days or even several weeks.
The source data used by the decision logic supports the configuration. If the business data is required to be referred in the rule condition, the stored business data field is read by hard coding and then transmitted to the rule engine. In the whole scheme of the decision engine, the business data field can also be configured. When the rule condition changes and the quoted business data also changes, the code does not need to be modified, and the business data can be configured through the entity object.
Adding calls for JAVA code units to the current existing rule engines.
Drawings
FIG. 1 is an example initialization parameter pool;
FIG. 2 is a general overview of a decision rule engine;
FIG. 3 is an example business process embedded decision engine.
Detailed Description
The invention provides a decision engine based on dynamic configuration rules
Step S1, configuring rule reference parameters;
step S2, the configuration rule refers to the entity object data;
step S3, configuring rules;
step S4, configuring decision set;
step S5, configuring the association rule under the decision set;
step S6, executing the decision set and the lower association rule thereof;
step S7: calling a decision set in a business processing flow, as shown in FIG. 3;
in the above technical solution, the rule reference parameters in step 1 are as follows:
parameter _ id, parameter number, automatic generation;
parameter name, auxiliary understanding parameter meaning;
date _ type: the parameter value type can support STRING-STRING, INT-integer, DOUBLE-numerical value, BOOLEAN-Boolean value and DATE-DATE, and can be converted into a specified type to be operated in the rule using process;
value is the specific Value of the setting parameter;
the reference mode of the parameters in the rule is as follows: $ Param _ id };
an example of the configuration is as follows:
Param_id P000001
Param_name age comparison parameter
Date_type INT
Value
18
In the above technical solution, the rule referencing entity object data in step 2 is as follows:
data _ id: the object data number defines the rule as 'entity object field name';
table _ name: the entity object corresponds to the table name;
column _ name: the field name of the corresponding value in the entity object table name;
where: SQL conditions when querying the entity object;
where _ in _ param: variable parameters referenced in the Where condition;
reference mode # { Data _ id } of object Data in rule;
an example of the configuration is as follows:
Data_id Apply.idcardNo
Table_name BUSNESS_APPLY
Column_name IDCARDNO
Where APPLYNO=#{applyno}
Where_In_param String idcardNo
in the above technical solution, the configuration rule in step 3 is as follows:
rule _ id is a Rule number and is automatically generated;
rule _ name: rule description is abbreviated;
type: analyzing the rule type, and supporting 3 CLASS-JAVA classes, JS-JAVASCRIPT scripts and BJS-logic expressions;
content, namely, rule core execution logic, if the Type is CLASS, the Content is 'CLASS name, method name', and other scenes are JAVASCRIPT scripts or expressions;
param _ In: content input parameters;
CLASS-JAVA CLASS, for example as follows:
Rule_id R000001
Rule_name applicant blacklist checking
Type CLASS
Content RCBlackCheck.cust()
Param_In String phone,String cardNo
JS-JAVASCRIPT script, an example is as follows:
Rule_id R000002
rule _ name applicant age judgment
Type JS
Content var cardNo = #{idcardNo};
var year = parseInt(cardNo.substring(6,10));
var month = parseInt(cardNo.substring(10,12));
var currentDate = new Date();
...
_RESULT = cardDate<=currentDate;
Param_In String phone,String cardNo
BJS-logic expression, example as follows:
Rule_id R000003
Rule_name identification number andverifying whether the ID numbers are consistent
Type BJS
Content #{cardNo}==#{idcardNo}
Param_In String cardNo,String idcardNo
In the above technical solution, the decision set defined in step 4 is as follows:
group _ id is a decision set number and is automatically generated;
group _ name: description of decision sets is abbreviated;
in the above technical solution, the rule ruleObject in the association decision set in step 5 is as follows:
group _ id, the number of the decision set defined in step 4;
rule _ id: the rule number defined in step 3;
the Name refers to the rule Name defined in the step 3 and can be modified;
execution _ Condition: executing the rule to obtain a preset judgment condition which is a logic expression;
sort _ no: executing the rules in the order of the sequence number from low to high under the decision set;
result _ type: the type of processing of the rule execution result. 1: for mandatory, if false, then not execute any more, 2: for suggestive purposes, if prompt information is output for false, the subsequent rules are continuously executed;
rule _ Param _ In: input parameters of the execution rule core logic;
rule _ Param _ Out: executing the output parameters after the rule core logic;
examples are as follows:
Group_id G000001
Rule_id R000003
Name whether the identity card number is consistent with the authentication identity card number or not
Execute_Condition !isEmpty(#{VerifyE.cardNo,String}) && !isEmpty(#{Apply.idcardNo,String})
Sort_no 01
Result_type 1
Rule_Param_In #{VerifyE.cardNo},#{Apply.idcardNo}
Rule_Param_Out currentDate
In the above technical solution, the decision set executed in step 6 and the following association rules are as follows:
6.1: the input parameter of the rule EnginRun calling decision engine is (grouped, dataMap), the grouped is the number of the decision set, and the dataMap is the parameter set which is transmitted when the business process is called and the type of the parameter set is MAP < key, value >.
6.2: traversing all the association rules ruleObjects below the decision set groupId according to the decision set groupId;
6.3: obtaining parameters dependent on the association Rule according to an input parameter Rule _ Param _ In configured by the association Rule rulObject, and initializing to a parameter pool rulParamoPool;
6.4: acquiring object data dependent on an association Rule according to an input parameter Rule _ Param _ In configured by the association Rule rulObject, and initializing the object data to an object data pool rulDatePool;
6.5: inputting an initialized object data pool ruleDatePool and a parameter pool rulparampool into an association rule rulobjected, and executing all rules in sequence according to Sort _ no of the association rule;
6.6: traversing the execution results of all the ruleObjects, and comprehensively obtaining the total result of the decision set, wherein if one false exists, the total result is false, and otherwise, the total result is true;
in the above technical solution, the initialization parameter pool rulepampool in step 6.3 is defined as follows:
6.3.1: and sequentially traversing the dependent parameters of all the association rules according to the Rule object input parameter Rule _ Param _ In. The parsing rule ends with $ { start }, and the parameter number Param _ id is intercepted.
6.3.2: and sequentially taking out the configuration of all dependent parameters according to all Param _ ids (step 1), and putting the configuration into a parameter pool rulepampool as shown in the figure 1.
In the above technical solution, the initialization object data pool ruleDatePool in step 6.4 is defined as follows:
6.4.1: inputting a ruleEnginRun input parameter dataMap, and initializing to a rulDataPool object data pool;
6.4.2: and sequentially traversing the dependent object data of all the association rules according to the Rule object input parameter Rule _ Param _ In. The parsing rule ends with # { start }, and the object Data number Data _ id is intercepted.
6.4.3: and finding out the corresponding entity Table name Table _ name and the corresponding entity Table font name Column _ name from the configuration entity object according to the Data _ id. After all objects are sequentially checked out, all dependent entity objects are obtained after the duplication is removed by the combination of Table _ name and Where. And finally, splicing and assembling all columns of the Table _ name, the Where and the object into the database query SQL.
6.4.4: and (3) executing a result set obtained by database query SQL, taking Data _ id as key and Column as value, and sequentially putting the result set into an object Data pool rulDataPool.
In the above technical solution, the execution process of the association rule ruleObject in step 6.5 is defined as follows:
6.5.1: execution precondition execution _ Condition for executing ruleObject;
6.5.2: judging whether the Execute _ Condition is null or not, if so, considering that no precondition exists, and directly returning to true; if not, calling a rule engine interpreter rulExplain to calculate an expression result, and returning a corresponding result to be true or false;
6.5.3: if the execution _ Condition result is true, executing the rule logical Content of the ruleObject, otherwise, not executing the Content to skip the rule, and continuing to Execute the next association rule (see step 6.3.1);
6.5.4: calling a rule engine interpreter rulExplain execution rule core logic Content, and if the execution result is true, continuing to execute the next association rule in the step 6.3.1; if the Result is false, judging the processing type Result _ type, if the Result is '1-mandatory', stopping all subsequent rule execution, and if not, directly returning a decision aggregation Result as false;
in the above technical solution, the rule engine interpreter rulexendin in the steps 6.5.2 and 6.5.4 is defined as follows:
6.5.2.1: transmitting the configuration (parameter pool ruleParamPool, object data pool ruleDataPool, parsing Rule Type, Rule logic Content, input parameter Rule _ Param _ In, output parameter Rule _ Param _ Out) depended by the ruleObject into a Rule engine interpreter ruleExploin;
6.5.2.2: acquiring a corresponding execution engine exeExplain according to the Type;
6.5.2.2.1: if the Type is CLASS, calling a CLASS-JAVA CLASS execution engine exeExpiainlClass;
6.5.2.2.1.1: the Content is divided into two parts, the front part is the name of a ServiceClass execution class, and the rear part is the name of a ServiceMethod method;
6.5.2.2.1.2: acquiring a class instance of the ServiceClass by using SpringContextHolder.
6.5.2.2.1.3: calling a ServiceMethod method of a ServiceClass by using a JAVA reflection tool class reflocation, and taking an object data pool rulDataPool and a parameter pool rulParampPool as input parameters of the ServiceMethod so that processing logic in the method can call a dependent parameter or an object;
6.5.2.2.1.4: the output result after the ServiceMethod method is executed is true or false;
6.5.2.2.2: if the Type is JS, calling a JS-JAVASCRIPT script execution engine exeExplainJs;
6.5.2.2.2.1: initializing JAVASCRIPT script engine instance script Engine;
6.5.2.2.2.2: dividing an input parameter Rule _ Param _ In into two queues by commas, putting the queue into an object queue by taking a # { beginning as an object, and putting the queue into a parameter queue by taking a $ { switch as a parameter;
6.5.2.2.2.3: taking object KEY of the object queue, sequentially positioning the object KEY to a specific position in the Content, and replacing the object KEY with a value corresponding to the KEY in an object data pool ruleDataPool;
6.5.2.2.2.4: taking the parameter KEY of the parameter queue, sequentially positioning the parameter KEY to a specific position in the Content, and replacing the specific position with a value corresponding to the KEY in the parameter pool ruleParampool;
6.5.2.2.2.5: executing the Content without the parameter through a script engine instance script engine;
6.5.2.2.2.6: separating the output parameter Rule _ Param _ Out by commas, sequentially taking Out parameters to be output from the execution result of the script Engine, and putting the parameters into a parameter pool rulepampool;
6.5.2.2.2.7: obtaining an execution RESULT true or false by using a convention RESULT mark _ RESULT;
6.5.2.2.3: if the Type is BJS, calling a BJS-logic expression execution engine exeExemplinBjs;
6.5.2.2.3.1: initializing JAVASCRIPT script engine instance script Engine;
6.5.2.2.3.2: dividing an input parameter Rule _ Param _ In into two queues by commas, putting the queue into an object queue by taking a # { beginning as an object, and putting the queue into a parameter queue by taking a $ { switch as a parameter;
6.5.2.2.3.3: taking object KEY of the object queue, sequentially positioning the object KEY to a specific position in the Content, and replacing the object KEY with a value corresponding to the KEY in an object data pool ruleDataPool;
6.5.2.2.3.4: taking the parameter KEY of the parameter queue, sequentially positioning the parameter KEY to a specific position in the Content, and replacing the specific position with a value corresponding to the KEY in the parameter pool ruleParampool;
6.5.2.2.3.5: and executing the Content without the parameters by the script engine instance script engine, and outputting the result as true or false.

Claims (3)

1. A decision engine implementation method based on dynamic configuration rules is characterized in that,
step 1: acquiring input parameters, decision set numbers and parameter sets transmitted in the calling of a business process;
step 2: traversing all the association rules under the decision set according to the decision set number;
and step 3: acquiring a dependent parameter of the association rule from a configuration rule reference parameter according to an input parameter of an execution rule core logic configured by the association rule, and initializing the dependent parameter to a parameter pool;
and 4, step 4: according to the value of the input parameter configured by the association rule, the entity object is referred from the configuration rule, the entity object data depended by the association rule is obtained, and the entity object data is initialized to an entity object data pool;
and 5: sending the values of the entity object data pool and the parameter pool to a rule core execution logic of the configuration rule according to the rule number of the association rule, executing the rule and obtaining a rule execution result;
step 6: all the rule execution results form a decision set, if one rule execution result is false, the final decision result is false, otherwise, the final decision result is true;
step 5 comprises the following steps:
step 5.1: executing an execution precondition for the association rule;
step 5.2: judging whether the execution precondition is empty, if so, determining that no precondition exists, and directly returning to true; if not, calling a rule engine interpreter to calculate and execute an expression result of the precondition, and returning a corresponding result to be true or false;
step 5.3: if the result of executing the precondition is true, executing step 5.4, otherwise, not executing the rule core execution logic to skip the association rule, and continuing to execute the next association rule;
step 5.4: calling a rule engine interpreter to execute a rule core execution logic, and if the execution result of the execution rule is true, continuing to execute the next association rule; if the result is false, judging the processing type, if the value of the processing type is 1-mandatory, stopping all subsequent rule execution, otherwise, directly returning the final decision result to be false;
a rules engine interpreter, defined as follows:
step 5.2.1: transmitting the configuration depended by the association Rule ruleObject, a parameter pool ruleParampool, an object data pool ruleDataPool, a parsing Rule Type, a Rule logic Content, an input parameter Rule _ Param _ In and an output parameter Rule _ Param _ Out into a Rule engine interpreter;
step 5.2.2: acquiring a corresponding execution engine exeExplain according to the Type;
step 5.2.2.1: if the Type is CLASS, calling a CLASS-JAVA CLASS execution engine exeExpiainlClass;
step 5.2.2.1.1: the Content is divided into two parts, the front part is the name of a ServiceClass execution class, and the rear part is the name of a ServiceMethod method;
step 5.2.2.1.2: acquiring a class instance of the ServiceClass by using SpringContextHolder.
Step 5.2.2.1.3: calling a ServiceMethod method of a ServiceClass by using a JAVA reflection tool class reflocation, and taking an object data pool rulDataPool and a parameter pool rulParampPool as input parameters of the ServiceMethod so that processing logic in the method can call a dependent parameter or an object;
step 5.2.2.1.4: executing the output rule after the ServiceMethod method is executed as true or false;
step 5.2.2.2: if the Type is JS, calling a JS-JAVASCRIPT script execution engine exeExplainJs;
step 5.2.2.2.1: initializing JAVASCRIPT script engine instance script Engine;
step 5.2.2.2.2: dividing an input parameter Rule _ Param _ In into two queues by commas, putting the queue into an object queue by taking the head of "# {" as an object, and putting the queue into a parameter queue by taking the switch of "$ {" as a parameter;
step 5.2.2.2.3: taking object KEY of the object queue, sequentially positioning the object KEY to a specific position in the Content, and replacing the object KEY with a value corresponding to the KEY in an object data pool ruleDataPool;
step 5.2.2.2.4: taking the parameter KEY of the parameter queue, sequentially positioning the parameter KEY to a specific position in the Content, and replacing the specific position with a value corresponding to the KEY in the parameter pool ruleParampool;
step 5.2.2.2.5: executing the Content without the parameter through a script engine instance script engine;
step 5.2.2.2.6: separating the output parameter Rule _ Param _ Out by commas, sequentially taking Out parameters to be output from the execution result of the script Engine, and putting the parameters into a parameter pool rulepampool;
step 5.2.2.2.7: obtaining a rule execution RESULT true or false by using a convention RESULT mark _ RESULT;
step 5.2.2.3: if the Type is BJS, calling a BJS-logic expression execution engine exeExemplinBjs;
step 5.2.2.3.1: initializing JAVASCRIPT script engine instance script Engine;
step 5.2.2.3.2: dividing an input parameter Rule _ Param _ In into two queues by commas, putting the queue into an object queue by taking a # { beginning as an object, and putting the queue into a parameter queue by taking a $ { switch as a parameter;
step 5.2.2.3.3: taking object KEY of the object queue, sequentially positioning the object KEY to a specific position in the Content, and replacing the object KEY with a value corresponding to the KEY in an object data pool ruleDataPool;
step 5.2.2.3.4: taking the parameter KEY of the parameter queue, sequentially positioning the parameter KEY to a specific position in the Content, and replacing the specific position with a value corresponding to the KEY in the parameter pool ruleParampool;
step 5.2.2.3.5: and executing the Content without the parameters by the script engine instance script engine, and outputting the rule execution result as true or false.
2. The dynamic configuration rule-based decision engine implementation method of claim 1, wherein the step 3 comprises the following steps:
the initialization parameter pool in step 3 is defined as follows:
step 3.1: according to input parameters of the association rules, sequentially traversing the dependent parameters of all the association rules, ending the analysis rule by "$ {" start "}", and intercepting parameter numbers;
step 3.2: and sequentially taking out values corresponding to the configuration of all the dependent parameters according to all the parameter numbers, and putting the values into a parameter pool.
3. The dynamic configuration rule-based decision engine implementation method of claim 1, wherein the step 4 comprises the following steps:
step 4.1: according to the input parameters of the association rules, sequentially traversing all the dependent entity object data of the association rules, ending the analysis rules by "# {" start "}", and intercepting the object data numbers;
step 4.2: searching corresponding entity table names, entity table field names and query conditions from the configured entity objects according to the object data numbers, sequentially searching all the configured entity objects, combining and de-duplicating the entity table names and the query conditions to obtain all dependent entity objects, and finally splicing and assembling the entity table names, the query conditions and the entity table field names of all the dependent entity objects into the database query SQL;
step 4.3: and executing a result set obtained by querying SQL by the database, and sequentially putting the object data number as key and the entity table field name Column _ name as value into an object data pool.
CN202110499415.8A 2021-05-08 2021-05-08 Decision engine implementation method based on dynamic configuration rules Active CN112907234B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110499415.8A CN112907234B (en) 2021-05-08 2021-05-08 Decision engine implementation method based on dynamic configuration rules

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110499415.8A CN112907234B (en) 2021-05-08 2021-05-08 Decision engine implementation method based on dynamic configuration rules

Publications (2)

Publication Number Publication Date
CN112907234A CN112907234A (en) 2021-06-04
CN112907234B true CN112907234B (en) 2021-07-16

Family

ID=76109052

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110499415.8A Active CN112907234B (en) 2021-05-08 2021-05-08 Decision engine implementation method based on dynamic configuration rules

Country Status (1)

Country Link
CN (1) CN112907234B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113362038A (en) * 2021-06-30 2021-09-07 武汉众邦银行股份有限公司 Examination and approval authorization method and device based on parameterized rule set configuration
CN113628036A (en) * 2021-08-16 2021-11-09 武汉众邦银行股份有限公司 Big data risk detection model-based method and device
CN116243892B (en) * 2023-01-09 2023-10-20 睿智合创(北京)科技有限公司 Dynamic JAVA implementation method of decision engine rule

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1659589A (en) * 2002-04-19 2005-08-24 电脑联合想象公司 System and method for providing inferencing services
CN110647682A (en) * 2019-09-04 2020-01-03 华东江苏大数据交易中心股份有限公司 Associated recommendation system for transaction data
CN111741007A (en) * 2020-07-06 2020-10-02 桦蓥(上海)信息科技有限责任公司 Financial business real-time monitoring system and method based on network layer message analysis
CN112395342A (en) * 2020-11-18 2021-02-23 平安普惠企业管理有限公司 Wind control decision method, device, equipment and storage medium
CN112579054A (en) * 2020-12-10 2021-03-30 平安普惠企业管理有限公司 Rule updating method, device, equipment and medium of rule engine
CN112700329A (en) * 2021-01-27 2021-04-23 永辉云金科技有限公司 Response method of wind control rule engine and wind control rule engine

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180322199A1 (en) * 2017-05-08 2018-11-08 Propellum Infotech Pvt. Ltd. Optimizing the allocation of jobs on job portal
CN110502732A (en) * 2019-07-09 2019-11-26 威富通科技有限公司 A kind of rule generating method of discount coupon, device and server

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1659589A (en) * 2002-04-19 2005-08-24 电脑联合想象公司 System and method for providing inferencing services
CN110647682A (en) * 2019-09-04 2020-01-03 华东江苏大数据交易中心股份有限公司 Associated recommendation system for transaction data
CN111741007A (en) * 2020-07-06 2020-10-02 桦蓥(上海)信息科技有限责任公司 Financial business real-time monitoring system and method based on network layer message analysis
CN112395342A (en) * 2020-11-18 2021-02-23 平安普惠企业管理有限公司 Wind control decision method, device, equipment and storage medium
CN112579054A (en) * 2020-12-10 2021-03-30 平安普惠企业管理有限公司 Rule updating method, device, equipment and medium of rule engine
CN112700329A (en) * 2021-01-27 2021-04-23 永辉云金科技有限公司 Response method of wind control rule engine and wind control rule engine

Also Published As

Publication number Publication date
CN112907234A (en) 2021-06-04

Similar Documents

Publication Publication Date Title
CN112907234B (en) Decision engine implementation method based on dynamic configuration rules
US9037549B2 (en) System and method for testing data at a data warehouse
US10599635B1 (en) Control systems with independent data processing
US9703808B2 (en) Data masking setup
CN111767350A (en) Data warehouse testing method and device, terminal equipment and storage medium
CN112527421A (en) Service calling method, device, equipment and storage medium
CN110597844A (en) Heterogeneous database data unified access method and related equipment
CN112783867A (en) Database optimization method for meeting real-time big data service requirements and cloud server
CN111598535B (en) Basic material importing method, system and computer equipment
JP6419667B2 (en) Test DB data generation method and apparatus
CN112612813A (en) Test data generation method and device
CN112948473A (en) Data processing method, device and system of data warehouse and storage medium
CN108459846B (en) Software cloud customization method and platform
CN117495544A (en) Sandbox-based wind control evaluation method, sandbox-based wind control evaluation system, sandbox-based wind control evaluation terminal and storage medium
CN115455239B (en) Conversion method and device for JAVA class instance and target format data
CN114610385B (en) Running environment adaptation system and method
CN116069628A (en) Intelligent-treatment software automatic regression testing method, system and equipment
CN115757481A (en) Data migration method, device, equipment and storage medium
CN112230887B (en) Script configuration system applied to index in decision engine
CN114065288A (en) Method and device for auditing data change SQL statement
CN112347095B (en) Data table processing method, device and server
US10997056B1 (en) Generation of explanatory and executable repair examples
CN111968022B (en) Service number generation system and method based on JSON configuration mode
CN112527820B (en) Method and system for uniformly checking various service application data
CN117648303A (en) Bank core system and data migration method of matched peripheral system thereof

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
GR01 Patent grant
GR01 Patent grant