Order parameter verification and data query method and system, computer equipment and medium

Through state machine template and plug-in design, the parameter verification of order processing is decoupled from the data query logic, solving the problem of high code coupling in the existing technology, and achieving efficient code maintenance and flexible business processing.

CN120258928APending Publication Date: 2025-07-04XING LIN JU (BEI JING) KE JI YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510232961.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

In the prior art, the data query and parameter verification of the order processing function are highly coupled with the business logic, resulting in poor code reusability and high maintenance costs, making it difficult to cope with diversified business needs.

Method used

Through state machine template and plug-in design, the parameter verification of order processing is decoupled from the data query logic, and encapsulated into independent plug-ins to realize parallel or serial processing.

Benefits of technology

It reduces the degree of code coupling, improves the maintainability and reuse rate of code, reduces the workload of code modification caused by data or parameter changes, and improves the flexibility and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120258928A_ABST
    Figure CN120258928A_ABST
Patent Text Reader

Abstract

The invention relates to an order parameter verification and data query method and system, computer equipment and a medium, and the method comprises the steps: responding to a call request of an order related interface, and calling a target plug-in in a plurality of independent plug-ins according to parameters of the call request. And executing parameter verification on the parameters of the calling request through the target plug-in to obtain a parameter verification result. And judging whether the parameter verification is passed or not according to the authenticity of the parameter verification result. And if the parameter verification result is true, indicating that the parameter verification is passed, and executing data query in a data source of the order business system according to the parameters of the calling request to obtain target data. Otherwise, returning parameter verification failure information. Decoupling of data verification and business logic is achieved through a state machine template and plug-in design, the code coupling degree is reduced, the maintainability and the reuse rate of codes are improved, and the code modification workload caused by data or parameter changes is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of software engineering, and in particular, to a method, system, computer device, and medium for parameter verification and data query of orders. Background Art

[0002] In modern background business systems, the order processing function is one of the core functions, involving multiple business processes such as refunds and performance. In the prior art, order processing usually adopts a sequential execution method, that is, first query order information, then perform business parameter verification according to the order status, and finally execute specific business logic. For example, in the refund and performance interfaces, it is necessary to first query order information, verify whether the order status meets the business requirements (such as refund or performance conditions), and then execute the corresponding business logic.

[0003] This processing method has obvious drawbacks: data query, parameter verification, and business logic are highly coupled, resulting in poor code reusability and high maintenance costs. Once the business logic or data structure changes, it is necessary to check and modify the relevant code one by one, with a huge workload and easy to make mistakes. In addition, the prior art lacks an effective mechanism for splitting and reusing complex verification logics (such as order amount range verification, user permission verification, etc.), and it is difficult to cope with diverse business requirements. Summary of the Invention

[0004] The present application aims at the above deficiencies or drawbacks, and provides a method, system, computer device, and medium for parameter verification and data query of orders. Through a state machine template and plug-in design, the decoupling of data verification and business logic is realized, the code coupling degree is reduced, the maintainability and reuse rate of the code are improved, and the workload of code modification caused by data or parameter changes is reduced.

[0005] The present application provides a method for parameter verification and data query of orders according to the first aspect. The method is based on an order business system of an order state machine. The order state machine defines multiple order common processes according to a preset order state change process framework. The steps of each order common process during the order state change include corresponding lock acquisition, data query, data verification, data assembly, data saving, post-processing, and lock release. Moreover, the order state machine pre-packages the parameter verification, data query, and data verification logics corresponding to each common process into multiple independent plug-ins, so as to decouple the business processing logic of the order from the data verification and query logics. The method includes:

[0006] In response to a call request of an order-related interface, call a target plug-in among multiple independent plug-ins according to the parameters of the call request.

[0007] Execute parameter verification on the parameters of the call request through the target plug-in to obtain a parameter verification result.

[0008] Judge whether the parameter verification is passed according to the truth or falsehood of the parameter verification result.

[0009] If the parameter verification result is true, it indicates that the parameter verification is passed. Then, execute a data query in the data source of the order business system according to the parameters of the call request to obtain the target data; otherwise, return the parameter verification failure message.

[0010] In some embodiments, after querying the target data, the method further includes:

[0011] Execute data verification on the target data according to the preset business requirements to obtain the data verification result. Judge whether the data verification is passed according to the truth or falsehood of the data verification result.

