Concurrency control-based retail end online management method and system

By constructing an inventory time-sharded mirror and lock-free buffering mechanism, combined with a spatiotemporal interactive entropy weighted algorithm and a streaming dense subgraph incremental mining algorithm, the data conflict between inventory counting and sales control in retail business was resolved, achieving non-blocking inventory management in a high-concurrency environment and improving business continuity and system throughput.

CN121684802APending Publication Date: 2026-03-17NANJING GRAVITY CLOUD TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In retail operations, traditional inventory counting technology struggles to resolve data conflicts between inventory counting and sales control transactions in a high-concurrency environment without interrupting sales, leading to lost revenue and a decline in the consumer shopping experience.

Method used

By constructing an inventory time-sharded mirror and a lock-free buffer mechanism, static inventory counting and dynamic sales are physically isolated. A retail knowledge graph is constructed using a spatiotemporal interactive entropy weighted algorithm. A streaming dense subgraph incremental mining algorithm is used to identify concurrent states. During inventory counting, inventory deduction requests are written to a lock-free circular buffer. After inventory counting is completed, compensation and merging are performed to update the inventory database.

Benefits of technology

It enables seamless hybrid concurrency of inventory counting and sales operations, ensuring inventory data consistency, improving business continuity and system throughput at retail terminals, and enhancing the intelligence and responsiveness of inventory management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121684802A_ABST
    Figure CN121684802A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of retail management, in particular to a retail end online management method and system based on concurrency control, and the method comprises the steps: constructing a retail knowledge graph based on historical transaction logs through employing a space-time interaction entropy weighting algorithm; calculating a local topology edge density increment by applying a streaming dense subgraph increment mining algorithm, and determining a topology aggregation state of a target node; if the state is the mixed concurrent state, constructing an inventory time slice mirror image containing a reference inventory domain and a dynamic increment domain; and writing the request into the lock-free annular buffer during checking, and merging data by adopting a time sequence alignment algorithm after checking to carry out atomized updating. According to the method, static inventory and dynamic sales are physically isolated by constructing the inventory time slice mirroring and lock-free buffer mechanism, the read-write conflict in the scene of inventory while sales is solved, and zero-blocking hybrid concurrence is realized while the final consistency of inventory data is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of retail management technology, specifically to a retail online management method and system based on concurrency control. Background Technology

[0002] In the daily operations of modern retail, the real-time accuracy of inventory data is crucial to ensuring the smooth operation of sales. To correct discrepancies between inventory records and actual stock caused by losses, misplacement, or system errors, retailers must conduct regular or irregular inventory checks on shelf merchandise. Retail operations are characterized by high-frequency transactions and long operating hours, making traditional inventory counting techniques ill-suited to current business needs. In existing retail management systems, inventory counting often conflicts with sales control operations. Specifically, to prevent data discrepancies, systems typically employ strategies such as closing down for inventory counting or locking inventory counts. This involves using database locks to forcibly suspend sales permissions for specific shelves or product categories at the POS terminal or online. While this approach ensures data consistency, it directly disrupts retail operations, resulting in lost revenue and severely impacting the consumer shopping experience. The current challenge is resolving data conflicts between inventory counting and sales control transactions in a high-concurrency environment where retail operations remain uninterrupted. Essentially, this is a technical challenge in concurrent data structure design—how to achieve data consistency guarantees under high concurrency without relying on global locks. To address this, a retail online management method and system based on concurrency control is proposed. Summary of the Invention

[0003] The purpose of this invention is to provide a retail online management method based on concurrency control. By constructing an inventory time-sharded mirror and a lock-free buffer mechanism, static inventory counting and dynamic sales are physically isolated, thus solving the read-write conflict in the scenario of simultaneous inventory counting and sales.

[0004] To achieve the above objectives, the present invention provides the following technical solution: Online management methods for retail terminals based on concurrency control include...

[0005] Obtain historical transaction logs from the retail sector, and construct a retail knowledge graph based on the historical transaction logs using a spatiotemporal interaction entropy weighted algorithm. In response to real-time business requests, the transaction objects contained in the request are mapped to target nodes in the retail knowledge graph. The streaming dense subgraph incremental mining algorithm is applied to calculate the marginal increment of local topological edge density caused by the access of the target node. Retail entity clusters are mined without traversing the global graph, and the topological clustering state of the target node is determined. If the topology aggregation state is identified as a mixed concurrent state where inventory counting operations and sales transactions coexist, an inventory time-sharded mirror containing a baseline inventory counting domain and a dynamic incremental domain is constructed for concurrent control; during inventory counting, inventory deduction requests are written to the lock-free circular buffer of the dynamic incremental domain, and the virtual inventory level is updated in real time. After the inventory count is completed, a time-series alignment algorithm is used to compensate and merge the transaction offset of the lockless circular buffer with the physical inventory data, calculate the final inventory calibration value, and atomically update the inventory database.

[0006] Preferably, the specific process of constructing a retail knowledge graph from the historical transaction logs using a spatiotemporal interaction entropy weighted algorithm is as follows: The historical transaction logs are structured and parsed to extract retail product nodes and their actual transaction-related edges, and an initial unweighted graph is constructed; the spatiotemporal interaction entropy weighting algorithm includes time and space dimensions; The time dimension involves dividing the transaction timeline into discrete time sliding windows, statistically analyzing the transaction frequency distribution probability of each product entity node within different time windows, and using the Shannon entropy formula to calculate the negative logarithmic expectation of the transaction time dispersion, thus obtaining the time fluctuation entropy value. The spatial dimension involves identifying the co-occurrence relationship of products under the same transaction serial number, calculating the conditional co-occurrence probability of the target node relative to the associated nodes, and calculating the spatial association entropy value based on the conditional co-occurrence probability. A spatiotemporal coupling factor is introduced to nonlinearly weight and fuse the temporal fluctuation entropy value and the spatial correlation entropy value to obtain the comprehensive edge weight of the actual transaction correlation edge. The comprehensive edge weight is then assigned to the initial unweighted graph to construct a retail knowledge graph.

