State management method and device, storage medium and electronic equipment

By automatically generating state management core configuration files and code files, the problems of cumbersome and high cost in the state management operation in the existing technology are solved, convenient code generation is realized, system maintenance complexity and cost are reduced, and scalability is enhanced.

CN120335769APending Publication Date: 2025-07-18DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510484075.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

Existing software programs are cumbersome and costly in state management, making it difficult to generate state management code files easily, resulting in developers investing a lot of time and energy.

Method used

By detecting the status flow core configuration file generation requirements, the status management core configuration file is automatically generated, and when the status management code file generation requirements are detected, the target status management code file is generated based on the status management core configuration file.

Benefits of technology

It reduces the complexity and cost of system maintenance, improves the scalability of state management, and avoids the tedious operation of developers to manually generate code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335769A_ABST
    Figure CN120335769A_ABST
Patent Text Reader

Abstract

The invention provides a state management method and device, a storage medium and electronic equipment, and the method comprises the steps: determining state circulation relation indication data and state management code basic data when a state circulation core configuration file generation demand is detected; generating a state management core configuration file based on the state circulation relation indication data and the state management code basic data; and when a state management code file generation demand is detected, generating a target state management code file based on the state management core configuration file. According to the embodiment of the invention, the target state management code file can be conveniently generated, so that the cost is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a state management method, apparatus, storage medium, and electronic device. Background Art

[0002] Currently, existing software programs usually involve complex business processes (such as transaction processing, order management, customer service, etc.); in the design of existing software programs, state management is a key design consideration, especially in the management of these complex processes. In this regard, in order to effectively handle these complex states and processes, in software design, state management is usually performed through a finite-state machine (FSM, which consists of a finite number of states, and the transition between each state is triggered by an input or an event. The FSM can be deterministic (DFA) or non-deterministic (NFA), that is, a mathematical model representing a finite number of states and behaviors such as the flow and actions between these states); through the state machine pattern (State Machine Pattern, which is a design pattern used to manage the possible states in a system and the transitions between states. Through this pattern, the behavior of the system can be modeled as multiple states and their transitions, simplifying the processing of complex state and transition logic). Developers can clearly define complex state logic as a set of finite state and transition (i.e., flow) rules. However, related technologies usually manage large-scale states and transitions manually to generate state management code files, resulting in cumbersome operations and high costs. Based on this, there is currently no good solution for how to conveniently generate state management code files to effectively reduce costs. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a state management method, apparatus, storage medium, and electronic device to solve problems such as cumbersome operations and high costs in related technologies; that is, the embodiments of the present invention can automatically generate a state management core configuration file when detecting a requirement for generating a state transition core configuration file, and automatically generate a target state management code file when detecting a requirement for generating a state management code file, thereby conveniently generating a state management code file to effectively reduce costs, which can effectively avoid developers investing a large amount of time and effort to ensure the correctness of the state machine, and further reduce the complexity and cost of system maintenance, and can effectively enhance the scalability of state management.

[0004] According to an aspect of an embodiment of the present invention, a state management method is provided, and the method includes:

[0005] When detecting a requirement for generating a state transition core configuration file, determining state transition relationship indication data and state management code basic data;

[0006] Generate a state management core configuration file based on the state transition relationship indication data and the state management code basic data;

[0007] When detecting a requirement for generating a state management code file, generate a target state management code file based on the state management core configuration file.

[0008] According to another aspect of the embodiments of the present invention, there is provided a state management device, the device includes:

[0009] A determination unit, configured to determine state transition relationship indication data and state management code basic data when detecting a requirement for generating a state transition core configuration file;

[0010] A processing unit, configured to generate a state management core configuration file based on the state transition relationship indication data and the state management code basic data;

[0011] The processing unit is further configured to generate a target state management code file based on the state management core configuration file when detecting a requirement for generating a state management code file.

[0012] According to another aspect of the embodiments of the present invention, there is provided an electronic device, the electronic device includes a processor and a memory storing a program, wherein the program includes instructions, and when the instructions are executed by the processor, the processor executes the methods mentioned above.

[0013] According to another aspect of the embodiments of the present invention, there is provided a non-transitory computer-readable storage medium storing computer instructions, and the computer instructions are used to cause a computer to execute the methods mentioned above.

[0014] In the embodiments of the present invention, when detecting a requirement for generating a state transition core configuration file, state transition relationship indication data and state management code basic data can be determined; and based on the state transition relationship indication data and the state management code basic data, a state management core configuration file can be generated. Further, when detecting a requirement for generating a state management code file, a target state management code file can be generated based on the state management core configuration file. The embodiments of the present invention can automatically generate a state management core configuration file when detecting a requirement for generating a state transition core configuration file, so as to automatically generate a target state management code file when detecting a requirement for generating a state management code file, thereby conveniently generating a state management code file to effectively reduce costs; that is to say, the embodiments of the present invention can effectively avoid developers from investing a large amount of time and effort to ensure the correctness of the state machine, thereby reducing the complexity and cost of system maintenance, and can effectively enhance the scalability of state management. Description of the Drawings

[0015] In the following description of exemplary embodiments with reference to the accompanying drawings, more details, features, and advantages of the present invention are disclosed. In the drawings:

[0016] Figure 1 A flowchart showing a state management method according to an exemplary embodiment of the present invention is illustrated;

[0017] Figure 2 A schematic diagram of a module according to an exemplary embodiment of the present invention is illustrated;

[0018] Figure 3 A flowchart showing another state management method according to an exemplary embodiment of the present invention is illustrated;

[0019] Figure 4 A schematic diagram showing a diagram for drawing a state transition relationship according to an exemplary embodiment of the present invention is illustrated;

[0020] Figure 5 A schematic diagram showing the generation of a state management code file according to an exemplary embodiment of the present invention is illustrated;

[0021] Figure 6 A schematic block diagram of a state management device according to an exemplary embodiment of the present invention is illustrated;

[0022] Figure 7 A structural block diagram of an exemplary electronic device capable of implementing the embodiments of the present invention is illustrated. Detailed Embodiments

[0023] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present invention. It should be understood that the drawings and embodiments of the present invention are for exemplary purposes only and are not used to limit the scope of protection of the present invention.

[0024] It should be understood that the various steps recited in the method embodiments of the present invention can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this regard.

[0025] As used herein, the term "including" and its variations are open-ended, that is, "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts such as "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence relationship of the functions performed by these devices, modules or units.

[0026] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless clearly specified otherwise in the context, it should be understood as "one or more".

[0027] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0028] It should be noted that the execution subject of the state management method provided in the embodiments of the present invention can be one or more electronic devices, and the embodiments of the present invention do not limit this; among them, the electronic device can be a terminal (i.e., a client) or a server. Then, when the execution subject includes multiple electronic devices, and at least one terminal and at least one server are included in the multiple electronic devices, the state management method provided in the embodiments of the present invention can be jointly executed by the terminal and the server. Correspondingly, the terminal mentioned herein can include but not be limited to: smart phones, tablet computers, laptop computers, desktop computers, intelligent voice interaction devices, etc. The server mentioned herein can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc.

[0029] Optionally, an embodiment of the present invention may further provide a state management tool (which may also be referred to as a state management code generation and dynamic flow chart design tool); optionally, an electronic device may include a state management tool (i.e., installed with a state management tool), that is to say, the execution subject of the state management method provided by the embodiment of the present invention may be the state management tool in the electronic device, that is, the electronic device may execute the state management method provided by the embodiment of the present invention through the state management tool; or, the electronic device used to execute the state management method may be used as the state management tool, so that the execution subject of the state management method may be the state management tool, and so on.