[0012] If the data verification result is true, it indicates that the data verification is passed. Then, execute the business processing logic related to the order; otherwise, return the data verification failure message.

[0013] In some embodiments, the step of executing parameter verification includes:

[0014] Execute required parameter verification and parameter format verification to obtain the required parameter verification result and the parameter format verification result.

[0015] If both the required parameter verification result and the parameter format verification result are true, the parameter verification result is true; otherwise, the parameter verification result is false.

[0016] In some embodiments, the parameters of the call request include a product identifier and a user identifier. The step of required parameter verification includes:

[0017] Perform non-null verification on the product identifier and the user identifier respectively.

[0018] If both the product identifier and the user identifier are in a non-null state, the required parameter verification result is true; otherwise, the required parameter verification result is false.

[0019] In some embodiments, the parameters of the call request further include the expected selling price of the product. The target data includes the product data corresponding to the product identifier and the product pricing amount. The step of executing data verification includes:

[0020] Perform a consistency comparison between the product identifier and the product data to determine whether the product exists.

[0021] Perform a consistency comparison between the expected selling price of the product and the product pricing amount to determine whether the product pricing is accurate.

[0022] If the product identifier is consistent with the product data, and the expected selling price of the product is consistent with the product pricing amount, the data verification result is true; otherwise, the data verification result is false.

[0023] In some embodiments, the order state machine is also pre-configured with an interface implementation class of the checker Checker and an execution mode, and the execution mode is used to determine whether to use a parallel or serial processing mode to execute the steps of data query and data verification. Before calling the target plug-in in multiple independent plug-ins according to the parameters of the call request, the method further includes:

[0024] Add a first dynamic array member variable ArrayList1 and a first dynamic array member variable ArrayList2 in the state machine processing class to store two types of Checkers for parallel and serial processing modes respectively.

[0025] Add a registration method, and store the two types of Checkers into ArrayList1 and ArrayList2 respectively through the registration method.

[0026] Add a check method with a return value of boolean type boolean and a method with a return value of CheckerType to the interface implementation class to execute parameter verification and data verification logic.

[0027] In some embodiments, the method further includes:

[0028] Through the Checker that supports parallel processing, allocate the steps of executing data query and executing data verification to the first thread and the second thread respectively for parallel execution, so as to collect the target data and data verification results through the first thread and the second thread.

[0029] Through the Checker that supports serial processing, use the sequential method order to define the serial execution order of multiple Checkers to sequentially execute the steps of data query and data verification.

[0030] According to a second aspect of the present application, a parameter verification and data query system for an order is provided. The system is an order business system based on an order state machine. The order state machine defines multiple order common processes according to a preset order state change process framework. The steps of each order common process during order state change include corresponding lock acquisition, data query, data verification, data assembly, data storage, post-processing, and lock release; and the order state machine pre-packages the parameter verification, data query, and data verification logics corresponding to each common process into corresponding multiple independent plug-ins, decoupling the business processing logic of the order from the data verification and query logic; the system includes:

[0031] A target plug-in call module, configured to call a target plug-in in multiple independent plug-ins according to the parameters of a call request when receiving a call request for an order-related interface.

[0032] A parameter verification module is used to perform parameter verification on the parameters of a call request through a target plugin to obtain a parameter verification result.

[0033] A verification result comparison module is used to determine whether the parameter verification is passed according to the truth or falsehood of the parameter verification result.

[0034] A verification result processing module is used to, when the parameter verification result is true, perform a data query in the data source of the order business system according to the parameters of the call request to obtain target data; otherwise, return a parameter verification failure message.

[0035] According to a third aspect of the present application, there is provided a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the parameter verification and data query method of any one of the above-mentioned embodiments for an order are implemented.

[0036] According to a fourth aspect of the present application, there is provided a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes, the steps of the parameter verification and data query method of any one of the above-mentioned embodiments for an order are implemented.

