CN107025102B - Decision method and system based on rule file - Google Patents

Decision method and system based on rule file Download PDF

Info

Publication number
CN107025102B
CN107025102B CN201610071299.9A CN201610071299A CN107025102B CN 107025102 B CN107025102 B CN 107025102B CN 201610071299 A CN201610071299 A CN 201610071299A CN 107025102 B CN107025102 B CN 107025102B
Authority
CN
China
Prior art keywords
operation command
data
rule
field name
decision
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
CN201610071299.9A
Other languages
Chinese (zh)
Other versions
CN107025102A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610071299.9A priority Critical patent/CN107025102B/en
Publication of CN107025102A publication Critical patent/CN107025102A/en
Application granted granted Critical
Publication of CN107025102B publication Critical patent/CN107025102B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a decision method and a decision system based on a rule file. The method provided by the embodiment of the invention comprises the following steps: acquiring a first operation command and first data; determining a first rule file corresponding to the first operation command, wherein a rule language is configured in the first rule file; and adopting the first rule file to make a decision on at least part of the first data, and returning a first decision result when the at least part of the first data meets a first condition.

Description

Decision method and system based on rule file
Technical Field
The invention relates to the field of computers, in particular to a decision method and a decision system based on a rule file.
Background
The rules engine is a component embedded in the application that enables policy rules to be defined, tested, executed, and maintained apart from the application code. The rule engine receives data input, interprets business rules and makes corresponding decisions based on the business rules.
At present, rule engines are widely used in the industries of finance, telecommunication, government and the like, and are used for supporting the editing, management and deployment of business rules so as to adapt to the rapid change of business. However, one common way in the existing rule engine is to configure a file, and the condition judgment is realized by configuring the condition value judgment according to the content of the file. However, the configuration file has the disadvantages that editing is complicated, variables cannot be increased without limit, and code needs to be modified. Another common way is to adopt a dynamic language, and flexibly adjust the conditions by writing the dynamic language. Dynamic languages have the advantage of flexibility, but are more expensive due to their greater power, which results in more time spent in writing.
Disclosure of Invention
The embodiment of the invention provides a decision method and a decision system based on a rule file, which can reduce the cost.
One aspect of the present invention provides a rule file-based decision method, including:
acquiring a first operation command and first data;
determining a first rule file corresponding to the first operation command, wherein a rule language is configured in the first rule file;
and adopting the first rule file to make a decision on at least part of the first data, and returning a first decision result when the at least part of the first data meets a first condition.
Optionally, the first data includes a first parameter set, and a parameter value of each parameter in the first parameter set;
the making a decision on the first data by using the first rule file further includes:
querying a parameter format and an operation instruction corresponding to the first operation command according to a first preset table, wherein an operation command set and a parameter format and an operation instruction corresponding to each operation command in the operation command set are stored in the first preset table;
checking whether the first data conforms to a parameter format corresponding to the first operation command;
and when the first data is determined to accord with the parameter format corresponding to the first operation command, processing the first data according to the operation instruction.
Optionally, the parameter format corresponding to the first operation command includes a field name set;
the checking whether the first data conforms to a parameter format corresponding to the first operation command includes:
and checking whether the first parameter set contains a field name set corresponding to the first operation command, and if so, determining that the first data conforms to a parameter format corresponding to the first operation command.
Optionally, the parameter format corresponding to the first operation command further includes a field length limit of each field name in the field name set;
the checking whether the first data conforms to a parameter format corresponding to the first operation command further includes:
when the first parameter set is determined to contain the field name set corresponding to the first operation command, checking whether the length of the parameter value of each field name in the first data does not exceed the field length limit of the field name, and if so, determining that the first data conforms to the parameter format corresponding to the first operation command.
Optionally, the method further includes:
and when the first data is determined not to conform to the parameter format corresponding to the first operation command, stopping the operation on the first data and prompting that an error occurs.
Optionally, the operation instruction corresponding to the first operation command includes a field type of each field name in the field name set, where the field type is used to indicate whether the field name is required for the first rule file decision;
the processing the first data according to the operation instruction comprises:
determining a core field name set according to a field type corresponding to the field name in the first data, wherein the core field name set comprises the field name required by the first rule file decision in the first data;
the making a decision on at least part of the first data by using the first rule file, and returning a first decision result when the at least part of the first data meets a first condition specifically includes:
adopting the first rule file to make a decision on parameter values of the field names in the decision field name set;
and when the parameter values of the field names in the decision field name set meet a first condition, returning a first decision result.
Optionally, the operation instruction corresponding to the first operation command includes a warehousing instruction of each field name in the field name set, where the warehousing instruction is used to instruct whether to store the field name in a database;
the processing the first data according to the operation instruction comprises:
and when the warehousing indication corresponding to the field name in the first data is used for indicating that the field name is stored in the data, storing the parameter value of the field name into a database.
Optionally, the determining a first rule file corresponding to the first operation command includes:
inquiring a rule file access path and a rule file interface certificate corresponding to the first operation command according to a preset rule file access protocol table, wherein an operation command set and a rule file access path and a rule file interface certificate corresponding to each operation command in the operation command set are stored in the preset rule file access protocol table;
and determining a first rule file corresponding to the first operation command according to the rule file access path and the rule file interface certificate.
Optionally, the returning the first decision result further includes:
inquiring an entry path corresponding to the first operation command according to a second preset table, wherein the entry path comprises a database name, a table name and a database-dividing and table-dividing mode, and the second preset table stores an operation command set and the database name, the table name and the database-dividing and table-dividing mode corresponding to each operation command in the operation command set;
and storing the first data and the decision result into a database according to the input path.
In another aspect, the present invention further provides a decision system based on rule files, including:
the acquisition module is used for acquiring a first operation command and first data;
a determining module, configured to determine a first rule file corresponding to the first operation command, where a rule language is configured in the first rule file;
and the decision module is used for deciding at least part of the first data by adopting the first rule file, and returning a first decision result when the at least part of the first data meets a first condition.
Optionally, the first data includes a first parameter set, and a parameter value of each parameter in the first parameter set;
the rule file based decision system further comprises:
the query module is configured to query a parameter format and an operation instruction corresponding to the first operation command according to a first preset table before the decision module makes a decision on the first data by using the first rule file, where the first preset table stores an operation command set and a parameter format and an operation instruction corresponding to each operation command in the operation command set;
the checking module is used for checking whether the first data accords with a parameter format corresponding to the first operation command;
and the processing module is used for processing the first data according to the operation instruction when the first data is determined to accord with the parameter format corresponding to the first operation command.
Optionally, the parameter format corresponding to the first operation command includes a field name set;
the checking module is specifically configured to check whether the first parameter set includes a field name set corresponding to the first operation command, and if so, determine that the first data conforms to a parameter format corresponding to the first operation command.
Optionally, the parameter format corresponding to the first operation command further includes a field length limit of each field name in the field name set;
the checking module is specifically configured to, when it is determined that the first parameter set includes a field name set corresponding to the first operation command, check whether a length of a parameter value of each field name in the first data does not exceed a field length limit of the field name, and if so, determine that the first data conforms to a parameter format corresponding to the first operation command.
Optionally, the processing module is further configured to stop the operation on the first data and prompt an error when it is determined that the first data does not conform to the parameter format corresponding to the first operation command.
Optionally, the operation instruction corresponding to the first operation command includes a field type of each field name in the field name set, where the field type is used to indicate whether the field name is required for the first rule file decision;
the processing module is specifically configured to determine a core field name set according to a field type corresponding to a field name in the first data, where the core field name set includes the field name required for the decision of the first rule file in the first data;
the decision module is specifically configured to perform a decision on parameter values of the field names in the decision field name set by using the first rule file, and return a first decision result when the parameter values of the field names in the decision field name set satisfy a first condition.
Optionally, the operation instruction corresponding to the first operation command includes a warehousing instruction of each field name in the field name set, where the warehousing instruction is used to instruct whether to store the field name in a database;
the processing module is specifically configured to store a parameter value of the field name in a database when the entry indication corresponding to the field name in the first data is used to indicate that the field name is stored in data.
Optionally, the determining module is specifically configured to query, according to a preset rule file access protocol table, a rule file access path and a rule file interface credential corresponding to the first operation command, where an operation command set and a rule file access path and a rule file interface credential corresponding to each operation command in the operation command set are stored in the preset rule file access protocol table; and determining a first rule file corresponding to the first operation command according to the rule file access path and the rule file interface certificate.
Optionally, the decision system based on the rule file further includes:
the entry module is used for querying an entry path corresponding to the first operation command according to a second preset table after a first decision result is returned, wherein the entry path comprises a database name, a table name and a database-based sub-table mode, and the second preset table stores an operation command set and the database name, the table name and the database-based sub-table mode corresponding to each operation command in the operation command set; and storing the first data and the decision result into a database according to the input path.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the invention, the rule file is adopted to make decision on the user data, and because the structure of the rule file only has a simple rule language like 'where … the …' (Chinese: when … is equal to …), no loop or no loop is needed, the writing is simple, the time consumption is less, the variables can be increased infinitely, the code does not need to be rewritten when the variables are increased, and the cost is lower.
Drawings
FIG. 1 is a schematic diagram of a decision making system according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart diagram illustrating an embodiment of a rule-file based decision method according to the present invention;
FIG. 3 is a schematic flow chart diagram illustrating another embodiment of a rule-file based decision method according to the present invention;
FIG. 4 is a schematic diagram of another embodiment of a rule file based decision system according to the present invention;
FIG. 5 is a schematic diagram of another embodiment of a rule file based decision system according to the present invention;
FIG. 6 is a schematic diagram of another embodiment of a rule file based decision system according to the present invention;
FIG. 7 is a schematic structural diagram of another embodiment of a rule file-based decision system according to the present invention.
Detailed Description
Fig. 1 is a schematic structural diagram of an embodiment of a decision system in the present invention. The decision making system comprises a database, at least one external service interface, at least one rule engine and a rule base. In the invention, a plurality of rule files are stored in the rule base, and the rule engine is used for calling the rule files in the rule base to make a decision on input data. The decision method based on the rule file is applied to the decision system.
Fig. 2 is a schematic flow chart of an embodiment of a rule-file-based decision method according to the present invention, and fig. 2 is a schematic flow chart. The decision method based on the rule file comprises the following steps:
201. a first operation command and first data are acquired.
In this embodiment, the first operation command is a string of characters. The first operation instruction may be a numeric string, an alphabetic string, or both, and is not limited herein. The decision-making system provides a plurality of operation options for a user, and an operation command corresponding to each operation option is predefined in the decision-making system. Each operation option provided by the decision-making system also has a corresponding relation with each external service interface in the decision-making system. And the external service interface corresponding to the operation option corresponding to the first operation command receives the first operation command and first data input by a user.
In this embodiment, the first data is data required by the decision system to execute the operation command for decision making. Specifically, the first data includes external data and internal data, where the external data is basic information input by a user and received by the external service interface, and the internal data is related data searched by the external service interface in the database according to the external data. For example, the basic information is a first user account registered in the preset application program, and the database of the rule engine stores related record data logged in the preset application program by using the first user account. After receiving the first user account, the external service interface searches the record data in the preset application program corresponding to the first user account in the database according to the first user account. Or, the basic information is an identity card number or a mobile phone number, and the personal identity card number or the mobile phone number and corresponding personal related data are stored in a database of the rule engine. After receiving the identity card number or the mobile phone number, the external service interface searches personal related data corresponding to the identity card number or the mobile phone number from the database.
When the user uses the decision-making system, after inputting the basic information, the user selects the operation options of the basic information. And an external service interface corresponding to the operation option in the decision system receives the basic information and the operation option, uses the basic information and the related data inquired according to the basic information as first data, and uses an operation command corresponding to the operation option as a first operation command.
202. And determining a first rule file corresponding to the first operation command, wherein a rule language is configured in the first rule file.
In this embodiment, the decision system is provided with at least one rule engine, where each rule engine is respectively configured to invoke a rule file in a rule base to make a decision on data. Specifically, the rule file is configured with a rule language and describes conditions required for returning different results. Optionally, at least two rule engines are arranged in the decision making system to reduce the flow pressure. Different rule files in the rule base correspond to different operation commands. After an external service interface in the decision system acquires first data and a first operation command, a rule engine is randomly selected, and the acquired first data is sent to the rule engine, so that the rule engine calls a first rule file corresponding to the first operation command to make a decision on the first data.
There are various methods of determining the first rule file corresponding to the first operation command.
Optionally, the decision system further stores a preset rule file access protocol table, where the preset rule file access protocol table stores an operation command set, and a rule file access path and a rule file interface credential corresponding to each operation command in the operation command set. The rule file access path and the rule file interface certificate are used for assembling access parameters, and the corresponding rule file can be accessed according to the access parameters. Optionally, the regular file access path is a Uniform Resource Locator (URL).
Determining the first rule file corresponding to the first operation command includes: inquiring a rule file access path and a rule file interface certificate corresponding to the first operation command according to a preset rule file access protocol table; and determining a first rule file corresponding to the first operation command according to the rule file access path and the rule file interface certificate. Specifically, the external service interface assembles the first data, the rule file access path and the rule file interface certificate into an access parameter according to an engine protocol, and sends the access parameter to the selected rule engine.
203. And adopting the first rule file to make a decision on at least part of the first data, and returning a first decision result when the at least part of the first data meets a first condition.
And after receiving the access parameters, the rule engine determines a first rule file according to the rule file access path in the access parameters and the rule file interface certificate, and calls the first rule file to make a decision on first data in the access parameters. Specifically, the rule engine compares the first data with a first condition described in the rule file, and returns a first decision result if the first data satisfies the first condition. Optionally, at least two conditions are described in the rule file, where each condition corresponds to a decision result. And the rule engine compares the first data with all conditions in the rule file in sequence and returns a decision result corresponding to the condition met by the first data.
And after the rule engine decides the first data to obtain a decision result, sending the decision result to the external service interface so that the external service interface displays the decision interface to the user. Optionally, in this embodiment, the decision result is further stored in a database, so as to record the decision history of the decision system.
In the embodiment, the rule engine in the decision system decides the data by adopting the rule file, and because the structure of the rule file only has a simple rule language like 'where … the …' (Chinese: when … is equal to …), no cycle and no cycle are needed, the data only needs to be put into the rule language when the decision is made on the data, and only the newly added variable needs to be put into the rule language when the newly added variable is needed in the data, the code does not need to be rewritten, and the structure is simple.
Optionally, as shown in fig. 3, fig. 3 is a schematic flowchart of another embodiment of the decision method based on a rule file according to the present invention. Different from the embodiment shown in fig. 2, in this embodiment, before the step 203 uses the first rule file to make a decision on the first data, the rule file-based decision method of the present invention further includes:
301. and querying a parameter format and an operation instruction corresponding to the first operation command according to a first preset table.
302. And checking whether the first data conforms to the parameter format corresponding to the first operation command.
In this embodiment, a first preset table is stored in the decision making system, and an operation command set, and a parameter format and an operation instruction corresponding to each operation command in the operation command set are stored in the first preset table.
Optionally, in this embodiment, the parameter format corresponding to the first operation command includes a field name set. And checking whether the first data conforms to the parameter format corresponding to the first operation command, specifically, checking whether the first data includes a field name set corresponding to the first operation command, and if so, determining that the first data conforms to the parameter format corresponding to the first operation command.
For example, the parameter format corresponding to the first operation command includes a field name set of { userid, provnum, isactive }, where userid is used to indicate a registered account number of the user in a preset application, provnum is used to indicate a province number that the user has logged in, and isactive is used to indicate whether the user is active. And when the field name set is included in the first data, determining that the first data conforms to the parameter format corresponding to the first operation command.
Further, optionally, the parameter format corresponding to the first operation command further includes a field length of each field name in the field name set, and checking whether the first data conforms to the parameter format corresponding to the first operation command, specifically, the method further includes: when the first parameter set is determined to contain the field name set corresponding to the first operation command, checking whether the length of the parameter value of each field name in the first data does not exceed the field length of the field name, and if so, determining that the first data conforms to the parameter format corresponding to the first operation command. Therefore, the data format adopted by the first rule language during decision making can be ensured to be correct, and errors are avoided.
For example, in the parameter format corresponding to the first operation command, the field length limit corresponding to userid is 255, the field length limit corresponding to provnum is 8, and the field length limit corresponding to isactive is 8. After the first data is obtained, whether the field length of the parameter value of the userid exceeds 255, whether the field length of the parameter value of the provnum exceeds 8, and whether the field length of the parameter value of the isactive exceeds 8 are checked, and if not, the first data is determined to accord with the parameter format corresponding to the first operation command.
Further, optionally, in the decision method based on the rule file according to this embodiment, when it is determined that the first data does not conform to the parameter format corresponding to the first operation command, the operation on the first data is stopped, and an error is prompted to occur. The rule engine may prompt the user of the error through text or voice, which is not limited herein.
303. And when the first data is determined to accord with the parameter format corresponding to the first operation command, processing the first data according to the operation instruction.
In this embodiment, there may be a plurality of operation instructions corresponding to the first operation command.
Optionally, the operation instruction corresponding to the first operation command includes a field type of each field name in the field name set, where the field type is used to indicate whether the field name is required for the first rule file decision.
And when the first data is processed according to the operation instruction, selecting a field name required by first rule file decision from a field name set of the first data according to a field type corresponding to the field name in the first data. For convenience of description, the selected field names are used as a core field name set, and the core field name set comprises the field names required by the first rule file decision in the first data. And deciding the parameter values of the field names in the decision field name set by adopting the first rule file.
Specifically, when the external service interface assembles the first data, the rule file access path and the rule file interface certificate into the access parameter according to the engine protocol, the field names in the core field name set and the parameter values of the field names are assembled into the access parameter, and the access parameter is sent to the rule engine. And the rule engine calls a first rule file to make a decision on the parameter values in the core field name set. In this way, unnecessary parameters may be avoided from being sent to the rules engine.
Optionally, the operation instruction corresponding to the first operation command includes a warehousing instruction of each field name in the field name set, where the warehousing instruction is used to instruct whether to store the field name in a database. When the first data is processed according to the operation instruction, when the warehousing instruction corresponding to the field name in the first data is used for indicating that the field name is stored in the data, the parameter value of the field name is stored in a database so as to record the decision history of the rule engine.
In this embodiment, by using a first preset table to query a parameter format and parameter operation corresponding to the first operation command, when it is checked that first data conforms to the parameter format corresponding to the first operation command, the first data is processed according to the operation instruction; therefore, when the variables required by the decision making of the rule file are changed, the code does not need to be changed, and only the first preset table needs to be modified, so that the maintenance of the decision making system is simpler.
In this embodiment, optionally, the external service interface needs to record at least part of the parameters and the decision result in the first data in the database. There are various recording methods, one of which is described below.
Optionally, the decision system further stores a second preset table, where the second preset table stores an operation command set and an entry path corresponding to each operation command in the operation command set, and the entry path includes a database name, a table name, and a sub-database and sub-table manner. And after the external service interface acquires the decision result and the first data, packaging the decision result and the first data. Optionally, the external service interface encapsulates the decision result and the first data by using SQL language.
And the external service interface inquires an entry path corresponding to the first operation command according to the second preset table, and stores the packaged decision result and the first data into a database according to the entry path.
In order to facilitate understanding of the present invention, the following describes an example of the rule-file-based decision method according to the present invention with a specific application scenario.
Fig. 4 is a schematic structural diagram of a decision system according to an embodiment of the present invention. In this embodiment, the decision system is specifically a credit investigation decision system, and is configured to execute a rule file-based decision method. Specifically, the decision system comprises an interface, anti-fraud management, a database and a rule engine, wherein the rule engine comprises a rule base, and the anti-fraud management comprises an anti-fraud interface, a first preset table, a preset rule file access protocol table and a second preset table.
In this embodiment, before the first user loans, the merchant needs to use the decision-making system to make a decision on the data of the first user to obtain the credit rating of the first user, so as to evaluate whether the first user is fraudulent according to the credit rating of the first user. Specifically, the merchant firstly inputs a registered account number of the first user in a preset application program on an interface of the decision system and selects an operation option for acquiring the credit rating of the first user. And after the decision-making system receives the selection of the operation option, the decision-making system calls an anti-fraud interface in anti-fraud management. The anti-fraud interface obtains the registered account, specifically, the registered account is zhangsan in this embodiment. The anti-fraud interface takes the registered account as a parameter value of a field name userid; and searching the related data of the registered account in a database according to the registered account.
Specifically, in this implementation, the relevant data of the registered account in the database includes the number of the provinces that the registered account has logged in and whether the registered account is active. The anti-fraud interface takes the provincial number as a parameter value of a field name provnum and takes a result of whether the registered account is active as a parameter value of a field name isactive. Here, the value of isactive is 1 when the user is an active user, and the value of isactive is 0 when the user is not an active user. Specifically, in this embodiment, the anti-fraud interface uses the field name of userid, inactive, 1, and prevnum, 10 as the first data, and obtains the first operation command corresponding to the operation option selected by the merchant for obtaining the credit level of the first user, where the first operation command is 10001 in this embodiment.
The anti-fraud interface looks up the parameter format and the operation indication corresponding to 10001 shown in the following table in the first preset table according to the first operation command 10001.
Figure BDA0000919947910000111
Figure BDA0000919947910000121
When the field type is 0, the corresponding field name is not the field required by the rule file decision, and when the field type is 1, the corresponding field name is the field required by the rule file decision; when the warehousing indication is 0, the corresponding field name is not required to be stored in the database, and when the warehousing indication is 1, the corresponding field name is required to be stored in the database.
When the anti-fraud interface detects that the first data includes all the field names in the table and the length of the parameter value of each field name in the first data does not exceed the length of the corresponding field, it is determined that the first data conforms to the parameter format corresponding to the operation command 10001.
The anti-fraud interface queries, according to the first operation command 10001, a rule file access path and a rule file interface credential corresponding to 10001 shown in the following table from a preset rule file access protocol table.
Operating commands Regular file access path Rule file interface voucher
10001 url1 spdb_comm
The anti-fraud interface packages the inactive 1, the provnum 10, the spdb _ comm and the url1 in the first data according to the format agreed by the engine protocol to generate the access parameter. The access parameters are then sent to the rules engine.
And the rule engine determines a rule file from the rule base according to the spdb _ comm and the url1 in the access parameters, calls the rule file to make a decision on the data "inactive 1 and prevnum 10", and obtains a decision result, wherein the decision result is the credit rating of the first user. And the rule engine sends the decision result to the anti-fraud interface so that the anti-fraud interface displays the decision result on the interface.
The anti-fraud interface further queries, according to the first operation command 10001, an entry path corresponding to 10001 shown in the following table in the second preset table, where the entry path includes a database name, a table name, and a sub-base and sub-table manner. According to the parameter format and the operation instruction corresponding to 10001 found by querying in the first preset table, the parameter value of the field name provnum does not need to be recorded into the database.
Operating commands Name of field Name of database Table name Warehouse and table dividing mode
10001 userid A M x
10001 isactive C P z
And the fraud prevention interface records the userid in the first data into the database according to the entry path corresponding to the userid, and records the isactive 1 into the database according to the entry path corresponding to the isactive.
The above describes the rule-file-based decision method of the present invention, and the following describes the rule-file-based decision system of the present invention.
Fig. 5 is a schematic structural diagram of an embodiment of a rule file-based decision system according to the present invention. The rule file based decision system 500 includes:
an obtaining module 501, configured to obtain a first operation command and first data;
a determining module 502, configured to determine a first rule file corresponding to the first operation command, where a rule language is configured in the first rule file;
the decision module 503 is configured to perform a decision on at least part of the first data by using the first rule file, and return a first decision result when the at least part of the first data meets a first condition.
In the embodiment, the decision system based on the rule file is used for deciding the user data by adopting the rule file, and as only a simple rule language like 'where … then …' (Chinese: when … is equal to …) exists in the structure of the rule file, no loop or loop is needed, the writing is simple, the time consumption is less, variables can be increased infinitely, codes do not need to be rewritten when the variables are increased, and the cost is lower.
Optionally, as shown in fig. 6, the first data includes a first parameter set, and a parameter value of each parameter in the first parameter set.
The rule file based decision system 600 further comprises:
a query module 601, configured to query, according to a first preset table, a parameter format and an operation instruction corresponding to the first operation command before the decision module 503 decides on the first data by using the first rule file, where the first preset table stores an operation command set and a parameter format and an operation instruction corresponding to each operation command in the operation command set;
a checking module 602, configured to check whether the first data conforms to a parameter format corresponding to the first operation command;
a processing module 603, configured to process the first data according to the operation instruction when it is determined that the first data conforms to a parameter format corresponding to the first operation command.
Further, optionally, the parameter format corresponding to the first operation command includes a field name set; the checking module 602 is specifically configured to check whether the first parameter set includes a field name set corresponding to the first operation command, and if so, determine that the first data conforms to a parameter format corresponding to the first operation command.
Or, optionally, the parameter format corresponding to the first operation command further includes a field length limit of each field name in the field name set; the checking module 602 is specifically configured to, when it is determined that the first parameter set includes a field name set corresponding to the first operation command, check whether a length of a parameter value of each field name in the first data does not exceed a field length limit of the field name, and if so, determine that the first data conforms to a parameter format corresponding to the first operation command.
Optionally, the processing module 603 is further configured to, when it is determined that the first data does not conform to the parameter format corresponding to the first operation command, stop the operation on the first data, and prompt that an error occurs.
Optionally, the operation instruction corresponding to the first operation command includes a field type of each field name in the field name set, where the field type is used to indicate whether the field name is required for the first rule file decision.
The processing module 603 is specifically configured to determine a core field name set according to a field type corresponding to a field name in the first data, where the core field name set includes the field name required for the first rule file decision in the first data;
the decision module 503 is specifically configured to perform a decision on parameter values of the field names in the decision field name set by using the first rule file, and when the parameter values of the field names in the decision field name set satisfy a first condition, return a first decision result.
Optionally, the operation instruction corresponding to the first operation command includes a warehousing instruction of each field name in the field name set, where the warehousing instruction is used to instruct whether to store the field name in a database; the processing module 603 is specifically configured to store the parameter value of the field name in a database when the entry indication corresponding to the field name in the first data is used to indicate that the field name is stored in data.
Optionally, the determining module 502 is specifically configured to query, according to a preset rule file access protocol table, a rule file access path and a rule file interface credential corresponding to the first operation command, where an operation command set and a rule file access path and a rule file interface credential corresponding to each operation command in the operation command set are stored in the preset rule file access protocol table; and determining a first rule file corresponding to the first operation command according to the rule file access path and the rule file interface certificate.
Optionally, as shown in fig. 7, the rule-file-based decision system 700 further includes:
the entry module 701 is configured to query, after a first decision result is returned, an entry path corresponding to the first operation command according to a second preset table, where the entry path includes a database name, a table name, and a sub-database and sub-table manner, and the second preset table stores an operation command set and a database name, a table name, and a sub-database and sub-table manner corresponding to each operation command in the operation command set; and storing the first data and the decision result into a database according to the input path.
For the explanation description of the decision system based on the rule file, reference may be made to the explanation description of the embodiments shown in fig. 1 to fig. 4, which is not repeated herein.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (18)

