Data record processing method and device, computer equipment, readable storage medium and program product
By obtaining the data record context object to match the path template and dynamically adjusting the path chain, the flexibility problem of traditional data record systems when facing new scenarios is solved, and efficient data record adaptation and automated processing are achieved.
Patent Information
- Application Number
- CN202511138428.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-11-11
AI Technical Summary
Traditional data recording systems suffer from long rule change cycles, high code maintenance costs, and difficulty in code reuse when faced with new products, new scenarios, and new recording rules, resulting in poor data recording flexibility and difficulty in meeting the requirements of flexible configuration.
By obtaining the current data record context object, matching the target path template in the path template library, adjusting the initial path chain based on the branch judgment logic, and generating a data record information table, dynamic configuration and adjustment of the path chain can be achieved to adapt to complex recording scenarios.
It improves the flexibility of data recording, automatically adapting to new business and new recording rules without adjusting code logic, thus enhancing the system's adaptability and efficiency.
Smart Images

Figure CN120929462A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a data recording and processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] With the development of data processing technology, there has been a trend of evolution from a static, single rule execution mode to a multi-dimensional, dynamic, and automatic generation mode.
[0003] In traditional technologies, systems often configure fixed data recording logic separately for different products or types. The system has a pre-built set of fixed record information generation processes, such as each mapping rule combination needing to be pre-defined; when facing new products, new scenarios, or new recording rules, it is necessary to modify the underlying program code or redeploy the data recording and record information generation modules.
[0004] However, the current approach suffers from long rule change cycles, high code maintenance costs, difficulty in code reuse, and poor product scalability, all of which result in poor data recording flexibility and make it difficult to meet the requirements of flexible configuration. Summary of the Invention
[0005] Therefore, it is necessary to provide a data recording and processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve flexibility in addressing the aforementioned technical problems.
[0006] In a first aspect, this application provides a data recording and processing method, the method comprising:
[0007] Get the context object of the current data record;
[0008] The target path template is obtained by matching the current data record context object with the path templates stored in the path template library; the target path template includes an initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes;
[0009] For each of the aforementioned data record nodes, branch judgment logic is executed to obtain the branch judgment result;
[0010] Based on the branch determination result, the data record nodes in the initial path chain are adjusted to obtain the target path chain;
[0011] A data record information table is generated based on the data record template corresponding to each data record node in the target path chain and the current data record context object.
[0012] In one embodiment, generating a data record information table based on the data record template corresponding to each data record node in the target path chain and the current data record context object includes:
[0013] Load the data record templates corresponding to the data record nodes according to the order of the data record nodes in the target path chain;
[0014] The key fields of each scenario determined based on the current data record context object are filled into the data record template to obtain the first record result of each data record node;
[0015] If each of the first record results passes the post-validation, a data record information table is generated based on each of the first record results that passes the post-validation.
[0016] In one embodiment, the method further includes:
[0017] If any of the first record results fails the post-validation, the inverse data record template corresponding to the data record node is loaded in reverse order of the data record nodes in the target path chain; wherein, the inverse data record template corresponds to the data record template;
[0018] The key fields of each scenario determined based on the current data record context object are filled into the inverse data record template to obtain the second record result of each data record node;
[0019] Based on each of the second record results, a data record information table is generated.
[0020] In one embodiment, the path template includes a set of scene matching conditions; the step of matching the current data record context object with each path template stored in the path template library to obtain the target path template includes:
[0021] Extract the context object of the current data record to obtain the key fields for each scenario;
[0022] Each of the aforementioned key fields of the scenario is matched with the scenario matching condition set of each path template stored in the path template library to obtain each candidate path template;
[0023] Determine the priority score of each candidate path template, and use the candidate path template with the highest priority score as the target path template.
[0024] In one embodiment, determining the priority score of each of the candidate path templates includes one of the following:
[0025] For each candidate path template, the number of scenarios in the scenario matching condition set that are exactly the same as the key fields of each scenario is obtained. Based on the number and the first score, the priority score of each candidate path template is determined. The first score is assigned and determined when the scenario matching condition in the scenario matching condition set is exactly the same as the key fields of the scenario.
[0026] For each candidate path template, the matching result of the scene key field with the scene matching condition in the scene matching condition set is obtained. Based on the matching result and the second score corresponding to the scene key field, the priority score of each candidate path template is determined; wherein, the matching result includes successful matching and failed matching.
[0027] Obtain the priority label carried by each candidate path template, and determine the priority score of each candidate path template based on the third score corresponding to the priority label.
[0028] In one embodiment, the branch determination result includes at least one of the following: jumping to the current data record node, whether the current data record node is executed, and inserting a data record node into the current data record node; adjusting the data record nodes in the initial path chain based on the branch determination result to obtain the target path chain includes at least one of the following:
[0029] When the branch determination result is that the current data record node jumps, the subsequent data record node of the current data record node in the initial path chain is replaced to obtain the target path chain;
[0030] When the branch determination result indicates that the current data record node is being executed, the initial path chain is determined as the target path chain;
[0031] When the branch determination result is that the current data record node is not executed, the current data record node is removed from the initial path chain to obtain the target path chain;
[0032] When the branch determination result is that the current data record node is to insert a new data record node, a new data record node is inserted at the position before or after the current data record node to obtain the target path chain.
[0033] Secondly, this application provides a data recording and processing apparatus, the apparatus comprising:
[0034] The retrieval module is used to retrieve the context object of the current data record;
[0035] The matching module is used to match the current data record context object with each path template stored in the path template library to obtain a target path template; the target path template includes an initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes;
[0036] The judgment module is used to execute branch judgment logic for each of the data record nodes and obtain the branch judgment result;
[0037] An adjustment module is used to adjust the data record nodes in the initial path chain based on the branch judgment result to obtain the target path chain;
[0038] The generation module is used to generate a data record information table based on the data record template corresponding to each data record node in the target path chain and the current data record context object.
[0039] In one embodiment, the generation module includes:
[0040] The loading unit is used to load the data record templates corresponding to the data record nodes in the target path chain according to the order of the data record nodes;
[0041] A filling unit is used to fill the data record template with the key fields of each scenario determined based on the current data record context object, so as to obtain the first record result of each data record node;
[0042] The generation unit is used to generate a data record information table based on each of the first record results that has passed the post-verification, provided that each of the first record results has passed the post-verification.
[0043] In one embodiment, the generation unit is further configured to: if any of the first recording results fails the post-validation, load the inverse data recording template corresponding to the data recording node in the reverse order of the data recording nodes in the target path chain; wherein the inverse data recording template corresponds to the data recording template; fill the inverse data recording template with the key fields of each scenario determined based on the current data recording context object to obtain the second recording result of each data recording node; and generate a data recording information table based on each second recording result.
[0044] In one embodiment, the path template includes a set of scene matching conditions; the matching module includes:
[0045] The extraction unit is used to extract the current data record context object to obtain key fields for each scenario;
[0046] The matching unit is used to match each of the aforementioned key fields with the set of scene matching conditions for each path template stored in the path template library to obtain each candidate path template.
[0047] The determining unit is used to determine the priority score of each candidate path template and to take the candidate path template with the highest priority score as the target path template.
[0048] In one embodiment, the determining unit is configured to, for each candidate path template, obtain the number of times the scene matching conditions in the scene matching condition set are exactly the same as each key field, and determine the priority score of each candidate path template based on the number and a first score; wherein, the first score is assigned and determined when the scene matching conditions in the scene matching condition set are exactly the same as the scene key fields.
[0049] It is also used to obtain, for each of the candidate path templates, the matching result of the scene key field with the scene matching condition in the scene matching condition set, and determine the priority score of each candidate path template based on the matching result and the second score corresponding to the scene key field; wherein, the matching result includes matching success and matching failure;
[0050] It is also used to obtain the priority label carried by each of the candidate path templates, and determine the priority score of each candidate path template based on the third score corresponding to the priority label.
[0051] In one embodiment, the branch determination result includes at least one of the following: jumping to the current data record node, whether the current data record node is executed, and inserting a data record node into the current data record node; the adjustment module further includes:
[0052] The replacement unit is used to replace the subsequent data record node of the current data record node in the initial path chain when the branch judgment result is a jump to the current data record node, so as to obtain the target path chain;
[0053] An execution unit is configured to determine the initial path chain as the target path chain when the branch determination result indicates that the current data record node is to be executed.
[0054] The removal unit is used to remove the current data record node from the initial path chain when the branch judgment result is that the current data record node is not executed, so as to obtain the target path chain;
[0055] An insertion unit is used to insert a new data record node at a position before or after the current data record node when the branch determination result is that the current data record node is to be inserted into a data record node, thereby obtaining the target path chain.
[0056] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.
[0057] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0058] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.
[0059] The aforementioned data recording processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product first obtain a target path template by matching the current data recording context object. This target path template maps to a dynamically configured initial path chain, which includes multiple record templates. Each record template can be maintained independently to adapt to different recording rules, improving flexibility. Second, branching, merging, and jumping within the initial path chain are implemented through branching logic, allowing the adjusted initial path chain to adapt to complex recording scenarios, further enhancing flexibility. Finally, a data recording information table is generated by dynamically adjusting the data recording template corresponding to each data recording node in the target path chain and the current data recording context object. This table can automatically adapt to new business processes and new recording rules without requiring adjustments to the code logic, further improving the flexibility of data recording. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1 This is an application environment diagram of a data recording and processing method in one embodiment;
[0062] Figure 2 This is a flowchart illustrating a data recording and processing method in one embodiment;
[0063] Figure 3 This is a flowchart illustrating the process of generating a data record information table in one embodiment;
[0064] Figure 4 This is a flowchart illustrating the process of generating a data record information table in another embodiment;
[0065] Figure 5 This is a flowchart illustrating the process of matching a target path template in one embodiment;
[0066] Figure 6 This is a flowchart illustrating the process of determining priority scores in one embodiment;
[0067] Figure 7 This is a flowchart illustrating the process of adjusting the initial path chain in one embodiment;
[0068] Figure 8 This is a structural block diagram of a data recording and processing device in one embodiment;
[0069] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. It should be noted that existing industry solutions such as software, components, and models may be mentioned in the embodiments of this application. These should be considered exemplary and are intended only to illustrate the feasibility of implementing the technical solutions of this application, but do not imply that the applicant has already used or necessarily used such solutions.
[0071] It should be noted that all data involved in this application (including but not limited to data used for analysis, stored data, and displayed data) are information and data that have been fully authorized by all parties, and the collection, use, and processing of such data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.
[0072] The terms "first," "second," etc., used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are used only to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0073] The data recording and processing method provided in this application embodiment can be applied to, for example, Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Server 104 obtains the current data record context object; matches the current data record context object with each path template stored in the path template library to obtain a target path template; the target path template includes an initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes; branch judgment logic is executed for each data record node to obtain a branch judgment result; the data record nodes in the initial path chain are adjusted based on the branch judgment result to obtain the target path chain; a data record information table is generated based on the data record template corresponding to each data record node in the target path chain and the current data record context object. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.
[0074] In one exemplary embodiment, such as Figure 2 As shown, a data recording and processing method is provided, which can be applied to... Figure 1 Taking the server in the example, the explanation includes the following steps 202 to 210. Wherein:
[0075] Step 202: Obtain the current data record context object.
[0076] The data record context object is a standardized resource interaction context object that encapsulates multidimensional factors that drive data recording. These multidimensional factors include, but are not limited to, product code, the contract identifier corresponding to the product code, data record type, transfer value, transfer direction, user type, and time.
[0077] Optionally, the server extracts the current data record context object from the contract, the original transfer value record information table, and the user information table involved in the current resource interaction.
[0078] Step 204: Match the current data record context object with each path template stored in the path template library to obtain the target path template; the target path template includes the initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes.
[0079] The path template library is a pre-defined data structure used to store path templates for various business scenarios. Each path template represents an accounting process under a product and scenario, including: a set of scenario matching conditions and an ordered list of data record nodes under that business scenario, which is also the initial path chain.
[0080] Optionally, the server matches the field values in the current data record context object with the path templates stored in the path template library. If a match is successful, the server determines the corresponding target path template and extracts the initial path chain from the target path template. The initial path chain includes multiple data record nodes in the business scenario.
[0081] Step 206: Execute the branch judgment logic for each data record node to obtain the branch judgment result.
[0082] The branch decision logic is defined on the data record nodes in the path chain. Before executing a data record node, it performs conditional judgments based on the current data record context object and current state to obtain the branch decision result: jump to a data record node in another path chain, skip the current data record node, insert a new data record node, merge the next node of the current data record node, and roll back the data record node. In other words, it's the logic set at the entry point of each data record node, i.e., the judgment logic before the data record node is executed, used to determine whether the current data record node has changed. The branch decision logic can be a rule pre-configured according to business requirements, or it can be a logic judgment called from an external rule engine, which then decides whether to execute the current data record node or jump based on the node returned by the external rule engine.
[0083] Optionally, the initial path chain includes multiple data record nodes in the business scenario, such as an initial path chain consisting of three chain data nodes A, B, and C (arranged in order). The server traverses data record nodes A, B, and C and performs branch judgment logic before execution to obtain the branch judgment result for each node.
[0084] In practical applications, each data record node on the initial path chain can embed a set of business judgment conditions and jump mechanisms, enabling the initial path chain to be dynamically adjusted during execution to adapt to complex business and compliance requirements.
[0085] Step 208: Adjust the data record nodes in the initial path chain based on the branch judgment results to obtain the target path chain.
[0086] Optionally, the server adjusts the data record nodes in the initial path chain based on the branch judgment result, performing operations such as jumping, execution, and insertion, to obtain the target path chain. Adjusting the initial path chain disrupts the linear execution of the path chain.
[0087] Step 210: Generate a data record information table based on the data record template corresponding to each data record node in the target path chain and the current data record context object.
[0088] Among them, a data record template refers to a predefined structured framework or format used to collect and store specific types of data in a standardized and consistent manner, including but not limited to the value of factor transfer, transfer direction, account type, contract identifier, and supplementary information fields.
[0089] The data record information table is a complete structured table, which includes a filled-in data record template; the filled-in data record template is a part of the data record information table.
[0090] Optionally, the server fills the data record template corresponding to each data record node in the target path chain with the information extracted from the current data record context object, so as to generate a data record information table based on the filled data record template.
[0091] In the above data recording processing method, firstly, a target path template is obtained by matching the current data record context object. The target path template maps to a dynamically configured initial path chain. The initial path chain includes multiple record templates. Path modeling and entry rules are decoupled and separated, facilitating their individual maintenance. Each record template can be maintained independently. In new scenarios, only a new path template is added, without modifying the original record templates, adapting to different scenario rules and improving flexibility. Secondly, branching, merging, and jumping of the initial path chain are implemented through branch judgment logic, allowing the adjusted initial path chain to adapt to complex recording scenarios, further improving flexibility. Finally, a data record information table is generated by dynamically adjusting the data record template corresponding to each data record node in the target path chain and the current data record context object. This table can automatically adapt to new business and new record rules without adjusting the code logic, further improving the flexibility of data recording.
[0092] In one exemplary embodiment, a data record information table is generated, such as... Figure 3 As shown, a data record information table is generated based on the data record template corresponding to each data record node in the target path chain and the current data record context object, including steps 302 to 306. Wherein:
[0093] Step 302: Load the data record templates corresponding to the data record nodes according to the order of the data record nodes in the target path chain.
[0094] Optionally, the server loads the data record template corresponding to the data record node according to the numbering order of the data record node in the target path chain. When loading the data record template corresponding to the data record node, the corresponding data record template can be retrieved from the data record template according to the identifier of the data record template.
[0095] Step 304: Fill the key fields of each scenario determined based on the current data record context object into the data record template to obtain the first record result of each data record node.
[0096] The first record result is the result after filling the data record template.
[0097] Optionally, the server, based on the numbering order of the data record nodes bound in the target path chain, fills each data record template with the scene key fields determined by the current data record context object, obtaining the first record result for each data record node. During the filling process, the server replaces the placeholders in the data record template with the scene key fields determined by the current data record context object. Furthermore, the filling process can call preprocessing functions to calculate or standardize the scene key fields.
[0098] Step 306: If each first record result passes the post-validation, generate a data record information table based on each first record result that passes the post-validation.
[0099] Post-verification is used to detect anomalies in the first record result. After execution, the data record nodes on the target path chain check whether certain business constraints or recording rules are met. Business constraints or recording rules include, but are not limited to, violations of recording rules, transfer value entering an illegal state (e.g., transfer value is negative), transfer value being empty, and account validity.
[0100] Optionally, the server only writes each first record result into the data record information table if the first record results of all data record nodes in the target path chain satisfy the post-validation. At this time, the data record information table records the first record results of all data record nodes in the target path chain after this execution.
[0101] In this embodiment, by loading data record templates sequentially based on the order in the target path chain, dynamically filling fields in conjunction with the data record context object, and with strict post-validation, it is ensured that the generated data record information table can completely and accurately reflect the first record result of the target path chain after this execution, thereby improving the automation and flexibility of the first record result generation and writing it into the data record information table to ensure traceability.
[0102] In one exemplary embodiment, a data record information table is generated, such as... Figure 4 As shown, the data recording and processing method further includes steps 402 to 406. Wherein:
[0103] Step 402: If any first record result fails the post-validation, load the inverse data record template corresponding to the data record node in the reverse order of the data record nodes in the target path chain.
[0104] The reverse data record template corresponds to the data record template and is used to reverse the cancellation operation of the first record result. The reverse data record template and the data record template have the same transferred value, the same account type, and the same contract identifier, but the value transfer direction is opposite.
[0105] Optionally, if any first record result fails the post-validation, indicating an anomaly in the first record result, the server enters rollback mode: The server can read the data record node identifiers sequentially from the end node forward, based on the position of the data record node corresponding to the first record result that failed the post-validation in the target path chain. For each data record node identifier, the server queries the data record template library for the corresponding inverse data record template. The server loads the corresponding inverse data record template to ensure that the rollback process is completely reversed from the original execution order, avoiding intermediate state imbalance.
[0106] Step 404: Fill the key fields of each scenario determined based on the current data record context object into the inverse data record template to obtain the second record result of each data record node.
[0107] Optionally, the server, following the reverse order of the data record nodes in the target path chain, fills the placeholder positions of each scenario-specific key field determined by the current data record context object into the reverse data record template, and records the timestamp of this operation and the associated data record template identifier. Each reverse data record template is instantiated as a second record result, structurally identical to the first record result, but with the value transfer direction reversed. Rollback operations performed through the reverse data record templates automatically roll back all preceding nodes without manual intervention, improving efficiency.
[0108] Step 406: Generate a data record information table based on the result of each second record.
[0109] Optionally, the server instantiates all the reverse data record templates and obtains a set of second record results arranged in reverse order. Each second record result is converted into a structured table row. The server determines the second record result based on the structured table rows. After execution, the impact of the target path chain is completely canceled out, and the state is rolled back to the baseline state before execution.
[0110] In this embodiment, when the first record result fails the post-validation, the reverse data record template is loaded in reverse order of the path chain, and combined with the original context object to form the second record result. Then, a unified data record information table is generated, enabling automated rollback of the path chain and record cancellation. On one hand, this ensures a rollback to the baseline state before execution, preventing the abnormal first record result from affecting the data record information table. On the other hand, it makes the rollback process configurable and easily extensible, significantly improving flexibility and efficiency in exception handling.
[0111] In one exemplary embodiment, a target path template is matched, such as Figure 5 As shown, the path template includes a set of scene matching conditions; the target path template is obtained by matching the current data record context object with each path template stored in the path template library, including steps 502 to 506. Wherein:
[0112] Step 502: Extract the context object of the current data record to obtain the key fields for each scenario.
[0113] Optionally, the current data record context object contains multiple records. The server extracts key fields of each initial scenario (including but not limited to product code, data record type, user type, etc.) one by one according to the record order of the current data record context object. The extracted key fields of each initial scenario are deduplicated to eliminate duplicate field combinations and reduce the amount of subsequent matching calculations. Finally, the deduplicated key fields of the scenario are formed.
[0114] Optionally, the server divides the current data record context object into multiple fragmented records based on its source, product number type, or time period. The server uses multiple extraction threads to independently and in parallel extract the initial scene key fields from these fragmented records, with one thread corresponding to each fragmented record. The server then outputs the initial scene key fields through these multiple threads, merges and removes duplicates to obtain the scene key fields.
[0115] Optionally, the server divides the fields included in the current data record context object into static fields and dynamic fields. The static fields are extracted to obtain the first scenario key fields; the dynamic fields are preprocessed using a calculation function to obtain the second scenario key fields. The server then merges the first and second scenario key fields to obtain the scenario key fields.
[0116] It should be noted that during the extraction process, some fields can be preprocessed, such as standardizing the mapping of fields with the same meaning in different systems, or assigning default values to missing fields, thereby improving the robustness of the matching.
[0117] Step 504: Match the key fields of each scenario with the scenario matching condition set of each path template stored in the path template library to obtain each candidate path template.
[0118] The path template includes a set of scene matching conditions and an initial path chain for that scene.
[0119] Optionally, the server matches the key fields of each scenario with the set of scenario matching conditions for each path template stored in the path template library using a first matching condition, to obtain at least one candidate path template. The first matching condition refers to "the scenario matching conditions in the set of scenario matching conditions are exactly the same as the key fields of each scenario".
[0120] Optionally, the server matches each scenario key field with the scenario matching condition set of each path template stored in the path template library using a second matching condition to obtain at least one candidate path template. The second matching condition refers to "the scenario matching condition in the scenario matching condition set is the same as part of the scenario key field".
[0121] Step 506: Determine the priority score of each candidate path template, and use the candidate path template with the highest priority score as the target path template.
[0122] Optionally, the server calculates the priority score of each candidate path template and selects the candidate path template with the highest priority score as the target path template based on the priority score of each candidate path template.
[0123] In this embodiment, by extracting key scene fields from the current data record context object and matching them with the scene matching condition set in the path template library, the flexibility and applicability of path template matching are improved by combining multiple matching mechanisms. At the same time, the accuracy and stability of dynamic path chain generation are improved, the need for manual intervention is reduced, and the processing efficiency is improved.
[0124] In one exemplary embodiment, a priority score is determined, such as Figure 6As shown, the priority score of each candidate path template is determined, including one of steps 602, 604, and 406, wherein:
[0125] Step 602: For each candidate path template, obtain the number of scenarios in the scenario matching condition set that are exactly the same as the key fields of each scenario. Based on the number and the first score, determine the priority score of each candidate path template.
[0126] The first score is determined when the scene matching condition is exactly the same as the scene key field in the scene matching condition set. If the scene matching condition is exactly the same as the scene key field, the score is x, where x is a positive integer. Otherwise, no score is awarded.
[0127] Optionally, the server selects the path template with the highest number of identical scene matching conditions and scene key fields as the target path template. For example, given two candidate path templates, if each scene key field has 4 identical fields after matching with the scene matching conditions in the first candidate path template, the first candidate path template has a first score of 4x. If each scene key field has 3 identical fields after matching with the scene matching conditions in the second candidate path template, the second candidate path template has a first score of 3x. The server selects the first candidate path template as the target path template.
[0128] Step 604: For each candidate path template, obtain the matching result of the scene key field with the scene matching condition in the scene matching condition set, and determine the priority score of each candidate path template based on the matching result and the second score corresponding to the scene key field.
[0129] The matching results include successful and unsuccessful matches. For example, there are 10 key fields for a scenario, each corresponding to a different score. A successful match is marked as 1, and an unsuccessful match is marked as 0.
[0130] Optionally, for each candidate path template, the server obtains the matching results of the scene key fields with the scene matching conditions in the scene matching condition set. For example, the scene matching conditions of the first candidate path template match three scene key fields successfully. The matching score is obtained by multiplying the matching result of each field by the corresponding field's second score, and all matching scores are accumulated to determine the priority score of each candidate path template. The server selects the candidate path template with the highest priority score as the target path template. For example, for two candidate path templates, the number of scenes with the scene matching conditions in the first candidate path template that are completely identical after matching is 4, and the second scores corresponding to these 4 scene keywords are 1, 2, 3, and 4, respectively. The number of scenes with the scene matching conditions in the second candidate path template that are completely identical after matching is 3, and the second scores corresponding to these 3 scene keywords are 7, 8, and 9, respectively. Therefore, the priority score of the second candidate path template is higher than that of the first candidate path template, so the second candidate path template is selected as the target path template.
[0131] Step 606: Obtain the priority label carried by each candidate path template, and determine the priority score of each candidate path template based on the third score corresponding to the priority label.
[0132] Optionally, the server obtains the priority label carried by each candidate path template. Each priority label corresponds to a third score, and the third score is used as the priority score. If there are two candidate path templates, the first candidate path template has a third score of x corresponding to its priority label, and its corresponding priority score is x. The second candidate path template has a third score of y corresponding to its priority label, and its corresponding priority score is y. Where x is greater than y, the server selects the first candidate path template as the target path template.
[0133] In this embodiment, multiple matching mechanisms (exact matching, fuzzy matching, and priority matching) are preset to ensure the accuracy of the target path template matching results.
[0134] In one exemplary embodiment, the initial path chain is adjusted as follows: Figure 7 As shown, the branch judgment result includes at least one of the following: jumping to the current data record node, whether the current data record node is executed, and inserting a data record node into the current data record node; based on the branch judgment result, the data record nodes in the initial path chain are adjusted to obtain the target path chain, including at least one of steps 702 to 708. Wherein:
[0135] Step 702: When the branch judgment result is that the current data record node jumps, the data record node after the current data record node in the initial path chain is replaced to obtain the target path chain.
[0136] Optionally, when the branch determination result indicates a jump to the current data record node, such as if the current data record node is path chain A, the jump can proceed to a specific data record node or an abnormal data record node on its path chain, such as B. The server locates the target data record node to jump to based on the branch jump rule table, and replaces the data record node following the target data record node in path chain B with the data record node following the current data record node in path chain A.
[0137] Step 704: When the branch judgment result is that the current data record node is executed, the initial path chain is determined as the target path chain.
[0138] Optionally, if the branch decision result indicates that the current data record node is to be executed, it means that the current data record node meets the business execution conditions and no structural adjustment is required. The initial path chain is retained, and the target path chain is completely consistent with the initial path chain.
[0139] Step 706: When the branch judgment result is that the current data record node is not executed, the current data record node is removed from the initial path chain to obtain the target path chain.
[0140] Optionally, when the branch judgment result indicates that the current data record node is not executed, it means that the business condition corresponding to the current data record node is not met, and skipping the node will not destroy the logical integrity of the path chain. At this time, the server disconnects the current data record node from the upstream and downstream data record nodes and removes the current data record node from the initial path chain. For example, if there is a data record node abc on path chain A, and the current data record node is a, it is not executed. The server removes the current data record node a. At this time, there is a data record node bc on path chain A, and the target path chain is obtained.
[0141] Step 708: When the branch judgment result is that the current data record node is to insert a new data record node, then insert a new data record node at the position before or after the current data record node to obtain the target path chain.
[0142] Optionally, when the branch decision result indicates that the current data record node should be inserted into a new data record node, the server creates a new data record node at a specified position based on the branch decision result and the insertion rule table. For example, if there is a data record node abc on path chain A, and the current data record node is a, the server creates a preceding data record node a' after a. At this point, there is a data record node aa'bc on path chain A, thus obtaining the target path chain. The specified position includes either the preceding or following position of the current data record node.
[0143] In this embodiment, by dynamically adjusting the structure of the initial path chain based on the branch judgment results, various structural changes such as path chain jumps, executions, skips, and insertions can be flexibly implemented. This allows the final target path chain to be dynamically optimized and reconstructed according to real-time business conditions. On the one hand, this improves the adaptability of the path chain to changes in complex business conditions, avoiding redundant calculations and delays caused by fixed processes. On the other hand, fine-grained adjustments at the node level can reduce the generation of invalid entries while maintaining the integrity of the accounting logic, improving execution efficiency and accuracy, thereby significantly enhancing the flexibility, scalability, and stability of the entire dynamic data recording and processing method.
[0144] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0145] Based on the same inventive concept, this application also provides a data recording and processing apparatus for implementing the data recording and processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data recording and processing apparatus embodiments provided below can be found in the limitations of the data recording and processing method described above, and will not be repeated here.
[0146] In one exemplary embodiment, such as Figure 8 As shown, a data recording and processing device is provided, including: an acquisition module 801, a matching module 802, a judgment module 803, an adjustment module 804, and a generation module 805, wherein:
[0147] The acquisition module 801 is used to obtain the current data record context object.
[0148] The matching module 802 is used to match the current data record context object with each path template stored in the path template library to obtain the target path template; the target path template includes the initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes.
[0149] The judgment module 803 is used to execute branch judgment logic for each data record node and obtain the branch judgment result.
[0150] The adjustment module 804 is used to adjust the data record nodes in the initial path chain based on the branch judgment result to obtain the target path chain.
[0151] The generation module 805 is used to generate a data record information table based on the data record template corresponding to each data record node in the target path chain and the current data record context object.
[0152] In one exemplary embodiment, the generation module 805 includes:
[0153] The loading unit is used to load the data record templates corresponding to the data record nodes in the target path chain according to their order.
[0154] The fill unit is used to fill the key fields of each scenario determined based on the current data record context object into the data record template to obtain the first record result of each data record node.
[0155] The generation unit is used to generate a data record information table based on each first record result that has passed the post-verification, provided that each first record result has passed the post-verification.
[0156] In an exemplary embodiment, the generation unit is further configured to: if any first record result fails the post-validation, load the inverse data record template corresponding to the data record node in the reverse order of the data record nodes in the target path chain; wherein the inverse data record template corresponds to the data record template; fill the inverse data record template with the key fields of each scenario determined based on the current data record context object to obtain the second record result of each data record node; and generate a data record information table based on each second record result.
[0157] In an exemplary embodiment, the path template includes a set of scene matching conditions; the matching module 802 includes:
[0158] The extraction unit is used to extract the context object of the current data record to obtain the key fields of each scenario.
[0159] The matching unit is used to match the key fields of each scenario with the scenario matching condition set of each path template stored in the path template library to obtain each candidate path template.
[0160] The determination unit is used to determine the priority score of each candidate path template, and the candidate path template with the highest priority score is used as the target path template.
[0161] In an exemplary embodiment, the determining unit is configured to, for each candidate path template, obtain the number of times the scene matching conditions in the scene matching condition set are exactly the same as each key field, and determine the priority score of each candidate path template based on the number and a first score; wherein, the first score is assigned and determined when the scene matching conditions in the scene matching condition set are exactly the same as the scene key fields.
[0162] It is also used to obtain the matching results of the scene key fields of the scene matching conditions in the scene matching condition set for each candidate path template, and determine the priority score of each candidate path template based on the matching results and the second score corresponding to the scene key fields; wherein, the matching results include matching success and matching failure.
[0163] It is also used to obtain the priority label carried by each candidate path template, and to determine the priority score of each candidate path template based on the third score corresponding to the priority label.
[0164] In an exemplary embodiment, the branch determination result includes at least one of the following: jumping to the current data record node, whether the current data record node is executed, and inserting a data record node at the current data record node; the adjustment module 804 further includes:
[0165] The replacement unit is used to replace the next data record node in the initial path chain when the branch judgment result is a jump to the current data record node, so as to obtain the target path chain.
[0166] The execution unit is used to determine the initial path chain as the target path chain when the branch judgment result is that the current data record node is to be executed.
[0167] The removal unit is used to remove the current data record node from the initial path chain when the branch judgment result is that the current data record node will not be executed, so as to obtain the target path chain.
[0168] The insertion unit is used to insert a new data record node at the position before or after the current data record node when the branch judgment result is that the current data record node should be inserted into a new data record node, thus obtaining the target path chain.
[0169] Each module in the aforementioned data recording and processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0170] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data records. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a data recording and processing method.
[0171] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0172] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0173] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0174] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0175] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, central processing units, artificial intelligence (AI) processors, etc., and are not limited to these.
[0176] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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, they should be considered to be within the scope of this application.
[0177] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data recording and processing method, characterized in that, The method includes: Get the context object of the current data record; The target path template is obtained by matching the current data record context object with the path templates stored in the path template library; the target path template includes an initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes; For each of the aforementioned data record nodes, branch judgment logic is executed to obtain the branch judgment result; Based on the branch determination result, the data record nodes in the initial path chain are adjusted to obtain the target path chain; A data record information table is generated based on the data record template corresponding to each data record node in the target path chain and the current data record context object.
2. The method according to claim 1, characterized in that, The step of generating a data record information table based on the data record template corresponding to each data record node in the target path chain and the current data record context object includes: Load the data record templates corresponding to the data record nodes according to the order of the data record nodes in the target path chain; The key fields of each scenario determined based on the current data record context object are filled into the data record template to obtain the first record result of each data record node; If each of the first record results passes the post-validation, a data record information table is generated based on each of the first record results that passes the post-validation.
3. The method according to claim 2, characterized in that, The method further includes: If any of the first record results fails the post-validation, the inverse data record template corresponding to the data record node is loaded in reverse order of the data record nodes in the target path chain; wherein, the inverse data record template corresponds to the data record template; The key fields of each scenario determined based on the current data record context object are filled into the inverse data record template to obtain the second record result of each data record node; Based on each of the second record results, a data record information table is generated.
4. The method according to claim 1, characterized in that, The path template includes a set of scene matching conditions; the process of matching the current data record context object with each path template stored in the path template library to obtain the target path template includes: Extract the context object of the current data record to obtain the key fields for each scenario; Each of the aforementioned key fields of the scenario is matched with the scenario matching condition set of each path template stored in the path template library to obtain each candidate path template; Determine the priority score of each candidate path template, and use the candidate path template with the highest priority score as the target path template.
5. The method according to claim 4, characterized in that, The determination of the priority score for each candidate path template includes one of the following: For each candidate path template, the number of scenarios in the scenario matching condition set that are exactly the same as the key fields of each scenario is obtained. Based on the number and the first score, the priority score of each candidate path template is determined. The first score is assigned and determined when the scenario matching condition in the scenario matching condition set is exactly the same as the key fields of the scenario. For each candidate path template, the matching result of the scene key field with the scene matching condition in the scene matching condition set is obtained. Based on the matching result and the second score corresponding to the scene key field, the priority score of each candidate path template is determined; wherein, the matching result includes successful matching and failed matching. Obtain the priority label carried by each candidate path template, and determine the priority score of each candidate path template based on the third score corresponding to the priority label.
6. The method according to claim 1, characterized in that, The branch determination result includes at least one of the following: jumping to the current data record node, whether the current data record node is executed, and inserting a data record node into the current data record node; adjusting the data record nodes in the initial path chain based on the branch determination result to obtain the target path chain includes at least one of the following: When the branch determination result is that the current data record node jumps, the subsequent data record node of the current data record node in the initial path chain is replaced to obtain the target path chain; When the branch determination result indicates that the current data record node is being executed, the initial path chain is determined as the target path chain; When the branch determination result is that the current data record node is not executed, the current data record node is removed from the initial path chain to obtain the target path chain; When the branch determination result is that the current data record node is to insert a new data record node, a new data record node is inserted at the position before or after the current data record node to obtain the target path chain.
7. A data recording and processing apparatus, characterized in that, The device includes: The retrieval module is used to retrieve the context object of the current data record; The matching module is used to match the current data record context object with each path template stored in the path template library to obtain a target path template; the target path template includes an initial path chain under the business scenario; the initial path chain is an ordered list representing data record nodes; The judgment module is used to execute branch judgment logic for each of the data record nodes and obtain the branch judgment result; An adjustment module is used to adjust the data record nodes in the initial path chain based on the branch judgment result to obtain the target path chain; The generation module is used to generate a data record information table based on the data record template corresponding to each data record node in the target path chain and the current data record context object.
8. The apparatus according to claim 7, characterized in that, The generation module includes: The loading unit is used to load the data record templates corresponding to the data record nodes in the target path chain according to the order of the data record nodes; A filling unit is used to fill the data record template with the key fields of each scenario determined based on the current data record context object, so as to obtain the first record result of each data record node; The generation unit is used to generate a data record information table based on each of the first record results that has passed the post-verification, provided that each of the first record results has passed the post-verification.
9. The apparatus according to claim 8, characterized in that, The generation unit is further configured to: if any of the first record results fails the post-validation, load the inverse data record template corresponding to the data record node in the reverse order of the data record nodes in the target path chain; wherein the inverse data record template corresponds to the data record template; fill the inverse data record template with the key fields of each scenario determined based on the current data record context object to obtain the second record result of each data record node; and generate a data record information table based on each second record result.
10. The apparatus according to claim 7, characterized in that, The path template includes a set of scene matching conditions; the matching module includes: The extraction unit is used to extract the current data record context object to obtain key fields for each scenario; The matching unit is used to match each of the aforementioned key fields with the set of scene matching conditions for each path template stored in the path template library to obtain each candidate path template. The determining unit is used to determine the priority score of each candidate path template and to take the candidate path template with the highest priority score as the target path template.
11. The apparatus according to claim 10, characterized in that, The determining unit is configured to, for each candidate path template, obtain the number of times the scene matching conditions in the scene matching condition set are exactly the same as the scene key fields, and determine the priority score of each candidate path template based on the number and a first score; wherein, the first score is assigned and determined when the scene matching conditions in the scene matching condition set are exactly the same as the scene key fields. It is also used to obtain, for each of the candidate path templates, the matching result of the scene key field with the scene matching condition in the scene matching condition set, and determine the priority score of each candidate path template based on the matching result and the second score corresponding to the scene key field; wherein, the matching result includes matching success and matching failure; It is also used to obtain the priority label carried by each of the candidate path templates, and determine the priority score of each candidate path template based on the third score corresponding to the priority label.
12. The apparatus according to claim 7, characterized in that, The branch determination result includes at least one of the following: jumping to the current data record node, whether the current data record node is executed, and inserting a data record node into the current data record node; The adjustment module further includes: The replacement unit is used to replace the subsequent data record node of the current data record node in the initial path chain when the branch judgment result is a jump to the current data record node, so as to obtain the target path chain; An execution unit is configured to determine the initial path chain as the target path chain when the branch determination result indicates that the current data record node is to be executed. The removal unit is used to remove the current data record node from the initial path chain when the branch judgment result is that the current data record node is not executed, so as to obtain the target path chain; An insertion unit is used to insert a new data record node at a position before or after the current data record node when the branch determination result is that the current data record node is to be inserted into a data record node, thereby obtaining the target path chain.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.