[0007] Preferably, mapping the transaction object included in the request to the target node in the retail knowledge graph specifically involves: parsing the real-time business request to extract the unique identifier of the transaction object, and using an inverted index to retrieve the corresponding graph node in the retail knowledge graph; if the graph node has a combined product attribute, then traversing downwards according to the inclusion relationship edges in the graph to obtain all its associated atomic inventory nodes as the target node; otherwise, directly confirming the retrieved graph node as the target node.

[0008] Preferably, the streaming dense subgraph incremental mining algorithm is as follows: Centered on the target node, related product nodes within the K-order neighborhood are extracted to construct a local product association network. The interaction strength matrix of the local product association network is initialized using the comprehensive edge weights in the retail knowledge graph. The current business request is mapped as a real-time transaction pulse signal, which is injected into the local product association network as a temporary strong correlation edge, and the transaction concurrency of each product node in the network is updated. A greedy stripping strategy based on retail popularity is executed in the local product association network to iteratively remove product nodes and their associated edges with transaction concurrency below a preset popularity threshold until the network node set is empty. If the network node set is not empty, the remaining high-popularity product node set is determined to constitute the retail entity aggregation cluster, and the average interaction density difference of the aggregation cluster before and after the injection of the transaction pulse signal is calculated. The difference is used as the marginal increment of the local topological edge density to determine the topological aggregation state of the target node.

[0009] Preferably, the specific process of determining the topological clustering state of the target node is as follows: Obtain the set of inventory objects covered by the currently executed inventory operation, and calculate the intersection of the retail entity cluster and the set of inventory objects; If the intersection is not empty and the marginal increment of the local topological edge density is greater than a preset increment threshold, it indicates that there are associated nodes in the retail entity aggregation cluster affected by the inventory operation, and the topological aggregation state of the target node is determined to be the mixed concurrent state.

[0010] Preferably, the inventory time-segmented mirroring comprising the baseline inventory domain and the dynamic incremental domain is as follows: Use atomic operations to lock the current system time as the anchor point for retail concurrency control logic; Configure the baseline inventory domain as a static management partition, freeze and store the static inventory snapshot at the time of the retail concurrency control logic anchor point; Configure the dynamic incremental domain as a dynamic transaction partition and map it to the lock-free circular buffer; append records of inventory deduction requests and transaction offsets that occur after the retail concurrency control logic anchor point; calculate the real-time sum of the static inventory snapshot and the accumulated transaction offsets in the lock-free circular buffer as the virtual inventory level.

[0011] Preferably, the timing alignment algorithm defines a dynamic statistical interval for the unlocked circular buffer based on the generation time of the logical anchor point and the physical inventory data. Summarize all transaction offsets recorded in the unlocked circular buffer within the dynamic statistical interval to obtain the total dynamic turnover during the inventory count; superimpose the total dynamic turnover with the static inventory snapshot within the benchmark inventory count domain to derive the theoretical inventory value of the system; compare the physical inventory count data with the theoretical inventory value of the system, and use the calculated difference value as the final inventory calibration value; The final inventory calibration value is applied to the inventory database for a non-blocking calibration update.

[0012] A retail online management system based on concurrency control includes: Knowledge Graph Module: Obtain historical transaction logs from the retail end, and construct a retail knowledge graph based on the historical transaction logs using a spatiotemporal interaction entropy weighted algorithm; Topology clustering module: In response to real-time business requests, it maps the transaction objects contained in the request to target nodes in the retail knowledge graph, applies a streaming dense subgraph incremental mining algorithm to calculate the local topological edge density marginal increment caused by the access of the target node, mines retail entity clusters without traversing the global graph, and determines the topological clustering state of the target node. Concurrency control module: If the topology aggregation state is identified as a mixed concurrent state where inventory counting and sales transactions coexist, construct an inventory time-sharded mirror containing a baseline inventory domain and a dynamic incremental domain for concurrency control; during inventory counting, write inventory deduction requests into the lock-free circular buffer of the dynamic incremental domain and update the virtual inventory level in real time. Inventory Update Module: After the inventory count is completed, the transaction offset of the lockless circular buffer is compensated and merged with the physical inventory count data using a time-series alignment algorithm, the final inventory calibration value is calculated and the inventory database is atomically updated.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This application achieves non-blocking hybrid concurrency of inventory counting and sales operations by constructing an inventory time-sharded mirror that includes a baseline inventory domain and a dynamic incremental domain. Traditional retail inventory counting often requires freezing inventory and stopping sales, or faces inconsistencies caused by data contention. This application introduces an inventory time-sharded mirroring mechanism, using atomic operations to establish logical anchors, and physically isolates the static baseline inventory data from the dynamic incremental sales data. This maintains the stability of the baseline inventory domain while using the dynamic incremental domain to respond in real time to high-frequency sales deduction requests, completely solving the data read / write conflict problem in the scenario of simultaneous inventory counting and sales. Under the premise of ensuring eventual consistency of inventory data, it significantly improves the business continuity and system throughput of retail terminals.

[0014] 2. This application employs a spatiotemporal interactive entropy weighted algorithm to construct a retail knowledge graph. This algorithm deeply mines and quantifies the implicit correlation characteristics of retail products in the spatiotemporal dimensions. Unlike traditional, simple inventory list management, this application extracts data from historical transaction logs, introduces Shannon entropy theory, and calculates the negative logarithmic expectation of transaction time dispersion and the conditional probability of product co-occurrence relationships. Through nonlinear weighted fusion of spatiotemporal coupling factors, it accurately assigns comprehensive weights to the association edges between products, thereby constructing a knowledge graph that reflects the true transaction activity and association strength. This not only provides a high-value data foundation for subsequent topological state recognition but also enables the system to intelligently perceive the complex transaction logic between products, improving the level of intelligence in retail management.

