A method and system for backtracking a cross-time-zone business travel order state machine

CN122597044APending Publication Date: 2026-08-18GUANGZHOU MEIYA SHANGTU INT TRAVEL SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610920023.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-24
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0004]然而,现有方案的这种实现方式在面对跨时区商旅订单时存在技术缺陷

Benefits of technology

[0025]本发明通过同义动作合并与对象规范化处理,将异构业务系统中的差异化表述统一为标准语义要素,消除了多源订单事件在语义层面的二义性,为跨系统状态回溯奠定了可靠的语义基础。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597044A_ABST
    Figure CN122597044A_ABST
Patent Text Reader

Abstract

The application discloses a kind of backtracking method and system of cross time zone business travel order state machine, belong to order data processing technical field, it includes from distribution end, supply end, payment end obtains order change message stream and parses event source identification and event load, event semantic elements are constructed by synonym action merging, object normalization and dependence extraction, time credibility calculation and uniform time identification generation are carried out in conjunction with multi-source timestamp, then causal sequence event set is formed by cause-effect reasoning and dependence graph analysis, then drive order state machine to generate state path and obtain final state snapshot according to target time instant clipping, finally, based on the dependence satisfaction and time consistency of key event node Abstract generation Verifiable backtracking result.The application solves the problem that order state backtracking is inconsistent and difficult to verify under cross time zone and multi-source message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of order data processing technology, and in particular to a backtracking method and system for a cross-time zone business travel order state machine. Background Technology

[0002] This application relates to order data processing technology, and more particularly to a method and system for backtracking the process of managing the order lifecycle through a state machine in cross-timezone business travel services. The transaction chain of business travel orders typically spans global distribution systems, service provider systems, and payment settlement systems. These systems asynchronously generate and push business messages representing changes in order status, constituting a dynamically evolving order event flow in a distributed environment. To accurately reconstruct the state of an order at a specific historical moment in scenarios such as after-sales disputes, financial reconciliation, or compliance audits, a backtracking mechanism capable of comprehensively processing messages from multiple sources and time zones is needed.

[0003] Existing order status backtracking solutions generally rely on local transaction logs of a single system or change records in a centralized database. Order status is restored by replaying or reverse-engineering operation logs in timestamp order. This approach works effectively in scenarios involving only a single closed-loop system, provided that the semantics of business actions remain consistent across modules and all events are recorded under the same clock reference. When integrating messages from the distribution, supply, and payment ends, message middleware is often used to sort them by delivery time and aggregate all change records using the order number as the association key, forming a global event sequence.

[0004] However, this existing approach has technical flaws when dealing with cross-timezone business travel orders. Different business systems describe the same business action in a synonymous yet heterogeneous manner, each using its own local timezone to mark time. This results in semantic inconsistencies in the global event sequence and makes it difficult to establish a precise temporal order due to a lack of reliable metrics. When dependent distributed events arrive out of order due to clock skew or network latency, sorting solely by delivery time will disrupt the causal order, leading to discrepancies between the replayed order status and the actual internal view of any system at a specific historical moment. Consequently, the final backtracking results cannot be effectively verified. Summary of the Invention

[0005] To address the aforementioned issues, this invention provides a backtracking method and system for cross-timezone business travel order state machines. It employs multi-source event semantic normalization and time reliability calculation to reconstruct causal sequences and drive the state machine to generate customizable state paths, enabling the output of verifiable cross-timezone order state backtracking results.

[0006] The above objectives can be achieved through the following approach:

[0007] A backtracking method for a cross-timezone business travel order state machine includes acquiring order change message streams from the distribution end, supply end, and payment end, parsing the event source identifier and event payload in the message stream, and generating an order event set;

[0008] The event semantic elements are generated by merging synonymous actions, normalizing objects, and extracting dependent object identifiers for each event in the order event set.

[0009] Time features are extracted from the set of order events, and time reliability is calculated to generate event time elements;

[0010] Perform event cleaning and merging on the event semantic elements and event time elements corresponding to the same event to generate a usable event set;

[0011] Based on the available event set, causal reasoning and dependency graph analysis are performed to generate a causal sequence event set;

[0012] Obtain a preset order state machine, input the causal sequence event set into the order state machine in sequence, and generate a state path containing forward transition and reverse rollback segments;

[0013] The target time is obtained and uniformly transformed, and the state path is time-positioned to obtain the trimmed state path and the final state snapshot.

[0014] Based on the causal sequence events, the pruned state path, and the final state snapshot, a verifiable backtracking result is generated.

[0015] Based on the same inventive concept, the present invention also provides a backtracking system for a cross-time zone business travel order state machine, the system comprising:

[0016] The event acquisition module is used to acquire order change message streams from the distribution end, supply end, and payment end, parse the event source identifier and event payload in the message stream, and generate a set of order events.

[0017] The semantic extraction module is used to perform synonymous action merging, object normalization, and dependency object identification extraction on each event in the order event set to generate event semantic elements;

[0018] The time calculation module is used to extract time features from the order event set, calculate time reliability, and generate event time elements;

[0019] The event filtering module is used to clean and merge the event semantic elements and event time elements corresponding to the same event to generate a set of usable events;

[0020] The causal sequence generation module is used to perform causal reasoning and dependency graph analysis based on the available event set to generate a causal sequence event set;

[0021] The state transition execution module is used to obtain a preset order state machine, input the causal sequence event set into the order state machine in sequence, and generate a state path containing forward transition and reverse rollback segments;

[0022] The backtracking positioning module is used to acquire the target time and perform unified conversion, and to perform time positioning on the state path to obtain the trimmed state path and the final state snapshot.

[0023] A verifiable output module is used to generate verifiable backtracking results based on the causal sequence event set, the pruned state path, and the final state snapshot.

[0024] Compared with the prior art, the present invention has the following advantages:

[0025] This invention unifies the differentiated expressions in heterogeneous business systems into standard semantic elements by merging synonymous actions and standardizing objects, eliminating the semantic ambiguity of multi-source order events and laying a reliable semantic foundation for cross-system state backtracking.

