CN117008878A - Rule generation method, device, equipment and storage medium - Google Patents

Rule generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN117008878A
CN117008878A CN202310990278.7A CN202310990278A CN117008878A CN 117008878 A CN117008878 A CN 117008878A CN 202310990278 A CN202310990278 A CN 202310990278A CN 117008878 A CN117008878 A CN 117008878A
Authority
CN
China
Prior art keywords
rule
business
package
business rule
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310990278.7A
Other languages
Chinese (zh)
Inventor
刘光胜
黄粲
朱文生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Merchants Bank Co Ltd
Original Assignee
China Merchants 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 China Merchants Bank Co Ltd filed Critical China Merchants Bank Co Ltd
Priority to CN202310990278.7A priority Critical patent/CN117008878A/en
Publication of CN117008878A publication Critical patent/CN117008878A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/10Requirements analysis; Specification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a rule generation method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring the service requirement of a user; determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files; and converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so as to be called by related personnel in real time. The application improves the service processing efficiency.

Description

Rule generation method, device, equipment and storage medium
Technical Field
The present application relates to the field of rule engine technologies, and in particular, to a rule generating method, device, apparatus, and storage medium.
Background
In the service system, the service processing scenes are various, and after the service system receives the service demands of users, the service system processes various input service parameters by calling rules related to the service demands, so as to obtain processing results.
At present, most business systems complete business processing based on a Drools rule engine, when a rule is called, corresponding data variables and rule text data are required to be loaded first, then the rule text data are converted into rule script files, the rule can be called and executed after compiling is successful, and when the associated data variables are more, the loading and compiling time of the rule is longer, so that the business processing efficiency is low.
Disclosure of Invention
The application mainly aims to provide a rule generation method, a device, equipment and a storage medium, and aims to solve the technical problems that in the related art, when rule text data are converted into rule script files and then compiled into corresponding rule files, when associated data variables are more, the loading and compiling time of rules is longer, and the service processing efficiency is low.
In order to achieve the above object, an embodiment of the present application provides a rule generating method, including:
acquiring the service requirement of a user;
determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
and converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so as to be called by related personnel in real time.
In one possible implementation manner of the present application, the step of converting the service rule package to obtain a service rule file includes:
determining rule set files and data variables associated with the rule sets according to the dependency relationship between the business rule packages and the rule sets;
and compiling the rule set file and the data variable based on a preset rule engine to obtain a business rule file.
In one possible implementation manner of the present application, after the step of converting the service rule package to obtain the service rule file, the method further includes:
storing the business rule file in a preset script instance according to the rule identifier corresponding to the business rule package;
and processing the service parameters corresponding to the service requirements based on the preset script instance to obtain a service processing result.
In a possible implementation manner of the application, when the version state of the business rule file is changed, rule contents in the preset script instance are updated in real time, so that related personnel can call the preset script instance in real time.
In one possible implementation manner of the present application, after the step of storing the business rule file in a preset script instance according to the rule identifier corresponding to the business rule package, the method includes:
acquiring first change information of a business rule packet in a preset time period;
and according to the first change information, determining to load or unload the preset script instance.
In one possible embodiment of the present application, the first change information includes load change information and unload change information;
the step of determining to load or unload the preset script instance according to the first change information includes:
rule generation, namely reloading the preset script instance if the loading change information shows that the change record of the preset script instance does not exist;
or,
if the loading change information shows that the version identification of the preset script instance is different from that in the change record, reloading the preset script instance;
and if the unloading change information shows that the change time is earlier than the unloading record time in the change record, directly unloading the preset script instance.
In one possible embodiment of the present application, the step of determining a service rule packet to be executed according to the service requirement includes:
acquiring rule information of a plurality of rule packages in a preset database;
and filtering the plurality of rule packages based on the association information between the rule information and the service requirement to obtain the service rule package to be executed.
The application also provides a rule generating device, which further comprises:
the acquisition module is used for acquiring the service requirement of the user;
the determining module is used for determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
the conversion module is used for converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so that related personnel can call the preset script instance in real time.
The application also provides a rule generating device, which is entity node device, comprising: the system comprises a memory, a processor and a program of the rule generating method stored on the memory and executable on the processor, wherein the program of the rule generating method can realize the steps of the rule generating method when being executed by the processor.
In order to achieve the above object, there is also provided a storage medium having stored thereon a rule generation program which, when executed by a processor, implements the steps of any one of the rule generation methods described above.
The application provides a rule generating method, a device, equipment and a storage medium, compared with the prior art, when rule text data are converted into rule script files and then compiled into corresponding rule files, when associated data variables are more, the loading and compiling time of the rules is longer, so that the service processing efficiency is lower, and compared with the service processing efficiency, the service requirements of users are acquired in the application; determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files; and converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so as to be called by related personnel in real time. In the application, the business rule package to be executed is determined according to the business requirement of the user, and because the business rule package comprises a plurality of compiled rule script files, the rule text data do not need to be converted into corresponding script files, and the obtained business rule files are stored in the preset script instance, so that the preset script instance can be conveniently called in real time according to the business requirement, thereby saving the whole rule calling and compiling time and improving the business processing efficiency.
Drawings
FIG. 1 is a flow chart of a first embodiment of a rule generating method of the present application;
FIG. 2 is a schematic diagram of a system architecture involved in the rule generation method of the present application;
FIG. 3 is a schematic diagram of a device architecture of a hardware operating environment according to an embodiment of the present application;
FIG. 4 is a flow chart of precompilation and caching of the rule generating method of the present application;
fig. 5 is a flow chart of a timed task process involved in the rule generation method of the present application.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
An embodiment of the present application provides a rule generating method, in a first embodiment of the rule generating method of the present application, referring to fig. 1, the method includes:
step S10, obtaining the service requirement of a user;
step S20, determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
and step S30, converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so that related personnel can call the preset script instance in real time.
The present embodiment aims at: compiling a plurality of rule script files, converting rule text data into corresponding script files again is not needed, and the obtained business rule files are stored in a preset script instance, so that the preset script instance can be conveniently invoked in real time according to business requirements, the whole rule invoking and compiling time is saved, and the business processing efficiency is improved.
The method comprises the following specific steps:
step S10, obtaining the service requirement of a user;
as an example, the rule generating method may be applied to a rule generating apparatus belonging to a rule generating system belonging to a rule generating device.
As an example, the service requirement may be a requirement corresponding to a service that the user needs to transact, and the service requirement further includes a corresponding service parameter.
As an example, the rule generation method may also be applied to Drools (open source rule engine) or a service management platform, where the rule engine may release complex and variable service rules from hard coding, store them in a file or in a specific storage medium in the form of rule scripts, and Drools rule execution involves two parts: the input and output data of the rule and the specific judgment logic of the rule are defined as face objects, the face objects need to be created when the rule is used, the specific judgment logic of the rule needs to be stored in a rule script file of Drools, and the file format suffix is drl.
As an example, the drl rule script file main information includes: package packet path, import face information, rule body (array), LHS condition part, RHS result part.
As an example, the service data may be service parameters or data related to a service to be handled by the user, or the like.
As an example, a schematic system structure diagram of the rule generating method is shown in fig. 2, where a Web module is provided as a front end to a user to perform maintenance and rule visualization configuration of service rule related resources; the Bus module is used as a back end to be responsible for storing relevant resource information of the business rule; the Core module is used as a Core processing module to analyze the visual configuration message, generate a Drools rule, and in the interaction process, the web module is used as a front end to interact with the service data of the user and visually display the service data.
As an example, the web module applies common scenario requirements according to resources required by the Drools rule and the rule, including the functions of: space management, decision management, data variables, data constants, API services, rule sets, and release management.
As one example, the functions of space management include: the space is a top-level catalog of related resources for managing service rules, various service systems can create a resource management catalog belonging to the service systems by a mode of creating a space by a user, effectively manage the resources under the name, the space name is unique to a whole platform, different service systems can not create the same space, and after the space is newly added, the space information is stored in a background MySQL database space information table.
As one example, the functions of decision management include: the decision is a secondary catalog for managing relevant resources of the business rules, each decision is affiliated to a space, the relevant resources of the business rules are directly managed in the decision, after the space is created by various business systems, business rules can be classified according to the system conditions of the business systems, corresponding decisions are created, the decision names are unique to the whole platform, different business systems can not create the same decisions, and after the decisions are newly added, the decisions are stored in a background MySQL database decision information table.
As one example, the functions of the data variables include: the Fact object management is that a data variable management function is provided under decision; the business system can be used for carrying out new addition on data variable management after designing corresponding data entities by inducing input and output data of business rules, the data variables only need to be unique under decision, different business systems can create homonymous data variables under respective decisions and do not conflict with each other to cover, and the newly added data variables need to fill in entity class names, namely Java class names, entity names and field information, wherein the field information comprises Java field names, field descriptions and field types; the field types are fixed as Java specific data types, wherein the field types comprise 8 types of String, digital Double, date, boolean database, big number BigDecimal, character set List < String >, digital set List < Double >, big number set List < BigDecimal >, and after the data variable is newly added, the data variable information table of the background MySQL database is stored.
As one example, the functions of the data constants include: the method comprises the steps that a plurality of rules in the bank comprise the use of various code information, such as common world name codes, common region name codes, common national and regional code, common national and economic industry classification and codes used for public customer information, common occupation classification and codes used for individual customers, and the like, aiming at the information, a data constant management function is provided under decision, and a business system can input various codes as constants for visual configuration of subsequent business rules. And the data constant is consistent with the control of the data variable, only the data constant is needed to be unique under the decision, the new data constant is needed to be filled with a constant name, a constant description, a constant value and a value description, and after the data constant is newly added, the data constant is stored in a data constant information table of a background MySQL database.
As one example, the functions of the API service include: the method and the system support custom functions in Drools, and support the visualized configuration of RHS part of rule to call API service by realizing function of automatically generating call functions, and provide API service function under decision aiming at the characteristic, a business system can register the API interface required to be called for the visualized configuration of the follow-up business rule, and the data constant is consistent with the control of data variable, and only needs to be needed under decision, and newly added API service needs to fill in service name, http request address, request header, url parameter, body parameter and interface return template. The request header, url parameters, body parameters and the interface return template only need to fill in the format and default values, and all support personalized parameter configuration in the follow-up visual configuration.
As one example, the functions of the decision tree include: the decision tree function provides a decision tree management function, and can enter a decision tree visual configuration page through a design function to perform maintenance operation of a decision tree, wherein the decision tree design provides functions of setting and saving, decision tree source files, quick testing, association entities, association constants, association APIs and the like; the decision tree editing page provides functions of deleting nodes, adding condition nodes, adding action nodes, editing rules, adding operations and the like.
As one example, the functions of the bus module include: 1. providing a space management interface, and storing the newly added space into a MySQL database space information table; 2. providing a decision management interface, and storing the newly added decisions and the upper space thereof into a MySQL database decision information table; 3. providing a data variable interface, calling a Core module to generate Java class definition information according to the decision and the data variable information sent by Web, and storing the Java class definition information in a MySQL database data variable information table; 4. providing a data variable interface, calling a Core module to generate Java class definition information according to the decision and the data variable information sent by Web, and storing the Java class definition information in a MySQL database data variable information table; 5. providing an API interface, and storing newly added APIs and decision information thereof into an API information table of a MySQL database; 6. providing a decision tree interface, and storing the newly added decision tree and the decision information thereof into a MySQL database rule set information table; storing the association relation between the decision tree and the data variable, the data constant and the API service into a MySQL database rule set resource dependency relation table; the Core module is invoked to generate drl script definition information.
As an example, the rule set, i.e. drl file, provides a management function of service rules, and the rule set function can enter a rule visualization configuration page through a rule design function of the rule set to perform maintenance operation of the service rules, the rule design provides functions of setting and saving, viewing source files, quick testing, association entities, association constants, association APIs and the like, and the specific rule body editing provides functions of Drools advanced attribute setting, LHS condition part tree form expansion configuration, RHS result part list form expansion and the like.
As an example, the release management, i.e. business rule package/release package, the business rule package is used to package rule sets, and the business system does not access the rule sets directly any more when invoking business rules, but rather indirectly through the business rule package. A plurality of rule set files can be added in a business rule package, a history version which can be called is generated through a version release mode after the association, the release package can specify a default version and an enabling version, wherein the default version is only a business rule package id which is sent when a business system calls rules, a background default selects the version of the business rule package which is executed, the enabling version is a version which can be called by the business rule package, and the control can only be set to 3 at most and comprises the default version.
As an example, the Core module is configured to generate Java class definition information, after defining the following data structure JavaJsonJavaDto to be used for representing data variable information, the Web module sends up the Java class definition information according to the splicing field information of the data structure, and the Bus module forwards the request, and the Core module parses the Java class definition information and returns the Java class definition information to the Bus module for storage.
As an example, the Core module is further used for rule precompilation caching, and is responsible for precompiling the specified business rule at the time of starting, and caching KIE entities (hereinafter, preset script examples) generated after precompilation into a module memory for the call of a subsequent business system; and the method is also used for updating the cache of the entity KIE through a timing task, and keeping KIE the entity consistent with the latest logic of the current business rule.
Step S20, determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
as an example, different business requirements correspond to different business rules, and when the business requirements are determined, the corresponding business rule package can be directly obtained from the database according to the business requirements.
As an example, the business rule package is a rule script file obtained after the rule text data is converted, and the rule script file is converted when being compiled, so that the compiling time is saved.
The step of determining the service rule package to be executed according to the service requirement comprises the following steps:
step S201, obtaining rule information of a plurality of rule packages in a preset database;
as an example, the preset database is a database at the back end of the system, and the preset database includes a plurality of rule packages, where each rule package corresponds to different information such as identification and version.
Step S202, filtering the rule packets based on the association information between the rule information and the service requirement to obtain the service rule packet to be executed.
As an example, the association information may be a correspondence between a service parameter corresponding to a service requirement and each rule identifier, and when the service rule package is obtained, since the service rule package includes a plurality of rule script files, the rule script files of irrelevant service requirements in the service rule package need to be filtered to obtain the required rule script files.
And step S30, converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so that related personnel can call the preset script instance in real time.
As an example, in the process of converting the business rule package, by creating a script instance, a Java class file of a data variable and a rule script file are written in the created script instance, so as to obtain a corresponding business rule file.
The step of converting the business rule package to obtain a business rule file comprises the following steps:
step S301, determining rule set files and data variables associated with the rule sets according to the dependency relationship between the business rule packages and the rule sets;
as an example, the rule set is a set formed by multiple rules, the rule set file information associated with the service rule set is queried according to the dependency relationship between the service rule set and the rule set, drl rule script file content is obtained from the drl format file content field of the rule set file record, and further, the Java format object field of the data variable record is obtained from the Java class file content of the data variable according to the rule set dependency resource relationship query rule set associated data variable information.
Step S302, compiling the rule set file and the data variable based on a preset rule engine to obtain a business rule file.
As an example, the preset rule engine may be a Drools rule engine, compiling is performed by calling an API interface provided by Drools, a KIE file system catalog kieFilesystem (kie file system) instance is created first, then the obtained drl rule script file and Java class file of the data variable are written into the instance, and finally a KIE entity constructor kieBuilder instance is created to perform compiling construction to obtain the business rule file.
After the step of converting the business rule package to obtain the business rule file, the method further comprises the following steps:
a1, storing the business rule file in a preset script instance according to a rule identifier corresponding to the business rule package;
as an example, in the storage process, according to the rule identifier corresponding to the service rule packet, a thread security instance residing in the memory is used as a cache carrier, and the KIE entity generated after the compiling is successful is stored according to the format that the service rule packet id and the service rule packet version number connection string is key, and the KIE entity is value.
As an example, the construction process is continuously cycled through the process of generating business rule packages until all enabled business rule packages have been compiled and cached.
As an example, the pre-set script instance may be a kie entity, wherein the pre-set script instance is used to store business rule packages.
As an example, a flow chart of precompiled and cached in the method is shown in fig. 4, where the publishing packet in fig. 4 is a service rule packet, and whether the publishing packet is enabled is determined by querying a usage record of the publishing packet, so as to obtain rule set information and data variable information, complete a process of compiling rules and constructing examples by a drools rule engine, and cache the compiled service rule file in a preset script example.
And step A2, processing the service parameters corresponding to the service requirements based on the preset script instance to obtain a service processing result.
As an example, in the process of performing service processing, service parameters corresponding to service requirements are processed through a preset script instance, so as to obtain a service processing result.
The application provides a rule generating method, a device, equipment and a storage medium, compared with the prior art, when rule text data are converted into rule script files and then compiled into corresponding rule files, when associated data variables are more, the loading and compiling time of the rules is longer, so that the service processing efficiency is lower, and compared with the service processing efficiency, the service requirements of users are acquired in the application; determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files; and converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so as to be called by related personnel in real time. In the application, the business rule package to be executed is determined according to the business requirement of the user, and because the business rule package comprises a plurality of compiled rule script files, the rule text data do not need to be converted into corresponding script files, and the obtained business rule files are stored in the preset script instance, so that the preset script instance can be conveniently called in real time according to the business requirement, thereby saving the whole rule calling and compiling time and improving the business processing efficiency.
Further, based on the first embodiment of the present application, another embodiment of the present application is provided, in this embodiment, when the version status of the business rule file changes, rule contents in the preset script instance are updated in real time, so that related personnel can call the preset script instance in real time.
As an example, the version status of the business rule file may be divided into three types, a default version, an enabled version, and a history version, where the default version is a version of the business rule package that the system defaults to select to execute, the enabled version is a version that the business rule package can call, and the history version is a version of the rule package that has been called.
As an example, the rule calling process is completed through a preset script instance stored by the business rule, and when the rule is called in real time, the cached rule information needs to be updated under the following three conditions, so that the problem of calling errors is avoided.
As an example, in the case of release of a new version, if the version of the service rule file that has been called is in the overlay release state, it indicates that the content of the current version is modified, and at this time, the preset script instance cached in the system needs to be modified and recompiled, so as to avoid inconsistent logic.
As an example, in the pre-compiling caching process after the rule is invoked, redundant storage is performed in the memory for the current default version, for example, the default version is switched, and the redundant storage in the corresponding cache is also modified and kept consistent, so that the version is prevented from being invoked by mistake.
As an example, during the running process of the related module, if disabling of the enabled version or enabling of other versions occurs, the cache needs to perform synchronous deletion and adding of KIE entities, so that unnecessary resource occupation is avoided.
In this embodiment, the rule in the preset script instance is updated in real time, so as to avoid the occurrence of calling errors.
Further, based on the first embodiment and the second embodiment of the present application, another embodiment of the present application is provided, in this embodiment, after the step of storing the business rule file in a preset script instance according to the rule identifier corresponding to the business rule package, the method includes:
step B1, obtaining first change information of a business rule packet in a preset time period;
as an example, the preset period may be 1 minute, 5 minutes, or the like, and may be changed according to the needs of the user, which is not particularly limited.
As one example, the first change information may be a load cache start time, an unload cache start time, and associated registration unload record information.
As an example, the reason for loading and unloading script instances is to update the corresponding rule scripts in real time, thereby ensuring that rule calls are normal.
And B2, determining to load or unload the preset script instance according to the first change information.
As one example, a MySQL database published package change registry is accessed by a timing task, change information of recently published packages is queried, and loading and unloading of caches is performed.
Wherein the first change information includes load change information and unload change information;
the step of determining to load or unload the preset script instance according to the first change information includes:
step C1, rule generation, wherein if the loading change information shows that the change record of the preset script instance does not exist, the preset script instance is reloaded;
as an example, the load change information may be a load cache start time and a cache update type, and the relevant change registration record is obtained according to the load cache start time and the cache update type.
As an example, the release package id+release package version number of the record caches a preset script instance for the key query KIE entity, if the record does not exist, which indicates that the cache is not loaded and needs to be loaded.
As an example, a record exists but the change version number of the KIE entity in the cache is consistent with the record, indicating that it has been loaded in a previous execution of a timed task, this time without reloading.
Or,
step C2, reloading the preset script instance if the loading change information shows that the version identification of the preset script instance is different from that in the change record;
as an example, if the change version number does not coincide with the version number in the acquired related record, a reload is required.
As an example, for the entity KIE to be loaded, the latest resource is pulled first and then compiled, the created entity KIE is reset to the script instance cached by the entity KIE to perform the new addition or coverage processing, and if the version number of the release packet of the record is the current default version of the release packet, the new addition or coverage of the default version of the script instance is also required to be synchronized.
And step C3, if the unloading change information shows that the change time is earlier than the unloading record time in the change record, directly unloading the preset script instance.
As an example, when determining whether to offload a preset script instance, an offload record is queried and then a determination is made as to whether offload is required.
As an example, the release package change registry is queried according to the conditions that the creation time stamp of the record to be unloaded, which is queried in the last execution, is the unloading cache starting time, and the cache update type is the uninstalling-unloading, so as to acquire the related record.
As an example, according to the release package and version number of the record, the KIE entity is queried to cache the script instance, if the record does not exist, the script instance is successfully unloaded, and the unloading is not needed at this time; if the record exists, comparing the change time of the KIE entity record, if the change time is earlier than the change time of the unloading record, directly unloading, and if the change time is later than the change time of the unloading record, the unloading record is reloaded after being unloaded, and the unloading is impossible, wherein the specific loading and unloading flow is shown in fig. 5.
As an example, unloading is performed according to the judgment result, and deleting operation is performed on the business rule in the preset script instance.
In this embodiment, the service rule file is ensured to be updated in real time by loading and unloading the service rule in the currently invoked preset script instance.
Referring to fig. 3, fig. 3 is a schematic device structure diagram of a hardware running environment according to an embodiment of the present application.
As shown in fig. 3, the rule generating apparatus may include: a processor 1001, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to enable connected communication between the processor 1001 and the memory 1005.
Optionally, the rule generating device may further include a user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, a WiFi module, and the like. The user interface may include a Display, an input sub-module such as a Keyboard (Keyboard), and the optional user interface may also include a standard wired interface, a wireless interface. The network interface may include a standard wired interface, a wireless interface (e.g., WI-FI interface).
Those skilled in the art will appreciate that the rule generating device structure shown in fig. 3 does not constitute a limitation of the rule generating device and may include more or fewer components than shown, or may combine certain components, or may be arranged in a different arrangement of components.
As shown in fig. 3, an operating system, a network communication module, and a rule generation program may be included in the memory 1005 as one type of storage medium. An operating system is a program that manages and controls the hardware and software resources of the rule-generating device, supporting the execution of the rule-generating program and other software and/or programs. The network communication module is used to enable communication between components within the memory 1005 and other hardware and software in the rule generation system.
In the rule generating device shown in fig. 3, a processor 1001 is configured to execute a rule generating program stored in a memory 1005, and implement the steps of the rule generating method described in any one of the above.
The specific implementation manner of the rule generating device of the present application is basically the same as that of each embodiment of the rule generating method, and will not be repeated here.
The application also provides a rule generating device, which further comprises:
the first acquisition module is used for acquiring the service requirement of the user;
the first determining module is used for determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
the conversion module is used for converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so that related personnel can call the preset script instance in real time.
In one possible embodiment of the present application, the conversion module includes:
the determining unit is used for determining a rule set file and a data variable associated with the rule set according to the dependency relationship between the business rule packet and the rule set;
and the compiling unit is used for compiling the rule set file and the data variable based on a preset rule engine to obtain a business rule file.
In one possible embodiment of the present application, the rule generating apparatus further includes:
the storage module is used for storing the business rule file in a preset script instance according to the rule identifier corresponding to the business rule packet;
and the processing module is used for processing the service parameters corresponding to the service requirements based on the preset script instance to obtain a service processing result.
In one possible embodiment of the present application, the rule generating apparatus further includes:
the second acquisition module is used for acquiring the first change information of the business rule packet in a preset time period;
and the second determining module is used for determining to load or unload the preset script instance according to the first change information.
In one possible embodiment of the present application, the second determining module includes:
the first loading unit is used for regularly generating and reloading the preset script instance if the loading change information shows that the change record of the preset script instance does not exist;
or,
the second loading unit is used for reloading the preset script instance if the loading change information shows that the version identification of the preset script instance is different from that in the change record;
and the unloading unit is used for directly unloading the preset script instance if the unloading change information shows that the change time is earlier than the unloading record time in the change record.
In one possible embodiment of the present application, the first determining module includes:
the acquisition unit is used for acquiring rule information of a plurality of rule packages in a preset database;
and the filtering unit is used for filtering the plurality of rule packets based on the association information between the rule information and the service requirement to obtain the service rule packet to be executed.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. A method of rule generation, the method comprising the steps of:
acquiring the service requirement of a user;
determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
and converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so as to be called by related personnel in real time.
2. The rule generating method according to claim 1, wherein the step of converting the business rule package to obtain a business rule file comprises:
determining rule set files and data variables associated with the rule sets according to the dependency relationship between the business rule packages and the rule sets;
and compiling the rule set file and the data variable based on a preset rule engine to obtain a business rule file.
3. The rule generating method according to claim 2, wherein after the step of converting the business rule package to obtain the business rule file, the method further comprises:
storing the business rule file in a preset script instance according to the rule identifier corresponding to the business rule package;
and processing the service parameters corresponding to the service requirements based on the preset script instance to obtain a service processing result.
4. The rule generating method according to claim 3, wherein when the version status of the business rule file is changed, rule contents in the preset script instance are updated in real time so that related personnel can call the preset script instance in real time.
5. The rule generating method according to claim 3, wherein after the step of storing the business rule file in a preset script instance according to the rule identifier corresponding to the business rule package, the method comprises:
acquiring first change information of a business rule packet in a preset time period;
and according to the first change information, determining to load or unload the preset script instance.
6. The rule generating method according to claim 5, wherein the first change information includes load change information and unload change information;
the step of determining to load or unload the preset script instance according to the first change information includes:
rule generation, namely reloading the preset script instance if the loading change information shows that the change record of the preset script instance does not exist;
or,
if the loading change information shows that the version identification of the preset script instance is different from that in the change record, reloading the preset script instance;
and if the unloading change information shows that the change time is earlier than the unloading record time in the change record, directly unloading the preset script instance.
7. The rule generating method according to claim 1, wherein the step of determining a business rule package to be executed according to the business requirement comprises:
acquiring rule information of a plurality of rule packages in a preset database;
and filtering the plurality of rule packages based on the association information between the rule information and the service requirement to obtain the service rule package to be executed.
8. A rule generating apparatus, characterized in that the rule generating apparatus comprises:
the acquisition module is used for acquiring the service requirement of the user;
the determining module is used for determining a business rule package to be executed according to the business requirement, wherein the business rule package comprises a plurality of rule script files;
the conversion module is used for converting the business rule package to obtain a business rule file, wherein the business rule file is cached in a preset script instance so that related personnel can call the preset script instance in real time.
9. A rule generating apparatus, the apparatus comprising: a memory, a processor and a rule generation program stored on the memory and executable on the processor, the rule generation program being configured to implement the steps of the rule generation method of any one of claims 1 to 7.
10. A computer storage medium having stored thereon a rule generation program which, when executed by a processor, implements the steps of the rule generation method according to any one of claims 1 to 7.
CN202310990278.7A 2023-08-04 2023-08-04 Rule generation method, device, equipment and storage medium Pending CN117008878A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310990278.7A CN117008878A (en) 2023-08-04 2023-08-04 Rule generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310990278.7A CN117008878A (en) 2023-08-04 2023-08-04 Rule generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117008878A true CN117008878A (en) 2023-11-07