[0015] 3. This application applies a streaming dense subgraph incremental mining algorithm to achieve low-latency, real-time identification of retail entity clusters without traversing the global graph. Addressing the time-consuming graph traversal issue caused by the massive number of product nodes in retail scenarios, this application only calculates the marginal increment of local topological edge density caused by the access of target nodes. Combined with a greedy stripping strategy based on retail popularity, it quickly mines high-popularity entity clusters within the local product association network. This incremental calculation method greatly reduces the algorithm's time complexity, enabling millisecond-level determination of whether the current transaction object is in a mixed concurrent state of inventory and sales. This ensures system response speed while achieving accurate positioning and dynamic control of high-concurrency risk areas. Attached Figure Description

[0016] Figure 1 A flowchart illustrating a retail online management method based on concurrency control; Figure 2 A data flow diagram for a retail online management method based on concurrency control; Figure 3 This is a schematic diagram of the structure of a retail online management system based on concurrency control. Detailed Implementation

[0017] 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, and 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.

[0018] Example 1:

[0019] Please see Figure 1 , Figure 2 The present invention provides a case name and the technical solution is as follows: Online management methods for retail terminals based on concurrency control include: Obtain historical transaction logs from the retail sector, and construct a retail knowledge graph based on the historical transaction logs using a spatiotemporal interaction entropy weighted algorithm. In response to real-time business requests, the transaction objects contained in the request are mapped to target nodes in the retail knowledge graph. The streaming dense subgraph incremental mining algorithm is applied to calculate the marginal increment of local topological edge density caused by the access of the target node. Retail entity clusters are mined without traversing the global graph, and the topological clustering state of the target node is determined. If the topology aggregation state is identified as a mixed concurrent state where inventory counting operations and sales transactions coexist, an inventory time-sharded mirror containing a baseline inventory counting domain and a dynamic incremental domain is constructed for concurrent control; during inventory counting, inventory deduction requests are written to the lock-free circular buffer of the dynamic incremental domain, and the virtual inventory level is updated in real time. After the inventory count is completed, a time-series alignment algorithm is used to compensate and merge the transaction offset of the lockless circular buffer with the physical inventory data, calculate the final inventory calibration value, and atomically update the inventory database.

[0020] The specific process of constructing a retail knowledge graph based on the historical transaction logs using a spatiotemporal interaction entropy weighted algorithm is as follows: The historical transaction logs are structured and parsed to extract retail product nodes and their actual transaction-related edges, and an initial unweighted graph is constructed; the spatiotemporal interaction entropy weighting algorithm includes time and space dimensions; The time dimension involves dividing the transaction timeline into discrete time sliding windows, statistically analyzing the transaction frequency distribution probability of each product entity node within different time windows, and using the Shannon entropy formula to calculate the negative logarithmic expectation of the transaction time dispersion, thus obtaining the time fluctuation entropy value. The spatial dimension involves identifying the co-occurrence relationship of products under the same transaction serial number, calculating the conditional co-occurrence probability of the target node relative to the associated nodes, and calculating the spatial association entropy value based on the conditional co-occurrence probability. By using Shannon entropy to quantify the temporal dispersion and spatial co-occurrence probability of commodity transactions, we can accurately calculate the temporal fluctuation entropy and spatial correlation entropy that reflect the explosive sales, overcoming the limitations of traditional static statistics. This method can deeply mine and digitize the implicit spatiotemporal logic between commodities, providing reliable data support for building a high-precision retail knowledge graph and for subsequent accurate identification of high-concurrency risks.

[0021] A spatiotemporal coupling factor is introduced to nonlinearly weight and fuse the temporal fluctuation entropy value and the spatial correlation entropy value to obtain the comprehensive edge weight of the actual transaction correlation edge. The comprehensive edge weight is then assigned to the initial unweighted graph to construct a retail knowledge graph.

[0022] The structured parsing process involves parsing each transaction log entry to identify the transaction serial number, transaction timestamp, and all unique product identifiers under that serial number. Each unique product identifier is then used to generate a product entity node in the graph. All transaction logs are traversed to identify product combinations appearing under the same transaction serial number. If two product nodes exist in the same transaction, an undirected actual transaction association edge is established between the two nodes. The resulting graph is an initial unweighted graph. The calculation of time fluctuation entropy involves dividing the historical transaction timeline into continuous and equally long discrete time sliding windows (in this embodiment, the time length of each window is set to one hour). For each product entity node in the graph, the transaction frequency of the product within each time sliding window is counted, and this frequency is divided by the total transaction frequency of the product throughout the entire statistical period, thereby obtaining the transaction frequency distribution probability of the product in each time window. Next, the system uses the logic of the Shannon entropy formula to calculate: for each time window, the product of the window distribution probability and the logarithm of the probability is calculated. The calculation results for all windows are summed, and the negative of the sum is taken. The result is the time fluctuation entropy value of the product node. This value is used to quantify the dispersion of product sales over time; the lower the value, the more concentrated the transactions of the product are in a few specific time periods, exhibiting high-concurrency burst characteristics. Each actual transaction-related edge in the initial unweighted graph is analyzed to identify the connected source and target nodes. The number of times the source and target nodes co-occur in historical logs is counted, i.e., the co-occurrence frequency. Simultaneously, the total number of times the source node appears independently is counted. The conditional co-occurrence probability is calculated by dividing the co-occurrence frequency by the total number of times the source node appears. This probability value represents the likelihood of purchasing the target node's product along with the product purchased from the source node. To quantify the spatial dimensional density, the probability value is normalized and used as the spatial association entropy value. The higher the spatial association entropy value, the stronger the spatial pairing and purchasing relationship between the two products. A spatiotemporal coupling factor is introduced to generate comprehensive edge weights and construct the final graph. The spatiotemporal coupling factor is determined using a calculation method based on the real-time load ratio. Specifically, the total number of transaction requests per second at the retail end is counted in real-time, and this is divided by the historical peak transaction volume; the resulting ratio is the spatiotemporal coupling factor. The spatiotemporal coupling factor value is between zero and one, dynamically reflecting the current level of concurrency pressure. A nonlinear weighted fusion operation is performed. First, the reciprocal of the previously calculated time fluctuation entropy value is taken to obtain an index reflecting time concentration. Then, using the time concentration index as the base, the spatiotemporal coupling factor is calculated... The exponent is used to perform a power operation on the factor, achieving nonlinear amplification of the temporal features. Finally, the result of the power operation is multiplied by the spatial association entropy value, and the calculated product is the comprehensive edge weight of the actual transaction association edge. The comprehensive edge weight is assigned to the corresponding edge in the initial unweighted graph, completing the construction of a retail knowledge graph containing spatiotemporal features. By using the spatiotemporal coupling factor as an exponent for nonlinear weighting, adaptive dynamic adjustment of the spatiotemporal feature weights under different concurrency pressures is achieved. This ensures the sensitivity of feature capture during peak periods while effectively suppressing random noise under low load, significantly improving the robustness of graph construction.

[0023] This application employs a spatiotemporal interaction entropy weighting algorithm, introducing a spatiotemporal coupling factor to nonlinearly and dynamically fuse the temporal burst characteristics (temporal fluctuation entropy) of commodity transactions with spatial pairing relationships (spatial correlation entropy). It can adaptively adjust the graph weights according to the current real-time load of the retail end, and automatically amplify the influence weight of time concentration indicators in high-concurrency scenarios, thereby constructing a retail knowledge graph that combines time-sensitive bursts with spatial correlation, significantly improving the retail end's ability to perceive and its robustness to high-concurrency traffic in complex transaction environments.

[0024] The specific steps of mapping the transaction object contained in the request to the target node in the retail knowledge graph are as follows: parsing the real-time business request to extract the unique identifier of the transaction object, and using the inverted index to retrieve the corresponding graph node in the retail knowledge graph; if the graph node has a combined product attribute, then traversing downwards according to the inclusion relationship edge in the graph to obtain all its associated atomic inventory nodes as the target node; otherwise, directly confirming the retrieved graph node as the target node.

[0025] After the retail knowledge graph is built, it enters the real-time operation stage. When a real-time business request is received, the request message is parsed to extract the unique identifier of the transaction object. This identifier corresponds to the product barcode or internal inventory code. The system does not traverse the entire graph, but uses a pre-built inverted index table with the extracted unique identifier as the search key to directly query and lock the corresponding graph node position in the in-memory graph database, thereby quickly completing the mapping from business data to graph data. After locking the graph node, read the node's attribute fields to determine its product type; if the attributes show that the node is a single basic product and there are no lower-level associations, directly confirm the retrieved graph node as the target node and use it as the input object for subsequent algorithms; The combined product attribute judgment process involves reading the attribute details of the currently retrieved graph node and checking the preset product structure type field. This field is written based on the product's bill of materials data during the graph construction phase and is used to distinguish between single products and composite products. If the value of this field indicates that the node belongs to the category of combination sets, promotional packages, or bundled sales, or if the graph topology detects that the node has outward-facing directed edges representing hierarchical affiliation, then the system determines that the graph node has combined product attributes. This identifies a complex object that is displayed as a single product at the sales level but needs to be broken down into multiple basic units for management at the inventory level, thereby triggering the subsequent downward traversal and atomic node extraction process. If the attribute shows that the node has the characteristics of combined products, starting from the node, traverse downwards along the preset containment relationship edges in the graph, and search for its associated child nodes layer by layer. This traversal process continues until all atomic inventory nodes that no longer contain lower-level child nodes are retrieved. All atomic inventory nodes found at the end of the path are summarized into a node set and confirmed as the final target node of this request, thereby ensuring that the concurrency control logic can accurately act on the actual affected physical inventory units. This embodiment utilizes an inverted index to achieve rapid location of transaction objects, significantly improving the response efficiency of the retail end in high-concurrency scenarios. At the same time, through the atomic traversal mechanism of combined products, the control granularity is precisely anchored to the physical inventory unit, effectively solving the problem of inconsistency between sales and inventory levels, avoiding overselling of combined products, and ensuring the real-time accuracy of inventory data.

[0026] The specific algorithm for incremental mining of dense subgraphs in streaming is as follows: Centered on the target node, related product nodes within the K-order neighborhood are extracted to construct a local product association network. The interaction strength matrix of the local product association network is initialized using the comprehensive edge weights in the retail knowledge graph. The current business request is mapped as a real-time transaction pulse signal, which is injected into the local product association network as a temporary strong correlation edge, and the transaction concurrency of each product node in the network is updated. A greedy stripping strategy based on retail popularity is executed in the local product association network to iteratively remove product nodes and their associated edges with transaction concurrency below a preset popularity threshold until the network node set is empty. If the network node set is not empty, the remaining high-popularity product node set is determined to constitute the retail entity aggregation cluster, and the average interaction density difference of the aggregation cluster before and after the injection of the transaction pulse signal is calculated. The difference is used as the marginal increment of the local topological edge density to determine the topological aggregation state of the target node.