[0037] The order parameter verification and data query method of the above-mentioned embodiment is constructed based on an order business system, and the system realizes the decoupling of data verification and business logic through a state machine template and a plug-in design. The specific method includes: in response to a call request of an order-related interface, a target plugin is called from multiple independent plugins according to the parameters of the call request. The parameters of the call request refer to a set of information passed with the request and used to indicate specific business requirements and operation conditions, usually including key information such as an order number, a user identifier, an operation type, etc. After the target plugin is called, it performs verification on the parameters of the call request according to the encapsulated verification logic to generate a verification result. The verification content includes format verification of the order number, range verification of the order amount, legality verification of the order status, and verification of user permissions, etc. The verification result is a boolean value (true or false), or a data structure containing a verification status and detailed information. If the verification result is true, it indicates that the parameter verification is passed; if it is false, a failure message containing the parameter name that failed the verification and the reason for the failure is generated. When the verification result is true, the system constructs an SQL statement (Structured Query Language) according to the parameters of the call request and executes it in the data source to obtain order data related to the request, such as order amount, order date, commodity information, etc. If the verification result is false, a parameter verification failure message is returned.

[0038] Therefore, through the state machine template and plug-in design, this method realizes the decoupling of data verification and business logic. The state machine template defines the process framework for order business processing, while the plug-in design encapsulates the verification logic into independent modules, making the verification logic independent of the business logic. This design reduces the code coupling degree, improves the code maintainability and reuse rate. For example, when the verification rule of the order amount changes, only the corresponding verification plug-in needs to be modified, without changing the core business logic code. In addition, this method also reduces the code modification workload caused by data or parameter changes, avoids the chain reaction caused by one change in the traditional architecture, and significantly improves the flexibility and stability of the system. Description of the Drawings

[0039] Figure 1 Schematic diagram of the application environment of a method for parameter verification and data query of an order in one or more embodiments of the present application;

[0040] Figure 2 Flowchart of a method for parameter verification and data query of an order in one or more embodiments of the present application;

[0041] Figure 3 Flowchart of a method for performing data verification on target data in one or more embodiments of the present application;

[0042] Figure 4 Flowchart of a method for performing data verification based on a commodity identifier in one or more embodiments of the present application;

[0043] Figure 5 Flowchart of a method for configuring an implementation class of the Checker interface in one or more embodiments of the present application;

[0044] Figure 6 Flowchart of a method for performing data query and data verification through parallel and serial Checkers in one or more embodiments of the present application;

[0045] Figure 7 Example diagram of performing data query and data verification through parallel and serial Checkers in one or more embodiments of the present application;

[0046] Figure 8 Schematic diagram of the structure of a system for parameter verification and data query of an order in one or more embodiments of the present application;

[0047] Figure 9 Schematic diagram of the internal structure of a computer device in one or more embodiments of the present application. Detailed Embodiments

[0048] In order to make the objectives, technical solutions, and advantages of the present application more clearly understood, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] According to a first aspect of the present application, a method for parameter verification and data query of an order can be applied to a cloud environment as shown in Figure 1 The user terminal (101) can first send an order to the cloud platform server (102), causing the cloud platform server (102) to instruct the order business system to perform the parameter verification and data query tasks of the order. Then, when the cloud platform server (102) receives the parameter verification result and the query result returned by the order business system, it sends the business processing result related to the order to the user terminal (101), or returns a parameter verification failure message or a query failure message.

[0050] In some exemplary embodiments of the present application, the above method can be applied to a cloud platform server, and the method is based on an order business system of an order state machine as shown in Figure 1 The order state machine defines multiple order common processes according to a preset order state change process framework. The steps of each order common process during the order state change include corresponding lock acquisition, data query, data verification, data assembly, data storage, post-processing, and lock release; and the order state machine pre-packages the parameter verification, data query, and data verification logics corresponding to each common process into multiple independent plugins, decoupling the business processing logic of the order from the data verification and query logics; as shown in Figure 2 The method includes the following steps:

[0051] Step 201: In response to a call request for an order-related interface, call a target plugin from multiple independent plugins according to the parameters of the call request.

[0052] Among them, the parameters of the call request refer to a set of information passed along with the call request, which is used to indicate specific business requirements and operation conditions, and usually includes key information such as order numbers, user identities, and operation types. These parameters are used to help the system determine the specific plugin to be called and execute the corresponding business logic.

[0053] Specifically, after receiving the call request, the cloud platform server accurately locates and calls the target plugin that matches the request from multiple independent plugins through a plugin management module deployed in the order business system.

