Carbon code pipeline storage method and carbon quota whole-process tracing method and device
By storing carbon coded business change information in the carbon coded channel list tree, the problem of difficulty in traceability of carbon quota throughout the process is solved, efficient storage and rapid query are achieved, and system performance is improved.
Patent Information
- Application Number
- CN202411955179.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
It is difficult for the existing technology to trace the carbon quota in the entire process, resulting in a large amount of carbon coded fragments stored, affecting the performance and stability of the main system.
The carbon encoding channel link list tree is used to store the carbon encoding change information generated by each carbon encoding service, and quickly store and query is achieved through dynamic allocation of memory space and insertion and deletion operations of linked lists.
It effectively solves the problem of full-process traceability of carbon quota, improves storage efficiency and query speed, and reduces the overhead of memory application and release.
Smart Images

Figure CN119884118A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a carbon coding flow storage method, a carbon quota full-process traceability method and a device. Background Art
[0002] The carbon emission rights code (hereinafter referred to as: carbon code) is a code that uniquely identifies each trading unit (ton) in the carbon emission rights trading market, similar to the unique asset code in the financial market. The main purpose of setting carbon codes is to ensure the security and legality of carbon trading data. Considering the rationality of data storage in the main system (carbon emission rights registration system and / or CCER registration system), it is impossible to store each ton of carbon quota separately. The actual data storage method used is to record the start code and end code to record the carbon code segment.
[0003] In the actual business process, due to business operations such as carbon allocation, fulfillment and trading, the carbon code will be continuously split into several code segments, or continuous code segments may be merged, which will generate a large amount of carbon coding business flow, that is, each allocation, fulfillment and transaction will generate flow data, resulting in more and more stored carbon code fragments, affecting the performance and stability of the main system, and it is more difficult to trace the carbon quota throughout the entire process. Summary of the invention
[0004] The present invention provides a carbon coding flow storage method, a carbon quota full-process traceability method and a device, which are used to solve the problem that it is difficult to trace the carbon quota throughout the entire process in the prior art.
[0005] The present invention provides a carbon-coded water flow storage method, comprising: Obtaining a carbon coding service message from the main system, the carbon coding service message including: information before the carbon coding change and information after the carbon coding change, the carbon coding information before the change including: the account number before the change, the start code and the end code of the carbon coding code segment before the change, the carbon coding information after the change including: the account number after the change, the start code and the end code of the carbon coding code segment after the change; Searching for a first storage node in the carbon coding pipeline linked list tree, the first storage node recording the account number before the change and the start code and end code of the carbon coding code segment before the change, wherein the carbon coding pipeline linked list tree is generated by initialization of the carbon allocation service; Based on the changed holding account number and the start code and end code of the changed carbon-coded code segment, a second storage node is created, the pointer of the first storage node is pointed to the second storage node, and the node ID of the first storage node is recorded in the second storage node to update the carbon-coded pipeline linked list tree.
[0006] A carbon-coded flow storage method provided by the present invention is characterized in that obtaining a carbon-coded service message of a main system includes: Real-time monitoring of carbon coding business events in the main system; When a carbon-coded service event is detected, a carbon-coded service message corresponding to the service event is added to a message queue.
[0007] A carbon-coded flow storage method provided by the present invention is characterized in that the data of the storage nodes in the carbon-coded flow linked list tree are stored in different flow data tables in the database according to the year of the carbon-coded code segment recorded by the storage node.
[0008] A carbon-coded flow storage method provided by the present invention is characterized in that, for the carbon-coded code segment of any year, when the number of corresponding storage nodes exceeds the data record threshold of the data table, multiple flow data tables are stored in sequence according to the node ID order of the storage nodes, and each flow data table corresponding to the any year is named with a string combination of the modulus result of the maximum node ID in each table using the string representing the year and the maximum data volume of a single flow data table.
[0009] A carbon-coded water flow storage method provided by the present invention is characterized in that each storage node in the carbon-coded water flow linked list tree also records its own level information in the carbon-coded water flow linked list tree.
[0010] The present invention also provides a carbon quota full-process traceability method, which is implemented based on a carbon-coded flow linked list tree obtained by the carbon-coded flow storage method described in any one of the above, and the carbon quota full-process traceability method includes: Receive the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, and query all target leaf storage nodes whose product label number is consistent with the target product label number and contains carbon codes within the start code and end code range of the code segment to be traced; In the carbon-coded pipeline linked list tree, carbon quota backtracking is performed starting from the target leaf storage node.
[0011] The present invention also provides a carbon-coded water flow storage device, comprising: A business message acquisition module, used to acquire the carbon coding business message of the main system, wherein the carbon coding business message includes: information before the carbon coding is changed and information after the carbon coding is changed, wherein the information before the carbon coding is changed includes: the account number before the change, the start code and the end code of the carbon coding code segment before the change, and the information after the carbon coding is changed includes: the account number after the change, the start code and the end code of the carbon coding code segment after the change; A storage node query module, used to find the first storage node in the carbon coding pipeline linked list tree, the first storage node records the account number before the change and the start code and end code of the carbon coding code segment before the change, wherein the carbon coding pipeline linked list tree is generated by initialization of the carbon allocation business; A linked list update module is used to create a second storage node based on the changed holding account number and the start code and end code of the changed carbon-coded code segment, point the pointer of the first storage node to the second storage node, and record the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
[0012] The present invention also provides a carbon quota full-process traceability device, which is implemented based on a carbon-coded flow chain tree obtained by the carbon-coded flow storage method described in any one of the above items, and the carbon quota full-process traceability device includes: A target node query module is used to receive the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, and query all target leaf storage nodes whose product label number is consistent with the target product label number and contains carbon codes within the start code and end code range of the code segment to be traced; The carbon quota backtracking module is used to perform carbon quota backtracking in the carbon coding pipeline linked list tree, taking the target leaf storage node as the starting point.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the program, it implements the carbon-coded flow storage method as described in any one of the above, or implements the carbon quota full-process traceability method as described in any one of the above.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it implements a carbon-coded flow storage method as described in any one of the above, or implements a carbon quota full-process traceability method as described in any one of the above.
[0015] The carbon-coded flow storage method, carbon quota full-process traceability method and device provided by the present invention utilize a carbon-coded flow linked list tree to store the carbon-coded change information generated by each carbon-coded business, that is, to store the carbon-coded flow. The storage nodes in the linked list can dynamically allocate memory space, avoiding the overhead of frequently applying for and releasing memory when storing a large amount of data. In addition, the linked list also has the advantage of convenient insertion and deletion operations, and nodes can be quickly added or deleted. In terms of query efficiency, the linked list can quickly locate the target data by directly accessing the node, and the lower-level storage nodes of the carbon-coded flow linked list tree all store the node ID of the upper-level storage node, which can quickly realize the full-process traceability of the carbon quota. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a schematic diagram of the process of the carbon-coded flow storage method provided by the present invention.
[0018] Figure 2 It is a schematic diagram of the carbon-coded flow linked list tree structure in the carbon-coded flow storage method provided by the present invention.
[0019] Figure 3 It is a schematic diagram of carbon code splitting after carbon quota trading in the carbon code flow storage method provided by the present invention.
[0020] Figure 4 It is a schematic diagram of carbon coding merging after carbon quota trading in the carbon coding flow storage method provided by the present invention.
[0021] Figure 5 It is a flow chart of the carbon quota full-process traceability method provided by the present invention.
[0022] Figure 6 It is a structural schematic diagram of the carbon-coded water flow storage device provided by the present invention.
[0023] Figure 7 It is a structural schematic diagram of the carbon quota full-process traceability device provided by the present invention.
[0024] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The carbon-coded flow storage method of the embodiment of the present invention is as follows: Figure 1 As shown, the following steps S110 to S130 are included.
[0027] Step S110: Obtain the carbon coding business message of the main system, the carbon coding business message includes: information before the carbon coding change and information after the carbon coding change, the carbon coding information before the change includes: the account number before the change, the start code and the end code of the carbon coding code segment before the change, the carbon coding information after the change includes: the account number after the change, the start code and the end code of the carbon coding code segment after the change.
[0028] Carbon coding business includes allocation, performance and trading, etc. Each business needs to be registered and processed in the main system. Therefore, each time a carbon coding business is processed in the main system, a corresponding carbon coding business message will be generated. The carbon coding business message records the relevant information of the carbon coding change, mainly including: information before the carbon coding change and information after the carbon coding change. The information before the carbon coding change includes: the account number before the change, the start code and end code of the carbon coding code segment before the change, and the information after the carbon coding change includes: the account number after the change, the start code and end code of the carbon coding code segment after the change. The details of the carbon coding business message are shown in Table 1 below.
[0029] Table 1 Carbon coding service message content
[0030] Among them, the product label number is a unique number for each carbon quota (for example: the carbon quota is 100 million tons, the starting code of the carbon code is 1, and the ending code is 100000000). Usually, each year corresponds to a product label number. No matter how many code segments the 100 million tons of carbon quota is subsequently split into, for each code segment's carbon code, the corresponding product label number is the unique number.
[0031] Step S120: Find the first storage node in the carbon coding flow chain tree, which records the account number before the change and the start code and end code of the carbon coding code segment before the change. The carbon coding flow chain tree is used to record the change information of the carbon coding after the carbon coding service, that is, the carbon coding flow. Figure 2 As shown in the figure, the carbon coding pipeline chain tree is generated by the initialization of the carbon allocation business. All carbon codes are allocated from the country to the province and then to the enterprise level by level. Eventually, the enterprise will get its own carbon coding code segment to form a tree-type chain structure. Each storage node in the carbon coding pipeline chain tree is a carbon coding pipeline. Correspondingly, the data of each storage node of the initialized carbon coding pipeline chain tree is stored as a row of data content in the pipeline data table of the corresponding database, and the node ID of each storage node is generated according to the order of the pipeline.
[0032] The data structure of the storage node of the carbon-coded pipeline linked list tree is shown in Table 2 below.
[0033] Table 2 Data structure of storage nodes of carbon-coded pipeline linked list tree
[0034] Since the information before the carbon coding change in the carbon coding business message reflects the operation object of this carbon coding business, in this step, it is necessary to find the first storage node in the carbon coding flow chain tree that stores the account number before the change and the start and end codes of the carbon coding code segment before the change, and generate a new storage node based on the first storage node according to the information after the carbon coding change to record the flow information generated by this carbon coding business. Specifically, the first storage node can be directly queried in the flow data table according to the product label number, the position account number, and the start and end codes of the carbon coding code segment before the change.
[0035] Step S130: Based on the changed holding account number and the start code and end code of the changed carbon-coded code segment, create a second storage node, point the pointer of the first storage node to the second storage node, and record the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
[0036] Specifically, an empty second storage node is generated, and the node ID of the second storage node can be generated according to the pipeline sequence, and the changed holding account and the start code and end code of the changed carbon coding code segment are written into the second storage node, and the node ID of the first storage node is recorded in the second storage node, so that the parent node can be found in the subsequent carbon coding traceability. Of course, the second storage node also includes other contents in Table 2 above, which can be obtained from the carbon coding service message.
[0037] For example, the business scenario is that user A needs to transfer 50 quotas to user B. User A holds the code segment PE-00000000001 to CN-01- PE-00000000100, that is, the carbon code segment of the carbon quota owned by user A is 1-100. Through calculation, the code segment PE-00000000001 to PE-0000000050 needs to be transferred to user B, and the code segment PE-00000000051 to PE-0000000100 needs to be transferred to user A.
[0038] like Figure 3As shown, the first storage node storing the code segment of user A from PE-00000000001 to PE-00000000100 is found in the carbon code pipeline linked list tree, that is, the upper storage node. Two second storage nodes, that is, two new lower storage nodes, are created. One second storage node stores the carbon code of user B from PE-00000000001 to PE-0000000050, and the other second storage node stores the carbon code of user A from PE-00000000051 to PE-0000000100. The pointer of the upper first storage node points to the two lower second storage nodes at the same time. It can be understood that: the first storage node has two pointers, which point to the two second storage nodes respectively, and the PID recorded in the two second storage nodes is the ID in the first storage node.
[0039] Another example: In the scenario of merging multiple consecutive upper-level storage nodes into a new lower-level storage node, user A originally held the carbon code from PE-0000000051 to PE-0000000100, and then re-assigned the carbon code from PE-00000000101 to PE-0000000200. Since these two code segments are consecutive, the main system needs to merge these two carbon code segments into one carbon code, so a carbon code service message for the merged carbon code will be generated. Figure 4 As shown, based on the carbon coding business message, the first storage node storing the carbon codes of PE-0000000051 to PE-0000000100 is found in the carbon coding pipeline linked list tree, and the first storage node storing the carbon codes of PE-00000000101 to PE-0000000200 is found, a new subordinate second storage node is created, the carbon codes of the two first storage nodes are merged and stored in the second storage node, and the pointers of the two first storage nodes of the upper level both point to the second storage node of the lower level, and two PIDs are stored in the second storage node, which are the IDs of the two first storage nodes of the upper level.
[0040] The carbon-coded flow storage method of this embodiment uses a carbon-coded flow linked list tree to store the carbon-coded change information generated by each carbon-coded business, that is, to store carbon-coded flow. The storage nodes in the linked list can dynamically allocate memory space, avoiding the overhead of frequently applying for and releasing memory when storing large amounts of data. In addition, the linked list also has the advantage of convenient insertion and deletion operations, and can quickly add or delete nodes. In terms of query efficiency, the linked list can quickly locate the target data by directly accessing the node, and the lower-level storage nodes of the carbon-coded flow linked list tree all store the node ID of the upper-level storage node, which can quickly realize the full process traceability of the carbon quota.
[0041] In some embodiments, the step S110 specifically includes: monitoring the carbon coding business events in the main system in real time; and when a carbon coding business event is monitored, adding a carbon coding business message corresponding to the business event to a message queue.
[0042] In this embodiment, by monitoring the carbon coding business events in the main system, the storage of carbon coding flow is realized in an event-driven manner, and the carbon coding business logic and data storage are decoupled, which can reduce the impact on the existing business logic in the main system and improve the scalability and maintainability of the main system. In addition, the carbon coding business messages are received and processed through the message queue, so that the asynchronous processing of carbon coding flow storage can be realized without blocking the business logic.
[0043] Since the data volume of carbon-coded flow is large and scattered, business processing will consume a lot of resources and a long time, and real-time performance is difficult to guarantee. At the same time, the logical complexity of business processing is greatly increased, and due to the data volume carrying limit of the current database middleware, a distributed database is used to divide the library and table to store the massive data of carbon-coded flow. Therefore, in some embodiments, the data of the storage nodes in the carbon-coded flow chain tree are stored in different flow data tables in the database according to the year of the carbon-coded code segment recorded by the storage node. Business relationships will occur for the targets of the same year, and business relationships will generally not occur for targets of different years. Therefore, the carbon quota product targets are distinguished by year and stored separately by year, effectively logically isolating the carbon-coded flow data of different years. When searching for the first storage node, the corresponding flow data table is quickly located according to the year corresponding to the product target number, and only the flow data table corresponding to the year is queried, thereby improving query efficiency.
[0044] Furthermore, for the carbon-coded code segment of any year, when the number of corresponding storage nodes exceeds the data record threshold of the flow data table, multiple flow data tables are stored in sequence according to the node ID order of the storage nodes, and each flow data table corresponding to the any year is named with a string combination of the result of taking the modulus of the maximum node ID in each table with the string representing the year and the maximum data volume of a single flow data table.
[0045] Specifically, in the sub-database strategy of carbon-coded flow record data, the product year and data volume are used as dimensions to divide the table. That is, the year data of different products can be stored in different flow data tables. When the records of a single table exceed 2×10 7 When a new table is created for storage, the maximum amount of data in a single flow data table is 2×10 7This can further reduce the amount of data in a single table and improve query efficiency. The specific implementation logic is to use prefix and modulus rules when naming the flow data table, that is, the table prefix _{product_year}_{maxId%(2×10 7 )}. In which, product_year indicates the product year, maxId indicates the maximum node ID value in the table, %(2×10 7 ) represents the value of 2×10 7 The result of taking the modulus can quickly locate the corresponding flow data table according to different product years and data volumes.
[0046] Furthermore, when the data volume of the carbon-coded flow is larger, the flow can be stored in separate databases according to the year of the carbon-coded code segment recorded by the storage node, and the flow in each database is stored in separate tables according to the year of the carbon-coded code segment recorded by the storage node.
[0047] In some embodiments, each storage node in the carbon-coded pipeline linked list tree also records its own level information in the carbon-coded pipeline linked list tree, that is, Table 2 also includes a field for level information, and the level information of each storage node is the maximum level value in its parent node + 1.
[0048] If the storage node does not record its own hierarchical information, when tracing the source, if there are N leaf storage nodes that meet the start code and end code range of the given code segment to be traced, each leaf storage node will trace the source to the starting node, and each starting node will be traced upward to form a tracing linked list. In the worst case, the number of starting point nodes is approximately equal to N, and the length of querying each linked list is approximately logN, then the query complexity of the data table in the database is O(NlogN).
[0049] After the storage node records its own hierarchical information, when tracing the source, if the start code and end code range of the given code segment to be traced has N nodes, each leaf storage node will trace the starting node. Since the hierarchical information is recorded, the maximum level of these starting nodes is calculated, and the data of the parent node of each level corresponding to the next storage node is queried in descending order. Then the query complexity of the data table in the database is (logN), which improves the query speed of the database during tracing the source.
[0050] In some embodiments, the carbon-coded pipeline storage method further includes: updating the carbon-coded attribution table in real time according to the leaf storage nodes in the carbon-coded pipeline linked list tree, wherein the carbon-coded attribution table is created based on the leaf storage nodes in the carbon-coded pipeline linked list tree and is used to record the data of the leaf storage nodes. The carbon-coded pipeline data table records the entire change information of the carbon code, and the amount of data is large, while the carbon-coded attribution table only records the data of the leaf storage nodes, which is convenient for subsequent tracing. According to the code segment to be traced, the data of each leaf storage node containing each carbon code in the code segment to be traced can be more quickly queried, that is, each leaf storage node is quickly located, and then each leaf storage node traces back upward in the carbon-coded pipeline linked list tree until the root node, thereby obtaining the tracing result. For example: Figure 3 As shown, assuming Figure 3 The storage node (0001-0050) is split into two leaf storage nodes (0001-0020) and (0021-0050). The code segment to be traced is the carbon code of 0040-0060. The data of all leaf storage nodes containing the code segment to be traced (i.e. 0040-0060) can be quickly found through the carbon code attribution table. The data corresponding to the leaf storage nodes (0021-0050) and (0051-0100) only need to be queried in the carbon code attribution table containing three leaf storage nodes, instead of in the flow data table containing six storage nodes, which improves the query efficiency.
[0051] The present invention also provides a carbon quota full-process traceability method, which is implemented based on the carbon coding flow chain tree obtained by the above-mentioned carbon coding flow storage method, such as Figure 5 As shown, the carbon quota full-process traceability method includes steps S510 to S520.
[0052] Step S510: Receive the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, and query all target leaf storage nodes of the carbon code whose product label number is consistent with the target product label number and contains the start code and end code of the code segment to be traced. Specifically, the target leaf storage node can be queried more quickly in the above carbon code attribution table.
[0053] Step S520: Tracing the carbon quota in the carbon-coded pipeline linked list tree based on the target leaf storage node.
[0054] The carbon quota full-process traceability method of this embodiment is implemented based on the carbon-coded pipeline linked list tree obtained by the above-mentioned carbon-coded pipeline storage method, so that the carbon quota full-process traceability can be quickly achieved.
[0055] In the carbon quota full-process traceability method of this embodiment, the lower-level storage nodes of the carbon-coded pipeline linked list tree all store the node ID of the upper-level storage node, which can quickly realize the carbon quota full-process traceability.
[0056] The carbon-coded flow water storage device provided by the present invention is described below. The carbon-coded flow water storage device described below and the carbon-coded flow water storage method described above can be referenced to each other.
[0057] The carbon-coded flow storage device provided in the embodiment of the present invention is as follows: Figure 6 As shown, including: The business message acquisition module 610 is used to obtain the carbon coding business message of the main system, and the carbon coding business message includes: information before the carbon coding change and information after the carbon coding change. The carbon coding information before the change includes: the account number before the change, the start code and the end code of the carbon coding code segment before the change. The carbon coding information after the change includes: the account number after the change, and the start code and the end code of the carbon coding code segment after the change.
[0058] The storage node query module 620 is used to find the first storage node in the carbon coding pipeline linked list tree, the first storage node records the account number before the change and the start code and end code of the carbon coding code segment before the change, wherein the carbon coding pipeline linked list tree is generated by initialization of the carbon allocation service.
[0059] The linked list update module 630 is used to create a second storage node based on the changed holding account number and the start code and end code of the changed carbon-coded code segment, point the pointer of the first storage node to the second storage node, and record the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
[0060] In some embodiments, the business message acquisition module 610 is specifically used to monitor the carbon-coded business events in the main system in real time; when a carbon-coded business event is monitored, the carbon-coded business message corresponding to the business event is added to the message queue.
[0061] In some embodiments, the data of the storage nodes in the carbon-coded pipeline linked list tree are stored in different pipeline data tables in the database according to the year of the carbon-coded code segment recorded by the storage node.
[0062] In some embodiments, for the carbon-coded code segments of any year, when the number of corresponding storage nodes exceeds the data record threshold of the data table, multiple flow data tables are stored in sequence according to the node ID order of the storage nodes, and each flow data table corresponding to any year is named with a string representing the year and a string combination of the modulus result of the maximum node ID in each table with the maximum data volume of a single flow data table.
[0063] In some embodiments, each storage node in the carbon-coded pipeline linked list tree also records its own level information in the carbon-coded pipeline linked list tree.
[0064] The carbon quota full-process traceability device provided by the present invention is described below. The carbon quota full-process traceability device described below and the carbon quota full-process traceability method described above can be referenced to each other.
[0065] The carbon quota full-process traceability device provided in the embodiment of the present invention is implemented based on the carbon-coded flow chain tree obtained by the above-mentioned carbon-coded flow storage method. The carbon quota full-process traceability device is as follows: Figure 7 As shown, including: The target node query module 710 is used to receive the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, and query the product label number that is consistent with the target product label number and contains all target leaf storage nodes with carbon codes within the start code and end code range of the code segment to be traced.
[0066] The carbon quota backtracking module 720 is used to perform carbon quota backtracking in the carbon coding pipeline linked list tree, taking the target leaf storage node as the starting point.
[0067] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8 As shown, the electronic device may include: a processor (processor) 810, a communication interface (Communications Interface) 820, a memory (memory) 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call the logic instructions in the memory 830 to execute the carbon-coded pipeline storage method, which includes: obtaining the carbon-coded business message of the main system, the carbon-coded business message includes: carbon-coded information before change and carbon-coded information after change, the carbon-coded information before change includes: the account number before change, the start code and the end code of the carbon-coded code segment before change, the carbon-coded information after change includes: the account number after change, the start code and the end code of the carbon-coded code segment after change; searching for the first storage node in the carbon-coded pipeline linked list tree, the first storage node records the account number before change and the start code and the end code of the carbon-coded code segment before change; based on the account number after change and the start code and the end code of the carbon-coded code segment after change, creating a second storage node, pointing the pointer of the first storage node to the second storage node, and recording the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
[0068] Alternatively, a carbon quota full-process traceability method is executed, which is implemented based on the carbon-coded pipeline linked list tree obtained by the carbon-coded pipeline storage method described in any of the above items. The carbon quota full-process traceability method includes: receiving the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, querying all target leaf storage nodes of the carbon code whose product label number is consistent with the target product label number and contains the start code and end code of the code segment to be traced; in the carbon-coded pipeline linked list tree, carbon quota backtracking is performed with the target leaf storage node as the starting point.
[0069] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0070] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the carbon-coded pipeline storage method provided by the above methods, the method including: obtaining a carbon-coded business message of the main system, the carbon-coded business message including: carbon-coded information before change and carbon-coded information after change, the carbon-coded information before change including: the account number before change, the start code and end code of the carbon-coded code segment before change, the carbon-coded information after change including: the account number after change, the start code and end code of the carbon-coded code segment after change; searching for a first storage node in a carbon-coded pipeline linked list tree, the first storage node records the account number before change and the start code and end code of the carbon-coded code segment before change; based on the account number after change and the start code and end code of the carbon-coded code segment after change, creating a second storage node, pointing the pointer of the first storage node to the second storage node, and recording the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
[0071] Alternatively, a carbon quota full-process traceability method is executed, which is implemented based on the carbon-coded pipeline linked list tree obtained by the carbon-coded pipeline storage method described in any of the above items. The carbon quota full-process traceability method includes: receiving the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, querying all target leaf storage nodes of the carbon code whose product label number is consistent with the target product label number and contains the start code and end code of the code segment to be traced; in the carbon-coded pipeline linked list tree, carbon quota backtracking is performed with the target leaf storage node as the starting point.
[0072] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the carbon-coded pipeline storage method provided by the above-mentioned methods, the method comprising: obtaining a carbon-coded business message of a main system, the carbon-coded business message comprising: information before the carbon-coded change and information after the carbon-coded change, the carbon-coded information before the change comprising: an account number held before the change, a start code and an end code of a carbon-coded code segment before the change, the carbon-coded information after the change comprising: an account number held after the change, a start code and an end code of a carbon-coded code segment after the change; searching for a first storage node in a carbon-coded pipeline linked list tree, the first storage node recording the account number held before the change and the start code and the end code of a carbon-coded code segment before the change; creating a second storage node based on the account number held after the change and the start code and the end code of a carbon-coded code segment after the change, pointing the pointer of the first storage node to the second storage node, and recording the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
[0073] Alternatively, a carbon quota full-process traceability method is executed, which is implemented based on the carbon-coded pipeline linked list tree obtained by the carbon-coded pipeline storage method described in any of the above items. The carbon quota full-process traceability method includes: receiving the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, querying all target leaf storage nodes of the carbon code whose product label number is consistent with the target product label number and contains the start code and end code of the code segment to be traced; in the carbon-coded pipeline linked list tree, carbon quota backtracking is performed with the target leaf storage node as the starting point.
[0074] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0075] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art 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 ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A carbon-coded water flow storage method, characterized in that: include: Obtaining a carbon coding service message from the main system, the carbon coding service message including: information before the carbon coding change and information after the carbon coding change, the carbon coding information before the change including: the account number before the change, the start code and the end code of the carbon coding code segment before the change, the carbon coding information after the change including: the account number after the change, the start code and the end code of the carbon coding code segment after the change; Searching for a first storage node in the carbon coding pipeline linked list tree, the first storage node recording the account number before the change and the start code and end code of the carbon coding code segment before the change, wherein the carbon coding pipeline linked list tree is generated by initialization of the carbon allocation service; Based on the changed holding account number and the start code and end code of the changed carbon-coded code segment, a second storage node is created, the pointer of the first storage node is pointed to the second storage node, and the node ID of the first storage node is recorded in the second storage node to update the carbon-coded pipeline linked list tree.
2. The carbon-coded flow storage method according to claim 1, characterized in that: Obtain carbon-coded business messages from the main system, including: Real-time monitoring of carbon coding business events in the main system; When a carbon-coded service event is detected, a carbon-coded service message corresponding to the service event is added to a message queue.
3. The carbon-coded flow storage method according to claim 1, characterized in that: The data of the storage nodes in the carbon-coded flow chain tree are stored in different flow data tables in the database according to the year of the carbon-coded code segment recorded by the storage node.
4. The carbon-coded flow storage method according to claim 3, characterized in that: For the carbon-coded code segment of any year, if the number of corresponding storage nodes exceeds the data record threshold of the data table, multiple flow data tables are stored in sequence according to the node ID order of the storage nodes, and each flow data table corresponding to any year is named with a string combination of the modulus result of the maximum node ID in each table using the string representing the year and the maximum data volume of a single flow data table.
5. The carbon-coded flow storage method according to any one of claims 1 to 4, characterized in that: Each storage node in the carbon-coded pipeline linked list tree also records its own level information in the carbon-coded pipeline linked list tree.
6. A carbon quota full-process traceability method, characterized in that: Based on the carbon-coded flow chain tree obtained by the carbon-coded flow storage method according to any one of claims 1 to 5, the carbon quota full-process traceability method includes: Receive the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, and query all target leaf storage nodes whose product label number is consistent with the target product label number and contains carbon codes within the start code and end code range of the code segment to be traced; In the carbon-coded pipeline linked list tree, carbon quota backtracking is performed starting from the target leaf storage node.
7. A carbon-coded water flow storage device, characterized in that: include: A business message acquisition module, used to acquire the carbon coding business message of the main system, wherein the carbon coding business message includes: information before the carbon coding is changed and information after the carbon coding is changed, wherein the information before the carbon coding is changed includes: the account number before the change, the start code and the end code of the carbon coding code segment before the change, and the information after the carbon coding is changed includes: the account number after the change, the start code and the end code of the carbon coding code segment after the change; A storage node query module, used to find the first storage node in the carbon coding pipeline linked list tree, the first storage node records the account number before the change and the start code and end code of the carbon coding code segment before the change, wherein the carbon coding pipeline linked list tree is generated by initialization of the carbon allocation business; A linked list update module is used to create a second storage node based on the changed holding account number and the start code and end code of the changed carbon-coded code segment, point the pointer of the first storage node to the second storage node, and record the node ID of the first storage node in the second storage node to update the carbon-coded pipeline linked list tree.
8. A carbon quota full-process traceability device, characterized in that: Based on the carbon-coded flow chain tree obtained by the carbon-coded flow storage method according to any one of claims 1 to 5, the carbon quota full-process traceability device comprises: A target node query module is used to receive the target product label number of the code segment to be traced and the start code and end code of the code segment to be traced, and query all target leaf storage nodes whose product label number is consistent with the target product label number and contains carbon codes within the start code and end code range of the code segment to be traced; The carbon quota backtracking module is used to perform carbon quota backtracking in the carbon coding pipeline linked list tree, taking the target leaf storage node as the starting point.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, it implements the carbon-coded flow storage method as described in any one of claims 1 to 5, or implements the carbon quota full-process traceability method as described in claim 6.
10. A non-transitory 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 carbon-coded flow storage method as described in any one of claims 1 to 5, or implements the carbon quota full-process traceability method as described in claim 6.