[0027] After determining the target node, the streaming dense subgraph incremental mining algorithm is used to quickly locate high-risk concurrent regions within a local area. Using the determined target node as the central anchor point, all related product nodes within the second-order neighborhood are extracted outward to construct a local product association network. The local product association network does not contain all retail data, but only a local subset that has a direct or indirect relationship with the current transaction object. The pre-calculated comprehensive edge weights in the retail knowledge graph are read and these weight values ​​are filled into the local product association network to initialize and generate an interaction strength matrix, which digitally reflects the existing spatiotemporal correlation tightness between various product nodes in the local network before the current moment. The currently received real-time business request is mapped as a real-time transaction pulse signal. Logically, this transaction pulse signal is regarded as a temporary strong correlation edge and is forcibly injected into the aforementioned local product association network. Specifically, the autocorrelation weight of the target node or its connection weight with the core associated node is instantly increased to the maximum saturation value to simulate a surge in attention triggered by this transaction. With the injection of the pulse signal, the transaction concurrency of each product node in the network is updated in real time. The transaction concurrency is obtained by accumulating the connection weights of the node with all its neighboring nodes in the network, which is used to characterize the transaction activity of the product at the current instant. Within the local product association network, a greedy stripping strategy based on retail popularity is executed. First, the average transaction concurrency of all nodes in the current local network is calculated and set as a dynamic popularity threshold. The network is traversed to identify unpopular product nodes with transaction concurrency below the popularity threshold, and these nodes, along with their associated edges, are removed from the network. Since the removal of nodes will cause the connection weight of neighboring nodes to decrease, which in turn causes the concurrency of neighboring nodes to fall below the threshold, the above operations of calculating the threshold, identifying low-popularity nodes, and removing nodes and edges are repeated until the network node set is cleared. If the network node set is still non-empty after the above multiple rounds of stripping, then the remaining high-popularity product node sets are determined to constitute a retail entity aggregation cluster. The average interaction density of the retail entity aggregation cluster before and after the injection of the transaction pulse signal is calculated respectively. The average interaction density is obtained by calculating the ratio of the sum of the weights of all edges in the cluster to the theoretically maximum number of edges. The density value after the injection signal is subtracted from the density value before the injection signal, and the difference is the marginal increment of the local topological edge density. The marginal increment of the local topological edge density directly reflects whether the current transaction significantly increases the congestion of the local network. Based on this, the topological aggregation state of the target node is finally determined, providing a quantitative basis for subsequent judgment on whether to start the concurrency control mechanism. By applying a streaming dense subgraph incremental mining algorithm, which replaces global traversal by calculating the marginal increment of local topological edge density and combining it with a greedy stripping strategy, millisecond-level accurate location of high-concurrency risk areas is achieved. This method can effectively quantify the immediate impact of a single transaction on network congestion, avoid unnecessary resource locking, and significantly improve the real-time response capability and overall throughput of the system with extremely low computational overhead.

[0028] The specific process of the topological aggregation state of the target node is as follows: Obtain the set of inventory objects covered by the currently executed inventory operation, and calculate the intersection of the retail entity cluster and the set of inventory objects; If the intersection is not empty and the marginal increment of the local topological edge density is greater than a preset increment threshold, it indicates that there are associated nodes in the retail entity aggregation cluster affected by the inventory operation, and the topological aggregation state of the target node is determined to be the mixed concurrent state.

[0029] After determining the retail entity clusters and the marginal increments of local topological edge density using the aforementioned algorithm, all currently executing inventory instructions are obtained through the background task interface. The unique identifiers of the products in the inventory lock state are parsed and extracted to form an inventory object set. Each product node in the retail entity cluster is matched and retrieved with the inventory object set to calculate the intersection of the two. As long as any node in the cluster falls within the scope of the inventory object set, the intersection is determined to be non-empty. This clarifies the spatial overlap between transaction hotspots and physical inventory operations. Based on this, the calculated marginal increment value of the local topology edge density is further compared with a preset increment threshold. If a non-empty intersection is detected, and the marginal increment value is strictly greater than the preset threshold, it indicates that the current transaction not only involves inventory counting but also causes significant congestion impact on the local network. At this point, it is determined that there are associated nodes affected by inventory counting within the retail entity aggregation cluster, officially confirming that the topology aggregation state of the target node is a mixed concurrent state where inventory counting operations and sales transactions coexist, thereby triggering the subsequent inventory time sharding mirror control process. By performing intersection operations between retail entity clusters and inventory object sets, and combining this with threshold verification of local topological edge density margin increments, a dual risk identification mechanism of spatial overlap and congestion intensity is constructed. This mechanism accurately determines whether transaction behavior has substantially intruded into the inventory operation domain and caused network congestion, effectively avoiding the situation where complex control logic is mistakenly triggered due to slight correlations, and ensuring that the inventory mirroring mechanism is activated only in truly high-risk mixed concurrency scenarios.

[0030] The inventory time-segmented mirror, which includes the baseline inventory domain and the dynamic incremental domain, is as follows: Use atomic operations to lock the current system time as the anchor point for retail concurrency control logic; Configure the baseline inventory domain as a static management partition, freeze and store the static inventory snapshot at the time of the retail concurrency control logic anchor point; Configure the dynamic incremental domain as a dynamic transaction partition and map it to the lock-free circular buffer; append records of inventory deduction requests and transaction offsets that occur after the retail concurrency control logic anchor point; calculate the real-time sum of the static inventory snapshot and the accumulated transaction offsets in the lock-free circular buffer as the virtual inventory level.

[0031] After the topological aggregation state of the target node is confirmed to be a mixed concurrent state, the inventory time sharding and mirroring mechanism is initiated. Logically, a single physical inventory is separated into two parallel processing domains that do not interfere with each other. An atomic locking operation based on underlying hardware instructions is executed to accurately capture the current clock time point and solidify it as the retail concurrency control logic anchor point. The anchor point, as an absolute dividing line on the time axis, strictly defines the static historical state and dynamic future flow of inventory data, ensuring the time consistency of concurrency control. Through time sharding and mirroring and atomic locking anchor points, a single inventory resource is decoupled into parallel domains that do not interfere with each other, realizing strict isolation between static historical data and dynamic business flow, effectively eliminating read-write race conditions under high concurrency, and achieving zero-downtime parallel processing of retail business while ensuring strong data consistency.

