Web-based business modification method
By integrating a web-based rule engine and a custom software development toolkit in complex business logic systems, flexible modification of business processes and reduced code changes are achieved, and the difficulties in modifying complex business logic systems in the prior art are solved, and an easy-to-use visual operation interface is provided.
Patent Information
- Application Number
- CN202411982314.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
AI Technical Summary
When modifying a system with complex business logic, it is difficult to flexibly implement business processes modifications to avoid large-scale changes in the code, and it is not applicable to ordinary users.
The web-based business modification method is adopted, and the web-based rule engine is integrated into the original application code, and the rule chain is arranged using the web interface to realize the modification of business requirements, and component initialization and business events are performed through a custom software development toolkit.
It realizes flexible modification of business processes, reduces changes to the original code, provides visual operations and real-time update functions, allowing non-developers to configure and manage rules, and reduces the complexity of system operations.
Smart Images

Figure CN119988774A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of data processing, and in particular relates to a web-based service modification method. Background Art
[0002] In every company, there are always some systems with complex business logic. As the core business logic, they are associated with almost every functional requirement, such as internal logic operations, cache operations, persistence operations, external resource retrieval, internal other system RPC calls, etc. As the years of use increase, the project changes hands several times, and the maintenance cost will become higher and higher. Various hard code judgments and more and more branch conditions. There are differences in the code logic written by different maintenance personnel, which is not easy to understand. As time goes by, the system code becomes more and more complex, the redundant code becomes more and more, the reuse rate of the original code becomes lower and lower, and the maintenance difficulty becomes higher and higher. This is because the modules of the system are highly coupled, and some small logic changes can easily affect other modules. Complete regression testing is required to verify, which is time-consuming and costly. Therefore, how to flexibly implement the modification of business processes and avoid large changes to the code is a problem that needs to be solved urgently.
[0003] In the prior art, the rule engine framework is used to solve the above problems to a certain extent. However, the rule engine framework method needs to separate the business rules from the application program and store these business rules in a database or rule file so that the application program can call these rules to execute specific business logic. This type of method requires developers to have a certain degree of familiarity with the application code, and there are problems such as difficulty in getting started in arranging the application code and implementing the business logic, which is not suitable for daily use by ordinary users. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a web-based business modification method for modifying business processes and avoiding major changes to codes.
[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions:
[0006] In a first aspect, the present invention provides a web-based service modification method, comprising:
[0007] S1: Identify the business requirements that need to be modified;
[0008] S2: Integrate the web-based rule engine into the original application code of the business requirement in step S1;
[0009] S3: According to the business requirements that need to be modified in step S1, determine the rules that need to be executed by the web-based rule engine in step S2;
[0010] S4: calling the relevant node components in the original application code according to the rules determined in step S3;
[0011] S5: In step S2, the web interface of the web-based rule engine is used to arrange the node components called in step S4 to form a rule chain, and the rule chain is used to implement the business requirements of step S1;
[0012] S6: Execute the rule chain arranged in step S5 online on the web interface of step S5 and return the execution result to the web interface.
[0013] In the aforementioned web-based service modification method, step S2 comprises:
[0014] S21: Introduce the dependency of the web-based rule engine into the original application code of the business requirement in step S1;
[0015] S22: Configure the parameters required for the web-based rule engine to run.
[0016] In the aforementioned web-based service modification method, step S3 comprises:
[0017] S31: define or modify business events related to business requirements, where the business events are responsible for executing business requirement logic;
[0018] A business requirement is related to several business events. When a new business event appears, the new business event is defined; when the related business event is an existing one, the existing business event is modified to meet the current business requirement;
[0019] S32: Write a rule file, in which the execution order and logical relationship of the business events are defined.
[0020] The aforementioned web-based business modification method, wherein the web-based rule engine includes a custom software development kit;
[0021] Step S4 includes:
[0022] S41: Initialize components of the original application code using a custom software development kit;
[0023] The custom software development kit includes a component initialization module. When the original application code is started, the custom software development kit automatically calls the component initialization module to initialize the application code.
[0024] The initialization component module obtains node components related to business requirements in the original application code by combining rule engine annotations with pointcuts, and obtains business events composed of node components through custom annotations.
[0025] S42: Call the relevant business events and node components of the rule in step S3, and store them in the component library of the web-based rule engine in step S2.
[0026] In the aforementioned web-based service modification method, step S41 comprises:
[0027] S411: Obtain node components related to the step S3 rule in the original application code through the rule engine annotation;
[0028] S412: According to the node components obtained in step S411 and the rules determined in step S3, the node components obtained in step S411 are combined into business events;
[0029] S413: Add a custom annotation to the interface method of the business event in step S412, where the interface method is a method for calling the business event.
[0030] In the aforementioned web-based service modification method, when the web-based rule engine is a web-based liteflow rule engine, step S41 includes:
[0031] The SpringContextUtils.getApplicationContext() method returns the instance class stored in the Spring application context interface through a static method;
[0032] Use the getBeansWithAnnotation method in the ApplicationContext interface in the Spring framework to obtain the @LiteflowComponent annotation;
[0033] Among them, the getBeansWithAnnotation method returns all instance classes with the specified annotation and conforming to the required type; the @LiteflowComponent annotation is used to mark the node component in the original application code, and the @LiteflowComponent annotation includes the id field of the node component. There is a unique correspondence between the node component in the application code and its id field.
[0034] In the aforementioned web-based service modification method, the node components obtained in step S41 need to be verified and deduplicated before being stored in the component library.
[0035] In the aforementioned web-based service modification method, step S6 comprises:
[0036] S61: Bind the rule chain of step S5 to the business event;
[0037] S62: Start the application code online in the web interface to execute the business event of step S61 and return the execution result to the web interface.
[0038] In the aforementioned web-based business modification method, the custom annotation in step S41 is @BusinessEvent annotation, and step S62 includes:
[0039] Start the application code online in the web interface. When the application code is executed to call a business event, the application system locates and obtains the rule chain of the business event under the @BusinessEvent annotation based on the pointcut matching rules in the business event interface method.
[0040] The process of locating and obtaining the rule chain is as follows:
[0041] When the application code executes a business event, the application system calls the custom software development kit in step S41 to initialize the component according to the interface method under the @BusinessEvent annotation, and sequentially executes step S42 to store the business event and node components required to execute the business event into the component library, and calls the pointcut @Pointcut(value="@annotation(BusinessEvent)") to obtain the corresponding rule chain according to the id field under the corresponding @LitflowComponent annotation;
[0042] The rule chain is executed by the flowExecutor.execute2Resp() method in the rule engine framework;
[0043] The execute2Resp() method is an execution method provided by the process executor of the web-based rule engine, which is used to execute the rule chain and return the response result.
[0044] The aforementioned web-based business modification method realizes cross-server calling of business events and / or node components for business modification by registering business event names and / or node component names in combination with HTTP calls.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] The web-based business modification method of the present invention combines web functions with traditional rule engines to modify business processes and avoid major changes to the code. It can integrate the advantages of the rule engine framework and separate business rule settings from applications, and can also take advantage of web functions to perform visual operations and publish business modifications online, thus making up for the defects of traditional code modification operations that are complex, the need to publish online after code modification, and cumbersome processes, making it easier for users to use.
[0047] The Web-based rule engine of the present invention performs rule configuration, management and monitoring through a Web interface, and provides a visual configuration interface so that non-developers (such as business analysts) can configure and manage rules without writing code.
[0048] Visual configuration: Through the web interface, users can intuitively configure and manage rules.
[0049] Live Updates: Rules can be updated in real time through the web interface without restarting the application.
[0050] Remote management: Users can remotely access and manage the rule engine through the network.
[0051] The service orchestration chain generation and executor execution processes in the present invention are based on the rule engine framework, which is suitable for rewriting or reconstructing complex business logic and reducing the coupling of business codes. The waterfall-style code is transformed into a code structure with node components as the core. The advantages of this structure are visual operation, reduced development complexity, arbitrary arrangement of each node component, and decoupling between node components.
[0052] At the same time, custom annotations, point-cutting execution and other methods are introduced to integrate component initialization, service orchestration design and execution process; node components and business events are introduced to divide the complex business requirements of the project into several business events. Each business event is composed of node components. The logic of business events composed of node components is arranged into a rule chain to provide suitable implementation conditions for the rule engine framework, reduce the complexity of system operation, and reduce the additional code modifications caused by R&D personnel during secondary development, which greatly improves the performance of the platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 is a schematic diagram of a web-based service modification method flow chart of Embodiment 1 of the present invention; DETAILED DESCRIPTION
[0054] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.
[0055] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0056] Embodiment 1:
[0057] This embodiment introduces a web-based service modification method.
[0058] Figure 1 This is a flow chart of a web-based service modification method in Embodiment 1 of the present invention. This flow chart only shows the logical sequence of the method described in this embodiment. In other possible embodiments of the present invention, different methods may be used without conflict. Figure 1 The steps shown or described are accomplished in the order shown.
[0059] S1: Identify the business requirements that need to be modified;
[0060] S2: Integrate the web-based rule engine into the original application code of the business requirement in step S1;
[0061] S3: According to the business requirements that need to be modified in step S1, determine the rules that need to be executed by the web-based rule engine in step S2;
[0062] S4: calling the relevant node components in the original application code according to the rules determined in step S3;
[0063] S5: In step S2, the web interface of the web-based rule engine is used to arrange the node components called in step S4 to form a rule chain, and the rule chain is used to implement the business requirements of step S1;
[0064] S6: Execute the rule chain arranged in step S5 online on the web interface of step S5 and return the execution result to the web interface.
[0065] Suppose an e-commerce platform needs to modify the VIP upgrade conditions of store A to: upgrade to VIP after spending 1,000 yuan in store A. The traditional implementation method is to hard-code these conditions into the program, but this method requires re-modifying the code and re-publishing it when the demand changes (such as changing the consumption amount threshold or adding new conditions). The web-based rule engine can configure these rules through the web interface. When the demand changes, you only need to modify the rules online without rewriting the code.
[0066] In this embodiment, the above steps S1-S6 are executed sequentially, and the VIP level upgrade conditions of the e-commerce platform store A can be modified by using the web-based liteflow rule engine.
[0067] The modification process is briefly described as follows:
[0068] Clarify the conditions for upgrading the VIP level, which is to spend at least RMB 1,000 in Store A.
[0069] Modify the relevant business events according to the new upgrade conditions. For example, modify the business event of checking the consumption amount so that the business event can correctly determine whether the user meets the VIP upgrade conditions.
[0070] In the rule file, adjust the rule chain of the business event to reflect the new VIP upgrade conditions. For example, you can modify the rule chain so that when the user's consumption amount in store A meets the conditions, the VIP upgrade operation is performed.
[0071] The specific description of some steps of the web-based service modification method of the present invention is as follows:
[0072] This embodiment is implemented under the Spring Boot framework.
[0073] Spring Boot is an extension of the Spring framework. It is based on the concept of "convention over configuration" and aims to simplify the initial construction and development process of Spring applications. Spring Boot provides a large number of default configurations to reduce the configuration work during the development process. At the same time, it also provides many built-in starters that can easily integrate various commonly used libraries and frameworks.
[0074] Step S2 includes:
[0075] S21: Introduce the dependency of the web-based rule engine into the original application code of the business requirement in step S1;
[0076] In step S1, in the backend project of the original application code of the business requirement, the dependency of the web-based rule engine is introduced. The Maven dependency of the web-based rule engine can be added in the pom.xml file of the backend project, or the dependency of the web-based rule engine can be configured in the corresponding build tool.
[0077] The project's pom.xml file is a core configuration file in a Maven project, which contains the project's build information, dependency information, plug-in configuration, etc.
[0078] S22: configure the parameters required for the web-based rule engine to run;
[0079] In the configuration file of the backend project, configure the relevant parameters of the web-based rule engine, such as the rule file path, node retry times, thread pool parameters, etc. Ensure that the web-based rule engine can correctly load and execute the rule file.
[0080] Steps S21 and S22 enable the web-based rule engine to be integrated into the original application code of the business requirement of step S1 and realize the original functions of the web-based rule engine.
[0081] In this embodiment, the web-based rule engine uses the Liteflow rule engine integrated with the web interface. The following steps are included:
[0082] 1. Preparation
[0083] Create a Spring Boot project: Create a new Spring Boot project using Spring Initializr or the IDE of your choice. Add necessary dependencies such as Spring Web, Spring Boot DevTools, etc.
[0084] Add LiteFlow dependency: Add the Spring BootStarter dependency of LiteFlow in the pom.xml file of the Maven project.
[0085] 2. Configure LiteFlow
[0086] Create LiteFlow configuration file: Create your rule configuration file (such as JSON, YAML, etc.) in the src / main / resources / flow directory. Define process nodes and chains, which will describe your business logic and process.
[0087] Create business logic components: Create your business logic components in the src / main / java directory. These components will implement specific business logic. Make sure these components implement the NodeComponent interface of LiteFlow and override the process method.
[0088] Configure LiteFlow beans: When you need to customize LiteFlow configuration, you can create a configuration class and configure LiteFlow beans in it. Usually, these beans are declared through annotations or XML configuration.
[0089] 3. Create a Web Interface
[0090] Design web interface: Use front-end frameworks (such as React, Vue, Angular, etc.) to design web interfaces. Create pages to display and manage LiteFlow's rules and processes.
[0091] Backend controller: Create controller classes in the Spring Boot project to handle requests from the web interface. These controllers will call LiteFlow's API to execute the process and return the results to the frontend.
[0092] Integrate the front-end and back-end: Use AJAX, Fetch API or other technologies to integrate the front-end and back-end. Make sure the front-end can correctly send requests to the back-end and receive responses from the back-end.
[0093] 4. Testing and Deployment
[0094] Testing: Test the integration of the web interface and LiteFlow in your local environment. Make sure all the features work as expected and there are no errors.
[0095] Deployment: Deploy the tested web-based LiteFlow rule engine to the application environment. Ensure that all dependencies and configurations of the web-based LiteFlow rule engine are correctly set up and can run normally in the application environment.
[0096] 5. Additional Considerations
[0097] Security: Ensure that the web interface and LiteFlow integration are secure, especially when sensitive data and business processes are involved.
[0098] Performance: Monitor the performance of the web-based LiteFlow rule engine application environment and optimize as needed.
[0099] Maintainability: When designing the integration between the web interface and LiteFlow, future maintenance and extensibility were taken into consideration.
[0100] This completes the integration of the LiteFlow rule engine and the web interface in the web-based rule engine of this embodiment. The web-based rule engine can be used to configure, manage, and monitor rules through the web interface. By providing a visual configuration interface, business personnel can configure and manage rules without writing code.
[0101] Specific features of the Web-based rule engine:
[0102] Visual configuration: Through the web interface, users can intuitively configure and manage rules.
[0103] Live Updates: Rules can be updated in real time through the web interface without restarting the application.
[0104] Remote management: Users can remotely access and manage the rule engine through the network.
[0105] Step S3 includes:
[0106] S31: Define or modify business events related to business requirements
[0107] Define or modify related business events according to the business requirements that need to be modified in step S1. A business requirement may be related to one or more business events. When a new business event occurs, define the new business event; when the related business event is original, modify the original business event to meet the current business requirements. These business events will be responsible for executing specific business requirement logic. For example, a business event can be defined to check whether the amount of consumption by the user in store A meets the VIP upgrade conditions.
[0108] S32: Write rule files
[0109] Use the rule file format supported by the web-based rule engine to write a rule file. In the rule file, define the execution order and logical relationship of business events. For example, you can write a rule file to trigger the VIP upgrade logic when the user's consumption amount in store A meets the VIP upgrade conditions.
[0110] Step S4 includes:
[0111] Web-based rules engine including custom software development kit;
[0112] S41: Use a custom software development kit to initialize the original application code components.
[0113] The custom software development toolkit includes a component initialization method. When the original application code is started, the custom software development toolkit automatically calls the component initialization method to initialize the application code.
[0114] The component initialization method obtains the node components in the original application code by combining the rule engine annotations with the cut points, and obtains the business events composed of the node components by custom annotations.
[0115] S42: calling the business events and node components initialized and processed in step S41 related to the rule determined in step S3 and storing them in the component library of the web-based rule engine in step S2;
[0116] Step S41 includes:
[0117] S411: Obtain node components related to the step S3 rule in the original application code through the rule engine annotation;
[0118] S412: According to the node components obtained in step S411 and the rules determined in step S3, the node components obtained in step S411 are combined into business events;
[0119] S413: Adding a custom annotation to the interface method of the business event in step S412, wherein the interface method is a method for calling the business event;
[0120] In this embodiment, step S4 specifically includes:
[0121] The SpringContextUtils.getApplicationContext() method is used to return the instance class stored in the Spring application context interface through a static method, that is, the @LiteflowComponent annotation is obtained by using the getBeansWithAnnotation method in the ApplicationContext interface in the Spring framework. Among them, the getBeansWithAnnotation method will directly return all instance classes with the specified annotation and conform to the required type; the @LiteflowComponent annotation is an annotation used to identify the LiteFlow process component, which is used to mark the node component in the original application code. Through this annotation, developers can register custom components in the LiteFlow process engine so that these components can be called in the process. The @LiteflowComponent annotation includes the id field of the node component, and there is a unique correspondence between the node component in the application code and its id field.
[0122] Due to changes in business needs, the application code corresponding to the node component will change according to the changes in business needs, which also means that the node component information may change every time the application is started. Therefore, the node component obtained in step S41 needs to be verified and deduplicated before being stored in the component library.
[0123] According to the component type obtained in step S41 and the business event to which the component belongs, the component library is traversed to perform verification and deduplication.
[0124] The deduplication means that when two or more identical components are obtained in step S41, the component is only stored in the component library once.
[0125] Since code developers often change codes according to business requirements, and then adjust (add / delete) the components corresponding to the business requirements, in order to ensure that the components stored in the component library are the components corresponding to the current application code, reduce redundant components, and reduce the complexity of traversing the component library, it is stipulated that: if the component initialization in step S51 does not find the component, it will be deleted from the existing component library, and the business events related to the component will be deleted at the same time. If the same component exists, it will be overwritten and updated with the component called by the component initialization in step S41. In addition, there are operations such as initialization list deduplication.
[0126] In actual application, business modification involves several business events, each of which is composed of several node components. In order to improve the efficiency of business modification, business events are directly called for modification. Therefore, a custom annotation @BusinessEvent is designed, which is marked on the interface method of each business event in the application code. Similarly, the called business events also need to be verified and deduplicated before being stored in the component library to reduce the redundancy of the component library and ensure that the components and business events in the component library are used to modify the current business needs and are associated with the latest application code.
[0127] Introducing the custom annotation @BusinessEvent in the Spring framework, the process includes: defining annotations, using annotations, and processing annotations.
[0128] Define annotations: Use the @interface keyword to define a custom annotation @BusinessEvent.
[0129] Use annotations: Use the @BusinessEvent annotation on business logic methods. The @BusinessEvent annotation triggers certain specific behaviors when the method is executed, such as logging and sending notifications.
[0130] Processing annotations: To process these annotations, write an aspect to intercept methods annotated with @BusinessEvent. This example uses Spring AOP (aspect-oriented programming) to implement it.
[0131] Configure Spring AOP: Make sure that AOP support is enabled in Spring configuration. This example uses SpringBoot, and usually you only need to add the @EnableAspectJAutoProxy annotation to the startup class.
[0132] Test Annotations: Verify that the @BusinessEvent annotation works as expected. Make sure the test covers methods annotated with @BusinessEvent and verifies that the aspects correctly intercept and handle the business events accessed by these @BusinessEvent annotations.
[0133] In Spring AOP (Aspect-Oriented Programming), the @Pointcut annotation is used to define a pointcut, which is an expression that specifies which joinpoints should be enhanced (i.e., the advice in the application aspect). The @Pointcut annotation is usually located on an empty method that does not perform any operations but serves as a marker to define a pointcut expression in the aspect class.
[0134] Java code:
[0135] @Pointcut(value="@annotation(BusinessEvent)")
[0136] This pointcut expression uses the @annotation indicator, which specifies a specific annotation as a matching condition. In this example, @annotation(BusinessEvent) means that this pointcut will match all methods marked with the @BusinessEvent annotation.
[0137] The value attribute in the @Pointcut annotation contains the pointcut expression. In this example, the pointcut expression is @annotation(BusinessEvent), which tells the Spring AOP framework that any method marked with the @BusinessEvent annotation is a candidate join point for this pointcut.
[0138] This @Pointcut annotation is located in an aspect class. An aspect class is a special class that contains pointcut definitions and advice definitions. Advices are blocks of code that will be executed at matched join points.
[0139] After defining the pointcut in the aspect class, you can use this pointcut in advice (such as @Before, @After, @Around, etc.) to specify which methods should be enhanced.
[0140] Java code example:
[0141] @Aspect public class MyAspect { / / Define the cut point @Pointcut(value="@annotation(BusinessEvent)") public void businessEventMethods() {} / / Define notifications, using the pointcuts defined above @Before("businessEventMethods()") public void beforeBusinessEvent(JoinPoint joinPoint) { / / Logic before business event method execution }}
[0142] In the above sample code, MyAspect is an aspect class that defines a pointcut called businessEventMethods, which matches all methods marked with the @BusinessEvent annotation. Then, it defines a @Before advice that will be executed before the method matching the businessEventMethods pointcut is executed.
[0143] Step S5 includes:
[0144] After initializing the node components, users can filter the required node components according to the application and enter the graphical interface - canvas to design the service orchestration chain. The canvas-toolbar of the web interface integrates the logical tools required for rule chain orchestration, such as serial orchestration THEN, parallel orchestration WHEN, selection orchestration SWITCH, and conditional execution TO; among them, serial orchestration THEN means execution in sequence, and parallel orchestration WHEN means that the execution of each component does not affect each other. In the canvas of the web interface, the rule chain is designed by dragging components, text input, and drop-down selection. Move the logic tool to the canvas and fill in the component name associated with the logic tool in the pop-up window. The list is presented in the form of "component name-event_id", where event_id corresponds to the id field under the @LiteflowComponent annotation, which serves as the unique identifier recorded in the component library.
[0145] The component name and id field codes under the @LiteflowComponent annotation are as follows:
[0146] @LiteflowComponent(id = "orderProcessing", name = "Order Processing Component") public class OrderProcessingComponent extends NodeComponent { @Override public void process() { / / Implement order processing logic, such as order review, payment, delivery, etc. System.out.println("Order processing component has been executed!"); } }
[0147] In the above example:
[0148] The value of the id field is orderProcessing, which is used to uniquely identify the component in the rule file. The component can be referenced by the id in the rule file.
[0149] The value of the Component Name field is the order processing component, which provides an alias that is easier to understand and identify, making it easier to identify in logs or configurations.
[0150] The design of the component name field enables non-R&D personnel (such as business analysts) to modify the business without understanding complex codes.
[0151] At the same time, users can also edit EL expressions directly in the backend project to achieve more complex rule chain arrangement without operating on the canvas.
[0152] The visual operation of the web interface can intuitively see the arrangement relationship of complex rule chains. Users can select node components under the application through the current web interface, or select node components that are not displayed in the current interface through the search function.
[0153] Step S6 includes:
[0154] S61: Bind the rule chain of step S5 to the business event;
[0155] S62: starting the application code online on the web interface to execute the business event of step S61 and returning the execution result to the web interface;
[0156] In this embodiment, step S6 specifically includes:
[0157] After the rule chain design is completed, select the business event in the same application for binding.
[0158] Start the application code online in the web interface. When the application code is executed to call a business event, the application system locates and obtains the rule chain of the business event under the @BusinessEvent annotation based on the pointcut matching rules in the business event interface method.
[0159] The above process of locating and obtaining the rule chain is as follows:
[0160] When the application code executes a business event, according to the interface method under the @BusinessEvent annotation, the custom software development kit of step S41 is automatically called to initialize the component, and step S42 is executed sequentially to store the business event and node components required to execute the business event into the component library, and the pointcut @Pointcut (value = "@annotation (BusinessEvent)") is called to obtain the corresponding rule chain according to the id field under the corresponding @LitflowComponent annotation. Among them, in the component library-component properties, the automatic execution field and the enabled status field are set, and the "automatic execution" and "enabled status" fields in the component properties of a series of node components associated with the business event are queried to determine whether the rule chain is allowed to execute. Finally, the flowExecutor.execute2Resp() method in the rule engine framework executes the rule chain. Among them, the execute2Resp() method is an execution method provided by the process executor of the web-based rule engine, which is used to execute the rule chain and return the response result, and the business modification process ends here.
[0161] As business needs increase, the number of node components that need to be connected will continue to increase, and their associations will become more complicated. Therefore, the system can improve the efficiency of rule chain orchestration by configuring the binding relationship between node components and business scenarios.
[0162] After the application is started, it is automatically executed so that users do not need to manually execute service orchestration rules. After the program automatically locates the rule chain in the business event, it queries the orchestration rules of the rule chain and executes the node components under the rule chain according to the orchestration rules.
[0163] During the execution process, the context object is introduced to pass parameters to each node component in the rule chain. The present invention can also register the business event name and / or node component name in combination with HTTP call to implement cross-server call of business events and / or node components for business modification, so that the application scope of the web-based rule engine of the present invention is far higher than that of the traditional framework.
[0164] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0165] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0166] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0167] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0168] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A web-based service modification method, characterized in that: include: S1: Identify the business requirements that need to be modified; S2: Integrate the web-based rule engine into the original application code of the business requirement in step S1; S3: According to the business requirements that need to be modified in step S1, determine the rules that need to be executed by the web-based rule engine in step S2; S4: calling the relevant node components in the original application code according to the rules determined in step S3; S5: In step S2, the web interface of the web-based rule engine is used to arrange the node components called in step S4 to form a rule chain, and the rule chain is used to implement the business requirements of step S1; S6: Execute the rule chain arranged in step S5 online on the web interface of step S5 and return the execution result to the web interface.
2. The web-based service modification method according to claim 1, characterized in that: Step S2 includes: S21: Introduce the dependency of the web-based rule engine into the original application code of the business requirement in step S1; S22: Configure the parameters required for the web-based rule engine to run.
3. The web-based service modification method according to claim 1, characterized in that: Step S3 includes: S31: define or modify business events related to business requirements, where the business events are responsible for executing business requirement logic; A business requirement is related to several business events. When a new business event appears, the new business event is defined; when the related business event is an existing one, the existing business event is modified to meet the current business requirement; S32: Write a rule file, in which the execution order and logical relationship of the business events are defined.
4. The web-based service modification method according to claim 3, characterized in that: The web-based rules engine includes a custom software development kit; Step S4 includes: S41: Initialize components of the original application code using a custom software development kit; The custom software development kit includes a component initialization module. When the original application code is started, the custom software development kit automatically calls the component initialization module to initialize the application code. The initialization component module obtains node components related to business requirements in the original application code by combining rule engine annotations with pointcuts, and obtains business events composed of node components through custom annotations. S42: Call the relevant business events and node components of the rule in step S3, and store them in the component library of the web-based rule engine in step S2.
5. The web-based service modification method according to claim 4, characterized in that: Step S41 includes: S411: Obtain node components related to the step S3 rule in the original application code through the rule engine annotation; S412: According to the node components obtained in step S511 and the rules determined in step S3, the node components obtained in step S411 are combined into business events; S413: Add a custom annotation to the interface method of the business event in step S412, where the interface method is a method for calling the business event.
6. The web-based service modification method according to claim 5, characterized in that: When the web-based rule engine is a web-based liteflow rule engine, step S41 includes: The SpringContextUtils.getApplicationContext() method returns the instance class stored in the Spring application context interface through a static method; Use the getBeansWithAnnotation method in the ApplicationContext interface in the Spring framework to obtain the @LiteflowComponent annotation; Among them, the getBeansWithAnnotation method returns all instance classes with the specified annotation and conforming to the required type; the @LiteflowComponent annotation is used to mark the node component in the original application code, and the @LiteflowComponent annotation includes the id field of the node component. There is a unique correspondence between the node component in the application code and its id field.
7. The web-based service modification method according to any one of claims 4 to 6, characterized in that: The node components obtained in step S41 need to be verified and deduplicated before being stored in the component library.
8. The web-based service modification method according to claim 6, characterized in that: Step S6 includes: S61: Bind the rule chain of step S5 to the business event; S62: Start the application code online in the web interface to execute the business event of step S61 and return the execution result to the web interface.
9. The web-based service modification method according to claim 8, characterized in that: The custom annotation in step S41 is @BusinessEvent annotation, and step S62 includes: Start the application code online in the web interface. When the application code is executed to call a business event, the application system locates and obtains the rule chain of the business event under the @BusinessEvent annotation based on the pointcut matching rules in the business event interface method. The process of locating and obtaining the rule chain is as follows: When the application code executes a business event, the application system calls the custom software development kit in step S41 to initialize the component according to the interface method under the @BusinessEvent annotation, and sequentially executes step S42 to store the business event and node components required to execute the business event into the component library, and calls the pointcut @Pointcut(value="@annotation(BusinessEvent)") to obtain the corresponding rule chain according to the id field under the corresponding @LitflowComponent annotation; The rule chain is executed by the flowExecutor.execute2Resp() method in the rule engine framework; The execute2Resp() method is an execution method provided by the process executor of the web-based rule engine, which is used to execute the rule chain and return the response result.
10. The web-based service modification method according to claim 4, characterized in that: By registering the business event name and / or node component name, combined with HTTP call, cross-server calling of business events and / or node components is implemented to perform business modification.