[0030] Based on the above description, an embodiment of the present invention proposes a state management method, which can be executed by the above-mentioned electronic device (terminal or server); or, the state management method can be jointly executed by the terminal and the server; or, the state management method can be executed by the state management tool in the electronic device, and so on. For the sake of convenience of description, hereinafter, the state management method executed by the electronic device will be taken as an example for illustration; as Figure 1 shown, the state management method may include the following steps S101 - S103:

[0031] S101, when detecting a requirement for generating a state transition core configuration file, determine state transition relationship indication data and state management code basic data.

[0032] Optionally, the electronic device may include a configuration center module (which can be used to manage user configurations, error detection, optimization suggestions, configuration file generation, etc.). In this case, the electronic device may detect the requirement for generating a state transition core configuration file through the configuration center module, and then trigger the execution of the above-mentioned determination of state transition relationship indication data and state management code basic data to generate a state management core configuration file.

[0033] Optionally, the electronic device may determine that it has detected a requirement for generating a state transition core configuration file every preset core configuration file generation interval duration; or, it may determine that it has detected a requirement for generating a state transition core configuration file when detecting a state transition core configuration file generation instruction, and so on; the embodiment of the present invention does not make any limitation in this regard. Optionally, the preset core configuration file generation interval duration may be set according to experience or according to actual requirements, and the embodiment of the present invention does not make any limitation in this regard. Optionally, a target object (such as any user) may execute a state transition core configuration file generation operation, then the electronic device may determine that it has detected a state transition core configuration file generation instruction when detecting the state transition core configuration file generation operation.

[0034] It should be noted that the embodiments of the present invention do not limit the specific execution manner of the operation for generating the state transition core configuration file (for example, the operation for generating the state transition core configuration file can be executed by voice, or the operation for generating the state transition core configuration file can be implemented by clicking or long-pressing the button for generating the state transition core configuration file, etc.). Optionally, the long-press operation can refer to an operation with a pressing duration greater than a preset pressing duration threshold; optionally, the preset pressing duration threshold can be set according to experience or according to actual requirements, and the embodiments of the present invention do not limit this. Optionally, the electronic device may include a graphical user interface module (which can be responsible for user interaction and graphical display). In this case, the operation for generating the state transition core configuration file can be executed by the target user through the graphical user interface module. For example, the electronic device can display a state management graphical user interface (which can also be simply referred to as a graphical user interface) through the graphical user interface module. Then, the target object can execute the operation for generating the state transition core configuration file on the state management graphical user interface to implement the operation for generating the state transition core configuration file through the graphical user interface module, etc. Optionally, the graphical user interface module can be located in the same electronic device as the configuration center module (which can also be referred to as the service layer), or in different electronic devices. The embodiments of the present invention do not limit this; based on this, the electronic device (such as one or more electronic devices) may include a front end (the front end may include a graphical user interface module, which can also be referred to as the user interface layer) and a back end (the back end may include a configuration center module, etc.).

[0035] In a specific implementation, the state transition core configuration file generation instruction may carry state transition relationship indication data and state management code basic data; in this case, the state transition relationship indication data and the state management code basic data can be determined through the state transition core configuration file generation instruction. In another specific implementation, the electronic device can obtain the state transition relationship indication data and the state management code basic data from the graphical user interface module through the configuration center module to implement the determination of the state transition relationship indication data and the state management code basic data, etc.; the embodiments of the present invention do not limit this. Exemplarily, the state management code basic data, etc. can also be obtained from the data storage layer, etc.

[0036] Optionally, the configuration center module can implement real-time two-way communication through the WebSocket (a network communication protocol) technology, that is, a two-way communication channel can be established between the front end and the back end through WebSocket. For example, the configuration center module obtains the state transition relationship indication data and the state management code basic data, etc. through WebSocket; optionally, the front end can transfer the flow design behavior to the back end (that is, transfer it to the configuration center module), and the configuration center module can perform real-time processing and feedback on the data.

[0037] Optionally, the above state transition relationship indication data may be set by the target object through the state management graphical user interface; based on this, the electronic device may, in response to a state creation operation detected in the state management graphical user interface, create a state node for the state indicated by the state creation operation, where one state node is used to represent one state; and / or, in response to a transition design operation detected in the state management graphical user interface, update the target state transition relationship set according to the state transition relationship indicated by the transition design operation; and / or, in response to an event configuration operation detected in the state management graphical user interface, determine the to-be-configured state transition relationship and the configuration event indicated by the event configuration operation, and use the configuration event as the event for the to-be-configured state transition relationship. An event for a state transition relationship is supported to indicate the transition condition for the corresponding state transition relationship (i.e., an event can be used to indicate the condition for the transition relationship between states), and so on. Optionally, the electronic device may, through the graphical user interface module, in response to a state creation operation detected in the state management graphical user interface, and / or in response to a transition design operation detected in the state management graphical user interface, and / or in response to an event configuration operation detected in the state management graphical user interface, and so on; in this case, for any operation performed by the target object on the state management graphical user interface, the electronic device can respond through the graphical user interface module.

[0038] It should be noted that the embodiments of the present invention do not limit the specific execution manners of operations such as the state creation operation, the transition design operation, and the event configuration operation.

[0039] In one implementation manner, the target object may perform a state creation operation through a state creation component on the state management graphical user interface; for example, after the target object inputs the state indication data of the newly created state in the state creation area, it may perform a click operation or a long-press operation (i.e., an operation with a pressing duration greater than the preset pressing duration threshold) on the state creation component, etc., to implement the execution of the state creation operation. At this time, the state indicated by the state creation operation may be the state indicated by the state indication data input in the state creation area, and so on. Optionally, one state indication data can be used to indicate one state; optionally, the state indication data of one state may include, but is not limited to, at least one of the following: the state name of the corresponding state, the state description, the state attributes (such as the color, border, font, etc. of the state node used to represent the corresponding state), the state serial number, and so on. The embodiments of the present invention do not limit this. Optionally, the preset pressing duration threshold may be set according to experience or according to actual requirements. The embodiments of the present invention do not limit this.