[0054] For example, if the parameter content includes an order status change request, an order data query request, or an order data verification request, the plugin management module will analyze this key information, determine the type and function of the target plugin, and call the corresponding plugin according to the preset logic. In this way, the efficient decoupling of the order business processing logic from the data verification and query logic is achieved.

[0055] Step 202: Perform parameter verification on the parameters of the call request through the target plugin to obtain a parameter verification result.

[0056] Specifically, the order business system passes the parameters of the call request to the target plugin, and the target plugin verifies each parameter one by one according to the encapsulated verification logic (such as order number format, order amount range, order status legality, and user permissions). If a parameter that does not conform to the rules is found, the target plugin immediately generates a verification failure message and feedbacks it to the order business system; if all parameters pass the verification, a verification success result is generated and passed to the subsequent processing flow.

[0057] Step 203: Determine whether the parameter verification is passed based on the truth or falsehood of the parameter verification result.

[0058] Specifically, after the target plugin completes the verification of the call request parameters, it generates a parameter verification result and feedbacks it to the order business system. After receiving this result, the order business system makes a judgment based on its truth or falsehood. The parameter verification result can be a boolean value (true or false), or a data structure containing the verification status and detailed information. True indicates that all parameters conform to the preset verification rules, while False indicates that there are parameters that do not conform to the rules. The data structure may contain detailed information such as the name of the parameter that failed the verification and the reason for the verification failure. For example, if the order amount fails the range verification, the verification result may contain an error prompt message such as "The order amount exceeds the allowed range".

[0059] Step 204: If the parameter verification result is true, indicating that the parameter verification is passed, perform a data query in the data source of the order business system according to the parameters of the call request to obtain the target data; otherwise, return a parameter verification failure message.

[0060] Specifically, when the parameter verification result is true, the cloud platform server instructs the order business system to perform a data query operation from the data source according to the parameters of the call request (such as order number, order status, user identification, etc.). The query module generates an SQL statement or other query instructions based on these parameters and in combination with preset logic, and executes them in the database or data warehouse to obtain the target data. For example, if the parameter is the order number "123456", the query module will construct an SQL statement similar to "SELECT * FROM orders WHERE order_id = '123456'" and execute it to obtain detailed information such as the order amount, order date, and product information. If the parameter verification result is false, the order business system will generate a failure message containing the name of the parameter that failed the verification, the reason for the verification failure, and a correction suggestion, and return it to the user side through the cloud platform server so that the user can quickly locate and correct the problem, thereby improving the user experience and system reliability.

[0061] Therefore, due to the decoupling of data verification and business logic through the state machine template and plug-in design, the code coupling degree is reduced, the maintainability and reuse rate of the code are improved, and the workload of code modification caused by data or parameter changes is reduced.

[0062] In some embodiments, after querying the target data, as Figure 3 shown, the method further includes:

[0063] Step 301: Perform data verification on the target data according to preset business requirements to obtain a data verification result. Determine whether the data verification is passed based on the truth or falsehood of the data verification result.

[0064] Specifically, data verification refers to further verifying the target data queried from the data source to ensure that it conforms to business rules and logic. For example, the verification content may include whether the order amount is within the expected range, whether the order status is legal, whether the product information is complete, etc. The verification result is usually a boolean value, or a data structure containing the verification status and detailed information. If the result is a boolean value, True indicates that the target data conforms to all preset rules, and False indicates that there are situations that do not conform to the rules; if the result is a data structure, it may include the names of the data fields that failed the verification, the reasons for the verification failure, and other detailed information.

[0065] Step 302: If the data verification result is true, indicating that the data verification is passed, execute the business processing logic related to the order, otherwise return a data verification failure message.

[0066] Among them, the business processing logic related to order execution may include operations such as order status update, data assembly and storage. If the data verification fails, the system will generate detailed information including the field names that failed the verification, the reasons for failure, and corrective suggestions. In this way, users can quickly locate and correct problems, thereby improving the reliability of the system and the user experience.

[0067] In some embodiments, the above step of performing parameter verification includes:

[0068] Perform mandatory parameter verification and parameter format verification to obtain the mandatory parameter verification result and the parameter format verification result. If both the mandatory parameter verification result and the parameter format verification result are true, the parameter verification result is true; otherwise, the parameter verification result is false.