[0026] This invention utilizes a global time zone database to perform Coordinated Universal Time (UTC) conversion on multi-source timestamps and quantifies time reliability based on a segmented decay function. Combined with dependency graph analysis and conflict resolution to correct event timelines, it achieves accurate reconstruction of causal sequences in cross-time zone environments.

[0027] This invention uses a causal sequence to drive the order state machine to execute a complete state transition including forward transition and reverse rollback, and trims and locates the state path according to the target time to obtain a final state snapshot reflecting the business situation at any historical moment.

[0028] This invention extracts the dependency satisfaction and time consistency of key event nodes and generates hash digests, binding the backtracking process and the final snapshot into a verifiable result, providing an objective verification basis for the backtracking of cross-time zone business travel orders. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a schematic diagram of a backtracking method for a cross-time zone business travel order state machine according to an embodiment of the present invention.

[0031] Figure 2 This is a schematic diagram of the piecewise attenuation function curve according to an embodiment of the present invention.

[0032] Figure 3 This is a schematic diagram of the structure of a backtracking system for a cross-time zone business travel order state machine according to an embodiment of the present invention. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0034] Reference Figure 1 One embodiment of the present invention proposes a backtracking method for cross-time zone business travel order state machines. It uses multi-source event semantic normalization and time credibility calculation to reconstruct causal sequences and drive the state machine to generate customizable state paths, which can output verifiable cross-time zone order state backtracking results.

[0035] The method described in this embodiment specifically includes:

[0036] S1. Obtain the order change message streams from the distribution end, supply end, and payment end; parse the event source identifiers and event payloads in the message streams; and generate a set of order events.

[0037] Specifically, the system acquires order change message streams originating from the distribution, supply, and payment ends through an asynchronous message queue listener. The distribution end refers to the business systems that distribute and sell goods; the supply end refers to the upstream supplier business systems that provide goods or services; and the payment end refers to the financial business systems that handle fund transfers and settlements. The order change message stream is a continuous sequence of messages pushed to the message middleware in real time by these three business systems when the order status changes. The system parses the message body of each message in the message stream and extracts a fixed field embedded in the message metadata header, called the event source identifier. The event source identifier is a globally unique string used to identify the source business system instance that generated the message and its corresponding business line. Its encoding rule adopts the format "business line code-system instance number-geographic region number," for example, "DIST-01-NC" represents the distribution system instance with the North China region number 01. Simultaneously, the system parses the business data blocks carried in the message body; these blocks are called the event payload. Event payloads typically use structured formats such as JSON or Protocol Buffers, containing key-value pairs including order number, operation type, operation time, changed fields, and specific values ​​before and after the change. The system pairs the extracted event source identifier with the corresponding event payload to form a structure, called an order event. The collection of all order events is called the order event set, formally represented as: ,in Representing the One order event, This represents the total number of events. Each order has multiple events. Internally contains event source identifiers and event payload , can be written as .

[0038] For example, in a certain automated test run, the business interaction of an order from creation to payment completion on the distribution side was simulated. The system first receives a message from the distribution side. The message metadata header carries the event source identifier "DIST-03-SC", and the event payload in the message body includes the order number "ORD-8823", operation type "CREATE", operation time "2024-12-01T10:00:00.000+08:00", and order details. After parsing the message, the system generates the first order event, denoted as... Subsequently, the system received another message from the payment terminal, with the event source identified as "PAY-05-SC". The event payload contained data such as the order number "ORD-8823", operation type "PAYMENT_SUCCESS", operation time "2024-12-01T10:05:00.000+08:00", and payment transaction number "TXN-9981". After parsing, the system generated a second order event. Both messages contain the order number "ORD-8823" in their event payloads, ensuring consistency of the business objects. After the above parsing and pairing, the final generated order event set is represented as: E={⟨DIST-03-SC,{orderId:ORD-8823,action:CREATE,…}>,⟨PAY-05-SC,{orderId:ORD-8823,action:PAYMENT_SUCCESS,...}>}. The form of each element within the set conforms to the expected settings, the event source identifier accurately reflects the source of the message, and the event payload fully carries the details of the business change.

[0039] S2. Perform synonymous action merging, object normalization, and dependency object identification extraction on each event in the order event set to generate event semantic elements;

[0040] In one embodiment of the present invention, step S2 includes the following steps:

[0041] Receive the set of order events, and parse out the action field describing the business operation and the object field describing the operation target from each event payload;

[0042] Using a pre-configured synonym mapping table, action fields with the same meaning but different expressions are merged into a unified standardized action name, and object fields with the same meaning but different identifiers are normalized into a unified global object identifier;

[0043] Based on the operation type to which the standardized business action belongs, add a positive change mark for resource creation actions, add a negative change mark for resource release or cancellation actions, and extract the objects representing business preconditions from the standardized object identifiers as dependency object identifiers.

[0044] The standardized business actions, the positive change markers or the negative change markers, and the dependent object identifiers are combined to generate event semantic elements.

[0045] Specifically, the system receives a set of order events. Each order event Identified by the event source and event payload Composition, that is For each event load The system parses the internal fields of a message body based on a predefined payload pattern dictionary. The payload pattern dictionary is a configuration file describing the key-value structure of the message body, recording the positions of field names representing operational intentions and field names representing operational objects in messages from different business lines. Action fields are key-value pairs in the payload that record the name of the business operation instruction; for example, in a distribution-end message, the value "placeOrder" corresponding to the key "opType" is an action field. Object fields are key-value pairs in the payload that record the unique identifier of the target entity; for example, in a payment-end message, the value "INV-7742" corresponding to the key "targetId" is an object field.

[0046] After parsing the action and object fields, the system loads a pre-configured thesaurus map. The thesaurus is a hash table structure stored in system memory. The key column contains action words with the same meaning but different spellings or naming conventions across different business systems, such as "placeOrder". Both "orderCreate" and "orderCreate" are mapped to the standardized action name of the value column. Similarly, the key column also includes possible values ​​for object fields with different identifiers but pointing to the same business entity, such as "INV-7742" and "". All values ​​are mapped to the unified global object identifier "INV-7742" in the value column. The system uses the parsed action field value as the key to search the synonym mapping table. If a match is found, it is replaced with the standardized action name in the value column. If no match is found, the original value is retained and a non-match log entry is recorded. The system also uses the parsed object field value as the key to search the synonym mapping table. If a match is found, it is replaced with the global object identifier in the value column. If no match is found, the original value is retained and another non-match log entry is recorded.