1. A decision method based on a rule file is characterized by comprising the following steps:
acquiring a first operation command and first data;
inquiring a rule file access path and a rule file interface certificate corresponding to the first operation command according to a preset rule file access protocol table, and assembling access parameters of the first data, the rule file access path and the rule file interface certificate, wherein an operation command set and the rule file access path and the rule file interface certificate corresponding to each operation command in the operation command set are stored in the preset rule file access protocol table;
determining a first rule file according to the rule file access path and the rule file interface certificate in the access parameters, wherein the structure of the first rule file only comprises a rule language;
and adopting the first rule file to make a decision on at least part of the first data in the access parameters, and returning a first decision result when the at least part of the first data meets a first condition.
2. The rule-file based decision method of claim 1, wherein the first data comprises a first set of parameters, and a parameter value for each parameter in the first set of parameters;
the deciding, by using the first rule file, at least part of the first data in the access parameters, previously includes:
querying a parameter format and an operation instruction corresponding to the first operation command according to a first preset table, wherein an operation command set and a parameter format and an operation instruction corresponding to each operation command in the operation command set are stored in the first preset table;
checking whether the first data conforms to a parameter format corresponding to the first operation command;
and when the first data is determined to accord with the parameter format corresponding to the first operation command, processing the first data according to the operation instruction.
3. The rule-file-based decision method according to claim 2, wherein the parameter format corresponding to the first operation command comprises a field name set;
the checking whether the first data conforms to a parameter format corresponding to the first operation command includes:
and checking whether the first parameter set contains a field name set corresponding to the first operation command, and if so, determining that the first data conforms to a parameter format corresponding to the first operation command.
4. The rule-file-based decision method according to claim 3, wherein the parameter format corresponding to the first operation command further comprises a field length limit for each field name in the field name set;
the checking whether the first data conforms to a parameter format corresponding to the first operation command further includes:
when the first parameter set is determined to contain the field name set corresponding to the first operation command, checking whether the length of the parameter value of each field name in the first data does not exceed the field length limit of the field name, and if so, determining that the first data conforms to the parameter format corresponding to the first operation command.
5. The rule-file based decision method according to claim 3 or 4, wherein the method further comprises:
and when the first data is determined not to conform to the parameter format corresponding to the first operation command, stopping the operation on the first data and prompting that an error occurs.
6. The rule file based decision method according to claim 3, wherein the operation indication corresponding to the first operation command comprises a field type of each field name in the field name set, and the field type is used for indicating whether the field name is required for the first rule file decision;
the processing the first data according to the operation instruction comprises:
determining a core field name set according to a field type corresponding to the field name in the first data, wherein the core field name set comprises the field name required by the first rule file decision in the first data;
the making a decision on at least part of the first data by using the first rule file, and returning a first decision result when the at least part of the first data meets a first condition specifically includes:
adopting the first rule file to make a decision on parameter values of field names in a decision field name set;
and when the parameter values of the field names in the decision field name set meet a first condition, returning a first decision result.
7. The rule-file-based decision method according to claim 3 or 6, wherein the operation indication corresponding to the first operation command comprises a warehousing indication of each field name in the field name set, and the warehousing indication is used for indicating whether the field name is stored in a database;
the processing the first data according to the operation instruction comprises:
and when the warehousing indication corresponding to the field name in the first data is used for indicating that the field name is stored in the data, storing the parameter value of the field name into a database.
8. The rule-file-based decision method according to claim 1, wherein the returning a first decision result further comprises:
inquiring an entry path corresponding to the first operation command according to a second preset table, wherein the entry path comprises a database name, a table name and a database-dividing and table-dividing mode, and the second preset table stores an operation command set and the database name, the table name and the database-dividing and table-dividing mode corresponding to each operation command in the operation command set;
and storing the first data and the decision result into a database according to the input path.
9. A rule file based decision system, comprising:
the acquisition module is used for acquiring a first operation command and first data;
the determining module is used for querying a rule file access path and a rule file interface certificate corresponding to the first operation command according to a preset rule file access protocol table, and assembling access parameters of the first data, the rule file access path and the rule file interface certificate, wherein an operation command set and the rule file access path and the rule file interface certificate corresponding to each operation command in the operation command set are stored in the preset rule file access protocol table;
determining a first rule file according to the rule file access path and the rule file interface certificate in the access parameters, wherein the structure of the first rule file only comprises a rule language;
and the decision module is used for deciding at least part of the first data in the access parameters by adopting the first rule file, and returning a first decision result when the at least part of the first data meets a first condition.
10. The rule-file based decision system of claim 9 wherein the first data comprises a first set of parameters and a parameter value for each parameter in the first set of parameters;
the rule file based decision system further comprises:
the query module is configured to query a parameter format and an operation instruction corresponding to the first operation command according to a first preset table before the decision module makes a decision on the first data by using the first rule file, where the first preset table stores an operation command set and a parameter format and an operation instruction corresponding to each operation command in the operation command set;
the checking module is used for checking whether the first data accords with a parameter format corresponding to the first operation command;
and the processing module is used for processing the first data according to the operation instruction when the first data is determined to accord with the parameter format corresponding to the first operation command.
11. The rule-file based decision system of claim 10 wherein the parameter format to which the first operation command corresponds comprises a set of field names;
the checking module is specifically configured to check whether the first parameter set includes a field name set corresponding to the first operation command, and if so, determine that the first data conforms to a parameter format corresponding to the first operation command.
12. The rule-file based decision system of claim 11 wherein the parameter format to which the first operation command corresponds further comprises a field length limit for each field name in the set of field names;
the checking module is specifically configured to, when it is determined that the first parameter set includes a field name set corresponding to the first operation command, check whether a length of a parameter value of each field name in the first data does not exceed a field length limit of the field name, and if so, determine that the first data conforms to a parameter format corresponding to the first operation command.
13. The rule-file-based decision system according to claim 11 or 12, wherein the processing module is further configured to stop the operation on the first data and prompt an error when it is determined that the first data does not conform to the parameter format corresponding to the first operation command.
14. The rule file-based decision system according to claim 11, wherein the operation indication corresponding to the first operation command comprises a field type of each field name in the field name set, the field type being used to indicate whether the field name is required for the first rule file decision;
the processing module is specifically configured to determine a core field name set according to a field type corresponding to a field name in the first data, where the core field name set includes the field name required for the decision of the first rule file in the first data;
the decision module is specifically configured to perform a decision on parameter values of the field names in the decision field name set by using the first rule file, and return a first decision result when the parameter values of the field names in the decision field name set satisfy a first condition.
15. The rule-file-based decision system according to claim 11 or 14, wherein the operation indication corresponding to the first operation command comprises a warehousing indication of each field name in the field name set, the warehousing indication being used for indicating whether the field name is stored in a database;
the processing module is specifically configured to store a parameter value of the field name in a database when the entry indication corresponding to the field name in the first data is used to indicate that the field name is stored in data.
16. The rule-file based decision system of claim 9, further comprising:
the entry module is used for querying an entry path corresponding to the first operation command according to a second preset table after a first decision result is returned, wherein the entry path comprises a database name, a table name and a database-based sub-table mode, and the second preset table stores an operation command set and the database name, the table name and the database-based sub-table mode corresponding to each operation command in the operation command set; and storing the first data and the decision result into a database according to the input path.
17. A computer storage medium, wherein a computer program is stored in the computer storage medium; the computer program is for executing the rule-file based decision method according to any one of claims 1 to 8.
18. A server, comprising: a memory and a processor;
the memory is used for storing a computer program;
the processor is configured to execute a computer program stored in the memory;
the computer program is for performing the rule file based decision method of any one of claims 1 to 8.
CN201610071299.9A 2016-02-01 2016-02-01 Decision method and system based on rule file Active CN107025102B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610071299.9A CN107025102B (en) 2016-02-01 2016-02-01 Decision method and system based on rule file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610071299.9A CN107025102B (en) 2016-02-01 2016-02-01 Decision method and system based on rule file