Family

ID=88572389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310990278.7A Pending CN117008878A (en) 2023-08-04 2023-08-04 Rule generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117008878A (en)

Similar Documents

Publication Publication Date Title
US10282191B2 (en) Updating web resources
CN107832100B (en) APK plug-in loading method and terminal thereof
CN109558320B (en) System testing method, device, system, equipment and computer readable storage medium
US20220179642A1 (en) Software code change method and apparatus
CN110377360A (en) Method, display terminal and the computer readable storage medium that webview is quickly loaded
CN107957837B (en) Method and device for generating shortcut of webpage application program and terminal equipment
CN111814089A (en) Page rendering method and device, rendering server and storage medium
CN108279882B (en) Framework generation method, device, equipment and computer readable medium
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN104038520A (en) Multi-version distributed resource management method and multi-version distributed resource management system
CN113010224A (en) Front-end micro-service method, device, computer equipment and storage medium
CN114385164A (en) Page generation and rendering method and device, electronic equipment and storage medium
CN112579319A (en) Service calling method and device based on LRU Cache optimization
US20200053150A1 (en) Network topology templates for internal states of management and control planes
JP2010272090A (en) Device, program and method for managing processing request destination
CN106293790B (en) application program upgrading method and device based on Firefox operating system
CN112860308A (en) Configuration method of interface definition, service processing method, server and storage medium
CN110704041A (en) Software development method and device
CN110362305B (en) Form component state switching method and device
CN116048609A (en) Configuration file updating method, device, computer equipment and storage medium
CN117008878A (en) Rule generation method, device, equipment and storage medium
CN107783837B (en) Method and device for performing storage expansion and electronic equipment
CN115729590A (en) Service deployment method, device, equipment and computer readable storage medium
CN109840156B (en) Data caching method and equipment, storage medium and terminal thereof
CN115237631A (en) Easily-extensible data sharing system and method based on data sharing plug-in

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