[0032] Based on the logical anchor point, a baseline inventory domain is configured and set as a static management partition with read-only attributes. Within this partition, the inventory data at the anchor point moment is frozen immediately, generating and persistently storing a static inventory snapshot. The snapshot fully preserves the book inventory status at the moment the inventory count begins, remaining absolutely static throughout the entire inventory count cycle and unaffected by any subsequent new transactions. This provides a stable and unchanging verification benchmark for offline physical inventory count operations, eliminating inventory count discrepancies caused by data changes. A parallel configuration of the dynamic incremental domain is defined as a dynamic transaction partition specifically for handling real-time business, and a lock-free circular buffer is allocated in memory to map it. The buffer adopts a first-in-first-out circular queue structure and is specifically used to temporarily store data written at high frequency. All inventory deduction requests that arrive after the retail concurrency control logic anchor point will no longer directly modify the inventory records in the database, but will be converted into signed values ​​and sequentially appended to the lock-free circular buffer as transaction offsets. To enhance concurrency safety, a lock-free circular buffer is used, employing a versioning mechanism. Each write operation not only updates the write pointer but also adds an associated version number. During reads, the version number is checked against the expected value; if they do not match, the read operation is restarted. The buffer size is set to 2n to ensure it can accommodate at least 5 minutes of peak transactions. Capacity requirements are pre-calculated during initialization to prevent buffer overflow during runtime. If the expected peak exceeds the initial capacity, an expansion mechanism is employed. To ensure continuity at the retail level, real-time available inventory data, or virtual inventory level, needs to be provided to the transaction end. The calculation logic involves reading the static inventory snapshot value from the baseline inventory domain in real time and performing a real-time digital summation with all accumulated transaction offsets within the unlocked circular buffer. The result is the theoretically available remaining inventory for sale at the current moment. In this way, while static inventory checks are performed in the background, the front end can still respond to user purchase requests normally based on the accurate virtual inventory level, achieving perfect data-level isolation and seamless business-level integration between inventory checks and sales. By constructing a time-sharded inventory mirror containing a baseline inventory domain and a dynamic incremental domain, and establishing logical anchors using atomic operations, the static baseline inventory data and dynamic incremental sales data are physically isolated. This mechanism can maintain the stability of the baseline inventory domain while using the lock-free circular buffer of the dynamic incremental domain to respond to high-frequency sales deduction requests in real time, and maintain business continuity by calculating virtual inventory levels. It completely solves the data read / write conflict problem in the scenario of simultaneous inventory counting and sales, and significantly improves concurrent throughput while ensuring eventual consistency of inventory data.

[0033] After the inventory count is completed, the transaction offset of the lockless circular buffer is compensated and merged with the physical inventory count data using a time-series alignment algorithm, the final inventory calibration value is calculated and the inventory database is atomically updated. The timing alignment algorithm defines a dynamic statistical interval for the unlocked circular buffer based on the generation time of the logical anchor point and the physical inventory data. Summarize all transaction offsets recorded in the unlocked circular buffer within the dynamic statistical interval to obtain the total dynamic turnover during the inventory count; superimpose the total dynamic turnover with the static inventory snapshot within the benchmark inventory count domain to derive the theoretical inventory value of the system; compare the physical inventory count data with the theoretical inventory value of the system, and use the calculated difference value as the final inventory calibration value; The final inventory calibration value is applied to the inventory database for non-blocking calibration updates; Specifically, once all offline physical inventory operations are completed and the physical inventory data uploaded from the inventory terminal is received, a time-series alignment algorithm is activated to resolve dynamic data discrepancies caused by concurrent sales during the inventory period. First, the retail concurrency control logic anchor point set in the previous stage is read; this anchor point records the precise start time of the inventory. Simultaneously, the timestamp generated when the physical inventory data was uploaded is extracted. Using these two time points as the start and end boundaries, a dynamic statistical interval is precisely defined on the timeline; this interval covers the entire time period from the start to the end of the inventory. Access the unlocked circular buffer in the dynamic incremental domain, and retrieve and summarize all inventory deduction requests and corresponding transaction offsets recorded within the defined dynamic statistical interval. The system accumulates these transaction offsets to obtain a summary value, which is the total dynamic turnover during the inventory count, representing the total inventory changes generated by online operations while inventory personnel are conducting physical counting. Extract the frozen static inventory snapshot from the baseline inventory domain, and superimpose the snapshot value with the calculated total dynamic turnover to derive the system's theoretical inventory value, representing the value that the inventory database should present at the end of the inventory count, assuming no inventory count errors or losses. The actual physical inventory data collected is compared with the derived theoretical inventory value of the system, and the difference between the two is calculated, which is the final inventory calibration value. This eliminates the interference of inventory changes caused by normal sales during the inventory period. After obtaining the final inventory calibration value, a non-blocking calibration update command is initiated to the core inventory database, and the calibration value is directly applied to the current database record. In this way, the accurate calibration of the inventory data is completed without blocking the current real-time transaction write.

[0034] By employing a time-series alignment algorithm, the theoretical inventory value of the system is derived by summarizing the transaction offset within the dynamic statistical interval and superimposing it with the static snapshot, accurately eliminating data interference from sales operations during the inventory count. The final inventory calibration value calculated in this way can truly reflect non-transactional differences and update the inventory database in a non-blocking manner, ensuring that business continuity is maintained and the system data and physical goods are accurately consistent even in a high-concurrency environment without interruption.

[0035] This application constructs a spatiotemporal interactive entropy knowledge graph and applies a streaming dense subgraph incremental mining algorithm to achieve millisecond-level accurate identification of high-risk mixed concurrent states without traversing the global graph. Based on this, an inventory time-sharding mirroring mechanism is introduced, utilizing the logical isolation between the baseline inventory domain and the dynamic incremental domain, along with a lock-free circular buffer to process real-time transactions, resolving the read-write conflict problem in scenarios where inventory is being conducted while sales are taking place simultaneously. Finally, dynamic compensation is achieved by combining a time-series alignment algorithm, ensuring zero business interruption and high concurrency throughput while realizing high-precision consistency calibration between the inventory database and the physical inventory.