[0040] Correspondingly, the target object can perform a flow design operation through the drag-and-drop component on the state management graphical user interface, so as to construct a process on the state management graphical user interface and connect the flow relationships between states (that is, connect the flow relationships between state nodes to achieve the flow relationships between states). Optionally, the components on the state management graphical user interface can be implemented through a React component library (a UI (User Interface) component library), that is, the embodiments of the present invention can design state nodes and flow relationships (i.e., state flow relationships, and a flow relationship can be represented by an edge) using a React component library at the front end; in this case, each state node (such as a circular or rectangular icon, etc.) can be used as a React component (abbreviated as a component) respectively, supporting being dragged and placed, and / or each edge supports being dragged and placed, and so on. Optionally, the electronic device can use React DnD (a React drag-and-drop library) to handle the drag behavior (that is, handle the drag operation performed by the target object) to implement the flow design operation, so that each state node can be connected to other states by dragging to achieve state connection; in this case, the electronic device can be controlled through the API (Application Program Interface) of React DnD. Optionally, the electronic device can use libraries such as react-flow (a library for creating node-based applications, supporting custom node and edge types) and / or react-diagrams (a very simple and practical flow and process-oriented graphical library) to manage state nodes and edges (i.e., flow relationships), so as to ensure the display of the connection lines and the connection between states. Based on this, each state node and connection line (i.e., edge) on the state management graphical user interface can be used as a drag object respectively, so as to define a drag source (which can also be called a source state, that is, the state represented by the starting state node of an edge) and a drag target (that is, a target state, that is, the state represented by the ending state node of an edge), that is to say, the target object can perform a drag operation on at least one drag object to implement the flow design operation, so as to define the source state and target state indicated by any edge. Optionally, the number of state flow relationships indicated by the flow design operation can be one or more, and the embodiments of the present invention do not limit this; optionally, a state flow relationship can include but is not limited to at least one of the following: source state, target state, flow condition, and state event (which can be abbreviated as an event), etc., and the embodiments of the present invention do not limit this.Optionally, the state transition relationships indicated by the transition design operation may include, but are not limited to, at least one of the following: state transition relationships to be added, state transition relationships to be deleted, etc., which are not limited in the embodiments of the present invention; based on this, the electronic device may add the state transition relationships to be added indicated by the transition design operation to the target state transition relationship set, and / or delete the state transition relationships to be deleted from the target state transition relationship set, etc., so as to update the target state transition relationship set according to the state transition relationships indicated by the transition design operation, and so on.

[0041] Correspondingly, the target object may implement an event configuration operation on the state transition relationship to be configured (which may be any state transition relationship) through the event configuration component; by way of example, the target object may perform a click operation on any state transition relationship on the state management graphical user interface, then the electronic device may display the event configuration component of any state transition relationship, or the state management graphical user interface may include the event configuration component of each state transition relationship, etc., to support the target object to perform the event configuration operation, and so on; the embodiments of the present invention do not limit this.

[0042] Optionally, the transition condition of a state transition relationship may be used to indicate the condition for the corresponding state transition relationship to occur, that is, the condition for the source state of the corresponding state transition relationship to transition to the target state of the corresponding state transition relationship. That is to say, when the transition condition of a state transition relationship is satisfied, the corresponding state transition relationship is established, that is, the transition from the source state of the corresponding state transition relationship to the target state of the corresponding state transition relationship is realized. Optionally, when an event of a state transition relationship occurs, it may be determined that the transition condition of the corresponding state transition relationship is satisfied; by way of example, assuming that the event of a state transition relationship is an event of passing approval, then the transition condition of the corresponding state transition relationship may be passing approval, and so on.

[0043] Based on this, the embodiments of the present invention may develop an intuitive drag-and-drop interface (i.e., the state management graphical user interface), enabling users to conveniently construct state management logic through the state management graphical user interface without in-depth programming knowledge.

[0044] In another implementation, the target object can create states and state transition relationships through natural language input. That is to say, the target object can implement state creation operations, transition design operations, event configuration operations, etc. through natural language input. Thus, when the electronic device detects a natural language input operation performed by the target object on the state management graphical user interface, it determines that at least one state setting operation is detected on the state management graphical user interface. Optionally, the at least one state setting operation may include, but is not limited to, at least one of the following: state creation operation, transition design operation, event configuration operation, etc. The embodiments of the present invention do not limit this. Optionally, the natural language input operation can be implemented by voice or by text input. The embodiments of the present invention do not limit this.

[0045] Optionally, when the electronic device detects a natural language input operation on the state management graphical user interface, it can parse the text to be parsed input by the natural language input operation through a target natural language processing (NLP) model, that is, it can parse the text to be parsed through the target NLP model to obtain a text parsing result, so as to detect at least one state setting operation. The text parsing result may include data indicated by each state setting operation in the at least one state setting operation (such as the state indicated by the state creation operation, the state transition relationship indicated by the transition design operation, and / or the state transition relationship to be configured and the configuration event indicated by the event configuration operation, etc.). Optionally, the target natural language processing model can be a spaCy model (a natural language processing model) or a Hugging Face Transformers model (another natural language processing model), etc.; the embodiments of the present invention do not limit this. Optionally, the target natural language processing model may include a pre-trained model for word segmentation, named entity recognition (NER), syntactic analysis, etc.

[0046] Based on this, the electronic device extracts the text parsing result from the text to be parsed, for example, by rule matching and / or model-based named entity recognition, etc.; optionally, the text parsing result may include, but is not limited to, at least one of the following: status (the quantity can be one or more, and may include the status name of the status, etc.), configuration event, and status transition relationship, etc.; the embodiments of the present invention do not limit this. Exemplarily, assuming the text to be parsed is "transfer from the to-be-approved status to the approved status when the approval pass event occurs", at this time, the source status can be parsed as the to-be-approved status, the target status as the approved status, the configuration event as the approval pass event, the transition condition as when the approval pass event occurs (i.e., approval passed), and the status transition relationship as transfer from the to-be-approved status to the approved status, etc. Exemplarily, when any of the extracted statuses (i.e., any status in the text parsing result) does not exist, it can be determined that a status creation operation for any status is detected; when there is a status transition relationship in the text parsing result, it is determined that a transition design operation is detected, etc.

[0047] Optionally, the electronic device can convert the text parsing result into structured data, that is, convert the extracted status, configuration event, status transition relationship, etc. into structured data (such as JSON (a format for storing and transmitting data) or an internal data structure), for example, convert "transfer from to-be-approved to approved" into a status ID (i.e., serial number) and transition conditions, etc.

[0048] Based on this, the embodiments of the present invention can parse the content input by the user through natural language processing technology, thereby automatically generating a status and transition diagram; that is to say, the embodiments of the present invention can provide natural language processing functions through intelligent assistant interaction, allowing users to interact with the intelligent assistant through natural language and simplifying the configuration process.

[0049] In another implementation manner, the target object can perform at least one status setting operation in the way of forms and configuration items to implement status creation operations, transition design operations, event configuration operations, etc.; exemplarily, the target object can rely on form elements such as standardized input boxes and selection boxes to define statuses, transition relationships, events, etc.

[0050] Optionally, when the electronic device detects at least one status setting operation (such as whenever the user drags nodes and / or wires, or performs a natural language input operation), it passes the data (i.e., operation content) indicated by the at least one status setting operation to the backend to update the user's design content in real time, such as recording at least one status setting operation and / or the data indicated by the at least one status setting operation in real time, etc. Optionally, the electronic device can pass the data to the backend through the state management mechanism of React (such as Redux (the state container of the application) or Context API (context cache)), such as passing it to the configuration center module, etc.

[0051] S102, generate a core state management configuration file based on the state transition relationship indication data and the basic state management code data.

[0052] Optionally, the core state management configuration file can be generated by the electronic device through the configuration center module; in this case, the configuration center module can be used to manage the state transition configuration designed by the user and generate the final configuration file (i.e., the core state management configuration file). Optionally, the core state management configuration file may include, but is not limited to, at least one of the following: at least one state definition (such as the state indication data of each state included in the state transition relationship indication data), at least one transition relationship (which may include all state transition relationships indicated by the state transition relationship indication data), and transition conditions (such as the transition conditions of each transition relationship in at least one transition relationship), etc.; the embodiments of the present invention do not limit this.