[0047] The system categorizes standardized action names based on the corresponding operation types. The categorization rule table predefines the correspondence between standardized action names and operation types, for example, " "", Actions such as "..." belong to resource creation operations. "", Actions such as "" belong to the category of resource release or cancellation operations. For resource creation actions, the system adds a positive change flag with a value of the constant "+1"; for resource release or cancellation actions, the system adds a negative change flag with a value of the constant "-1". The positive change flag indicates the incremental impact of the event on the quantity or status of business resources, while the negative change flag indicates the decremental impact of the event on the quantity or status of business resources.

[0048] The system identifies and extracts dependent object identifiers from the normalized global object identifiers. A dependent object identifier is a globally unique identifier for a business object that must already exist and be in a specific state before the event can be executed. The system maintains a dependency rule table, which records the types of preceding objects that each standardized action name depends on during execution and their positions in the object field. For example, for action "..." "If the system depends on an order object with a status of 'confirmed' and a payment account object with a status of 'available,' the portion of the global object identifier corresponding to the order will be extracted as the dependency object identifier. The extraction process involves splitting the string of the global object identifier into multiple sub-identifiers by delimiters, and then filtering out the sub-identifiers that meet the subordinate preconditions according to the dependency rule table."

[0049] The system encapsulates the standardized action name, positive or negative change marker, and dependent object identifier into a triple structure, which is called the event semantic element. Formally, for an event... Its event semantic elements are denoted as ,in These are standardized action names. It is a change marker, and its value is taken from a set. , It is a dependency object identifier, which is a string or a list of strings.

[0050] S3. Extract time features from the order event set, calculate time reliability, and generate event time elements;

[0051] In one embodiment of the present invention, step S3 includes the following steps:

[0052] Obtain the local occurrence timestamp of each event record in the order event set, the arrival timestamp recorded by the gateway server receiving the order change message stream, and the local time zone identifier configured by the source system;

[0053] Using a global time zone database, the Coordinated Universal Time (UTC) time corresponding to the local occurrence timestamp is calculated based on the local time zone identifier, and used as a unified time identifier;

[0054] Calculate the second-level offset between the unified time identifier and the corresponding Coordinated Universal Time standard time to obtain the standard time offset;

[0055] Calculate the absolute time difference between the arrival timestamp and the local occurrence timestamp, input the absolute time difference into a preset piecewise decay function containing multiple confidence intervals, and calculate the output time reliability.

[0056] The unified time identifier, the standard time offset, and the time reliability are combined to generate event time elements.

[0057] Specifically, the system retrieves the order event set. Each event The associated raw time data. There are three specific sources: the first is the local timestamp. The first item is the Unix timestamp recorded in the event payload by the business system that generated the event according to its own clock, in milliseconds; the second item is the arrival timestamp. The first item is the Unix timestamp recorded by the gateway server receiving the order change message stream at the moment the message arrives, in milliseconds; the second item is the local timezone identifier. The IANA timezone database format string declared in the configuration file by the source system, such as "Asia / Shanghai".

[0058] The system uses a global timezone database as the conversion benchmark, which employs a publicly maintained timezone rule dataset. The system will then convert locally occurring timestamps. Subtract its Unix epoch start offset to obtain the original time, then combine it with the local timezone identifier. Find the corresponding UTC offset in the database at that time. The unit is seconds, and Coordinated Universal Time (UTC) is used as a unified time identifier. The calculation formula is:

[0059] ,

[0060] In the formula, The unified time identifier, expressed in seconds, is the number of seconds that have elapsed since the Unix epoch, January 1, 1970, 00:00:00 UTC. Convert the data to milliseconds by dividing by 1000 to obtain seconds to maintain consistency of units. It is the number of seconds that the local time zone is offset from UTC at this moment, with positive values ​​for the Eastern Hemisphere.

[0061] The system calculates the standard time offset. The standard time offset is defined as a uniform time identifier. The offset in seconds from the corresponding Coordinated Universal Time (UTC) standard time. UTC standard time refers to the integer second increments on a continuous timeline after adjusting for leap seconds, etc. Here, the system uses... The integer seconds after rounding The absolute value of the difference is used as the offset, but considering the actual time synchronization accuracy of the system, a more stable quantization deviation measurement method is adopted: obtaining the reference time of the minute window where the event is located. Calculate the offset:

[0062] ,

[0063] In the formula The unit is seconds, and the value range is... Within the interval, the system calculates the absolute time difference between the arrival timestamp and the local occurrence timestamp. :

[0064] ,

[0065] In the formula The unit is seconds. The numerator is taken as its absolute value to ensure non-negativity. Dividing by 1000 is to convert milliseconds to seconds. The system will use this time difference. The input is fed into a preset piecewise decay function containing multiple confidence intervals, and the output time reliability is calculated. The piecewise attenuation function is constructed based on network transmission and message queuing experience. Based on statistical fitting of 200 sets of measured latency samples across data center message links, the interval thresholds and attenuation parameters were determined. For example... Figure 2 As shown, the function is defined as follows:

[0066] ,

[0067] In the formula Dimensionless, with values ​​ranging from Between 0.5 and 1.0. When the time difference is less than 0.5 seconds, it belongs to the sub-second synchronization scenario, with a maximum reliability of 1.0. As the time difference increases, the reliability decreases linearly in segments. When the time difference reaches or exceeds 10.0 seconds, it adopts an exponential decay form, corresponding to the high-latency unreliable scenario, with the reliability approaching 0.

[0068] The system combines a unified time identifier, a standard time offset, and time reliability into event time elements. Formally, for events... The time element of the event is denoted as .

[0069] S4. Perform event cleaning and merging on the event semantic elements and event time elements corresponding to the same event to generate a usable event set;