[0069] Specifically, mandatory parameter verification refers to verifying the existence of parameters that must be provided in the call request to ensure that these parameters are not omitted. For example, the order number (order_id) and user identifier (user_id) are usually mandatory parameters. If these parameters are missing from the call request, the system will determine that the mandatory parameter verification fails and generate corresponding failure information. Parameter format verification is to verify the format of the parameters in the call request to ensure that it conforms to the preset format specifications. For example, the order number may be required to be a number or a specific combination of characters, and the user identifier may be required to be in email format or a string of a specific length. The target plugin will verify each parameter according to the preset rules. If the parameter format does not meet the requirements, the system will determine that the parameter format verification fails and generate a prompt containing specific error information.

[0070] For example, when both the mandatory parameter verification and the parameter format verification pass, it means that the parameters of the call request are both complete and conform to the format requirements, and the system determines that the parameter verification is successful. If any verification fails, the system will return detailed information including the parameter names that failed the verification and the reasons for failure, so that users can quickly locate and correct problems.

[0071] In some embodiments, the parameters of the call request include a product identifier and a user identifier, and the steps of mandatory parameter verification include:

[0072] Perform non-empty verification on the product identifier and the user identifier respectively. If both the product identifier and the user identifier are in a non-empty state, the mandatory parameter verification result is true; otherwise, the mandatory parameter verification result is false.

[0073] Specifically, the non-empty check refers to verifying the existence of specific parameters in the call request to ensure that their values are not empty. For example, in the call request of the order-related interface, the product identifier (product_id) and the user identifier (user_id) are parameters that must be provided. The system will check whether these two parameters contain valid values. If the product identifier or the user identifier is empty (e.g., the value is null or an empty string), it is determined that the non-empty check of this parameter fails, and a corresponding check failure message is generated, such as "The product identifier cannot be empty". Only when both the product identifier and the user identifier pass the non-empty check will the system determine that the mandatory parameter check passes and continue with the subsequent parameter check process. If any parameter fails the non-empty check, the mandatory parameter check fails, and the system will return detailed information including the name of the parameter that failed the check and the reason for the failure, so that the user can quickly locate and correct the problem. In this way, the system can effectively ensure the integrity and accuracy of the call request, improving the reliability of the system and the user experience.

[0074] In some embodiments, the parameters of the call request further include the expected selling price of the product, and the target data includes the product data corresponding to the product identifier and the product pricing amount. As Figure 4 shown, the steps for performing the data check include:

[0075] Step 401: Perform a consistency comparison between the product identifier and the product data to determine whether the product exists.

[0076] Specifically, the consistency comparison is to match and verify the product identifier (product_id) in the call request with the product data in the data source to ensure that the product identifier in the request is valid in the system. For example, if the product identifier in the call request is "P12345", but the system cannot find the corresponding product record, it is determined that the product does not exist, and the data check result is false, and a check failure message of "The product identifier is invalid or the product does not exist" is generated.

[0077] Step 402: Perform a consistency comparison between the expected selling price of the product and the product pricing amount to determine whether the product pricing is accurate.

[0078] If the product identifier is consistent with the product data and the expected selling price of the product is consistent with the product pricing amount, the data check result is true; otherwise, the data check result is false.

[0079] Specifically, the consistency comparison refers to matching and validating the expected selling price of the commodity carried in the call request with the pricing amount of the commodity obtained from the target data to ensure that the two are consistent within a preset error range. For example, if the expected selling price of the commodity in the call request is 100 yuan, the pricing amount of the commodity in the target data is 100.05 yuan, and the preset error range is ±0.1 yuan, then the two are considered consistent and the verification result is true. Conversely, if it exceeds the error range, the verification result is false and a verification failure message is generated. Through this step, the accuracy of the commodity price can be effectively verified, business errors caused by price differences can be avoided, and the correctness and reliability of business processing can be ensured.

[0080] In some embodiments, the order state machine is also pre-configured with an interface implementation class of the checker Checker and an execution method, and the execution method is used to determine whether to use a parallel or serial processing method to execute the steps of data query and data verification. Before calling the target plugin in multiple independent plugins according to the parameters of the call request, as Figure 5 shown, the method includes the following steps:

[0081] Step 501: Add a first dynamic array member variable ArrayList1 and a first dynamic array member variable ArrayList2 in the state machine processing class to store two types of Checkers in parallel and serial processing methods respectively.