Publications (2)

Publication Number Publication Date
CN107025102A CN107025102A (en) 2017-08-08
CN107025102B true CN107025102B (en) 2020-10-16

Family

ID=59524512

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610071299.9A Active CN107025102B (en) 2016-02-01 2016-02-01 Decision method and system based on rule file

Country Status (1)

Country Link
CN (1) CN107025102B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108038665B (en) * 2017-12-08 2020-01-24 平安科技(深圳)有限公司 Business rule management method, device, equipment and computer readable storage medium
CN109086031B (en) * 2018-06-28 2022-08-05 创新先进技术有限公司 Business decision method and device based on rule engine
CN110737439B (en) * 2019-10-18 2022-07-22 四川长虹电器股份有限公司 Equipment control system and method based on rule file
CN115511596B (en) * 2022-09-02 2023-09-19 杭州榜置科技有限公司 Credit verification evaluation management method and system for auxiliary decision

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739881A (en) * 2011-04-01 2012-10-17 中兴通讯股份有限公司 Method for carrying out summarizing after conversation and apparatus thereof
CN103268228A (en) * 2013-05-28 2013-08-28 上海林康医疗信息技术有限公司 Middleware applied to medical behavior supervisory platform

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030046665A1 (en) * 2001-02-28 2003-03-06 Thomas Ilin Reusable software component for textually supplementing, modifying, evaluating and processing procedural logic for a compiled host program at run-time
CN1329818C (en) * 2002-11-14 2007-08-01 中兴通讯股份有限公司 Implement method of the man machine command based on plain text command script files
CN103927174A (en) * 2014-04-17 2014-07-16 北京视博数字电视科技有限公司 Service processing method and device
CN104572122B (en) * 2015-01-28 2018-04-27 中国工商银行股份有限公司 A kind of generating means and method of software application data
CN105630617A (en) * 2015-12-28 2016-06-01 山东中创软件工程股份有限公司 Business processing method and system based on rule engine

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739881A (en) * 2011-04-01 2012-10-17 中兴通讯股份有限公司 Method for carrying out summarizing after conversation and apparatus thereof
CN103268228A (en) * 2013-05-28 2013-08-28 上海林康医疗信息技术有限公司 Middleware applied to medical behavior supervisory platform