[0070] In one embodiment of the present invention, step S4 includes the following steps:

[0071] Obtain the semantic elements and time elements associated with each event, and use the combination key composed of the event source identifier and the locally generated sequence number of the event as the unique key of the event to perform association matching to obtain the matching event stream;

[0072] By comparing the unique key of the event in the matching event stream, duplicate event records with the same key value are deduplicated;

[0073] Traverse the deduplicated matching event stream and idempotently merge event records that are continuously generated by the same business object within a preset time window, where the positive and negative markers cancel each other out.

[0074] Extract the field completeness score and time credibility of each merged event, filter out events whose field completeness score is lower than a preset completeness threshold or whose time credibility is lower than a preset credibility threshold, and output the usable event set.

[0075] Specifically, the system has received each event. event semantic elements and event time elements To link the two, the system uses event source identifiers. Locally generated sequence number of the event The combined key serves as the unique key for the event. The local event generation number is a strictly incrementing long integer appended to the event payload by the source system when the event is generated, ensuring the chronological order of events within the same source. The system concatenates the event source identifier and the local event generation number into a string. This serves as the unique key for the event. Through equality matching of the event's unique key, [the event is then...]. and They are associated with the same event record, forming a matching event stream.

[0076] The matching event stream may contain duplicate event records due to message retransmission. The system creates a hash table indexed by the event's unique key, traverses the matching event stream, and if the event's unique key already exists in the hash table, it indicates a duplicate event record, and the system discards the record; otherwise, the event's unique key is inserted into the hash table, and the event is retained. This process removes all duplicate event records with the same key value.

[0077] In the deduplicated matching event stream, the same business object may generate pairs of positive and negative marker events due to repeated user operations within a preset time window, such as continuously executing resource locking and immediate unlocking. The system uses a pre-configured time window length. The unit is seconds. Based on the distribution of the operation intervals of these 200 sets of measured data, the following settings are made: Seconds. The system iterates through the deduplicated event stream, using the global object identifier as the aggregation key, and assigns events that occurred in seconds. Within the window, for the same business object and with the change flag A pair of events that are opposites of each other is identified, and the net change effect of this pair is calculated. If the net change effect is zero, the pair of events is removed from the stream; this process is called idempotent merging. Idempotent merging ensures that consecutive invalid operations do not pollute subsequent state machine deductions.

[0078] After idempotent merging, the system extracts a field completeness score for each remaining event. and time credibility The field completeness score is a quantitative metric for evaluating the completeness of key business fields in the event payload. The system predefines a set of key fields that must exist for each event under a specific action, and approximately 35 key field items are identified based on order business data specifications. For events... The system counts the number of predefined key fields that are actually contained and have non-empty values. The total number of predefined key fields corresponding to this action The ratio is the field completeness score:

[0079]

[0080] In the formula Dimensionless, range of values Total number of predefined key fields According to the standardized action name Retrieved from the business metadata management module.

[0081] The system has a preset completeness threshold. and credibility threshold These two thresholds are set based on the acceptable lower limit of historical order processing quality assessment. The system checks each event one by one, if... or If the condition is met, then the event will be filtered out; only events that simultaneously satisfy the condition will be retained. and The events that are ultimately retained constitute the set of available events, denoted as . The output is then passed to the subsequent step S4.

[0082] For example, the order event set contains two events. and System Analysis The payload yields the action field "CREATE" and the object field "ORD-8823". After passing through a synonym mapping table, the action field "CREATE" is normalized to the standardized action name "ORDER_CREATE", and the object field "ORD-8823" is normalized to the global object identifier "ORD-8823". Since "ORDER_CREATE" belongs to a resource creation operation, a positive change flag is added. The dependency rule table shows that the creation action has no prerequisite dependencies, and the dependency object identifier is... Empty. Generate event semantic elements. Similarly, analysis The action "PAYMENT_SUCCESS" and object "ORD-8823" are obtained, corresponding to the standardized action name "PAYMENT_CONFIRM". The reverse change flag is not applicable here. "PAYMENT_CONFIRM" actually belongs to a neutral operation of resource transfer. The system uniformly assigns a positive change flag to neutral operations in the classification rule table, but additionally identifies it when handling dependencies. Here, the positive change flag is bound according to the classification rule "PAYMENT_CONFIRM". The dependency rule table indicates that the action depends on the object "ORD-8823". Extract the dependency object identifier. .generate .

[0083] The local timestamp is Milliseconds, corresponding to 10:00:00.000 Beijing time on December 1, 2024, time zone identifier. Arrival timestamp Milliseconds. Calculate the unified time stamp: consult the global time zone database. Second, Seconds. Standard time offset calculation: , Seconds. Absolute time difference. Seconds. Piecewise decay function input. If it falls into the first interval, output Obtain the event time element. .right Perform the same process, assuming you get .

[0084] The event source identifier "DIST-03-SC" is combined with the local event generation sequence number "1001". The event unique key is "DIST-03-SC_1001". The corresponding event has a unique key "PAY-05-SC_2056". After association and matching, a matching event stream is formed; duplicate keys are skipped. Preset time window. If no positive or negative canceling event pairs appear within a second, idempotent merging is skipped. Field completeness score calculation: Total number of key fields The actual number of non-empty cells filled ,have to ; Total number of key fields Actual filling ,have to Both scores are no lower than the threshold of 0.9, and the time reliability scores of 1.0 and 0.95 are both no lower than the threshold of 0.7. All events are retained. The final output is a usable event set. It includes the complete structure of the two events mentioned above and additional semantic temporal elements.

[0085] S5. Based on the available event set, perform causal reasoning and dependency graph analysis to generate a causal sequence event set;

[0086] In one embodiment of the present invention, step S5 includes the following steps:

[0087] Extract the dependency object identifier carried by each event in the available event set, and construct a directed dependency graph with events as nodes and dependency relationships as edges;

[0088] Detect dependency cycles in the directed dependency graph and locate conflict segments that form conflicts;