[0082] For example, the Checker interface defines a check verification method to execute specific verification logic, and defines the execution order of the serial Checker through the order method. The state machine registers the Checker according to its type into the corresponding ArrayList1 or ArrayList2: the serial Checker is executed in the insertion order, while the parallel Checker is executed in parallel through an asynchronous task (such as CompletableFuture).

[0083] Step 502: Add a registration method to store the two types of Checkers into ArrayList1 and ArrayList2 respectively through the registration method.

[0084] Specifically, the registration method is used to dynamically allocate the pre-configured Checker interface implementation class to the corresponding dynamic array according to its execution method. For example, if the execution method of the Checker is parallel, it is added to ArrayList1; if it is serial, it is added to ArrayList2. ArrayList1 and ArrayList2 are dynamic arrays for storing parallel and serial Checkers respectively.

[0085] During the implementation process, the Checker interface defines a check method to execute the verification logic, and at the same time identifies the execution mode (parallel or serial) of the Checker through the CheckerType method. The registration method assigns it to the corresponding ArrayList1 or ArrayList2 by judging the CheckerType of the Checker. For example, if the CheckerType of a certain Checker is PARALLEL, it is added to ArrayList1; if it is SERIAL, it is added to ArrayList2.

[0086] Step 503: Add a check method with a return value of boolean type and a method with a return value of CheckerType to the interface implementation class to execute the parameter verification and data verification logic.

[0087] Specifically, the check method is used to implement the specific verification logic. Returning the boolean value true indicates that the verification passes, and returning false indicates that the verification fails. The CheckerType method is used to identify the execution mode of the Checker, and the return value is of the CheckerType enumeration type. For example, PARALLEL indicates parallel execution, and SERIAL indicates serial execution.

[0088] For example, an OrderChecker, an implementation class of the Checker interface, is defined in the order state machine. Its check method is used to verify whether the order amount is within the allowed range. If the order amount is less than 0 or greater than the preset upper limit, false is returned; otherwise, true is returned. At the same time, the CheckerType method of OrderChecker returns PARALLEL, indicating that this Checker is suitable for parallel execution.

[0089] In this way, the Checker interface implementation class can flexibly define the verification logic and execution mode according to specific business requirements, providing an efficient and flexible verification mechanism for the system.

[0090] In some embodiments, as Figure 6 、 7 shown, the method includes the following steps:

[0091] Step 601: Through a Checker that supports parallel processing, allocate the steps of executing data query and executing data verification to the first thread and the second thread for parallel execution respectively, so as to collect the target data and the data verification result through the first thread and the second thread.

[0092] Specifically, the Checker interface defines a check method for executing verification logic and identifies the execution mode (parallel or serial) of the Checker through the CheckerType method. For parallel Checkers, the state machine processing class stores them in the parallelChecker list and implements parallel processing through CompletableFuture tasks. For example, the data query task and the data verification task are executed in the first thread and the second thread respectively, and the two tasks run independently without interference. When any task returns false, the system will throw a verification failure exception; if all tasks return true, the subsequent business processing will continue.

[0093] Step 602: Through a Checker that supports serial processing, use the sequential method order to define the serial execution order of multiple Checkers to sequentially execute the steps of data query and data verification.

[0094] Specifically, serial Checkers are stored in the serialChecker list, and their execution order is determined by the order method. For example, if the return values of the order method are 0 and 1, the Checker with a return value of 0 will be executed first, and the Checker with a return value of 1 will be executed later. Through the order method, the system can flexibly define the execution order of multiple Checkers to ensure the logic and accuracy of serial verification. By combining parallel and serial Checkers, this method can dynamically adjust the execution mode of verification tasks according to business requirements, improving the flexibility and efficiency of the system.

[0095] According to the second aspect of the present application, a parameter verification and data query system for orders is provided. This system is an order business system based on an order state machine. The order state machine defines multiple order common processes according to a preset order state change process framework. The steps in each order common process during order state change include corresponding lock acquisition, data query, data verification, data assembly, data saving, post-processing, and lock release; moreover, the order state machine pre-packages the parameter verification, data query, and data verification logics corresponding to each common process into multiple independent plugins, decoupling the business processing logic of the order from the data verification and query logics; as Figure 8 shown, the system includes:

[0096] A target plugin call module 110, configured to, when receiving a call request for an order-related interface, call a target plugin among multiple independent plugins according to the parameters of the call request.

[0097] A parameter verification module 120, configured to execute parameter verification on the parameters of the call request through the target plugin to obtain a parameter verification result.

[0098] The verification result comparison module 130 is used to determine whether the parameter verification is passed according to the truth or falsehood of the parameter verification result.

[0099] The verification result processing module 140 is used to, when the parameter verification result is true, execute a data query in the data source of the order business system according to the parameters of the call request to obtain the target data; otherwise, return the parameter verification failure information.

[0100] In some embodiments, after the target data is obtained by querying, the system further includes a data verification module 150. The data verification module 150 is used to perform data verification on the target data according to the preset business requirements to obtain a data verification result. Determine whether the data verification is passed according to the truth or falsehood of the data verification result. If the data verification result is true, it indicates that the data verification is passed, and then execute the business processing logic related to the order; otherwise, return the data verification failure information.

[0101] In some embodiments, the above-mentioned parameter verification module 120 is further used to perform mandatory parameter verification and parameter format verification to obtain a mandatory parameter verification result and a parameter format verification result. If both the mandatory parameter verification result and the parameter format verification result are true, the parameter verification result is true; otherwise, the parameter verification result is false.

[0102] In some embodiments, the above-mentioned parameter verification module 120 is further used to perform non-empty verification on the product identifier and the user identifier respectively. If both the product identifier and the user identifier are in a non-empty state, the mandatory parameter verification result is true; otherwise, the mandatory parameter verification result is false.

[0103] In some embodiments, the parameters of the call request further include the expected selling price of the product, and the target data includes the product data corresponding to the product identifier and the product pricing amount. The above-mentioned data verification module 150 is further used to perform a consistency comparison between the product identifier and the product data to determine whether the product exists. Perform a consistency comparison between the expected selling price of the product and the product pricing amount to determine whether the product pricing is accurate. If the product identifier is consistent with the product data, and the expected selling price of the product is consistent with the product pricing amount, the data verification result is true; otherwise, the data verification result is false.

[0104] In some embodiments, the order state machine is also pre-configured with an interface implementation class of the checker Checker and an execution method, and the execution method is used to determine whether to use a parallel or serial processing method to execute the steps of data query and data verification. Before calling the target plug-in in multiple independent plug-ins according to the parameters of the call request, the parameter verification and data query system is further used to: add a first dynamic array member variable ArrayList1 and a first dynamic array member variable ArrayList2 to the state machine processing class to store two types of Checkers for parallel and serial processing methods respectively. Add a registration method, and store the two types of Checkers into ArrayList1 and ArrayList2 respectively through the registration method. Add a check method with a return value of boolean type and a method with a return value of CheckerType to the interface implementation class to execute the parameter verification and data verification logic.

[0105] In some embodiments, the parameter verification and data query system is further used to: through the Checker that supports parallel processing, allocate the steps of executing data query and executing data verification to the first thread and the second thread respectively for parallel execution, so as to collect the target data and the data verification result through the first thread and the second thread. Through the Checker that supports serial processing, use the sequential method order to define the serial execution order of multiple Checkers to sequentially execute the steps of data query and data verification.

[0106] According to a third aspect of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the parameter verification and data query method of any one of the above embodiments of the order are implemented.

[0107] According to a fourth aspect of the present application, there is provided a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes, the steps of the parameter verification and data query method of any one of the above embodiments of the order are implemented.

[0108] In one embodiment, there is provided a computer device, which may be a server, and its internal structure diagram may be as Figure 9As shown in the figure. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to parameter verification and data query of orders. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it is used to implement the parameter verification and data query method for any one of the above orders.

[0109] Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application may include non-volatile and / or volatile memories. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or an external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (RamCUs), direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0110] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0111] The above embodiments only represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

[0112] Finally, it should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

Claims

