Business rule updating method, device, equipment and storage medium
By receiving and processing business rule update requests, generating and loading update field files, dynamically adjusting the operation business rules in the business decision engine, the lag problem caused by slow loading of risk rules in the existing technology is solved, and fast response and efficient business rule updates are achieved.
Patent Information
- Application Number
- CN202210731840.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-25
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-06-25
AI Technical Summary
In the prior art, risk rules are loaded slowly, resulting in lag in risk engine execution.
By receiving business rule update requests, obtaining target business rules and rule types, comparing target business rules with historical business rules, generating rule update fields, and calling the preset compiler to compile the update fields to generate update field class files. Then, obtain the rule loading interface matching the business decision engine, transfer the update field class file to the interface for hot loading, and dynamically adjust the operational business rules in the business decision engine.
It realizes rapid update and dynamic loading of business rules, improves the response speed of the risk engine to business rules, and solves the problem of lag in business rules adjustment of risk model.
Smart Images

Figure CN115202707B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a business rule updating method, apparatus, device and storage medium. Background Art
[0002] At present, with the rapid development of financial services and Internet technology, many financial enterprises have reduced the difficulty of implementing business logic by building risk engines. However, the business rules running in the current risk engine are pre-written, and when the system is started and loaded, the corresponding business rules and business orchestration are loaded into the virtual machine for scheduling by the risk engine. This loading method results in low efficiency in the risk engine's response to the business rules, and there is a lag in the adjustment of the business rules of the risk model. Summary of the invention
[0003] The embodiments of the present application provide a business rule updating method, apparatus, device and storage medium, aiming to solve the technical problem in the prior art that risk rules are loaded slowly, resulting in a lag in the execution of the risk engine.
[0004] On the one hand, an embodiment of the present application provides a business rule updating method, the business rule updating method comprising the following steps:
[0005] Receive a business rule update request, and obtain a target business rule and a rule type in the business rule update request;
[0006] Compare the target business rule with the historical business rule to obtain a rule update field;
[0007] Calling a preset compiler to compile the rule update field to generate an update field class file;
[0008] Obtain a rule loading interface that matches the business decision engine with the rule type, and transfer the update field class file to the rule loading interface for hot loading;
[0009] The running business rules in the business decision engine are adjusted according to the updated field class file.
[0010] In a possible implementation of the present application, after receiving the business rule update request and obtaining the target business rule and rule type in the business rule update request, the method further includes:
[0011] Acquire a target preset type that matches the rule type, and a target rule folder corresponding to the target preset type;
[0012] Obtaining the rule text feature of the target business rule, and calculating the similarity between the rule text feature and the preset text feature of each initial business rule in the target rule folder to obtain the rule similarity between the target business rule and each initial business rule;
[0013] The initial business rule whose rule similarity is greater than a preset similarity threshold is set as the historical business rule of the target business rule.
[0014] In a possible implementation of the present application, the target business rule is compared with the historical business rule to obtain a rule update field, including:
[0015] Performing word segmentation processing on the target business rule to obtain a first word segmentation, and performing word segmentation processing on the historical business rule to obtain a second word segmentation;
[0016] Compare the first participle with the second participle to obtain a difference participle field between the first participle and the second participle;
[0017] The difference segmentation field is set as the rule update field of the target business rule.
[0018] In a possible implementation of the present application, before calling a preset compiler to compile the rule update field and generate an update field class file, the method further includes:
[0019] Obtaining update intervals of the update rule and the historical business rule, and a first review weight of the update interval;
[0020] Obtaining the update intervals of the target business rule and the historical business rule and the first audit weights of the update intervals, and obtaining the update policy of the rule update field and the second audit weight of the update policy;
[0021] Perform an urgency review on the update interval and the rule update field according to a preset urgency review rule to obtain an update interval score and an update field score;
[0022] The update interval score is weighted according to the first review weight, the update field score is weighted according to the second review weight, and the sum of the weighted update interval score and the weighted update field score is calculated to obtain the urgency score of the target business rule;
[0023] According to the urgency score of the target business rule, a preset compiler is called to compile the rule update field to generate an update field class file.
[0024] In a possible implementation of the present application, calling a preset compiler to compile the rule update field to generate an update field class file includes:
[0025] Compare the urgency score with a preset urgency threshold to obtain an urgency evaluation level of the target business rule;
[0026] If the urgency is less than the preset urgency threshold, loading the rule update field into a preset engine virtual machine for orchestration;
[0027] If the urgency is greater than the preset urgency threshold, the preset Jonino compiler is called to compile the rule update field to generate an update field class file.
[0028] In a possible implementation of the present application, obtaining a rule loading interface that matches the business decision engine with the rule type, and transferring the update field class file to the rule loading interface for hot loading, includes:
[0029] Obtain the rule loading interface corresponding to the rule type and the rule cookie information corresponding to the update field class file;
[0030] The rule cookie information is transmitted to the rule loading interface, and the cookie information is transmitted to the preset engine virtual machine according to the rule loading interface;
[0031] The target business rules are dynamically loaded by driving the business decision engine according to the engine virtual machine.
[0032] In a possible implementation of the present application, after adjusting the running business rules in the business decision engine according to the updated field class file, the method further includes:
[0033] Read the version number of the historical business rule, and edit the current version number of the target business rule according to the version number;
[0034] The target business rule replaces the historical business rule and is stored in a preset rule folder, and the historical business rule and the version number are stored in a historical rule folder.
[0035] On the other hand, the present application provides a business rule updating device, the business rule updating device comprising:
[0036] A receiving module is configured to receive a business rule update request and obtain a target business rule and a rule type in the business rule update request;
[0037] A rule comparison module is configured to compare the target business rule with the historical business rule to obtain a rule update field;
[0038] A rule compilation module is configured to call a preset compiler to compile the rule update field and generate an update field class file;
[0039] The rule loading module is configured to obtain a rule loading interface that matches the business decision engine with the rule type, transfer the update field class file to the rule loading interface for hot loading, and adjust the running business rules in the business decision engine according to the update field class file.
[0040] On the other hand, the present application also provides a business rule updating device, the business rule updating device comprising:
[0041] one or more processors;
[0042] Memory; and
[0043] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the business rule updating method.
[0044] On the other hand, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the business rule updating method.
[0045] In the present application, a business rule update request is received, and a target business rule and a rule type in the business rule update request are obtained, and a historical business rule corresponding to the target business rule is obtained through the rule type, and the target business rule is compared with the historical business rule to obtain a rule update field of the target business rule; and a preset janino compiler is called to transform the rule update field, so as to generate an update field class file of the rule update field; after obtaining the update field class file, a rule loading interface matching the rule type in the decision engine is further obtained, and the update field class file is transferred to the rule loading interface for hot loading, so as to adjust the running business rules in the business decision engine according to the update field class file, so as to improve the application response speed of the target business rule by updating the existing business rules and dynamically loading them into the business decision engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 A schematic diagram of a scenario of a method for updating business rules according to an embodiment of the present application;
[0048] Figure 2 A flowchart of an embodiment of a method for updating business rules in an embodiment of the present application;
[0049] Figure 3 A flowchart of an embodiment of reviewing the urgency of a business rule update request in a business rule update method provided in an embodiment of the present application;
[0050] Figure 4 A flowchart of an embodiment of dynamically loading an update field class file in a business rule update method provided in an embodiment of the present application;
[0051] Figure 5 It is a structural diagram of an embodiment of a business rule updating device in an embodiment of the present application;
[0052] Figure 6 This is a schematic diagram of the structure of an embodiment of a business rule updating device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0054] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0055] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.
[0056] At present, with the rapid development of financial services and Internet technology, many financial enterprises have reduced the difficulty of implementing business logic by building risk engines. However, the business rules running in the current risk engine are pre-written, and when the system is started and loaded, the corresponding business rules and business orchestration are loaded into the virtual machine for scheduling by the risk engine. This loading method results in low efficiency in the risk engine's response to the business rules, and there is a lag in the adjustment of the business rules of the risk model.
[0057] Based on this, the present application proposes a business rule updating method, device, equipment and computer-readable storage medium to solve the technical problem in the prior art that risk rules are loaded slowly, resulting in a lag in the execution of the risk engine.
[0058] The business rule updating method in the embodiment of the present invention is applied to a business rule updating device, which is arranged in the business rule updating device. The business rule updating device is provided with one or more processors, a memory, and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the business rule updating method; wherein the business rule updating device can be an intelligent terminal, such as a mobile phone, a tablet computer, a smart TV, a network device, and a smart computer; optionally, the business rule updating device can also be a server, or a service cluster composed of multiple servers.
[0059] like Figure 1 As shown, Figure 1 This is a scenario diagram of the business rule updating method in an embodiment of the present application. The business rule updating scenario in the embodiment of the present invention includes multiple business rule updating devices 100 (business rule updating devices 100 are integrated with business rule updating devices), and computer-readable storage media corresponding to the business rule updating method are running in the business rule updating devices 100 to execute the steps of the business rule updating method.
[0060] Understandably, Figure 1 The business rule updating device in the business rule updating method scenario shown, or the devices included in the business rule updating device, does not constitute a limitation on the embodiments of the present invention, that is, the number of devices and types of devices of the business rule updating device included in the business rule updating method scenario, or the number and types of devices included in each device, do not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected in the embodiments of the present invention.
[0061] The service rule updating device 100 in the embodiment of the present invention is mainly used for:
[0062] Receive a business rule update request, and obtain a target business rule and a rule type in the business rule update request;
[0063] Compare the target business rule with the historical business rule to obtain a rule update field;
[0064] Calling a preset compiler to compile the rule update field to generate an update field class file;
[0065] Obtain a rule loading interface that matches the business decision engine with the rule type, transfer the update field class file to the rule loading interface for hot loading, and adjust the running business rules in the business decision engine according to the update field class file.
[0066] The business rule update device 100 in the embodiment of the present invention can be multiple independent business rule update devices, such as smart terminals such as mobile phones, tablet computers, smart TVs, network devices, servers and smart computers, or it can be a business rule update network or business rule update cluster composed of multiple business rule update devices.
[0067] The embodiments of the present application provide a business rule updating method, apparatus, device, and computer-readable storage medium, which are described in detail below.
[0068] It can be understood by those skilled in the art that Figure 1 The application environment shown in is only one of the application scenarios related to the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer business rules update devices as shown, or business rules update network connection relationships, such as Figure 1 Only one business rule updating device is shown. It can be understood that the scenario of the business rule updating method can also include one or more business rule updating devices, which is not specifically limited here. The business rule updating device 100 can also include a memory for storing business rules and other data.
[0069] It should be noted that Figure 1 The scenario diagram of the business rule updating method shown is only an example. The scenario of the business rule updating method described in the embodiment of the present invention is to more clearly illustrate the technical solution of the embodiment of the present invention, and does not constitute a limitation on the technical solution provided by the embodiment of the present invention.
[0070] Based on the scenario of the above business rule updating method, various embodiments of the business rule updating method disclosed in the present invention are proposed.
[0071] like Figure 2 As shown, Figure 2 This is a flow chart of an embodiment of a method for updating business rules in an embodiment of the present application. The method for updating business rules includes the following steps 201 to 204:
[0072] 201. Receive a business rule update request, and obtain a target business rule and a rule type in the business rule update request;
[0073] The business rule updating method in this embodiment is applied to a business rule updating device. The type and quantity of the business rule updating device are not specifically limited. That is, the business rule updating device may be one or more intelligent terminals or servers. In a specific embodiment, the business rule updating device is a smart computer.
[0074] The business rule update device is configured to update the stored business rules and dynamically load them into the business decision engine for response. The business rule is a set text that drives the business decision engine to make decisions; the business decision engine is an application model for reviewing decisions for specific business scenarios. Optionally, in a specific embodiment, the business rule can be a risk control rule; the business decision engine can be a risk control decision engine. In actual application scenarios, business rules are updated according to changes in specific business scenarios. The business rule update device needs to quickly load the updated business rules into the business decision engine to meet the business decision needs of the current application scenario.
[0075] Specifically, when the business rule update device is in operation, it obtains a business rule update request, wherein the business rule update request is an operation instruction requesting the business rule update device to perform addition, deletion, modification, query and update operations on specific business rules. Optionally, the triggering method of the business rule update request is not specifically limited here, that is, the business rule update request can be actively triggered by the user. For example, the user is a relevant staff member of the business decision engine. When it is determined that there is a change in the business scenario and the business rules corresponding to the business scenario need to be updated, the target business rule and the rule type corresponding to the target business rule are input into the business rule update device to trigger the business rule update request. In addition, the business rule update request can also be automatically triggered by the business rule update device. For example, the business rule update device pre-sets the rule update process and automatically triggers the business rule update request for a specific business rule within a preset time period.
[0076] Specifically, after receiving the business rule update request, the business rule update device reads the business rule update request, obtains the target business rule in the business rule update request and the rule type corresponding to the target business rule, and matches the historical business rule that needs to be replaced and updated for the target business rule in the background according to the rule type.
[0077] Specifically, the business rule updating device pre-classifies each initial business rule according to its rule type, and stores the initial business rules of the same rule type in a rule folder and rule menu corresponding to the rule type. Different rule folders are preset with different preset types. The business rule updating device manages each initial business rule through a background management interface.
[0078] Specifically, after receiving the business rule update request, the business rule update device obtains the permission identifier of the business rule update request, and performs permission management on the business rule update request through the permission identifier, wherein users corresponding to different permission identifiers can modify and adjust different business rules.
[0079] Specifically, after the business rule update device performs permission control on the business rule update request and determines that the business rule update request has the corresponding business permission, it matches the rule type of the target business rule in the business rule update request with the preset type in the preset rule folder in the business rule update device, thereby determining the target rule folder that matches the rule type of the target business rule.
[0080] After determining the target rule folder, the business rule updating device further encodes the target business rule to obtain the rule text feature of the target business rule, and calculates the similarity between the rule text feature and the preset text feature of each initial business rule in the target rule folder, thereby obtaining the rule similarity between the target business rule and the initial business rule. The historical business rule corresponding to the target business rule is determined by the rule similarity.
[0081] Specifically, the business rule updating device sets a similarity threshold to determine the historical business rules corresponding to the target business rule, and the business rule updating device sets the initial business rule whose rule similarity is greater than the similarity threshold as the historical business rule of the target business rule, wherein the historical business rule is the initial business rule to be updated and replaced.
[0082] 202. Compare the target business rule with the historical business rule to obtain a rule update field;
[0083] After acquiring the target business rule and the historical business rule, the business rule updating device also compares the target business rule with the historical business rule, thereby obtaining the updated content of the updated rule compared with the historical business rule, and obtaining the updated rule field.
[0084] Specifically, the business rule update device performs word segmentation processing on the target business rule to obtain a first word segmentation, and performs word segmentation processing on the historical business rule to obtain a second word segmentation, and determines the rule field of the target business rule that is changed compared with the historical business rule through the first word segmentation and the second word segmentation.
[0085] Specifically, the business rule update device compares each segmentation in the first segmentation with each segmentation in the second segmentation, thereby determining the difference segmentation field of the target business rule compared with the historical business rule. The difference segmentation field is set as the rule update field of the target business rule, and the rule update field and the relative position of the field in the target business rule are extracted. In subsequent operations, the rule update field is dynamically loaded into the business decision engine, so as to achieve lightweight and fast driving of the business decision engine to respond to the business rule update request.
[0086] 203. Calling a preset compiler to compile the rule update field to generate an update field class file;
[0087] After acquiring the rule update field, the business rule update device calls a preset compiler to compile the rule update field, thereby generating an update field class file.
[0088] Optionally, before compiling the rule update field, the business rule update device also reviews the urgency of the business rule update request, thereby determining the corresponding compilation method according to the urgency of the business rule update request. Optionally, the business rule update device can jointly determine the urgency of the business rule update request through the update interval of the historical business rules and the rule update field of the target business rules, thereby determining the corresponding compilation method. Optionally, the business rule update request can also carry an emergency flag set by the user, and the business rule update device can jointly determine the urgency of the business rule update request through the emergency flag, the update interval of the historical business rules and the rule update field of the target business rules, thereby determining the corresponding compilation method.
[0089] Specifically, when the business rule update device can determine that the urgency of the business rule update request is an emergency level update through the update interval of the historical business rule and the rule update field of the target business rule, the business rule update device uses the ClassBodyEvaluator class in the Janino compiler to compile the rule update field to obtain an update field class file. Optionally, the business rule update device can also use the ClassBodyEvaluator class in the Janino compiler to directly compile the target business rule to obtain an update rule class file.
[0090] The business rule updating device adjusts the business decision engine with the acquired update field class file or update rule class file.
[0091] 204. Obtain a rule loading interface that matches the business decision engine with the rule type, transfer the update field class file to the rule loading interface for hot loading, and adjust the running business rules in the business decision engine according to the update field class file.
[0092] After obtaining the update field class file or the update rule class file, the business rule update device further obtains the rule loading interface that matches the rule type in the business decision engine, where the rule loading interface is an HTTP API interface. Different rule types correspond to different application scenarios and are connected to different rule loading interfaces.
[0093] After determining the rule loading interface, the business rule update device calls the rule loading interface through the back-end management backend to receive the update field class file and read the update field class file, and hot loads the Cookie information corresponding to the update field class file or the update rule class file, thereby adjusting the business decision engine according to the Cookie of the update field class file or the update rule class file, and realizing hot loading of the update field class file or the update rule class file.
[0094] Optionally, the business rule update device can also perform hot loading into the business decision engine in the form of a message stream corresponding to the update field class file or the update rule class file according to the technical architecture scenario requirements.
[0095] In this embodiment, the business rule update device receives a business rule update request, obtains the target business rule and the rule type in the business rule update request, obtains the historical business rule corresponding to the target business rule through the rule type, compares the target business rule with the historical business rule, and obtains the rule update field of the target business rule; and calls the preset janino compiler to transform the rule update field, thereby generating an update field class file of the rule update field; after obtaining the update field class file, further obtains the rule loading interface that matches the rule type in the decision engine, transfers the update field class file to the rule loading interface for hot loading, and adjusts the business decision engine according to the update field class file, so as to improve the application response speed of the target business rule by updating the existing business rules and dynamically loading them into the business decision engine.
[0096] like Figure 3 As shown, Figure 3 The present invention is a flowchart of an embodiment of reviewing the urgency of a business rule update request in the business rule update method provided in an embodiment of the present application.
[0097] Based on the above embodiment, in the embodiment of the present application, by scoring the update interval and the update field, the urgency of the business rule update request is reviewed, specifically, including steps 301 to 304:
[0098] 301. Obtain update intervals of the target business rule and the historical business rule and first audit weights of the update intervals, and obtain update policies of the rule update fields and second audit weights of the update policies;
[0099] 302. Perform an urgency review on the update interval and the rule update field according to a preset urgency review rule to obtain an update interval score and an update field score;
[0100] 303. Weighting the update interval score according to the first review weight, weighting the update field score according to the second review weight, calculating the sum of the weighted update interval score and the weighted update field score, and obtaining the urgency score of the target business rule;
[0101] 304. According to the urgency score of the target business rule, a preset compiler is called to compile the rule update field to generate an update field class file.
[0102] In this embodiment, before compiling the rule update field, the business rule update device also reviews the urgency of the business rule update request, thereby determining the corresponding compilation method according to the urgency of the business rule update request.
[0103] Specifically, the business rule updating device pre-sets a first review weight for calculating the urgency for the update interval, and sets a second review weight for each rule update field and update strategy.
[0104] Specifically, the business rule update device parses the rule update field to determine an update policy for the rule update field. Optionally, the update policy for the rule update field includes a substantive update policy and a formal update policy.
[0105] Specifically, the business rule update device pre-sets an urgency review rule, wherein the urgency review rule is a rule that specifies the urgency score of the update interval, update field, and update field type. The business rule update device performs an urgency review on the update interval and rule update field of the target business rule according to the preset urgency review rule, thereby calculating the update review score of the update interval and the update field score of the rule update field.
[0106] After obtaining the update interval score and update field score of the target business rule, the business rule update device weights the update interval score according to the first audit weight, weights the update field score according to the second audit weight, and obtains the sum of the weighted update interval score and the weighted update field score to obtain the urgency score of the target business rule.
[0107] After determining the urgency score of the target business rule, the business rule updating device compares the urgency score with a preset urgency threshold, thereby obtaining the urgency evaluation level of the target business rule.
[0108] Optionally, if the urgency score of the target business rule is less than the preset urgency threshold, the urgency evaluation level is determined to be a normal level, the rule update field is loaded into a preset engine virtual machine for orchestration, and the loading is started through the engine virtual machine.
[0109] Optionally, if the urgency score of the target business rule is less than the preset emergency threshold, the emergency evaluation level is determined to be the emergency level, the business rule update device determines that the target business rule needs to be dynamically loaded, calls the preset Jonino compiler to compile the rule update field of the target business rule, generates an update field class file, and inputs the update field class file into the business decision engine for dynamic loading to improve the response speed.
[0110] In this embodiment, the business rule update device evaluates the update urgency of the target business rule by evaluating the update interval and update strategy of the target business rule, thereby determining the emergency evaluation level of the target business rule, and determines the compilation method according to different emergency evaluation levels, thereby realizing dynamic loading of the target business rule with an emergency evaluation level of the emergency level, thereby improving the response speed of the target business rule.
[0111] like Figure 4 As shown, Figure 4 A flowchart of an embodiment of dynamically loading an update field class file in a business rule update method provided in an embodiment of the present application, specifically, comprising steps 401 and 403:
[0112] 401. Obtain a rule loading interface corresponding to the rule type and rule Cookie information corresponding to the update field class file;
[0113] 402. Transmit the rule cookie information to the rule loading interface, and transmit the cookie information to the preset engine virtual machine according to the rule loading interface;
[0114] 403. Drive the business decision engine to dynamically load the target business rule according to the engine virtual machine.
[0115] Based on the above embodiments, in the embodiments of the present application, after obtaining the update field class file of the target business rule, the business rule update device further obtains the rule loading interface corresponding to the rule type. The rule loading interface is an HTTPAPI interface. Different rule types correspond to different application scenarios and are connected to different rule loading interfaces.
[0116] After determining the rule loading interface corresponding to the update field class file, the business rule update device also obtains the rule cookie information of the update field class file, and transmits the rule cookie information to the rule loading interface, and transmits the cookie information to the preset engine virtual machine corresponding to the business decision engine through the rule loading interface for dynamic loading, so that the business decision engine dynamically loads the target business rule through the engine virtual machine.
[0117] Optionally, the business rule update device can also convert the text in the update field class file into a message stream through the Janino compiler and transmit it to the rule loading interface, and transmit the message stream to the preset engine virtual machine through the rule loading interface for dynamic loading.
[0118] In this embodiment, the business rule update device obtains the rule loading interface corresponding to the rule type and the rule cookie information corresponding to the update field class file; transmits the rule cookie information to the rule loading interface, transmits the cookie information to the preset engine virtual machine according to the rule loading interface; and drives the business decision engine to dynamically load the target business rule according to the engine virtual machine. Dynamic loading of the target business rule is achieved, and the rule update response speed is improved.
[0119] In order to better implement the business rule updating method in the embodiment of the present application, based on the business rule updating method, the embodiment of the present application also provides a business rule updating device, such as Figure 5 As shown, Figure 5 : is a schematic diagram of the structure of an embodiment of a business rule updating device in an embodiment of the present application, wherein the business rule updating device 500 comprises:
[0120] The receiving module 501 is configured to receive a business rule update request and obtain a target business rule and a rule type in the business rule update request;
[0121] A rule comparison module 502 is configured to compare the target business rule with the historical business rule to obtain a rule update field;
[0122] A rule compiling module 503 is configured to call a preset compiler to compile the rule update field and generate an update field class file;
[0123] The rule loading module 504 is configured to obtain a rule loading interface that matches the business decision engine with the rule type, transfer the update field class file to the rule loading interface for hot loading, and adjust the running business rules in the business decision engine according to the update field class file.
[0124] In some embodiments of the present application, after the business rule updating device receives a business rule update request and obtains a target business rule and a rule type in the business rule update request, it further includes:
[0125] Acquire a target preset type that matches the rule type, and a target rule folder corresponding to the target preset type;
[0126] Obtaining the rule text feature of the target business rule, and calculating the similarity between the rule text feature and the preset text feature of each initial business rule in the target rule folder to obtain the rule similarity between the target business rule and each initial business rule;
[0127] The initial business rule whose rule similarity is greater than a preset similarity threshold is set as the historical business rule of the target business rule.
[0128] In some embodiments of the present application, the business rule updating device compares the target business rule with the historical business rule to obtain a rule update field, including:
[0129] Performing word segmentation processing on the target business rule to obtain a first word segmentation, and performing word segmentation processing on the historical business rule to obtain a second word segmentation;
[0130] Compare the first participle with the second participle to obtain a difference participle field between the first participle and the second participle;
[0131] The difference segmentation field is set as the rule update field of the target business rule.
[0132] In some embodiments of the present application, the business rule updating device calls a preset compiler to compile the rule update field, and before generating an update field class file, it also includes:
[0133] Obtaining the update intervals of the target business rule and the historical business rule and the first audit weights of the update intervals, and obtaining the update policy of the rule update field and the second audit weight of the update policy;
[0134] Perform an urgency review on the update interval and the rule update field according to a preset urgency review rule to obtain an update interval score and an update field score;
[0135] The update interval score is weighted according to the first review weight, the update field score is weighted according to the second review weight, and the sum of the weighted update interval score and the weighted update field score is calculated to obtain the urgency score of the target business rule;
[0136] According to the urgency score of the target business rule, a preset compiler is called to compile the rule update field to generate an update field class file.
[0137] In some embodiments of the present application, the business rule updating device calls a preset compiler to compile the rule update field to generate an update field class file, including:
[0138] Compare the urgency score with a preset urgency threshold to obtain an urgency evaluation level of the target business rule;
[0139] If the urgency is less than the urgency threshold, loading the rule update field into the preset engine virtual machine for orchestration;
[0140] If the urgency is greater than the urgency threshold, the preset Jonino compiler is called to compile the rule update field to generate an update field class file.
[0141] In some embodiments of the present application, the business rule updating device obtains a rule loading interface of the business decision engine that matches the rule type, and transmits the update field class file to the rule loading interface for hot loading, including:
[0142] Obtain the rule loading interface corresponding to the rule type and the rule cookie information corresponding to the update field class file;
[0143] The rule cookie information is transmitted to the rule loading interface, and the cookie information is transmitted to the preset engine virtual machine according to the rule loading interface;
[0144] The target business rules are dynamically loaded by driving the business decision engine according to the engine virtual machine.
[0145] In some embodiments of the present application, after the business rule updating device adjusts the running business rules in the business decision engine according to the update field class file, it also includes:
[0146] Read the version number of the historical business rule, and edit the current version number of the target business rule according to the version number;
[0147] The target business rule replaces the historical business rule and is stored in a preset rule folder, and the historical business rule and the version number are stored in a historical rule folder.
[0148] In this embodiment, the business rule updating device receives a business rule update request, obtains the target business rule and the rule type in the business rule update request, obtains the historical business rule corresponding to the target business rule through the rule type, compares the target business rule with the historical business rule, and obtains the rule update field of the target business rule; and calls the preset janino compiler to transform the rule update field, so as to generate an update field class file of the rule update field; after obtaining the update field class file, further obtains the rule loading interface that matches the rule type in the decision engine, transfers the update field class file to the rule loading interface for hot loading, and adjusts the business decision engine according to the update field class file, so as to improve the application response speed of the target business rule by updating the existing business rules and dynamically loading them into the business decision engine.
[0149] The embodiment of the present invention also provides a service rule updating device, such as Figure 6 As shown, Figure 6This is a schematic diagram of the structure of an embodiment of a business rule updating device provided in an embodiment of the present application.
[0150] The business rule updating device integrates any one of the business rule updating devices provided in the embodiments of the present invention, and the business rule updating device includes:
[0151] one or more processors;
[0152] Memory; and
[0153] One or more applications, wherein the one or more applications are stored in the memory and are configured to execute, by the processor, the steps of the business rule updating method described in any of the above business rule updating method embodiments.
[0154] Specifically, the business rule updating device may include one or more processing core processors 601, one or more computer-readable storage media memories 602, a power supply 603, an input unit 604 and other components. Those skilled in the art will understand that Figure 6 The business rule updating device structure shown in the figure does not constitute a limitation on the business rule updating device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0155] The processor 601 is the control center of the business rule update device. It uses various interfaces and lines to connect various parts of the entire business rule update device. By running or executing software programs and / or modules stored in the memory 602 and calling data stored in the memory 602, it executes various functions of the business rule update device and processes data, thereby monitoring the business rule update device as a whole. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601.
[0156] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created by the use of the device according to business rules, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0157] The business rule updating device also includes a power supply 603 for supplying power to each component. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 603 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0158] The business rule updating device may further include an input unit 604, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0159] Although not shown, the business rule update device may also include a display unit, etc., which will not be described in detail here. Specifically in this embodiment, the processor 601 in the business rule update device will load the executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 will run the application programs stored in the memory 602, thereby realizing various functions, as follows:
[0160] Receive a business rule update request, and obtain a target business rule and a rule type in the business rule update request;
[0161] Compare the target business rule with the historical business rule to obtain a rule update field;
[0162] Calling a preset compiler to compile the rule update field to generate an update field class file;
[0163] Obtain a rule loading interface that matches the business decision engine with the rule type, transfer the update field class file to the rule loading interface for hot loading, and adjust the running business rules in the business decision engine according to the update field class file.
[0164] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0165] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.
[0166] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0167] The above is a detailed introduction to a business rule updating method provided in an embodiment of the present application. Specific embodiments are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A business rule updating method, It is characterized in that The business rule updating method comprises: Receive a business rule update request, and obtain a target business rule and a rule type in the business rule update request; Acquire a target preset type that matches the rule type, and a target rule folder corresponding to the target preset type; Obtaining the rule text feature of the target business rule, and calculating the similarity between the rule text feature and the preset text feature of each initial business rule in the target rule folder to obtain the rule similarity between the target business rule and each initial business rule; Setting the initial business rule whose rule similarity is greater than a preset similarity threshold as the historical business rule of the target business rule; Performing word segmentation processing on the target business rule to obtain a first word segmentation, and performing word segmentation processing on the historical business rule to obtain a second word segmentation; Compare the first participle with the second participle to obtain a difference participle field between the first participle and the second participle; Setting the difference segmentation field as the rule update field of the target business rule; Calling a preset compiler to compile the rule update field to generate an update field class file; Obtain a rule loading interface that matches the rule type of the business decision engine, and transfer the update field class file to the rule loading interface for hot loading; The running business rules in the business decision engine are adjusted according to the updated field class file.
2. The business rule updating method according to claim 1, It is characterized in that The calling of the preset compiler to compile the rule update field and generate the update field class file also includes: Obtaining the update intervals of the target business rule and the historical business rule and the first audit weights of the update intervals, and obtaining the update policy of the rule update field and the second audit weight of the update policy; Perform an urgency review on the update interval and the rule update field according to a preset urgency review rule to obtain an update interval score and an update field score; The update interval score is weighted according to the first review weight, the update field score is weighted according to the second review weight, and the sum of the weighted update interval score and the weighted update field score is calculated to obtain the urgency score of the target business rule; According to the urgency score of the target business rule, a preset compiler is called to compile the rule update field to generate an update field class file.
3. The business rule updating method according to claim 2, It is characterized in that The method of calling a preset compiler to compile the rule update field according to the urgency score of the target business rule to generate an update field class file includes: Compare the urgency score with a preset urgency threshold to obtain an urgency evaluation level of the target business rule; If the urgency score is less than the preset urgency threshold, loading the rule update field into the preset engine virtual machine for orchestration; If the urgency score is greater than the preset urgency threshold, a preset Janino compiler is called to compile the rule update field to generate an update field class file.
4. The business rule updating method according to claim 1, It is characterized in that The step of obtaining a rule loading interface that matches the business decision engine with the rule type and transmitting the update field class file to the rule loading interface for hot loading includes: Obtain the rule loading interface corresponding to the rule type and the rule cookie information corresponding to the update field class file; The rule cookie information is transmitted to the rule loading interface, and the cookie information is transmitted to the preset engine virtual machine according to the rule loading interface; The target business rules are dynamically loaded by driving the business decision engine according to the engine virtual machine.
5. The business rule updating method according to claim 1, It is characterized in that After adjusting the running business rules in the business decision engine according to the update field class file, the method further includes: Read the version number of the historical business rule, and edit the current version number of the target business rule according to the version number; The target business rule replaces the historical business rule and is stored in a preset rule folder, and the historical business rule and the version number are stored in a historical rule folder.
6. A business rule updating device, It is characterized in that The business rule updating device comprises: A receiving module is configured to receive a business rule update request and obtain a target business rule and a rule type in the business rule update request; The rule comparison module is configured to obtain a target preset type matching the rule type and a target rule folder corresponding to the target preset type; obtain a rule text feature of the target business rule, and perform similarity calculation between the rule text feature and the preset text feature of each initial business rule in the target rule folder to obtain a rule similarity between the target business rule and each initial business rule; set the initial business rule whose rule similarity is greater than a preset similarity threshold as a historical business rule of the target business rule; perform word segmentation processing on the target business rule to obtain a first word segmentation, and perform word segmentation processing on the historical business rule to obtain a second word segmentation; perform word segmentation comparison between the first word segmentation and the second word segmentation to obtain a difference word segmentation field between the first word segmentation and the second word segmentation; Setting the difference segmentation field as the rule update field of the target business rule; A rule compilation module is configured to call a preset compiler to compile the rule update field and generate an update field class file; The rule loading module is configured to obtain a rule loading interface that matches the business decision engine with the rule type, transfer the update field class file to the rule loading interface for hot loading, and adjust the running business rules in the business decision engine according to the update field class file.
7. A business rule updating device, It is characterized in that The business rule updating device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the business rule updating method according to any one of claims 1 to 5.
8. A computer-readable storage medium, It is characterized in that A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps of the business rule updating method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Service rule update method and apparatus, computer device, and storage medium
CN109358874A
Service rule updating method and device, computer equipment and storage medium
CN110851159A