Prepayment bill management method and device, equipment and storage medium
By using the improved isolation forest model and Bayesian classifier to perform anomaly detection and trend analysis on courier bills, the financial pressure and risk identification problems in courier prepayment management are solved, and efficient bill management and risk control are achieved.
Patent Information
- Application Number
- CN202510826506.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-26
AI Technical Summary
Couriers face financial pressure and risks in prepayment management during operations that are difficult to trace. Existing technologies are unable to analyze prepayment consumption trends in real time, and the efficiency of anomaly detection is low, making it impossible to promptly identify risky behaviors such as repeated advance payments.
An improved isolation forest model combined with a Bayesian classifier is used to detect anomalies in multi-dimensional feature bill sets, generate graded reminder information, and eliminate abnormal transaction data through courier confirmation interactions and consumption trend analysis to construct prepaid consumption trends.
It achieves efficient management and risk control of couriers' bills, ensures the accuracy of data extraction and integration, keenly captures abnormal transactions and generates reasonable graded reminders, providing deep insights into consumer behavior.
Smart Images

Figure CN120705707A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bill management, and in particular to a prepaid bill management method, apparatus, device and storage medium. Background Art
[0002] In the express delivery industry, couriers often face the need to advance funds due to the characteristics of their work processes, making prepayment management a pain point in the industry. Specifically:
[0003] 1. Cost prepayment pressure in the receiving process
[0004] When couriers collect "cash on delivery" or "cash on delivery" parcels, they must prepay packaging materials or freight charges on behalf of the customer. Some e-commerce clients (especially small businesses) require couriers to prepay order shipping costs, with settlement to be made after the recipient signs for the parcel. These advance payments have a cash turnover cycle of 1-7 days. During peak shopping seasons (such as Singles' Day), when couriers receive a surge in parcels, the advance payments can reach thousands of yuan, tying up significant personal funds in the short term and straining cash flow.
[0005] 2. Emergency expenditure requirements during delivery
[0006] Couriers are also required to prepay the additional shipping or storage fees incurred by customers who request a "redirect" package. These unexpected expenses are random, and the company's reimbursement process is often slow, forcing couriers to shoulder the financial burden themselves, impacting their job stability.
[0007] 3. Traditional prepaid bill management relies on manual recording and verification, which has the following problems:
[0008] The data dimension is single: it only records basic information such as transaction time and amount, lacks multi-dimensional labeling of expense types and business scenarios, and is difficult to trace the reasons for advance payments and their relevance to the business.
[0009] Delayed anomaly detection: Manual screening of abnormal transactions is inefficient and cannot promptly identify risky behaviors such as duplicate advance payments.
[0010] Lack of dynamic management: It is impossible to analyze prepaid consumption trends in real time, making it difficult to provide couriers with targeted capital turnover advice or risk warnings, which restricts the improvement of operational efficiency and service quality.
[0011] Therefore, the existing technology still needs to be improved and developed. Summary of the Invention
[0012] The present invention provides a prepayment bill management method, apparatus, device and storage medium for managing and analyzing prepayment bills.
[0013] A first aspect of the present invention provides a prepaid bill management method, which includes: receiving a query request from a courier, parsing the query request to obtain a query type and a user identifier, and generating a structured query object based on the query type and the user identifier; querying bill records based on the structured query object to obtain query data, and constructing a multidimensional feature bill set including transaction time, amount, and fee type based on the query data; using an improved isolation forest model to perform anomaly detection on the multidimensional feature bill set, and filtering out abnormal transaction data based on the detection results; inputting the abnormal transaction data into a pretrained Bayesian classifier, obtaining a classification result output by the Bayesian classifier, and generating graded reminder information based on the classification result; feeding back the abnormal transaction data and the graded reminder information to the courier, obtaining the courier's confirmation result, eliminating the multidimensional feature bill set based on the confirmation result, and analyzing the eliminated multidimensional feature bill set to obtain a prepaid consumption trend.
[0014] Optionally, in a first implementation method of the first aspect of the present invention, the receiving of the courier's query request and parsing of the query request to obtain a query type and a user identifier include: receiving the courier's query request through an API interface and parsing the query request to obtain a plurality of fields; using a first regular expression and a second regular expression to match the plurality of fields to obtain a query type and a user identifier respectively; performing security verification on the user identifier, and binding the verified user identifier to the query type to generate a structured query object.
[0015] Optionally, in a second implementation method of the first aspect of the present invention, querying bill records according to the structured query object to obtain query data, and constructing a multidimensional feature bill set containing transaction time, amount, and fee type based on the query data, including: determining the data storage location according to the user identifier, and selecting the corresponding data table according to the query type; querying bill records according to the selected data table to obtain query data, and performing data preprocessing on the query data; constructing a multidimensional feature bill set containing transaction time, amount, and fee type based on the preprocessed query data.
[0016] Optionally, in a third implementation method of the first aspect of the present invention, the improved isolation forest model is used to perform anomaly detection on the multidimensional feature bill set, and abnormal transaction data is screened out based on the detection results, including: constructing an isolation forest infrastructure, and introducing a weighted sampling mechanism to improve the isolation forest infrastructure to obtain an improved isolation forest model; extracting basic features from the multidimensional feature bill, and deriving timing features, behavioral features and trend features based on the basic features, the basic features including the transaction time, amount and fee type of each transaction data; fusing the basic features, the timing features, the behavioral features and the trend features and inputting them into the improved isolation forest model to obtain the detection results output by the improved isolation forest model, and screening out abnormal transaction data based on the detection results.
[0017] Optionally, in a fourth implementation method of the first aspect of the present invention, the abnormal transaction data is input into a pre-trained Bayesian classifier to obtain the classification result output by the Bayesian classifier, and graded reminder information is generated based on the classification result, including: extracting classification-related features from the abnormal transaction data to obtain classification features, and performing One-Hot encoding on the classification features; inputting the encoded classification features into a pre-trained Bayesian classifier to obtain the classification result output by the Bayesian classifier; and generating graded reminder information based on the classification result and a preset risk level.
[0018] Optionally, in a fifth implementation of the first aspect of the present invention, the abnormal transaction data and the graded reminder information are fed back to the courier, the courier's confirmation result is obtained, the multidimensional feature bill set is eliminated based on the confirmation result, and the multidimensional feature bill set after elimination is analyzed to obtain the prepaid consumption trend, including: feeding back the abnormal transaction data and the graded reminder information to the courier, obtaining the courier's confirmation result, if the confirmation result indicates that the data is abnormal, then eliminating the corresponding abnormal transaction data from the multidimensional feature bill set; performing K-means clustering analysis on the transaction data of the multidimensional feature bill set after elimination to obtain cluster analysis data; and inputting the cluster analysis data into a trained consumption trend prediction model to obtain the prepaid consumption trend.
[0019] Optionally, in a sixth implementation of the first aspect of the present invention, the cluster analysis data is input into a trained consumption trend prediction model to obtain a prepaid consumption trend, including: constructing and training an LSTM metamodel and an XGBoost metamodel; integrating and training the LSTM metamodel and the XGBoost metamodel to obtain a trained consumption trend prediction model; inputting the cluster analysis data into the trained consumption trend prediction model to obtain a prepaid consumption trend, and generating a consumption analysis report.
[0020] The second aspect of the present invention provides a prepaid bill management device, comprising: a parsing module for receiving a query request from a courier, parsing the query request to obtain a query type and a user identifier, and generating a structured query object based on the query type and the user identifier; a query module for querying bill records based on the structured query object to obtain query data, and constructing a multidimensional feature bill set including transaction time, amount, and fee type based on the query data; an anomaly detection module for performing anomaly detection on the multidimensional feature bill set using an improved isolation forest model, and filtering out abnormal transaction data based on the detection results; a classification module for inputting the abnormal transaction data into a pretrained Bayesian classifier, obtaining a classification result output by the Bayesian classifier, and generating graded reminder information based on the classification result; an analysis module for feeding back the abnormal transaction data and the graded reminder information to the courier, obtaining the courier's confirmation result, eliminating the multidimensional feature bill set based on the confirmation result, and analyzing the eliminated multidimensional feature bill set to obtain a prepaid consumption trend.
[0021] Optionally, in a first implementation of the second aspect of the present invention, the parsing module includes: a parsing unit, used to receive the courier's query request through an API interface, and parse the query request to obtain multiple fields; a matching unit, used to use a first regular expression and a second regular expression to match the multiple fields to obtain a query type and a user identifier; a binding unit, used to perform security verification on the user identifier, and bind the verified user identifier to the query type to generate a structured query object.
[0022] Optionally, in a second implementation of the second aspect of the present invention, the query module includes: a determination unit, used to determine the data storage location based on the user identifier, and select the corresponding data table based on the query type; a query unit, used to query the bill record based on the selected data table, obtain query data, and perform data preprocessing on the query data; a first construction unit, used to construct a multidimensional feature bill set including transaction time, amount, and fee type based on the preprocessed query data.
[0023] Optionally, in a third implementation of the second aspect of the present invention, the anomaly detection module includes: a second construction unit, used to construct the basic architecture of the isolation forest, and introduce a weighted sampling mechanism to improve the basic architecture of the isolation forest to obtain an improved isolation forest model; an extraction unit, used to extract basic features from the multidimensional feature bill, and derive timing features, behavioral features and trend features based on the basic features, and the basic features include the transaction time, amount and fee type of each transaction data; an anomaly detection unit, used to fuse the basic features, the timing features, the behavioral features and the trend features and input them into the improved isolation forest model, obtain the detection results output by the improved isolation forest model, and filter out abnormal transaction data based on the detection results.
[0024] Optionally, in a fourth implementation of the second aspect of the present invention, the classification module includes: an encoding unit, used to extract features related to classification from the abnormal transaction data, obtain classification features, and perform One-Hot encoding on the classification features; a classification unit, used to input the encoded classification features into a pre-trained Bayesian classifier to obtain the classification results output by the Bayesian classifier; and a generation unit, used to generate graded reminder information based on the classification results and preset risk levels.
[0025] Optionally, in a fifth implementation of the second aspect of the present invention, the analysis module includes: a feedback unit, used to feed back the abnormal transaction data and the graded reminder information to the courier, and obtain the courier's confirmation result. If the confirmation result indicates that the data is abnormal, the corresponding abnormal transaction data is eliminated from the multidimensional feature bill set; an analysis unit, used to perform K-means clustering analysis on the transaction data of the multidimensional feature bill set after the elimination process to obtain cluster analysis data; a prediction unit, used to input the cluster analysis data into a trained consumption trend prediction model to obtain prepaid consumption trends.
[0026] A third aspect of the present invention provides a prepaid bill management device, comprising: a memory and at least one processor, wherein the memory stores computer-readable instructions, and the memory and the at least one processor are interconnected via a circuit; the at least one processor calls the computer-readable instructions in the memory to cause the prepaid bill management device to execute each step of the prepaid bill management method described above.
[0027] A fourth aspect of the present invention provides a computer-readable storage medium having computer-readable instructions stored therein, which, when executed on a computer, causes the computer to execute the steps of the prepaid bill management method described above.
[0028] The technical solution provided by the present invention realizes the efficient management and risk control of couriers' bills at the data processing level. By parsing query requests, structured query objects are generated and multi-dimensional feature bill sets are constructed to ensure the accuracy and efficiency of data extraction and integration. In terms of anomaly detection, the improved isolation forest model combined with the Bayesian classifier can not only keenly capture abnormal transactions, but also carefully classify anomalies and generate reasonable graded reminders. In the interaction and analysis link, through confirmation interaction with couriers and consumption trend analysis, it not only ensures data accuracy, but also provides in-depth insights into the couriers' consumption behavior. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A first flow chart of the prepaid bill management method provided in an embodiment of the present invention;
[0030] Figure 2 A second flow chart of the prepaid bill management method provided in an embodiment of the present invention;
[0031] Figure 3 A third flow chart of the prepaid bill management method provided in an embodiment of the present invention;
[0032] Figure 4 A fourth flow chart of the prepaid bill management method provided by an embodiment of the present invention;
[0033] Figure 5 A fifth flow chart of the prepaid bill management method provided in an embodiment of the present invention;
[0034] Figure 6 A sixth flow chart of the prepaid bill management method provided in an embodiment of the present invention;
[0035] Figure 7 A schematic diagram of the structure of a prepaid bill management device provided by an embodiment of the present invention;
[0036] Figure 8 A schematic diagram of the structure of a prepaid bill management device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] Embodiments of the present invention provide a prepaid bill management method, apparatus, device, and storage medium for managing and analyzing prepaid bills. The method comprises: receiving a query request from a courier, parsing the query request to obtain a query type and user identifier, and generating a structured query object based on the query type and user identifier; querying bill records based on the structured query object to obtain query data, and constructing a multidimensional feature bill set containing transaction time, amount, and fee type based on the query data; performing anomaly detection on the multidimensional feature bill set using an improved isolation forest model, and filtering out abnormal transaction data based on the detection results; inputting the abnormal transaction data into a pretrained Bayesian classifier, obtaining a classification result output by the Bayesian classifier, and generating graded reminder information based on the classification result; feeding the abnormal transaction data and the graded reminder information back to the courier, obtaining a confirmation result from the courier, eliminating the multidimensional feature bill set based on the confirmation result, and analyzing the eliminated multidimensional feature bill set to obtain prepaid consumption trends.
[0038] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0039] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 A first embodiment of a prepaid bill management method according to an embodiment of the present invention includes:
[0040] S101: Receive a query request from a courier, parse the query request to obtain a query type and a user identifier, and generate a structured query object according to the query type and the user identifier.
[0041] In this embodiment, continuous monitoring is performed through a specific interface or service to receive query requests initiated by the courier from the client (such as APP, PC), and support HTTP / HTTPS and other protocol transmission.
[0042] In this embodiment, the query types include real-time bill flow query and monthly summary bill query.
[0043] In this embodiment, the user identifier includes a courier employee number, a mobile phone number, etc.
[0044] It is understandable that the execution subject of the present invention may be a prepaid bill management device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0045] S102. Query bill records according to the structured query object to obtain query data, and construct a multi-dimensional feature bill set including transaction time, amount, and fee type according to the query data.
[0046] In this embodiment, according to the structured query object, the corresponding SQL query statement is executed in the bill database to retrieve the bill records corresponding to the query type and user identifier. If the data volume is large, paging or streaming processing is used to avoid memory overflow.
[0047] In this embodiment, statistical features (such as weekly cumulative amount), time series features (transaction intervals), and other features can also be derived and put into a multi-dimensional feature bill set.
[0048] S103. Use the improved isolation forest model to perform anomaly detection on the multi-dimensional feature bill set, and filter out abnormal transaction data based on the detection results.
[0049] In this embodiment, numerical features are standardized, categorical features are encoded, and missing values in the data are processed.
[0050] In this embodiment, based on the isolation forest model, improved strategies such as dynamic subsample generation, feature-weighted isolation tree, and multi-scale ensemble detection are adopted to construct an improved isolation forest model.
[0051] In this embodiment, the processed multi-dimensional feature bill set is input into the model, anomaly scores are calculated, and adaptive threshold calibration is combined to filter out abnormal transaction data. Adaptive threshold calibration dynamically adjusts the threshold based on density and integrates business rules.
[0052] S104: Input the abnormal transaction data into a pre-trained Bayesian classifier, obtain the classification results output by the Bayesian classifier, and generate graded reminder information based on the classification results.
[0053] In this embodiment, relevant features are extracted from the abnormal transaction data, and encoding and missing value processing are performed to make it meet the input requirements of the Bayesian classifier. Then, the pre-trained Bayesian classifier is loaded, and the processed abnormal transaction data is input into the pre-trained Bayesian classifier to obtain the category prediction results of the abnormal transaction data and the probability estimation of each category.
[0054] In this embodiment, based on the preset risk level mapping rules, combined with the classification results and probabilities, graded reminder information is generated to clearly mark the abnormal risk level and recommended operations.
[0055] S105. Feedback the abnormal transaction data and graded reminder information to the courier, obtain the courier's confirmation result, remove the abnormal transaction data confirmed to be abnormal from the multi-dimensional feature bill set, and analyze the multi-dimensional feature bill set to obtain the prepaid consumption trend.
[0056] In this embodiment, abnormal transaction data and graded reminder information are sent to couriers through multiple channels such as APP push, SMS, and system messages, and an interactive confirmation interface is provided for easy operation.
[0057] In this embodiment, the courier's confirmation result is obtained. If it is confirmed to be abnormal, the corresponding abnormal transaction data is removed from the multi-dimensional feature bill set, and the relevant data records are updated; if it is confirmed to be normal, no processing is required.
[0058] In this embodiment, a time series model can be used to predict monthly consumption fluctuations.
[0059] This embodiment provides a prepaid bill management method, which realizes the efficient management and risk control of couriers' bills. At the data processing level, by parsing query requests, structured query objects are generated and multi-dimensional feature bill sets are constructed to ensure the accuracy and efficiency of data extraction and integration. In terms of anomaly detection, the improved isolation forest model combined with the Bayesian classifier can not only keenly capture abnormal transactions, but also carefully classify anomalies and generate reasonable graded reminders. In the interaction and analysis link, through confirmation interaction with couriers and consumption trend analysis, it not only ensures data accuracy but also provides in-depth insights into the couriers' consumption behavior.
[0060] See also Figure 2 A second embodiment of the prepaid bill management method according to the present invention includes:
[0061] S201. Receive a query request from a courier through an API interface, and parse the query request to obtain multiple fields.
[0062] In this embodiment, a dedicated API interface is built and deployed on the server side, which continuously monitors query requests from the courier client (such as mobile APP, PC management system), supports common protocols such as HTTP / HTTPS, and ensures that the interface can stably receive various request data.
[0063] In this embodiment, when the API interface receives a query request, it parses the request data according to a preset request format (such as JSON, XML) and breaks it down into multiple independent fields, such as request time, query type identifier, user identity identifier, device information, etc., to prepare for the subsequent accurate extraction of key information.
[0064] S202: Use the first regular expression and the second regular expression to match multiple fields to obtain a query type and a user identifier.
[0065] In this embodiment, corresponding regular expression rules are predefined based on the query type and the format characteristics of the user identifier. The first regular expression is used to match the query type, such as matching the specific string format of "real-time bill flow query" or "monthly summary bill query"; the second regular expression is used to match the user identifier, such as matching the courier's mobile phone number (which meets the 11-digit rule) or the employee ID (which has a specific length format of a combination of letters and numbers).
[0066] S203: Perform security verification on the user ID, and bind the verified user ID to the query type to generate a structured query object.
[0067] In this embodiment, multiple verification methods are used to perform security checks on user IDs. First, the courier account corresponding to the user ID is verified to be in a normal and available state, such as not being blocked or expired. Second, password verification, token verification (such as a JWT token), or secondary authentication are used to confirm that the operation request comes from a legitimate user. Finally, the user's operation permissions are checked to ensure that the courier has the authority to query the corresponding type of bill.
[0068] In this embodiment, once a user ID passes security verification, it is bound to a query type, establishing an association between the two. Then, based on the bound user ID and query type, a structured query object is generated according to a pre-defined data structure specification. This object contains explicit user identity information and query type information, presented in a standardized format.
[0069] In this embodiment, the API interface is used to receive requests and parse fields to ensure the compatibility and integrity of data acquisition; regular expressions are used to accurately match query types and user identifiers, which improves the accuracy and efficiency of data extraction; user identifiers are security verified and bound to generate structured query objects, which not only ensures data access security, but also lays a standardized data foundation for subsequent bill queries, effectively avoiding query anomalies caused by request parsing errors or illegal access, and providing couriers with fast, accurate and secure bill query services.
[0070] See also Figure 3A third embodiment of a prepaid bill management method according to an embodiment of the present invention includes:
[0071] S301: Determine a data storage location according to a user identifier, and select a corresponding data table according to a query type.
[0072] In this embodiment, user identification information is extracted from the structured query object. This identification is typically unique, such as a courier's work ID or registered mobile phone number. Based on the user identification and pre-defined storage rules, the specific storage location of the user's billing data is quickly located in the database cluster or distributed storage system. For example, a hash algorithm is used to map the user identification to a specific database partition or storage node.
[0073] In this embodiment, the query type information in the structured query object is extracted to determine whether it is a real-time bill flow query or a monthly bill summary query. Based on the query type, the corresponding stored data table is selected from the database. For example, a real-time bill flow query is associated with the real-time transaction data table, and a monthly bill summary query is associated with the monthly bill summary table. This ensures that the query is performed on the correct data table.
[0074] S302: Query bill records according to the selected data table to obtain query data, and perform data preprocessing on the query data.
[0075] In this embodiment, a query statement that conforms to database syntax specifications, such as an SQL query statement, is constructed based on the selected data table and the user identifier in the structured query object. For example, to query real-time bill flow, a SELECT statement containing the user identifier condition is constructed to filter out the real-time transaction records of the corresponding courier.
[0076] In this embodiment, data preprocessing performed on query data includes data cleaning and data conversion.
[0077] S303: Construct a multi-dimensional feature bill set including transaction time, amount, and fee type based on the pre-processed query data.
[0078] In this embodiment, key features are extracted from the preprocessed query data, including core fields such as transaction time, amount, and fee type, time dimension features such as the hour, date, and week of the transaction time, and statistical features such as the cumulative value and average value of the amount. The extracted features are integrated and organized into a multi-dimensional feature bill set according to a certain data structure.
[0079] In this embodiment, the data storage location and corresponding table are determined based on the user identifier and query type to ensure the targeted and efficient data retrieval; the query data is preprocessed to effectively improve the data quality and lay a solid foundation for subsequent analysis; and finally, a multi-dimensional feature bill set is constructed to comprehensively integrate key information to facilitate subsequent anomaly detection and trend analysis, which not only improves the efficiency of bill data processing, but also enhances the availability and analytical value of the data.
[0080] See also Figure 4 A fourth embodiment of a prepaid bill management method according to an embodiment of the present invention includes:
[0081] S401. Construct an isolation forest infrastructure and introduce a weighted sampling mechanism to improve the isolation forest infrastructure to obtain an improved isolation forest model.
[0082] In this embodiment, based on the basic principles of the isolation forest algorithm, the basic parameters of the isolation forest model are initialized, such as setting the number of trees (usually 100-200 trees), the subsample size (generally 25%-50% of the data set), etc., to build the overall framework of the model.
[0083] In this embodiment, methods such as random forest feature importance and SHAP value are used to evaluate the importance of each feature in the multidimensional feature bill set (such as transaction time, amount, fee type, etc.), quantify the contribution of each feature in distinguishing normal and abnormal transactions, and obtain the feature importance ranking or weight value.
[0084] In this embodiment, when constructing each isolation tree, the traditional isolation forest method of selecting splitting attributes with equal probability is changed to weighted sampling based on the calculated feature importance weights. For example, the highly important transaction amount feature is given a higher probability of being selected as a splitting attribute, while the probability of selecting less important features is reduced. This makes the constructed isolation tree more inclined to split based on key features, improving the model's ability to capture abnormal data, and ultimately resulting in an improved isolation forest model.
[0085] S402. Extract basic features from the multi-dimensional feature bill, and derive time series features, behavior features, and trend features based on the basic features. The basic features include the transaction time, amount, and fee type of each transaction data.
[0086] In this embodiment, core basic features are directly extracted from the multidimensional feature bill set, including the transaction time of each transaction data (accurate to the specific date and time), transaction amount (the actual transaction value), and fee type (such as collection fees, delivery fees, fines, etc.) to form a basic feature data set.
[0087] In this example, derived features related to time series are calculated based on the fundamental feature of transaction time. For example, the time interval between two adjacent transactions is calculated to determine the frequency of transactions; the number of transactions per day, week, and month is counted to analyze the distribution of transactions over time; and information such as the hour, week, and month of the transaction time is extracted to explore differences in transaction patterns across different time periods.
[0088] In this example, we combine basic features such as transaction amount, fee type, and transaction time to explore features related to courier transaction behavior. For example, we calculate the proportion of transaction amounts for the same fee type within a certain timeframe to analyze the courier's business focus; we count the frequency of transactions within a specific area and timeframe to determine the courier's business scope and active hours; and we compare the fluctuations in transaction amounts for different fee types to assess the stability of the courier's business income.
[0089] In this embodiment, time series data is used to calculate trend characteristics of indicators such as transaction amounts and transaction counts using algorithms such as moving averages and exponential smoothing. For example, the moving average of transaction amounts over a period of time is calculated to observe their upward or downward trends; the month-on-month and year-on-year growth rates of transaction counts are analyzed to determine business volume trends; and periodic patterns in transaction data (such as peak transactions at fixed times of the week) are identified to predict future transaction trends.
[0090] S403: The basic features, time series features, behavioral features, and trend features are integrated and input into the improved isolation forest model to obtain the detection results output by the improved isolation forest model, and abnormal transaction data is screened out based on the detection results.
[0091] In this embodiment, the extracted basic features, derived time series features, behavioral features, and trend features are integrated to form a feature set containing multi-dimensional information. These features can be arranged in a specific order to form a feature vector or feature matrix, ensuring that each transaction data record corresponds to a complete multi-dimensional feature description.
[0092] In this example, the fused feature set is input into an improved isolation forest model. Based on a trained isolation tree, the improved isolation forest model analyzes each sample (i.e., each transaction data item). By calculating the path length of the sample in the isolation tree, the model assesses its degree of abnormality and outputs an anomaly score or anomaly label (labeled as normal or abnormal) for each sample, yielding an overall detection result.
[0093] In this embodiment, an abnormality judgment threshold is set based on the detection results output by the model, and transaction data with an abnormality score higher than the threshold or marked as an abnormal label is screened out as the final identified abnormal transaction data for subsequent further analysis, processing and early warning.
[0094] In this embodiment, the abnormality judgment threshold can be based on the default contamination rate parameter of the model, or can be manually adjusted in combination with business experience.
[0095] In this embodiment, the accuracy and effectiveness of abnormal transaction detection are significantly improved through innovative improvements to the isolation forest model and the fusion of multi-dimensional features. In model construction, weighted sampling is performed based on feature importance, and the splitting logic of the isolation tree is optimized to make the model more in line with the characteristics of express bill data; in data processing, basic features are deeply mined from multi-dimensional feature bills and time series, behavior, trend and other features are derived to fully cover the potential patterns of transaction data; finally, the multi-dimensional features are fused and input into the improved model to accurately screen abnormal transaction data, which not only reduces false positives and missed reports, but also captures complex abnormal patterns, providing strong technical support for the risk management of couriers' prepaid bills.
[0096] See also Figure 5 A fifth embodiment of a prepaid bill management method according to an embodiment of the present invention includes:
[0097] S501. Extract features related to classification from abnormal transaction data to obtain classification features, and perform One-Hot encoding on the classification features.
[0098] In this embodiment, features that have a key impact on anomaly classification are screened out, such as transaction amount, transaction time (specific to hour, day of the week, etc.), fee type, transaction location, transaction frequency, etc. These features are extracted one by one from the abnormal transaction data records to form a classification feature dataset.
[0099] In this embodiment, one-hot encoding is used to process categorical data within classification features (such as fee type and transaction location). One-hot encoding converts each category into a binary vector, where only one element is 1 and the rest are 0. This converts categorical data into numerical data, eliminating the influence of size relationships between data categories and ensuring that the data meets the input requirements of the Bayesian classifier. For example, if there are three fee types: "collection fee," "delivery fee," and "fine," they are encoded as [1, 0, 0], [0, 1, 0], and [0, 0, 1], respectively.
[0100] S502: Input the encoded classification features into a pre-trained Bayesian classifier to obtain a classification result output by the Bayesian classifier.
[0101] In this embodiment, the classification feature data after one-hot encoding is input into a pre-trained Bayesian classifier. Based on Bayes' theorem, the Bayesian classifier uses knowledge learned during training, such as prior probabilities and conditional probabilities, to perform probability calculations on the input feature data and assess the likelihood that the abnormal transaction belongs to different preset categories.
[0102] In this embodiment, after the Bayesian classifier completes the calculation, it outputs the probability value of each abnormal transaction data belonging to each preset category, as well as the final classification result determined according to certain rules (such as the maximum probability principle), that is, it determines which category the abnormal transaction specifically belongs to (such as suspected fraud, system error, operational error, etc.), and returns these results for subsequent use.
[0103] S503: Generate graded reminder information based on the classification result and the preset risk level.
[0104] In this embodiment, risk level mapping rules are pre-defined to associate the classification results and probability values output by the Bayesian classifier with different risk levels. For example, if the classification result is "suspected fraud" with a probability greater than 80%, it is set to a "high risk" level; if the classification result is "system error" with a probability between 50% and 70%, it is set to a "medium risk" level; other situations can be set to a "low risk" level.
[0105] In this embodiment, the classification results and probability values of abnormal transaction data are analyzed and judged according to pre-defined risk level mapping rules to determine the corresponding risk level. By matching the specific classification results and probability values with the conditions in the rules, each abnormal transaction is labeled with a corresponding risk level.
[0106] In this embodiment, graded reminder information is generated based on the determined risk level. For abnormal transactions with high risk levels, urgent and detailed reminder information is generated, such as "[High Risk Warning] Your transaction of [transaction amount] yuan at [specific time] was determined to be suspected fraud. Please stop the relevant operations immediately and contact the financial department for verification!"; for transactions with medium risk levels, a milder reminder is generated, prompting the courier to pay attention and conduct an inspection; for transactions with low risk levels, a general reminder message is generated, informing the courier that there is a minor abnormality and recommending that you pay attention to subsequent transactions. Different levels of reminder information differ in content, tone, and urgency, so that couriers can quickly understand the risk level of abnormal transactions and take corresponding measures.
[0107] In this embodiment, by extracting key classification features and performing One-Hot encoding, complex transaction data can be converted into a standard format that can be recognized by the model, ensuring the standardization and accuracy of data input; classification is performed using a pre-trained Bayesian classifier, giving full play to its advantages based on probabilistic reasoning and improving the reliability of the classification results; reminder information is generated based on the classification results and preset risk levels, realizing quantitative assessment and graded processing of abnormal transaction risks, and being able to promptly and accurately convey the degree of abnormal risk to couriers, facilitating their rapid response, effectively reducing potential risk losses, and improving the refinement level of prepaid bill management and risk prevention and control capabilities.
[0108] See also Figure 6 A sixth embodiment of a prepaid bill management method according to an embodiment of the present invention includes:
[0109] S601. Feedback the abnormal transaction data and graded reminder information to the courier, and obtain the courier's confirmation result. If the confirmation result shows that the data is abnormal, the corresponding abnormal transaction data will be removed from the multi-dimensional feature bill set.
[0110] In this embodiment, abnormal transaction data and corresponding graded alerts are sent to couriers through various channels, including push notifications via the courier's mobile app, SMS notifications, and messages from the company's internal management system. The notifications detail key information about the abnormal transaction, such as the transaction time, amount, fee type, and the system's initial abnormality category and risk level, allowing couriers to quickly understand the situation.
[0111] In this embodiment, the courier's confirmation result is received in real time. If the courier's confirmation result indicates that the data is abnormal, the system will mark the data as confirmed abnormal and remove it from the multi-dimensional feature bill set to prevent the abnormal data from interfering with subsequent analysis.
[0112] S602: Perform K-means cluster analysis on the transaction data of the multi-dimensional feature bill set to obtain cluster analysis data.
[0113] In this embodiment, key features suitable for cluster analysis are screened from a multi-dimensional feature set of bills, such as transaction amount, transaction time (time-related derivative features can be extracted, such as hour, day, week, etc.), fee type, transaction frequency, etc. The selected feature data is standardized to eliminate differences in dimension and numerical range between different features. For example, Z-score normalization or Min-Max scaling is used to bring the data to the same scale, facilitating the clustering algorithm to accurately calculate similarities between the data.
[0114] In this example, the elbow method and silhouette coefficient method are used, taking into account the actual situation of express delivery services and data characteristics, to determine the optimal number of clusters, K. The elbow method calculates the moment of inertia of the clustering results under different K values, plots the relationship between K and the moment of inertia, and selects the K value at the inflection point of the curve as the optimal value. The silhouette coefficient method calculates the silhouette coefficient of each sample and finds the K value that maximizes the average silhouette coefficient, ensuring the compactness and separation of the clustering results.
[0115] In this embodiment, the standardized transaction data is input into the K-means clustering algorithm. The algorithm randomly initializes K cluster centers according to the set K value, then iteratively calculates the distance from each data point to the cluster center, assigns the data point to the cluster to which the nearest cluster center belongs, and updates the cluster center position. This process is repeated until the cluster center no longer changes or the preset number of iterations is reached. Finally, the cluster cluster label to which each transaction data belongs is obtained, forming cluster analysis data, which intuitively shows the different patterns and category distributions of the transaction data.
[0116] S603: Input the cluster analysis data into the trained consumption trend prediction model to obtain the prepayment consumption trend.
[0117] In this embodiment, the cluster analysis data is input into the trained consumption trend prediction model to obtain the prepayment consumption trend, specifically including: constructing and training the LSTM metamodel and the XGBoost metamodel; integrating and training the LSTM metamodel and the XGBoost metamodel to obtain a trained consumption trend prediction model; inputting the cluster analysis data into the trained consumption trend prediction model to obtain the prepayment consumption trend, and generating a consumption analysis report.
[0118] In this embodiment, the LSTM meta-model is a special recurrent neural network used to process long-term dependencies in time series data and is suitable for capturing temporal patterns of consumer behavior (such as seasonality and cyclical fluctuations).
[0119] The XGBoost metamodel is an optimized distributed gradient boosting framework and a Boosting algorithm in ensemble learning. It is used to process nonlinear relationships and high-dimensional features and is suitable for mining the association between consumer behavior and courier attributes (such as region, length of service, and number of parcels collected).
[0120] In this example, a stacking ensemble approach is used to construct a two-layer model structure. The first layer includes a trained LSTM meta-model and an XGBoost meta-model, each of which makes predictions on the input data. The second layer is a meta-learner (such as logistic regression or linear regression), which receives the predictions of the two models in the first layer as input and learns how to combine them to produce the final prediction.
[0121] In this example, cluster analysis data is fed into a trained consumption trend forecasting model. Based on the model's integrated predictive capabilities, it outputs a forecast of the courier's consumption trends over the next period of time. This forecast includes predicted consumption amounts, consumption fluctuation trends, and forecasts of changes in the proportion of different expense types.
[0122] In this embodiment, a detailed consumption analysis report is generated based on the model's prediction results. The report uses charts (e.g., a line chart showing consumption amount trends and a pie chart showing the percentage of expense types) to visually present the prediction results, making it easier for couriers to quickly understand. The report can also interpret key indicators in the prediction results, such as identifying peak and trough periods of consumption and analyzing the causes and impacts of changes in the percentage of expense types.
[0123] The report content can identify abnormal consumption points or potential risks in the forecast results, such as predicted large expenditures, and issue early warnings to couriers.
[0124] In this embodiment, through interactive confirmation with the courier, the accuracy of the data is guaranteed and data deviation caused by misjudgment is avoided, and abnormal identification can be corrected in time to ensure the reliability of the multi-dimensional feature bill set; K-means clustering analysis is used to perform pattern recognition on transaction data, effectively divide different consumer behavior categories, and explore the potential patterns of the data; the clustering results are input into the trained consumer trend prediction model, which can accurately predict the courier's consumption trend, provide a scientific basis for couriers to rationally plan their income and expenditure and for enterprises to optimize resource allocation, and comprehensively improve the practicality and decision-making value of prepaid bill management.
[0125] The above describes the prepaid bill management method in the embodiment of the present invention. The following describes the device in the embodiment of the present invention. Figure 7 , the implementation of the prepaid bill management device in the embodiment of the present invention includes:
[0126] Parsing module 701, for receiving a query request from a courier, parsing the query request to obtain a query type and a user identifier, and generating a structured query object according to the query type and the user identifier;
[0127] Query module 702, configured to query bill records according to the structured query object, obtain query data, and construct a multi-dimensional feature bill set including transaction time, amount, and fee type according to the query data;
[0128] Anomaly detection module 703, configured to perform anomaly detection on the multi-dimensional feature bill set using an improved isolation forest model, and filter out abnormal transaction data based on the detection results;
[0129] The classification module 704 is configured to input the abnormal transaction data into a pre-trained Bayesian classifier, obtain the classification results output by the Bayesian classifier, and generate graded reminder information based on the classification results;
[0130] The analysis module 705 is used to feed back the abnormal transaction data and the graded reminder information to the courier, obtain the courier's confirmation result, eliminate the multidimensional feature bill set based on the confirmation result, and analyze the multidimensional feature bill set after elimination to obtain the prepaid consumption trend.
[0131] In this embodiment, the parsing module 701 includes: a parsing unit 7011, which is used to receive the courier's query request through the API interface, and parse the query request to obtain multiple fields; a matching unit 7012, which is used to use the first regular expression and the second regular expression to match the query type and user identifier from the multiple fields respectively; a binding unit 7013, which is used to perform security verification on the user identifier, and bind the verified user identifier to the query type to generate a structured query object.
[0132] In this embodiment, the query module 702 includes: a determination unit 7021, which is used to determine the data storage location based on the user identifier and select the corresponding data table based on the query type; a query unit 7022, which is used to query the bill record based on the selected data table, obtain the query data, and perform data preprocessing on the query data; a first construction unit 7023, which is used to construct a multidimensional feature bill set including transaction time, amount, and fee type based on the preprocessed query data.
[0133] In this embodiment, the anomaly detection module 703 includes: a second construction unit 7031, which is used to construct the basic architecture of the isolation forest and introduce a weighted sampling mechanism to improve the basic architecture of the isolation forest to obtain an improved isolation forest model; an extraction unit 7032, which is used to extract basic features from the multidimensional feature bill, and derive time series features, behavior features and trend features based on the basic features, and the basic features include the transaction time, amount and fee type of each transaction data; an anomaly detection unit 7033, which is used to fuse the basic features, the time series features, the behavior features and the trend features and input them into the improved isolation forest model, obtain the detection results output by the improved isolation forest model, and filter out abnormal transaction data based on the detection results.
[0134] In this embodiment, the classification module 704 includes: an encoding unit 7041, which is used to extract classification-related features from the abnormal transaction data, obtain classification features, and perform One-Hot encoding on the classification features; a classification unit 7042, which is used to input the encoded classification features into a pre-trained Bayesian classifier to obtain the classification results output by the Bayesian classifier; and a generation unit 7043, which is used to generate graded reminder information based on the classification results and preset risk levels.
[0135] In this embodiment, the analysis module 705 includes: a feedback unit 7051, which is used to feed back the abnormal transaction data and the graded reminder information to the courier, obtain the courier's confirmation result, and if the confirmation result indicates that the data is abnormal, the corresponding abnormal transaction data is eliminated from the multi-dimensional feature bill set; an analysis unit 7052, which is used to perform K-means clustering analysis on the transaction data of the multi-dimensional feature bill set after the elimination process to obtain cluster analysis data; a prediction unit 7053, which is used to input the cluster analysis data into a trained consumption trend prediction model to obtain prepaid consumption trends.
[0136] In this embodiment, efficient management and risk control of couriers' bills are achieved at the data processing level. By parsing query requests, structured query objects are generated and multi-dimensional feature bill sets are constructed to ensure the accuracy and efficiency of data extraction and integration. In terms of anomaly detection, the improved isolation forest model combined with the Bayesian classifier can not only keenly capture abnormal transactions, but also classify anomalies in detail and generate reasonable graded reminders. In the interaction and analysis link, through confirmation interaction with couriers and consumption trend analysis, it not only ensures data accuracy, but also provides in-depth insights into the couriers' consumption behavior.
[0137] Figure 7 The structure of the prepaid bill management device shown does not constitute a limitation on the prepaid bill management device, and can implement the steps of the prepaid bill management method provided by the above-mentioned method embodiments.
[0138] above Figure 7 The prepaid bill management apparatus in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The following describes the prepaid bill management device in the embodiment of the present invention in detail from the perspective of hardware processing.
[0139] Figure 8FIG2 is a schematic diagram of the structure of a prepaid bill management device provided by an embodiment of the present invention. The device 800 may vary significantly due to different configurations or performance, and may include one or more processors (central processing units, CPUs) 810 (e.g., one or more processors), a memory 820, and one or more storage media 830 (e.g., one or more mass storage devices) storing applications 833 or data 832. The memory 820 and storage medium 830 may be either transient or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown), each of which may include a series of instruction operations on the device 800. Furthermore, the processor 810 may be configured to communicate with the storage medium 830 to execute the series of instruction operations on the storage medium on the device 800.
[0140] The device 800 may also include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input and output interfaces 860, and / or one or more operating systems 831, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
[0141] An embodiment of the present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute the steps of the prepaid bill management method.
[0142] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0143] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program code.
[0144] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A prepaid bill management method, characterized in that: The prepaid bill management method includes: Receiving a query request from a courier, parsing the query request to obtain a query type and a user identifier, and generating a structured query object according to the query type and the user identifier; Querying bill records according to the structured query object to obtain query data, and constructing a multi-dimensional feature bill set including transaction time, amount, and fee type based on the query data; Using an improved isolation forest model to perform anomaly detection on the multi-dimensional feature bill set, and screening out abnormal transaction data based on the detection results; Inputting the abnormal transaction data into a pre-trained Bayesian classifier, obtaining a classification result output by the Bayesian classifier, and generating graded reminder information based on the classification result; The abnormal transaction data and the graded reminder information are fed back to the courier, the courier's confirmation result is obtained, the multidimensional feature bill set is eliminated based on the confirmation result, and the multidimensional feature bill set after elimination is analyzed to obtain the prepaid consumption trend.
2. The prepaid bill management method according to claim 1, characterized in that: The receiving the query request from the courier and parsing the query request to obtain the query type and the user identifier includes: Receive the courier's query request through the API interface, and parse the query request to obtain multiple fields; Using the first regular expression and the second regular expression respectively to match the multiple fields to obtain the query type and the user identifier; The user identification is security verified, and the verified user identification is bound to the query type to generate a structured query object.
3. The prepaid bill management method according to claim 1, characterized in that: The bill record is queried according to the structured query object to obtain query data, and a multi-dimensional feature bill set including transaction time, amount, and fee type is constructed according to the query data, including: Determine a data storage location according to the user identifier, and select a corresponding data table according to the query type; Querying bill records according to the selected data table to obtain query data, and performing data preprocessing on the query data; A multi-dimensional feature bill set including transaction time, amount, and fee type is constructed based on the preprocessed query data.
4. The prepaid bill management method according to claim 1, characterized in that: The improved isolation forest model is used to perform anomaly detection on the multi-dimensional feature bill set, and abnormal transaction data is screened out based on the detection results, including: Build the basic framework of the isolation forest and introduce a weighted sampling mechanism to improve the basic framework of the isolation forest to obtain an improved isolation forest model; Extracting basic features from the multi-dimensional feature bill, and deriving time series features, behavioral features, and trend features based on the basic features, wherein the basic features include the transaction time, amount, and fee type of each transaction data; The basic features, the time series features, the behavior features and the trend features are fused and input into the improved isolation forest model to obtain the detection results output by the improved isolation forest model, and the abnormal transaction data is screened out according to the detection results.
5. The prepaid bill management method according to claim 1, characterized in that: The step of inputting the abnormal transaction data into a pre-trained Bayesian classifier, obtaining a classification result output by the Bayesian classifier, and generating graded reminder information according to the classification result includes: Extracting features related to classification from the abnormal transaction data to obtain classification features, and performing One-Hot encoding on the classification features; Input the encoded classification features into the pre-trained Bayesian classifier to obtain the classification results output by the Bayesian classifier; Generate graded reminder information based on the classification results and preset risk levels.
6. The prepaid bill management method according to claim 1, characterized in that: Feeding back the abnormal transaction data and the graded reminder information to the courier, obtaining the courier's confirmation result, eliminating the multi-dimensional feature bill set based on the confirmation result, and analyzing the eliminated multi-dimensional feature bill set to obtain prepaid consumption trends, including: Feedback the abnormal transaction data and the graded reminder information to the courier, obtain the courier's confirmation result, and if the confirmation result indicates that the data is abnormal, remove the corresponding abnormal transaction data from the multi-dimensional feature bill set; Perform K-means cluster analysis on the transaction data of the multi-dimensional feature bill set after the elimination process to obtain cluster analysis data; The cluster analysis data is input into the trained consumption trend prediction model to obtain the prepayment consumption trend.
7. The prepaid bill management method according to claim 6, characterized in that: Inputting the cluster analysis data into the trained consumption trend prediction model to obtain the prepayment consumption trend includes: Build and train LSTM metamodel and XGBoost metamodel; Integrate and train the LSTM metamodel and the XGBoost metamodel to obtain a trained consumption trend prediction model; The cluster analysis data is input into the trained consumption trend prediction model to obtain the prepayment consumption trend and generate a consumption analysis report.
8. A prepaid bill management device, characterized in that: include: A parsing module, configured to receive a query request from a courier, parse the query request to obtain a query type and a user identifier, and generate a structured query object according to the query type and the user identifier; A query module, configured to query bill records according to the structured query object, obtain query data, and construct a multi-dimensional feature bill set including transaction time, amount, and fee type according to the query data; an anomaly detection module, configured to perform anomaly detection on the multi-dimensional feature bill set using an improved isolation forest model, and filter out abnormal transaction data based on the detection results; a classification module, configured to input the abnormal transaction data into a pre-trained Bayesian classifier, obtain classification results output by the Bayesian classifier, and generate graded reminder information based on the classification results; The analysis module is used to feed back the abnormal transaction data and the graded reminder information to the courier, obtain the courier's confirmation result, eliminate the multidimensional feature bill set based on the confirmation result, and analyze the multidimensional feature bill set after elimination to obtain the prepaid consumption trend.
9. A prepaid bill management device, characterized in that: comprising a memory and at least one processor, wherein the memory has computer-readable instructions stored therein; The at least one processor calls the computer-readable instructions in the memory to execute the steps of the prepaid bill management method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer-readable instructions stored thereon, characterized in that: When the computer-readable instructions are executed by a processor, the steps of the prepaid bill management method according to any one of claims 1 to 7 are implemented.