Disclosure of Invention
The technical problem to be solved by the present invention is to provide a service state transition method and system based on dynamic programming according to the deficiencies of the prior art, and establish a relationship between each state node in the internet service flow through a state transition equation, so that in the process of internet service promotion, the state values of the state nodes before or after the current state node in the service flow can be dynamically obtained according to the state values of the current state node and user operations.
In order to solve the above technical problem, according to an aspect of the present invention, the present invention provides a service state transition method based on dynamic programming, wherein the method includes the following steps:
obtaining the state value of the current state node where the user logs in the service process from the database, and displaying a current state page to the user;
receiving current user operation input by a user to obtain a corresponding operation identifier;
inputting the state value of the current state and the operation identifier as input variables into a state transition equation of a current state node to obtain a state value of a target state node corresponding to the user operation in a service flow;
updating the state value stored in a database according to the state value of the target state node, and recording the user operation; and
and displaying a corresponding target state page after the user operation to the user.
Preferably, before the state value of the current state and the operation identifier are input to the state transition equation of the service as input variables, whether the current state node is the last state node in the service flow is judged according to a preset service flow;
if the current state node is not the last state node, inputting the state value of the current state node and the operation identifier as input variables into a state transition equation of the current state node;
and if the current state node is the last state node in the service process, ending the state transition.
Preferably, according to the attribute of the state node, the state value of the current state and the operation identifier are used as input variables and input into a state transition equation matched with the attribute of the current state and the operation identifier, so as to obtain the state value of the target state node; the state transition equations are one or more in one business process.
Preferably, in the service flow, the target state node is a state node after or before the current state node.
Preferably, when the target state node is a state node before the current state node, the previous user operation corresponding to the target state and/or the current state is queried from a user operation log in the database.
In order to solve the above technical problem, according to another aspect of the present invention, the present invention further provides a service state transition system based on dynamic programming, including:
the database is used for storing the latest state value in the business process and recording an operation log of user operation;
the user operation acquisition module is used for receiving user operation input by a user and obtaining a user operation identifier;
a current state value obtaining module, configured to obtain, from the database, a state value of a current state node in a service flow currently operated by the user and after a last operation; and
and the state transition processing module is used for inputting the user operation identifier and the state value of the current state node as input variables into a state transition equation of the current state node to obtain the state value of the target state node corresponding to the user operation in the service flow, updating the state value in the database by using the state value of the target state node, and recording the user operation in a user operation log in the database.
Preferably, the system further comprises:
and the ending state judgment module is connected with the current state value acquisition module and used for judging whether the current state node is the last state node in the current business process.
Preferably, the state transition processing module includes:
the state transition equation unit is used for obtaining a state value corresponding to the target state node after the user operation by taking the user operation identifier and the state value of the current state node as input variables according to the state transition equation of the current state node;
the state value updating unit is connected with the state transition equation unit and used for updating the state value in the database according to the state value of the target state node; and
and the user operation recording unit is connected with the state transition equation unit and is used for recording the user operation for obtaining the state value of the target state node in a user operation log in a database.
Preferably, the system further includes a previous user operation obtaining module, configured to query a user operation log in the database for a previous user operation corresponding to the state value of the target state node and/or the state value of the current state node.
Preferably, the system further includes a status page pushing module, connected to the status transition processing module, and configured to push a corresponding status page to a user according to the status value of the target status node.
The invention utilizes the thought of dynamic planning and combines the state transfer equation with the internet service flow to make the whole service flow clear. According to the state value of the current state node and the user operation obtained by the service process, the state value of the state node corresponding to the user operation can be automatically calculated through a state transition equation, and the corresponding state page is presented to the user, so that better operation experience is provided for the user. The state node corresponding to the user operation may be a next state node of the current state, or a previous state node. For business personnel, the next state, the previous state and the corresponding user operation can be obtained according to the current state query of the user. For designers, the operation and state of business personnel and users can be predicted, and complete user operation records are provided, so that business process change can be performed better and faster.
Detailed Description
The present invention will be described below based on examples, but the present invention is not limited to only these examples. In the following detailed description of the present invention, certain specific details are set forth. It will be apparent to one skilled in the art that the present invention may be practiced without these specific details. Well-known methods, procedures, and procedures have not been described in detail so as not to obscure the present invention. The figures are not necessarily drawn to scale.
The flowcharts and block diagrams in the figures and block diagrams illustrate the possible architectures, functions, and operations of the systems, methods, and apparatuses according to the embodiments of the present invention, and may represent a module, a program segment, or merely a code segment, which is an executable instruction for implementing a specified logical function. It should also be noted that the executable instructions that implement the specified logical functions may be recombined to create new modules and program segments. The blocks of the drawings, and the order of the blocks, are thus provided to better illustrate the processes and steps of the embodiments and should not be taken as limiting the invention itself.
As shown in fig. 3, the method for transferring a service state based on dynamic programming provided by the present invention includes the following steps:
step SA1, logging in the service process to obtain the state value of the current state node. And the current state value is obtained from the database when the user logs in the service process. For example, for the service of a customer order, a service state chain is composed of state nodes of to-be-confirmed-to-be-paid-to-ex-to-accepted-to-completed and the like. If the user has confirmed the order but has not paid at the last login, the "to-be-paid" is taken as the current state node of the user at the current login. And the state value of the current state node at the time of login is determined by the last user operation and is stored in the database. If there is no last operation, the last user operation identifier is considered to be 0. Corresponding to the last user operation identifier, the state node corresponding to the last user operation identifier is the initial state node of the current service process.
Step SA2 is to obtain a status page corresponding to the status value according to the status value.
Step SA3, the status page corresponding to the status value is pushed to the foreground and displayed to the user.
If the user inputs an operation at this time, at step SA4, the user operation currently input by the user is received, and the corresponding user operation identifier is acquired. The user operation identifier may be a numeric value, a letter, a character or a character string composed of numeric values, letters, characters, and the like. In general, the user operation identifier is set to be a numerical value, so that the application in the state transition equation is facilitated.
Step SA5, inputting the state value of the current state node and the user operation identifier as input variables into a state transition equation corresponding to the current node, to obtain a state value of a target state node corresponding to the user operation in the service flow. The state transition equations may be different according to different service flows, and even in the same service flow, the state transition equations corresponding to the state nodes may also be different according to transition conditions between different nodes. The state transition equation has two variable entries, one for the state value and one for the user action identifier. According to the two known quantities, a state value corresponding to the target state of the user operation is finally obtained through calculation of a state transition equation.
Step SA6, updating the state value stored in the database with the state value of the target state, and recording the user operation in a user operation log. The state value stored in the database corresponds to the latest user operation of the user, when the user logs in the service flow next time, the result of the user operation is displayed to the user, and preparation is made for the promotion of the next service flow.
Step SA7, a status page corresponding to the target status value is displayed to the user.
Before calculating the state value of the target state node corresponding to the user operation in step SA5, it is determined whether a state transition is required, that is, whether the state value at this time is available is determined, and the determining method is: judging whether the current state node is the last state node in the business process according to a preset business process; if the current state node is not the last state node, the state value of the current state node is available, and state transition can be carried out; and if the current state node is the last state node in the service flow, the state value is unavailable, the state transition cannot be carried out, and the state transition is finished.
It can be seen from the foregoing method that the present invention associates the service state with the user operation, and after the user inputs the operation, the state value of the state node desired by the user can be automatically obtained. The target state may be a state after the current state or a state before the current state according to a user operation. For example, when the current status is "to be paid", the user performs a payment operation, and the target status is "paid". If the user reconfirms the order, the target state is "to be confirmed," at which time the user can adjust the selected goods and reconfirm. Thus, the schematic diagram of the state transition principle of the present invention is shown in fig. 4. For example, in the case of a state node having a state value of 20, a state node having a state value of 30 may be obtained, or conversely, a state node having a state value of 10 may be obtained. The method not only can be transferred from the current state node to the adjacent previous or next state node, but also can be transferred to any state node matched with the operation of the user in the business process. For example, a jump may be made from a state node with a state value of 10 to a state with a state value of 30 or 40. The state value in the invention is not required to be obtained by table look-up as in the prior art, but is obtained by calculation through a state transition equation, namely, the state value of the state node of the user in a certain service can be dynamically obtained by the invention.
Therefore, when the service process is changed or adjusted, only the state transition equation and the transition condition need to be changed, the whole process does not need to be straightened out again, the state value does not need to be changed, the design process is simple and convenient, the service process and the design process are more robust, and the user experience is improved.
The invention also provides a corresponding service state transition system based on dynamic programming, as shown in fig. 5. The system comprises:
the database 1 is used for storing the latest state value in the business process and recording an operation log of user operation;
the user operation acquisition module 2 is used for receiving user operations input by a user and obtaining operation identifiers;
a current state value obtaining module 3, configured to obtain, from the database 1, a state value of a current state node in a service flow currently operated by the user and after the last operation; and
and the state transition processing module 4 is configured to input the user operation identifier and the state value of the current state node as input variables to a state transition equation of the current state node, obtain a state value of a target state node in a service flow after the user operation, update the state value in the database 1 with the state value of the target state node, and record the user operation in a user operation log in the database 1.
In addition, the system of the present invention further includes a status page pushing module 5, as shown in fig. 6. And the state transition processing module 3 is connected to push a corresponding state page to the user according to the state value of the target state node.
The system of the present invention further includes an ending state determining module 6, as shown in fig. 7, and/or a previous operation acquiring module 7, as shown in fig. 8. The ending state judgment module 6 is connected with the current state value acquisition module 4 and the database 1, and is used for judging whether the current state node is the last state node in the current business process. The previous operation obtaining module 7 is configured to query, from the user operation log in the database, a previous user operation corresponding to the state value of the target state node and/or the state value of the current state node.
As shown in fig. 9, the state transition processing module 4 includes:
a state transition equation unit 41, configured to obtain, according to a state transition equation of a current state node, a state value corresponding to a target state node after the user operation by using a user operation identifier and the state value of the current state node as input variables;
a state value updating unit 42, connected to the state transition equation unit 41, for updating the state value in the database according to the state value of the target state node; and
and the user operation recording unit 43 is connected with the state transition equation unit 41 or the user operation obtaining module 2, and is used for recording the user operation for obtaining the state value of the target state node in a user operation log in a database, so as to facilitate query of service personnel.
Fig. 10 is a flowchart of a first embodiment of obtaining a target state value through a state transition equation according to the present invention. In the invention, the state value of the target state node corresponding to the user operation is dynamically calculated according to the state transition equation. The state transition equations are not appropriate, corresponding to different business processes and different transition conditions of each state node. The flow chart shown in fig. 10 is a transfer method of most state nodes of most business processes. The state transition equation is simplified to F (n +1) ═ F (n) + o (m), where F (n) is a state value function and o (m) is a user operation function, and the aforementioned function may be one equation or a plurality of equations. The state transition equation thus has two input entries, one for the state variable entry and one for the user manipulated variable entry, where F (n +1) is the target state node state value corresponding to the user manipulation o (m). The specific flow chart is as follows:
step SA51 assigns the state value of the current state and the user operation identifier to F (n +1) ═ F (n) + o (m) of the state transition equation, respectively. The state value of the current state is a state value stored in the data, specifically, a numerical value, for example, a numerical value "20". The user operation identifier is a value, for example, "10", which is obtained when the user selects a certain operation (e.g., a certain key) designed by the designer, and the corresponding value or character string is obtained.
In step SA52, a state transition equation is executed, so that F (n +1) ═ F (n) + o (m) ═ 20+10 ═ 30.
Step SA53, the result 30 of executing the state transition equation is taken as the state value of the target state node.
In order to enable state transition, in addition to the foregoing method, the state transition equation in the present invention adopts a doubly linked list structure, as shown in fig. 11, which is a schematic view of the state transition principle of the second embodiment of obtaining the target state value through the state transition equation according to the present invention. A doubly linked list can be used to perform state transitions on a single straight-line flow, i.e., each node has and can only have one front node and one back node. As shown in fig. 12, for the schematic diagram of the structural principle of the node in the second embodiment of obtaining the target state value by the state transition equation according to the present invention, each node has an information data field a and two pointer fields (alternatively referred to as identification bits, the identification bits of each state node are different), the pointer m1 is a forward pointer, the pointer m2 is a backward pointer, the pointer provides the direction of node transition, if the transition condition of a node meets the pointer m1, the node is moved forward, and if the transition condition of a node meets the pointer m2, the node is moved backward.
The process of the present invention for state transition using a doubly linked list is shown in FIG. 13.
Step SB51, assigning the state value of the current state node to the initial data of the current state node information field in the doubly linked list, and assigning the operation identifier obtained from the user operation identifier to the pointer value of the target state node, where in this embodiment, the user operation identifier is a numerical value. When the doubly linked list is adopted, if the target state node is not the adjacent node of the current state node, multiple iterations are needed, and the termination condition of the iteration is the user operation identifier.
Step SB52, comparing the user operation identifier with the pointers m1 and m2 of the current state node, if the pointer m1 of the current state node is larger than the user operation identifier, then in step SB53, taking the forward pointer m1 as the state transition direction of the transition, and obtaining the previous state node of the current state node as the current computing node; if the pointer m1 of the current state node is smaller than the user operation identifier, at step SB56, the backward pointer m2 is taken as the state transition direction of the transition, and the next state node of the current state node is acquired as the current computation node.
At steps SB54 and SB57, the information domain data of the current compute node is computed according to the state transition equation. For example, taking the expression F (n +1) ═ F (n) + O (m) as an example, if the current state value F (2) is 1, the operation identifier brought by the user operation is 5, and the pointer of the current node is 2, the flow needs to be shifted backward, and the state value of the next adjacent node is F (3) ═ F (2) + O (2) ═ 1+5 ═ 6.
At steps SB55 and SB58, the pointer value (the value of the flag) of the current compute node is compared with the user operation identifier, and if they are equal, at step SB59, the transition is stopped, the current compute state node is the target state node, and the information field data of the current compute node is the state value of the target state node.
If they are not equal, step SB53 or SB56 is added, and the iteration continues until the pointer value of the current compute node is equal to the user operation identifier. As in the previous example, if the pointer (value of the identification bit) of the state node with F (3) ═ 6 is 3, 3<5, so iteration and calculation are still required until the state node with the pointer equal to the user operation identifier is obtained.
The invention also adopts another mode of realizing state transition specifically, namely a finite state machine. Fig. 14 is a schematic diagram of a state transition principle of a third embodiment of the present invention, which obtains a target state value through a state transition equation, and a multi-flow state transition can be performed by using a finite state machine.
FIG. 15 is a flowchart illustrating a second embodiment of obtaining a target state value according to a state transition equation. The method comprises the following specific steps:
step SC51, assigning the state value of the current state node as the initial value of the node state value Sum.
Step SC52, calculating according to the formula Sum (n +1) ═ Sum (n) + r (m), where r (m) is a user operation identifier, and in this embodiment, the user operation identifier is a numeric value;
step SC53, determining whether the value of the flag of the currently calculated state node is consistent with the user operation identifier, if so, in step SC54, the state node is the target state node, and taking the state value Sum (n +1) as the state value of the target state node, if not, returning to step SC51 to continue the calculation until obtaining whether the value of the flag of the currently calculated state node is consistent with the user operation identifier.
In the two embodiments, when the doubly linked list is used for state transition, straight line transition can be performed, and when the finite state machine is used for state transition, state nodes with branches can be transitioned. Thus, when the state transition is performed by combining these two methods, the state transition diagram shown in fig. 14 can be completed.
In the foregoing method, several specific implementation manners for obtaining the target state value through the state transition equation are provided in the present invention, and it should be clear to those skilled in the art that the data expression of the state transition equation in the foregoing example is only an example, different attributes are set according to different types and operating conditions of the nodes in the business process, and different state transition equations are applied to different attributes, so that, when performing state transition, it is necessary to set certain conditions according to the attributes of the state nodes, such as that a user cannot perform cancel operation at the node, and when iterating to the node, the user continues to transition downwards. The state value of the next state node is obtained at the state node through the state transition equation matched with the attribute of the state node, for example, the method in the foregoing embodiment one can be adopted in one service flow, and the method in embodiment two or three is adopted at some nodes, and the whole service flow is completed by mixing and using the methods. In the second or third embodiment, when iteration is performed, after the current state is transferred to the next state, if the next transfer is required, calculation needs to be performed according to the state transfer equation of the next state node.
Still taking the customer order business process as an example, the business process is composed of: the total of 7 state nodes of confirmation, payment waiting, ex-warehouse, acceptance waiting and completion. In the "pending payment" status node, if the client selects the payment operation, assuming that the initial status value f (n) is 10 and the user payment operation o (n) is 10, after the client pays, the status value of "paid" in one status node is (n +1) is 20, and the order flow of the client arrives at the "paid" status node. However, since the customer payment is actually not billed due to problems during the financial audit, the order process of the customer is returned by the "paid" status node with status value 20 to the "to be paid" status node with status value f (n) 10.
The business process in the invention can carry out state transition and dynamically obtain the state value after the transition according to the specific operation of the user, such as the payment operation of the user or the actually occurring transition condition, such as the fact that the money of the user is not actually paid. The transferred state value is automatically recorded in the database, so that when the business process is transferred according to the transfer condition, the state value can be obtained, the transferred state value can be dynamically obtained, and the state value of the state node does not need to be set as in the prior art. When the service flow needs to be updated, only the added nodes and the transfer conditions thereof need to be set, and the whole service flow does not need to be smoothed again as in the prior art.
The invention records the specific operation of the user in the user operation record log, so that the invention can obtain the previous state node and the user operation thereof by inquiring the current state node, and provides accurate and complete user operation record for service personnel.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.