[0053] Optionally, the electronic device (such as through the configuration center module of the electronic device) can also obtain the state transition data to be verified when detecting a rule verification requirement; correspondingly, a preset error detection rule can be determined, and the rule verification is performed on the state transition data to be verified according to the preset error detection rule to obtain a rule verification result; if the rule verification result includes at least one detection error indication information, at least one error prompt corresponding to the detection error indication information is output. Optionally, when the target object sets (such as modifies) a certain state or state transition relationship, the front end (i.e., the graphical user interface module) in the electronic device can send a real-time rule verification request to the configuration center module. Then, after receiving the rule verification request, the configuration center module in the electronic device can determine that a rule verification requirement is detected. In this case, the setting content carried by the rule verification request can be used as the state transition data to be verified. At this time, when the user designs on the graphical user interface, the configuration center module can listen to and record the changes of each state, transition relationship, and event in real time, that is, it can listen to the user's design behavior in real time; or, when detecting a requirement for generating a core state transition configuration file, it can determine that a rule verification requirement is detected and use the state transition relationship indication data as the state transition data to be verified, etc.; the embodiments of the present invention do not limit this.

[0054] Optionally, the preset error detection rules can be set empirically or according to actual requirements, and the embodiments of the present invention do not limit this; exemplarily, the preset error detection rules may include, but are not limited to, verifying whether the verification status is repeated (such as whether the status before transfer (i.e., the source status) is the same as the status after transfer (i.e., the target status)), verifying whether there is a dead loop (i.e., the transfer relationship is closed-loop, such as transferring from the to-be-approved status to the approved status and then from the approved status to the to-be-approved status), etc.), verifying whether the transfer conditions are reasonable (such as whether the transfer conditions are clear), verifying whether the status is defined (such as whether the status indication data of a status is completed), and so on; the embodiments of the present invention do not limit this. Optionally, the configuration center module can use Drools (a business rule framework based on a rule engine) for rule verification to provide real-time error and optimization suggestions. Optionally, the preset error detection rules can be located in the rule library, and the rule library can contain preset business rules and state machine design specifications (i.e., the preset error detection rules), etc.

[0055] Optionally, the rule verification result can be empty (indicating no error at this time), or the rule verification result can also include but is not limited to at least one of the following: at least one detection error indication information, no error flag (which can be used to indicate no error), error flag (which can be used to indicate an error), etc.; the embodiments of the present invention do not limit this. Optionally, both the no error flag and the error flag can be set according to experience or according to actual requirements; the embodiments of the present invention do not limit this. Optionally, one detection error indication information can be used to indicate one error (such as the transfer condition of any state transition relationship is unreasonable, or there is a cycle in multiple state transition relationships, or any state is undefined (such as lack of description, etc.)). Optionally, the error indication information of an error can be generated according to a preset error indication rule, and the preset error indication rule can be set according to experience or actual requirements; the embodiments of the present invention do not limit this. Optionally, the error prompt corresponding to one detection error indication information can be set according to experience or according to actual requirements; the embodiments of the present invention do not limit this. Based on this, the electronic device displays the error prompt corresponding to at least one detection error indication information, that is, displays the error prompt of the error indicated by each detection error indication information in at least one detection error indication information, so as to output the error prompt corresponding to at least one detection error prompt information. Exemplarily, the electronic device can feedback at least one detection error indication information to the graphical user interface module through the configuration center module, and then the graphical user interface module can display the error prompt corresponding to at least one detection error indication information, that is, can display the error prompt corresponding to at least one detection error indication information on the state management graphical user interface. Optionally, the error prompt corresponding to at least one detection error indication information can include the error prompt corresponding to each detection error indication information in at least one detection error indication information. The error prompt corresponding to one detection error indication information can be used to prompt the error indicated by the corresponding detection error indication information, that is, the error prompt corresponding to one detection error indication information can be the error prompt of the error indicated by the corresponding detection error indication information. Optionally, the error prompt of an error can be set according to experience or according to actual requirements; the embodiments of the present invention do not limit this. Exemplarily, the error prompt of an error can be a red warning box. At this time, a red warning box can be displayed for the corresponding error to prompt the error, etc.

[0056] Optionally, the electronic device may further output at least one optimization suggestion for the error indicated by the detection error indication information, such as a clear status definition, etc.; optionally, the electronic device may determine at least one optimization suggestion for the error indicated by the detection error indication information through the configuration center module, and send the optimization suggestion to the graphical user interface module, so as to display the optimization suggestion on the status management graphical user interface through the graphical user interface module, thereby realizing the output of the optimization suggestion. Based on this, the embodiments of the present invention can continuously analyze (such as real-time analysis) the state transition relationship and state configuration (i.e., state definition) designed by the user according to the set preset error detection rules, so as to propose error detection and / or optimization suggestions.

[0057] Optionally, the design of the target object can be saved in JSON format at the front end of the electronic device, that is, it can be saved in the graphical user interface module; optionally, the electronic device can also perform data storage on the data to be saved. The data to be saved can include all the data saved at the front end, or all the data not stored at the back end, etc. Optionally, when the graphical user interface module of the electronic device detects that the user performs an operation to generate a state transition core configuration file on the state management graphical user interface, it transmits the data to be saved to the configuration center module and / or the data storage layer (i.e., the database) for saving. For example, the data to be saved can include state transition relationship indication data and / or state management code basic data; or, when the electronic device detects a data saving operation through the graphical user module, it can transmit the data to be saved to the configuration center module and / or the data storage layer for saving; or, the graphical user module can transmit the data to be saved to the configuration center module and / or the data storage layer for saving every preset data saving interval duration, etc.; the embodiments of the present invention do not limit this. Optionally, the preset data saving interval duration can be set according to experience or according to actual requirements, and the embodiments of the present invention do not limit this. It should be noted that the embodiments of the present invention do not limit the specific execution manner of the data saving operation, such as it can be executed by clicking or long-pressing on the saving component, etc. Based on this, the embodiments of the present invention can realize data storage.

[0058] Optionally, the electronic device may further include the above data storage layer for storing user-designed data, status information (i.e., status indication data), configuration files, and so on. Optionally, the data storage layer may be located at the backend of the electronic device, that is, it can be a part of the backend. It should be noted that the storage structure of the data storage layer in the embodiments of the present invention is not limited. For example, the data storage layer can be a MySQL database (a relational database management system), and so on. Optionally, the embodiments of the present invention can use Java (a programming language and development platform) and Spring Boot (a lightweight Java development framework) to develop backend services, and the configuration data can be stored in the data storage layer. Optionally, the configuration center module (also called the configuration management module) can be used for configuration management. The electronic device can provide a configuration management interface through RESTful (a set of architecture constraints and principles) APIs, and the front end can interact with the backend through Ajax (Asynchronous JavaScript and XML, a technology for asynchronous data exchange) requests, and so on.

[0059] S103, when detecting a requirement for generating a state management code file, generate a target state management code file based on the state management core configuration file.

[0060] Among them, the target state management code file can support state management for the target application. Optionally, the target application can be any application, and the embodiments of the present invention do not limit this. In other words, the target state management code file can support state management in the target project. The target application can be used to implement the target project, and the target project can be any project. Optionally, the target state management code file can be used to indicate which states there are and where these states can flow from and to (that is, it can be used to indicate states and the state transition relationships between states, etc.) to control that states cannot flow back or jump in the project. That is, the target state management code file can be used to do specific content in the project to solve security problems. Based on this, the state management code can be code that realizes unified management of states based on the state machine mode. Optionally, a state management code file can be used to indicate a set of state transition relationships, that is, it can include at least one state transition relationship.

[0061] Optionally, the electronic device may further include a code generation module, such as Figure 2As shown; in this case, the electronic device can detect the need for generating the status management code through the code generation module, so that when detecting the need for generating the status management code file, based on the status management core configuration file, generate the target status management code file, and so on. Optionally, the code generation module can be used to support functions such as "template upload" and "online modification" by the user, so as to complete code generation according to the status management core configuration file, and support the download of the code file, and so on. Based on this, the embodiments of the present invention can adopt a modular design, and the modules communicate through standardized interfaces; optionally, the core modules can include but are not limited to a graphical user interface module, a configuration center module, a status visualization module, a code generation module, etc.; each module has an independent function and can cooperate through the core configuration file and data exchange.

[0062] Optionally, any two modules in the electronic device can be located in the same electronic device. For example, when the number of electronic devices for executing the status management method is one, all modules can be located in the same electronic device; or, any two modules can also be located in different electronic devices. For example, when the number of electronic devices for executing the status management method is multiple, there can be two modules located in different electronic devices, and so on. The embodiments of the present invention do not make any limitations in this regard.

[0063] The embodiments of the present invention can determine the status transition relationship indication data and the status management code basic data when detecting the need for generating the status transition core configuration file; and based on the status transition relationship indication data and the status management code basic data, generate the status management core configuration file. Further, when detecting the need for generating the status management code file, based on the status management core configuration file, generate the target status management code file. The embodiments of the present invention can automatically generate the status management core configuration file when detecting the need for generating the status transition core configuration file, so as to automatically generate the target status management code file when detecting the need for generating the status management code file, thereby conveniently generating the status management code file to effectively reduce costs; that is to say, the embodiments of the present invention can effectively avoid developers investing a large amount of time and effort to ensure the correctness of the state machine, thereby reducing the complexity and cost of system maintenance, and can effectively enhance the scalability of status management.

[0064] Based on the above description, the embodiments of the present invention also propose another status management method. Correspondingly, this status management method can be executed by the above-mentioned electronic device (terminal or server); or, this status management method can be jointly executed by the terminal and the server; or, this status management method can be executed by the status management tool in the electronic device, and so on. For the convenience of description, hereinafter, it will be described by taking the electronic device executing this status management method as an example; please refer to Figure 3 , this status management method can include the following steps S301-S304:

[0065] S301. When a requirement for generating a state transition core configuration file is detected, determine state transition relationship indication data and state management code basic data.

[0066] S302. Generate a state management core configuration file based on the state transition relationship indication data and the state management code basic data.

[0067] Optionally, the state management core configuration file can be in JSON format or YAML (YAML Ain’t Markup Language, a data serialization language) format (in this case, the core configuration file can be a YAML file), etc. The embodiments of the present invention do not limit this. In the embodiments of the present invention, the state management core configuration file is the basis for subsequent state transition diagram drawing and code generation. Optionally, the state management core configuration file can be generated through the JSON or YAML serialization function of the configuration center module, and the graphical user interface module and the configuration center module can use the same format to parse and generate configuration data. Optionally, a state transition diagram (i.e., a state transition relationship diagram) can be a diagram describing the relationships among all states, pre-transition states, post-transition states, and transition conditions in a finite machine.

[0068] Optionally, relevant information such as state management code basic data is configured in the state management core configuration file. For example, R & D personnel only need to focus on designs such as state transition relationships and do not need to pay attention to the entire state management code, etc.

[0069] Optionally, the basic data of the state management code may include, but is not limited to, at least one of the following: the code package path for generating the state management code (which can be the configuration content of the packagePath configuration item in the core configuration file (also known as the code package path configuration item for generating the state management code). A package is a way to organize and manage classes, interfaces, and their related resources. In the Java language, the package path can refer to the directory structure of the code project where the Java code is located), the file path for generating the state management code file (which can be the configuration content of the targetFilePath configuration item in the core configuration file (also known as the code file path configuration item for generating the state management code)), the file name for generating the state management code (which can be the configuration content of the targetFileName configuration item in the core configuration file (also known as the code file name configuration item for generating the state management code)), the entity path corresponding to the state management code (also known as the entity path corresponding to the state machine management code, which can be the configuration content of the entityPackage configuration item in the core configuration file (also known as the entity path configuration item corresponding to the state management code). An entity usually refers to the basic components with specific roles and functions in the code. For example, an order can be an entity), the state enumeration class path corresponding to the state management code (also known as the state enumeration class path corresponding to the state machine management code, which can be the configuration content of the enumPackage configuration item in the core configuration file (also known as the state enumeration class path configuration item corresponding to the state management code). A class can be one of the basic structures for building a program. A class defines the attributes and behaviors of an object and is one of the core concepts in object-oriented programming. An enumeration class (enum) is a special class used to define a set of types with fixed constant values. An enumeration class is a safer and more maintainable way to represent and operate on a set of related constants), and the method name for obtaining the enumeration state of the entity corresponding to the state management code (also known as the method name for obtaining the enumeration state of the entity corresponding to the state machine management code, which can be the configuration content of the enumGetMethodName configuration item in the core configuration file (also known as the configuration content of the method name for obtaining the enumeration state of the entity corresponding to the state management code (configuration item)), and so on; the embodiments of the present invention do not limit this. Optionally, the basic data of the state management code can be set in advance according to experience or actual needs, or can be set by the target object performing the operation of setting the basic data of the state management code, and so on; the embodiments of the present invention do not limit this. It should be noted that the embodiments of the present invention do not limit the specific execution manner of the operation of setting the basic data of the state management code.)

[0070] Optionally, the state transition relationship indication data may include, but is not limited to, at least one of the following: the starting state in the transition relationship (i.e., the source state, which may be the configuration content of the fromState configuration item (also referred to as the starting state configuration item) in the core configuration file), the set of relationships that a source state can transition to (which may be the configuration content of the transitions configuration item (also referred to as the set of relationships that can be transitioned to configuration item) in the core configuration file), the reachable state in the transition relationship (i.e., the target state, which may be the configuration content of the transitions.toState configuration item (also referred to as the reachable state configuration item) in the core configuration file), and the transition condition of the reachable state in the transition relationship (i.e., the transition condition or event of the transition relationship, which may be the configuration content of the transitions.event configuration item (also referred to as the transition condition configuration item or event configuration item) in the core configuration file), and so on; the embodiments of the present invention do not limit this. Optionally, the transitions configuration item may include, but is not limited to, the transitions.toState configuration item, the transitions.event configuration item, etc., and the embodiments of the present invention do not limit this. Optionally, one configuration content of the fromState configuration item may correspond to one configuration content of the transitions configuration item; optionally, the configuration content of the transitions configuration item corresponding to one configuration content of the fromState configuration item may also be empty, and so on; the embodiments of the present invention do not limit this.

[0071] Optionally, the state management core configuration file (i.e., the core configuration file) may include, but is not limited to, the configuration content of each configuration item in at least one of the above packagePath, targetFilePath, targetFileName, etc. The embodiments of the present invention do not limit this; in other words, the embodiments of the present invention do not limit the configuration items in the core configuration file, and the state transition relationship indication data and the state management code base data may include the configuration content of each configuration item. Optionally, the number of configuration contents of one configuration item may be one or more, and the embodiments of the present invention do not limit this; for example, when the number of source states is multiple, the number of configuration contents of the fromState configuration item may be multiple, that is, the configuration content of the fromState configuration item may be each source state respectively, and so on.