[0089] Extract the time credibility corresponding to each event in the conflict segment, sort them from largest to smallest, select the timestamp of the event corresponding to the first time credibility in the sort as the benchmark, perform position correction on the events in the conflict segment, and generate a causal sequence event set that simultaneously satisfies dependency constraints and global temporal partial order relationship.

[0090] Specifically, event sets can be used. Each event All carry event semantic elements and event time elements ,in These are standardized action names. It is a change marker. It depends on the object identifier. It is a unified time identifier. It is the standard time offset. This involves the credibility of the timeline. These elements collectively form the basis for subsequent causal analysis and state backtracking.

[0091] The system extracts the available event set. Each event Dependency object identifier carried The dependency object identifier is a globally unique identifier for a business object that must already exist before the event is executed. If the event has no prerequisite dependencies, then... Empty. The system constructs a directed dependency graph. , where the node set Each node in Corresponding to an event Directed edge set The definition rule is: if the event Dependency object identifier With the event The global object identifier matches, i.e., the event. The object created or ultimately manipulated is the event. For the objects that depend on, add a line from point to A directed edge represents an event. Must be in the event This occurs subsequently. The global object identifier is taken from the normalized object field during event semantic element parsing, during the construction... The time is already retained in the event log as an additional attribute, and is marked here as Directed edge The logical premise is .

[0092] Subsequently, the system runs a cycle detection algorithm based on depth-first search to traverse the directed dependency graph. When a directed cycle is detected, i.e., a series of events forming a circular dependency, the original event sequence corresponding to all nodes on the cycle is marked as a conflict segment. A conflict segment is a subset of events with inconsistent causality; without correction, the global execution order cannot be determined. The system extracts the temporal reliability of all events within the conflict segment. Sort these time confidence scores from highest to lowest, and select the event with the highest time confidence score as the baseline event. Let this event be denoted as _____. Its unified time identifier is .

[0093] To resolve conflicts, the system performs positional correction on events within the conflict segment. Positional correction refers to re-determining the order of events on the timeline according to their dependency topology, ensuring that both dependency constraints and global temporal partial order are satisfied. The specific method is as follows: using a baseline event... As the anchor point, its unified time identifier is retained unchanged; within the conflict segment, other events are topologically sorted according to the order specified by the directed dependency edges. Let the sorted events be as follows: ,in For each event Calculate the corrected unified time stamp :

[0094]

[0095] In the formula, It is the preset minimum sequence interval constant, in seconds. The setting is based on the actual delay distribution of 200 cross-system message links, with 0.1 seconds taken as the lower limit for effective distinction between causal events. This formula ensures that the timestamp of the preceding event is strictly less than that of the subsequent event, and the unit is unified to seconds. If an event in the conflict segment originally carries external constraints of the dependency edge, its correction value also needs to be compared with the timestamp of the external reference event, retaining the larger value to ensure global partial order.

[0096] After the correction is complete, the system sorts all events, regardless of whether they have undergone conflict correction, according to their final unified time identifier in ascending order, forming a globally causally ordered sequence of events, called the causal sequence event set, denoted as . Each event in the causal sequence event set carries both the original semantic elements and the updated temporal elements.

[0097] S6. Obtain a preset order state machine, input the causal sequence event set into the order state machine in sequence, and generate a state path containing forward transition and reverse rollback segments;

[0098] In one embodiment of the present invention, step S6 includes the following steps:

[0099] Obtain a pre-built order state transition model as the order state machine;

[0100] The causal sequence event set is input sequentially into the order state machine to execute state transition;

[0101] Record the triggering conditions, input event identifiers, and output state snapshots corresponding to each transition step, and generate a state path containing forward transition and reverse rollback segments.

[0102] Specifically, the system loads a pre-built order state transition model, called the order state machine, from the persistent configuration repository. The order state machine uses a finite state machine definition, encompassing all possible states in the order lifecycle, such as "Initial State," "Created," "Confirmed," "Paid," "Shipped," "Completed," "Cancelled," "Refunding in Progress," and "Refunded," as well as the event types and transition conditions that drive state changes. Each transition is formalized as follows: It also includes a precondition guard to ensure that a transfer can only occur if the current attributes of the order meet specific conditions.

[0103] The system will use a causal sequence event set Input the order state machine sequentially, one by one. The initial state is set to "Initial State," and an initial state snapshot is generated. The state snapshot is a complete record of all attributes and their values ​​of the order at a specific moment, represented as a set of key-value pairs. For each event in the sequence... The system extracts its standardized action names. As an event type, the system searches for a transition that meets the conditions, based on the current state of the order state machine. If the transition is successful, the order state machine enters a new state, and the system immediately generates a new state snapshot. The system records the tuple for each transition, including the triggering condition (current state and event type), the input event identifier (globally unique event number), and the output state snapshot. If an event attempts to trigger a transition but the precondition guard is not met, such as attempting to pay for a canceled order, the state machine may execute a reverse rollback segment—the system generates a path back to a previous valid state according to preset compensation rules and records the corresponding state snapshot. The entire record, from the initial state through a series of forward transitions and possible reverse rollback segments, is called a state path. In terms of data structure, the state path is represented as an ordered list of state snapshots progressing in time, with each node accompanied by a corresponding event identifier and a unified time identifier.

[0104] S7. Obtain the target time and perform a unified conversion, and perform time positioning on the state path to obtain the trimmed state path and the final state snapshot.

[0105] In one embodiment of the present invention, step S7 includes the following steps:

[0106] Obtain the target time for backtracking query, and convert the target time into the unified time identifier;

[0107] Locate event nodes on the state path whose timestamps are less than or equal to the target time after the transformation, and extract the path segment from the initial state to the state snapshot corresponding to the last matching event node to obtain the trimmed state path.

[0108] The final state snapshot is determined as the end state snapshot of the pruning state path.

[0109] Specifically, the system obtains the target time for backtracking queries through an external query interface. The target time is typically a date and time string with business semantics, such as the time point from a reconciliation request. The system parses the target time to obtain its corresponding Unix millisecond timestamp. and source time zone identifier Using the same global time zone database and conversion method as in step S3, the target time is converted into a unified time identifier. The conversion formula is:

[0110] ,

[0111] In the formula, It is the local Unix millisecond timestamp of the target time. It corresponds to the UTC offset in seconds at that moment.

[0112] After obtaining the unified time identifier of the target time, the system iterates through the unified time identifiers corresponding to each event node on the state path. The event nodes on the state path are the causal sequence events of the input order state machine, and their unified time identifiers have been finalized in step S5. The system locates all events that satisfy the condition. The system selects the last matching node (those with the largest timestamp) from the event nodes. The system extracts a path segment from the initial state snapshot to the state snapshot corresponding to the last matching event node; this segment is called the trimmed state path. The trimmed state path fully preserves the linear history of all valid state snapshots from the start of the business process to the target time.

[0113] The system determines the final state snapshot as the snapshot of the end state of the trimmed state path. The final state snapshot represents the business state that the order system should present in terms of causality at a specified target time.

[0114] For example, the available event set contains two events: The event semantic elements are Unified time identifier in time elements Seconds, time reliability The global object identifier is "ORD-8823"; The event semantic elements are Unified time identifier Seconds, time reliability The global object identifier is "ORD-8823". In step S5, the system extracts the dependency object identifier: No dependency The dependency object identifier is "ORD-8823", which is... Global object identifier matching. Construct a directed dependency graph, nodes. point to Acyclic, requiring no conflict correction. Causal sequence event set. Its unified time identifier remains unchanged.

[0115] The order state machine starts in the "initial state". Input The standardized action name "ORDER_CREATE" triggers a transition to the "Created" state and generates a state snapshot. Record timestamps .enter The "PAYMENT_CONFIRM" event triggers a transition to the "Paid" status and generates a status snapshot. timestamp The entire state path is... No reverse rollback segment.

[0116] The target time is set to "2024-12-01T10:04:00.000+08:00". After decomposition, the local millisecond timestamp is obtained. Time zone identifier Query the global time zone database to get the UTC offset. Seconds. Calculate the uniform time stamp:

[0117] ,

[0118] On the state path, ,and The last matched event node is The clipping state path is taken from the initial state to... Corresponding state snapshot Until then, that is The final state snapshot is a "Created" state snapshot. The content reflects that order "ORD-8823" was only created at the target time, but payment has not yet been completed. The entire process verifies the accuracy of causal sequence, state path pruning, and target time location.

[0119] S8. Based on the causal sequence events, the pruned state path, and the final state snapshot, generate a verifiable backtracking result.

[0120] In one embodiment of the present invention, step S8 includes the following steps:

[0121] Extract the key event nodes that trigger state changes from the causal sequence event set;

[0122] Obtain the state snapshots corresponding to the key event nodes from the clipped state path to obtain a state snapshot sequence;

[0123] For each critical event node, check the existence of the uniquely identified dependent object in the state snapshot sequence and whether the state value meets the preset expected constraints, and generate a Boolean dependency satisfaction flag.

[0124] For each of the key event nodes, the overlap between the time window into which the unified time identifier falls and the time window of the associated state snapshot change is calculated, and a time consistency score is generated.

[0125] The identifiers of the key event nodes, the dependency satisfaction markers, and the time consistency scores are hashed to generate a fixed-length backtracking digest.

[0126] The backtracking summary is bound to the final state snapshot and output as a verifiable backtracking result.

[0127] Specifically, the system already holds a set of events from a causal sequence. The process involves pruning the state path and creating the final state snapshot. The causal sequence event set is a sequence of events arranged in a partially global temporal order after dependency resolution. The pruned state path is an ordered list of state snapshots from the start of the order lifecycle to a specified target time. The final state snapshot is the complete attribute record of the order at the end of this path. The purpose of this step is to transform these intermediate results into immutable backtracking results that can be verified by a third party.

[0128] The system first traverses the causal sequence event set. Extract the key event nodes that trigger state changes. Key event nodes are defined as events that successfully match transition conditions and cause a state transition during the execution of the order state machine. Denote the causal sequence event set. For each event If the transition step corresponding to the state path is marked as a valid transition, it is included in the set of critical event nodes. Each key event node Carry the event unique key as the node identifier Standardized action name, dependency object identifier Unified time identifier and time credibility .

[0129] The system retrieves a state snapshot corresponding to each key event node from the pruned state path. The pruned state path is formally a series of tuples arranged in ascending order of timestamps. Each tuple contains the input event identifier, the generated state snapshot, and the state entry time. The system uses node identifiers. Query the clipping state path; if a match is found, retrieve the corresponding state snapshot and record it as... If the target time is missed, it means that the critical event occurred later than the target time and was not included in the pruning path. Set to null. The final result is the same as... A sequence of state snapshots in a consistent order.

[0130] The system provides each key event node Generate boolean dependency satisfaction tags If node Dependency object identifier If empty, then set directly. .like If not empty, the system extracts the precondition expectation constraint corresponding to the standardized action name from the business rule base. This constraint specifies the set of legal states that the dependent object must be in before the event is executed, denoted as... For example, the set of allowed states for the action "PAYMENT_CONFIRM" is... The system checks the final rendered state of the dependent object in the state snapshot sequence: searching backwards in the state snapshot sequence for the first containing object. A state snapshot, representing the latest effective state of the object at the target time; if no available state snapshot sequence contains... If a snapshot is taken, then the final state snapshot is used as the reference snapshot. Record the objects in this reference snapshot. The state value is ,if ,but ,otherwise .

[0131] Afterwards, the system assigns each key event node... Calculate time consistency score The time consistency score reflects the degree to which the timing of the event matches the rhythm of state path changes. The system first serves as a node... Constructing a time window with a unified time identifier Utilizing time credibility Calculation of time uncertainty radius The formula is:

[0132] ,

[0133] In the formula It is the preset maximum time offset tolerance limit, set to 10.0 seconds. This value is determined based on the statistical analysis of 99th percentile delay and clock deviation in 200 cross-system message links. The unit is seconds. Dimensionless. The time window for a unified time identifier is defined as follows:

[0134] ,