1. A method for parameter verification and data query of an order, characterized in that The method is based on an order business system of an order state machine. The order state machine defines multiple order common processes according to a preset order state change process framework. The steps of each order common process during order state change include corresponding lock acquisition, data query, data verification, data assembly, data storage, post-processing, and lock release. Moreover, the order state machine pre-packages the parameter verification, data query, and data verification logics corresponding to each common process into multiple independent plugins respectively, decoupling the business processing logic of the order from the data verification and query logics. The method includes: In response to a call request of an order-related interface, call a target plugin among the multiple independent plugins according to the parameters of the call request; Perform parameter verification on the parameters of the call request through the target plugin to obtain a parameter verification result; Judge whether the parameter verification is passed according to the truth or falsehood of the parameter verification result; If the parameter verification result is true, indicating that the parameter verification is passed, perform a data query in the data source of the order business system according to the parameters of the call request to obtain target data; otherwise, return a parameter verification failure message.

2. The method according to claim 1, wherein After the target data is obtained through the query, the method further includes: Perform data verification on the target data according to preset business requirements to obtain a data verification result; Judge whether the data verification is passed according to the truth or falsehood of the data verification result; If the data verification result is true, indicating that the data verification is passed, execute the business processing logic related to this order; otherwise, return a data verification failure message.

3. The method according to claim 2, wherein The step of performing parameter verification includes: Perform required parameter verification and parameter format verification to obtain a required parameter verification result and a parameter format verification result; If both the required parameter verification result and the parameter format verification result are true, the parameter verification result is true; otherwise, the parameter verification result is false.

4. The method according to claim 3, wherein The parameters of the call request include a product identifier and a user identifier. The step of performing required parameter verification includes: Perform non-null verification on the product identifier and the user identifier respectively; If both the product identifier and the user identifier are in a non-null state, the required parameter verification result is true; otherwise, the required parameter verification result is false.

5. The method according to claim 4, wherein The parameters of the call request further include an expected selling price of the product. The target data includes product data corresponding to the product identifier and a product pricing amount; The step of performing data verification includes: Perform a consistency comparison between the product identifier and the product data to determine whether the product exists; Perform a consistency comparison between the expected selling price of the product and the product pricing amount to determine whether the product pricing is accurate; If the product identifier is consistent with the product data, and the expected selling price of the product is consistent with the product pricing amount, the data verification result is true; otherwise, the data verification result is false.

6. The method according to claim 2, wherein The order state machine also pre-configures an interface implementation class and an execution method of a checker Checker. The execution method is used to determine whether to use a parallel or serial processing method to execute the steps of data query and data verification; Before calling the target plug-in among the multiple independent plug-ins according to the parameters of the call request, the method further includes: Adding a first dynamic array member variable ArrayList1 and a first dynamic array member variable ArrayList2 in the state machine processing class to store two types of Checkers for parallel and serial processing methods respectively; Adding a registration method to store the two types of Checkers into the ArrayList1 and the ArrayList2 respectively through the registration method; Adding a check method with a return value of boolean type and a method with a return value of CheckerType to the interface implementation class to execute parameter verification and data verification logic.

7. The method according to claim 6, wherein The method further includes: Through the Checker that supports parallel processing, the steps of performing the execution data query and the execution data verification are respectively allocated to the first thread and the second thread for parallel execution, so as to collect the target data and the data verification result through the first thread and the second thread; Through the Checker that supports serial processing, the serial execution order of multiple Checkers is defined by the sequential method order to sequentially execute the steps of the data query and the data verification.

8. A parameter verification and data query system for orders, characterized in that The system is an order business system based on an order state machine. The order state machine defines multiple order common processes according to a preset order state change process framework. The steps of each order common process during the order state change include corresponding lock acquisition, data query, data verification, data assembly, data storage, post-processing, and lock release; and the order state machine pre-packages the parameter verification, the data query, and the data verification logic corresponding to each common process into corresponding multiple independent plug-ins, decoupling the business processing logic of the order from the data verification and query logic; The system includes: A target plug-in call module, configured to call a target plug-in among the multiple independent plug-ins according to the parameters of the call request when receiving a call request for an order-related interface; A parameter verification module, configured to perform parameter verification on the parameters of the call request through the target plug-in to obtain a parameter verification result; A verification result comparison module, configured to determine whether the parameter verification is passed according to the truth or falsehood of the parameter verification result; A verification result processing module, configured to perform a data query in the data source of the order business system according to the parameters of the call request to obtain target data when the parameter verification result is true; otherwise, return a parameter verification failure message.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.