Also Published As

Publication number Publication date
CN107025102A (en) 2017-08-08

Similar Documents

Publication Publication Date Title
CN110069449B (en) File processing method, device, computer equipment and storage medium
CN107025102B (en) Decision method and system based on rule file
CN103618794B (en) Method, terminal and the server of automated log on
CA3139243A1 (en) Information collection method, device, computer equipment and storage medium
CN107908695A (en) Operation system operation method, device, system and readable storage medium storing program for executing
CN104750872A (en) Method and device for searching service object
CN105488125A (en) Page access method and apparatus
CN104424202A (en) Method and system for performing duplication checking on customer information in customer relationship management (CRM) system
KR102060262B1 (en) Method and apparatus for recognizing service request for changing mobile phone number
CN104408118A (en) Database establishing method and device
CN101763593A (en) Method and device for realizing audit log of system
CN108933789A (en) A kind of method and third-party application server preventing personal information leakage
CN112800197A (en) Method and device for determining target fault information
CN114356898A (en) Data storage method and device, electronic equipment and storage medium
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN108234122A (en) Token method of calibration and device
CN111343348A (en) Application method, system, device and storage medium of interactive voice response menu
US20150140957A1 (en) Prepaid phone card charging
CN112084199A (en) Scene-based general parameter maintenance method and device
CN110912901A (en) Application login verification method, device and system
EP1569405A1 (en) Technique for creation and linking of communications network user accounts
CN114254371A (en) Data permission processing method and device and server
CN114255134A (en) Account number disassembling method and device and storage medium
CN110417851B (en) Data matching method, hosting platform, storage medium and computer equipment
CN113674083A (en) Internet financial platform credit risk monitoring method, device and computer system

Legal Events

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