[0135] Next, determine the associated status snapshot change time window. This window is a status snapshot. The valid time period for the change of the represented state. If If not empty, the system locates the timestamp of the preceding state snapshot immediately preceding this state snapshot on the state path. If the event is the first transition on the state path, then Set to 0. The change window selects intervals that are closed on both the left and right sides:

[0136] ,

[0137] like If the value is empty and the event has not entered the state path, the change window is considered non-existent. Time Consistency Score Defined as the ratio of the intersection length of two time windows to the length of the unified time identifier window:

[0138] ,

[0139] Both the intersection length and window length are expressed in seconds, and the score is... Dimensionless, with a range of values ​​of .when When the unified time identifier degenerates into a single time point, if that time point is within the change window, the consistency score is 1.0. The formula has handled this separately.

[0140] The system obtains the node identifier for each key event node. Dependency satisfaction marker Consistency score with time Next, these three elements are hashed. The hashing uses the cryptographic hash function SHA-256, which converts the node identifier string, the boolean value to a "1" or "0" character, and the score formatted as a string with four decimal places. These are then concatenated using vertical bars as delimiters to form the original message. :

[0141] ,

[0142] Compute a fixed-length backtracking summary The system outputs a 256-bit (32-byte) binary digest. It binds the backtracking digests of all key event nodes with the final state snapshot into a single structure, which serves as a verifiable backtracking result. This structure can be serialized as a JSON object, containing a "Digest List" field listing the identifier of each key event node and its corresponding backtracking digest, and a "Final State Snapshot" field whose values ​​are the key-value set of the final state snapshot. Third parties holding the same SHA-256 hash algorithm and business rule library can recalculate the digest and verify the completeness and correctness of the backtracking conclusions.

[0143] For example, a causal sequence event set contains two events. (ORDER_CREATE) and Both (PAYMENT_CONFIRM) successfully triggered state changes and were extracted as key event nodes. correspond logo Dependency object identifier Empty, unified time identifier Seconds, time reliability .node correspond logo Dependency object identifier , Second, The pruning state path is a snapshot from the initial state to the "created" state. The final state snapshot is .

[0144] right The cropping path contains the snapshots it triggers. The dependency object identifier is empty. Consistency in computation time: Second, The change window is set to the first transfer. , .because And the window exists, so you can get it directly. Original message Hashed Summary .

[0145] right No corresponding state snapshot is found in the clipping path. Empty. Dependency satisfaction verification: The valid state required for the action PAYMENT_CONFIRM is Check the final state snapshot The object ORD-8823 has a status of "created" and meets the constraints. Time consistency: Second, .because Empty, the change window does not exist. Original message Hashed Summary The verifiable backtracking output includes a list of summaries. With final state snapshot This result proves that at the target time, the order creation event has occurred and the payment event has not yet entered the state machine, and its prerequisites have been satisfied in the snapshot. The temporal consistency of the payment event is marked as zero because it is outside the scope of the pruning.

[0146] Based on the same inventive concept, such as Figure 3 As shown, the present invention also provides a backtracking system for a cross-timezone business travel order state machine, the system comprising:

[0147] The event acquisition module is used to acquire order change message streams from the distribution end, supply end, and payment end, parse the event source identifier and event payload in the message stream, and generate a set of order events.

[0148] The semantic extraction module is used to perform synonymous action merging, object normalization, and dependency object identification extraction on each event in the order event set to generate event semantic elements;

[0149] The time calculation module is used to extract time features from the order event set, calculate time reliability, and generate event time elements;

[0150] The event filtering module is used to clean and merge the event semantic elements and event time elements corresponding to the same event to generate a set of usable events;

[0151] The causal sequence generation module is used to perform causal reasoning and dependency graph analysis based on the available event set to generate a causal sequence event set;

[0152] The state transition execution module is used to obtain a preset order state machine, input the causal sequence event set into the order state machine in sequence, and generate a state path containing forward transition and reverse rollback segments;

[0153] The backtracking positioning module is used to acquire the target time and perform unified conversion, and to perform time positioning on the state path to obtain the trimmed state path and the final state snapshot.

[0154] A verifiable output module is used to generate verifiable backtracking results based on the causal sequence event set, the pruned state path, and the final state snapshot.

[0155] It should be noted that the electrical connections between the various units described above do not necessarily represent direct or indirect connections. Any indirect connection method can be applied to the embodiments of the present invention as long as it achieves the purpose of the present invention. The above descriptions are merely exemplary embodiments of the present invention and should not be construed as limiting the scope of the present invention.

[0156] All equivalent changes and modifications made in accordance with the teachings of this invention are still within the scope of this invention. Those skilled in the art will readily conceive of other embodiments of this invention upon considering the specification and the disclosure of practical truth. This application is intended to cover any variations, uses, or adaptations of this invention that follow the general principles of this invention and include common knowledge or conventional techniques in the art not described herein.

Claims

1. A backtracking method for a cross-timezone business travel order state machine, characterized in that, The method includes: Obtain order change message streams from the distribution, supply, and payment ends; parse the event source identifiers and event payloads in the message streams; and generate a set of order events. The event semantic elements are generated by merging synonymous actions, normalizing objects, and extracting dependent object identifiers for each event in the order event set. Time features are extracted from the set of order events, and time reliability is calculated to generate event time elements; Perform event cleaning and merging on the event semantic elements and event time elements corresponding to the same event to generate a usable event set; Based on the available event set, causal reasoning and dependency graph analysis are performed to generate a causal sequence event set; Obtain a preset order state machine, input the causal sequence event set into the order state machine in sequence, and generate a state path containing forward transition and reverse rollback segments; The target time is obtained and uniformly transformed, and the state path is time-positioned to obtain the trimmed state path and the final state snapshot. Based on the causal sequence event set, the pruned state path, and the final state snapshot, a verifiable backtracking result is generated.

2. The backtracking method for a cross-timezone business travel order state machine according to claim 1, characterized in that, The semantic elements of the generated event include: Receive the set of order events, and parse out the action field describing the business operation and the object field describing the operation target from each event payload; Using a pre-configured synonym mapping table, action fields with the same meaning but different expressions are merged into a unified standardized action name, and object fields with the same meaning but different identifiers are normalized into a unified global object identifier; Based on the operation type to which the standardized business action belongs, add a positive change mark for resource creation actions, add a negative change mark for resource release or cancellation actions, and extract the objects representing business preconditions from the standardized object identifiers as dependency object identifiers. The standardized business actions, the positive change markers or the negative change markers, and the dependent object identifiers are combined to generate event semantic elements.

3. The backtracking method for a cross-timezone business travel order state machine according to claim 2, characterized in that, The event time elements include: Obtain the local occurrence timestamp of each event record in the order event set, the arrival timestamp recorded by the gateway server receiving the order change message stream, and the local time zone identifier configured by the source system; Using a global time zone database, the Coordinated Universal Time (UTC) time corresponding to the local occurrence timestamp is calculated based on the local time zone identifier, and used as a unified time identifier; Calculate the second-level offset between the unified time identifier and the corresponding Coordinated Universal Time standard time to obtain the standard time offset; Calculate the absolute time difference between the arrival timestamp and the local occurrence timestamp, input the absolute time difference into a preset piecewise decay function containing multiple confidence intervals, and calculate the output time reliability. The unified time identifier, the standard time offset, and the time reliability are combined to generate event time elements.

4. The backtracking method for a cross-timezone business travel order state machine according to claim 3, characterized in that, The generated available event set includes: Obtain the semantic elements and time elements associated with each event, and use the combination key composed of the event source identifier and the locally generated sequence number of the event as the unique key of the event to perform association matching to obtain the matching event stream; By comparing the unique key of the event in the matching event stream, duplicate event records with the same key value are deduplicated; Traverse the deduplicated matching event stream and idempotently merge event records that are continuously generated by the same business object within a preset time window, where the positive and negative markers cancel each other out. Extract the field completeness score and time credibility of each merged event, filter out events whose field completeness score is lower than a preset completeness threshold or whose time credibility is lower than a preset credibility threshold, and output the usable event set.

5. The backtracking method for a cross-timezone business travel order state machine according to claim 4, characterized in that, The generated causal sequence event set includes: Extract the dependency object identifier carried by each event in the available event set, and construct a directed dependency graph with events as nodes and dependency relationships as edges; Detect dependency cycles in the directed dependency graph and locate conflict segments that form conflicts; Extract the time credibility corresponding to each event in the conflict segment, sort them from largest to smallest, select the timestamp of the event corresponding to the first time credibility in the sort as the benchmark, perform position correction on the events in the conflict segment, and generate a causal sequence event set that simultaneously satisfies dependency constraints and global temporal partial order relationship.

6. The backtracking method for a cross-timezone business travel order state machine according to claim 5, characterized in that, The step of obtaining a preset order state machine and sequentially inputting the causal sequence event set into the order state machine to generate a state path containing forward transitions and reverse rollback segments includes: Obtain a pre-built order state transition model as the order state machine; The causal sequence event set is input sequentially into the order state machine to execute state transition; Record the triggering conditions, input event identifiers, and output state snapshots corresponding to each transition step, and generate a state path containing forward transition and reverse rollback segments.

7. The backtracking method for a cross-timezone business travel order state machine according to claim 6, characterized in that, The process of acquiring the target time and performing a unified transformation, and then performing time positioning on the state path to obtain the trimmed state path and the final state snapshot includes: Obtain the target time for backtracking query, and convert the target time into the unified time identifier; Locate event nodes on the state path whose timestamps are less than or equal to the target time after the transformation, and extract the path segment from the initial state to the state snapshot corresponding to the last matching event node to obtain the trimmed state path. The final state snapshot is determined as the end state snapshot of the pruning state path.

8. The backtracking method for a cross-timezone business travel order state machine according to claim 7, characterized in that, The process of generating verifiable backtracking results based on the causal sequence event set, the pruned state path, and the final state snapshot includes: Extract the key event nodes that trigger state changes from the causal sequence event set; Obtain the state snapshots corresponding to the key event nodes from the clipped state path to obtain a state snapshot sequence; Based on the state snapshot sequence, the business dependency satisfaction and time window consistency of the key event nodes are encoded to generate a backtracking summary. The backtracking summary is bound to the final state snapshot and output as a verifiable backtracking result.

9. The backtracking method for a cross-timezone business travel order state machine according to claim 8, characterized in that, The process of encoding the business dependency satisfaction and time window consistency of the key event nodes based on the state snapshot sequence to generate a backtracking summary includes: For each critical event node, check the existence of the uniquely identified dependent object in the state snapshot sequence and whether the state value meets the preset expected constraints, and generate a Boolean dependency satisfaction flag. For each of the key event nodes, the overlap between the time window into which the unified time identifier falls and the time window of the associated state snapshot change is calculated, and a time consistency score is generated. The identifiers of the key event nodes, the dependency satisfaction markers, and the time consistency scores are hashed to generate a fixed-length backtracking digest.

10. A backtracking system for a cross-timezone business travel order state machine, characterized in that, The system includes: The event acquisition module is used to acquire order change message streams from the distribution end, supply end, and payment end, parse the event source identifier and event payload in the message stream, and generate a set of order events. The semantic extraction module is used to perform synonymous action merging, object normalization, and dependency object identification extraction on each event in the order event set to generate event semantic elements; The time calculation module is used to extract time features from the order event set, calculate time reliability, and generate event time elements; The event filtering module is used to clean and merge the event semantic elements and event time elements corresponding to the same event to generate a set of usable events; The causal sequence generation module is used to perform causal reasoning and dependency graph analysis based on the available event set to generate a causal sequence event set; The state transition execution module is used to obtain a preset order state machine, input the causal sequence event set into the order state machine in sequence, and generate a state path containing forward transition and reverse rollback segments; The backtracking positioning module is used to acquire the target time and perform unified conversion, and to perform time positioning on the state path to obtain the trimmed state path and the final state snapshot. A verifiable output module is used to generate verifiable backtracking results based on the causal sequence event set, the pruned state path, and the final state snapshot.