[0036] Example 2:

[0037] This embodiment is built upon a specific scenario of a large chain supermarket during a weekend promotional peak. The system hardware includes servers deployed in the cloud, edge computing nodes within the store, and handheld PDA inventory terminals used by staff. This embodiment focuses on demonstrating how to handle a large influx of mixed checkout requests at the cashier while inventory operations are being conducted in the beverage section. (See also...) Figure 3 ; During the system initialization phase, the knowledge graph module first retrieves the supermarket's historical transaction logs from the past six months, performs structured parsing of the logs, and extracts 330ml of cola and 500ml of orange juice. A spatiotemporal interaction entropy weighted algorithm is used to construct the knowledge graph: In the time dimension, the system identifies the weekend period from 18:00 to 20:00 as a high-frequency transaction time window, and calculations show that the 330ml cola has an extremely high transaction frequency during this window, resulting in a low negative logarithmic expectation, i.e., a high time fluctuation entropy value; in the spatial dimension, it identifies that the 330ml cola often co-occurs with large bags of potato chips under the same serial number, calculating a high spatial association entropy value. The system introduces a spatiotemporal coupling factor based on the current promotional load, nonlinearly weighting and fusing the two to generate comprehensive edge weights, constructing a retail knowledge graph that reflects real purchasing habits and clearly defining the high-strength association between beverages and snacks. When a scan request containing a 330ml can of cola is received from the cashier, the topology aggregation module responds immediately, mapping the request to a target node in the graph. The system applies a streaming dense subgraph incremental mining algorithm to extract a K-order neighborhood centered on the 330ml can of cola. At this point, the system calculates the marginal increase in local topological edge density caused by the node's access and finds that the increase is sudden. After a greedy stripping strategy, the remaining set of high-popularity nodes (beverage-snack clusters) has a non-empty intersection with the set of beverage items being inventoried by the PDA terminal. Given that the density increase is greater than a preset threshold, the module determines that the current state is a mixed concurrent state of inventory operations and sales transactions, and special control needs to be initiated immediately. After confirming the mixed concurrent state, the concurrency control module immediately constructs an inventory time-sharded mirror; the system uses atomic operations to lock the current time (19:00:00 in this embodiment) as the anchor point for retail concurrency control logic. At this moment, the system freezes the database inventory of 330ml Coca-Cola (100 bottles in this embodiment) and stores it in the baseline inventory field as a static snapshot for inventory personnel to verify. At the same time, a dynamic incremental field is configured and mapped to a lock-free circular buffer in memory. All sales deduction requests for Coca-Cola that occur after 19:00:00 (5 bottles sold at the cashier) will no longer modify the database, but will be written sequentially to the circular buffer as transaction offsets (-1, -1, -3...). At this time, the virtual inventory level queried by the front end is calculated in real time (95) by the static snapshot (100) and the cumulative offset of the buffer (-5), ensuring that the sales business is not affected by the inventory lock and achieving zero-blocking sales; When staff complete the inventory count and upload the physical inventory data at 19:30 (assuming a physical count of 94 bottles, implying a possible loss or error of 1 bottle), the inventory update module intervenes. Using a time-series alignment algorithm, it defines a dynamic statistical interval from the logical anchor point (19:00:00) to the inventory data generation time (19:30:00). It then summarizes all transaction offsets within this interval in the unlocked circular buffer to obtain the total dynamic turnover (20 bottles sold). The system overlays the total dynamic turnover (-20) with the static snapshot (100) of the baseline inventory domain to derive the theoretical inventory value (80 bottles). It compares the physical inventory data with the theoretical inventory value (80), calculates the difference (-1) as the final inventory calibration value, and atomically applies this calibration value to the inventory database, completing the inventory correction without stopping business operations. By constructing a time-sharded inventory mirror containing a baseline inventory domain and a dynamic incremental domain, and using a lock-free circular buffer to isolate read and write conflicts, the system achieves non-blocking hybrid concurrency of inventory operations and sales operations, completely solving the technical problem of business interruption or data inconsistency caused by inventory in the traditional retail model. At the same time, by combining the spatiotemporal interaction entropy weighted algorithm and the streaming dense subgraph incremental mining algorithm, the system can accurately locate high-risk topology clusters in milliseconds without traversing the global graph, ensuring business continuity and eventual consistency of inventory data in high-frequency trading scenarios with extremely low computational overhead.

[0038] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for online management of retail end based on concurrency control, characterized in that, The application comprises the following steps: acquiring a historical transaction log of a retail end, and constructing a retail knowledge graph based on the historical transaction log by using a spatio-temporal interaction entropy weighting algorithm; in response to a real-time business request, mapping the real-time business request to a target node in the retail knowledge graph, applying a streaming dense subgraph incremental mining algorithm to calculate a local topology edge density marginal increment caused by access of the target node, mining a retail entity aggregation cluster without traversing the global graph, and determining a topology aggregation state of the target node; if the topology aggregation state is identified as a mixed concurrent state in which a check operation coexists with a sales transaction, constructing an inventory time-sliced mirror image including a benchmark check domain and a dynamic incremental domain for concurrent control; during the check, writing an inventory deduction request to a lock-free ring buffer in the dynamic incremental domain, and updating a virtual inventory level in real time; after the check is completed, using a time sequence alignment algorithm to compensate and combine transaction offsets of the lock-free ring buffer with physical check data, calculating a final inventory calibration value, and atomically updating an inventory database.

