Business rule updating method and system, electronic equipment and storage medium
By using the front-end service page and the back-end rule module in the business rule update system, the hard-coded and logical relationships of the business rule units are directly combined, which solves the problem that developers easily miss modifications when updating business rules, and improves the accuracy of business rule updates. sex.
Patent Information
- Application Number
- CN202411759504.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-01-24
AI Technical Summary
When updating business rules in the existing technology, developers need to modify the code of the original business rules, which is prone to missed modifications, resulting in a decrease in the accuracy of business rules updates.
Provide a business rules update method, obtain each rules and logic relationships input through the front -end service page, the background rules module obtain the hard -coding corresponding to each rule unit, and combine it according to the logical relationship to generate the updated business rules according to the logical relationship. Code.
There is no need for business personnel to communicate with developers about rule updates, and there is no need for developers to modify the hard-coded original business rules, which avoids missing modifications and improves the accuracy of business rule updates.
Smart Images

Figure CN119356713A_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, system, electronic device and storage medium. Background Art
[0002] Generally speaking, business rules need to change as business needs change. For example, the original business rule is: determine whether the data meets condition a. If condition a is met, the data is pushed to system A. If condition a is not met, determine whether the data meets condition b. If condition b is met, the data is pushed to system B. If condition b is not met, the data push is terminated. As business needs change, the condition for pushing data to system B needs to be modified, that is, "not meeting condition a, but meeting condition b" is changed to "meeting condition c".
[0003] In order to adapt to new business needs, the code of the original business rules (such as hard-coded if-else) needs to be modified. Specifically, the business personnel will inform the developer of the modification information (change "does not meet condition a, but meets condition b" to "meets condition c"), and the developer will modify the code based on the modification information. The corresponding business rules after the code modification are: determine whether the data meets condition c. If condition c is met, push the data to system B. If condition c is not met, then determine whether the data meets condition a. If condition a is met, push the data to system A. If condition a is not met, end the data push.
[0004] It can be seen that when developers modify the code, they not only need to modify the rule changes, that is, change "condition b" to "condition c", but also need to adapt the logic before and after the rule changes, that is, swap the positions of "determine whether condition c is met" and "determine whether condition a is met" in the code, and swap the positions of "send to system A" and "send to system B" in the code. If the developer does not fully consider the logic before and after the rule changes during the modification, the modification will be omitted, causing the logic of the business rules corresponding to the modified code to be disordered, thereby reducing the accuracy of the business rule update. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a business rule updating method, system, electronic device and storage medium, which can improve the accuracy of business rule updating.
[0006] In order to solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0007] A first aspect of the present application provides a business rule updating method, which is applied to a business rule updating system. The system includes a front-end service page and a back-end rule module. The back-end rule module is pre-installed with hard codes corresponding to various rule units corresponding to the smallest structural unit in the business rules. The front-end service page is used to receive each rule unit involved in the updated business rules and the logical relationship between them. The method includes: obtaining each input rule unit and the logical relationship between each rule unit through the front-end service page; obtaining the hard code corresponding to each rule unit through the back-end rule module, and combining each obtained hard code according to the logical relationship between each rule unit to obtain an updated business rule code.
[0008] Compared with the prior art, the business rule updating method provided in the first aspect of the present application is that the developer pre-edits the hard codes corresponding to various rule units in the background rule module. When the business personnel need to update the business rules, the business personnel only need to select from the various pre-edited rule units in the front-end service page according to the new business rules, and specify the logical relationship between the selected rule units. The background rule module can combine the hard codes corresponding to the rule units selected by the business personnel according to the logical relationship specified by the business personnel to obtain the code for executing the updated business rules. In this way, there is no need for the business personnel to communicate with the developers about rule updates, nor is there any need for the developers to modify the hard codes of the original business rules based on the updated business rules, which avoids the developers from missing modifications in the hard code modification and improves the accuracy of the business rule update.
[0009] In some changed implementation modes of the first aspect of the present application, the background rule module also stores one or more hard-coded combinations and the logic codes corresponding to each hard-coded combination, any hard-coded combination includes multiple hard codes, and the logic code corresponding to any hard-coded combination is used to characterize the logical relationship between the hard codes included in any hard-coded combination; each acquired hard code is combined according to the logical relationship between each rule unit to obtain an updated business rule code, including: determining a target hard-coded combination containing the hard codes corresponding to each rule unit from one or more hard-coded combinations; if the logic code corresponding to the target hard-coded combination conforms to the logical relationship, then generating an updated business rule code based on the target hard-coded combination and its corresponding logic code.
[0010] Various combinations of hard codes of various rule units are made in advance. When hard codes of rule units are entered in the combination front-end service page, combinations with the same hard codes can be directly selected. In this way, fast and accurate combinations of hard codes of input rule units can be achieved, thereby improving the efficiency and accuracy of business rule updates.
[0011] In some changed implementation modes of the first aspect of the present application, each hard-coded combination in the background rule module corresponds to a serial number combination, and each serial number in the serial number combination corresponds to a hard code in the hard-coded combination; a target hard-coded combination containing the hard code corresponding to each rule unit is determined from one or more hard-coded combinations, including: determining the hard-coded serial number corresponding to each rule unit, and combining the determined serial numbers into a serial number combination; determining a target serial number combination consistent with the combined serial number combination from the serial number combinations of the background rule module, and determining the hard-coded combination corresponding to the target serial number combination as the target hard-coded combination.
[0012] When searching for a target hard-coded combination, searching is performed by using the serial number corresponding to the hard code. Compared with directly searching by using the original content of the hard code, serial number searching is simpler and can improve the efficiency of searching for the target hard-coded combination.
[0013] In some modified implementations of the first aspect of the present application, the rule unit includes a unit template and personalized data; obtaining each input rule unit and the logical relationship between each rule unit, including: displaying at least part of the unit template; obtaining a selected unit template and the personalized data entered in the selected unit template, and then generating a rule unit based on the obtained unit template and personalized data.
[0014] Various unit templates are provided on the front-end service page. Business personnel can directly select templates based on the display and configure personalized data in the selected template. This can simplify the complexity of operations for business personnel on the front-end service page. Personnel can update business rules after simple training, reducing the cost of updating business rules.
[0015] In some changed implementation modes of the first aspect of the present application, before displaying all unit templates, the method also includes: outputting a rule configuration item in a front-end service page, the rule configuration item being used to input attributes of this rule configuration, the attributes including adding, updating or deleting; obtaining the content entered in the rule configuration item, and when the content indicates an update, calling the unit template and personalized data of the business rule history configuration according to the business rules indicated by the content, and displaying the called unit template and personalized data in the front-end page, so that the business rules are updated on the displayed unit template and personalized data.
[0016] Before business personnel configure rules, they first confirm whether this configuration is a rule update. If it is determined to be a rule update, the historical rule configuration of the business corresponding to this rule update is displayed, so that business personnel can adjust and update the historical rule configuration. Compared with a new rule configuration, this can improve the updating efficiency of business rules.
[0017] In some changed implementation modes of the first aspect of the present application, after obtaining the updated business rule code, the method also includes: extracting keywords that can characterize the business from the updated business rule code; calculating the similarity between the keywords and the description information of each business involved in the system, the description information is generated when the corresponding business is connected to the system; taking the business corresponding to the description information with the highest similarity to the keyword as the target business; and connecting the updated business rule code with the target business.
[0018] Through the similarity between the keywords in the updated business rule code and the descriptions of various businesses in the system, the updated business rule code can be automatically determined to be connected to the business, and the updated business rule code can be automatically connected to the corresponding business, thereby improving the user experience.
[0019] In some change implementation modes of the first aspect of the present application, the method also includes: obtaining a newly added rule unit and its corresponding hard code; using a preset logic code to combine the newly added hard code with the corresponding hard code in the background rule module, and testing the obtained hard code combination; if the test is successful, the newly added hard code is stored in the background rule module, and the rule unit corresponding to the newly added hard code is sent to the front-end service page for display, so that the front-end service page provides a selection of the newly added rule unit.
[0020] When adding a new rule unit, the developer will combine the hard code corresponding to the newly added rule unit with the corresponding hard code in the background rule module and then test it. If the test is successful, the newly added hard code will be stored in the background rule module and the newly added rule unit will be displayed in the front-end service page. In this way, after the business personnel enter the rule unit in the front-end service page, the background rule module can directly call the corresponding hard code to generate the business rule code without code testing, which can improve the efficiency of business rule updates and ensure the accuracy of business rule updates.
[0021] The second aspect of the present application provides a business rule updating system, which includes a front-end service page and a back-end rule module. The back-end rule module is pre-installed with hard codes corresponding to various rule units corresponding to the smallest structural unit in the business rules. The front-end service page is used to receive each rule unit involved in the updated business rules and the logical relationship between them. In the system: the front-end service page is used to obtain each input rule unit and the logical relationship between each rule unit; the back-end rule module is used to obtain the hard code corresponding to each rule unit, and combine each obtained hard code according to the logical relationship between each rule unit to obtain the updated business rule code.
[0022] The third aspect of the present application provides an electronic device, which includes: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the method in the first aspect.
[0023] A fourth aspect of the present application provides a computer-readable storage medium, which includes: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method in the first aspect.
[0024] The business rule updating system provided in the second aspect, the electronic device provided in the third aspect, and the computer-readable storage medium provided in the fourth aspect of the present application have the same or similar beneficial effects as the business rule updating method provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0026] Figure 1 The structure of the business rule update system in the embodiment of the present application is shown as follows: Figure 1 ;
[0027] Figure 2 The process diagram of the business rule updating method in the embodiment of the present application is as follows: Figure 1 ;
[0028] Figure 3 The process diagram of the business rule updating method in the embodiment of the present application is as follows: Figure 2 ;
[0029] Figure 4 The structure of the business rule update system in the embodiment of the present application is shown as follows: Figure 2 ;
[0030] Figure 5 The process diagram of the business rule updating method in the embodiment of the present application is as follows: Figure 3 ;
[0031] Figure 6 The structure of the business rule update system in the embodiment of the present application is shown as follows: Figure 3 ;
[0032] Figure 7 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0034] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.
[0035] Currently, when business rules need to be updated, developers need to modify the hard-coded parts of the business rules. An update to one part of the business rules may cause other parts of the business rules to be updated at the same time. If developers do not consider the implications completely, they will miss some modifications, which will reduce the accuracy of the business rule update.
[0036] In view of this, the embodiments of the present application provide a business rule updating method, system, electronic device and storage medium. Developers edit and save the hard codes corresponding to various rule units under different business rules in advance. When business personnel need to update business rules, developers are no longer required to modify the hard codes of the original business rules. Business personnel can select from the various rule units saved by developers and specify the logical relationship between the selected rule units. The selected rule units correspond to hard codes. These hard codes are combined according to the specified logical relationship to obtain the updated business rule code, and then the updated business rules are obtained. There is no need for developers to modify the code of the original business rules. Business personnel reselect and combine the various rule units in the updated business rules, which can avoid missing modifications and improve the accuracy of business rule updates.
[0037] First, the application scenario of the business rule updating method provided in the embodiment of the present application is described.
[0038] Figure 1 The structure of the business rule update system in the embodiment of the present application is shown as follows: Figure 1 , see Figure 1 As shown, the system may include: a front-end service page 11 and a back-end rule module 12 .
[0039] The front-end service page 11 is used to receive each rule unit involved in the updated business rules and the logic therebetween. The back-end rule module 12 is pre-installed with hard codes corresponding to various rule units corresponding to the smallest structural unit in the business rules.
[0040] Before updating the business rules, the developers will store the hard codes corresponding to various rule units into the background rule module 12 in advance.
[0041] A rule unit can refer to the smallest structural unit in a business rule, that is, an atomic business node. For example, a business rule is: determine whether the data meets condition a. If condition a is met, the data is pushed to system A. If condition a is not met, determine whether the data meets condition b. If condition b is met, the data is pushed to system B. If condition b is not met, the data push is terminated. Then, "determine whether the data meets condition a", "push the data to system A", "determine whether the data meets condition b", and "push the data to system B" are all rule units. Various rule units need to be determined according to specific business rules.
[0042] When updating business rules, business personnel can input various rule units in the front-end service page 11, and specify logical relationships between the input rule units, so that the background rule module 12 combines the hard codes corresponding to the rule units input by the business personnel according to the input logical relationships to obtain updated business rule codes, and then obtain updated business rules.
[0043] Next, the business rule updating method provided in the embodiment of the present application is described in detail.
[0044] Figure 2 The process diagram of the business rule updating method in the embodiment of the present application is as follows: Figure 1 , see Figure 2 As shown, the method may include:
[0045] S21: Obtain each input rule unit and the logical relationship between each rule unit through the front-end service page.
[0046] When business personnel need to update business rules, they know the updated business rules in advance, or know the update requirements, and then modify the original business rules according to the update requirements to obtain updated business rules. Next, the business personnel need to enter each rule unit involved in the updated business rules and the logical relationship between them in the front-end service page of the business update system.
[0047] Each rule unit input is obtained by splitting the updated business rule according to the smallest structural unit. The smallest structural unit can be a field with complete meaning, a field containing a verb, a field separated by punctuation marks, etc.
[0048] The input logical relationship may refer to the logical relationship between two or more rule units having a forward and backward execution relationship in the updated business rules, for example: if..., then...
[0049] That is to say, each rule unit and logical relationship inputted can constitute the updated business rules.
[0050] Taking the updated business rule of "determine whether the data meets condition c, if condition c is met, push the data to system B, if condition c is not met, then determine whether the data meets condition a, if condition a is met, push the data to system A, if condition a is not met, end data push" as an example, the rule units that business personnel need to enter in the front-end service page include: "determine whether the data meets condition c", "if condition c is met, push the data to system B", "if condition c is not met, then determine whether the data meets condition a", "if condition a is met, push the data to system A", "if condition a is not met, end data push". The logical relationships that business personnel need to enter in the front-end service page include: "determine whether the data meets condition c", "if condition c is met, push the data to system B", "if condition c is not met, then determine whether the data meets condition a", "if condition a is met, push the data to system A", "if condition a is not met, end data push" are executed in sequence.
[0051] In actual applications, the front-end service page may not display anything, and business personnel directly input rule units and logical relationships. The back-end rule module searches for the corresponding hard code based on the rule unit input on the front-end service page, and automatically converts the input logical relationship into the corresponding logic code, thereby splicing the searched hard code with the converted logic code. The front-end service page can also directly display the rule units and various logic codes corresponding to each hard code in the back-end rule module, so that business personnel can directly select rule units and logic codes on the front-end service page based on the updated business rules, so that the back-end rule module can directly splice the hard code corresponding to the selected rule unit with the selected logic code.
[0052] S22: Obtain the hard code corresponding to each rule unit through the background rule module, and combine each obtained hard code according to the logical relationship between each rule unit to obtain an updated business rule code.
[0053] In the background rule module, different rule units and their corresponding hard codes are stored. Each rule unit entered by the business personnel in the front-end service page is matched with each rule unit stored in the background rule module, and the rule unit corresponding to each rule unit entered in the front-end service page is found in the background rule module, and then the corresponding hard code is found. Then, the hard codes found are combined according to the logical relationship entered in the front-end service page to obtain the updated business rule code, that is, the updated business rule is obtained.
[0054] During specific matching, the name, summary, complete content, etc. of the rule unit may be used individually or in combination for matching, and the specific matching may be determined comprehensively based on the efficiency and accuracy requirements of the business rule update.
[0055] Continuing with the above example, in the background service module, find the hard codes corresponding to the rule units "determine whether the data meets condition c", "if condition c is met, push the data to system B", "if condition c is not met, then determine whether the data meets condition a", "if condition a is met, push the data to system A", and "if condition a is not met, end data push". By connecting these hard codes in sequence according to the logical relationship, we can obtain the updated business rule code, and also obtain the updated business rule "determine whether the data meets condition c, if condition c is met, push the data to system B, if condition c is not met, then determine whether the data meets condition a, if condition a is met, push the data to system A, and if condition a is not met, end data push".
[0056] As can be seen from the above content, the business rule updating method provided by the embodiment of the present application is that the developer pre-edits the hard codes corresponding to various rule units in the background rule module. When the business personnel need to update the business rules, the business personnel only need to select from the various pre-edited rule units in the front-end service page according to the new business rules, and specify the logical relationship between the selected rule units. The background rule module can combine the hard codes corresponding to the rule units selected by the business personnel according to the logical relationship specified by the business personnel to obtain the code for executing the updated business rules. In this way, there is no need for the business personnel to communicate with the developers about rule updates, and there is no need for the developers to modify the hard codes of the original business rules based on the updated business rules, which avoids the developers from missing modifications in the hard code modification and improves the accuracy of the business rule update.
[0057] Furthermore, as a Figure 2 As a refinement and extension of the method shown, an embodiment of the present application also provides a business rule updating method.
[0058] Figure 3The process diagram of the business rule updating method in the embodiment of the present application is as follows: Figure 2 , see Figure 3 As shown, the method may include:
[0059] S31: Output the rule configuration item in the front-end service page. The rule configuration item is used to input the attributes of this rule configuration. The attributes include adding, updating or deleting.
[0060] Before business personnel enter the rule unit in the front-end service page, the front-end service page can output the rule configuration item first to know whether the business personnel's current rule configuration is addition, update or deletion. Because if it is a rule update, the front-end service page can call and display the historical rule configuration, so that business personnel can modify the historical rule configuration.
[0061] Rule configuration items can be displayed through a drop-down menu or left blank for direct input by business personnel.
[0062] When the business personnel enters the front-end service page, or clicks anywhere in the front-end service page, it means that the business personnel need to start rule configuration. At this time, the front-end service page immediately displays the output configuration items so that the business personnel can specify the rule configuration for this time as adding, updating or deleting.
[0063] S32: Obtain the content input in the rule configuration item. When the content indicates a new addition, execute S33-S34; when the content indicates an update, execute S35.
[0064] If the rule configuration item is displayed in the form of a drop-down menu, whether it indicates an update can be determined based on the position of the selected content in the drop-down menu. For example, "Update" is located in the second position in the drop-down menu. If the second position in the drop-down menu is selected, it is determined that the selected content indicates an update.
[0065] If the rule configuration item is displayed in the form of an input box, semantic recognition can be performed on the content entered in the input box to determine whether it indicates an update. For example, if "modify" is entered in the input box, through semantic analysis, it is found that "modify" contains the meaning of "rule update", and it is determined that the input content indicates an update.
[0066] S33: Display at least part of the unit template.
[0067] For rule units, they can include unit templates and personalized data. Unit templates can refer to common content between certain rule units, for example: if... satisfies... Personalized data can refer to content that is easy to change between certain rule units, for example: a rule unit is "if data a satisfies condition a", the unit template is "if... satisfies...", and the personalized data is "data a" and "condition a".
[0068] If the business personnel need to add new business rules, they will select from the displayed unit templates, fill in personalized data in the selected unit template, and configure logical relationships between the selected unit templates.
[0069] S34: Acquire the selected unit template and the personalized data input in the selected unit template, and generate a rule unit based on the acquired unit template and the personalized data.
[0070] Business personnel may select multiple unit templates in the front-end service page and enter personalized data in each unit template. By integrating each unit template and the personalized data therein, each rule unit involved in the business rule that needs to be added this time is obtained.
[0071] When the content in the input configuration item indicates deletion, the front-end service page will automatically display the currently configured business rules for business personnel to select the business rules to be deleted, thereby deleting the selected business rules from the system.
[0072] When the content in the input configuration item indicates an update, the front-end service page can display the rule unit corresponding to the business rule to be updated so that the business personnel can make adjustments on the original business rule.
[0073] S35: According to the business rules indicated by the content, the unit template and personalized data configured in the business rule history are called, and the called unit template and personalized data are displayed in the front-end page, so that the business rules are updated on the displayed unit template and personalized data.
[0074] If the business personnel need to modify the business rules, they will select Update in the rule configuration item and further specify the business rules to be updated. The business rules to be updated can be specified by serial number, by the business name corresponding to the rule, or by the keywords in the rule.
[0075] After determining the business rules that need to be updated, you can call the unit template and personalized data in the most recently configured business rule from the background rule module, and then display it on the front-end page so that business personnel can add or remove unit templates, adjust the logic between unit templates, modify the personalized data in the unit templates, etc. based on the changes in the rules and the displayed unit templates and personalized data.
[0076] The modifications to the unit template and personalized data here are the same as the modifications to the hard-coded data by the developers mentioned in the background technology in the overall idea of rule modification. However, here the business personnel make modifications on the original business rules, while in the background data, the business personnel tell the developers what to modify, and the developers make modifications based on the modifications. The developers do not have a comprehensive understanding of the business rules as the business personnel, and the developers also need to take into account the code logic when making modifications. These are not as accurate as the direct modifications to the business rules by the business personnel. Therefore, calling the historically configured unit templates and personalized data for the business personnel to modify can improve the accuracy of the final updated business rules.
[0077] S36: Acquire the logical relationship configured between the selected unit templates.
[0078] After the business personnel select a unit template on the front-end service page and fill in the corresponding personalized data in the selected unit template, they also need to configure the logical relationship between the selected unit templates on the front-end service page.
[0079] At this point, the front-end service page obtains the various rule units involved in the updated business rules and the logical relationships between them.
[0080] The next step is to find the corresponding hard coding in the background rule module based on each rule unit obtained from the front-end service page and the logical relationship between them, and build the updated business rule code.
[0081] In the background rule module, there are various rule units, each of which has a corresponding hard code. These hard codes can be combined into hard code combinations. Each hard code in each hard code combination is configured with a corresponding logic code. These logic codes are the specific expressions of logical relationships in computer codes.
[0082] S37: Determine a target hard-coded combination including the hard-coded information corresponding to each rule unit from one or more hard-coded combinations.
[0083] After obtaining each rule unit from the front-end service page, each rule unit needs to find the corresponding hard code in the background rule module, and then generate the business rule code in combination with the logical relationship entered in the front-end service page.
[0084] In order to quickly generate business rule codes, the existing hard-coded combinations and their corresponding logic codes in the background rule module can be used. The logic code corresponding to the hard-coded combination is used to characterize the logical relationship between the hard codes included in the hard-coded combination. Specifically, among the various hard-coded combinations preset in the background rule module, search for a target hard-coded combination that only contains the hard codes corresponding to the rule units entered in the front-end page. Specifically: among the various rule units preset in the background rule module and their corresponding hard codes, search for a rule unit that matches the rule unit entered in the front-end service page, and use the hard codes corresponding to the matching rule units as the basis for subsequent hard-coded combination searches. Furthermore, among the various hard-coded combinations in the background rule module, search for a hard-coded combination that only contains the hard codes corresponding to the rule units entered in the front-end service page, and use it as the target hard-coded combination.
[0085] Since the number of rule units entered in the front-end service page is generally multiple, although the business personnel also specify logical relationships between the multiple rule units, the logical relationships specified by the business personnel may not be applicable in the code. Therefore, it is also necessary to convert the logical relationships entered in the front-end service page into logical codes.
[0086] In addition to using code conversion tools to convert logical relationships into logical codes, in order to achieve rapid conversion of logical codes, you can also directly use the corresponding logical codes pre-configured by the target hard-coded combination. Before this, you need to verify whether the logical code matches the logical relationship entered on the front-end service page.
[0087] S38: Determine whether the logic code corresponding to the target hard-coded combination conforms to the logic relationship. If yes, execute S39; if no, use a code conversion tool to convert the logic relationship into logic code.
[0088] The code conversion tool here can be any tool that can convert specified content into computer-recognizable codes.
[0089] When making a specific judgment, you can first obtain the logical code corresponding to the target hard-coded combination, and then check whether the characters in the logical code are the same or partially the same as the logical symbols corresponding to the logical relationship. If so, it is determined that the logical code corresponding to the target hard-coded combination conforms to the logical relationship. If not, it is determined that the logical code corresponding to the target hard-coded combination does not conform to the logical relationship.
[0090] S39: Generate updated business rule code based on the target hard-coded combination and its corresponding logic code.
[0091] That is, the logic code is inserted between each hard code in the target hard code combination to obtain the updated business rule code, thus completing the update of the business rule.
[0092] For example, suppose that the business personnel input rule unit a, rule unit b and rule unit c on the front-end service page, and the input rule unit a and rule unit b are in a causal relationship, and the input rule unit b and rule unit c are in a sequential relationship. The background rule module stores rule unit a-hard-coded a, rule unit b-hard-coded b, rule unit c-hard-coded c, and hard-coded combinations ab-if...else..., hard-coded combinations bc-...and..., and hard-coded combinations ac-if...else... In the background rule module, first determine hard-coded a, hard-coded b and hard-coded c according to the rule unit input on the front-end service page. Then, determine the target hard-coded combination, that is, hard-coded combination ab and hard-coded combination bc. Next, find the logical code in the hard-coded combination, that is, if...else... and...and... Finally, combine the hard code with the logical code to obtain the updated business rule code, that is, if rule unit a, else rule unit b, and rule unit c.
[0093] When determining the target hard-coded combination from multiple hard-coded combinations, in addition to matching the hard-coded corresponding to the rule unit input by the business personnel with each hard-coded in the multiple hard-coded combinations one by one, different hard codes can also have different serial numbers and use the serial numbers for matching. That is, each hard-coded combination in the background rule module corresponds to a serial number combination, and each serial number in the serial number combination corresponds to a hard code in the hard-coded combination. For example: hard-coded a-serial number 1, hard-coded b-serial number 2, ..., hard-coded combination ab corresponds to serial number combination 12.
[0094] Specifically, the above step S37 may include:
[0095] Step A1: Determine the hard-coded sequence number corresponding to each rule unit, and combine the determined sequence numbers into a sequence number combination.
[0096] Step A2: Determine a target sequence number combination that is consistent with the sequence number combination of the combination from the sequence number combination of the background rule module, and determine the hard-coded combination corresponding to the target sequence number combination as the target hard-coded combination.
[0097] For example, suppose that the business personnel input rule unit a, rule unit b and rule unit c on the front-end service page, rule unit a corresponds to sequence number 1, rule unit b corresponds to sequence number 2, rule unit c corresponds to sequence number 3, the causal relationship between rule unit a and rule unit b, and the order relationship between rule unit b and rule unit c. In the background rule module, the following corresponding relationships are pre-set: sequence number 1-rule unit a-hard-coded a, sequence number 2-rule unit b-hard-coded b, sequence number 3-rule unit c-hard-coded c, sequence number 4-rule unit d-hard-coded d, and hard-coded combination abc-sequence number combination 123-if...else...and..., hard-coded combination bcd-sequence number combination 234-...and...and... At this time, the background rule module begins to determine the target hard-coded combination based on the input of the front-end service page. First, determine the sequence number combination composed of the rule units entered by the business personnel, that is, 123. Then, in the pre-configured serial number combinations in the background rule module, the hard-coded combination abc corresponding to the same serial number combination and its corresponding logic code if...else...and... are searched. Finally, when the found logic code matches the logic relationship entered in the front-end service page, the hard-coded combination abc is combined with its corresponding logic code if...else...and... to obtain the updated business rule code.
[0098] In some examples, according to the execution order of each rule unit in the logical relationship, step A1 combines the determined sequence numbers into a sequence number combination. For example, rule unit a corresponds to sequence number 1, rule unit b corresponds to sequence number 2, rule unit c corresponds to sequence number 3, and the execution order of rule unit a, rule unit b and rule unit c is a→b→c, then the determined sequence number combination is 123.
[0099] In some specific implementations, if the execution order of at least two rule units is parallel, or there is no restriction on the order of execution, A1 generates multiple sequence number combinations according to the execution order. For example: rule unit a corresponds to sequence number 1, rule unit b corresponds to sequence number 2, rule unit c corresponds to sequence number 3, and the execution order of rule unit a, rule unit b and rule unit c is a and b are executed in parallel before c is executed, then the determined sequence number combination is 123, or 213. For another example: rule unit a corresponds to sequence number 1, rule unit b corresponds to sequence number 2, rule unit c corresponds to sequence number 3, and the execution order of rule unit a, rule unit b and rule unit c is a and b are executed before c is executed, wherein the order of ab is not restricted, then the determined sequence number combination is 123, or 213. In these cases, if step A2 matches any of the aforementioned determined sequence number combinations in the sequence number combination of the background rule module, the hard-coded combination corresponding to the matched target sequence number combination is the target hard-coded combination. If there are multiple target sequence number combinations matched in step A2, at least one target sequence number combination is selected as the target hard-coded combination according to a preset rule. The preset rule may be random, the execution efficiency of the hard-coded combination is greater than the preset efficiency, the usage rate of the hard-coded combination is greater than the preset usage rate, the hard-coded combination used the most recently, and the like.
[0100] S310: extracting keywords that can characterize the business from the updated business rule code.
[0101] Although the updated business rule code is a program code, some of the content it contains is related to the business. For example, the code may include the words "If yes, send the employee salary details to the financial system". Then, the employee salary details or the financial system will indicate that the corresponding specific business is salary payment.
[0102] Generally speaking, the keywords extracted from the code can be the information within "", or characters different from the executed code.
[0103] S311: Calculate similarity between the keyword and the description information of each business involved in the system. The description information is generated when the corresponding business is connected to the system.
[0104] The business rule update system is used to update business rules. Therefore, all businesses that have business rule usage or update requirements will also be connected to the system. When these businesses are connected to the system, they will be required to note the business description information in the business. The description information is used to describe the name, type, application scenario, specific content, etc. of the business.
[0105] The similarity calculation between the keyword and the description information can be performed using the percentage of identical characters or the semantic similarity.
[0106] S312: The business corresponding to the description information having the highest similarity to the keyword is taken as the target business.
[0107] S313: Connect the updated business rule code with the application system of the target business.
[0108] The more similar the keyword is to the description information of a certain business, the greater the possibility that the updated business rule belongs to the business. Therefore, the business corresponding to the description information with the highest similarity to the keyword is taken as the target business, and the updated business rule code is connected to the application system of the target business, so as to realize the automatic determination and connection of the business corresponding to the updated business rule code.
[0109] The so-called docking may refer to the business rule update system providing an interface to the target business's application system so that the target business's application system can call the updated business rule code through the interface. It may also refer to the business rule update system actively sending the updated business rule code to the target business's application system so that the target business's application system updates the existing business rule code based on the updated business rule code.
[0110] Of course, the target business can also be specified in the front-end service page when the business personnel input the rule unit, and then the back-end rule module implements the docking of the updated business rule code according to the business specified in the front-end service page.
[0111] In some other embodiments of the present application, if a new rule unit is discovered before, during, or after the business rule update system is used, the developer can edit a hard code based on the rule unit. If the hard code passes the test alone or in combination with other hard codes in the background rule module according to preset logic, the new hard code can be stored in the background rule module, and the new rule unit can be displayed on the front-end service page.
[0112] Step B1: Obtain the newly added rule unit and its corresponding hard code.
[0113] When a new rule unit is found, the developer can write the corresponding hard code based on the newly added rule unit, and then send the newly added rule unit and its hard code to the background rule module. The background rule module receives the newly added rule unit and its hard code.
[0114] Of course, the developer can also send the newly added rule unit and its hard code to the specified location. The background rule module can obtain the newly added rule unit and its hard code from the specified location at a certain time interval.
[0115] Step B2: Using the preset logic code, combine the newly added hard code with the corresponding hard code in the background rule module, and test the obtained hard code combination.
[0116] The preset logic code may be any one or more commonly used logic codes, such as: if...else..., ...and..., and so on.
[0117] The preset logic code is used to combine the newly added hard code with the corresponding hard code in the background rule module. The corresponding hard code and the adopted logic code can be specified by the developer, that is, the developer selects one or more hard codes that are compatible with the newly added hard code in the background rule module according to experience based on the newly added hard code, and specifies the adapted logic code between the selected hard codes. The corresponding hard code and the adopted logic code can also be randomly selected, that is, a hard code is randomly selected in the background rule module, and a logic code is randomly selected, and then the newly added hard code is combined with the randomly selected hard code through the randomly selected logic code. Since the subsequent test is to detect whether the rule unit corresponding to the newly added hard code can be executed, if the rule unit corresponding to the randomly selected hard code has been executed in the test, and the rule unit corresponding to the newly added hard code has not been executed in the test, it means that there is an error in the newly added hard code, and the content of the hard code needs to be adjusted. It can be seen that whether the randomly selected hard code and the logic code are reasonable in matching with the newly added hard code in actual content can be ignored.
[0118] After combining the newly added hard-coded code, the hard-coded code selected from the background rule module, and the selected logic code, you can test the combined code. The specific implementation method of the test here is the same as the specific implementation method of the test before the code goes online, so I will not repeat it here.
[0119] Step B3: Determine whether the test is successful. If yes, go to step B4; if no, go to step B5.
[0120] If the test succeeds, the test data will be output normally, or the code will run normally. If the test fails, the test data will output errors, or the code will prompt abnormal operation. Therefore, you can judge whether the test is successful by the output of the test data or the operation of the code.
[0121] Step B4: storing the newly added hard code in the background rule module, and sending the rule unit corresponding to the newly added hard code to the front-end service page for display, so that the front-end service page provides the selection of the newly added rule unit.
[0122] Each time a new rule unit is added, the hard-coded combination and test can be performed in the above manner. After the test is passed, the new rule unit is sent to the front-end service page for display, and the hard-coded corresponding to the new rule unit is sent to the back-end rule module for storage, so that business personnel can use more rule units when updating business rules, making the configuration content of business rules richer and improving the flexibility of business rule configuration. In addition, the hard-coded saved in the back-end rule module has been tested in advance, and the rule units input based on the front-end service page can be directly combined and put into use, which improves the updating efficiency of business rules.
[0123] The test is successful, indicating that the newly added hard code has no problems in operation and can be put into use. That is, the newly added hard code and its corresponding rule unit, as well as the hard code combination composed of other hard codes, are stored in the background rule module, and the newly added rule unit is sent to the front-end service page for display.
[0124] Step B5: Output a prompt message, where the prompt message is used to indicate that the newly added hard-coded content has a defect.
[0125] If the test fails, it means that there is a problem with the newly added hard-coded code and it needs to be fixed. The background rule module outputs a prompt message. After seeing the prompt message, the developer can immediately check and modify the newly added hard-coded code, and then combine the modified hard-coded code with the hard-coded code in the background rule module and the preset logic code and test it again until the test succeeds.
[0126] Finally, the business rule updating method provided in the application embodiment is described again with a specific example.
[0127] Figure 4 The structure of the business rule update system in the embodiment of the present application is shown as follows: Figure 2 , see Figure 4 As shown, the system may include: a marketing rule service and a marketing service (marketing-server) service.
[0128] The marketing-server service mainly provides page functions for business personnel. Business personnel can add, modify, delete and publish business rules on this page, and synchronize the published complete rules to the marketing-rule service.
[0129] The marketing rule service has two main functions: one is to provide an HTTP entry for the business initiator, and the other is to write business process nodes and synchronize them to the marketing service (marketing-server).
[0130] In the marketing-rule service, there are controllers, models, cache-handlers, and user connectors (netty-nio client).
[0131] In the marketing-server service, it includes the service connector (netty-nio server), database (db mysql) and web interface (web-ui).
[0132] The marketing service (marketing-server) service can call the marketing interface (marketing-api) and the marketing multi-function module (marketing-mq) to connect the updated business rules with the marketing business (marketing-job).
[0133] Figure 5 The process diagram of the business rule updating method in the embodiment of the present application is as follows: Figure 3 ,by Figure 4 Take the system as an example, Figure 5 The method shown may include:
[0134] S51: Developers write atomic business node codes in the marketing-rule service to implement a series of basic atomic functions.
[0135] The developers specifically use springboot automatic assembly technology to automatically introduce this system into the actual scenario, use spring-ioc automatic loading technology, write atomic business node code in the model mode, and put it into the spring container for management. The written atomic business node code uses netty communication technology that can realize the interaction between server code and client code, and is transmitted to the service connector netty-nio server through the user connector netty-nio client, then stored in the database db mysql, and finally displayed through the network interface web-ui.
[0136] S52: Business personnel configure required rules from a series of atomic business nodes according to business requirements in the front-end page of the marketing-server service.
[0137] S53: The marketing-server service pushes the configured complete rules to the marketing-rule service through the publishing function.
[0138] Business personnel specifically use the vue front-end technology with page display function to select atomic business nodes through the web-ui network interface. The selected atomic business nodes are extracted from the database db mysql and transmitted to the user connector netty-nio client through the service connector netty-nio server.
[0139] S54: The marketing-rule service updates the cache information of this service.
[0140] S55: The marketing rule marketing-rule service call-side related services (including: marketing interface marketing-api, marketing multi-function module marketing-mq, etc.) initiate an http call, specify relevant rules, initiate the actual business marketing business marketing-job call, and complete the entire business process.
[0141] Specifically, the cache processor cache-handler stores the atomic business nodes selected by the business personnel, and calls the marketing interface marketing-api and the marketing multi-function module marketing-mq through the controller controller to connect the business rules composed of the selected atomic business nodes to the marketing business marketing-job.
[0142] Through the code of a series of atomic business nodes written by developers in the marketing-rule service in advance, when there is a need to update business rules, the business personnel configure the rules in a series of atomic business nodes on the front-end page of the marketing-server service, and then the marketing-rule service combines the codes of the atomic business nodes involved in the rules based on the configured rules to obtain the updated business rule code. In this way, there is no need for business personnel to communicate with developers about rule updates, and there is no need for developers to modify the hard-coded original business rules based on the updated business rules, which avoids developers from missing modifications in hard-coded modifications and improves the accuracy of business rule updates.
[0143] At this point, the business rule updating method provided in the embodiment of the present application has been fully described.
[0144] Based on the same inventive concept, as an implementation of the above method, the embodiment of the present application also provides a business rule updating system.
[0145] Still see Figure 1As shown, the system includes a front-end service page 11 and a back-end rule module 12. The front-end service page 11 is connected to the back-end rule module 12. The back-end rule module 12 is pre-set with hard codes corresponding to various rule units corresponding to the smallest structural unit in the business rules. The front-end service page 11 is used to receive each rule unit involved in the updated business rules and the logic between them. In the system:
[0146] The front-end service page 11 is used to obtain each input rule unit and the logical relationship between each rule unit;
[0147] The background rule module 12 is used to obtain the hard code corresponding to each rule unit, and combine each obtained hard code according to the logical relationship between each rule unit to obtain an updated business rule code.
[0148] Furthermore, as a Figure 1 As a refinement and extension of the system shown, the embodiment of the present application also provides a business rule updating system.
[0149] Figure 6 The structure of the business rule update system in the embodiment of the present application is shown as follows: Figure 3 , see Figure 6 As shown, the system may include: a front-end service page 11 and a back-end rule module 12,
[0150] The front-end service page 11 includes: a history display unit 111 and a rule determination unit 112 .
[0151] Specifically, the rule unit includes a unit template and personalized data.
[0152] The history display unit 111 is used to output the rule configuration item in the front-end service page. The rule configuration item is used to input the attributes of the current rule configuration, and the attributes include adding, updating or deleting; obtaining the content input in the rule configuration item, and when the content indicates an update, calling the unit template and personalized data of the business rule history configuration according to the business rules indicated by the content, and displaying the called unit template and personalized data in the front-end page, so that the business rules are updated on the displayed unit template and personalized data.
[0153] The rule determination unit 112 is used to display at least part of the unit template; obtain the selected unit template and the personalized data input in the selected unit template, and then generate a rule unit based on the obtained unit template and personalized data.
[0154] The background rule module 12 includes: a code acquisition unit 121 , a combination determination unit 122 , a service connection unit 123 and a code adding unit 124 .
[0155] Specifically, the background rule module also stores one or more hard-coded combinations and logic codes corresponding to each hard-coded combination. Any hard-coded combination includes multiple hard codes, and the logic code corresponding to any hard-coded combination is used to characterize the logical relationship between the hard codes included in any hard-coded combination.
[0156] The code acquisition unit 121 is used to determine a target hard code combination including the hard code corresponding to each rule unit from one or more hard code combinations.
[0157] Specifically, each hard-coded combination in the background rule module corresponds to a serial number combination, and each serial number in the serial number combination corresponds to a hard code in the hard-coded combination.
[0158] The coding acquisition unit 121 is specifically used to determine the hard-coded serial number corresponding to each rule unit, and combine the determined serial numbers into a serial number combination; determine a target serial number combination that is consistent with the combined serial number combination from the serial number combination of the background rule module, and determine the hard-coded combination corresponding to the target serial number combination as the target hard-coded combination.
[0159] The combination determination unit 122 is configured to generate an updated business rule code based on the target hard-coded combination and its corresponding logic code if the logic code corresponding to the target hard-coded combination conforms to the logic relationship.
[0160] The business docking unit 123 is used to extract keywords that can represent the business from the updated business rule code; calculate the similarity between the keywords and the description information of each business involved in the system, the description information is generated when the corresponding business is docked with the system; the business corresponding to the description information with the highest similarity to the keyword is taken as the target business; and the updated business rule code is docked with the target business.
[0161] The coding adding unit 124 is used to obtain the newly added rule unit and its corresponding hard code; use the preset logic code to combine the newly added hard code with the corresponding hard code in the background rule module, and test the obtained hard code combination; if the test is successful, the newly added hard code is stored in the background rule module, and the rule unit corresponding to the newly added hard code is sent to the front-end service page for display, so that the front-end service page provides the selection of the newly added rule unit.
[0162] It should be noted here that the description of the above system embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the system embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0163] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.
[0164] Figure 7 This is a schematic diagram of the structure of the electronic device in the embodiment of the present application, see Figure 7 As shown, the electronic device may include: a processor 71, a memory 72, and a bus 73; wherein the processor 71 and the memory 72 communicate with each other via the bus 73; the processor 71 is used to call program instructions in the memory 72 to execute the methods in one or more of the above embodiments.
[0165] It should be noted that the description of the above electronic device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the electronic device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0166] Based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium, which may include: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method in one or more of the above embodiments.
[0167] It should be noted here that the description of the above storage medium embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the storage medium embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0168] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A business rule updating method, characterized in that: The method is applied to a business rule updating system, the system comprising a front-end service page and a back-end rule module, the back-end rule module being pre-installed with hard codes corresponding to various rule units corresponding to the smallest structural unit in the business rules, the front-end service page being used to receive each rule unit involved in the updated business rules and the logical relationships between them, the method comprising: Obtain each rule unit input and the logical relationship between each rule unit through the front-end service page; The hard code corresponding to each rule unit is obtained through the background rule module, and each obtained hard code is combined according to the logical relationship between each rule unit to obtain an updated business rule code.
2. The method according to claim 1, characterized in that The background rule module further stores one or more hard-coded combinations and logic codes corresponding to each hard-coded combination, wherein any hard-coded combination includes multiple hard codes, and the logic code corresponding to any hard-coded combination is used to characterize the logical relationship between the hard codes included in any hard-coded combination; The step of combining each acquired hard code according to the logical relationship between each rule unit to obtain an updated business rule code includes: Determine a target hard-coded combination including the hard-coded information corresponding to each rule unit from one or more hard-coded combinations; If the logic code corresponding to the target hard-coded combination conforms to the logic relationship, an updated business rule code is generated based on the target hard-coded combination and its corresponding logic code.
3. The method according to claim 2, characterized in that Each hard-coded combination in the background rule module corresponds to a sequence number combination, and each sequence number in the sequence number combination corresponds to a hard code in the hard-coded combination; and determining a target hard-coded combination including the hard code corresponding to each rule unit from one or more hard-coded combinations includes: Determine the hard-coded sequence number corresponding to each rule unit, and combine the determined sequence numbers into a sequence number combination; A target sequence number combination that is consistent with the sequence number combination of the combination is determined from the sequence number combination of the background rule module, and a hard-coded combination corresponding to the target sequence number combination is determined as the target hard-coded combination.
4. The method according to claim 1, characterized in that: The rule unit includes a unit template and personalized data; each rule unit inputted and the logical relationship between each rule unit include: Display at least part of the unit template; The selected unit template and the personalized data input in the selected unit template are acquired, and the rule unit is generated based on the acquired unit template and the personalized data.
5. The method according to claim 4, characterized in that Before displaying all unit templates, the method further includes: Outputting rule configuration items in the front-end service page, wherein the rule configuration items are used to input properties of this rule configuration, including adding, updating or deleting; Get the content entered in the rule configuration item. When the content indicates an update, call the unit template and personalized data of the business rule history configuration according to the business rule indicated by the content, and display the called unit template and personalized data in the front-end page to update the business rules on the displayed unit template and personalized data.
6. The method according to any one of claims 1 to 5, characterized in that After obtaining the updated business rule code, the method further includes: Extracting keywords capable of representing the business from the updated business rule code; Calculating similarity between the keyword and description information of each business involved in the system, where the description information is generated when the corresponding business is connected to the system; The business corresponding to the description information having the highest similarity to the keyword is taken as the target business; The updated business rule code is connected to the target business.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Get the newly added rule units and their corresponding hard codes; Use the preset logic code to combine the newly added hard-coded code with the corresponding hard-coded code in the background rule module, and test the obtained hard-coded combination; If the test is successful, the newly added hard code is stored in the background rule module, and the rule unit corresponding to the newly added hard code is sent to the front-end service page for display, so that the front-end service page provides the selection of the newly added rule unit.
8. A business rule updating system, characterized in that: The system includes a front-end service page and a back-end rule module. The back-end rule module is pre-installed with hard codes corresponding to various rule units corresponding to the smallest structural unit in the business rules. The front-end service page is used to receive each rule unit involved in the updated business rules and the logical relationship between them. In the system: The front-end service page is used to obtain each input rule unit and the logical relationship between each rule unit; The background rule module is used to obtain the hard code corresponding to each rule unit, and combine each obtained hard code according to the logical relationship between each rule unit to obtain an updated business rule code.
9. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium comprises: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method as claimed in any one of claims 1 to 7.