[0072] Optionally, the electronic device can generate a state management core configuration file through the configuration center module according to a preset data structure format (which can be used to indicate each configuration item in the core configuration file, as well as the configuration item format of each configuration item, etc.), based on the state transition relationship indication data and the state management code basic data; Optionally, the state management core configuration file can include the state transition relationship indication data and the state management code basic data, that is, in the embodiments of the present invention, the state transition relationship indication data and the state management code basic data can be filled into the state management core configuration file according to the preset data structure format, that is, filled as the configuration content of the corresponding configuration items in the state management core configuration file respectively, so as to generate the state management core configuration file, so that the state management core configuration file can include but is not limited to at least one state definition, at least one transition relationship, and at least one transition condition, etc., such as it can also include the code package path, the code file path, etc. Optionally, the preset data structure format can be set according to experience or according to actual needs, and the embodiments of the present invention do not limit this.

[0073] S303, based on the state management core configuration file, generate a target state transition relationship diagram. The target state transition relationship diagram includes the state nodes of multiple states in the state management core configuration file and the edges between multiple state nodes. An edge is used to represent a state transition relationship.

[0074] Optionally, the target state transition relationship diagram supports changing according to the real-time update of the state management core configuration file.

[0075] Optionally, the electronic device can also include a state visualization module; in this case, the electronic device can generate a target state transition relationship diagram through the state visualization module based on the state management core configuration file. Optionally, the state visualization module can integrate the Graphviz (Graph Visualization Software) toolkit (an open-source toolkit for drawing graphs described by DOT (a scripting language used to draw graphs on the open-source toolkit Graphviz)) language script, complete the drawing of the state transition relationship diagram (that is, the target state transition relationship diagram) according to the state management core configuration file, and support the download or export of the completed graph. Based on this, the embodiments of the present invention can display multiple state nodes and the transition relationships between multiple state nodes (that is, the transition relationships between the states indicated by multiple state nodes) through the target state transition relationship diagram.

[0076] Optionally, when the electronic device detects the need to draw a state transition diagram through the state visualization module, it can generate a target state transition relationship diagram based on the state management core configuration file. Optionally, the state visualization module can determine that the need to draw a state transition diagram is detected every preset drawing interval duration and when the state management core configuration file is updated; or, it can also determine that the need to draw a state transition diagram is detected each time the state management core configuration file is received, that is, it can determine that the need to draw a state transition diagram is detected each time the updated state management core configuration file is received. At this time, the target state transition relationship diagram supports changing according to the real-time update of the state management core configuration file, etc.; the embodiments of the present invention do not limit this. Optionally, the preset drawing interval duration can be set according to experience or according to actual needs, and the embodiments of the present invention do not limit this. Optionally, the configuration center module can update the state management core configuration file to the state visualization module in real time, that is, after the configuration center module generates a new state management core configuration file (that is, when updating the state management core configuration file), it can send the current state management core configuration file to the state visualization module. Optionally, the configuration center module can also update the state management core configuration file to the data storage layer in real time and enable the state visualization module and / or the code generation module to obtain the state management core configuration file from the data storage layer; that is, the configuration center module can also send the state management core configuration file to the state visualization module and / or the code generation module through the data storage layer, etc.; the embodiments of the present invention do not limit the specific manner in which the state visualization module and the code generation module obtain the state management core configuration file.

[0077] Optionally, when generating a target state transition relationship diagram based on the state management core configuration file, the state transition relationship can be obtained from the state management core configuration file through the core configuration file reader, and the target state transition relationship diagram can be drawn through the state transition relationship diagram drawer to achieve the generation of the target state transition relationship diagram, as Figure 4 shown. Optionally, the state transition relationship diagram drawer can be drawn through the Graphviz toolkit (C language library), that is, the target state transition relationship diagram can be drawn through Graphviz, so as to convert the state and transition information in the state management core configuration file into the DOT format of Graphviz and generate the target state transition relationship diagram. Based on this, when the state transition relationship diagram changes according to the real-time update of the state management core configuration file, each time the state management core configuration file is updated, the execution of generating the target state transition relationship diagram based on the state management core configuration file (here is the current state management core configuration file) can be triggered respectively to achieve the real-time update of the target state transition relationship diagram.

[0078] Optionally, the electronic device may also respond to a graphic export operation performed by the target object and return the state transition relationship diagram indicated by the graphic export operation to the target object. It should be noted that the specific execution manner of the graphic export operation in the embodiments of the present invention is not limited. Optionally, the electronic device may respond to the graphic export operation through the state visualization module, or may also respond to the graphic export operation through other modules (for example, the electronic device may store the generated state transition relationship diagram in the data storage layer for each module to obtain, or other modules may obtain the corresponding state transition relationship diagram from the state visualization module), etc.; the embodiments of the present invention do not limit this. Optionally, the state transition relationship diagram may be exported in PNG format (a lossless compressed bitmap file format), or may also be exported in SVG format (a vector graphic format based on XML (Extensible Markup Language)), or may also be exported in PDF format (a file format), etc.; the embodiments of the present invention do not limit this. Optionally, the electronic device may also respond to a graphic download operation performed by the target object and download the state transition relationship diagram indicated by the graphic download operation to the target object; it should be noted that the specific execution manner of the graphic download operation in the embodiments of the present invention is not limited.

[0079] Optionally, the electronic device may also respond to a state transition relationship diagram display operation performed by the target object through the graphical user interface and display the state transition relationship diagram indicated by the state transition relationship diagram display operation. Optionally, the electronic device may use a front-end JS library (such as jsGraphviz) to display the corresponding state transition relationship diagram. Optionally, the electronic device may also implement the real-time dynamic visualization of the state transition relationship diagram based on front-end graphical libraries such as Web front-end visualization tools (such as D3.js, JointJS, GoJS), etc.

[0080] Optionally, an edge in the state transition relationship diagram may be used to indicate the source state, target state, event condition (such as approver approval, etc.), and trigger mechanism (which may include but is not limited to the transition condition of the corresponding state transition relationship, such as approval passed, etc.) of the corresponding state transition relationship. Optionally, an edge in a state transition relationship diagram may include the event condition and / or trigger mechanism of the state transition relationship indicated by the corresponding edge, that is to say, when displaying a state transition relationship diagram, it is possible to support displaying the event condition and / or trigger mechanism of each state transition relationship on each edge in the corresponding state transition relationship diagram, etc.

[0081] S304, when detecting a requirement for generating a state management code file, generate a target state management code file based on the state management core configuration file.

[0082] Optionally, the electronic device can detect the need to generate a status management code file through the code generation module, and when the need to generate a status management code file is detected, generate a target status management code file based on the status management core configuration file. Optionally, the code generation module can determine that the need to generate a status management code file is detected each time it receives the status management core configuration file, and thus generate a target status management code file based on the currently received status management core configuration file; or, it can determine that the need to generate a status management code file is detected when a code generation request is received. At this time, if the code generation request carries the status management core configuration file, a target status management code file can be generated based on the status management core configuration file carried by the code generation request. If the code generation request does not carry the status management core configuration file, the status management core configuration file can be obtained from the configuration center module in real time to trigger the execution of generating a target status management code file based on the status management core configuration file, etc.; the embodiments of the present invention do not limit this. Based on this, the configuration center module can send the real-time updated status management core configuration file to the code generation module in real time, or can send a code generation request to the code generation module when detecting a code generation operation performed by the target object or receiving a code generation request sent by the graphical user interface module. The code generation request sent by the configuration center module can carry the current status management core configuration file, etc.

