Number card distribution system based on message middleware
By adopting a distributed architecture based on message middleware and a data sharding storage mechanism, the data security and regional management issues of the SIM card distribution system are solved, the system stability and data security are improved, the accurate prediction of SIM card demand is achieved, and the sales strategy is guided.
Patent Information
- Application Number
- CN202511296624.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-12-26
AI Technical Summary
The existing SIM card distribution system has problems such as high data storage security risks and low efficiency of regional management. Centralized storage is susceptible to single point of failure and lacks distributed partitioning and fine-grained permission control, resulting in a high risk of sensitive data leakage.
It adopts a message middleware-based distributed architecture, realizes asynchronous communication and data transmission through a distributed message middleware cluster, combines a data sharding storage mechanism and a threshold secret sharing algorithm, uses an intelligent routing engine to process messages according to priority, and performs demand prediction through a federated learning framework.
It improves system stability and risk resistance, reduces the risk of data corruption caused by a single node failure, enhances data security and management flexibility, enables accurate prediction of SIM card demand, guides sales strategy formulation, and reduces inventory imbalance.
Smart Images

Figure CN121213136A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of system management, specifically a SIM card distribution system based on message middleware. Background Technology
[0002] With the rapid development of the telecommunications industry, SIM cards, as a basic communication carrier, have seen their distribution business coverage expand continuously. The number of agent levels, regional data volume, and user scale involved have continued to grow, placing higher demands on the operational efficiency, data security, and scientific decision-making of SIM card distribution systems.
[0003] Existing SIM card distribution systems generally employ a centralized data storage mechanism, storing distribution data across the entire region on a few core nodes. This model presents two major risks: First, if a single storage node experiences a hardware failure or network attack, it could lead to the unavailability or leakage of all data across the region, with data recovery being difficult and time-consuming, directly threatening business continuity and user privacy. Second, centralized storage is ill-suited to the needs of regional business management; distribution data from different regions is stored in a mixed manner, requiring regional administrators to retrieve local data across nodes, a cumbersome and inefficient process. Furthermore, existing systems employ limited methods for protecting sensitive data, relying primarily on simple encryption and lacking distributed partitioning and fine-grained access control, resulting in a high risk of sensitive data leakage. Summary of the Invention
[0004] This application provides a SIM card distribution system based on message middleware, which solves the technical problem of high data storage security risks in existing SIM card distribution systems.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, a message middleware-based SIM card distribution system is provided, comprising:
[0007] The message hub module is used to process asynchronous communication and data transmission within the system using a distributed message middleware cluster.
[0008] The data security module is used to manage distribution data in various regions using a data sharding storage mechanism; the distribution data includes user identity information, product order records, commission settlement details, and agent hierarchy relationships.
[0009] The demand forecasting module is used to predict the demand for SIM cards in the next period based on sales data and demographic data of each region; the demand for SIM cards is used to guide the formulation of sales strategies for the next period.
[0010] Based on the above technical solutions, the message middleware-based SIM card distribution system provided in this application achieves asynchronous communication and distributed processing through a message hub module composed of a distributed message middleware cluster. This effectively solves the communication congestion problem in high-concurrency scenarios and improves system stability and risk resistance. The data security module adopts a regionalized data sharding storage mechanism, which reduces the risk of data corruption due to a single node failure and facilitates regionalized management and access control, enhancing data security and management flexibility. The demand forecasting module integrates regional sales data and demographic data to achieve accurate forecasting of SIM card demand, effectively guiding sales strategy formulation, reducing inventory imbalance, and improving resource utilization and market response speed.
[0011] Furthermore, the asynchronous communication and data transmission within the distributed message middleware cluster processing system includes:
[0012] Build a distributed message middleware cluster based on Apache Kafka, and configure multiple topic partitions to handle messages from different business types and sales regions respectively;
[0013] The intelligent routing engine identifies the business type and sales area label of the input message, and transmits messages of different priorities to the corresponding topic partitions for processing according to preset priority rules.
[0014] Furthermore, the step of transmitting messages of different priorities to corresponding topic partitions for processing according to preset priority rules includes:
[0015] Messages are divided into first priority and second priority according to preset priority rules; among which,
[0016] In the topic partition corresponding to the first priority message, a synchronous confirmation transmission mechanism is used to process the message; the synchronous confirmation mechanism means that after the producer sends a message, it will execute subsequent business operations only after receiving a confirmation signal that the message has been successfully written to all synchronous replicas in the distributed message middleware cluster.
[0017] In the topic partition corresponding to the second priority message, the message is processed using a batch asynchronous processing mechanism. The batch asynchronous processing mechanism means that the producer puts the message into the local buffer. When the preset number or preset time interval is reached, the producer sends the messages in the local buffer to the message middleware cluster in batches. After the message is sent, there is no need to wait for the message middleware cluster to return an acknowledgment signal before subsequent business operations can be performed.
[0018] The producer refers to the business function module within the system that generates messages to be transmitted, including but not limited to the inventory management module, the demand forecasting module, and additional order management and commission settlement modules within the system. The business function module converts business data into data packets conforming to the Apache Kafka cluster message format through a preset message encapsulation interface, and then sends a message request to the distributed message middleware cluster.
[0019] Furthermore, the messages of the first priority include, but are not limited to, order creation messages, commission settlement messages, and inventory change messages;
[0020] Second priority messages include, but are not limited to, operation log messages, behavior tracking messages, and batch report messages;
[0021] Furthermore, the first priority is higher than the second priority.
[0022] Furthermore, the data sharding storage mechanism includes:
[0023] A data sharding strategy based on agent level and sales region is adopted to store distribution data on agent nodes under the directly associated sales region;
[0024] The threshold secret sharing algorithm is used to divide sensitive data into multiple data fragments, and the data fragments are distributed and stored in agent nodes in different sales regions; the sensitive data is the privacy fields in the user's identity information, including ID card number, mobile phone number and bank card number.
[0025] Furthermore, the use of a threshold secret sharing algorithm to segment sensitive data into multiple data fragments includes:
[0026] After converting the segmented sensitive data S into values over the prime field GF(p), a polynomial f(x) of degree k-1 is constructed; the prime field GF(p) represents a finite field containing p elements (all arithmetic operations are performed modulo p), and k represents the minimum number of fragments required to recover the original sensitive data.
[0027] Assign a unique identifier index x to each proxy node i And calculate the data fragments (x) of each proxy node according to the polynomial. i ,y i ); where y i =f(x) i ), 1≤i≤n, where n represents the total number of data fragments, and n≥k;
[0028] The data fragments are transmitted and stored separately to agent nodes in n different sales regions through a secure channel, with each agent node holding only a unique data fragment.
[0029] Furthermore, the expression for the polynomial is: f(x) = S + a1x + a2x 2 +…+a k-1 x k-1 (mod p), where the coefficients a1, a2, ..., a k-1 It is an integer randomly selected over the prime field GF(p).
[0030] Furthermore, when the authorization requester requests access to the sensitive data, the data fragments collected from at least k different proxy nodes are processed using the Lagrange interpolation formula, a k-1 degree polynomial is reconstructed based on the k data fragments, and the original sensitive data is recovered by calculating f(0) = S.
[0031] Furthermore, the data security module includes an encryption unit, a data fragmentation storage unit, a dynamic key management unit, and an access auditing unit; wherein,
[0032] The encryption unit is used to encrypt sensitive data by binding it with a preset access policy using an attribute-based encryption algorithm, thereby ensuring the confidentiality of the data during storage and transmission. The preset access policy is: sensitive data can be accessed only when a preset number of data fragments are obtained and the proxy initiating the request passes the authentication and access permission authorization.
[0033] The data sharding storage unit is used to distribute sensitive data across different proxy nodes using a data sharding storage mechanism, thereby achieving decentralized data management and privacy protection.
[0034] The dynamic key management unit is used to generate a temporary session key for each data access, and the key expires immediately after the access ends to prevent security risks caused by key reuse.
[0035] The access audit unit is used to record data access behavior and send the data access behavior to the audit log center for centralized storage and analysis through message middleware, so as to realize full traceability and tamper-proof audit tracking; the data access behavior includes visitor identity, access time, accessed data object and operation type.
[0036] Furthermore, the prediction of SIM card demand for the next period based on sales data and demographic data of each region includes:
[0037] A federated learning framework is constructed, which distributes global model parameters to each sales region through a message hub module. The global model parameters represent the core features of the prediction model maintained by the central server, including the weight matrix, bias vector, model structure, and hyperparameters of each layer of the neural network.
[0038] At each sales region node, a local prediction model is trained using historical sales data and demographic data based on deep learning algorithms. The sales data includes, but is not limited to, SIM card packages and user profiles of those who purchase products. The user profiles include age ranges, genders, and data traffic usage preferences. The demographic data includes, but is not limited to, the age distribution of the population in the sales region, the gender ratio of the population, and the number of people corresponding to different genders and age groups.
[0039] The regional sales data and demographic data from the previous period are input into the trained local prediction model to obtain the demand for different SIM card packages in the next period.
[0040] Furthermore, the federated learning framework is used for distributed model training and inference for cross-regional SIM card demand forecasting, enabling collaborative optimization of the global model without requiring sales regions to operate locally. The specific workflow of the federated learning framework includes:
[0041] S1. Initialize global model parameters and encrypt and distribute them to each sales region node. The global model parameters include the weight matrix, bias vector, activation function type and hyperparameters of each layer of the neural network.
[0042] S2, after receiving the global model parameters, each sales region node trains the model based on the locally preprocessed sales data and demographic data, and generates the local model parameter update volume;
[0043] S3, each sales region node encrypts the local model parameter update and transmits it to the central server through the secure communication channel of the message hub module; the encryption process uses a homomorphic encryption algorithm to ensure the confidentiality of the parameter transmission process;
[0044] S4, the central server uses an adaptive weighted aggregation algorithm to aggregate the parameter updates of all sales region nodes to generate new global model parameters; the adaptive weighted aggregation algorithm dynamically allocates aggregation weights based on the proportion of data volume in each region, historical prediction accuracy, and feature importance.
[0045] S5, the central server encrypts and distributes the updated global model parameters to each sales region node. Each node replaces the local model parameters and repeats S2-S4 until the model reaches the preset convergence condition. The convergence condition includes the global loss function value being lower than a threshold, the parameter change being less than a set value for N consecutive iterations, or the maximum number of training rounds being reached.
[0046] S6. When the convergence condition is met, the central server will distribute the final global model parameters to each sales region node. Each node will predict the demand for SIM cards in the next cycle based on the locally deployed prediction model and feed the prediction results back to the decision center through the message hub module.
[0047] Furthermore, the local prediction model includes a feature embedding module, a spatiotemporal feature extraction module, an attention fusion module, a federated learning adaptation module, and a multi-task prediction output module; wherein,
[0048] The feature embedding module is used to standardize and transform the input features, mapping discrete features, continuous features, and time features to a feature space of a unified dimension to obtain an initial feature matrix. The discrete features include user gender, package type, user age group label, and region code. The continuous features include average spending per person, historical data usage, regional population density, and sales growth rate. The time features include period index, month identifier, number of days since the last promotion, and quarterly period code.
[0049] The spatiotemporal feature extraction module is used to extract the time-dependent features and spatial correlation features between sales regions of the initial feature matrix, and to fuse the time-dependent features and spatial correlation features through feature concatenation operation to obtain spatiotemporal interaction features.
[0050] The attention fusion module is used to dynamically assign weights and enhance features of spatiotemporal interaction features. By calculating feature importance scores, the influence of key features is strengthened, and an optimized fusion feature vector is obtained.
[0051] The federated learning adaptation module is used to perform local feature enhancement, parameter update calculation, and parameter encryption on the fused feature vector to obtain the encrypted and compressed local model parameter update amount; the parameter update amount is transmitted to the central server through the message hub module to participate in global aggregation, and receives the global parameter update local model issued by the central server.
[0052] The multi-task prediction output module is used to perform multi-dimensional prediction tasks based on the feature representation enhanced by the federated learning adaptation module, and outputs a comprehensive result including total demand, package type distribution and prediction confidence.
[0053] Furthermore, the internal workflow of the feature embedding module includes:
[0054] Discrete feature processing: One-hot encoding is performed on the discrete features to obtain a binary matrix of dimension n×k; where n represents the number of samples in the training dataset and k represents the cardinality of the discrete features;
[0055] The binary matrix is mapped into a discrete feature vector matrix through an embedding layer;
[0056] Continuous feature processing: Continuous features are standardized to obtain an n×c standardized matrix; the formula for the standardization process is: Where x represents the original data value of feature x, x' represents the processed standard data, median(x) represents the median of feature x in the training dataset, and IQR(x) represents the interquartile range of feature x in the training dataset;
[0057] The normalized matrix is mapped to a continuous eigenvector matrix through a linear transformation;
[0058] Temporal feature processing: The temporal features are periodically encoded to obtain a multi-scale temporal feature matrix; the formula for the periodic encoding is: in, This represents the sinusoidal time feature component at the i-th scale. Let i represent the cosine time feature component at the i-th scale, i = 0, 1, ..., d t / 2-1,d t This indicates the embedding dimension of the time feature, where t is the time step index;
[0059] A time feature vector matrix is obtained by fusing multi-scale time feature matrices through a gating mechanism.
[0060] The discrete feature vector matrix, the continuous feature vector matrix, and the time feature vector matrix are concatenated dimensionally to obtain the initial feature matrix.
[0061] Furthermore, the internal workflow of the spatiotemporal feature extraction module is as follows:
[0062] Using the initial feature matrix as input, the feature vector F corresponding to each time step t is obtained by splitting it according to the time step. init (t);
[0063] The feature vector F is processed using an improved GRU model. init (t), by introducing a gating mechanism of feature importance scores and their adaptive weights, the hidden state at each time step is iteratively calculated to generate a time-dependent feature sequence;
[0064] A regional adjacency matrix containing regional geographical distance and economic correlation coefficients is constructed. The initial feature matrix is sliced by time step and then input into a graph convolutional network to learn the spatial interaction rules between regions and obtain spatial correlation features.
[0065] The time-dependent feature sequence and spatial correlation feature are aligned and concatenated according to time steps to obtain the spatiotemporal interaction feature matrix.
[0066] Furthermore, the internal workflow of the attention fusion module is as follows:
[0067] Using the spatiotemporal interaction feature matrix as input, the importance score of a single feature dimension in the spatiotemporal interaction feature matrix is calculated by a multilayer perceptron.
[0068] Based on the importance scores, softmax normalization is performed to obtain feature-level weights;
[0069] A time decay factor is set based on historical periodic patterns to obtain time period weights;
[0070] Calculate the regional difference weights based on the historical prediction errors of each region;
[0071] The spatiotemporal interaction features are weighted and summed by multiplying the feature-level weights, time period weights, and regional difference weights to obtain the optimized fusion feature vector.
[0072] Furthermore, the internal workflow of the federated learning adaptation module is as follows:
[0073] Using the fused feature vector and the global model parameters issued by the central server as input, the region-specific feature vector is linearly transformed and activated, and then superimposed with the fused feature vector to generate local enhanced features; the region-specific feature vector refers to features that reflect the individual attributes of the sales region, including but not limited to the proportion of various types of packages in the sales region, the density of regional competitors, etc.
[0074] The loss function is constructed based on the real labels of the local training data, and the parameter update amount of the local model is calculated by gradient descent.
[0075] The parameter update amount is subjected to Top-K sparsity and 8-bit quantization, and then encrypted using a homomorphic encryption algorithm to obtain the encrypted and compressed parameter update amount;
[0076] The system receives global parameter updates, updates the local model using a weighted fusion strategy, and transmits the encrypted and compressed parameter updates to the central server for global aggregation.
[0077] Furthermore, the internal workflow of the multi-task prediction output module is as follows:
[0078] Using the local enhanced features as input, the total demand for SIM cards in the next cycle is calculated through a fully connected network with a regression branch;
[0079] The demand percentage of each package type is calculated using the softmax function of the classification branch, and the specific demand of each package is obtained by combining the total demand.
[0080] The Monte Carlo dropout method is used to repeat the prediction multiple times, and the mean and standard deviation of the prediction results are calculated to generate confidence intervals.
[0081] Output the total demand, the demand for each package, and the confidence interval.
[0082] Secondly, a SIM card distribution device based on a message middleware is provided, comprising: a communication unit and a processing unit; wherein,
[0083] The communication unit is used to realize asynchronous communication and data transmission within the device and between the device and various sales area nodes and agent nodes by relying on a distributed message middleware cluster. Specifically, it includes receiving sales data, population statistics data, and distribution data uploaded by each region, distributing global model parameters, encrypted sensitive data fragments, and audit log information to each region, and routing messages of different business types to the corresponding topic partitions based on preset priority rules, and transmitting encrypted data fragments and model parameter update amounts through a secure channel to ensure confidentiality and stability during data transmission.
[0084] The processing unit is used to implement the core business logic processing of the distribution system, including using a data sharding storage mechanism to regionally split and manage the received distribution data, using a threshold secret sharing algorithm to segment sensitive data and coordinate the distributed storage of data fragments, using a federated learning framework combined with deep learning algorithms to train a local prediction model to predict the demand for SIM cards in the next cycle, recording and auditing data access behavior, generating temporary session keys and invalidating them after the access ends, and also prioritizing messages and using corresponding synchronous confirmation or batch asynchronous processing mechanisms to provide core computing support for the secure and efficient operation of SIM card distribution.
[0085] Thirdly, this application provides a SIM card distribution device based on a message middleware, comprising: a processor and a storage medium; the storage medium includes instructions, and the processor is used to execute the instructions to implement the method described in the first aspect and any possible implementation thereof. This message middleware-based SIM card distribution device can be an electronic device or a chip within an electronic device.
[0086] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on a message middleware-based SIM card distribution device, cause the message middleware-based SIM card distribution device to perform the methods described in the first aspect and any possible implementation thereof.
[0087] Fifthly, this application provides a computer program product containing instructions that, when run on a message middleware-based SIM card distribution device, causes the message middleware-based SIM card distribution device to perform the methods described in the first aspect and any possible implementation thereof.
[0088] Compared with the prior art, the beneficial effects of the present invention are:
[0089] (1) In terms of communication processing and system operation efficiency, the SIM card distribution system of this application significantly improves the targeting and overall performance of message processing through a finely designed distributed message middleware cluster. The system builds a cluster based on Apache Kafka and divides it into topic partitions. Combined with an intelligent routing engine, it accurately matches business types and sales regions. At the same time, it adopts a differentiated processing mechanism according to message priority. For key business messages such as order creation and commission settlement, a synchronous confirmation transmission mechanism is used to ensure that data is not lost, providing strong persistence support for core businesses. For non-critical messages such as operation logs and batch reports, a batch asynchronous processing mechanism is used to achieve low latency and high throughput. This not only meets the needs of different business scenarios, but also effectively avoids communication blocking under high concurrency, further enhancing the system's stability and risk resistance.
[0090] (2) In terms of data security protection and management, the system constructs a comprehensive protection system through multi-level security design. The data sharding storage mechanism combines agent levels and sales regions to divide data storage nodes, and uses a threshold secret sharing algorithm to split sensitive data such as user ID numbers and mobile phone numbers, distributing the fragments across different regional nodes. Data can only be recovered when a sufficient number of fragments are collected and identity and authorization verification is passed, which greatly reduces the risk of data corruption caused by a single node failure. In addition, the encryption unit, dynamic key management unit and access audit unit of the data security module work together to not only ensure the security of data storage and transmission through encryption binding access policies, but also generate temporary keys to prevent key reuse risks, and record data access behavior in a fully traceable manner, taking into account both data security and management flexibility.
[0091] (3) Regarding the accuracy of demand forecasting and data privacy protection, the system relies on a federated learning framework to achieve efficient and secure cross-regional collaborative forecasting. Each sales region does not need to upload local data; it only participates in global model optimization by transmitting model parameter updates via encrypted transmission. This avoids the privacy risks associated with cross-regional data transfer and allows for model training by combining regional sales data with demographic data. Simultaneously, the local forecasting model processes discrete, continuous, and temporal features through multi-module collaborative processing, extracting spatiotemporal correlation information and dynamically allocating feature weights. The final output includes a comprehensive result encompassing total demand, package distribution, and confidence intervals, providing precise guidance for sales strategy formulation, effectively reducing inventory imbalances, and improving resource utilization and market responsiveness.
[0092] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description
[0093] 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.
[0094] Figure 1 A system architecture diagram of a SIM card distribution system based on message middleware is provided for embodiments of this application;
[0095] Figure 2 A flowchart illustrating a SIM card distribution system based on message middleware, provided for an embodiment of this application;
[0096] Figure 3 A flowchart illustrating another message middleware-based SIM card distribution system provided in this application embodiment;
[0097] Figure 4 A flowchart illustrating another message middleware-based SIM card distribution system provided in this application embodiment;
[0098] Figure 5 A schematic diagram of a SIM card distribution device based on a message middleware provided in this application embodiment;
[0099] Figure 6 This is a schematic diagram of the hardware structure of a SIM card distribution device based on a message middleware, provided in an embodiment of this application. Detailed Implementation
[0100] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "multiple" means two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0101] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0102] To address the technical problem of insufficient data security in existing card number distribution systems, this application provides a card number distribution system based on message middleware, which includes:
[0103] The message hub module is used to process asynchronous communication and data transmission within the system using a distributed message middleware cluster.
[0104] The data security module is used to manage distribution data in various regions using a data sharding storage mechanism, including user identity information, product order records, commission settlement details, and agent hierarchy relationships.
[0105] The demand forecasting module is used to predict the demand for SIM cards in the next cycle based on sales data and demographic data of each region, and to guide the formulation of sales strategies for the next cycle.
[0106] Based on this, the system can improve communication efficiency and stability through a distributed architecture, ensure data security through sharded storage, optimize sales decisions through data-driven prediction, and comprehensively improve the operational effectiveness of SIM card distribution business.
[0107] like Figure 1 As shown in the embodiment of this application, the SIM card distribution system based on message middleware includes: a message hub module, a data security module, and a demand prediction module, specifically:
[0108] The message hub module is used to process asynchronous communication and data transmission within the system using a distributed message middleware cluster.
[0109] Among them, the distributed message middleware cluster can be built based on mature message middleware products in existing technologies. Common message middleware includes RabbitMQ, ActiveMQ, Apache RocketMQ, etc. When the cluster is deployed, load balancing and failover are achieved through the collaboration of multiple nodes (master node + slave node) to avoid communication interruption caused by the failure of a single node. At the same time, the core mechanism of message queue (MQ, Message Queue) is used to realize the temporary storage and forwarding of messages, supporting asynchronous communication and data transmission within the system.
[0110] In some implementations, asynchronous communication can adopt a "producer-consumer" pattern. The business modules that generate messages within the system (such as the order module and the inventory module) act as producers. After sending the messages to the cluster's message queue, they can perform subsequent operations without waiting for the receiver's response. Data transmission can be combined with mechanisms such as message persistence (storing messages to disk instead of just storing them in memory) and replica synchronization (synchronizing messages to multiple cluster nodes) to ensure that data is not lost during transmission. At the same time, message processing priorities can be set according to the urgency of the business, prioritizing the processing of critical business data.
[0111] It should be noted that the number of nodes and deployment method of the distributed message middleware cluster can be flexibly adjusted according to the scale of the system business. Small-scale businesses can adopt a simplified cluster of "1 master and 2 slaves", while large-scale, high-concurrency businesses can be expanded to a "multi-master and multi-slave" cluster. The core is to distribute the processing pressure through a distributed architecture and improve the overall communication capability of the system.
[0112] For example, a distributed message middleware cluster based on RabbitMQ can be built, with two master nodes deployed to be responsible for message reception in North China and South China respectively. Each master node is paired with three slave nodes to achieve message backup. Order creation messages are critical business data. After being sent to a high-priority queue by the order module (producer), the inventory module (consumer) reads and processes the inventory deduction operation asynchronously. At the same time, message persistence is enabled to avoid order message loss due to cluster power failure.
[0113] The data security module is used to manage distribution data in various regions using a data sharding storage mechanism, including user identity information, product order records, commission settlement details, and agent hierarchy relationships.
[0114] The core of the data sharding storage mechanism is to split the full-domain distribution data into multiple independent "shards" according to preset rules, and then distribute the shards to different physical or logical storage nodes. Common sharding rules include those based on geographical region (such as by province or city), data type (such as dividing user identity information and commission details into different shards), and time period (such as dividing product order records by quarter). The purpose is to avoid problems such as excessive pressure on a single node and wide impact of failure caused by centralized storage of full-domain data.
[0115] In some implementations, to further enhance data security, sensitive data after sharding (such as user ID card numbers and mobile phone numbers) can be encrypted. Common encryption methods include Advanced Encryption Standard (AES) and Rivest-Shamir-Adleman Algorithm (RSA). This is combined with a Role-Based Access Control (RBAC) mechanism to assign differentiated data access permissions to operators at different levels (such as regional administrators and headquarters auditors), allowing them to access only the sharded data within their scope of responsibility. In addition, redundant storage can be configured for each data shard, such as storing a regional shard on both local nodes and off-site backup nodes, reducing the risk of data loss due to storage node hardware failures.
[0116] It should be noted that data sharding needs to balance "data relevance" and "management convenience". For example, the agent hierarchy and the commission settlement details corresponding to that agent should belong to the same regional shard to avoid efficiency reduction caused by cross-shard queries. At the same time, once the sharding rules are determined, it is necessary to ensure that subsequent data addition, query and modification operations follow the same rules to maintain data consistency.
[0117] For example, data can be segmented according to provincial administrative regions. The distribution data of Shandong Province can be split into "user identity information segment", "product order record segment" and "commission settlement details segment", which are stored on three storage nodes in Shandong Province respectively. Each node also stores off-site backup segments in Henan Province. The user identity information is encrypted with AES. The Shandong Province regional administrator can only access the unencrypted segment data in his / her own province. The headquarters auditors need to go through multiple layers of permission verification before they can view the commission settlement details segments of all regions in the country.
[0118] The demand forecasting module is used to predict the demand for SIM cards in the next cycle based on sales data and demographic data of each region, and to guide the formulation of sales strategies for the next cycle.
[0119] In some implementations, mature prediction algorithms in existing technologies can be used to build prediction models. Common algorithms include linear regression (which uses historical sales data to fit a trend line to predict future demand), autoregressive integrated moving average (ARIMA, suitable for sales data prediction with time periods), and random forest (which uses ensemble learning of multiple decision trees to comprehensively analyze the relationship between sales data and demographic data). Influencing factors that can be included in the prediction process include regional historical sales trends, total population size, age structure, gender ratio, and the effectiveness of past promotional activities.
[0120] It should be noted that since the sales volume of SIM cards in different regions is usually closely related to the regional population characteristics, consumption habits, and market competition environment, the prediction model needs to be adapted to the regional characteristics to avoid using a "one-size-fits-all" general model. For example, first-tier cities have a dense young population, so it is necessary to focus on population age distribution data, while third- and fourth-tier cities have low population mobility and need to refer more to historical sales cycle patterns.
[0121] For example, to predict the demand for SIM cards in Hangzhou, Zhejiang Province, data such as the sales volume of SIM cards over the past six months (including weekly sales of different packages), the number of permanent residents in Hangzhou, and the proportion of the population aged 18-35 can be collected. A predictive model can be built using the ARIMA algorithm to analyze and find the cyclical pattern of "sales increasing in the second week of each month due to payday". Combined with the expected growth data of the 18-35 age group in the following month, the total demand for SIM cards in Hangzhou next month is predicted to be 8,000, of which data packages account for 60%. This can then guide local agents to stock up on 6,000 data package SIM cards in advance and increase promotional efforts during the week of payday.
[0122] Based on the above technical solutions, the SIM card distribution system based on message middleware provided in this application achieves asynchronous communication and data transmission through a distributed message middleware cluster, effectively dispersing the communication pressure under high concurrency scenarios, avoiding the blocking problem of synchronous communication, and improving the system's operational stability and risk resistance. By leveraging data sharding storage mechanisms and general encryption and access control methods, the impact of a single storage node failure is reduced, and the security of distribution data, especially sensitive data, is strengthened, while also improving the flexibility of regional data management. Utilizing mature prediction algorithms combined with multi-dimensional data to conduct demand forecasting can accurately match the market characteristics of different regions, providing a scientific basis for sales strategy formulation, reducing inventory backlog or shortages, and ultimately improving the resource utilization rate and market response speed of the SIM card distribution business.
[0123] In one possible implementation of the embodiments of this application, combined with Figure 1 ,like Figure 2As shown, the specific working principle of the message hub module can be demonstrated through the following steps S101, S102, and S103, which are explained in detail below:
[0124] S101. Build a distributed message middleware cluster based on Apache Kafka to provide basic support for asynchronous communication and data transmission within the system.
[0125] Apache Kafka is a high-throughput distributed publish-subscribe messaging system. Building its distributed cluster enables distributed message storage and processing through multi-node collaborative deployment. The core principle is leveraging the redundancy of cluster nodes to distribute message processing pressure, avoiding communication interruptions caused by single-node failures. This also lays the foundation for subsequent message processing unit segmentation based on business type and sales region. Specifically, the distributed message middleware cluster can adopt the KRaft pattern, storing metadata in the built-in `__cluster_metadata` topic. An elected Controller node manages the metadata logs, and the Raft consensus protocol enables real-time replication and synchronization across all Broker nodes. The cluster deployment follows a "multi-master, multi-slave" architecture, with master nodes responsible for message reception and distribution, and slave nodes providing message backup. Physical isolation of nodes avoids single-point-of-failure risks and allows for elastic adjustment of the number of nodes based on business scale.
[0126] In some implementations, the number of nodes in a distributed message middleware cluster can be determined based on the scale of the system's business: for small to medium-sized regional SIM card distribution businesses, a simplified cluster architecture of "1 master and 2 slaves" can be adopted, where one master node is responsible for message reception and distribution, and two slave nodes are responsible for message backup; for large-scale nationwide SIM card distribution businesses, it needs to be expanded to a "multi-master and multi-slave" architecture, such as three master nodes corresponding to the East China, Central China, and West China regions respectively, with each master node paired with two slave nodes. At the same time, ZooKeeper (a distributed application coordination service) or Kafka's own KRaft protocol can be introduced to achieve state coordination of cluster nodes and automatic failover.
[0127] It should be noted that the deployment of cluster nodes must follow the principle of "physical isolation". The master node and slave node should be deployed on different server hardware or virtual machines to avoid the failure of the master and slave nodes simultaneously due to the failure of the same physical device. In addition, it is recommended to choose the Kafka cluster version 2.8.x or above to support the KRaft mode without ZooKeeper and simplify the cluster deployment and maintenance process.
[0128] For example, for the SIM card distribution business covering 30 provincial-level administrative regions, a distributed cluster based on Apache Kafka 3.0.0 is built. The KRaft mode is used to deploy 4 master nodes (responsible for the four major regions of North China, Northeast China, South China and Southwest China respectively) and 8 slave nodes (each master node corresponds to 2 slave nodes). The hardware configuration of the master nodes is 8 cores and 16GB of memory, and the slave nodes are configured with 4 cores and 8GB of memory to ensure that the cluster can handle the processing demand of 10 million messages per day.
[0129] S102: Configure multiple topic partitions and utilize an intelligent routing engine to achieve precise matching of messages and processing units.
[0130] In Apache Kafka, topic partitioning is the core mechanism for segmenting message processing units. Each topic partition can independently process messages of a specific business type or sales region. Through the correspondence between "topic partition - business / region", the inefficiency caused by mixed processing of different types of messages is avoided. The intelligent routing engine identifies the business type identifier (e.g., "ORDER" for order business, "COMMISSION" for commission business) and sales region label (e.g., "PROVINCE_01" for Beijing, "PROVINCE_02" for Shanghai) in the message and routes the message to the corresponding topic partition according to preset rules.
[0131] In some implementations, the number of topic partitions can be determined using a two-dimensional division rule of "number of business types × number of sales regions". Each partition independently processes messages of a specific business type in a specific region. If the system includes three core business types: order creation, commission settlement, and inventory changes, and the country is divided into six sales regions, then the total number of topic partitions can be set to 18. Each partition is named in the format of "business type_region code" (e.g., "ORDER_REGION_01"). The identification logic of the intelligent routing engine can use regular expression matching. For example, "^ORDER_." can be used to match all order-related messages, and "._REGION_03$" can be used to match all messages belonging to the third sales region.
[0132] It should be noted that topic partitions can implement region-based routing logic through custom partitioners, or use the hash mechanism of DefaultPartitioner to ensure that messages from the same region are routed to the same partition. Furthermore, once the number of topic partitions is determined, it should not be frequently adjusted in the short term to avoid message consumption chaos caused by partition reallocation. If new business types or sales regions are added subsequently, topic partitions can be added through Kafka's "partition extension" function, and the naming rules of the new partitions must be consistent with those of the existing partitions.
[0133] For example, the system includes three types of business: order creation (ORDER), commission settlement (COMMISSION), and inventory change (INVENTORY). The country is divided into three major regions: North China (REGION_01), East China (REGION_02), and South China (REGION_03), and configured with nine theme partitions (such as "ORDER_REGION_01" and "COMMISSION_REGION_02"). When an order message carries the identifier "ORDER" and the tag "REGION_02", the intelligent routing engine routes it to the "ORDER_REGION_02" partition through regular expression matching.
[0134] S103. Based on the preset priority rules, a differentiated processing mechanism is adopted for messages of different priorities to ensure reliable transmission of critical business messages and efficient processing of non-critical messages.
[0135] The preset priority rules divide messages into first priority and second priority. First priority messages are critical messages that affect core business processes and require synchronous confirmation transmission mechanisms to ensure they are not lost. Second priority messages are non-core auxiliary messages and can use batch asynchronous processing mechanisms to improve throughput. Specifically, first priority messages include, but are not limited to, order creation messages, commission settlement messages, and inventory change messages. These messages are directly related to SIM card sales fulfillment and revenue calculation and require strong persistence guarantees. Second priority messages include, but are not limited to, operation log messages, behavior tracking messages, and batch report messages. These messages do not affect real-time business processes and can tolerate a certain degree of delay.
[0136] In some implementations, the method for determining the preset priority rules is as follows: messages are divided into two levels based on business impact assessment (such as whether message loss leads to order failure or user complaints), with core business-related messages assigned to the first priority and auxiliary monitoring and statistical messages assigned to the second priority.
[0137] In the first-priority topic partition, a synchronous acknowledgment transmission mechanism is used to process messages. This mechanism means that after a producer sends a message, it blocks and waits until it receives an acknowledgment signal confirming that the message has been successfully written to all synchronous replicas in the distributed message middleware cluster before executing subsequent business operations. Its core function is to ensure that messages are not lost during transmission, providing strong durability guarantees for critical business operations. First-priority messages include, but are not limited to, order creation messages, commission settlement messages, and inventory change messages. These messages are directly related to the core business processes of SIM card distribution, such as order fulfillment, revenue calculation, and inventory control. If messages are lost or transmission anomalies occur, it may lead to serious problems such as business interruption and data inconsistency. The producers of first-priority messages are the business function modules within the system that generate messages to be transmitted, including but not limited to the inventory management module, demand forecasting module, and additional order management and commission settlement modules. These business function modules convert business data into data packets conforming to the Apache Kafka cluster message format through a preset message encapsulation interface before initiating message sending requests to the first-priority topic partition.
[0138] In the topic partition corresponding to the second priority, a batch asynchronous processing mechanism is used to process messages. This mechanism means that the producer places messages in a local buffer. When a preset quantity or time interval is reached, the producer sends the messages in the local buffer to the message middleware cluster in batches. After sending the messages, subsequent business operations can be executed without waiting for an acknowledgment signal from the message middleware cluster. Its core advantage is achieving low latency and high throughput, adapting to the processing needs of non-critical businesses. Second-priority messages include, but are not limited to, operation log messages (such as operation records of business modules), behavior tracking messages (such as user browsing data on SIM card packages), and batch report messages (such as summary reports of regional sales data). These messages do not directly affect the real-time core process of SIM card distribution. Even if there is a brief delay or individual message loss, it will not have a direct negative impact on business performance or user experience. The producers of second-priority messages are also business function modules within the system. These modules follow the same message encapsulation format requirements as first-priority messages. After completing data conversion through a preset interface, the messages are temporarily stored in a local buffer and then sent in batches to the topic partition corresponding to the second priority according to preset conditions.
[0139] It should be noted that the timeout for "waiting for confirmation signal" in the synchronous confirmation transmission mechanism is preset to 3-5 seconds, and the timeout is determined based on the cluster network latency, calculated by adding twice the standard deviation to the average confirmation time of 1000 historical message transmissions; in the batch asynchronous processing mechanism, the "preset quantity" is determined based on historical message volume statistics, taking 1 / 100 of the message volume per minute as the batch quantity, resulting in a preset quantity of 100-200 messages; the "preset time interval" is determined based on the latency tolerance of non-core business, such as a 30-second delay for report-type messages, resulting in a default time interval of 10-30 seconds.
[0140] It should be noted that while the synchronous confirmation mechanism for first-priority messages can ensure reliability, it will increase the short-term waiting time of business modules. Therefore, the scope of first-priority messages must be strictly controlled to avoid including non-core messages, which would lead to a decrease in the overall efficiency of the system. The local buffer of the batch asynchronous processing mechanism should be set with a maximum capacity (e.g., 500 messages) to avoid message accumulation that could lead to memory overflow.
[0141] For example, after the order creation message (first priority) is sent to the corresponding topic partition by the order management module (producer), it blocks and waits for the confirmation signal from the three synchronous replicas in the cluster (the timeout is set to 4 seconds). After receiving the confirmation, the order status update operation is performed. The operation log message (second priority) is written to the local buffer by each business module. When the buffer reaches 150 messages or the interval is 20 seconds, it is sent to the corresponding topic partition in batches. After sending, the subsequent log recording operation is performed directly without waiting for confirmation.
[0142] Based on the above technical solutions, the message hub module of this application embodiment, through a three-layer design of "distributed cluster deployment - intelligent routing matching - differentiated priority processing", not only solves the communication blocking problem under high concurrency in existing systems, but also achieves reliable transmission of critical messages and efficient processing of non-critical messages. At the same time, through flexible parameter configuration (such as the number of cluster nodes, the number of partitions, and the timeout time), it adapts to SIM card distribution businesses of different scales, significantly improving the stability, accuracy, and efficiency of system communication.
[0143] In one possible implementation of the embodiments of this application, combined with Figure 1 ,like Figure 3 As shown, the specific working principle of the above data security module can be demonstrated through the following steps S201, S202, and S203, which are explained in detail below:
[0144] S201 adopts a data sharding strategy based on agent level and sales region to split and store the full-domain distribution data to the associated agent nodes, laying the foundation for decentralized data management.
[0145] The data sharding strategy uses "business relevance" as the core criterion for segmentation. Distribution data, including user identity information, product order records, commission settlement details, and agent hierarchy relationships, is split according to the correspondence between agent level (e.g., provincial agent, city agent) and sales region (e.g., Shandong Province, Jiangsu Province). This ensures that each part of the distribution data is stored only on agent nodes within the sales region directly associated with that data, avoiding the problem of a wider impact from faults caused by centralized storage of data across the entire domain. For example, commission settlement details for city-level agents in Jinan City, Shandong Province, are stored only on the Jinan City agent node, not on the headquarters' centralized storage node, ensuring consistency between data management and business jurisdiction.
[0146] In some implementations, the granularity of data sharding can be adjusted according to the level of agency hierarchy: if the agency system is divided into four levels—headquarters, provincial, municipal, and county—the smallest data shard can be divided according to the sales area corresponding to the county-level agency; if there are only two levels of agencies—headquarters and provincial—then sharding is divided according to the provincial region. Simultaneously, a "sharding + local backup" model can be used for non-sensitive distribution data (such as package types in product order records), storing the primary shard on the corresponding agency node and the backup shard on the superior provincial node, reducing the risk of data loss due to the failure of a single agency node.
[0147] It should be noted that data sharding must strictly follow the principle of "matching agent level with data permissions". That is, a certain level of agent node can only store the distribution data within its jurisdiction. For example, a city-level agent node cannot store complete distribution data of other cities or provinces. It can only access some related data when authorized, so as to avoid data overreach.
[0148] For example, a certain SIM card distribution system's agent system is divided into three levels: "headquarters-provincial-city". For the distribution data of Zhejiang Province, it is divided into 11 data segments according to 11 prefecture-level cities. The distribution data of Hangzhou City (including Hangzhou user identity information, Hangzhou regional product ordering records, and Hangzhou agent commission details) is stored in the Hangzhou city-level agent node, while the backup data of the Hangzhou segment is stored in the Zhejiang provincial agent node. The distribution data of Ningbo City is stored independently in the Ningbo city agent node, completely isolated from the Hangzhou segment. Only the Zhejiang provincial agent can view the summary data of the 11 city-level segments in the province after authorization.
[0149] S202. Use a threshold secret sharing algorithm to split and distribute sensitive data to strengthen the security protection of user privacy fields.
[0150] Sensitive data specifically refers to privacy fields in user identity information (such as ID card numbers, mobile phone numbers, and bank card numbers). The processing involves four steps: "data transformation - polynomial construction - fragment generation - distributed storage".
[0151] First, convert the sensitive data to be split into values over the prime number field GF(p), where p is a prime number greater than the maximum value of the sensitive data;
[0152] Construct a k-1 degree polynomial, where the constant term of the polynomial is the transformed sensitive data, and the remaining coefficients are randomly selected from the prime number field;
[0153] Then, a unique index is assigned to each target agent node, and the corresponding data fragments are obtained by substituting them into a polynomial calculation.
[0154] Finally, the fragments are distributed and stored to agent nodes in different sales regions through a secure channel, with each node holding only one fragment.
[0155] When an authorized requester needs to access sensitive data, fragments must be collected from at least k different proxy nodes. The polynomial is then reconstructed using the Lagrange interpolation formula, and f(0) is calculated to recover the original sensitive data.
[0156] In some implementations, the minimum number of fragments k and the total number of fragments n required to recover sensitive data are determined as follows: Based on the importance of the sensitive data and system security requirements, core privacy fields (such as bank card numbers) can be set to k=3 and n=5 (requiring only 3 fragments for recovery, generating a total of 5 fragments stored on 5 nodes), while general privacy fields (such as mobile phone numbers) can be set to k=2 and n=3. The prime number p must be chosen to satisfy the condition that p is greater than the maximum possible value of the sensitive data; for example, when processing an 18-digit ID card number, p can be greater than 10. 18 Find the smallest prime number (e.g., 1000000000000000003) to ensure no loss of precision after data conversion.
[0157] It should be noted that the transmission and storage of data fragments must rely on encrypted secure channels, such as channels based on the Transport Layer Security (TLS) protocol, to prevent fragments from being stolen during transmission. At the same time, each proxy node is only allowed to store fragments of different sensitive data, and cannot store multiple fragments of the same sensitive data, to avoid security risks caused by a single node holding too many fragments.
[0158] For example, when processing the user's ID number "330106199001011234", it is first converted into a value in the prime field GF(1000000000000000003); then a quadratic polynomial f(x) = 330106199001011234 + a1x + a2x is constructed. 2 +…+a k-1 x k-1(a1 and a2 are randomly selected in the prime field); assign indices x1=1, x2=2, x3=3, x4=4, x5=5 to the agent nodes in 5 different regions, and calculate 5 fragments (x1, y1) to (x5, y5); store the fragments in the agent nodes of Jiangsu, Anhui, Jiangxi, Fujian and Shanghai respectively through the TLS channel; when the provincial agent needs to access the ID number, it needs to collect the fragments of at least 3 nodes, reconstruct the polynomial through Lagrange interpolation and calculate f(0) in order to recover the original ID number.
[0159] S203. By working together with the encryption unit, dynamic key management unit and access audit unit, a full-process data security protection and traceability system is constructed.
[0160] The encryption unit employs an attribute-based encryption algorithm, binding sensitive data with a preset access policy before encryption. Sensitive data can only be decrypted when the access request meets the dual conditions of "collecting a preset number of data fragments + the requester passing identity verification and authorization," ensuring the confidentiality of data storage and transmission. The dynamic key management unit generates a temporary session key for each data access. This key is only valid within the current access session and expires immediately after the access ends, preventing security risks caused by key reuse. The access auditing unit records all data access behaviors in real time (including visitor identity, access time, accessed data object, and operation type) and sends the records to the audit log center for centralized storage via message middleware, achieving full traceability and tamper-proof access behavior.
[0161] In some implementations, the encryption unit can select an appropriate encryption algorithm based on the sensitive data type: short text privacy fields such as user identity information use the Advanced Encryption Standard (AES-256), while structured data such as commission settlement details use the Rivest-Shamir-Adleman encryption algorithm (RSA-2048); the generation of temporary session keys can combine visitor identity identifiers (such as agent IDs) and access timestamps, and generate a unique key through a hash algorithm (such as SHA-256) to ensure key uniqueness and randomness.
[0162] It should be noted that the conditions of the preset access policy must be consistent with the fragment quantity requirements of the threshold secret sharing algorithm. For example, if the threshold secret sharing is set to k=3, then the "preset number of data fragments" in the access policy must be set to 3 to avoid sensitive data being unable to be accessed normally or being excessively opened due to mismatched conditions. The audit log center must use read-only mode to store records, allowing only headquarters auditors to view them to prevent logs from being tampered with.
[0163] For example, when a city-level agent needs to access the mobile phone numbers (sensitive data) of users within its jurisdiction, it first authenticates itself through the system (entering account password + verification code), and then confirms its access rights to the data within its jurisdiction through RBAC permission authentication; the encryption unit, based on the strategy of "collecting 3 data fragments + agent's legitimate identity", encrypts the mobile phone number and allows the agent to initiate a fragment collection request; the dynamic key management unit generates a temporary key containing the agent ID (NO.20240501) and the access time (2024-05-20 14:30:00) for the agent to decrypt the 3 collected fragments; throughout the access process, the access audit unit records "Visitor: NO.20240501 city-level agent, time: 2024-05-20 14:30:00, data object: mobile phone number of users within the jurisdiction, operation: read", and sends the record to the audit log center for storage.
[0164] Based on the above technical solutions, the data security module of this application embodiment solves the security risks of centralized storage in existing systems through the process of "layered and fragmented storage - sensitive data secret sharing - multi-unit collaborative protection". It also builds a full-link security barrier through mechanisms such as threshold secret sharing, dynamic keys, and access auditing, while taking into account the flexibility and compliance of data management. It effectively ensures the security and traceability of SIM card distribution data (especially user privacy data) and meets the strict data security requirements of distribution business.
[0165] In one possible implementation of the embodiments of this application, combined with Figure 1 ,like Figure 3 As shown, the specific working principle of the above-mentioned demand forecasting module can be illustrated by the following steps S301, S302, and S303, which are explained in detail below:
[0166] S301. Construct a federated learning framework and distribute global model parameters to each sales region to lay the foundation for cross-regional collaborative prediction.
[0167] The core function of the federated learning framework is to achieve collaborative optimization of the global model across all sales regions under the premise of "data not leaving the local area," avoiding the risk of privacy leaks caused by cross-regional data transfer. Its workflow begins with the central server initializing global model parameters—these parameters include the weight matrices and bias vectors of each layer of the neural network, the model structure (such as the number of hidden layers and activation function type), and hyperparameters (such as learning rate and number of iterations). Then, the encrypted global model parameters are distributed to each sales region node through the secure communication channel of the message hub module. Parameter encryption uses a homomorphic encryption algorithm to ensure that parameters are not stolen or tampered with during transmission. Simultaneously, the central server pre-verifies the identity and legitimacy of each regional node, distributing parameters only to verified nodes.
[0168] In some implementations, the initialization of global model parameters can be adjusted based on the optimal parameter values of historical prediction models: if the system has already run for one prediction cycle, the global parameters after convergence in the previous cycle can be used as the initial values; if it is the first run, the weight matrix can be initialized using the Xavier initialization method, the bias vector can be initialized to 0, the learning rate in the hyperparameters can be preset to 0.001-0.01 (determined according to the convergence speed of historical model training, if the convergence is slow, it can be increased, if the convergence oscillates, it can be decreased), and the maximum number of training epochs can be preset to 50-100 epochs (determined by the inflection point of model performance on the validation set, if there is no performance improvement after more than 50 epochs, it can be set to 50 epochs).
[0169] In some implementations, the specific workflow of the federated learning framework includes:
[0170] (1) Initialize global model parameters and encrypt and distribute them to each sales region node. The global model parameters include the weight matrix, bias vector, activation function type and hyperparameters of each layer of the neural network.
[0171] (2) After receiving the global model parameters, each sales region node trains the model based on the local preprocessed sales data and demographic data, and generates the local model parameter update.
[0172] (3) Each sales region node encrypts the local model parameter update and transmits it to the central server through the secure communication channel of the message hub module; the encryption process uses a homomorphic encryption algorithm to ensure the confidentiality of the parameter transmission process.
[0173] (4) After the central server verifies the identity and integrity of each sales region node, it uses an adaptive weighted aggregation algorithm to aggregate the parameter update of all sales region nodes to generate new global model parameters. The adaptive weighted aggregation algorithm dynamically allocates aggregation weights based on the proportion of data volume in each region, historical prediction accuracy, and feature importance.
[0174] (5) The central server encrypts and distributes the updated global model parameters to each sales area node. Each node replaces the local model parameters and repeats (2)-(4) until the model reaches the preset convergence condition. The convergence condition includes the global loss function value being lower than the threshold, the parameter change in N consecutive iterations being less than the set value, or the maximum number of training rounds being reached.
[0175] (6) When the convergence condition is met, the central server will distribute the final global model parameters to each sales area node. Each node will predict the demand for SIM cards in the next cycle based on the locally deployed prediction model and feed the prediction results back to the decision center through the message hub module.
[0176] It should be noted that the key to the federated learning framework lies in "parameter interaction rather than data interaction". Each region only needs to upload the model parameter update, without uploading the original sales data or demographic data. This not only meets the data localization compliance requirements, but also aggregates the feature information of the entire domain data, thereby improving the model's generalization ability.
[0177] For example, for a SIM card distribution system covering six major sales regions nationwide (North China, Northeast China, East China, Central China, South China, and Southwest China), the central server initializes a global prediction model based on a neural network. The weight matrix is initialized using Xavier, the activation function is set to ReLU, and the maximum number of training rounds is set to 60. After encrypting the global model parameters using a homomorphic encryption algorithm, the parameters are distributed to the six regional nodes through a high-priority secure channel of the message hub module. Each regional node must decrypt the parameters using its node identity key after receiving them, ensuring that only authorized nodes can obtain the parameters.
[0178] S302. Each sales region trains a local prediction model based on local data to generate preliminary prediction results of the demand for SIM cards in the next cycle.
[0179] The training of the local prediction model relies on two types of core data: first, sales data, including SIM card package types, user profiles (including age range, gender, data traffic usage preferences) and historical sales trends; second, demographic data, including regional population age distribution, gender ratio and the number of different groups.
[0180] The training process of a local prediction model requires first preprocessing the input data for features, and then learning the data association patterns through deep learning algorithms (such as the improved gated recurrent unit GRU). Specifically, discrete features (such as user gender and package type) are first one-hot encoded and embedded, continuous features (such as average spending per person and historical data usage) are standardized, and time features (such as periodic index and number of days since the last promotion) are periodically encoded to form an initial feature matrix of a unified dimension. Then, a spatiotemporal feature extraction module is used to capture time dependence and regional spatial associations, and finally a prediction model adapted to the characteristics of the local market is trained. Inputting the data from the previous period into the model can yield preliminary demand predictions.
[0181] In some implementations, the parameters for feature preprocessing can be adjusted according to the characteristics of the local data: continuous feature standardization adopts the interquartile range (IQR) method, with the formula x' = (x - median(x)) / IQR(x), where median(x) is the median of the feature in the local training data, and IQR(x) is the difference between the upper and lower quartiles to avoid the influence of outliers; the embedding dimension d_t of the periodic encoding of time features is preset to 12-24 (determined according to the time period granularity; if it is counted daily, it is set to 24, and if it is counted weekly, it is set to 12); the number of hidden layer nodes of the improved GRU is set to 64-128 (determined according to the sample size of the local data; if the sample size exceeds 100,000, it is set to 128, and if it is less than 100,000, it is set to 64).
[0182] For example, the East China regional node collects local sales data from the past 6 months (including 100,000 user purchase records covering 5 types of SIM card packages) and demographic data (45% of the population is aged 25-40, and 52% is female). After one-hot encoding of user gender (discrete feature), it is mapped to an 8-dimensional vector. The median of average monthly spending per person (continuous feature) is calculated to be 38 yuan, and the IQR is 22 yuan. The data is then standardized according to the formula. The "number of days since the last promotion" (time feature) is set to d_t=18 and periodically encoded. An improved GRU with 128 hidden layer nodes is used to train the local model. After inputting the data from the previous period, the total demand for SIM cards in the East China region in the next period is initially predicted to be 120,000.
[0183] S303: By optimizing the prediction results through multi-module collaboration, it outputs a comprehensive demand forecast containing multi-dimensional information, providing precise guidance for sales strategies.
[0184] The local prediction model optimizes prediction results through the collaborative work of a feature embedding module, a spatiotemporal feature extraction module, an attention fusion module, a federated learning adaptation module, and a multi-task prediction output module. The feature embedding module ensures a unified dimension for multiple feature types, the spatiotemporal feature extraction module captures the time trend and regional correlation of sales, the attention fusion module strengthens the influence of key features (such as promotional activities and the proportion of young people) through dynamic weight allocation, the federated learning adaptation module receives global parameters to update and optimize the local model, and finally the multi-task prediction output module performs regression and classification tasks—the regression branch calculates the total demand, the classification branch calculates the proportion of each package type, and then the Monte Carlo dropout method is used to generate prediction confidence intervals, forming a comprehensive result of "total quantity + structure + reliability".
[0185] In some implementations, the weight calculation of the attention fusion module can combine multiple dimensions: feature-level weights are obtained by scoring spatiotemporal interaction features through a multilayer perceptron and then normalizing them using softmax; time period weights are set with a decay factor based on the historical sales periodicity (e.g., the decay coefficient is 0.8 within one week after a promotion and 0.5 after one week); regional difference weights are adjusted inversely based on the historical prediction error of each region (the smaller the error, the greater the weight); the number of repeated predictions for Monte Carlo dropout is preset to 20-50 times (the more times, the more accurate the confidence interval; if real-time requirements are high, set it to 20 times; if accuracy requirements are high, set it to 50 times); and the confidence level of the confidence interval is set to 95% (the industry-standard reliability standard).
[0186] It should be noted that the core advantage of the multi-task forecasting output module is that it outputs both the total quantity and the package distribution simultaneously, avoiding the "supply and demand mismatch" caused by only forecasting the total quantity (such as accurate total quantity forecasting but insufficient inventory of a certain type of package); the confidence interval can reflect the reliability of the forecast results, making it easier for decision-makers to adjust their strategies according to their risk tolerance (such as appropriately increasing safety stock when the confidence level is below 80%).
[0187] In some implementations, the local prediction model in this application can adopt an end-to-end deep learning architecture. Through the collaboration of five modules—feature embedding, spatiotemporal feature extraction, attention fusion, federated learning adaptation, and multi-task prediction—it achieves accurate prediction of cross-regional SIM card demand while protecting data privacy. The model deeply integrates heterogeneous feature modeling, spatiotemporal correlation mining, and federated learning mechanisms; its technical details are as follows:
[0188] (1) Feature embedding module
[0189] The core of the feature embedding module is to convert three types of heterogeneous inputs—discrete, continuous, and temporal—into structured features with consistent dimensions, laying the foundation for subsequent spatiotemporal modeling.
[0190] For discrete features, including but not limited to: user gender, package type, user age group label, and region encoding, a binary matrix O is first generated through one-hot encoding, and then mapped to a low-dimensional dense vector through an embedding layer. Mathematically, this is expressed as: E dis =W emb ·O+b emb ;in, d1 is a discrete feature vector matrix, where n is the number of samples and d1 is the discrete feature embedding dimension. The embedding weight matrix is k, where k is the cardinality of the discrete features, i.e., the total number of different values of the discrete features. This is a one-hot encoding matrix. Each row of the one-hot encoding matrix contains only one 1 and the rest are 0, which is used to mark the discrete feature values of the samples. This is the embedding bias vector, used to adjust the baseline distribution of the embedding vector.
[0191] For continuous features, including but not limited to: per capita consumption, historical data usage, regional population density, and sales growth rate, robust standardization is employed to eliminate dimensional differences and outlier interference: x' = (x - median(x)) / IQR(x), where x is the original value of the continuous feature (e.g., average monthly consumption in a region); x' is the standardized value; median(x) is the median of the feature in the training set; and IQR(x) is the interquartile range, further reducing the impact of extreme values on the standardization result. The standardized continuous features are mapped to feature vectors through a linear transformation:
[0192] E con =W con ·X norm +b con ;in, d1 is a continuous feature vector matrix, and d2 is the continuous feature embedding dimension; Let c be the linear transformation weight matrix, and c be the number of continuous features; It is a standardized continuous feature matrix; This is the bias vector for the linear transformation.
[0193] For time features, including but not limited to periodic indexes, month identifiers, days since the last promotion, and quarterly periodic codes, a "sine-cosine" periodic code is used to capture multi-scale periodic patterns (such as weekly, monthly, and quarterly), calculated as follows: In the formula, This is the i-th sinusoidal coded component at time step t; This corresponds to the cosine-coded component; t is the time step index, such as t=1 for the first prediction period and t=2 for the second period; i is the coding scale index, with a value range of 0≤i≤d. t / 2,d t The embedding dimension for time features needs to be set to an even number to ensure that the sine and cosine components are paired. As a scale adjustment factor, i achieves multi-period scale coverage through changes in i. That is, the smaller i is, the shorter the period scale, capturing short-term fluctuations; the larger i is, the longer the period scale, capturing long-term trends.
[0194] The encoded temporal features are fused into a temporal feature vector matrix E through a gating mechanism. time =σ(W t ·T+b t )⊙(W′ t ·T+b′ t );in, The time eigenvector matrix; This is the time feature matrix after periodic encoding; This is the gate weight matrix; The gating bias vector; σ is the sigmoid activation function, used to output the gating coefficient in the interval [0,1] to control the feature pass rate; ⊙ is element-wise multiplication, used to realize the dynamic selection of features by the gating coefficient.
[0195] Finally, the three types of eigenvector matrices are concatenated according to their feature dimensions to form the initial feature tensor: F init =Concat(E dis E con E time );in, t represents the time step, which is the number of historical time periods contained in each sample. This achieves both the unification of heterogeneous features and the complete preservation of the time series dimension, providing a structured input for spatiotemporal feature extraction.
[0196] It should be noted that although discrete feature vectors and continuous feature vectors can be distinguished as "static features" and "dynamic features," they can be effectively concatenated while preserving the time dimension through a "time dimension expansion" operation, allowing both types of feature vectors to have the same time step t as the time feature vector. The specific processing logic is as follows:
[0197] For static discrete features and static continuous features (i.e., features that do not change over time, such as region coding, population density of sales areas, and fixed age group labels for users), their original feature vector dimensions do not include a time step. In this case, a "time step replication" operation needs to be performed: the static feature vector of each sample is repeated t times along the time dimension (t is the total number of time steps, i.e., the number of historical periods required for prediction), so that the static feature vector is expanded from a two-dimensional "sample-feature" structure to a three-dimensional "sample-time step-feature" structure.
[0198] For dynamic discrete features and dynamic continuous features (i.e. features that change over time, such as daily sales records of different package types, weekly fluctuations in average spending per person, etc.), the original data itself contains a time dimension, but it needs to be structured according to time steps: arrange the dynamic features of each sample in t time steps to form a three-dimensional matrix of "sample-time step-feature".
[0199] After the above processing, the discrete feature vector (expanded to n×t×d1), the continuous feature vector (expanded / simplified to n×t×d2), and the time feature vector (originally n×t×d1) are all transformed into a single vector. t The sample size (n) and time step (t) have already been fully matched. Only the feature dimensions (d1, d2, dt) need to be matched. t Performing the concatenation operation will yield the dimension as follows: The initial feature tensor ensures that the subsequent spatiotemporal feature extraction module can mine the temporal dependence and spatial correlation patterns based on complete "sample-time-feature" information.
[0200] (2) Spatiotemporal feature extraction module
[0201] The spatiotemporal feature extraction module uses an improved gated recurrent unit (GRU) and a graph convolutional network (GCN) to mine time series dependencies and regional spatial associations respectively, and achieves the fusion of the two.
[0202] Time-dependent feature extraction: Traditional GRU gating decisions rely solely on historical hidden states and the current input, failing to distinguish feature importance. This model introduces feature importance scores into the reset and update gates to achieve dynamic gating adjustment. The expression for the improved gating recurrent unit includes:
[0203] r t =σ(W r ·[h t-1 ,x t ]+b r +α r ·s t );
[0204] z t =σ(W z ·[h t-1 ,x t ]+b z +α z ·s t );
[0205]
[0206] In the above formula, To reset the gate output, d h R represents the hidden layer dimension of the GRU system, controlling the proportion of historical hidden states retained. t The closer it is to 1, the more historical information is retained; To update the gate output, the fusion ratio between the historical state and the current candidate state is controlled, i.e., z. t The closer the value is to 1, the higher the weight of the current candidate state. Let be the gating and candidate state weight matrix, and d init =d1+d2+d t The initial feature dimension; Let h0 be the hidden state at time step t-1 (initialized to the zero vector h0 = 0); Let be the initial feature vector at time step t; It is the bias vector; The adaptive weights for feature importance are learnable parameters used to control s t The intensity of the impact on gating; The feature importance score at time step t is obtained through a two-layer perceptron: st =σ(W s2 ·ReLU(W s1 ·x t +b s1 )+b s2 ), W s1 W s2 Let b be the weight matrix. s1 b s2 It is the bias vector; represents the candidate hidden state; tanh is the hyperbolic tangent activation function, with an output in the interval [-1, 1], used to alleviate gradient vanishing; Let t be the final hidden state at time step t.
[0207] Through multiple time-step iterations, a time-dependent feature sequence is finally formed. Capture both short-term fluctuations and long-term trends in sales data.
[0208] Spatial correlation feature extraction: To quantify the sales spillover effect between regions (such as demand correlation caused by user movement between adjacent regions), a regional adjacency matrix is first constructed:
[0209] In the formula, A i,j denoted as , where is the adjacency weight between region i and region j, reflecting the spatial association strength between the two regions; β is the distance attenuation coefficient, typically ranging from 0.1 to 1.0, and the larger β is, the more significant the weakening of the association strength due to geographical distance; d i,j γ represents the geographical distance between regions i and j, in km, calculated based on the latitude and longitude of the region's center point; i,j ∈[0,1] represents the economic correlation coefficient between regions i and j, calculated based on indicators such as GDP similarity and population mobility, and γ i,j The closer it is to 1, the stronger the economic ties.
[0210] To avoid gradient vanishing in graph convolution operations, the adjacency matrix is normalized. in, Let be a normalized adjacency matrix, k be the total number of sales regions; D be a degree matrix, and That is, the diagonal elements are the sum of the i-th row of the adjacency matrix; It is an identity matrix used to preserve the characteristic information of the region itself.
[0211] Based on the normalized adjacency matrix, spatial correlation features are extracted using a graph convolutional network: In the formula Let d be the spatial correlation feature matrix at time step t. g For spatial feature dimensions; Let be the initial feature matrix of the region at time step t (each row corresponds to the feature of a region); The graph convolution weight matrix; σ is the graph convolution bias vector; σ is the ReLU activation function. Then, the spatial features from all time steps are concatenated to obtain the spatially correlated feature sequence.
[0212] Finally, the time-dependent feature sequence and the spatially correlated feature sequence are concatenated along the feature dimension to form the spatiotemporal interaction feature tensor F. st =Concat(F temp F spa );in, It contains both temporal information about when it was a bestseller and spatial information about where it was a bestseller, providing a complete spatiotemporal context for subsequent attention fusion.
[0213] (3) Attention Fusion Module
[0214] The attention fusion module enhances information that contributes significantly to prediction and suppresses noise interference through triple weight adjustment at the feature level, time level, and region level, thereby achieving adaptive optimization of features.
[0215] First, calculate the importance score for each feature dimension:
[0216] s i =MLP(F st (i))=σ(W2·tanh(W1·F st (i)+b1)+b2); where s i The importance score for the i-th feature dimension; is the feature sequence of the i-th dimension in the spatiotemporal interaction features; MLP is a two-layer perceptron. The perceptron weight matrix d mlp For the hidden layer dimension of the perceptron; This is the perceptron bias vector.
[0217] Based on the feature importance scores, generate feature-level normalized weights:
[0218] Where, α i Let be the weight of the i-th feature, and
[0219] d st =d h +d g The total dimension of the spatiotemporal features is represented by the denominator, which is the sum of the exponential scores of all features, thus achieving weight normalization.
[0220] For the time dimension, a time decay weight is set based on historical periodic patterns: β t =exp(-λ×|t-t0|); where β t∈[0,1] represents the weight at time step t; λ is the decay rate, usually taken as 0.05 to 0.2. The larger λ is, the faster the weight decreases with time distance; t0 is the reference time step, usually set as the previous period of the prediction period, i.e. the most recent historical period; |t-t_0| is the distance between the current time step and the reference step, ensuring that recent features receive higher weights.
[0221] For the regional dimension, regional differences are weighted based on historical prediction accuracy:
[0222] In the formula, γ k Let be the weight of the k-th region, and
[0223] K is the number of regions; MSE k The historical mean squared error of the prediction for the k-th region; 1 / MSE k This means that regions with higher prediction accuracy have greater weights, thus reducing the interference of low-accuracy regions on the fusion results.
[0224] Finally, the optimized fused feature vector F is obtained by multiplying the spatiotemporal features by the triple weights and then summing them. fusion :
[0225]
[0226] Among them, F st (i,t,k) represents the feature value of the i-th dimension, the t-th time step, and the k-th region in the spatiotemporal features; the triple summation covers the feature, time, and region dimensions respectively, realizing the organic integration of multi-dimensional information.
[0227] (4) Federated Learning Adaptation Module
[0228] The federated learning adaptation module enables the connection between the local model and the global framework. While ensuring that regional data does not leave the local area, it absorbs global knowledge and retains regional characteristics through encrypted parameter transmission and weighted fusion.
[0229] First, region-specific features are introduced to enhance the adaptability of the local model: F local =F fusion +δ·ReLU(W l ·F region +b l In the formula, F local For local enhancement of feature vectors; F region This is a region-specific feature vector, containing features unique to this region, such as local consumption habit labels, regional policy coefficients, and competitor density; δ is the enhancement coefficient, typically ranging from 0.3 to 0.8, controlling the strength of the regional features' influence; W l b is the weight matrix for linear transformation of regional features;l This is the region feature bias vector.
[0230] Based on local augmentation features, the parameter update amount Δθ of the local model is calculated. local : Where η is the learning rate, which is usually taken as 10. -3 ~10 -1 ; The local loss function is applied to the global model parameters θ. global The gradient at θ, and θ global These are global parameters issued by the central server, reflecting common knowledge across different regions; the negative sign indicates that the parameters are updated along the direction of loss descent.
[0231] To reduce transmission costs and protect privacy, parameter updates are compressed and encrypted.
[0232] Top-K sparsification: Preserving Δθ local The K parameters with the largest absolute values are selected, where K is typically 10% to 30% of the total number of parameters, and the rest are set to 0, resulting in the sparsification parameter Δθ. sparse ;
[0233] 8-bit quantization: Δθ sparse The parameter precision was reduced from 32-bit floating-point to 8-bit integer, further compressing the data volume to obtain the quantization parameter Δθ. quant ;
[0234] Homomorphic encryption: The Paillier homomorphic encryption algorithm is used to encrypt Δθ. quant Encryption, obtaining encryption parameters Δθ enc This ensures that parameters are not leaked during transmission.
[0235] After the coordination server aggregates the encryption parameters from each region, it issues a global parameter update Δθ. global The local model updates parameters through weighted fusion: In the formula, For the updated local model parameters; The local parameters before the update are α∈[0,1], which are the global parameter weights, typically ranging from 0.4 to 0.6, balancing global common knowledge with local characteristic knowledge; Δθ global This represents the parameter update amount after global aggregation, reflecting the collaborative optimization direction of each region.
[0236] (5) Multi-task prediction output module
[0237] The multi-task prediction output module provides comprehensive support for sales strategy formulation by jointly modeling regression and classification tasks, simultaneously outputting the total demand for SIM cards, the distribution of package types, and the prediction confidence level.
[0238] The fused features are mapped to the total demand using a two-layer fully connected network: y total =W t ·ReLU(W t1 ·F adapt +b t1 )+b t In the formula, y total For the total demand of numbered cards in the next cycle; F adapt =F local The feature vector after federated adaptation; W t1 b is the weight matrix of the first fully connected layer; t1 The first layer bias vector W t b is the weight matrix for the second fully connected layer. t This is the bias vector for the second layer.
[0239] The demand percentage for each package is predicted using a softmax classifier, and the demand for a single package is obtained by combining this with the total demand. y c =y total ·p c In the above formula, p c Let W represent the demand percentage for the c-th package, and the sum of the demand percentages for all packages is 1; c b is the classification weight vector for the c-th package; c The category bias for the c-th package; y c To determine the specific demand for the c-th package, a joint forecast of "total quantity and structure" is achieved.
[0240] The Monte Carlo dropout method is used to quantify prediction uncertainty: 10% of neurons are randomly deactivated during the prediction process, and the prediction is repeated 20 times to obtain a prediction set. After calculating the mean μ and standard deviation σ, a 95% confidence interval [μ-1.96σ, μ+1.96σ) is output to provide a risk reference for inventory preparation.
[0241] In this application, the local prediction model achieves the organic integration of heterogeneous feature processing, spatiotemporal correlation modeling, dynamic attention adjustment, federated learning adaptation, and multi-task prediction through modular design and mathematical optimization. Among them, the dynamic gating mechanism of the improved GRU improves the accuracy of temporal modeling by introducing feature importance scores; the multi-dimensional attention fusion strategy realizes the adaptive enhancement of feature, time, and regional information; and the deep adaptation of federated learning and regional features takes into account both global and local knowledge while protecting privacy, so that the model can improve the accuracy and practicality of cross-regional SIM card demand prediction while ensuring data privacy.
[0242] For example, the multi-task prediction output module of the South China regional node calculates the total demand for the next period as 80,000 units through the regression branch. The classification branch obtains the proportion of data packages (65%), voice packages (20%), and bundled packages (15%) through the softmax function. After multiple Monte Carlo dropout calculations, the 95% confidence interval of the total demand is obtained as [75,000 units, 85,000 units]. Finally, the result of "total demand of 80,000 units, data packages of 52,000 units, and confidence interval [75,000, 85,000]" is fed back to the decision center through the message hub module, guiding the region to reserve 55,000 data packages in advance (reserving a 6% safety stock).
[0243] Based on the above technical solutions, the demand forecasting module in this application embodiment, through federated learning collaborative optimization, deep mining of local data, and precise output from multiple modules, not only solves the problem of balancing cross-regional data privacy protection and overall prediction accuracy in existing systems, but also achieves a "precise total quantity, clear structure, and measurable reliability" prediction effect for SIM card demand through multi-dimensional feature processing and multi-task output. This provides a scientific basis for formulating sales strategies for the next cycle (such as inventory allocation and preferential promotion of packages), effectively reduces inventory imbalance and market response lag, and improves the resource utilization rate and market competitiveness of SIM card distribution business.
[0244] The above primarily describes the solutions of the embodiments of this application from the perspective of device implementation. It is understood that each device, such as a SIM card distribution device based on message middleware, includes at least one of the hardware structures and software modules corresponding to the execution of each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software-driven hardware manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0245] This application embodiment can divide a SIM card distribution device based on a message middleware into functional units according to the above method example. For example, each function can be divided into separate functional units, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0246] When using integrated units, Figure 5The diagram shows a possible structure of a message middleware-based SIM card distribution device (referred to as a message middleware-based SIM card distribution device 50) involved in the above embodiments. The message middleware-based SIM card distribution device 50 includes a processing unit 501 and a communication unit 502, and may also include a storage unit 503. Figure 5 The structural diagram shown can be used to illustrate the structure of a SIM card distribution device based on message middleware involved in the above embodiments.
[0247] when Figure 5 The schematic diagram shown illustrates the structure of a SIM card distribution device based on message middleware in the above embodiments. The processing unit 501 is used to control and manage the operation of the SIM card distribution device based on message middleware, the communication unit 502 is used for the SIM card distribution device based on message middleware to communicate with other devices, and the storage unit 503 is used to store the program code and data of the SIM card distribution device based on message middleware.
[0248] For example, communication unit 502 is used to construct a communication link based on a distributed message middleware cluster, realizing asynchronous communication and data transmission within the system. Specifically, this includes: transmitting messages generated by business function modules within the system; transmitting first-priority order creation messages, commission settlement messages, and inventory change messages, as well as second-priority operation log messages, behavior tracking messages, and batch report messages to the corresponding topic partitions; distributing encrypted global model parameters to each sales region node in the federated learning framework, while simultaneously receiving local model parameter updates from each sales region node after encryption processing; and transmitting data fragments after sensitive data is split to agent nodes in different sales regions through a secure channel in the data security module.
[0249] Processing unit 501 is used to control the core logic execution of the message hub module, data security module, and demand forecasting module. Specifically, it includes: using an intelligent routing engine to identify the business type identifier and sales area label of the messages transmitted by communication unit 502; allocating messages to the corresponding topic partitions according to preset priority rules; using a synchronous confirmation transmission mechanism to process first-priority messages and a batch asynchronous processing mechanism to process second-priority messages; using a data sharding strategy based on agent level and sales area to split the distribution data in storage unit 503, and using a threshold secret sharing algorithm to divide sensitive data into data fragments; simultaneously controlling the dynamic key management unit to generate temporary session keys and the access auditing unit to record data access behavior; in demand forecasting, initializing global model parameters, controlling each sales area node to train a local forecasting model based on local sales data and demographic data, and calculating the total demand for SIM cards, the demand for each package type, and the forecast confidence interval for the next cycle through multi-task forecasting logic.
[0250] In one possible implementation, the processing unit 501 is also used to verify the identity legitimacy and parameter integrity of each sales area node, use an adaptive weighted aggregation algorithm to aggregate the local model parameter update of each node, generate new global model parameters, and determine whether the model has reached the preset convergence condition; at the same time, when the authorized requester accesses sensitive data, the identity information and access permissions of the requester are verified, and after confirming that the number of collected sensitive data fragments meets the preset requirements, the original sensitive data is restored through Lagrange interpolation logic.
[0251] In one possible implementation, the communication unit 502 is further configured to send the data access behavior recorded by the access audit unit to the audit log center for centralized storage; the processing unit 501 is further configured to standardize the continuous features received by the communication unit 502, encode and vector map the discrete features, periodically process the time features to generate an initial feature matrix, and then extract time-dependent features and spatial correlation features through the spatiotemporal feature extraction module, and combine the attention fusion module to assign dynamic weights to the features, optimize the feature input of the local prediction model, and improve the accuracy of SIM card demand prediction.
[0252] The processing unit 501 can be a processor or a controller, and the communication unit 502 can be a communication interface, transceiver, transceiver circuit, transceiver device, etc. The term "communication interface" is a general term and may include one or more interfaces. The storage unit 503 can be a memory. When a SIM card distribution device 50 based on message middleware is a chip, the processing unit 501 can be a processor or a controller, and the communication unit 502 can be an input interface and / or an output interface, pins, or circuits, etc. The storage unit 503 can be a storage unit within the chip (e.g., a register, cache, etc.) or a storage unit located outside the chip (e.g., read-only memory (ROM), random access memory (RAM, etc.).
[0253] The communication unit can also be called a transceiver unit. An antenna and control circuit with transceiver functions in a message middleware-based SIM card distribution device 50 can be considered as a communication unit 502 of the message middleware-based SIM card distribution device 50, and a processor with processing functions can be considered as a processing unit 501 of the message middleware-based SIM card distribution device 50. Optionally, the device in the communication unit 502 used to implement the receiving function can be considered as a communication unit, which is used to execute the receiving steps in the embodiments of this application. The communication unit can be a receiver, a receiver circuit, etc. The device in the communication unit 502 used to implement the sending function can be considered as a sending unit, which is used to execute the sending steps in the embodiments of this application. The sending unit can be a transmitter, a transmitter, a sending circuit, etc.
[0254] Figure 5 If the integrated units in the process are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. Storage media for storing computer software products include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0255] Figure 5 The units in the process can also be called modules; for example, a processing unit can be called a processing module.
[0256] This application also provides a hardware structure diagram of a message middleware-based SIM card distribution device (referred to as a message middleware-based SIM card distribution device 60), see [link to relevant documentation]. Figure 6 The SIM card distribution device 60 based on message middleware includes a processor 601, and optionally, a memory 602 connected to the processor 601.
[0257] In the first possible implementation, see Figure 6A SIM card distribution device 60 based on a message middleware also includes a transceiver 603. The processor 601, memory 602, and transceiver 603 are connected via a bus. The transceiver 603 is used to communicate with other devices or communication networks. Optionally, the transceiver 603 may include a transmitter and a receiver. The device in the transceiver 603 that implements the receiving function can be considered as a receiver, which is used to perform the receiving steps in the embodiments of this application. The device in the transceiver 603 that implements the sending function can be considered as a transmitter, which is used to perform the sending steps in the embodiments of this application.
[0258] Based on the first possible implementation method Figure 6 The structural diagram shown can be used to illustrate the structure of a SIM card distribution device based on message middleware involved in the above embodiments.
[0259] in, Figure 6 This can also be illustrated as a system chip in a message middleware-based SIM card distribution device. In this case, the actions performed by the aforementioned message middleware-based SIM card distribution device can be implemented by this system chip. The specific actions performed are described above and will not be repeated here.
[0260] In implementation, each step of the method provided in this embodiment can be completed by integrated logic circuits in the processor or by instructions in software form. The steps of the method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0261] The processor in this application may include, but is not limited to, at least one of the following: a central processing unit (CPU), a microprocessor, a digital signal processor (DSP), a microcontroller unit (MCU), or an artificial intelligence processor, etc., and other computing devices that run software. Each computing device may include one or more cores for executing software instructions to perform calculations or processing. The processor may be a separate semiconductor chip or integrated with other circuits into a single semiconductor chip. For example, it may be integrated with other circuits (such as encoding / decoding circuits, hardware acceleration circuits, or various bus and interface circuits) to form a System-on-a-Chip (SoC), or it may be integrated as a built-in processor within an ASIC. The ASIC with the integrated processor may be packaged separately or together with other circuits. In addition to the cores for executing software instructions to perform calculations or processing, the processor may further include necessary hardware accelerators, such as field-programmable gate arrays (FPGAs), PLDs (programmable logic devices), or logic circuits that implement dedicated logic operations.
[0262] The memory in the embodiments of this application may include at least one of the following types: read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions; random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; or electrically erasable programmable-only memory (EEPROM). In some scenarios, the memory may also be a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0263] This application also provides a computer-readable storage medium including instructions that, when run on a computer, cause the computer to perform any of the methods described above.
[0264] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods described above.
[0265] This application also provides a chip including a processor and an interface circuit. The interface circuit is coupled to the processor. The processor is used to run computer programs or instructions to implement the above-described method. The interface circuit is used to communicate with other modules outside the chip.
[0266] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0267] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, the disclosure, and the appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0268] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and modifications.
Claims
1. A SIM card distribution system based on message middleware, characterized in that, include: The message hub module is used to process asynchronous communication and data transmission within the system using a distributed message middleware cluster. The data security module is used to manage distribution data in various regions using a data sharding storage mechanism; the distribution data includes user identity information, product order records, commission settlement details, and agent hierarchy relationships. The demand forecasting module is used to predict the demand for SIM cards in the next period based on sales data and demographic data of each region; the demand for SIM cards is used to guide the formulation of sales strategies for the next period.
2. The SIM card distribution system based on message middleware according to claim 1, characterized in that, The asynchronous communication and data transmission within the system using a distributed message middleware cluster processing method includes: Build a distributed message middleware cluster based on Apache Kafka, and configure multiple topic partitions to handle messages from different business types and sales regions respectively; The intelligent routing engine identifies the business type and sales area label of the input message, and transmits messages of different priorities to the corresponding topic partitions for processing according to preset priority rules.
3. A SIM card distribution system based on message middleware according to claim 2, characterized in that, The step of transmitting messages of different priorities to the corresponding topic partitions for processing according to preset priority rules includes: Messages are divided into first priority and second priority according to preset priority rules; among which, In the topic partition corresponding to the first priority message, a synchronous confirmation transmission mechanism is used to process the message; the synchronous confirmation mechanism means that after the producer sends a message, it will execute subsequent business operations only after receiving a confirmation signal that the message has been successfully written to all synchronous replicas in the distributed message middleware cluster. In the topic partition corresponding to the second priority message, the message is processed using a batch asynchronous processing mechanism. The batch asynchronous processing mechanism means that the producer puts the message into the local buffer. When the preset number or preset time interval is reached, the producer sends the messages in the local buffer to the message middleware cluster in batches. After the message is sent, there is no need to wait for the message middleware cluster to return an acknowledgment signal before subsequent business operations can be performed. The producer refers to the business function module within the system that generates messages to be transmitted, including but not limited to the inventory management module, the demand forecasting module, and additional order management and commission settlement modules within the system. The business function module converts business data into data packets conforming to the Apache Kafka cluster message format through a preset message encapsulation interface, and then sends a message request to the distributed message middleware cluster.
4. A SIM card distribution system based on message middleware according to claim 1, characterized in that, The data sharding storage mechanism includes: A data sharding strategy based on agent level and sales region is adopted to store distribution data on agent nodes under the directly associated sales region; The threshold secret sharing algorithm is used to divide sensitive data into multiple data fragments, and the data fragments are distributed and stored in agent nodes in different sales regions; the sensitive data is the privacy fields in the user's identity information, including ID card number, mobile phone number and bank card number.
5. A SIM card distribution system based on message middleware according to claim 4, characterized in that, The threshold secret sharing algorithm is used to segment sensitive data into multiple data fragments, including: After converting the segmented sensitive data S into values over the prime field GF(p), a polynomial f(x) of degree k-1 is constructed; the prime field GF(p) represents a finite field containing p elements (all arithmetic operations are performed modulo p), and k represents the minimum number of fragments required to recover the original sensitive data. allocating a unique identification index x to each proxy node i , and calculating the data fragment (x i , y i ) of each proxy node according to the polynomial; wherein y i = f(x i ), 1≤i≤n, n represents the total number of data fragments, and n≥k; The data fragments are transmitted and stored separately to agent nodes in n different sales regions through a secure channel, with each agent node holding only a unique data fragment. Furthermore, the expression for the polynomial is: f(x) = S + a1x + a2x 2 +…+a k-1 x k-1 (mod p), where the coefficients a1, a2, ..., a k-1 It is an integer randomly selected over the prime field GF(p).
6. A SIM card distribution system based on message middleware according to claim 1, characterized in that, The method of predicting the demand for SIM cards in the next cycle based on sales data and demographic data of each region includes: A federated learning framework is constructed, which distributes global model parameters to each sales region through a message hub module. The global model parameters represent the core features of the prediction model maintained by the central server, including the weight matrix, bias vector, model structure, and hyperparameters of each layer of the neural network. At each sales region node, a local prediction model is trained using historical sales data and demographic data based on deep learning algorithms. The sales data includes, but is not limited to, SIM card packages and user profiles of those who purchase products. The user profiles include age ranges, genders, and data traffic usage preferences. The demographic data includes, but is not limited to, the age distribution of the population in the sales region, the gender ratio of the population, and the number of people corresponding to different genders and age groups. The regional sales data and demographic data from the previous period are input into the trained local prediction model to obtain the demand for different SIM card packages in the next period.
7. A SIM card distribution system based on message middleware according to claim 6, characterized in that, The federated learning framework is used for distributed model training and inference for cross-regional SIM card demand forecasting, enabling collaborative optimization of the global model without requiring sales regions to operate locally. The specific workflow of the federated learning framework includes: S1. Initialize global model parameters and encrypt and distribute them to each sales region node. The global model parameters include the weight matrix, bias vector, activation function type and hyperparameters of each layer of the neural network. S2, after receiving the global model parameters, each sales region node trains the model based on the locally preprocessed sales data and demographic data, and generates the local model parameter update volume; S3, each sales region node encrypts the local model parameter update and transmits it to the central server through the secure communication channel of the message hub module; the encryption process uses a homomorphic encryption algorithm to ensure the confidentiality of the parameter transmission process; S4, the central server uses an adaptive weighted aggregation algorithm to aggregate the parameter updates of all sales region nodes to generate new global model parameters; the adaptive weighted aggregation algorithm dynamically allocates aggregation weights based on the proportion of data volume in each region, historical prediction accuracy, and feature importance. S5, the central server encrypts and distributes the updated global model parameters to each sales region node. Each node replaces the local model parameters and repeats S2-S4 until the model reaches the preset convergence condition. The convergence condition includes the global loss function value being lower than a threshold, the parameter change being less than a set value for N consecutive iterations, or the maximum number of training rounds being reached. S6. When the convergence condition is met, the central server will distribute the final global model parameters to each sales region node. Each node will predict the demand for SIM cards in the next cycle based on the locally deployed prediction model and feed the prediction results back to the decision center through the message hub module.
8. A SIM card distribution system based on message middleware according to claim 7, characterized in that, The local prediction model includes a feature embedding module, a spatiotemporal feature extraction module, an attention fusion module, a federated learning adaptation module, and a multi-task prediction output module; wherein... The feature embedding module is used to standardize and transform the input features, mapping discrete features, continuous features, and time features to a feature space of a unified dimension to obtain an initial feature matrix. The discrete features include user gender, package type, user age group label, and region code. The continuous features include average spending per person, historical data usage, regional population density, and sales growth rate. The time features include period index, month identifier, number of days since the last promotion, and quarterly period code. The spatiotemporal feature extraction module is used to extract the time-dependent features and spatial correlation features between sales regions of the initial feature matrix, and to fuse the time-dependent features and spatial correlation features through feature concatenation operation to obtain spatiotemporal interaction features. The attention fusion module is used to dynamically assign weights and enhance features of spatiotemporal interaction features. By calculating feature importance scores, the influence of key features is strengthened, and an optimized fusion feature vector is obtained. The federated learning adaptation module is used to perform local feature enhancement, parameter update calculation, and parameter encryption on the fused feature vector to obtain the encrypted and compressed local model parameter update amount; the parameter update amount is transmitted to the central server through the message hub module to participate in global aggregation, and receives the global parameter update local model issued by the central server. The multi-task prediction output module is used to perform multi-dimensional prediction tasks based on the feature representation enhanced by the federated learning adaptation module, and outputs a comprehensive result including total demand, package type distribution and prediction confidence.
9. A SIM card distribution system based on message middleware according to claim 7, characterized in that, The internal workflow of the attention fusion module is as follows: Using the spatiotemporal interaction feature matrix as input, the importance score of a single feature dimension in the spatiotemporal interaction feature matrix is calculated by a multilayer perceptron. Based on the importance scores, softmax normalization is performed to obtain feature-level weights; A time decay factor is set based on historical periodic patterns to obtain time period weights; Calculate the regional difference weights based on the historical prediction errors of each region; The spatiotemporal interaction features are weighted and summed by multiplying the feature-level weights, time period weights, and regional difference weights to obtain the optimized fusion feature vector.
10. A SIM card distribution system based on message middleware according to claim 7, characterized in that, The internal workflow of the federated learning adaptation module is as follows: Using the fused feature vector and the global model parameters issued by the central server as input, the region-specific feature vector is linearly transformed and activated, and then superimposed with the fused feature vector to generate local enhanced features; the region-specific feature vector refers to features that reflect the individual attributes of the sales region, including but not limited to the proportion of various types of packages in the sales region and the density of regional competitors. The loss function is constructed based on the real labels of the local training data, and the parameter update amount of the local model is calculated by gradient descent. The parameter update amount is subjected to Top-K sparsity and 8-bit quantization, and then encrypted using a homomorphic encryption algorithm to obtain the encrypted and compressed parameter update amount; The system receives global parameter updates, updates the local model using a weighted fusion strategy, and transmits the encrypted and compressed parameter updates to the central server for global aggregation.
Citation Information
Patent Citations
Message caching system and message caching method based on Kafka
CN109451072A
Federated learning architecture under dynamic bandwidth and unreliable network and compression algorithm of architecture
CN111447083A
Fully homomorphic block chain privacy protection method based on Shamir threshold secret sharing
CN114598446A
Marketing management system based on AI algorithm
CN118822612A
Cloud mobile phone market demand analysis method and related equipment
CN120337152A
Cited By
An AI-based eSIM code number full life cycle management system
CN122367095A
An AI-based eSIM code number full life cycle management system
CN122367095B