Order settlement method and device, electronic equipment and storage medium
By extracting settlement rules from the code to form a pre-configured set of settlement strategies, and by adopting a design that separates data extraction rules and calculation rules, the problem of poor scalability and maintainability of existing order settlement systems is solved. This enables flexible adaptation to deduction configuration requirements and improves the scalability and maintenance efficiency of the system.
Patent Information
- Application Number
- CN202511084456.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-18
AI Technical Summary
In existing technologies, order settlement systems require modification of program code and redeployment when adding or modifying deduction configuration types, resulting in poor system scalability and maintainability.
By extracting settlement rules from the code to form a pre-configured set of settlement strategies, and adopting a design that separates data extraction rules and calculation rules, dynamic matching of target settlement strategies is achieved, and strategy management is carried out through a visual configuration interface and an automatic repair mechanism.
It enables flexible adaptation to various point deduction configuration requirements without modifying the program code, significantly improving the system's scalability and maintenance efficiency, and reducing system maintenance costs and manual intervention time.
Smart Images

Figure CN120975775A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of order processing, and in particular to an order settlement method and device, electronic equipment and a storage medium. BACKGROUND
[0002] With the rapid development of e-commerce platforms, the order settlement system between merchants and platforms faces increasingly complex settlement rule management requirements. In a typical mall system, order settlement involves multiple deduction modes (such as fixed proportion, fixed amount, etc.), and platform commissions need to be dynamically calculated according to different attributes such as commodity category and merchant type.
[0003] The existing order settlement scheme mainly realizes settlement logic in a hard-coded manner, which is specifically manifested as follows: when the order state reaches the settlement condition, the system matches different deduction types through pre-written conditional judgment statements (such as if-else or switch-case structures), and then combines the order amount field to calculate the commission.
[0004] However, the implementation method of directly coding business rules in program logic in the prior art requires modification of program code and redeployment of the system when adding or modifying deduction configuration types, resulting in poor system scalability and maintainability. SUMMARY
[0005] The purpose of the embodiments of the present application is to provide an order settlement method, device, electronic equipment and storage medium to solve the problem of poor system scalability and maintainability caused by the implementation method of directly coding business rules in program logic in the prior art when adding or modifying deduction configuration types. The specific technical solutions are as follows:
[0006] In a first aspect, the present application provides an order settlement method, comprising:
[0007] Obtaining order data of a paid order, wherein the order data comprises attribute data and payment data;
[0008] According to the attribute data, determining a target settlement strategy from a pre-configured settlement strategy set, wherein the target settlement strategy comprises data extraction rules and calculation rules;
[0009] According to the data extraction rules, obtaining target calculation data from the payment data;
[0010] Applying the calculation rules to the target calculation data for calculation processing to generate order settlement data.
[0011] In one possible implementation, the step of determining a target settlement strategy from a pre-configured settlement strategy set according to the attribute data comprises:
[0012] parsing the attribute data to obtain a merchant category identifier and a commodity category code;
[0013] matching at least one first settlement strategy from the settlement strategy set by using the merchant category identifier;
[0014] matching a target settlement strategy in the at least one first settlement strategy by using the commodity category code;
[0015] in a case where a corresponding settlement strategy is not matched by using the merchant category identifier and the commodity category code, taking a preset default settlement strategy as the target settlement strategy.
[0016] In one possible implementation, the method further includes:
[0017] parsing the data extraction rule to obtain a target field name;
[0018] locating a corresponding data storage structure from the payment data based on the target field name;
[0019] dynamically accessing the data storage structure by a reflection mechanism to obtain a corresponding target field value;
[0020] determining the target field value as the target calculation data.
[0021] In one possible implementation, the method further includes:
[0022] after the order settlement data is generated, establishing an association relationship between the order settlement data and the paid order;
[0023] persistently storing the association relationship to a settlement database;
[0024] when a fund distribution is triggered, querying the order settlement data corresponding to the paid order from the settlement database;
[0025] generating a fund transfer instruction according to the queried order settlement data;
[0026] calling a payment interface to execute the fund transfer instruction to perform a fund distribution operation.
[0027] In one possible implementation, the method further includes:
[0028] receiving configuration information through a visual configuration interface, the configuration information being used to configure at least one kind of order attribute data and a settlement strategy corresponding to each kind of order attribute data;
[0029] validating validity of the received configuration information;
[0030] storing the validated configuration information into the settlement strategy set.
[0031] In one possible implementation, the method further includes:
[0032] performing abnormality detection on the settlement strategy set at a preset time interval;
[0033] in a case where it is detected that there is abnormal configuration information, determining an abnormality type corresponding to the abnormal configuration information;
[0034] performing a corresponding repair operation on the abnormal configuration information according to the abnormality type;
[0035] revalidating the repaired configuration information;
[0036] updating the validated configuration information to the settlement strategy set.
[0037] In one possible implementation, the performing a corresponding repair operation on the abnormal configuration information according to the abnormality type includes:
[0038] when the abnormality type is a configuration logic abnormality, extracting a latest valid historical version from a configuration version library, and replacing an abnormal configuration in the abnormal configuration information with the valid historical version;
[0039] when the abnormality type is a data integrity abnormality, identifying a missing data item in the abnormal configuration information, generating a corresponding completion value according to a preset completion rule, and filling the completion value to the missing data item.
[0040] In a second aspect, the present application provides an order settlement device, including:
[0041] a first obtaining module configured to obtain order data of a paid order, wherein the order data includes attribute data and payment data;
[0042] a determining module configured to determine a target settlement strategy from a preconfigured settlement strategy set according to the attribute data, wherein the target settlement strategy includes a data extraction rule and a calculation rule;
[0043] a second obtaining module configured to obtain target calculation data from the payment data according to the data extraction rule;
[0044] a processing module configured to perform calculation processing on the target calculation data by applying the calculation rule, and generate order settlement data.
[0045] In a possible implementation, the determining module is specifically configured to:
[0046] parsing the attribute data to obtain a merchant category identifier and a commodity category code;
[0047] matching at least one first settlement strategy from the settlement strategy set by using the merchant category identifier;
[0048] matching a target settlement strategy in the at least one first settlement strategy by using the commodity category code;
[0049] in a case where a corresponding settlement strategy is not matched by using the merchant category identifier and the commodity category code, taking a preset default settlement strategy as the target settlement strategy.
[0050] In a possible implementation, the second obtaining module is specifically configured to:
[0051] parsing the data extraction rule to obtain a target field name;
[0052] locating a corresponding data storage structure from the payment data based on the target field name;
[0053] dynamically accessing the data storage structure by using a reflection mechanism to obtain a corresponding target field value;
[0054] determining the target field value as the target calculation data.
[0055] In a possible implementation, the apparatus further includes an executing module configured to:
[0056] after the order settlement data is generated, establishing an association relationship between the order settlement data and the paid order;
[0057] persistently storing the association relationship to a settlement database;
[0058] when fund allocation is triggered, querying the order settlement data corresponding to the paid order from the settlement database;
[0059] generating a fund transfer instruction according to the queried order settlement data;
[0060] calling a payment interface to execute the fund transfer instruction to perform a fund allocation operation.
[0061] In a possible implementation, the apparatus further includes a configuring module configured to:
[0062] receiving configuration information through a visual configuration interface, the configuration information being used to configure at least one kind of order attribute data and a settlement strategy corresponding to each kind of order attribute data;
[0063] validating the received configuration information;
[0064] storing the validated configuration information into the settlement strategy set.
[0065] In one possible implementation, the apparatus further comprises a repairing module configured to:
[0066] performing abnormality detection on the settlement strategy set at every preset time interval;
[0067] in a case where it is detected that there is abnormal configuration information, determining an abnormal type corresponding to the abnormal configuration information;
[0068] performing a corresponding repairing operation on the abnormal configuration information according to the abnormal type;
[0069] revalidating the repaired configuration information;
[0070] updating the validated configuration information to the settlement strategy set.
[0071] In one possible implementation, the repairing module is further configured to:
[0072] when the abnormal type is a configuration logic abnormality, extracting a latest valid historical version from a configuration version library and replacing an abnormal configuration in the abnormal configuration information with the valid historical version;
[0073] when the abnormal type is a data integrity abnormality, identifying a missing data item in the abnormal configuration information, generating a corresponding completion value according to a preset completion rule, and filling the completion value into the missing data item.
[0074] In a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
[0075] the memory is configured to store a computer program;
[0076] the processor is configured to execute the program stored on the memory, and implement the method steps of any one of the first aspect.
[0077] In a fourth aspect, a computer readable storage medium is provided, characterized in that the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method steps of any one of the first aspect.
[0078] In a fifth aspect, a computer program product containing instructions is provided, which, when executed on a computer, causes the computer to perform the order settlement method of any one of the above aspects.
[0079] The embodiments of the present application have the following beneficial effects:
[0080] The embodiments of the present application provide an order settlement method and device, electronic equipment and storage medium. In the present application, firstly, the settlement rule is separated from the code to form a pre-configured settlement strategy set (including data extraction rule and calculation rule), so that when a new deduction point type is added, only the configuration needs to be updated without modifying the code. Secondly, through the technical scheme of attribute data dynamically matching the target settlement strategy, the ability of automatically selecting the corresponding settlement rule according to the order attribute is realized. Finally, through the separation design of the data extraction rule and the calculation rule, the payment data acquisition mode and the calculation logic can be independently configured, and when the business rule changes, only the corresponding rule needs to be adjusted without overall reconstruction. In this way, the traditional hard-coded implementation mode is fundamentally changed, so that the settlement system can flexibly adapt to various deduction point configuration requirements without modifying the program code, and the system expansion and maintenance efficiency are significantly improved.
[0081] Of course, implementing any product or method of the present application does not necessarily require all the advantages described above. BRIEF DESCRIPTION OF DRAWINGS
[0082] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application, together with the description.
[0083] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.
[0084] One or more embodiments are exemplarily illustrated by the pictures in the drawings corresponding thereto, and these exemplary illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, unless otherwise specified. The drawings in the drawings do not constitute a proportional limitation.
[0085] Figure 1 A flowchart of an order settlement method provided by the embodiments of the present application;
[0086] Figure 2 A flowchart of another order settlement method provided by the embodiments of the present application;
[0087] Figure 3 A flowchart of another order settlement method provided by the embodiments of the present application;
[0088] Figure 4A schematic diagram of a visual configuration interface provided by an embodiment of the present application;
[0089] Figure 5 A schematic diagram of another visual configuration interface provided by an embodiment of the present application;
[0090] Figure 6 A structural schematic diagram of an order settlement device provided by an embodiment of the present application;
[0091] Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0092] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to make a clear and complete description of the technical solutions of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0093] The following disclosure provides many different embodiments, or examples, for implementing different structures of the present application. For the purpose of simplifying the present application's disclosure, the components and settings of specific examples are described in the following. Of course, they are merely examples, and the purpose is not to limit the present application. In addition, the present application can repeatedly refer to numbers and / or letters in different examples. Such repetition is for the purpose of simplification and clarity, and it does not indicate the relationship between the various embodiments and / or settings discussed.
[0094] Figure 1 A flowchart of an order settlement method provided by an embodiment of the present application. The method can be applied to one or more electronic devices such as smartphones, notebook computers, desktop computers, portable computers, and servers. In addition, the execution subject of the method can be hardware or software. When the execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute the method, or multiple electronic devices can cooperate with each other to execute the method. When the execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made herein.
[0095] As shown in Figure 1 , the method specifically includes:
[0096] S101, obtaining order data of a paid order, wherein the order data includes attribute data and payment data.
[0097] Paid order refers to a transaction order whose payment process is completed and payment success is confirmed by the payment system, and the order status is marked as "paid".
[0098] Order data refers to a complete transaction information set required for settlement processing, wherein attribute data refers to order characteristic data used to determine settlement rules, including but not limited to merchant category identifier (used to distinguish merchant types), commodity category code (used to distinguish commodity types), and promotion activity identifier; payment data refers to transaction data directly related to amount calculation, including order actual payment amount, shipping fee, discount amount, and tax.
[0099] In the embodiments of the application, the data interface of the order system is called to obtain a full set of order data of completed payment verification in real time, including order basic information, commodity details, and payment vouchers, and the data is preliminarily checked and formatted, thereby providing complete and standardized input data for subsequent settlement strategy matching.
[0100] S102, determining a target settlement strategy from a preconfigured settlement strategy set according to the attribute data, wherein the target settlement strategy includes data extraction rules and calculation rules.
[0101] The settlement strategy set refers to a settlement rule library preconfigured and persistently stored by the platform, which is stored in an extensible data structure, and each settlement strategy contains core elements such as applicable conditions, data extraction rules, and calculation rules. The target settlement strategy refers to a specific settlement scheme matched from the strategy set according to the current order characteristics.
[0102] In the embodiments of the application, S102 can specifically include the following steps: parsing the attribute data to obtain a merchant category identifier and a commodity category code; matching at least one first settlement strategy from the settlement strategy set using the merchant category identifier; matching a target settlement strategy in at least one first settlement strategy using the commodity category code; and in the case where the merchant category identifier and the commodity category code do not match the corresponding settlement strategy, using a preset default settlement strategy as the target settlement strategy.
[0103] The merchant category identifier refers to a code used to uniquely distinguish different merchant types, which is usually classified according to the characteristics of the business category and scale of the merchant; the commodity category code refers to a standard coding system for classifying commodities on an e-commerce platform; the first settlement strategy refers to a candidate settlement strategy set obtained in the preliminary matching stage; and the default settlement strategy refers to a bottom settlement scheme used by the system when the matching conditions are not met.
[0104] In the scheme, the system first deeply analyzes order attribute data, extracts key merchant category identifier and commodity category code as two dimension features; then adopts two-level matching mechanism, first performs first round screening from pre-configured settlement strategy set with merchant category identifier as condition, obtains candidate strategy set suitable for the merchant type (i.e. first settlement strategy); then performs second round accurate matching in the candidate strategy set with commodity category code as condition, determines final target settlement strategy; if no strategy meeting the condition is found after two-level matching, pre-configured default settlement strategy is automatically enabled as a safeguard.
[0105] The scheme, on one hand, improves the accuracy of settlement strategy positioning through hierarchical matching, and can meet the differentiated settlement needs of different merchants and different commodities; on the other hand, through a perfect bottom-up mechanism, it ensures that the system can normally complete settlement processing in any case, greatly improves the reliability and business continuity of the system, and at the same time, this structured matching logic also provides a clear framework for the expansion and maintenance of subsequent settlement strategies.
[0106] S103, obtaining target calculation data from the payment data according to the data extraction rule.
[0107] The data extraction rule is a field extraction specification defined in the target settlement strategy, which adopts a declarative configuration method to explicitly specify the field name, data type and conversion rule to be extracted from the payment data.
[0108] The target calculation data is a normalized numerical set that can be directly used for settlement calculation, which is obtained according to the extraction rule.
[0109] In the embodiment of the application, S103 can specifically include the following steps: parsing the data extraction rule to obtain a target field name; based on the target field name, locating a corresponding data storage structure from the payment data; dynamically accessing the data storage structure through a reflection mechanism to obtain a corresponding target field value; and determining the target field value as the target calculation data.
[0110] The target field name refers to the identification name of a specific field that needs to be obtained from the payment data in the data extraction rule; the data storage structure refers to the organization form of the payment data in the system memory or the database, including but not limited to object attribute, database field or JSON node, etc.; the reflection mechanism refers to a technical means of dynamically obtaining and operating class information and object attributes during program running.
[0111] In the scheme, the system first parses the target field name configured in the data extraction rule to determine the data content to be extracted; then locates the corresponding data position in the storage structure of the payment data according to the field name; then dynamically accesses the located data storage structure by using the reflection mechanism to obtain the current value of the target field stored therein; finally, after type conversion and verification of the obtained field value, the field value is determined as the final target calculation data.
[0112] The scheme dynamically obtains the field value through the reflection mechanism, avoids the problem of modifying the code when the field changes in the traditional hard coding mode, enables the system to flexibly adapt to the changes of the payment data structure, and at the same time, regularizes the configuration of the data extraction process, greatly improves the maintainability and expansibility of the system, and when a field to be extracted is added or modified, only the data extraction rule needs to be adjusted without modifying the program code, thereby significantly reducing the system maintenance cost. The technical scheme is particularly suitable for the e-commerce settlement scene with complex and frequently changing payment data structure.
[0113] S104, applying the calculation rule to the target calculation data for calculation processing to generate order settlement data.
[0114] The calculation rule is a mathematical operation logic defined in the target settlement strategy, supports formula configuration, and includes calculation types such as arithmetic operation and conditional judgment.
[0115] The order settlement data is structured data containing platform commission, settlement amount and other information finally generated.
[0116] In the embodiment of the application, first, the calculation rule is loaded and syntax analyzed to identify the mapping relationship between the variable and the target calculation data; then, the target calculation data is substituted into the calculation rule to perform operation and generate a preliminary calculation result; then, the result is post-processed according to the adjustment rule (such as rounding, guaranteed commission, etc.) in the settlement strategy; finally, the order settlement data containing the detail items is generated. The scheme realizes flexible definition and dynamic execution of the settlement logic through the configurable calculation rule.
[0117] As a specific example, the system performs differentiated calculation according to the deduction point configuration type (i.e. the business classification identifier of the calculation rule) defined in the target settlement strategy: when the configuration type is fixed ratio type (at this time the calculation factor B in the calculation rule is the proportion coefficient, such as 20%, i.e. B = 0.2), the system extracts the target calculation data A (such as order actual payment amount real_fee = 100, shipping fee post_fee = 0) from the payment data, and substitutes it into the calculation formula "platform commission = A x B" to calculate the commission income of 20; when the configuration type is fixed amount type (at this time the calculation factor B is a preset fixed value, such as B = 30), then directly output the value of B as the commission income, and in this scenario, the target calculation data is not required to participate in the operation. In this example: calculation factor B: parameter variable defined in the calculation rule, whose semantics varies with the deduction point configuration type (proportion coefficient or fixed value); target calculation data A: field value (such as real_fee) obtained from the payment data according to the data extraction rule; free shipping: indicates that post_fee = 0, reflecting the processing capability of the data extraction rule for zero value fields. This design enables the platform to flexibly support diversified settlement rules while maintaining the consistency and maintainability of the calculation process.
[0118] In the embodiments of the present application, first, by separating the settlement rules from the code, a pre-configured settlement strategy set (including data extraction rules and calculation rules) is formed, so that when a new deduction point type is added, only the configuration needs to be updated without modifying the code; second, by dynamically matching the attribute data with the target settlement strategy, the ability to automatically select the corresponding settlement rule according to the order attributes is realized; finally, by separating the data extraction rules and the calculation rules, the way of obtaining the payment data and the calculation logic can be independently configured, and when the business rules change, only the corresponding rules need to be adjusted without the need for overall reconstruction. In this way, the traditional hard-coded implementation method is fundamentally changed, so that the settlement system can flexibly adapt to various deduction point configuration requirements without modifying the program code, significantly improving the scalability and maintenance efficiency of the system.
[0119] Referring to Figure 2 An embodiment flowchart of another order settlement method provided by the embodiments of the present application is shown in FIG. 4. As shown in FIG. 4, the flowchart can include the following steps: Figure 2
[0120] S201, after generating the order settlement data, establishing an association relationship between the order settlement data and the paid order.
[0121] The association relationship refers to the mapping relationship formed between the order settlement data and the source order through the establishment of a bidirectional indexing mechanism, specifically including: 1) physical association - achieved by storing the order unique number in the settlement data; 2) logical association - achieved by maintaining the correspondence between the settlement data and the order business attributes.
[0122] In the embodiments of the present application, after generating the order settlement data, the system automatically creates an associated record. The specific implementation process is as follows: first, the key identification information (such as order ID, merchant ID, etc.) of the source order is extracted, then an associated relationship object containing metadata such as settlement version number and association timestamp is constructed, and finally the object is stored in association with the settlement data. This step ensures that each piece of settlement data can be accurately corresponded to the source order, providing a complete link for subsequent auditing and querying.
[0123] S202, persistently store the associated relationship to the settlement database.
[0124] Persistent storage refers to the process of writing data into non-volatile storage media using ACID transaction mechanism; the settlement database is a special database cluster designed by dividing the database into multiple parts, containing data tables such as associated relationship table and settlement detail table.
[0125] In the embodiments of the present application, the associated relationship object is first serialized, then the data is written into the MySQL cluster and Elasticsearch index through the distributed transaction framework, and finally the associated state in the Redis cache is updated synchronously. Data encryption and integrity verification are implemented during storage to ensure reliable storage and fast retrieval of the associated relationship.
[0126] S203, when the fund allocation is triggered, query the order settlement data corresponding to the paid order from the settlement database.
[0127] Triggering fund allocation refers to the fund processing flow started by the system through the event-driven mechanism. The triggering conditions include timer events (such as daily settlement), threshold events (such as cumulative amount reaching the standard), or manual intervention events.
[0128] In the embodiments of the present application, the fund allocation service listens to the event bus. When the triggering event arrives, first, the target order set is queried in parallel from the shard cluster of the settlement database, then the corresponding settlement data is quickly located through the associated relationship index, and finally the query results are summarized and verified to generate a to-be-processed task queue. This step uses a read-write separation architecture to ensure query performance, while implementing data consistency checking.
[0129] S204, generate fund transfer instructions according to the queried order settlement data.
[0130] Fund transfer instructions are structured electronic instructions that meet the PCI-DSS standard, including instruction header, transaction subject, security verification, and other components.
[0131] In the embodiment of the application, first, the corresponding clearing channel is selected according to the merchant qualification information in the settlement data, then the instruction elements (including the payee information, settlement amount, commission details, etc.) are assembled according to the channel specification, then the digital signature and transaction serial number are attached, and finally the instruction message conforming to the financial standard such as ISO 8583 is generated. This step implements a double-checking mechanism for the instruction to ensure the accuracy of the fund processing.
[0132] S205, calling a payment interface to execute the fund transfer instruction to perform a fund allocation operation.
[0133] The payment interface refers to an adaptation layer service encapsulating the API of a bank / third-party payment institution.
[0134] In the embodiment of the application, the system first locates the available payment interface instance through the service grid, then sends the instruction in an asynchronous non-blocking manner, monitors the interface response state in real time, updates the settlement state after receiving the processing result, and triggers the reconciliation process. This step implements a fuse mechanism and a retry strategy to ensure the high reliability of the fund operation.
[0135] Figure 2 The flowchart shown builds a complete solution from settlement calculation to fund delivery, effectively solving the link breakage, data inconsistency, and operation risk problems existing in the order settlement and fund transfer links of traditional e-commerce platforms, and greatly improving the overall reliability and operation efficiency of the settlement system.
[0136] Referring to Figure 3 An embodiment flowchart of another order settlement method provided in the embodiment of the application is shown. As Figure 3 shown, the flowchart can include the following steps:
[0137] S301, performing abnormality detection on the settlement strategy set at a preset time interval.
[0138] The preset time interval refers to the periodic detection frequency parameter configured by the system administrator, which can be dynamically adjusted according to business needs.
[0139] In the embodiment of the application, through the timing task scheduling mechanism, the scanning detection of the settlement strategy set is automatically triggered according to the configured time period (such as every hour), and the detection range includes the integrity, logical reasonableness, and compatibility with the current version of the system of the strategy configuration, etc. dimensions, to ensure that potential problems can be found in time.
[0140] S302, determining the abnormal type corresponding to the abnormal configuration information in the case where the abnormal configuration information is detected.
[0141] The abnormal configuration information refers to a policy entry in the settlement strategy set that does not conform to a preset check rule; the abnormal type is a systematic classification of the abnormal configuration, mainly including a configuration logic abnormality (such as a calculation formula syntax error) and a data integrity abnormality (such as a missing required field).
[0142] In the embodiment of the application, the abnormal configuration found is analyzed in depth by using a preset abnormal detection rule engine, abnormal features are extracted, and the abnormal features are matched with a predefined abnormal mode library, so that the abnormal type is accurately identified, and a basis is provided for subsequent repair.
[0143] S303, a corresponding repair operation is performed on the abnormal configuration information according to the abnormal type.
[0144] The repair operation refers to a corrective measure automatically performed by the system for a specific abnormal type.
[0145] In the embodiment of the application, S303 can specifically include the following steps: when the abnormal type is a configuration logic abnormality, the latest valid historical version is extracted from a configuration version library, and the valid historical version is used to replace the abnormal configuration in the abnormal configuration information; when the abnormal type is a data integrity abnormality, a missing data item in the abnormal configuration information is identified, a corresponding completion value is generated according to a preset completion rule, and the completion value is filled into the missing data item.
[0146] The configuration version library refers to a version control system that records historical changes of a settlement strategy, and saves complete configuration snapshots of each version in an incremental storage mode; the valid historical version refers to a past configuration version that is verified by the system and has no abnormal record; the missing data item refers to a required field that is not filled or filled in a non-standard manner in the configuration information; and the completion rule is a predefined field value generation logic, including a default value rule, a historical average value rule, and the like.
[0147] In the scheme, for configuration logic exceptions (such as calculation formula syntax errors), the system first queries the configuration version library, retrieves the modification history of the strategy in reverse chronological order, filters out the latest version record that passes the verification, and then performs an atomic replacement operation to replace the entire abnormal configuration with the historical version; for data integrity exceptions (such as the commission ratio field being empty), the system first scans the configuration information structure and marks all required but missing fields, then matches the corresponding completion rules (such as using the average value of similar merchants for numerical type fields) according to the field data type (such as numerical type, character type, etc.), and finally fills the generated values into the corresponding field positions. The scheme quickly fixes logical errors through version rollback to ensure system instant availability; handles data missing based on intelligent completion rules to avoid business distortion caused by simple default value filling; the entire repair process does not require human intervention, solving the problem of low efficiency of traditional manual troubleshooting and avoiding settlement business interruption due to delayed repair, ensuring settlement accuracy while greatly improving system robustness and operation efficiency.
[0148] S304, re-verify the repaired configuration information.
[0149] Re-verification refers to the process of full-quantity checking of the repaired configuration information.
[0150] In the embodiments of the present application, the correctness and availability of the repaired configuration information are verified through simulation of strategy calculation and checking of data association, etc., to ensure that it can be normally loaded and executed by the system.
[0151] S305, update the verified configuration information to the settlement strategy set.
[0152] Updating to the settlement strategy set refers to the process of re-writing the repaired and verified configuration information into the strategy library.
[0153] In the embodiments of the present application, the strategy data is updated in an atomic operation mode, while the version number is maintained and the change log is recorded to ensure the traceability of strategy changes.
[0154] Figure 3 The illustrated process significantly improves the stability and reliability of the settlement system through the closed-loop process of regular detection, intelligent diagnosis, automatic repair and strict verification, effectively avoids settlement errors caused by configuration exceptions, and greatly reduces the cost of manual intervention, so that the system can maintain the accuracy and consistency of configuration data without interruption of service.
[0155] In another embodiment of the present application, the method can further include the steps of: receiving configuration information through a visual configuration interface, the configuration information being used to configure at least one order attribute data and a settlement strategy corresponding to each order attribute data; performing validity verification on the received configuration information; and storing the configuration information that passes the verification into the settlement strategy set.
[0156] The visual configuration interface refers to a user interface that provides a graphical interactive mode and allows an administrator to perform configuration through visual operations such as forms and drag-and-drop. The configuration information refers to complete settlement strategy definition data input through the interface, including strategy matching conditions and calculation rules and other elements.
[0157] In this scheme, the system shows the administrator a visual configuration interface containing elements such as form controls and strategy editing areas, receives settlement strategy configuration data input by the administrator, and these data include order attribute conditions (such as merchant types and product categories) and corresponding detailed settlement rules applicable to the strategy. Then the system performs multiple validity verifications on the input configuration information, including syntax checking, logic verification, and conflict detection. Finally, the configuration information that passes the verification is converted into a data structure recognizable by the system and is stored persistently into the settlement strategy set.
[0158] Figure 4 And Figure 5 is a schematic diagram of the visual configuration interface. When applied, the user can configure the point deduction type, corresponding calculation factors, and calculation formula through the configuration interface (i.e., input settlement strategy configuration data), and can associate the settlement strategy with the order through the configuration interface for use in the settlement process. Figure 4 Figure 5 This scheme greatly reduces the configuration threshold of settlement strategies through a visual interface, allowing non-technical personnel to quickly set up complex settlement rules. At the same time, a strict verification mechanism ensures the accuracy and consistency of the configuration data, avoiding settlement abnormalities caused by incorrect configuration. In addition, this configuration management method enables the system to dynamically update settlement rules without downtime, greatly improving the flexibility and usability of the system and perfectly solving the problem of the need for development intervention and system restart when changing settlement rules in the traditional hard coding method.
[0159] Based on the same technical concept, embodiments of the present application also provide an order settlement device, as shown in , which includes:
[0160] Figure 6 A first acquisition module 61 is configured to acquire order data of a paid order, wherein the order data includes attribute data and payment data.
[0161] A second acquisition module 62 is configured to acquire settlement strategy data of the paid order, wherein the settlement strategy data includes a settlement strategy corresponding to each order attribute data.
[0162] The determining module 62 is configured to determine a target settlement strategy from a preconfigured settlement strategy set according to the attribute data, wherein the target settlement strategy comprises data extraction rules and calculation rules.
[0163] The second obtaining module 63 is configured to obtain target calculation data from the payment data according to the data extraction rules.
[0164] The processing module 64 is configured to perform calculation processing on the target calculation data according to the calculation rules, and generate order settlement data.
[0165] In a possible implementation, the determining module is specifically configured to:
[0166] Parse the attribute data to obtain a merchant category identifier and a commodity category code;
[0167] Match at least one first settlement strategy from the settlement strategy set by using the merchant category identifier;
[0168] Match a target settlement strategy from the at least one first settlement strategy by using the commodity category code;
[0169] In a case where the merchant category identifier and the commodity category code do not match a corresponding settlement strategy, use a preconfigured default settlement strategy as the target settlement strategy.
[0170] In a possible implementation, the second obtaining module is specifically configured to:
[0171] Parse the data extraction rules to obtain a target field name;
[0172] Locate a corresponding data storage structure from the payment data based on the target field name;
[0173] Access the data storage structure dynamically through a reflection mechanism to obtain a corresponding target field value;
[0174] Determine the target field value as the target calculation data.
[0175] In a possible implementation, the apparatus further comprises an executing module configured to:
[0176] After the order settlement data is generated, establish an association relationship between the order settlement data and the paid order;
[0177] Persist the association relationship to a settlement database;
[0178] When fund distribution is triggered, query the order settlement data corresponding to the paid order from the settlement database;
[0179] Generate fund transfer instructions based on the retrieved order settlement data;
[0180] The payment interface is invoked to execute the fund transfer instruction in order to perform the fund allocation operation.
[0181] In one possible implementation, the device further includes a configuration module for:
[0182] The configuration information is received through a visual configuration interface. The configuration information is used to configure at least one order attribute data and a settlement strategy corresponding to each order attribute data.
[0183] Validate the received configuration information.
[0184] The verified configuration information is stored in the settlement strategy set.
[0185] In one possible implementation, the device further includes a repair module for:
[0186] Anomaly detection is performed on the settlement strategy set at preset time intervals;
[0187] If abnormal configuration information is detected, the abnormal type corresponding to the abnormal configuration information is determined;
[0188] Perform corresponding repair operations on the abnormal configuration information according to the abnormal type;
[0189] Re-verify the repaired configuration information;
[0190] Update the verified configuration information to the settlement strategy set.
[0191] In one possible implementation, the repair module is further configured to:
[0192] When the exception type is a configuration logic exception, the most recent valid historical version is extracted from the configuration version repository, and the valid historical version is used to replace the exception configuration in the exception configuration information.
[0193] When the anomaly type is a data integrity anomaly, the missing data item in the anomaly configuration information is identified, the corresponding completion value is generated according to the preset completion rules, and the completion value is filled into the missing data item.
[0194] Based on the same technical concept, embodiments of this application also provide an electronic device, such as... Figure 7 As shown, it includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0195] a memory 113, configured to store a computer program;
[0196] a processor 111, configured to implement the following steps when executing the program stored in the memory 113:
[0197] obtain order data of a paid order, wherein the order data comprises attribute data and payment data;
[0198] determine a target settlement strategy from a pre-configured settlement strategy set according to the attribute data, wherein the target settlement strategy comprises data extraction rules and calculation rules;
[0199] obtain target calculation data from the payment data according to the data extraction rules;
[0200] perform calculation processing on the target calculation data according to the calculation rules to generate order settlement data.
[0201] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0202] The communication interface is used for communication between the above-mentioned electronic device and other devices.
[0203] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0204] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0205] In another embodiment provided in the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the steps of any of the order settlement methods.
[0206] In another embodiment provided in the present application, a computer program product containing instructions is provided, and when the computer program product is executed on a computer, the computer program product causes the computer to execute any of the order settlement methods in the above embodiments.
[0207] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0208] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software plus a general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, and the computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0209] It is to be understood that the terminology used herein is for the purpose of describing particular example embodiments only and is not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order
[0210] The above description is merely that of the specific embodiments of the application and as such is not to be taken in a limiting sense. Various modifications and alterations of the embodiments described herein will become apparent to those skilled in the art from the foregoing description, which does not limit the generality presented. It is the intention that all such modifications and alterations be considered equaliy by the spirit and scope of this application. It is therefore intended to cover in the appended claims all such changes and alterations that come within the scope of this application.
Claims
1. An order settlement method, characterized in that, The method includes: Retrieve order data for paid orders, wherein the order data includes attribute data and payment data; Based on the attribute data, a target settlement strategy is determined from a pre-configured set of settlement strategies, wherein the target settlement strategy includes data extraction rules and calculation rules; According to the data extraction rules, target calculation data is obtained from the payment data; The target calculation data is processed using the calculation rules described above to generate order settlement data.
2. The method according to claim 1, characterized in that, The step of determining the target settlement strategy from the pre-configured settlement strategy set based on the attribute data includes: The attribute data is parsed to obtain the merchant category identifier and product category code; At least one first settlement strategy is matched from the settlement strategy set using the merchant category identifier; The target settlement strategy is matched in at least one first settlement strategy using the product category code. If no corresponding settlement strategy is found using the merchant category identifier and the product category code, the preset default settlement strategy will be used as the target settlement strategy.
3. The method according to claim 1, characterized in that, The step of obtaining target calculation data from the payment data according to the data extraction rules includes: Parse the data extraction rules to obtain the target field names; Based on the target field name, locate the corresponding data storage structure from the payment data; The data storage structure is dynamically accessed via reflection to obtain the corresponding target field value; The target field value is determined as the target calculation data.
4. The method according to claim 1, characterized in that, The method further includes: After generating the order settlement data, establish the association between the order settlement data and the paid orders; The aforementioned relationship is persistently stored in the settlement database; When fund allocation is triggered, the settlement data of the paid order is retrieved from the settlement database. Generate fund transfer instructions based on the retrieved order settlement data; The payment interface is invoked to execute the fund transfer instruction in order to perform the fund allocation operation.
5. The method according to claim 1, characterized in that, The method further includes: The configuration information is received through a visual configuration interface. The configuration information is used to configure at least one order attribute data and a settlement strategy corresponding to each order attribute data. Validate the received configuration information. The verified configuration information is stored in the settlement strategy set.
6. The method according to claim 1, characterized in that, The method further includes: Anomaly detection is performed on the settlement strategy set at preset time intervals; If abnormal configuration information is detected, the abnormal type corresponding to the abnormal configuration information is determined; Perform corresponding repair operations on the abnormal configuration information according to the abnormal type; Re-verify the repaired configuration information; Update the verified configuration information to the settlement strategy set.
7. The method according to claim 6, characterized in that, The step of performing corresponding repair operations on the abnormal configuration information according to the abnormal type includes: When the exception type is a configuration logic exception, the most recent valid historical version is extracted from the configuration version repository, and the valid historical version is used to replace the exception configuration in the exception configuration information. When the anomaly type is a data integrity anomaly, the missing data item in the anomaly configuration information is identified, the corresponding completion value is generated according to the preset completion rules, and the completion value is filled into the missing data item.
8. An order settlement device, characterized in that, The device includes: The first acquisition module is used to acquire order data of paid orders, wherein the order data includes attribute data and payment data; The determination module is used to determine a target settlement strategy from a pre-configured set of settlement strategies based on the attribute data, wherein the target settlement strategy includes data extraction rules and calculation rules; The second acquisition module is used to acquire target calculation data from the payment data according to the data extraction rules; The processing module is used to apply the calculation rules to perform calculations on the target calculation data and generate order settlement data.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the order settlement method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the order settlement method according to any one of claims 1-7.