State change control method, device, electronic device and storage medium
By receiving status change requests and using directed graphs and XML configuration files to manage the order status process, the problem of insufficient flexibility in order status control in the existing technology is solved, and flexible status change control and simplified code management are achieved.
Patent Information
- Application Number
- CN202210208082.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-03
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-03-03
AI Technical Summary
The existing technology has the problem of poor flexibility in state change control in order status control, especially when controlling the status processes of multiple business orders. The code volume is large, process management is difficult, maintenance is complex, and the existing methods are difficult to adapt to the continuous iteration of business needs.
By receiving state change requests, obtaining the directed graph of the target business object, and using the process nodes and sequence relationships in the directed graph, executing the code logic corresponding to the code logic identifier to achieve the change of object state, using XML configuration files to manage the state process, avoiding the separation of code logic and business logic.
It improves the flexibility of order status change control, reduces the amount of code, simplifies process management, and enhances the system's maintainability and sustainable iteration capabilities.
Smart Images

Figure CN114663177B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a state change control method, device, electronic device and storage medium. Background Art
[0002] In a typical business object system, different object operation processes often need to be developed for different business lines and business products. For example, in an order system, the logical control process for status changes in a rental rental order is completely different from the logical control process for status changes in a rental deposit order. In some order systems, different order status control processes may be developed for dozens or even dozens of different business line orders.
[0003] In the prior art, there are mainly the following solutions for controlling order status: hard-coded code, workflow engine, and state machine. Among them, hard-coded code directly controls the order status flow and the corresponding business operations when the order status changes (including microservice calls, database updates, logging, business logic operations, etc.) through if-else logic in the code. The workflow engine can manage process nodes and flow directions. For different business orders, different workflows are developed for different types of business orders through different process nodes and flows. The process nodes contain business logic operations corresponding to different order statuses. Flow control determines the subsequent states that the current order status can flow to. For example, only after payment can it reach the refund node or the payment to the seller node. The state machine is composed of order status and combination logic. It can perform state transitions based on the current order status and pre-set order process states. It is the control center that coordinates signal actions and completes specific operations. For example, an order can have states such as pending payment, paid, refunded, payment to the seller, and order completed. The pre-set combination logic means that an order can only transition to the refund state or payment to the seller state when it is in the paid state. The paid state cannot directly transition to other states such as the completed state or the pending payment state.
[0004] For a single or small number of business order status processes, the hard-coded approach allows for different logic code controls for different order status processes. However, for controlling three or more, or even more than a dozen, different order status processes, not only does it result in a large amount of code, difficult process management, and confusing business logic, but it also becomes complex and unmaintainable as business requirements continue to evolve. While workflow engines can address order process control issues, they are complex and cumbersome. Many of their functions are not solely designed to address process control, and the state operations corresponding to each process node may require customization. Workflow engines offer no advantages in addressing these issues, and are rather cumbersome. State machines focus more on the logical control of state processes, but each state generally corresponds to specific business logic, not just state logical control. Regardless of the format in which the state machine process is stored, manual configuration and management are difficult for more complex processes. Therefore, existing approaches suffer from the problem of limited flexibility in state change control. Summary of the Invention
[0005] Embodiments of the present invention provide a state change control method, device, electronic device, and storage medium to improve the flexibility of state change control.
[0006] According to a first aspect of an embodiment of the present invention, a state change control method is provided, comprising:
[0007] receiving a state change request for a target business object, wherein the state change request includes a current object state;
[0008] Acquire a directed graph corresponding to the target business object, the directed graph including a plurality of process nodes and a sequential relationship between the plurality of process nodes, the process nodes including a code logic identifier and an object state;
[0009] According to the current object state and the sequence relationship, the code logic corresponding to the code logic identifier of the process node is controlled to execute, and the object state change is executed.
[0010] According to a second aspect of an embodiment of the present invention, a state change control device is provided, comprising:
[0011] A change request receiving module, configured to receive a state change request for a target business object, wherein the state change request includes a current object state;
[0012] A directed graph acquisition module, configured to acquire a directed graph corresponding to the target business object, wherein the directed graph includes a plurality of process nodes and a sequential relationship between the plurality of process nodes, and the process nodes include a code logic identifier and an object state;
[0013] The state change control module is used to control the execution of the code logic corresponding to the code logic identifier of the process node according to the current object state and the sequence relationship, and execute the change of the object state.
[0014] According to the third aspect of an embodiment of the present invention, an electronic device is also provided, comprising: a processor, a memory, and a computer program stored on the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the state change control method described in the first aspect are implemented.
[0015] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the state change control method described in the first aspect are implemented.
[0016] The state change control method, device, electronic device and storage medium provided by the embodiments of the present invention obtain a directed graph corresponding to the target business object when receiving a state change request for the target business object. The directed graph includes multiple process nodes and the sequential relationship between the multiple process nodes. The process node includes a code logic identifier and an object state. According to the current object state and the sequential relationship in the directed graph, the code logic corresponding to the code logic identifier of the process node is controlled to execute, and the object state change is executed. The business code logic and the control of the object state change are combined through the directed graph, thereby avoiding the separation of the two and improving the flexibility of the object state change control. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of a state change control method provided by an embodiment of the present invention;
[0018] Figure 2 It is a logic control diagram of the state flow of the business object of the house rental service in an embodiment of the present invention;
[0019] Figure 3 is an example diagram of a directed graph of a house rental service in an embodiment of the present invention;
[0020] Figure 4 This is a structural block diagram of a state change control device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0022] Figure 1 This is a flow chart of a state change control method provided by an embodiment of the present invention. The state change control method can be executed by an electronic device such as a server. Figure 1 As shown, the state change control method includes:
[0023] Step 110: Receive a state change request for a target business object, where the state change request includes the current object state.
[0024] A business object is business data with multiple states and various types of logical controls. Examples of such business objects include orders and contracts. A target business object is object data for a specific target business, such as a rental order, a rental deposit order, or other business orders. For example, any other order data has multiple states and various types of logical controls.
[0025] After a target business object is generated, it can receive a state change request based on a user's operation. The state change request includes the current object state. For example, after a user submits a target business object, the server receives a state change request for the target business object. If the target business object is a target business order, the current state of the target business order is pending payment.
[0026] Step 120: Obtain a directed graph corresponding to the target business object, wherein the directed graph includes a plurality of process nodes and a sequence relationship between the plurality of process nodes, and the process nodes include a code logic identifier and an object state.
[0027] A directed graph corresponding to a business object can be pre-generated based on a configuration file and saved. Upon receiving a state change request for a target business object, the directed graph corresponding to the target business object can be retrieved from the pre-saved directed graph corresponding to the business object. The directed graph includes multiple process nodes and sequential relationships between the multiple process nodes. Each process node includes a corresponding code logic identifier, and the code logic corresponding to the code logic identifier can be executed. The process node may also include an object state.
[0028] Step 130 : Control the execution of the code logic corresponding to the code logic identifier of the process node according to the current object state and the sequence relationship, and execute the change of the object state.
[0029] Based on the current object state, the process node where the current object state is located can be determined. The code logic corresponding to the code logic identifier of the process node can be obtained, and the code logic can be executed to obtain the execution result. Based on the sequential relationship between the process nodes in the directed graph, the next process node can be determined. Then, based on the object state of the next process node, the object state can be changed. The same code logic can be reused in different target business objects. In this case, the code logic only needs to be written once and can be reused in different target business objects based on the code logic identifier, which can reduce the amount of code.
[0030] In one embodiment of the present invention, according to the current object state and the sequential relationship, the code logic corresponding to the code logic identifier of the process node is controlled to be executed, and the change of the object state is executed, including: determining the current process node corresponding to the current object state; obtaining the current code logic corresponding to the code logic identifier of the current process node, executing the current code logic, and obtaining user operation data based on the execution result; determining the next process node of the current process node according to the user operation data and the sequential relationship, and changing the current object state according to the object state of the next process node.
[0031] Based on the current object state, the current process node corresponding to the current object state can be determined, the current code logic corresponding to the code logic identifier of the current process node can be obtained, and the current code logic can be executed. When the current code logic is successfully executed, user operation data can be obtained. For example, when the target business object is a target business order and the current object state is payment on behalf of another, the current code logic can be to display a payment page, and the user can make a payment based on the payment page. At this time, user operation data such as payment success or payment rejection can be obtained based on the displayed payment page. After obtaining the user operation data, the next process node of the current process node can be determined based on the user operation data and the sequential relationship between each node in the directed graph. Therefore, the current object state can be changed based on the object state of the next process node. For example, when the user payment is successful, the next process node can be paid, which means that the current object state is changed to paid. When the user rejects the payment, the next process node can be transaction closed, which means that the current object state is changed to transaction closed.
[0032] By executing the current code logic and obtaining user operation data, the next process node of the current process node can be accurately determined based on the user operation data and the sequential relationship between each process node in the directed graph, so that the object state can be accurately changed.
[0033] In one embodiment of the present invention, the process node further includes node attributes;
[0034] Determining the next process node of the current process node according to the user operation data and the sequence relationship includes: determining the next process node of the current process node according to the user operation data, the node attribute of the current process node and the sequence relationship.
[0035] The node attributes include jumping to the target process node or changing to the target object state. The node attribute for jumping to the target process node can be the gotoState attribute, which represents the state of automatic execution of the jump. A node execution link can be generated through the gotoState attribute. For example:
[0036] <flowNode state="1"name="A"codeClass="c"gotoState=2 / >
[0037] <flowNode state="2"name="B"codeClass="b"gotoState=3 / >
[0038] <flowNode state="3"name="C"codeClass="c"gotoState=4 / >
[0039] <flowNode state="4"name="D"codeClass="d"gotoState=5 / >
[0040] In the above configuration, state represents the object state of the process node, name represents the node name, codeClass identifies the code logic, and gotoState represents the gotoState attribute, which indicates the change to the target object state. With this configuration, the states corresponding to the four process nodes A, B, C, and D will be automatically executed. Nodes B and C can remain unchanged, and the state change is ultimately made by node D. By configuring gotoState, you can execute specific program code logic within a series of process nodes.
[0041] Node attributes can include attribute names and attribute values. The above jumps to the target process node or changes to the target object state are attribute values. Attribute names and attribute values can be expanded arbitrarily according to different needs. For example, the state attribute can be changed to the attr attribute. You can also add any number of custom attributes to the process node. For example, a process node is used to change the object state 1 to the specified object state N, and N can be changed arbitrarily. At this time, you can set the state of the process node to the state of the target object. <flownode>In the configuration, the state value to be changed is configured as an attribute. For example:
[0042] <flowNode state="1"name="A"codeClass="clzzA"updtState=2>
[0043] The program operation of clzzA is simply to change state 1 to state 2 corresponding to the updtState attribute. At this point, clzzA can be reused as a general node.
[0044] When determining the next process node of the current process node, in addition to determining it based on user operation data and the sequential relationship between the process nodes in the directed graph, it is also necessary to determine it in combination with the node attributes of the current process node. For example, when the current process node has a gotoState attribute, the next process node can be determined based on the gotoState attribute.
[0045] You can configure the corresponding node attributes according to your needs, thereby further improving the flexibility of object state changes through the node attributes of the process nodes. For example, if the automatic execution function (gotoState attribute) is configured, the subsequent process nodes will continue to be executed until the nodes that are not configured for automatic jump are executed.
[0046] The state change control method provided by an embodiment of the present invention obtains a directed graph corresponding to the target business object when receiving a state change request for the target business object. The directed graph includes multiple process nodes and the sequential relationship between the multiple process nodes. The process node includes a code logic identifier and an object state. According to the current object state and the sequential relationship in the directed graph, the code logic corresponding to the code logic identifier of the process node is controlled to execute, and the object state change is executed. The business code logic and the control of the object state change are combined through the directed graph, thereby avoiding the separation of the two and improving the flexibility of the object state change control.
[0047] Based on the above technical solution, before obtaining the directed graph corresponding to the target business object, it also includes: obtaining a configuration file, the configuration file including the state flow of the target business object; parsing the configuration file to generate a directed graph corresponding to the state flow of the target business object.
[0048] The configuration file is in XML format. Using XML-formatted configuration files allows for visualization. For processes of moderate complexity, the overall object state flow can be intuitively visualized, and corresponding flow charts can be easily drawn based on XML, effectively reducing the error rate of process configuration and increasing configuration speed. Currently, a wide range of software (including all browsers) and text editing tools support XML's tree-like display, making it virtually unnecessary to install additional tools to achieve high-level XML visualization.
[0049] The state flow of the target business object can be configured in advance through a configuration file. When the state change control of the target business object is performed, the configuration file can be obtained and parsed to determine each process node and obtain the sequential relationship between each process node. Based on the sequential relationship between each process node, a directed graph corresponding to the state flow of the target business object is generated.
[0050] The logical control of object state changes can be flexibly configured through configuration files, and the business logic can be controlled through the logical code of the process node, which changes the separation of logical control of object state changes and business logic, avoids the use of if-else judgments, reduces the amount of code, and improves the flexibility of object state change control.
[0051] Based on the above technical solution, the configuration file also includes the status flow of other business objects other than the target business object;
[0052] The method further includes generating a directed graph corresponding to the state flow of each of the other business objects.
[0053] The configuration file can be a configuration file that includes the state processes of all business objects. The state process of each business object can be a business object node in the configuration file. Therefore, the state processes of all business objects can be configured in one configuration file. By parsing the configuration file, each business object node can be obtained. By parsing the state process of each business object node, the process nodes under each business object node and the sequential relationship between the process nodes can be obtained. Therefore, a directed graph corresponding to the state process of each business object can be generated, that is, a directed graph corresponding to the state process of the target business object and a directed graph corresponding to the state process of other business objects other than the target business object can be generated. This enables the flexible configuration of the state process of each business object based on the configuration file.
[0054] The embodiment of the present invention can configure the object state process corresponding to each business based on the configuration file, so that the control engine that controls the object state change instantiates the executable object state process by parsing the configuration file. The object state process includes: object process control, code logic corresponding to different states (specific implementation classes, methods), preconditions for state jumps, etc.
[0055] Taking the business object as business order and the target business as rental business as an example, the logic control diagram of the state process of the business order is as follows: Figure 2 As shown, when a rental business order is generated, the order enters the pending payment state, and then it can be converted to the order closed state or the order paid state based on whether the payment is made. After the order paid state, it can be converted to the refund application state or the check-in confirmed state. After the refund application state, it can be converted to the order closed state or the order paid state based on whether the payment is successful. After the check-in confirmed state, it can be converted to the payment seller state. After the payment seller state, it can be converted to the order closed state or the check-in confirmed state based on whether the payment is successful.
[0056] The state flow of the above business object can be converted into the following id="1" <flow>The XML configuration file corresponding to the node:
[0057]
[0058]
[0059] In the above configuration file, allflow represents the root node. There can be one root node in the XML configuration file, and all the state processes of each business object are child nodes of the root node. Flow represents the business object node, that is, the state process of the business object. The flow node may include: node name (name), business identifier (bizIdentify) and other attributes. There can be any number of other attributes, and the attribute name can be expanded as needed. A business object node may include multiple process nodes (flowNode). flowNode represents the process node. The process node is a component of the state process of the business object. Each process node may include: object state (State), node name (Name), code logic identifier (codeClass, such as code implementation class), and may also include gotoState attribute and other attributes. The gotoState attribute is a state that can jump to a specified other process node. After the jump, the logic code of the corresponding process node will be directly executed. There can be any number of other attributes, and the attribute name can be expanded as needed.
[0060] According to the above XML configuration file, the generated directed graph is as follows Figure 3 As shown, Figure 3 The directed graph shown is an example of an in-memory data structure. The connectivity of a directed graph can be used to control changes in object states. The adjacent process nodes of any process node represent a set of logical states that can be changed. For example, the process node corresponding to "Payment Transfer (104)" is adjacent to the two process nodes "Payment Success (106)" and "Payment Failure (107)." Therefore, state 104 can be transformed into states 106 and 107. However, because the graph is directed, states 106 and 107 cannot reach node 104. Therefore, states 106 and 107 cannot directly transform into state 104.
[0061] In a directed graph, a process node's directly adjacent process nodes represent states that can be changed, while non-adjacent process nodes (any process nodes that the current process node cannot directly reach in one step) represent states that cannot be changed. Any two process nodes may be unidirectionally connected or bidirectionally connected (strongly connected). In unidirectional connectivity, state A can change to state B or C, but states B and C cannot revert to state A. In strong connectivity, state A can change to state B, and state B can revert to state A. Each process node can correspond to specific code logic and can change or not change the state of data. For example, when moving from node A to node B, node B does not necessarily need to complete the state change operation. Node B can be configured with the gotoState attribute to jump to node C, which then completes the state change operation. Each process node can also be configured with the aforementioned gotoState attribute and / or other node attributes. The state flow of each business object is managed through a configuration file, which can be converted into a directed graph based on the configuration file. When performing state change control, the directed graph determines the execution order of the corresponding code logic of the process nodes and whether the process nodes are executable.
[0062] The embodiment of the present invention can use the XML configuration method, which has better visualization effect; for XML parsing technology, various programming languages have relatively mature and convenient tool libraries, which can improve development efficiency; for systems with multiple (more than 3) state change logic controls, this solution can significantly reduce code complexity and code volume, enhance code readability, and achieve sustainable iterative development of the system; the gotoState configuration can be used to execute a series of process nodes (each node corresponds to corresponding logic code), thereby improving the versatility of the code logic implemented by each process node and improving reusability, thereby reducing the amount of repeated code; the separation of state change logic control and business logic is changed, and logic control is configured and managed through configuration files instead of the traditional if-else judgment in the code. The business logic can be abstracted into a series of execution units (process nodes) with smaller granularity. For reusable execution units, multiple configurations can be performed, or they can be directly jumped. For example, the "transaction closed" node in the above example can automatically jump to the "transaction closed" node and execute automatically after the refund successful and payment successful nodes are executed.
[0063] Figure 4 This is a structural block diagram of a state change control device provided by an embodiment of the present invention. Figure 4 As shown, the state change control device includes:
[0064] A change request receiving module 410 is configured to receive a state change request for a target business object, wherein the state change request includes a current object state;
[0065] A directed graph acquisition module 420 is configured to acquire a directed graph corresponding to the target business object, wherein the directed graph includes a plurality of process nodes and a sequential relationship between the plurality of process nodes, and the process nodes include a code logic identifier and an object state;
[0066] The state change control module 430 is used to control the execution of the code logic corresponding to the code logic identifier of the process node according to the current object state and the sequence relationship, and execute the change of the object state.
[0067] Optionally, the device further includes:
[0068] A configuration file acquisition module, configured to acquire a configuration file, wherein the configuration file includes a state flow of the target business object;
[0069] The configuration file parsing module is used to parse the configuration file and generate a directed graph corresponding to the state flow of the target business object.
[0070] Optionally, the configuration file further includes status processes of other business objects other than the target business object;
[0071] The configuration file parsing module is also used to:
[0072] A directed graph corresponding to the state flow of each of the other business objects is generated.
[0073] Optionally, the file format of the configuration file is XML.
[0074] Optionally, the state change control module includes:
[0075] A current node determining unit, configured to determine a current process node corresponding to the current object state;
[0076] an acquiring unit, configured to acquire the current code logic corresponding to the code logic identifier of the current process node, execute the current code logic, and acquire user operation data based on the execution result;
[0077] The object state changing unit is used to determine the next process node of the current process node according to the user operation data and the sequence relationship, and change the current object state according to the object state of the next process node.
[0078] Optionally, the process node further includes node attributes;
[0079] The object state changing unit further includes:
[0080] The next node determination subunit is used to determine the next process node of the current process node according to the user operation data, the node attribute of the current process node and the sequence relationship.
[0081] Optionally, the node attributes include jumping to a target process node or changing to a target object state.
[0082] The state change control device provided in the embodiment of the present invention is used to implement the various steps of the state change control method described in the embodiment of the present invention. The specific implementation of each module of the device can be found in the corresponding steps and will not be repeated here.
[0083] The state change control device provided by an embodiment of the present invention obtains a directed graph corresponding to the target business object when receiving a state change request for the target business object. The directed graph includes multiple process nodes and the sequential relationship between the multiple process nodes. The process node includes a code logic identifier and an object state. According to the current object state and the sequential relationship in the directed graph, the code logic corresponding to the code logic identifier of the process node is controlled to execute, and the object state change is executed. The business code logic and the control of the object state change are combined through the directed graph, thereby avoiding the separation of the two and improving the flexibility of the object state change control.
[0084] Preferably, an embodiment of the present invention also provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and runnable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned state change control method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0085] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the various processes of the state change control method embodiment described above are implemented, and the same technical effects are achieved. To avoid repetition, the details are not described here. The computer-readable storage medium may be, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0086] It should be noted that, in this document, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0087] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0088] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
[0089] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0090] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0091] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0092] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0093] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0094] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, ROM, RAM, a magnetic disk, or an optical disk.
[0095] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.< / flow> < / flownode>
Claims
1. A state change control method, characterized in that: include: receiving a state change request for a target business object, wherein the state change request includes a current object state; Obtaining a directed graph corresponding to the target business object, the directed graph including a plurality of process nodes and a sequential relationship between the plurality of process nodes, the process nodes including a code logic identifier and an object state, the directed graph being generated based on a configuration file in XML format; According to the current object state and the sequential relationship, the code logic corresponding to the code logic identifier of the process node is controlled to be executed, and the object state change is executed, including: determining the current process node corresponding to the current object state; obtaining the current code logic corresponding to the code logic identifier of the current process node, executing the current code logic, and obtaining user operation data based on the execution result; determining the next process node of the current process node according to the user operation data and the sequential relationship, and changing the current object state according to the object state of the next process node; the code logic is reused in different target business objects based on the code logic identifier.
2. The method according to claim 1, characterized in that Before obtaining the directed graph corresponding to the target business object, the method further includes: Obtaining a configuration file, wherein the configuration file includes a state flow of the target business object; The configuration file is parsed to generate a directed graph corresponding to the state flow of the target business object.
3. The method according to claim 2, characterized in that The configuration file also includes the status flow of other business objects other than the target business object; The method further comprises: A directed graph corresponding to the state flow of each of the other business objects is generated.
4. The method according to claim 2 or 3, characterized in that The file format of the configuration file is XML.
5. The method according to claim 1, wherein The process node also includes node attributes; Determining the next process node of the current process node according to the user operation data and the sequence relationship includes: The next process node of the current process node is determined according to the user operation data, the node attribute of the current process node and the sequence relationship.
6. The method according to claim 5, characterized in that The node attributes include jumping to a target process node or changing to a target object state.
7. A state change control device, characterized in that: include: A change request receiving module, configured to receive a state change request for a target business object, wherein the state change request includes a current object state; A directed graph acquisition module, configured to acquire a directed graph corresponding to the target business object, wherein the directed graph includes a plurality of process nodes and a sequential relationship between the plurality of process nodes, the process nodes include code logic identifiers and object states, and the directed graph is generated based on a configuration file in XML format; A state change control module is used to control the execution of the code logic corresponding to the code logic identifier of the process node and execute the change of the object state according to the current object state and the sequential relationship, including: determining the current process node corresponding to the current object state; obtaining the current code logic corresponding to the code logic identifier of the current process node, executing the current code logic, and obtaining user operation data based on the execution result; determining the next process node of the current process node according to the user operation data and the sequential relationship, and changing the current object state according to the object state of the next process node; the code logic is reused in different target business objects based on the code logic identifier.
8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the state change control method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the state change control method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Business process management method and equipment and computer readable storage medium
CN107450919A
Payment rejection task processing method, payment rejection task processing device and server
CN110728519A