2. The concurrent control based retail end online management method according to claim 1, wherein, The specific process of constructing the retail knowledge graph based on the historical transaction log by using the spatio-temporal interaction entropy weighting algorithm comprises the following steps: structurally analyzing the historical transaction log, extracting retail commodity nodes and actual transaction association edges thereof, and constructing an initial unweighted graph; the spatio-temporal interaction entropy weighting algorithm comprises a time dimension and a space dimension; the time dimension is to divide a transaction time axis into discrete time sliding windows, to statistically calculate transaction frequency distribution probabilities of each commodity entity node in different time windows, to calculate a negative logarithm expectation of transaction time dispersion by using a Shannon entropy formula, and to obtain a time fluctuation entropy value; the space dimension is to identify a commodity co-occurrence relationship under a same transaction serial number, to calculate a conditional co-occurrence probability of a target node relative to an associated node, and to calculate a spatial association entropy value based on the conditional co-occurrence probability; a spatio-temporal coupling factor is introduced to nonlinearly weight and fuse the time fluctuation entropy value and the spatial association entropy value, to obtain a comprehensive edge weight of the actual transaction association edge, and to assign the comprehensive edge weight to the initial unweighted graph, thereby constructing the retail knowledge graph.

3. The concurrent control based retail end online management method as claimed in claim 1, wherein, The specific process of mapping the real-time business request to the target node in the retail knowledge graph comprises the following steps: analyzing the real-time business request to extract a unique identification code of a transaction object, and using an inverted index to search a corresponding graph node in the retail knowledge graph; if the retail knowledge graph node has a combined commodity attribute, then traversing downward according to an inclusion relationship edge in the retail knowledge graph to obtain all atomic inventory nodes associated therewith as the target node; 4. The concurrent control based retail end online management method as claimed in claim 1, wherein, otherwise, directly confirming the searched graph node as the target node. The specific process of the streaming dense subgraph incremental mining algorithm comprises the following steps: taking the target node as the center, extracting associated commodity nodes within a K-order neighborhood range to construct a local commodity association network, and initializing an interaction intensity matrix of the local commodity association network by using the comprehensive edge weight in the retail knowledge graph; Map the real-time business request to a transaction pulse signal, inject the transaction pulse signal as a temporary strong correlation edge into the local commodity correlation network, and update the transaction concurrency of each commodity node in the network; execute a retail heat-based greedy stripping strategy in the local commodity correlation network, iteratively remove commodity nodes and their associated edges whose transaction concurrency is lower than a preset heat threshold, until the network node set is empty; If the network node set is not empty, determine that the remaining high-heat commodity node set constitutes the retail entity aggregation cluster, and calculate the average interaction density difference of the retail entity aggregation cluster before and after the injection of the transaction pulse signal. The average interaction density difference is used as the local topological edge density marginal increment to determine the topological aggregation state of the target node.

5. The concurrent control based retail end online management method according to claim 4, wherein, The specific process of determining the topological aggregation state of the target node is: Obtain the set of inventory objects covered by the currently executed inventory job, and calculate the intersection of the retail entity aggregation cluster and the set of inventory objects; If the intersection is not empty and the local topological edge density marginal increment is greater than a preset increment threshold, it indicates that there are correlation nodes in the retail entity aggregation cluster that are affected by the inventory job, and then it is determined that the topological aggregation state of the target node is the mixed concurrency state.

6. The concurrent control based retail end online management method as claimed in claim 1, wherein, The inventory time-slicing mirror containing the reference inventory domain and the dynamic increment domain is: Use atomic operation to lock the current system time as a retail concurrency control logic anchor point; Configure the reference inventory domain as a static management partition, freeze and store the static inventory snapshot at the time of the retail concurrency control logic anchor point; Configure the dynamic increment domain as a dynamic transaction partition and map it to the lock-free ring buffer; append the inventory deduction request and transaction offset that occur after the retail concurrency control logic anchor point; calculate the real-time sum of the static inventory snapshot and the accumulated transaction offset in the lock-free ring buffer as the virtual inventory level.

7. The concurrent control based retail end online management method as claimed in claim 1, wherein, The time sequence alignment algorithm defines the dynamic statistical interval for the lock-free ring buffer based on the generation time of the logic anchor point and the physical inventory data; Sum up all the transaction offsets recorded in the lock-free ring buffer within the dynamic statistical interval to obtain the total amount of dynamic flow during the inventory period; Superimpose the dynamic flow total amount and the static inventory snapshot in the reference inventory domain to obtain the system theoretical inventory value; Compare the physical inventory data with the system theoretical inventory value to calculate the difference value as the final inventory calibration value; Apply the final inventory calibration value to the inventory database for non-blocking calibration update.

8. A retail end online management system based on concurrent control, characterized in that, It includes: Knowledge graph module: obtain the historical transaction log of the retail end, and construct a retail knowledge graph based on the historical transaction log using a spatio-temporal interaction entropy weighting algorithm; Topology aggregation module: in response to a real-time business request, map the real-time business request to a target node in the retail knowledge graph, apply a streaming dense subgraph increment mining algorithm to calculate the local topological edge density marginal increment caused by the target node, mine a retail entity aggregation cluster without traversing the global graph, and determine the topological aggregation state of the target node; The concurrent control module: if the topology aggregation state is identified as a mixed concurrent state in which the inventory check operation and the sales transaction coexist, a concurrent control is performed on the inventory time-sliced mirror image including the benchmark inventory domain and the dynamic increment domain; During the inventory check, the inventory deduction request is written into the lock-free ring buffer of the dynamic increment domain, and the virtual inventory level is updated in real time; The inventory updating module: after the inventory check is completed, the transaction offset of the lock-free ring buffer is compensated and merged with the physical inventory data by using the time alignment algorithm, the final inventory calibration value is calculated, and the inventory database is atomically updated.

Citation Information

Cited By

  • Medical consumable inventory abnormity early warning method based on artificial intelligence

    CN121920933A

  • Artificial intelligence-based medical consumable inventory anomaly early warning method

    CN121920933B