CN117273177A - Service processing method, device, electronic equipment and computer readable medium - Google Patents

Service processing method, device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN117273177A
CN117273177A CN202210661909.6A CN202210661909A CN117273177A CN 117273177 A CN117273177 A CN 117273177A CN 202210661909 A CN202210661909 A CN 202210661909A CN 117273177 A CN117273177 A CN 117273177A
Authority
CN
China
Prior art keywords
state
state machine
machine instance
service
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210661909.6A
Other languages
Chinese (zh)
Inventor
张世博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Tuoxian Technology Co Ltd filed Critical Beijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202210661909.6A priority Critical patent/CN117273177A/en
Publication of CN117273177A publication Critical patent/CN117273177A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/02Reservations, e.g. for tickets, services or events
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/103Workflow collaboration or project management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/407Cancellation of a transaction
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H15/00ICT specially adapted for medical reports, e.g. generation or transmission thereof
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H40/00ICT specially adapted for the management or administration of healthcare resources or facilities; ICT specially adapted for the management or operation of medical equipment or devices
    • G16H40/20ICT specially adapted for the management or administration of healthcare resources or facilities; ICT specially adapted for the management or operation of medical equipment or devices for the management or administration of healthcare resources or facilities, e.g. managing hospital staff or surgery rooms

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Human Resources & Organizations (AREA)
  • Physics & Mathematics (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Tourism & Hospitality (AREA)
  • Epidemiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Operations Research (AREA)
  • Public Health (AREA)
  • Primary Health Care (AREA)
  • Accounting & Taxation (AREA)
  • Medical Informatics (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Data Mining & Analysis (AREA)
  • Finance (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Biomedical Technology (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a business processing method, a business processing device, electronic equipment and a computer readable medium, which relate to the field of consumer medical treatment, and one specific implementation mode comprises the steps of responding to the detection of a business triggering event and acquiring a corresponding business type identifier; acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event; and determining the current service state, and operating the target state machine instance to convert the current service state to a target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance. Therefore, the service state conversion efficiency and the service state conversion quality can be improved, and the development period and the development cost for realizing the service state conversion are reduced.

Description

Service processing method, device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates to the field of consumer medical technology, and in particular, to a service processing method, apparatus, electronic device, and computer readable medium.
Background
Consumer healthcare generally refers to a marketable medical project that is non-public, non-therapeutic, and actively selected for implementation by consumers. The workflow related to the consumer medical treatment comprises the following nodes: order creation, order placement, order payment, order management, order completion, etc., and after one node flow is completed, the business processing state of the corresponding node needs to be changed. The change of the service processing state is usually realized based on codes, such as a user submits reservation, the codes for carrying out state change are called to carry out verification of reservation information submitted by the user, then a third party system is called to submit the reservation information, callback notification of the third party system is received, and then the state of reservation documents in a database is updated according to the callback notification. As the business accepted by consumer healthcare accumulates, the cost of modifying the code used to make the state change increases.
In the process of implementing the present application, the inventor finds that at least the following problems exist in the prior art:
through the coding form, the circulation among the service states is ensured, and the modification cost of codes for carrying out state change is continuously increased along with the accumulation of the service of the state to be changed.
Disclosure of Invention
In view of this, the embodiments of the present application provide a service processing method, apparatus, electronic device, and computer readable medium, which can solve the problem that the current through-code form ensures the circulation between service states, and the modification cost of the code for performing the state change is continuously increased along with the accumulation of the service to be changed.
To achieve the above object, according to one aspect of the embodiments of the present application, there is provided a service processing method, including:
responding to the detection of a service triggering event, and acquiring a corresponding service type identifier;
acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event;
and determining the current service state, and operating the target state machine instance to convert the current state to the target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance.
Optionally, after determining the current service state, the service processing method further includes:
and returning a state transition failure identification in response to the current service state not matching the target state machine instance.
Optionally, determining the target state machine instance from the state machine instance pool according to the service trigger event includes:
and acquiring an instance identifier corresponding to the service triggering event, determining a corresponding state machine instance from a state machine instance pool according to the instance identifier, and further determining the state machine instance as a target state machine instance.
Optionally, before running the target state machine instance, the service processing method further comprises:
and determining a source state corresponding to the target state machine instance, and determining that the current service state is matched with the target state machine instance in response to the fact that the current service state is consistent with the source state.
Optionally, before acquiring the corresponding state machine instance pool, the service processing method further includes:
for each service type identifier, packaging a triggering event, a source state, a target service state and an operation contained in each corresponding state conversion process into a state machine instance;
and forming each state machine instance into a state machine instance pool.
Optionally, after the current state is converted to the target service state corresponding to the target state machine instance, the method further includes:
And returning a successful identification of the state transition.
Optionally, after running the target state machine instance, the service processing method further comprises:
generating an asynchronous running task based on the target state machine instance and sending the asynchronous running task to an asynchronous task pool in response to receiving the conversion failure identification;
and executing the asynchronous running task until receiving the conversion success identification in response to the current time reaching the task execution time corresponding to the asynchronous running task.
In addition, the application also provides a service processing device, which comprises:
the acquisition unit is configured to respond to the detection of the service triggering event and acquire the corresponding service type identifier;
the target state machine instance determining unit is configured to obtain a corresponding state machine instance pool according to the service type identifier, and further determine a target state machine instance from the state machine instance pool according to the service trigger event;
and the state transition unit is configured to determine the current service state, and run the target state machine instance to transition the current state to the target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance.
Optionally, the state transition unit is further configured to:
And returning a state transition failure identification in response to the current service state not matching the target state machine instance.
Optionally, the target state machine instance determining unit is further configured to:
and acquiring an instance identifier corresponding to the service triggering event, determining a corresponding state machine instance from a state machine instance pool according to the instance identifier, and further determining the state machine instance as a target state machine instance.
Optionally, the service processing device further comprises an authentication unit configured to:
and determining a source state corresponding to the target state machine instance, and determining that the current service state is matched with the target state machine instance in response to the fact that the current service state is consistent with the source state.
Optionally, the service processing apparatus further comprises a state machine instance pool composing unit configured to:
for each service type identifier, packaging a triggering event, a source state, a target service state and an operation contained in each corresponding state conversion process into a state machine instance;
and forming each state machine instance into a state machine instance pool.
Optionally, the state transition unit is further configured to:
and returning a successful identification of the state transition.
Optionally, the state transition unit is further configured to:
generating an asynchronous running task based on the target state machine instance and sending the asynchronous running task to an asynchronous task pool in response to receiving the conversion failure identification;
And executing the asynchronous running task until receiving the conversion success identification in response to the current time reaching the task execution time corresponding to the asynchronous running task.
In addition, the application also provides a service processing electronic device, which comprises: one or more processors; and a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the service processing method as described above.
In addition, the application also provides a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the service processing method as described above.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of responding to a service triggering event to obtain a corresponding service type identifier; acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event; and determining the current service state, and operating the target state machine instance to convert the current service state to a target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance. Therefore, the service state conversion efficiency and the service state conversion quality can be improved, and the development period and the development cost for realizing the service state conversion are reduced.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the present application and are not to be construed as unduly limiting the present application. Wherein:
FIG. 1 is a schematic diagram of the main flow of a business processing method according to one embodiment of the present application;
FIG. 2 is a schematic diagram of the main flow of a business processing method according to one embodiment of the present application;
FIG. 3 is a schematic view of reservation document status flow for a business processing method according to one embodiment of the present application;
FIG. 4 is a state machine diagram of a business processing method according to one embodiment of the present application;
FIG. 5 is a schematic diagram of the state machine core operation principle of the service processing method according to one embodiment of the present application;
FIG. 6 is a schematic diagram of the logic relationship of the internal components of the state machine of the business processing method according to one embodiment of the present application;
FIG. 7 is a schematic diagram of a state machine start-up principle of a service processing method according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a state machine operation execution flow of a business processing method according to one embodiment of the present application;
Fig. 9 is a schematic diagram of main units of a service processing apparatus according to an embodiment of the present application;
FIG. 10 is an exemplary system architecture diagram in which embodiments of the present application may be applied;
fig. 11 is a schematic diagram of a computer system suitable for use in implementing the terminal device or server of the embodiments of the present application.
Detailed Description
Exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness. The data acquisition, storage, use, processing and the like in the technical scheme meet the relevant regulations of national laws and regulations.
Fig. 1 is a schematic diagram of main flow of a service processing method according to an embodiment of the present application, and as shown in fig. 1, the service processing method includes:
step S101, responding to the detection of the service triggering event, and acquiring the corresponding service type identifier.
In this embodiment, the execution body (for example, may be a server) of the service processing method may detect the service triggering event by using a wired connection or a wireless connection. For example, a business trigger event may be bound to an element on a business process page, and when a user interacts with an element (for example) on the business process page, the business trigger event bound to the element is triggered. Specifically, the elements on the service processing page may be a reservation control, a payment control, and the like, and the embodiment of the present application does not specifically limit the elements on the service processing page.
The service type identifier may be an identifier for indicating what type of service is handled, for example YY, representing handling of a subscription service, or ZF, representing handling of a payment service.
Step S102, according to the service type identifier, a corresponding state machine instance pool is obtained, and then a target state machine instance is determined from the state machine instance pool according to the service trigger event.
The executing body determines the corresponding state machine according to the service type identifier, and then the executing body can call a preset state machine instance pool according to the state machine to determine a target state machine instance from the state machine instance pool according to the service trigger event.
Specifically, the state machine instance pool includes one or more state machine instances. Each state machine instance may correspond to a business state transition process. In the same state machine instance pool, the service trigger event corresponding to each state machine instance is different, and the service trigger event can be, for example, a reservation service trigger event, a payment service trigger event, etc. That is, a state machine instance may be uniquely determined from a service trigger event in the same state machine instance pool. A target state machine instance can be uniquely determined in a corresponding state machine instance pool according to the service trigger event detected by the execution body.
Each state machine instance in the state machine instance pool may correspond to a business state transition process consisting of business trigger events, source states, target business states, and transition actions. The source state may be any one of a to-be-reserved state, a cancelled state, a refund state, and the like, and the embodiment of the present application does not specifically limit the source state. The target service state may be any one of an arrived-at-check state, a checked-out state, a reported-out state, an expired state, a refund failure state, a refund completion state, and a reservation success state, and the embodiment of the present application does not specifically limit the target service state.
Specifically, determining a target state machine instance from a state machine instance pool according to a service trigger event includes:
and acquiring an instance identifier corresponding to the service triggering event, determining a corresponding state machine instance from a state machine instance pool according to the instance identifier, and further determining the state machine instance as a target state machine instance.
As another implementation manner, the execution body may further acquire a corresponding instance identifier from the service triggering event, so as to find whether a corresponding state machine instance exists in the state machine instance pool according to the acquired instance identifier, and if so, determine the found corresponding state machine instance as the target state machine instance.
Step S103, determining the current service state, and responding to the matching of the current service state and the target state machine instance, and operating the target state machine instance to convert the current service state to the target service state corresponding to the target state machine instance.
Specifically, after determining the current service state, the method further includes:
and returning a state transition failure identification in response to the current service state not matching the target state machine instance.
When the current service state is not the source state corresponding to the target state machine instance, the execution body may determine that the current service state does not match the target state machine instance, and return a state transition failure identifier, which may be error, for example. The source state may be any one of a to-be-reserved state, a cancelled state, a refund state, and the like, and the embodiment of the present application does not specifically limit the source state.
Specifically, after running the target state machine instance, the method further comprises: generating an asynchronous running task based on the target state machine instance and sending the asynchronous running task to an asynchronous task pool in response to receiving the conversion failure identification; and executing the asynchronous running task until receiving the conversion success identification in response to the current time reaching the task execution time corresponding to the asynchronous running task.
When the single thread runs the target state machine instance to execute the state conversion, when the operation fails, and the conversion failure identification is received, the execution main body can generate an asynchronous operation task according to the target state machine instance, and then send the asynchronous operation task to an asynchronous task pool, so that the asynchronous operation task is re-executed when the set asynchronous task execution time is reached, and the service state conversion is performed until the service state conversion is successful and the conversion success identification is received. Therefore, the successful execution of the service state conversion can be ensured, and the success rate of the service state conversion is improved.
In the embodiment, a corresponding service type identifier is obtained by responding to the detection of a service triggering event; acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event; and determining the current service state, and operating the target state machine instance to convert the current service state to a target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance. Therefore, the service state conversion efficiency and the service state conversion quality can be improved, and the development period and the development cost for realizing the service state conversion are reduced.
Fig. 2 is a main flow diagram of a service processing method according to an embodiment of the present application, and as shown in fig. 2, the service processing method includes:
step S201, responding to the detection of the service triggering event, and obtaining the corresponding service type identifier.
The service trigger event may be, for example, a service trigger event corresponding to a subscription service, or a service trigger event corresponding to a payment service. For example, when the user clicks the reservation control on the service processing page, a service trigger event corresponding to the reserved service is triggered. When the user clicks the payment control on the service processing page, a service triggering event corresponding to the payment service is triggered.
The service type identifier is used for representing what type of service is handled, and may be a number or a letter.
Step S202, according to the service type identifier, a corresponding state machine instance pool is obtained, and then a target state machine instance is determined from the state machine instance pool according to the service trigger event.
Each service type identifier corresponds to a state machine. Each state machine corresponds to a pool of state machine instances. As shown in fig. 6, a schematic diagram of the logic relationship of the internal components of the state machine is shown. A state machine instance pool contains n transitions, and the combination of "service trigger event", "source state", "target service state", "transition action" is referred to as a transition.
In fig. 6, each state machine may include multiple transitions, each transition being a state machine instance. In a transition (i.e., in a state machine instance) including an event, source, target, action, the service trigger event, source state, target service state, transition action are represented, respectively.
The service trigger event + source state + target service state can determine which conversion of the corresponding state machines is used by the service type identifier, that is, which state machine instance in the current state machine instance pool is used as the target state machine instance to perform the conversion of the service state.
Specifically, before the corresponding state machine instance pool is acquired, the service processing method further comprises the following steps:
for each service type identifier, packaging a triggering event, a source state, a target service state and an operation contained in each corresponding state conversion process into a state machine instance; and forming each state machine instance into a state machine instance pool.
As shown in fig. 6, by encapsulating the event, source, target, and action (specifically, the service triggering event, source state, target service state, and transition action) corresponding to each transition procedure included in the state machine corresponding to each service type identifier into each state machine instance in advance, a state machine instance pool formed by each state machine instance can be obtained to facilitate subsequent use.
Step S203, determining the current service state, determining the source state corresponding to the target state machine instance, and determining that the current service state is matched with the target state machine instance in response to the fact that the current service state is consistent with the source state.
The source state corresponding to the target state machine instance comprises: a waiting for reservation state, a reservation in progress state, a cancelled state, a refund in progress state, and the like. When the executing body determines that the current service state is consistent with the source state corresponding to the target state machine instance, then the current service state may be determined to match the target state machine instance.
And when the execution main body determines that the current service state is inconsistent with the source state corresponding to the target state machine, ending the processing process of the service corresponding to the detected service triggering event.
In step S204, in response to the current service state matching the target state machine instance, the target state machine instance is operated to convert the current service state to a target service state corresponding to the target state machine instance.
The result of executing the subject running the target state machine instance may be that the running is successful or that the running is failed, and the running end identifier is returned. The end of run identifier may include a state transition success identifier (e.g., success) and a state transition failure identifier (e.g., fail).
Specifically, after the current state is converted to the target service state corresponding to the target state machine instance, the service processing method further includes:
and returning a successful identification of the state transition. That is, the execution body returns a state transition success flag after determining that the service state transition is successful.
The embodiment of the application abstracts the complex state change in the state circulation of the performance bill in the performance system, and maintains the complex state change through a state machine after standardization. Each business line maintains its own unique requirements. Therefore, innovation of the product level is achieved, the research and development period of new requirements is shortened, the development cost is reduced, and the delivery efficiency and quality are improved.
Fig. 3 is a schematic view illustrating reservation document status flow according to a service processing method according to an embodiment of the present application. In particular to reservation bill state circulation in the medical field of consumption. For example, as shown in fig. 3, when the executor body detects that order payment is completed or equity redemption occurs, a reservation sheet is created, and the state of the reservation sheet is set to be reserved. And the user submits the reservation, synchronizes the reservation information and directly returns a reservation success message, so that the state of the reservation list is converted into the reservation success. And the user submits the reservation, the state of the reservation list is converted into the reservation, the reservation is successfully recalled, and the state of the reservation list is further converted into the reservation success. When the user initiates the cancellation of the reservation, the state of the reservation list is converted from the reservation to the cancellation successfully, and when the three-party callback is cancelled successfully, the state of the reservation list is converted from the cancellation to the cancelled. When the user initiates refund, the state of the reservation list is converted from cancelled to refund, and when the quick refund fails or the refund process fails, the state of the reservation list is converted from refund to refund failure. And when the refund is successful, converting the state of the reservation list from refund to refund. After the state of the reservation list is converted into the reservation success, if the three-party feedback is checked, the state of the reservation list is converted from the reservation success into the check; if the three parties call the verification service, the state of the reservation list is successfully changed from reservation to verified; if the three parties push back the reported, the state of the reservation list is successfully converted from reservation to reported.
And the user submits the reservation, synchronizes the reservation message, and if the user directly returns failure, the service state is converted into the reservation failure from the to-be-reserved state, and further, when the valid period of the reservation list is out of date, the service state can be converted into the expired state from the reservation failure.
When the state of the reservation list is cancelled, a new reservation can be lifted, and if the effective time of the reservation list is over, the state of the reservation list can be converted from cancelled to expired.
The core of the performance system is to control the state change of the performance document, and the relationship between the states of the performance document in the performance system is shown in fig. 3. The embodiment of the application manages the state and the change relation between the states through a state machine. Each service line maintains a respective characteristic requirement. Therefore, innovation of the product level is achieved, the research and development period of new requirements is shortened, the development cost is reduced, and the delivery efficiency and quality are improved. Through the state transition of the reservation list, the state of the reservation list can be updated in time, so that the user can conveniently identify and use the reservation list.
Fig. 4 is a schematic diagram of the state machine according to the service processing method according to one embodiment of the present application. Flow transitions between states are the nature of State machines, whereas State transitions require the flow to be driven from a source State (State) to a Target traffic State (Target State) by an Event (Event) during which some operation (Action), called a one-time Transition (Transition), is performed.
Fig. 5 is a schematic diagram of a state machine core working principle of a service processing method according to an embodiment of the present application. Some of the following components are involved in the state machine:
stateMachine state machine: the control center is used for completing state transition after an event occurs according to a preset reservation bill flow.
event: events that trigger the state of the state machine, such as user submitting a reservation, successful order payment, three-way push-to-check, etc.
transition: event driven state transitions. Binding with event.
Interceptor: interceptors are divided into three levels of global, state machine and transition. action: the event triggers an action that is performed after the state machine. The relationship between these components is shown in fig. 6. FIG. 6 is a diagram of the logical relationships of the internal components of the state machine. I.e., a StateMachine state machine may contain multiple Transition transitions. One Transition contains what event (event) the Transition is triggered by. After triggering, the source state of the conversion is source, and the target state after the conversion is target. The actual conversion operation is that the actions configured in the Transition complete the specific conversion action. In the implementation system introduced by the reservation document state flow diagram shown in fig. 3, a state change of a state flow of a reservation document from a to-be-reserved (source state) state to a reserved (target state) state is triggered by a user submitting a reservation action (event). According to this concept, the complex state flow in fig. 3 can be all split into fine-grained transitions (transitions), and these transitions are maintained in the form of configurations to form a state machine configuration in a business mode in the fulfillment system.
Fig. 7 is a schematic diagram of a state machine start-up principle of a service processing method according to an embodiment of the present application. In the embodiment of the application, the state machine: is a finite state automaton for short, and is a mathematical model formed by abstracting operation rules of reality. And (3) performing a system: and after tracking and guaranteeing the user transaction, the provider executes a contract tracking execution system. The fulfillment system may maintain a copy of the more transacted order information. Spring: the Spring framework is a J2EE application framework of open source code, initiated by Rod Johnson, which is a lightweight container (lightweight container) that manages the life cycle of beans. Spring solves many common problems encountered by developers in J2EE development, and provides powerful IOC, AOP, web MVC and other functions. Spring can be applied to construction application alone, can also be combined with a plurality of Web frameworks such as Struts, webwork, tapestry, and can be combined with desktop application AP such as Swing.
The state machine design depends on the java framework Spring running environment. The starting principle is as follows: when the Spring container is loaded, after a hook interface of Spring is realized through a core entry class of a state machine, configuration file analysis work of the state machine is called and triggered, and configuration file analysis is performed in the configuration analysis work, wherein the configuration file exists in various forms such as json, xml and the like. After the analysis is completed, the state machine configuration in a service mode takes the name (namely, the name of the state machine) as a key, and the state machine object (namely, the state machine object obtained by encapsulating the components of the state machine in an object-oriented form) is cached in a form of value. Waiting for the service system to trigger the state transition operation of the state machine. The hook function is exposed by adapting spring, the hook function is realized, the spring loads the state machine into the program, waits for the arrival of a service triggering event, and then executes corresponding conversion. The development period of new requirements can be shortened, the development cost can be reduced, and the service state conversion delivery efficiency and quality can be improved.
Fig. 8 is a schematic diagram of a state machine operation execution flow of the service processing method according to an embodiment of the present application. As shown in fig. 8, when the state machine is used and the state machine conversion method is called, each state circulation process includes: event, source state source (which may be empty), target state target, operation action, maintain this information as a Transition. Multiple transitions under a business process are combined to form a state machine configuration. The state machine configuration acquires state machine configuration information from the state machine configuration cache according to the requested parameter entry, and returns specific state machine configuration information to the state machine. The execution body calls the state machine to execute the corresponding state transition logic according to the state machine configuration information. The state machine configuration configures the interceptors at the state machine level, transition level, or global level, as desired. Wherein the global level configuration interceptor is applicable to all state transitions in all state machines. The state machine level interceptor applies to all transitions in a particular state machine. The Transition level interceptor is applicable to the current Transition. The pre-intercept logic of the interceptor is used to perform a match verification of the current traffic state and the source state, determine if a traffic state transition can be performed, etc., prior to the transition action. The post-intercept logic of the interceptor is used to record the process of traffic state transitions after the transition actions, detailed operation logs, etc., where the detailed operation logs may include what time the traffic state transitions were made, what state was before the transition, what state was after the transition, whether the result of the transition was success or failure, etc.
The business system drives the corresponding state machine to carry out specific and actual state conversion (transition) operation by calling trigger () of the state machine service and adding a request parameter Message and a state machine name to be used. And when the state transition action is performed, whether the current state of the action checking flow accords with the source state or not, and the current state can be transferred to the target state only if the current state accords with the source state. The business system finally processes the unified result response returned by the state machine.
Fig. 9 is a schematic diagram of main units of a service processing apparatus according to an embodiment of the present application. As shown in fig. 9, the service processing apparatus 900 includes an acquisition unit 901, a target state machine instance determination unit 902, and a state transition unit 903.
An obtaining unit 901, configured to obtain a corresponding service type identifier in response to detecting a service triggering event.
The target state machine instance determining unit 902 is configured to obtain a corresponding state machine instance pool according to the service type identifier, and further determine a target state machine instance from the state machine instance pool according to the service trigger event.
The state transition unit 903 is configured to determine a current service state, and in response to the current service state matching the target state machine instance, run the target state machine instance to transition the current state to a target service state corresponding to the target state machine instance.
In some embodiments, the state transition unit 903 is further configured to: and returning a state transition failure identification in response to the current service state not matching the target state machine instance.
In some embodiments, the target state machine instance determination unit 902 is further configured to: and acquiring an instance identifier corresponding to the service triggering event, determining a corresponding state machine instance from a state machine instance pool according to the instance identifier, and further determining the state machine instance as a target state machine instance.
In some embodiments, the apparatus further comprises a verification unit, not shown in fig. 9, configured to: and determining a source state corresponding to the target state machine instance, and determining that the current service state is matched with the target state machine instance in response to the fact that the current service state is consistent with the source state.
In some embodiments, the apparatus further comprises a state machine instance pool constituent unit, not shown in fig. 9, configured to: for each service type identifier, packaging a triggering event, a source state, a target service state and an operation contained in each corresponding state conversion process into a state machine instance; and forming each state machine instance into a state machine instance pool.
In some embodiments, the state transition unit 903 is further configured to: and returning a successful identification of the state transition.
In some embodiments, the state transition unit 903 is further configured to: generating an asynchronous running task based on the target state machine instance and sending the asynchronous running task to an asynchronous task pool in response to receiving the conversion failure identification; and executing the asynchronous running task until receiving the conversion success identification in response to the current time reaching the task execution time corresponding to the asynchronous running task.
In the present application, the service processing method and the service processing apparatus have a corresponding relationship in terms of implementation content, and therefore, the description of the repeated content is not repeated.
Fig. 10 illustrates an exemplary system architecture 1000 to which the business processing methods or business processing apparatuses of the embodiments of the present application may be applied.
As shown in fig. 10, a system architecture 1000 may include terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 serves as a medium for providing a communication link between the terminal apparatuses 1001, 1002, 1003 and the server 1005. The network 1004 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user can interact with a server 1005 via a network 1004 using terminal apparatuses 1001, 1002, 1003 to receive or transmit messages or the like. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 1001, 1002, 1003.
The terminal devices 1001, 1002, 1003 may be various electronic devices having a service processing screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 1005 may be a server providing various services, such as a background management server (by way of example only) providing support for service trigger events detected by users using the terminal devices 1001, 1002, 1003. The background management server responds to the detection of the service triggering event and acquires the corresponding service type identifier; acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event; and determining the current service state, and operating the target state machine instance to convert the current service state to a target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance. Therefore, the service state conversion efficiency and the service state conversion quality can be improved, and the development period and the development cost for realizing the service state conversion are reduced.
It should be noted that, the service processing method provided in the embodiment of the present application is generally executed by the server 1005, and accordingly, the service processing apparatus is generally disposed in the server 1005.
It should be understood that the number of terminal devices, networks and servers in fig. 10 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 11, there is illustrated a schematic diagram of a computer system 1100 suitable for use in implementing the terminal device of an embodiment of the present application. The terminal device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 11, the computer system 1100 includes a Central Processing Unit (CPU) 1101, which can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM1103, various programs and data required for the operation of the computer system 1100 are also stored. The CPU1101, ROM1102, and RAM1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input section 1106 including a keyboard, a mouse, and the like; an output section 1107 including a Cathode Ray Tube (CRT), a liquid crystal credit authorization query processor (LCD), and the like, and a speaker, and the like; a storage section 1108 including a hard disk or the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, and the like. The communication section 1109 performs communication processing via a network such as the internet. The drive 1110 is also connected to the I/O interface 1105 as needed. Removable media 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is installed as needed in drive 1110, so that a computer program read therefrom is installed as needed in storage section 1108.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1109, and/or installed from the removable media 1111. The above-described functions defined in the system of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 1101.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware. The described units may also be provided in a processor, for example, described as: a processor includes an acquisition unit, a target state machine instance determination unit, and a state transition unit. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As another aspect, the present application also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by one of the devices, cause the device to obtain a corresponding service type identifier in response to detecting a service trigger event; acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event; and determining the current service state, and operating the target state machine instance to convert the current service state to a target service state corresponding to the target state machine instance in response to the matching of the current service state and the target state machine instance.
According to the technical scheme of the embodiment of the application, the service state conversion efficiency and the service state conversion quality can be improved, and the development period and the development cost for realizing service state conversion are reduced.
The above embodiments do not limit the scope of the application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (12)

1. A method for processing a service, comprising:
responding to the detection of a service triggering event, and acquiring a corresponding service type identifier;
acquiring a corresponding state machine instance pool according to the service type identifier, and further determining a target state machine instance from the state machine instance pool according to the service triggering event;
and determining a current service state, and responding to the matching of the current service state and the target state machine instance, and operating the target state machine instance so as to convert the current service state into a target service state corresponding to the target state machine instance.
2. The method of claim 1, wherein after said determining the current traffic state, the method further comprises:
and returning a state transition failure identification in response to the current service state not matching the target state machine instance.
3. The method of claim 1, wherein said determining a target state machine instance from said pool of state machine instances based on said traffic trigger event comprises:
and acquiring an instance identifier corresponding to the service triggering event, determining a corresponding state machine instance from the state machine instance pool according to the instance identifier, and further determining the state machine instance as a target state machine instance.
4. The method of claim 1, wherein prior to said running said target state machine instance, said method further comprises:
and determining a source state corresponding to the target state machine instance, and determining that the current service state is matched with the target state machine instance in response to the current service state being consistent with the source state.
5. The method of claim 1, wherein prior to the obtaining the corresponding state machine instance pool, the method further comprises:
for each service type identifier, packaging a triggering event, a source state, a target service state and an operation contained in each corresponding state conversion process into a state machine instance;
and forming each state machine instance into a state machine instance pool.
6. The method of claim 5, wherein after said transitioning the current state to the target traffic state corresponding to the target state machine instance, the method further comprises:
and returning a successful identification of the state transition.
7. The method of claim 1, wherein after said running said target state machine instance, said method further comprises:
generating an asynchronous running task based on the target state machine instance and sending the asynchronous running task to an asynchronous task pool in response to receiving the conversion failure identification;
And executing the asynchronous running task until receiving a conversion success identification in response to the current time reaching the task execution time corresponding to the asynchronous running task.
8. A service processing apparatus, comprising:
the acquisition unit is configured to respond to the detection of the service triggering event and acquire the corresponding service type identifier;
the target state machine instance determining unit is configured to obtain a corresponding state machine instance pool according to the service type identifier, and further determine a target state machine instance from the state machine instance pool according to the service triggering event;
and the state conversion unit is configured to determine a current service state, and respond to the matching of the current service state and the target state machine instance, and operate the target state machine instance so as to convert the current state into a target service state corresponding to the target state machine instance.
9. The apparatus of claim 8, wherein the state transition unit is further configured to:
and returning a state transition failure identification in response to the current service state not matching the target state machine instance.
10. The apparatus of claim 8, wherein the target state machine instance determination unit is further configured to:
And acquiring an instance identifier corresponding to the service triggering event, determining a corresponding state machine instance from the state machine instance pool according to the instance identifier, and further determining the state machine instance as a target state machine instance.
11. A business processing electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
12. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
CN202210661909.6A 2022-06-13 2022-06-13 Service processing method, device, electronic equipment and computer readable medium Pending CN117273177A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210661909.6A CN117273177A (en) 2022-06-13 2022-06-13 Service processing method, device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210661909.6A CN117273177A (en) 2022-06-13 2022-06-13 Service processing method, device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN117273177A true CN117273177A (en) 2023-12-22

Family

ID=89201407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210661909.6A Pending CN117273177A (en) 2022-06-13 2022-06-13 Service processing method, device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN117273177A (en)

Similar Documents

Publication Publication Date Title
US10860398B2 (en) Adapting legacy endpoints to modern APIs
US9766927B1 (en) Data flow management in processing workflows
US11755461B2 (en) Asynchronous consumer-driven contract testing in micro service architecture
CN111090423B (en) Webhook framework system and method for realizing active calling and event triggering
CN112288577B (en) Transaction processing method, device, electronic equipment and medium for distributed service
CN112068973A (en) Asynchronous information processing method and device of policy mode, server and storage medium
US20100095165A1 (en) Method of Handling a Message
CN114900379A (en) Message notification method and device, electronic equipment and storage medium
CN111127224B (en) Information processing method, information processing device, electronic equipment and storage medium
CN112445860B (en) Method and device for processing distributed transaction
CN117273177A (en) Service processing method, device, electronic equipment and computer readable medium
CN113760487B (en) Service processing method and device
CN112134918B (en) Method for detecting and processing matching state of function and trigger in cloud service
CN113448960A (en) Method and device for importing form file
CN113590243A (en) Energy enterprise project creation method and device, computer equipment and medium
CN109840073B (en) Method and device for realizing business process
CN112241332A (en) Interface compensation method and device
CN114202046B (en) Method, device, equipment and medium for generating two-dimension code based on SAP system
WO2023273164A1 (en) Code integrated verification method and device
CN113947434A (en) Business processing method and device for multi-business component combination scene
CN116167835A (en) Service processing method, device, electronic equipment and computer readable medium
CN116700718A (en) Page configuration-based data processing method and system
CN115018490A (en) Payment method, system, device and medium based on transaction platform
CN114170006A (en) Information data acquisition method, device, equipment and medium based on state machine
CN116012158A (en) Service processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination