A Bill Processing Method and System Based on Price Comparison Model and Edge Computing
By using a price comparison model and edge computing, composite identifiers are generated and a one-way state advancement cache and a distributed state mirror table are constructed. This solves the problems of data loss and duplicate processing under network instability, achieves data synchronization and consistency, and improves processing real-time performance and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG YOUCAI CLOUD CHAIN TECH CO LTD
- Filing Date
- 2026-01-27
- Publication Date
- 2026-04-21
AI Technical Summary
Existing technologies struggle to ensure data consistency between the edge and the cloud in unstable network environments, leading to data loss, duplicate processing, and impacting user experience and system data reliability.
A method based on price comparison model and edge computing is adopted to generate composite identifiers, construct a one-way state advancement cache and a distributed state mirror table, optimize state mirror storage and price comparison triggering logic through spatiotemporal indexing, and generate approximate price comparison results by combining hidden Markov model and Laida criterion to ensure data synchronization and consistency.
In unstable network environments, this system ensures data synchronization and consistency, reduces invalid calculations and network transmission losses, improves real-time processing and security, provides reliable approximate price comparison results, and enhances user experience and system usability.
Smart Images

Figure CN121580451B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically, to a method and system for processing invoices based on a price comparison model and edge computing. Background Technology
[0002] In the process of invoice processing, existing systems mostly adopt an architecture that coordinates edge and cloud, involving the transmission of multiple levels of data streams, including raw invoice data, preprocessed data, and cloud-based price comparison results. It is necessary to maintain data synchronization and consistency among multiple nodes. However, in actual applications, network environments are often unstable, which can easily lead to data transmission anomalies. Specifically, after a user scans an invoice on an edge device, network jitter may cause the cloud to fail to record the request, resulting in the loss of historical price comparison records when querying on a different device. Or, due to the network retransmission mechanism, the same invoice may be processed repeatedly by the price comparison system, causing statistical data distortion and errors in recommendation logic.
[0003] The superficial shortcoming of this problem lies in the fact that current technology struggles to ensure data consistency between the edge and the cloud in unstable network scenarios, easily leading to data loss, duplicate processing, and other issues that affect user experience and system data reliability. A deeper analysis of the underlying technical issues reveals that existing systems rely on asynchronous request-response mechanisms and lack lightweight coordination solutions adapted to unreliable networks. The data streams between the edge and the cloud lack built-in conflict avoidance and state tracing capabilities, resulting in an irreconcilable contradiction between the need for low-latency processing and the guarantee of data consistency. Summary of the Invention
[0004] To address the problems existing in the prior art, the purpose of this invention is to provide a bill processing method and system based on a price comparison model and edge computing. This method can achieve data synchronization and consistency of bills under unreliable networks, avoid loss and duplicate processing, enable efficient edge computing, generate reliable approximate results when the network is disconnected, and improve the real-time performance, security and user experience of the processing.
[0005] To solve the above problems, the present invention adopts the following technical solution:
[0006] The first aspect is a bill processing method based on price comparison models and edge computing, including:
[0007] Step 1: Generate a composite identifier containing latitude, longitude, timestamp, and a summary of ticket feature points;
[0008] Step 2: Build a one-way state advance cache locally based on the composite identifier, bind the original ticket data with the composite identifier and mark it as pending;
[0009] Step 3: Encapsulate the pending status and composite identifier into a data packet, generate an integrity check code based on the composite identifier, and store the association pointer between the integrity check code and the data packet;
[0010] Step 4: Construct a distributed state mirror table using the physical coordinates and timestamps in the composite identifier, store state mirror records through a spatiotemporal index, and trigger price comparison processing when a state mirror record is in an idle state.
[0011] Step 5: Receive the price comparison results, use the composite identifier to perform check code matching verification in the local cache, and if the verification is successful, advance the status to completed; if the verification fails, keep the status pending.
[0012] Step 6: When the network unavailability duration exceeds a predetermined threshold, use the physical coordinates in the composite identifier to query historical price comparison records of the same merchant identifier, generate an approximate price comparison result through the inverse distance weighted interpolation algorithm, and mark it as the estimated state.
[0013] Furthermore, a composite identifier containing latitude, longitude, timestamp, and a summary of ticket feature points is generated, including:
[0014] Step 11: Perform drift compensation on the original GPS coordinates based on the geomagnetic field strength vector and inertial displacement data to generate enhanced spatial coordinates;
[0015] Step 12: Calculate the phase difference based on the local time starting point and the network time reference of the scan-triggered event, and apply a nonlinear transformation function to fuse the phase difference and the local time starting point to generate an anti-tampering time anchor point.
[0016] Step 13: Divide the bill image into a non-uniform grid, calculate the phase information of the local binary mode sequence within the grid, capture the phase transition points between adjacent grids and record their position and amplitude sequence, and generate a bill feature point summary.
[0017] Step 14: Using the note feature point digest as input data for hash operation, and using the temporary key derived from the enhanced spatial coordinates and the anti-tampering time anchor as the hash salt value, after performing the hash operation, the result is logically combined with the anti-tampering time anchor to generate a composite identifier.
[0018] Furthermore, the process of constructing a one-way state-progression cache includes:
[0019] Step 21: Use the composite identifier as an entropy source to drive the generation of unpredictable storage addresses;
[0020] Step 22: Create a cache entry containing the original ticket data, composite identifier, and state phase flag at an unpredictable storage address, and initialize the state phase flag to the starting phase;
[0021] Step 23: Perform a one-way hash chain iterative operation based on the current state phase marker and composite identifier to generate a state advancement certificate;
[0022] Step 24: After verifying the validity of the state advancement certificate, atomically update the state phase marker according to the predefined phase transition diagram.
[0023] Furthermore, the process of encapsulating data packets and generating checksums and pointers includes:
[0024] Step 31: Perform non-uniform fragmentation on the unresolved state data based on the entropy characteristics of the composite identifier to generate a data packet fragment set;
[0025] Step 32: Construct a topology check map based on the relative positional relationship of each fragment in the data packet fragment set, and generate a topology check code;
[0026] Step 33: Perform a logical folding operation on the topology check code and the composite identifier to generate a self-verifying pointer;
[0027] Step 34: Create a fragmentation index table and associate the data packet fragmentation set with the self-verification pointer for storage.
[0028] Furthermore, the process of constructing a distributed state mirror table includes:
[0029] Step 41: Merge and encode the physical coordinates and timestamps to generate a four-dimensional spatiotemporal grid cell identifier;
[0030] Step 42: Construct a consistent hash ring based on the four-dimensional spatiotemporal grid unit identifier to realize the logical sharding and distribution of state mirror records;
[0031] Step 43: Assign a causal consistency sequence number to each operation that writes to the state mirror record.
[0032] Furthermore, it also includes:
[0033] Step 44: Embed a version state machine based on a spatiotemporal vector clock into the state mirror record;
[0034] Step 45: When the version state machine is in a stable idle state and the spatiotemporal vector clock has no unconverged dependencies, trigger the price comparison process.
[0035] Furthermore, the process of verifying the price comparison results and managing the status includes:
[0036] Step 51: Extract the asynchronous delivery document from the received price comparison results and verify the structural integrity of the asynchronous delivery document;
[0037] Step 52: Generate zero-knowledge verification parameters based on the composite identifier and the features of the corresponding entries in the local cache;
[0038] Step 53: Generate a state arbitration result by comparing the spatiotemporal correlation between asynchronous delivery credentials and zero-knowledge verification parameters;
[0039] Step 54: If the state arbitration result is successful, the state phase mark is evolved to the completed state and the price comparison result is associated with it; if the state arbitration result is unsuccessful, traceability evidence is generated based on asynchronous delivery certificate and zero-knowledge verification parameters.
[0040] Furthermore, the process of generating approximate price comparison results includes:
[0041] Step 61: Construct a hidden Markov model of network state based on the timestamp sequence in the composite identifier to predict the spatiotemporal distribution pattern of network unavailability.
[0042] Step 62: Reconstruct the local cache index based on the spatiotemporal distribution map of network unavailability and generate a spatiotemporal constraint query path;
[0043] Step 63: Obtain historical records by querying the path through spatiotemporal constraints, perform spatiotemporal outlier filtering based on the Laida criterion, and generate a cleaned record set.
[0044] Furthermore, the process of generating approximate price comparison results also includes:
[0045] Step 64: Calculate the dynamic similarity weight based on the physical coordinates and timestamps of each record in the cleanup record set;
[0046] Step 65: Perform a weighted moving average calculation on the cleanup record set using dynamic similarity weights to generate an approximate price comparison result with confidence intervals;
[0047] Step 66: Based on the compatibility between the confidence interval of the approximate price comparison result and the phase label of the current state, perform gradient labeling of the estimated state and synchronous metadata encapsulation.
[0048] Secondly, a bill processing system based on a price comparison model and edge computing includes:
[0049] The identifier generation module is used to generate composite identifiers that include latitude, longitude, timestamp, and a summary of ticket feature points;
[0050] The local cache building module builds a one-way state-progressing cache locally based on composite identifiers, binding the original ticket data with composite identifiers and marking them as pending.
[0051] The data encapsulation and verification module is used to encapsulate pending state data and composite identifiers into data packets, generate integrity verification codes based on composite identifiers, and store the association pointer between integrity verification codes and data packets;
[0052] The mirror table construction module is used to build a distributed state mirror table using the physical coordinates and timestamps in the composite identifier. It stores state mirror records through a spatiotemporal index and triggers price comparison processing when a state mirror record is in an idle state.
[0053] The result verification module is used to receive the price comparison results, perform check code matching verification in the local cache using a composite identifier, and advance the status to "completed" if the verification is successful, and keep the status "pending" if the verification fails.
[0054] The approximate result generation module uses the physical coordinates in the composite identifier to query historical price comparison records of the same merchant identifier when the network unavailability duration exceeds a predetermined threshold. It then generates an approximate price comparison result using an inverse distance weighted interpolation algorithm and marks it as the estimated state.
[0055] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0056] (1) This solution binds the time and space and feature information of the bill by a composite identifier, and with the help of a one-way state advancement cache, a distributed state mirror table and a verification mechanism, it solves the problems of data loss, duplicate processing and state inconsistency when the network is unstable, ensures the accuracy of querying historical price comparison records by multiple devices, and provides a reliable guarantee for data synchronization and consistency.
[0057] (2) This solution relies on edge computing and cloud-based collaborative architecture. It optimizes the state image storage and price comparison triggering logic through spatiotemporal indexing, reduces invalid calculations and network transmission losses, and can efficiently process bill data even in weak network environments. It avoids processing delays caused by network problems and improves the real-time performance of bill price comparison and system operating efficiency.
[0058] (3) When the network is unavailable, this solution uses a hidden Markov model to predict the network status, the Laida criterion to filter abnormal data, and an inverse distance weighted interpolation algorithm to generate an approximate price comparison result with a confidence interval, ensuring that users can still obtain a valid reference when the network is disconnected, and greatly improving the user experience and system practicality in extreme network environments.
[0059] (4) This solution incorporates technologies such as anti-tampering time anchors, zero-knowledge verification, and dynamic similarity weights, which not only resist the risks of data tampering and illegal access, but also make anomalies traceable through the traceability evidence mechanism. At the same time, gradient marking of the estimated state ensures the credibility of the results, thus comprehensively enhancing the security, reliability and traceability of the bill processing process. Attached Figure Description
[0060] 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 only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1This is a flowchart of the invoice processing method based on a price comparison model and edge computing according to the present invention;
[0062] Figure 2 This is a flowchart illustrating the various modules in the invoice processing system based on a price comparison model and edge computing according to the present invention. Detailed Implementation
[0063] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0064] Example 1:
[0065] Please see Figure 1 The specific steps of the bill processing method based on the price comparison model and edge computing are as follows:
[0066] Step 1 generates a composite identifier containing latitude, longitude, timestamp, and a summary of ticket feature points, which also includes the following operations:
[0067] Step 11: Perform drift compensation on the original GPS coordinates based on the geomagnetic field strength vector and inertial displacement data to generate enhanced spatial coordinates. The specific operations are as follows:
[0068] In document scanning scenarios, native GPS coordinates are susceptible to drift due to environmental factors such as building obstruction and electromagnetic interference, resulting in insufficient accuracy of spatial location identification. This, in turn, affects subsequent data synchronization and consistency verification. To address this issue, after acquiring native GPS coordinates, the edge device simultaneously obtains the geomagnetic field strength vector and inertial displacement data of the current location. The geomagnetic field strength vector includes three components: magnetic declination, magnetic inclination, and magnetic field strength, reflecting the unique magnetic field characteristics of the current location and unaffected by common obstruction factors. The inertial displacement data is obtained in real time through the device's built-in accelerometer and gyroscope, which collects acceleration and angular velocity in three dimensions. The drift compensation function, which uses a multi-input multi-output nonlinear composite function, is constructed by cascading radial basis functions (RBF) and adaptive linear units (ADALINE). The system is composed of a radial basis function (RBF) responsible for capturing the nonlinear mapping relationship between the input data and the GPS drift, and an adaptive linear unit (ALU) responsible for correcting the linear deviation component. Together, they achieve full-scene drift compensation. Specifically, the RBF first takes the three components of the geomagnetic field strength vector, the three-dimensional displacement of the inertial displacement, and the device motion state parameters, such as motion speed and acceleration rate of change, as input variables. All input variables are standardized to eliminate the influence of dimensional differences. The standardized input data is first passed to the RBF, which uses a variant of the Gaussian kernel function as the activation function. The width parameter of the kernel function is dynamically set according to the stability of the magnetic field strength. The more stable the magnetic field, the smaller the width parameter, which improves the local fitting accuracy. The Euclidean distance between the input data and the cluster centers in the sample space is calculated, and then the nonlinear drift compensation component is output through the activation function.
[0069] Subsequently, the nonlinear compensation component, along with the standardized input data, is fed into the adaptive linear unit. This unit dynamically updates the weight vector using a minimum mean square error algorithm. The weight update rate is positively correlated with the rate of change of inertial displacement; the larger the rate of change of displacement, the faster the update, thus quickly adapting to the drift characteristics changes during equipment movement. This results in the output of a linear drift compensation component. Finally, the output of the drift compensation function is a weighted sum of the nonlinear and linear compensation components. The weighting coefficients are dynamically adjusted based on the variance of the current geomagnetic field strength vector. A smaller variance indicates a more stable magnetic field, resulting in a larger weight for the linear component; a larger variance results in a smaller weight for the nonlinear component. The greater the weight, the more the final drift compensation amount in the latitude and longitude directions is obtained through this weighted fusion. Based on this compensation amount, the original GPS coordinates are corrected in reverse. When the absolute value of the compensation amount is less than the preset threshold, such as the latitude and longitude difference corresponding to 0.5 meters less than the preset threshold, the compensation amount is directly added to complete the correction. When the absolute value of the compensation amount is greater than or equal to the preset threshold, gradient correction is performed in combination with the cumulative trend of inertial displacement to avoid overcorrection that could cause coordinate jumps. The final output is an enhanced spatial coordinate with higher accuracy and stronger stability. This coordinate provides a reliable spatial dimension basis for the composite identifier, ensuring the consistency of spatial information of the same ticket collected by different devices.
[0070] Step 12: Calculate the phase difference based on the local time start point and the network time reference of the scan trigger event, and apply a nonlinear transformation function to fuse the phase difference and the local time start point to generate an anti-tampering time anchor point. The specific operation is as follows:
[0071] The timing of the scan trigger event directly affects the uniqueness of the composite identifier's time dimension. However, the local clock of the edge device is susceptible to factors such as hardware precision and ambient temperature, resulting in deviations from the standard time. Simply relying on local time or network time cannot meet the requirements for tamper-proofing and accuracy. Therefore, the edge device first records the local time starting point at the moment of scan triggering, and simultaneously obtains a network time reference provided by the cloud or a distributed time server through network communication. This network time reference has undergone multi-node calibration and has high accuracy. By calculating the time difference between the local time starting point and the network time reference, the phase difference between the two is obtained. This phase difference directly reflects the degree of synchronization deviation between the device's local clock and the standard time. To prevent time information from being maliciously tampered with, a nonlinear transformation function with unidirectionality and anti-interference capabilities is introduced. This function uses an improved nonlinear fusion function based on SHA-256, combined with a Logistic chaotic mapping. The irreversibility of SHA-256 ensures the unidirectionality of the function, and the high sensitivity of the Logistic chaotic mapping to initial values enhances the anti-interference capability. The phase difference and the local time starting point are used as joint input parameters.
[0072] First, both data are quantized in the time dimension, converting the time values into a fixed-length numerical sequence to eliminate fusion bias caused by unit differences. Then, the quantized numerical sequence is input into the Logistic chaotic mapping module. By adjusting the mapping parameters—dynamically ranging from 3.57 to 4.0—adaptively adjusting based on the stability of the network time base, the input sequence is chaotically perturbed, generating intermediate variables with random distribution characteristics. This perturbation process ensures that even if an external attacker obtains the intermediate variables, they cannot deduce the original input data. Next, the chaotically perturbed intermediate variables are XORed bit-by-bit with the quantized original input sequence to strengthen data correlation and anti-interference capabilities. Finally, the result is input into the SHA-256 improved hash function. By adding a nonlinear feedback loop, the function's nonlinear expression capability is enhanced, generating a fixed-length hash value as an anti-tampering time anchor. This time anchor retains the true time characteristics of the scanned event and, due to the function's unidirectionality and anti-interference properties, effectively resists malicious tampering and external interference.
[0073] Step 13: Divide the bill image into a non-uniform grid, calculate the phase information of the local binary pattern sequence within the grid, capture the phase transition points between adjacent grids and record their position and amplitude sequences, and generate a bill feature point summary. The specific operations are as follows:
[0074] Feature extraction from invoice images needs to balance uniqueness and efficiency. Conventional uniform grid partitioning methods cannot adapt to the differences in feature density between text, patterns, and blank areas in invoice images, which can easily lead to feature redundancy or loss of key information. Therefore, the acquired invoice images are first preprocessed to remove noise interference and perform grayscale normalization. Then, a non-uniform grid partitioning strategy is adopted to segment the image. This strategy adaptively adjusts the grid size according to the pixel grayscale change rate of different regions of the image. A finer grid is used in feature-dense areas such as text and patterns to accurately capture detailed features, while a coarser grid is used in feature-sparse areas such as blank areas to reduce invalid calculations. For each grid region, its Local Binary Pattern (LBP) sequence is calculated. By analyzing the grayscale contrast relationship between adjacent pixels in this sequence, the texture feature phase information within the grid is extracted. Phase information can more accurately reflect the distribution pattern of local texture than simple grayscale values. Subsequently, the LBP phase information between adjacent grids is compared point by point to capture phase transition points where the phase value changes abruptly. These transition points usually correspond to key feature positions such as text edges and pattern outlines on the ticket. At the same time, the two-dimensional position coordinates of each transition point in the image coordinate system and the amplitude value of the phase change are recorded to form a position and amplitude sequence. This sequence is compressed and encoded, and after removing redundant information, a ticket feature point summary that can uniquely represent the core features of the ticket image is generated.
[0075] Step 14: Using the note feature point digest as input data for the hash operation, and the temporary key derived from the enhanced spatial coordinates and the tamper-proof time anchor as the hash salt value, the result is logically combined with the tamper-proof time anchor to generate a composite identifier. The specific operation is as follows:
[0076] The composite identifier needs to integrate information from three dimensions: space, time, and ticket features. It must also possess global uniqueness, tamper-proofness, and collision resistance. Simple hash operations cannot meet the requirements of multi-dimensional fusion and security. Therefore, the ticket feature point digest generated in step 13 is used as the input data for the hash operation. This digest already contains the unique feature information of the ticket, ensuring the uniqueness of the composite identifier. Simultaneously, based on the enhanced spatial coordinates obtained in step 11 and the tamper-proof time anchor point generated in step 12, a temporary key is generated through a key derivation algorithm. This temporary key combines unique spatial and temporal features and serves as the salt for the hash operation, effectively improving the randomness of the hash result and avoiding hash value collisions caused by similar feature point digests of different tickets. The hash operation uses an adaptive fusion variant of SHA-3-512. This function is an improvement on the sponge structure of SHA-3, retaining its core advantages of resistance to quantum attacks and high collision resistance. At the same time, the efficiency of multi-dimensional data fusion is improved by adding an input adaptation layer.
[0077] In the specific calculation, the feature point digest of the invoice and the temporary salt value are first interleaved and concatenated in byte sequence to form a mixed input stream. This concatenation method dynamically adjusts the concatenation interval according to the entropy distribution of the temporary salt value to avoid the security risks caused by a fixed concatenation pattern. Then, the mixed input stream is fed into the sponge structure of SHA-3-512, and the capacity parameter is adjusted to 1024 bits, twice the standard capacity, to enhance the data diffusion capability. Through the permutation operation in the water absorption stage and the output extraction in the squeezing stage, a 512-bit original hash result is generated. The hash value of this length has sufficient entropy density, which can effectively resist common cracking methods such as birthday attacks. To further enhance the anti-tampering property, the original hash result and the anti-tampering time anchor are combined with bit-level logic operation, and an irreversible XOR shift composite rule is adopted. This not only preserves the uniqueness of the original hash result, but also deeply integrates the anti-tampering property of the time dimension. The final generated composite identifier covers the three dimensions of space, time, and invoice features. The high security of its hash base function ensures the global uniqueness, strong anti-tampering property, and collision resistance of the identifier.
[0078] Step 2 involves building a one-way state advance cache locally based on the composite identifier, binding the original ticket data with the composite identifier and marking it as pending, which also includes the following operations:
[0079] Step 21: Use the composite identifier as an entropy source to drive the generation of unpredictable memory addresses. The specific operations are as follows:
[0080] First, the byte sequence of the composite identifier is extracted as the raw entropy input. This sequence is then entropy-enhanced by using cyclic shifting and XOR operations to expand the entropy distribution range, ensuring the uniformity and randomness of the input entropy source. Subsequently, an address derivation algorithm based on ChaCha20 is employed. This algorithm is highly efficient and secure, transforming high-entropy input into a uniformly distributed storage address sequence. The initial vector of the algorithm is directly generated from the last 64 bits of the composite identifier, while the key is derived by fusing the first 128 bits of the composite identifier with the device's local hardware identifier. During address generation, the number of iterations in the round function of the ChaCha20 algorithm is fixed at 20 rounds to balance security and computational efficiency. The enhanced entropy source is then encrypted, outputting a fixed-length address value. This value is then mapped to the physical storage address space of the local cache. Modulo operations ensure that the address falls within the effective storage range. The generated unpredictable storage address avoids address collisions between different ticket cache data, and the uniqueness of the entropy source prevents external parties from inferring the address location through reverse engineering, effectively resisting unauthorized access to the cache and data theft.
[0081] Step 22: Create a cache entry containing the original ticket data, composite identifier, and state phase flag at an unpredictable storage address, and initialize the state phase flag to the starting phase. The specific operations are as follows:
[0082] The data structure of cache entries is optimized to balance storage efficiency and access speed. It includes three fields: the original data field stores the original information such as scanned ticket images and text codes in a lossless compression format. The compression algorithm uses a variant of LZ77, and the compression level is dynamically adjusted according to the amount of ticket data. For example, level 3 compression is used when the data volume is less than 1MB, and level 6 compression is used when the data volume is greater than or equal to 1MB, which saves storage resources while ensuring the integrity of data restoration; the composite identifier field directly stores the complete composite identifier generated in step 14, which serves as the unique index key for the cache entry and is used for subsequent data query, association verification, and status matching; the status phase flag field is stored using single-byte binary encoding and initialized to a predefined starting phase. This starting phase is encoded as 0x01, representing the initial state that the ticket data has been stored in the cache but the price comparison process has not yet started. Its encoding design ensures the speed of status recognition and the compactness of storage. During the creation of cache entries, an atomic write mechanism is used to ensure that the three fields are stored successfully at the same time, avoiding data loss due to interruption. At the same time, an entry integrity verification bit is established. A check value is generated by performing CRC32 verification on the data of the three fields and stored together with the entry.
[0083] Step 23: Perform a one-way hash chain iterative operation based on the current state phase marker and composite identifier to generate a state advancement certificate. The specific operation is as follows:
[0084] First, the state phase marker in the current cached entry is obtained, initially as the starting phase. Then, it is concatenated with the complete composite identifier, and the two are byte-by-byte concatenated in the order of the phase marker and the composite identifier to form the input sequence. The SHA-3-256 algorithm is used to construct a one-way hash chain. This algorithm has high collision resistance and irreversibility, and can effectively resist tampering attacks. The number of iterations of the hash chain is dynamically determined by the current state phase marker. The starting phase corresponds to 3 iterations, and the number of iterations increases by 1 for each subsequent state phase to ensure that the credentials generated in different states are unique. The first iteration uses the concatenated input sequence as the original data to generate the first-level hash value. Each subsequent iteration uses the concatenation result of the first-level hash value and the composite identifier as the input to complete the preset number of iterations. The final output hash value is the state advancement credential. This credential is strongly bound to the current state phase and the composite identifier. Any change in either one will cause the credential to become invalid. Furthermore, due to the one-way nature of the hash chain, the original input data cannot be deduced from the credential from external sources, thus ensuring the legitimacy and security of the state advancement process.
[0085] Step 24: After verifying the validity of the state advancement certificate, atomically update the state phase marker according to the predefined phase transition diagram. The specific operation is as follows:
[0086] During the credential verification process, the same operational logic as in step 23 is used. The verification credential is regenerated using the state phase marker and composite identifier in the current cached entry as input. The verification credential is then compared byte by byte with the state advancement credential to be verified. If the two are completely consistent, the credential is deemed valid and state update is allowed. If they are inconsistent, the credential is deemed invalid, state update is rejected, and an exception log is recorded. The predefined phase transition diagram clarifies the legal state transition paths. This path is a unidirectional irreversible sequence. The starting phase can only transition to the processing phase, the processing phase can only transition to the completed phase or remain in an unresolved state, and the completed phase is the final state, which is not allowed to transition further to avoid state jump chaos. The starting phase is represented as 0x01, the processing phase as 0x02, the completed phase as 0x03, and the unresolved state as 0x01.
[0087] The state update adopts the Compare-and-Swap (CAS) atomic operation mechanism, which achieves atomicity through three operation steps: First, the current state phase flag is read as the expected value. Then, it is checked whether the cache entry has been modified by other operations. If it has not been modified, the state phase flag is updated to the target phase. If it has been modified, the update is abandoned and failure is returned. This atomic operation ensures that even in the scenario of multi-threaded concurrent access to the cache, the update of the state phase flag will not be partially modified or conflicted, thus guaranteeing the consistency and reliability of the local cache state.
[0088] Step 3: Encapsulate the pending status and the composite identifier into a data packet, generate an integrity check code based on the composite identifier, and store the association pointer between the integrity check code and the data packet. This also includes the following operations:
[0089] Step 31: Based on the entropy characteristics of the composite identifier, perform non-uniform fragmentation on the pending state data to generate a data packet fragment set. The specific operations are as follows:
[0090] First, the byte sequence of the composite identifier is extracted. By calculating the information entropy value of each byte, the overall entropy distribution curve is obtained. This curve can reflect the degree of concentration of information in the composite identifier. The higher the entropy value, the greater the information density, and the higher the proportion of key information in the corresponding pending state data. The entropy range is divided based on the entropy distribution curve. The threshold for the high entropy range is set at 0.8, the threshold for the medium entropy range is 0.5 to 0.8, and the threshold for the low entropy range is below 0.5. Different fragmentation strategies are adopted for different ranges: the unresolved data fragments corresponding to the high entropy range use smaller fragment sizes, with the minimum fragment size set at 1KB, to avoid splitting critical information; the medium entropy range uses medium fragment sizes, set at 8KB; and the low entropy range uses larger fragment sizes, with the maximum fragment size set at 64KB, to reduce the number of fragments and improve transmission efficiency. During the fragmentation process, the entropy mutation point of the composite identifier is used as the fragmentation boundary to ensure that the fragmentation does not destroy the integrity of critical data and can adaptively adjust the fragmentation granularity according to the information density. Finally, a set of data packet fragments containing metadata such as fragment sequence number, starting offset, and data length is generated. Each fragment is marked by some fields of the composite identifier.
[0091] Step 32: Construct a topology check map based on the relative positions of fragments in the data packet fragment set, and generate a topology check code. The specific operations are as follows:
[0092] First, the starting offset and fragment number are extracted from the metadata of each fragment to determine the relative position of each fragment in the original pending state data. Each fragment is used as a node in the topology check graph. The node weight is generated by performing a SHA-3-128 hash operation on the fragment data to ensure that the node weight can uniquely represent the fragment content. Directed edges are constructed to connect adjacent fragment nodes according to the order of the fragment starting offsets. The weight of the edge is the XOR value of the weights of two adjacent fragment nodes. This XOR value can reflect the association characteristics between adjacent fragments. The structure of the topology check graph is represented by an adjacency matrix. The rows and columns of the adjacency matrix correspond to the fragment node numbers, and the matrix elements are the weight values of the corresponding edges. If two nodes are not directly related, the element value is 0. The adjacency matrix is traversed in row-first order. The numerical sequence obtained by the traversal is used as input and processed by the SM3 hash algorithm to generate a 256-bit topology check code. This check code contains both the content characteristics of each fragment and the positional association information between fragments, which can effectively detect problems such as fragment loss, disordered order, or content tampering.
[0093] Step 33: Perform a logical folding operation on the topology check code and the composite identifier to generate a self-verifying pointer. The specific operation is as follows:
[0094] First, the topology check code and composite identifier are standardized by converting them into 512-bit byte sequences. If the topology check code is less than 512 bits, it is padded with zeros at the end. If the composite identifier exceeds 512 bits, the first 512 core bits are truncated. Logical folding operations employ a layered alternating fusion strategy, dividing the 512-bit byte sequence into eight equal layers, each containing 64 bits of data. Starting from the first layer, the data of the topology check code in that layer is XORed with the corresponding data of the composite identifier in that layer to obtain the first layer's fusion result. The second layer is fused by XORing after a left shift of 3 bits, and the third layer is fused by XORing after a right shift of 3 bits. Subsequent layers alternate between left and right shift operations. The shifting bit is gradually increased from 3 bits to 6 bits. Differentiated shifting operations enhance the randomness and tamper resistance of the fusion result. The 8-layer fusion result is then sequentially concatenated to form a new 512-bit byte sequence, which is then processed by the key derivation function KDF. The salt value of KDF is the hash value of the device's local hardware identifier, and the number of iterations is set to 1000. Finally, a 256-bit self-verification pointer is generated. In subsequent data access, this pointer can be used as an index to locate the data packet fragment set, and it can also be used to extract the topology check code fragment through reverse logical folding operation and compare it with the recalculated topology check code to achieve dual verification of its own validity and data integrity.
[0095] Step 34: Create a fragmentation index table and associate the data packet fragment set with the self-verification pointer for storage. The specific operations are as follows:
[0096] The shard index table is designed with a structured data format and contains five fields: shard unique identifier, self-verifying pointer, shard storage address, shard size, and integrity check bit. The shard unique identifier is generated by concatenating a composite identifier and a shard sequence number, and is stored using ASCII encoding to ensure that each shard has a unique identifier in the index table. The self-verifying pointer field directly stores the 256-bit self-verifying pointer generated in step 33, which serves as the search keyword for the index table. The shard storage address field records the physical or logical address of the shard in the local storage medium. The address format is adaptively adjusted according to the storage medium type; local disk storage uses sector addresses, and memory cache uses memory page addresses. The shard size field records the actual data length of the shard, in bytes. The integrity check bit field verifies the integrity of the shard data. CRC64 checksum generation is used to quickly verify whether fragmented data has been corrupted during storage. The index table uses a partitioned storage strategy, allocating index table entries to different storage partitions based on the hash value of the composite identifier. Each partition corresponds to a fixed range of hash values. For example, entries with the first 8 bits of the hash value being 00000000 to 00001111 are stored in the first partition, and so on, resulting in a total of 256 partitions. This improves index retrieval efficiency. At the same time, the index table is updated using a copy-on-write mechanism to avoid concurrent read / write conflicts and ensure the consistency and reliability of associated storage. When it is necessary to query or call a data packet fragment, the self-verifying pointer can quickly retrieve the index table entry in the corresponding partition to obtain the storage address and related metadata of the fragment, achieving efficient data location and access.
[0097] Step 4: Construct a distributed state mirror table using the physical coordinates and timestamps in the composite identifier. Store state mirror records using a spatiotemporal index. Trigger price comparison processing when a state mirror record is idle. This also includes the following operations:
[0098] Step 41: Merge and encode the physical coordinates and timestamps to generate a four-dimensional spatiotemporal grid cell identifier. The specific operations are as follows:
[0099] First, the enhanced spatial coordinates in the composite identifier, such as latitude and longitude, are gridded. The grid resolution is set according to the accuracy requirements of the ticket processing scenario. For example, the longitude direction is divided into grid units of 0.0001 degrees, and the latitude direction uses the same resolution to ensure that each grid unit corresponds to an area of about 10 square meters in real space, which ensures positioning accuracy and avoids the redundancy of the identifier caused by excessive grid subdivision. Then, the anti-tampering time anchor point is divided into time slices, and a fixed time slice length of 5 seconds is set. The continuous time dimension is discretized into independent time units, so that each time unit corresponds to a fixed time interval, which facilitates batch management of ticket processing events within the same time period. The longitude grid index, latitude grid index, and time slice index are used as three-dimensional core parameters, and then grid level parameters are introduced to construct a four-dimensional structure. The grid level parameters are dynamically adjusted according to the area range of ticket processing. A three-level level is used for city-level scenarios and a five-level level is used for regional scenarios to achieve spatiotemporal adaptation for different ranges. These four parameters are quantized and encoded, with each parameter converted into a fixed-length binary number. The longitude and latitude grid indices each occupy 24 bits, the time slice index occupies 32 bits, and the grid level parameter occupies 8 bits, for a total length of 88 bits. The four binary numbers are then merged in the order of grid level, longitude index, latitude index, and time slice index through bit concatenation operations. Finally, they are converted into a string form through Base64 encoding to generate the final four-dimensional spatiotemporal grid unit identifier. This identifier contains precise spatiotemporal information of the event and is compact and resolvable, uniquely identifying each spatiotemporal grid unit.
[0100] Step 42: Construct a consistent hash ring based on the four-dimensional spatiotemporal grid cell identifier to realize the logical sharding and distribution of state mirror records. The specific operations are as follows:
[0101] First, the SHA-3-256 algorithm is selected to calculate the hash value of each four-dimensional spatiotemporal grid cell identifier, and then it is mapped to 0 to 1. The numerical space is divided into a continuous hash ring. Then, virtual node technology is used to optimize the load balancing performance of the hash ring. 100 virtual nodes are allocated to each physical distributed node. Each virtual node generates a unique identifier by adding a different suffix to the physical node identifier. The virtual nodes are then mapped to the hash ring using the same SHA-3-256 algorithm, so that the virtual nodes are evenly distributed on the hash ring. The logical sharding of state mirror records is determined by the hash value of the corresponding four-dimensional spatiotemporal grid unit identifier. Records whose hash values fall within the interval of a certain virtual node on the hash ring are allocated to the physical node corresponding to that virtual node for storage. This logical sharding method ensures that records of different spatiotemporal grid units can be evenly distributed on each distributed node, avoiding excessive load on a single node. At the same time, the characteristics of the consistent hash ring mean that when a physical node fails or a new node is added, only the records in the interval of the corresponding virtual node need to be reallocated. The data migration amount is controlled to about 1 / (number of physical nodes × number of virtual nodes) of the total data volume, which greatly reduces the impact of node changes on the system, ensures the stability and availability of distributed storage, and realizes efficient distribution and dynamic adaptation of state mirror records.
[0102] Step 43: Assign a causal consistency sequence number to each operation that writes to the state mirror record. The specific operation is as follows:
[0103] First, a global causal relationship tracking mechanism is established. Each distributed node maintains a local sequence number counter, initially set to 0, and records the maximum sequence number of all other nodes it has detected. When a node initiates a state mirror record write operation, the causal dependencies of this operation are analyzed. If the operation is a subsequent processing of the same ticket, it depends on the sequence number of the preceding write operation; if it is the first write of a new ticket, there is no direct causal dependency. Based on the causal dependencies, a dependency sequence number set is generated, containing the sequence numbers of all preceding dependent operations. Then, the value of the local sequence number counter is incremented by 1 to obtain the local sequence number. The dependency sequence number set is then compared with the local sequence number and the node identifier. The system performs fusion encoding to generate causal consistency sequence numbers. The encoding format adopts a structure of node identifier, local sequence number, and hash value of dependent sequence number set. The hash value of dependent sequence number set is generated by performing SHA-1 operation on all sequence numbers in the set, ensuring the uniqueness and compactness of the sequence numbers. This sequence number can not only uniquely identify each write operation, but also trace the causal relationship of the operation through the dependent sequence number set. When subsequent nodes process related operations, they can verify the dependency relationship in the sequence number to ensure that the current operation is executed only after all preceding dependent operations are completed. This ensures the causal consistency of state mirror record write operations in a distributed environment and avoids data conflicts and state inconsistencies.
[0104] Step 44: Embed a version state machine based on a spatiotemporal vector clock into the state mirror record. The specific operations are as follows:
[0105] The spatiotemporal vector clock consists of a set of key-value pairs of node identifiers and counters. Each key-value pair corresponds to a distributed node participating in the state mirror record processing. The counter value indicates the number of write operations performed by that node on the current record. The version state machine includes four states: initialization state, processing state, idle state, and completed state. Each state corresponds to a specific business scenario and vector clock condition. During embedding, the spatiotemporal vector clock is used as a field in the state mirror record and stored together with information such as the record's composite identifier, ticket data reference, and four-dimensional spatiotemporal grid cell identifier. Simultaneously, the current state of the version state machine is stored in the record header using single-byte encoding for easy reading and identification. When a distributed node performs a state mirror operation... When a state mirror record performs a write operation, it synchronously updates its counter value in the spatiotemporal vector clock by incrementing the counter value by 1 and writes the updated vector clock to the record. The version state machine triggers state transitions based on changes in the vector clock and external events. For example, when a node initiates a write operation, the state machine transitions from the idle state to the processing state; when the write operation is completed and there are no new operation requests, it transitions to the idle state. The existence of the spatiotemporal vector clock ensures that the state transitions of each version state machine have a traceable version basis. Nodes can determine the version age and dependencies of records by comparing the vector clock, avoiding state errors caused by version confusion and ensuring the version consistency of state mirror records in a distributed environment.
[0106] Step 45: When the version state machine is in a stable idle state and the spatiotemporal vector clock has no unconverged dependencies, trigger the price comparison process. The specific operation is as follows:
[0107] The criterion for determining a stable idle state is that the version state machine remains idle for more than a preset threshold, set at 500 milliseconds. This threshold is measured by a local timer on each node. If there are no write operation requests or state transition events for the record within 500 milliseconds, it is considered a stable idle state, ensuring that the current record's state has stabilized without temporary fluctuations. The spatiotemporal vector clock has no unconverged dependency verification process. This is achieved by comparing the vector clocks of distributed nodes. Before triggering price comparison processing, each node collects the current vector clocks of all nodes participating in the record processing and checks whether the counter value corresponding to each node has been perceived and synchronized by all other nodes. That is, there is no situation where a node's counter value is updated without being known by other nodes. The specific verification method is to calculate the supremum of all node vector clocks. If each counter value in the supremum can be found to have a corresponding and equal value in the vector clocks of all nodes, then it is determined that there is no non-converged dependency. When both the stable idle state and the non-converged dependency conditions are met, the distributed nodes will generate a price comparison processing trigger signal. This signal contains core information such as the composite identifier of the state mirror record and the identifier of the four-dimensional spatiotemporal grid unit. It is sent to the price comparison system through a distributed message queue. After receiving the signal, the price comparison system retrieves the relevant bill information based on the bill data reference in the record and starts the price comparison calculation. This ensures that the price comparison processing is performed in an environment with consistent state and clear dependencies, which not only guarantees the accuracy of the price comparison results but also avoids the occurrence of duplicate processing or omissions.
[0108] Step 5: Receive the price comparison result, perform checksum matching verification in the local cache using a composite identifier, and advance the status to "Completed" if the verification is successful; otherwise, keep the status "Pending". This also includes the following operations:
[0109] Step 51: Extract the asynchronous delivery document from the received price comparison results and verify the structural integrity of the asynchronous delivery document. The specific operations are as follows:
[0110] After receiving the price comparison results, the edge device first extracts the asynchronous delivery voucher from the result data and then initiates a structural integrity verification process. The verification requires matching the predefined voucher structure specifications. For example, the voucher should contain 5 fixed-length fields, where the core fragment of the composite identifier is fixed at 64 bits, the generated timestamp is a 16-bit second-level time code, and the physical coordinate abbreviated information is a 16-bit latitude and longitude compressed value. The fields must be connected by a preset single-byte separator. The device verifies the existence and length compliance of each field one by one. If any field is missing, exceeds the length limit, or the separator is incorrect, the verification is deemed to have failed and the result is discarded. Only when all fields meet the specifications is the structural integrity verification completed and the subsequent matching stage begins. This process ensures that the vouchers processed later have a valid basic format.
[0111] Step 52: Generate zero-knowledge verification parameters based on the composite identifier and the features of the corresponding entries in the local cache. The specific operations are as follows:
[0112] The edge device first extracts the core segment of the composite identifier of the corresponding entry in the local cache. This segment contains key features of enhanced spatial coordinates and anti-tampering time anchors. At the same time, it obtains the state phase marker of the cache entry, which is currently in an unresolved state and is represented by the code 0x01. It also obtains the first 32 bits of the ticket data integrity check code. These information are concatenated in a fixed order to form the original input sequence. Then, the SHA-3-256 hash algorithm is used to operate on the sequence to generate a 256-bit zero-knowledge verification parameter. This parameter only contains the association information between the key features of the cache entry and the composite identifier. It can form a matching association with the corresponding asynchronous delivery voucher without exposing the original ticket data or complete status information, thus achieving the zero-knowledge characteristic of verification without leaking privacy.
[0113] Step 53: By comparing the spatiotemporal correlation between asynchronous delivery documents and zero-knowledge verification parameters, a state arbitration result is generated. The specific operations are as follows:
[0114] First, the time dimension is verified: the generation timestamp from the voucher is extracted and the time difference is calculated with the anti-tampering time anchor point of the voucher in the local cache. The valid threshold is set at 300 seconds. If the difference exceeds the limit, the time dimension is determined to be mismatched. Next, the spatial dimension is verified: the physical coordinate abbreviated information from the voucher is extracted and the deviation value is calculated with the local enhanced spatial coordinates. The valid deviation threshold is 0.0002 degrees, corresponding to approximately 20 meters. If the deviation exceeds the limit, the spatial dimension is determined to be mismatched. Based on this, the core fragment of the voucher's composite identifier is compared with the hash feature segment of the verification parameters, requiring at least the first 48 bits to be completely identical to ensure that both correspond to the same voucher. Combining the matching results of the above dimensions, if all dimensions meet the threshold, the arbitration result is passed; if any dimension does not match, it is a failure. This process avoids invalidating illegal or mismatched vouchers.
[0115] Step 54: If the state arbitration result is successful, the state phase marker is advanced to the completed state, and the price comparison result is associated with it; if the state arbitration result is unsuccessful, traceability evidence is generated based on the asynchronous delivery certificate and zero-knowledge verification parameters. The specific operations are as follows:
[0116] The state arbitration result determines the state evolution and data processing method of the local cache. When the result is pass, the edge device performs an atomic update on the state phase mark of the corresponding cache entry, evolving the pending state code 0x01 into the completed state code, which is represented as 0x03. At the same time, the price comparison result is stored in a designated area, and its storage address is associated with the cache entry to realize the binding of the ticket and the result. When the result is failure, the device records the mismatch points between the voucher and the verification parameters, such as time difference exceeding the limit or excessive spatial deviation, and generates traceability evidence, including the mismatch dimension, the feature fragments of both and the current cache state. After encapsulation, it is stored in the local anomaly log module to provide traceable evidence for subsequent investigation of abnormal scenarios such as duplicate processing and mismatch results, ensuring the consistency of system data and the traceability of anomalies.
[0117] Step 6: When the network unavailability duration exceeds a predetermined threshold, use the physical coordinates in the composite identifier to query historical price comparison records for the same merchant identifier, generate an approximate price comparison result using the inverse distance weighted interpolation algorithm, and mark it as the estimated state. This also includes the following operations:
[0118] Step 61: Construct a hidden Markov model of the network state based on the timestamp sequence in the composite identifier to predict the spatiotemporal distribution pattern of network unavailability. The specific operations are as follows:
[0119] The tamper-proof time anchors contained in the composite identifier are associated with historical network state data locally recorded by the edge device, such as latency and packet loss rate, to form a timestamp sequence. This sequence reflects the changes in network state over time and is therefore used as the basic input for constructing a network state Hidden Markov Model. The hidden states of the model are defined as three categories: network available, weakly available, and unavailable. The observation sequence corresponds to the actual network performance parameters collected at the historical timestamps. During the construction process, the transition probabilities between different hidden states in the historical timestamp sequence are first calculated. For example, the probability of transitioning from an available state to an unavailable state is set to 0.15, and the probability of transitioning from a weakly available state to an unavailable state is set to 0.15. The probability of reaching an unavailable state is set to 0.3. These probability values are based on statistical data of network status over the past 30 days. At the same time, the transmission probability of observation sequences corresponding to different hidden states is determined. For example, the probability of observing a packet loss rate of more than 50% in an unavailable state is set to 0.85. After completing the training of model parameters, combined with the physical coordinate information corresponding to the current composite identifier and the network status observation value corresponding to the recent timestamp, the probability of network unavailability in different physical coordinate areas within a preset time period, such as 1 hour, can be predicted. This generates a spatiotemporal distribution pattern of network unavailability, which can clearly identify the risk of network unavailability in different spatiotemporal areas.
[0120] Step 62: Reconstruct the local cache index based on the spatiotemporal distribution map of network unavailability, and generate spatiotemporal constrained query paths. The specific operations are as follows:
[0121] The spatiotemporal distribution map of network unavailability marks the probability of unavailability for different physical coordinate regions within different time intervals. Based on this, the idea of reconstructing the local cache index is to prioritize retaining historical record indexes corresponding to high unavailability risk regions to improve the effectiveness of local queries. During the reconstruction process, the sorting dimensions of the cache index are adjusted, using the deviation between the physical coordinates and the current ticket coordinates, and the difference between the timestamp and the current time as the core sorting criteria. This ensures that records with smaller deviations and closer times are placed at the top. Subsequently, a spatiotemporal constraint query path is generated. The constraints of this path are set based on the spatiotemporal distribution map: first, historical records with physical coordinate deviations not exceeding 0.0001 degrees and time differences not exceeding 1 hour are queried. If the number of records within this range is less than the preset threshold, such as 5 records, the constraint range is gradually expanded, with a maximum deviation not exceeding 0.0005 degrees and a maximum time difference not exceeding 24 hours. This hierarchical constraint query path ensures both the efficiency of the query process and the acquisition of a sufficient number of relevant historical records, avoiding irrelevant data from interfering with subsequent calculations due to an excessively large range.
[0122] Step 63: Obtain historical records by querying the path through spatiotemporal constraints, perform spatiotemporal outlier filtering based on the Laida criterion, and generate a cleaned record set. The specific operations are as follows:
[0123] First, extract the physical coordinate deviation and time difference values of all historical records, and calculate the mean μ and standard deviation σ of these two types of data. For example, the mean of the physical coordinate deviation is set to 0.0002 degrees and the standard deviation is set to 0.0001 degrees; the mean of the time difference is set to 6 hours and the standard deviation is set to 2 hours. According to the Laida criterion, records with physical coordinate deviations exceeding the range of μ+3σ to μ-3σ or time differences exceeding the corresponding range are removed. These records are judged as spatiotemporal outliers, and their corresponding price comparison results have low correlation with the current bill. The records retained after filtering constitute a purified record set. The records in this set have a high correlation with the current bill in the spatiotemporal dimension.
[0124] Step 64: Calculate the dynamic similarity weight based on the physical coordinates and timestamps of each record in the cleanup record set. The specific operation is as follows:
[0125] During the calculation, the deviation value d between the physical coordinates of each historical record and the physical coordinates of the current ticket, as well as the difference t between the timestamp and the current time, are first obtained. Weighting factors are then set for these two dimensions: the distance weighting factor Wd decreases as the deviation value d increases, for example, Wd is 0.9 when d is 0.0001 degrees and 0.5 when d is 0.0005 degrees; the time weighting factor Wt decreases as the time difference t increases, for example, Wt is 0.9 when t is 1 hour and 0.4 when t is 24 hours. The dynamic similarity weight is the product of the distance weighting factor and the time weighting factor. This weight can comprehensively reflect the degree of matching between the historical record and the current ticket in the spatiotemporal dimension.
[0126] Step 65: Perform a weighted moving average calculation on the cleanup record set using dynamic similarity weights to generate an approximate price comparison result with confidence intervals. The specific operation is as follows:
[0127] First, the cleanup record set is sorted from most recent to oldest timestamp. The price comparison result of each record is multiplied by its corresponding dynamic similarity weight. Then, all weighted results are summed and divided by the sum of all dynamic similarity weights. The resulting value is the core value of the approximate price comparison result. At the same time, the deviation of the price comparison result of each record from this core value is calculated. The standard deviation σr of the deviation is calculated in combination with the corresponding weight. Based on this, the confidence interval is set as the core value ±2σr. This interval can reflect the reliability of the approximate result. For example, when σr is smaller, the confidence interval is narrower, indicating that the consistency of the result is stronger and the reliability is higher. Conversely, the reliability is relatively weaker.
[0128] Step 66: Based on the compatibility between the confidence interval of the approximate price comparison result and the current state phase label, perform gradient labeling of the estimated state and synchronous metadata encapsulation. The specific operations are as follows:
[0129] First, the confidence interval width threshold is set to 0.1 times the core value of the approximate result. If the confidence interval width is less than this threshold, it is determined to be a high-confidence prediction state, and the corresponding code is set to 0x04. If the confidence interval width is greater than this threshold, it is determined to be a low-confidence prediction state, and the corresponding code is set to 0x05. After completing the state marking, the synchronization metadata is encapsulated. This metadata includes the approximate price comparison result, the confidence interval range, the prediction state code, and the corresponding composite identifier. The structure design of the metadata must meet the data synchronization requirements after the network is restored, ensuring that when the network is available, the metadata can be used to match the real price comparison result and update the state phase mark, thereby ensuring the final consistency between local data and cloud data.
[0130] Example 2:
[0131] Please see Figure 2Based on Example 1, this example provides a bill processing system based on a price comparison model and edge computing, including:
[0132] The identifier generation module is used to generate composite identifiers that include latitude, longitude, timestamp, and a summary of ticket feature points;
[0133] The local cache building module builds a one-way state-progressing cache locally based on composite identifiers, binding the original ticket data with composite identifiers and marking them as pending.
[0134] The data encapsulation and verification module is used to encapsulate pending state data and composite identifiers into data packets, generate integrity verification codes based on composite identifiers, and store the association pointer between integrity verification codes and data packets;
[0135] The mirror table construction module is used to build a distributed state mirror table using the physical coordinates and timestamps in the composite identifier. It stores state mirror records through a spatiotemporal index and triggers price comparison processing when a state mirror record is in an idle state.
[0136] The result verification module is used to receive the price comparison results, perform check code matching verification in the local cache using a composite identifier, and advance the status to "completed" if the verification is successful, and keep the status "pending" if the verification fails.
[0137] The approximate result generation module uses the physical coordinates in the composite identifier to query historical price comparison records of the same merchant identifier when the network unavailability duration exceeds a predetermined threshold. It then generates an approximate price comparison result using an inverse distance weighted interpolation algorithm and marks it as the estimated state.
[0138] The above description is merely a preferred embodiment of the present invention; however, the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and its improved concepts, should be covered within the scope of protection of the present invention.
Claims
1. A bill processing method based on a price comparison model and edge computing, characterized in that, include: Step 1: Generate a composite identifier containing latitude, longitude, timestamp, and a summary of ticket feature points; Step 2: Build a one-way state advance cache locally based on the composite identifier, bind the original ticket data with the composite identifier and mark it as pending; Step 3: Encapsulate the pending status and composite identifier into a data packet, generate an integrity check code based on the composite identifier, and store the association pointer between the integrity check code and the data packet; Step 4: Construct a distributed state mirror table using the physical coordinates and timestamps in the composite identifier, store state mirror records through a spatiotemporal index, and trigger price comparison processing when a state mirror record is in an idle state. Step 5: Receive the price comparison results, use the composite identifier to perform check code matching verification in the local cache, and if the verification is successful, advance the status to completed; if the verification fails, keep the status pending. Step 6: When the network unavailability duration exceeds a predetermined threshold, use the physical coordinates in the composite identifier to query historical price comparison records of the same merchant identifier, generate an approximate price comparison result through the inverse distance weighted interpolation algorithm, and mark it as the estimated state.
2. The bill processing method based on price comparison model and edge computing according to claim 1, characterized in that, Generate a composite identifier containing latitude, longitude, timestamp, and a summary of ticket feature points, including: Step 11: Perform drift compensation on the original GPS coordinates based on the geomagnetic field strength vector and inertial displacement data to generate enhanced spatial coordinates; Step 12: Calculate the phase difference based on the local time starting point and the network time reference of the scan-triggered event, and apply a nonlinear transformation function to fuse the phase difference and the local time starting point to generate an anti-tampering time anchor point. Step 13: Divide the bill image into a non-uniform grid, calculate the phase information of the local binary mode sequence within the grid, capture the phase transition points between adjacent grids and record their position and amplitude sequence, and generate a bill feature point summary. Step 14: Using the note feature point digest as input data for hash operation, and using the temporary key derived from the enhanced spatial coordinates and the anti-tampering time anchor as the hash salt value, after performing the hash operation, the result is logically combined with the anti-tampering time anchor to generate a composite identifier.
3. The bill processing method based on price comparison model and edge computing according to claim 2, characterized in that, The process of building a one-way state-advance cache includes: Step 21: Use the composite identifier as an entropy source to drive the generation of unpredictable storage addresses; Step 22: Create a cache entry containing the original ticket data, composite identifier, and state phase flag at an unpredictable storage address, and initialize the state phase flag to the starting phase; Step 23: Perform a one-way hash chain iterative operation based on the current state phase marker and composite identifier to generate a state advancement certificate; Step 24: After verifying the validity of the state advancement certificate, atomically update the state phase marker according to the predefined phase transition diagram.
4. The bill processing method based on price comparison model and edge computing according to claim 3, characterized in that, The process of encapsulating data packets and generating checksums and pointers includes: Step 31: Perform non-uniform fragmentation on the unresolved state data based on the entropy characteristics of the composite identifier to generate a data packet fragment set; Step 32: Construct a topology check map based on the relative positional relationship of each fragment in the data packet fragment set, and generate a topology check code; Step 33: Perform a logical folding operation on the topology check code and the composite identifier to generate a self-verifying pointer; Step 34: Create a fragmentation index table and associate the data packet fragmentation set with the self-verification pointer for storage.
5. The bill processing method based on price comparison model and edge computing according to claim 4, characterized in that, The process of building a distributed state mirror table includes: Step 41: Merge and encode the physical coordinates and timestamps to generate a four-dimensional spatiotemporal grid cell identifier; Step 42: Construct a consistent hash ring based on the four-dimensional spatiotemporal grid unit identifier to realize the logical sharding and distribution of state mirror records; Step 43: Assign a causal consistency sequence number to each operation that writes to the state mirror record.
6. The bill processing method based on price comparison model and edge computing according to claim 5, characterized in that, Also includes: Step 44: Embed a version state machine based on a spatiotemporal vector clock into the state mirror record; Step 45: When the version state machine is in a stable idle state and the spatiotemporal vector clock has no unconverged dependencies, trigger the price comparison process.
7. The bill processing method based on price comparison model and edge computing according to claim 6, characterized in that, The process of verifying price comparison results and managing their status includes: Step 51: Extract the asynchronous delivery document from the received price comparison results and verify the structural integrity of the asynchronous delivery document; Step 52: Generate zero-knowledge verification parameters based on the composite identifier and the features of the corresponding entries in the local cache; Step 53: Generate a state arbitration result by comparing the spatiotemporal correlation between asynchronous delivery credentials and zero-knowledge verification parameters; Step 54: If the state arbitration result is successful, the state phase mark is evolved to the completed state and the price comparison result is associated with it; if the state arbitration result is unsuccessful, traceability evidence is generated based on asynchronous delivery certificate and zero-knowledge verification parameters.
8. The bill processing method based on price comparison model and edge computing according to claim 7, characterized in that, The process of generating approximate price comparison results includes: Step 61: Construct a hidden Markov model of network state based on the timestamp sequence in the composite identifier to predict the spatiotemporal distribution pattern of network unavailability. Step 62: Reconstruct the local cache index based on the spatiotemporal distribution map of network unavailability and generate a spatiotemporal constraint query path; Step 63: Obtain historical records by querying the path through spatiotemporal constraints, perform spatiotemporal outlier filtering based on the Laida criterion, and generate a cleaned record set.
9. The bill processing method based on price comparison model and edge computing according to claim 8, characterized in that, The process of generating approximate price comparison results also includes: Step 64: Calculate the dynamic similarity weight based on the physical coordinates and timestamps of each record in the cleanup record set; Step 65: Perform a weighted moving average calculation on the cleanup record set using dynamic similarity weights to generate an approximate price comparison result with confidence intervals; Step 66: Based on the compatibility between the confidence interval of the approximate price comparison result and the phase label of the current state, perform gradient labeling of the estimated state and synchronous metadata encapsulation.
10. A bill processing system based on a price comparison model and edge computing, applied to the bill processing method based on a price comparison model and edge computing according to any one of claims 1-9, characterized in that, include: The identifier generation module is used to generate composite identifiers that include latitude, longitude, timestamp, and a summary of ticket feature points; The local cache building module builds a one-way state-progressing cache locally based on composite identifiers, binding the original ticket data with composite identifiers and marking them as pending. The data encapsulation and verification module is used to encapsulate pending state data and composite identifiers into data packets, generate integrity verification codes based on composite identifiers, and store the association pointer between integrity verification codes and data packets; The mirror table construction module is used to build a distributed state mirror table using the physical coordinates and timestamps in the composite identifier. It stores state mirror records through a spatiotemporal index and triggers price comparison processing when a state mirror record is in an idle state. The result verification module is used to receive the price comparison results, perform check code matching verification in the local cache using a composite identifier, and advance the status to "completed" if the verification is successful, and keep the status "pending" if the verification fails. The approximate result generation module uses the physical coordinates in the composite identifier to query historical price comparison records of the same merchant identifier when the network unavailability duration exceeds a predetermined threshold. It then generates an approximate price comparison result using an inverse distance weighted interpolation algorithm and marks it as the estimated state.
Citation Information
Patent Citations
Circulation data supervision method based on data interaction
CN120179667A
Digital right near-field real-time cancel-after-verification system and method based on edge calculation
CN120355464A