[0083] Optionally, when generating a target status management code file based on the status management core configuration file, a target status management code template can be loaded; and a target status management code file can be generated based on the status management core configuration file and the target status management code template. Optionally, the target status management code template can be a custom template uploaded by the target object, or a pre-set template, or a template modified by the target object on the pre-set template, etc.; the embodiments of the present invention do not limit this. Exemplarily, it can respond to the template upload operation performed by the target object and use the template uploaded by the template upload operation as the target status management code template; or, it can respond to the template modification operation performed by the target object and use the template modified by the template modification operation as the target status management code template; or, it can obtain a template from the template database and use the obtained template as the target status management code template, etc.

[0084] Optionally, the embodiment of the present invention can use the Velocity template engine (a Java-based template engine) to parse the template to load the target state management code template, so as to dynamically fill the obtained states, state transition relationships, etc. based on the state management core configuration file, thereby generating the target state management code file; that is, after loading the target state management code template, the target state management code template can be filled based on the state management core configuration file to generate the target state management code file.

[0085] Optionally, the code generation module can use the core configuration file reader to obtain the state transition relationship from the state management core configuration file (the obtained state transition relationship can also be called a custom configuration management object), and load the target state management code template, and can use the state management code generator to generate the target state management code file according to the target state management code template and the obtained state transition relationship, etc., as Figure 5 shown.

[0086] It should be noted that the embodiment of the present invention does not limit the programming language of the target state management code file; for example, the corresponding code automatically generated by the embodiment of the present invention according to the state management core configuration file and the target state management code template can support multiple programming languages such as Java, Python, and JavaScript.

[0087] Optionally, the electronic device can also respond to the code file download operation executed by the target object and return the code file indicated by the code file download operation to the target object. Based on this, the embodiment of the present invention can implement the code generation logic at the backend (the code generation module can be a part of the backend), that is, the template engine can be used to fill the target state management code template according to the state management core configuration file and generate the target state management code file. After generating the code, it can support users to download.

[0088] Optionally, when a code file compression instruction is detected, the electronic device can also package at least one status management code file indicated by the code file compression instruction to obtain a compressed package of the at least one status management code file (such as a ZIP (a file format for data compression and document storage) file, etc. In this case, a ZIP compression toolkit can be used for packaging); when a download instruction for the compressed package is detected for the target object, the compressed package can be sent to the target object. Optionally, the target object can perform a code file compression operation, so that the electronic device detects a code file compression instruction. At this time, the at least one status management code file indicated by the code file compression instruction can be the at least one status management code file indicated by the code file compression operation; correspondingly, the target object can perform a compressed package download operation on the above compressed package, so that the electronic device can detect the download instruction for the compressed package for the target object. It should be noted that the embodiments of the present invention do not limit the specific execution manners of the code file compression operation and the compressed package download operation. Based on this, the embodiments of the present invention support the user to download at least one generated code file (i.e., the status management code file) at one time, such as downloading all generated code files.

[0089] Optionally, when the electronic device detects a parsing and jumping instruction for the status management core configuration file, it can display a target jumping interface; wherein, the target jumping interface includes at least one of the following: status transition relationship indication data, status management code basic data, and a status management graphical user interface. Optionally, the target object can perform a parsing and jumping operation on the status management core configuration file. In this case, the electronic device can determine that a parsing and jumping instruction for the status management core configuration file is detected. It should be noted that the embodiments of the present invention do not limit the specific execution manner of the parsing and jumping operation; exemplarily, the target object can right-click on the status management core configuration file with the mouse, then the electronic device can display at least one setting option of the status management core configuration file, and the at least one setting option can include a parsing and jumping option, then the target object can perform a selection operation on the parsing and jumping option to implement the parsing and jumping operation, and so on. Optionally, the electronic device can include a core configuration file reader, and the status management core configuration file supports being read through the core configuration file reader. The core configuration file reader can support providing a unified interface externally. The interface function of the unified interface can support implementing an incoming plug-in event object (AnActionEvent), and the plug-in event object can support being used to jump to the target jumping interface, that is, the target jumping interface can be displayed through the plug-in event object, that is, the target jumping interface can be reached through the conditions of the plug-in event object.

[0090] Optionally, in other embodiments, the electronic device can also implement different implementation processes through the same module. For example, the electronic device can also implement all steps of the status management method through the same module, and so on. The present invention does not limit this.

[0091] When the embodiment of the present invention detects a requirement for generating a state transition core configuration file, it can determine the state transition relationship indication data and the state management code basic data; and based on the state transition relationship indication data and the state management code basic data, generate a state management core configuration file. Based on this, a target state transition relationship diagram can be generated based on the state management core configuration file. The target state transition relationship diagram includes state nodes of multiple states in the state management core configuration file and edges between multiple state nodes. An edge can be used to represent a state transition relationship. Correspondingly, when a requirement for generating a state management code file is detected, a target state management code file can be generated based on the state management core configuration file. It can be seen that the embodiment of the present invention can automatically generate code based on graphical design or natural language input, and support users to upload templates and customize code generation rules to ensure that the generated code meets the user's requirements; moreover, the embodiment of the present invention can integrate visualization tools such as Graphviz to draw a state transition diagram in real time and generate a downloadable image file (such as the target state transition relationship diagram), which is convenient for users to share and display the design results; based on this, the embodiment of the present invention can perfectly combine graphical design, natural language input, real-time feedback, intelligent optimization, automatic code generation and state diagram visualization, providing a comprehensive, integrated, automated, efficient and easy-to-use state management tool, which can conveniently generate a target state management code file to effectively reduce costs.

[0092] Based on the description of the related embodiments of the above state management method, an embodiment of the present invention also proposes a state management device. The state management device can be a computer program (including program code) running in an electronic device; as Figure 6 shown, the state management device may include a determination unit 601 and a processing unit 602. The state management device can execute Figure 1 or Figure 3 the state management method shown, that is, the state management device can run the above units:

[0093] The determination unit 601 is configured to determine the state transition relationship indication data and the state management code basic data when detecting a requirement for generating a state transition core configuration file;

[0094] The processing unit 602 is configured to generate a state management core configuration file based on the state transition relationship indication data and the state management code basic data;

[0095] The processing unit 602 is further configured to generate a target state management code file based on the state management core configuration file when detecting a requirement for generating a state management code file.

[0096] In one embodiment, when generating a target state management code file based on the state management core configuration file, the processing unit 602 may specifically be used for:

[0097] Load a target state management code template;

[0098] Generate a target state management code file based on the state management core configuration file and the target state management code template.

[0099] In another embodiment, the processing unit 602 may further be used for:

[0100] When detecting a code file compression instruction, package at least one state management code file indicated by the code file compression instruction to obtain a compressed package of the at least one state management code file;

[0101] When detecting a download instruction for the compressed package by a target object, send the compressed package to the target object.

[0102] In another embodiment, the processing unit 602 may further be used for:

[0103] When detecting a parsing jump instruction for the state management core configuration file, display a target jump interface;

[0104] Wherein, the target jump interface includes at least one of the following: the state transition relationship indication data, the state management code basic data, and the state management graphical user interface.

[0105] In another embodiment, the processing unit 602 may further be used for:

[0106] Generate a target state transition relationship diagram based on the state management core configuration file, where the target state transition relationship diagram includes state nodes of multiple states in the state management core configuration file and edges between multiple state nodes, and one edge is used to represent a state transition relationship.

[0107] In another embodiment, the processing unit 602 may further be used for:

[0108] When detecting a rule verification requirement, obtain state transition data to be verified;

[0109] The determination unit 601 may further be used for: determining a preset error detection rule;

[0110] The processing unit 602 may further be used for:

[0111] Perform rule verification on the state transition data to be verified according to the preset error detection rule to obtain a rule verification result;

[0112] If the rule verification result includes at least one detection error indication message, output an error prompt corresponding to the at least one detection error indication message.

[0113] In another implementation, the state transition relationship indication data is set by a target object through a state management graphical user interface, and the processing unit 602 can also be used for:

[0114] In response to a state creation operation detected in the state management graphical user interface, create a state node for the state indicated by the state creation operation, where one state node is used to represent one state; and / or,

[0115] In response to a transition design operation detected in the state management graphical user interface, update the target state transition relationship set according to the state transition relationship indicated by the transition design operation; and / or,

[0116] In response to an event configuration operation detected in the state management graphical user interface, determine the to-be-configured state transition relationship and configuration event indicated by the event configuration operation, and use the configuration event as the event of the to-be-configured state transition relationship. The event of a state transition relationship supports indicating the transition condition of the corresponding state transition relationship.

[0117] According to an embodiment of the present invention, Figure 6 Each unit in the state management device shown can be separately or all combined into one or several other units to form, or some of the units can be further split into multiple smaller units with functional division to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above units are divided based on logical functions. In practical applications, the function of one unit can also be realized by multiple units, or the functions of multiple units can be realized by one unit. In other embodiments of the present invention, any state management device can also include other units. In practical applications, these functions can also be assisted by other units and can be realized by the cooperation of multiple units.

[0118] According to another embodiment of the present invention, it can be achieved by running a computer program (including program code) capable of executing the respective steps involved in the corresponding method shown in Figure 1 or Figure 3 on a general-purpose electronic device such as a computer including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM), to construct as shown in Figure 6The state management device shown in [description], and to implement the state management method of the embodiments of the present invention. The computer program can be recorded on, for example, a computer storage medium, loaded into the above-mentioned electronic device through the computer storage medium, and run therein.

[0119] In the embodiments of the present invention, when a requirement for generating a state transition core configuration file is detected, the state transition relationship indication data and the state management code basic data can be determined; and based on the state transition relationship indication data and the state management code basic data, a state management core configuration file is generated. Further, when a requirement for generating a state management code file is detected, a target state management code file is generated based on the state management core configuration file. In the embodiments of the present invention, the state management core configuration file can be automatically generated when a requirement for generating a state transition core configuration file is detected, so that the target state management code file can be automatically generated when a requirement for generating a state management code file is detected, thereby conveniently generating the state management code file to effectively reduce costs; that is to say, the embodiments of the present invention can effectively avoid developers from investing a large amount of time and effort to ensure the correctness of the state machine, thereby reducing the complexity and cost of system maintenance, and can effectively enhance the scalability of state management.

[0120] Based on the description of the above method embodiments and device embodiments, an exemplary embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, and the computer program, when executed by the at least one processor, is used to cause the electronic device to execute the method according to the embodiments of the present invention.

[0121] An exemplary embodiment of the present invention further provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method according to the embodiments of the present invention.

[0122] An exemplary embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method according to the embodiments of the present invention.

[0123] Reference Figure 7, a block diagram of an electronic device 700 that can be a server or a client of the present invention will now be described. It is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0124] As Figure 7 shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0125] A plurality of components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device that can input information into the electronic device 700. The input unit 706 can receive input digital or character information, and generate key signal inputs related to the user settings and / or function controls of the electronic device. The output unit 707 can be any type of device that can present information, and can include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 can include, but is not limited to, magnetic disks, optical disks. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks, and can include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a BluetoothTM device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0126] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 executes the various methods and processes described above. For example, in some embodiments, the state management method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 700 via the ROM 702 and / or the communication unit 709. In some embodiments, the computing unit 701 can be configured to execute the state management method in any other suitable way (e.g., by means of firmware).

[0127] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0128] In the context of the present invention, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0129] As used in this invention, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., magnetic disks, optical disks, memory, programmable logic devices (PLDs)) used to provide machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and / or data to a programmable processor.

[0130] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0131] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.

[0132] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of client and server is generated by computer programs running on the respective computers and having a client-server relationship with each other.

[0133] Also, it should be understood that the above-disclosed are only preferred embodiments of the present invention, and of course cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.

Claims

1. A state management method, characterized in that, Including: When detecting a requirement for generating a state transition core configuration file, determining state transition relationship indication data and state management code basic data; Generating a state management core configuration file based on the state transition relationship indication data and the state management code basic data; When detecting a requirement for generating a state management code file, generating a target state management code file based on the state management core configuration file.

2. The method according to claim 1, wherein The generating a target state management code file based on the state management core configuration file includes: Loading a target state management code template; Generating a target state management code file based on the state management core configuration file and the target state management code template.

3. The method according to claim 1 or 2, characterized in that, The method further includes: When detecting a code file compression instruction, packing at least one state management code file indicated by the code file compression instruction to obtain a compressed package of the at least one state management code file; When detecting a download instruction of a target object for the compressed package, sending the compressed package to the target object.

4. The method according to claim 1 or 2, characterized in that The method further includes: When detecting a parsing and jumping instruction for the state management core configuration file, displaying a target jumping interface; Wherein, the target jumping interface includes at least one of the following: the state transition relationship indication data, the state management code basic data, and a state management graphical user interface.

5. The method according to claim 1 or 2, characterized in that, The method further includes: Generating a target state transition relationship diagram based on the state management core configuration file, where the target state transition relationship diagram includes state nodes of multiple states in the state management core configuration file and edges between the multiple state nodes, and one edge is used to represent a state transition relationship.

6. The method according to claim 1 or 2, characterized in that, The method further includes: When detecting a rule verification requirement, obtaining state transition data to be verified; Determining a preset error detection rule, and performing rule verification on the state transition data to be verified according to the preset error detection rule to obtain a rule verification result; If the rule verification result includes at least one detection error indication information, outputting an error prompt corresponding to the at least one detection error indication information.

7. The method according to claim 1 or 2, characterized in that, The state transition relationship indication data is set by a target object through a state management graphical user interface, and the method further includes: Responding to a state creation operation detected in the state management graphical user interface, creating a state node of the state indicated by the state creation operation, where one state node is used to represent one state; and / or, Responding to a transition design operation detected in the state management graphical user interface, updating a target state transition relationship set according to the state transition relationship indicated by the transition design operation; and / or, Responding to an event configuration operation detected in the state management graphical user interface, determining a state transition relationship to be configured and a configuration event indicated by the event configuration operation, and using the configuration event as an event of the state transition relationship to be configured, where an event of a state transition relationship supports indicating a transition condition of the corresponding state transition relationship.

8. A state management device, characterized in that, The device includes: A determination unit, configured to determine state transition relationship indication data and state management code basic data when detecting a requirement for generating a state transition core configuration file; A processing unit, configured to generate a state management core configuration file based on the state transition relationship indication data and the state management code basic data; The processing unit is further configured to generate a target state management code file based on the state management core configuration file when detecting a requirement for generating a state management code file.

9. An electronic device, characterized in that, Comprising: A processor; And A memory storing a program, Wherein, the program includes instructions that, when executed by the processor, cause the processor to execute the method according to any one of claims 1-7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause a computer to execute the method according to any one of claims 1-7.