Bulk cargo shipping global data platform data processing method and system
By using difference set calculation and physical composite primary key construction, combined with pre-defined pipeline diversion and pre-aggregation, the problem of data divergence and expansion in the bulk shipping full-domain data platform is solved, achieving efficient data processing and second-level response.
Patent Information
- Application Number
- CN202611652636.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-23
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, the data platform for bulk shipping is incompatible with the business accounting dimensions under multiple leases due to the granularity of record division, resulting in data divergence and expansion, causing excessive database computing load and high-concurrency query response delays.
By identifying and marking deleted records through difference calculation, a physical composite primary key is constructed. Combined with a pre-defined pipeline-based pre-aggregation, data bloat during multi-table joins is eliminated, and pre-aggregation calculation is implemented at the data model layer.
It reduces the computational load on the database, shortens the response latency for high-concurrency metric queries, and improves the throughput and high availability of the data platform.
Smart Images

Figure CN123178406A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of enterprise data governance and data platform technology, and in particular to a data processing method and system for a bulk shipping full-domain data platform. Background Technology
[0002] With the deepening of the digital transformation of shipping logistics and supply chains, the daily operations of bulk shipping companies involve massive amounts of shipping operation data interaction characterized by high mobility, long links, and multi-entity collaboration. To achieve centralized operational analysis of shipping business, companies need to build a comprehensive data platform to aggregate, synchronize, and model business data distributed across multiple heterogeneous business systems such as vessel navigation scheduling, freight forwarding collaboration, and business operations, in order to provide unified voyage benefit analysis and indicator services to upper-level application systems.
[0003] In related technologies, during the data model layer construction phase, the data platform generally follows general entity modeling specifications, configuring a single voyage number as the primary key for each voyage record, and storing specific business methods such as chartering or freight as ordinary attribute fields within the record row. In the upper-layer benefit indicator analysis phase, the data platform relies on complex SQL query statements with a large number of nested conditional statements (such as CASE WHEN logic) written at the application layer. During runtime, it dynamically reads the values of the business method attributes in the data records and branches and associates different cost allocation tables and revenue detail tables in real time in the database memory to complete the final benefit indicator conversion.
[0004] However, with the increasing complexity of shipping business models, bulk shipping often involves complex operations where the same vessel is chartered and subleased multiple times within a single voyage. Under this new demand, the data platform of the relevant technology relies only on a single voyage number as the primary key, placing the business method as a general attribute. This results in the granularity of the record division of the underlying data table being incompatible with the business accounting dimensions under multiple charter contracts. This easily leads to data divergence and expansion in the form of one-to-many or even many-to-many relationships when detailed records containing different charter contracts are joined in multiple tables. This data divergence at the underlying structure forces the data platform to issue extremely complex dynamic multi-layered nested judgment statements to the database engine every time it responds to upper-level benefit aggregation calculation requests. It performs costly Cartesian product joins and real-time dynamic filtering in computing memory, causing the execution plan tree generated by the database query optimizer to expand rapidly and the memory hash join table to frequently overflow into the disk swap area. This causes a sharp increase in the computing load of the underlying database of the data platform, resulting in data processing congestion and severe delays in computing response under high-concurrency query scenarios. Summary of the Invention
[0005] This application provides a data processing method and system for a bulk shipping global data platform, which addresses the problem of data divergence and expansion caused by the incompatibility between the record division granularity and the business accounting dimensions under multiple leases in related technologies, resulting in excessive database computing load and severe response delays during upper-level benefit aggregation calculations.
[0006] Firstly, this application provides a data processing method for a bulk shipping global data platform, the method comprising:
[0007] The first record primary key set of the source database and the second record primary key set of the target database are used to perform a difference calculation to obtain the primary key set of deleted records. The target record primary key of the primary key set of deleted records exists only in the target database and does not exist in the source database.
[0008] Based on the set of primary keys for deleted records, a deletion identifier is marked for each primary key of the target record in the target data table, and a corresponding lifecycle threshold is set to obtain an incremental data table carrying the deletion identifier;
[0009] Remove invalid records from the incremental data table whose retention time has exceeded the lifecycle threshold, and extract valid business data records without the deletion identifier from the removed incremental data table to obtain a basic detailed data table.
[0010] Multiple target data statistical dimension fields are extracted from the basic detailed data table and combined and reconstructed to obtain a physical composite primary key. A thematic data model table is then constructed based on the physical composite primary key. The record storage granularity of the thematic data model table is aligned with the data statistical dimension under the value of a single target business identifier field. The target data statistical dimension fields include a mode identifier field used to identify the voyage operation mode and a business identifier field to distinguish different business contracts.
[0011] Based on the value of the pattern identifier field in the topic data model table, the preset data calculation pipeline branches corresponding to different voyage operation modes are called to perform pre-aggregation calculations on the corresponding data records, generating an application data table with a pre-aggregated indicator structure in the data platform.
[0012] By adopting the above technical solutions, the system, while ensuring the purity of detailed data by performing soft deletion filtering of source-end failure records, reconstructs the physical composite primary key containing the pattern and business identifier. This allows the underlying storage granularity to be precisely aligned from coarse-grained voyages to single business contracts, eliminating the data bloat caused by many-to-many Cartesian product in multi-table joins. Furthermore, by pre-setting the pipeline for pre-aggregation and diversion, the dynamic nested branch calculations that were originally high-overhead during the upper-level query period are shifted to the data model construction period, reducing the instantaneous computing load of the database and shortening the response latency of high-concurrency index queries.
[0013] In some embodiments, the step of extracting multiple target data statistical dimension fields from the basic detailed data table, combining and reconstructing them to obtain a physical composite primary key, and constructing a subject data model table based on the physical composite primary key specifically includes:
[0014] In response to the fact that the value of the mode identifier field belongs to the preset time charter operation mode, the vessel identifier field, voyage identifier field, operating entity identifier field, mode identifier field and charter contract identifier field are extracted and combined and reconstructed to obtain the physical composite primary key. The charter contract identifier field is a business identifier field used to identify a single charter vessel contract.
[0015] Based on the physical composite primary key, multiple charter records under the same vessel identifier, voyage identifier, operating entity identifier, and voyage operating mode in the basic detailed data table are distinguished according to the charter contract identifier field, resulting in a thematic data model table whose record storage granularity is aligned with the data statistical dimensions under a single charter contract.
[0016] By adopting the above technical solution, the system extracts the combination of vessel, voyage, operating entity, mode, and charter contract identifiers to reconstruct the physical composite primary key in the time charter scenario. This enables the physical line record of the same vessel involved in multiple charter contracts within a single voyage cycle to have a unique and deterministic identifier at the contract level. It realizes the isolated and discretized mapping of each time charter record at the underlying physical storage level, reduces the risk of cross-divergence of multiple charter data under the same voyage during subsequent processing and calculation from the perspective of physical storage, and ensures the independence and clarity of the accounting boundary of charter business indicators.
[0017] In some embodiments, the step of calling preset data calculation pipeline branches corresponding to different voyage operation modes to perform pre-aggregation calculations on the corresponding data records and generating an application data table with a pre-aggregated indicator structure in the data platform specifically includes:
[0018] In response to the fact that the value of the mode identifier field belongs to the preset lease-type business mode, the numerical calculation operator built into the first data calculation pipeline branch is called to calculate the value of the daily rent field and the value of the lease term in days of the corresponding data record, and the pre-aggregation index of lease income is determined based on the calculation results.
[0019] In response to the fact that the value of the mode identifier field belongs to the preset time charter operation mode, the built-in numerical calculation operator of the second data calculation pipeline branch is called to calculate the value of the freight summary field and the voyage cost summary field of the corresponding data record, and the equivalent time charter pre-aggregation index is determined based on the calculation results.
[0020] Write the pre-aggregated term rental income index and the pre-aggregated equivalent term rental index into the application data table according to the physical composite primary key to obtain the application data table with the pre-aggregated index structure.
[0021] By adopting the above technical solution, the system addresses the differences in the mode identifiers of time charter and voyage charter by using a dedicated first branch (calculating the daily rental rate multiplied by the charter period) and a second branch (summarizing and converting freight and costs) for parallel processing. The system directly materializes these differences into a wide table structure based on the composite primary key, achieving physical-level decoupling of different operational accounting logics in the underlying computing engine. Upper-layer applications no longer need to dynamically associate detailed tables through complex conditional statements during runtime; they can directly read readily available benefit indicators, significantly improving the throughput of report aggregation queries.
[0022] In some embodiments, the step of performing a difference calculation between the first set of primary key records in the source database and the second set of primary key records in the target database to obtain the set of primary key records to be deleted specifically includes:
[0023] Extract primary keys of records from the source database and the target database in a preset batch, and perform the difference calculation in batches to obtain a subset of primary keys of deleted records for each batch.
[0024] If the difference calculation task in any batch fails, the failed batch will be automatically retried in the breakpoint resume mode until the preset maximum number of retries is reached, and the primary key subsets of the deleted records in each batch will be summarized to obtain the primary key set of the deleted records.
[0025] By adopting the above technical solutions, the system extracts primary keys in batches for difference calculation and introduces a breakpoint resume fault tolerance mechanism into the primary key comparison task, which controls the peak instantaneous memory resource usage during memory comparison of massive primary key sets. At the same time, it supports partial retries without rolling back the full synchronization task when encountering single-batch network fluctuations or computational jitter, which reduces the cluster resource consumption in the incremental comparison stage of massive data and improves the high availability and robustness of the underlying data synchronization link of the middle platform.
[0026] In some embodiments, the method further includes:
[0027] When performing the next round of incremental comparison task on the source database and the target database table, before the difference calculation is performed, data records in the incremental data table that have not been retained for a longer period than the lifecycle threshold and carry the deletion identifier are excluded from the second record primary key set to obtain the second record primary key set that skips the marked records.
[0028] According to the preset cleanup task and the set cleanup cycle, physical deletion is performed on the records in the incremental data table that have been retained for a longer period than the lifecycle threshold and carry the deletion identifier, so as to obtain the incremental data table after removing the invalid records.
[0029] By adopting the above technical solution, the system first excludes primary keys with deletion markers within the lifecycle threshold before difference calculation, and periodically performs physical clearing in the background, avoiding invalid duplicate difference comparison calculations for the same batch of soft-deleted records in a short period of time, reducing the useless load on the comparison engine; at the same time, through the dual-track soft deletion buffer and asynchronous physical removal mechanism, the real-time overhead of incremental data synchronization and the efficiency of underlying storage space reclamation are balanced.
[0030] In some embodiments, the method further includes:
[0031] Extract the associated contract identifier of each data record from the basic detailed data table, and link multiple records pointing to the same physical flight segment into a lease chain based on the associated contract identifier. The associated contract identifier is used to point to the previous business contract leased by the current business contract on the lease-in side in the lease chain.
[0032] Generate a shared lease chain association key for each data record on the lease chain, and assign a hierarchical number to distinguish the upstream record from the downstream record according to the order of lease in and lease out, and write it into the subject data model table;
[0033] According to the preset allocation coefficient, the shared cost measurement of the physical flight segment jointly borne by multiple business contracts is split and included in the cost measurement column corresponding to the business identifier field of each record, so as to obtain the cost allocation details that are not repeated among the cost measurement columns corresponding to each business identifier field.
[0034] When calling the data calculation pipeline branch corresponding to the sublease operation mode, the data is grouped according to the lease chain association key, and the sum of the income measurement of the downstream record is subtracted from the sum of the cost measurement of the upstream record within the group. The sublease net income pre-aggregation index in the application data table is obtained by single group aggregation.
[0035] By adopting the above technical solution, the system assembles discrete records into a lease chain with topological order based on the associated contract identifier and accurately splits the shared cost. This reduces the originally extremely cumbersome sublease benefit calculation process involving multiple layers of contracts and multiple nested queries to a simple arithmetic aggregation operation of the initial revenue and initial cost based on a single grouping under the lease chain association key. This greatly reduces the computational graph complexity of the database engine when processing sublease chains and achieves efficient second-level output of benefit indicators for complex multi-layer sublease links.
[0036] In some embodiments, the method further includes:
[0037] The set of primary keys for newly added and modified records in the source database relative to the target database table is extracted in the difference calculation, and then merged with the set of primary keys for deleted records to obtain the set of modified primary keys;
[0038] For the business identifier field and the corresponding lease chain association key to which the changed primary key set belongs, locate the corresponding historical aggregation record in the application data table, and deduct the corresponding old contribution value from the pre-aggregation index of the historical aggregation record using a reversible aggregation operator to obtain the intermediate pre-aggregation index. The reversible aggregation operator is a summation or counting aggregation operator that supports inverse operation. The old contribution value is read from the snapshot of the record before the change or the contribution value cached when it was last written.
[0039] The new contribution value obtained by the data calculation pipeline branch based on the changed record is accumulated to the intermediate pre-aggregation index, and the result is written back to the application data table with the physical composite primary key as the anchor point. The change point and index version level of this batch are registered simultaneously to obtain the incrementally updated application data table without full recalculation.
[0040] By adopting the above technical solution, the system combines the reversible aggregation operator with the primary key change capture mechanism. When a local incremental update occurs in the business data, it is only necessary to deduct the historical indicator contribution value in reverse for the business to which the changed primary key belongs and add the new value in forward. There is no need to perform a costly full recalculation on the global application data table. This greatly saves the computing resource overhead of the middle platform when facing high-frequency business changes and realizes near real-time materialization refresh of pre-aggregated application indicators with lightweight computing consumption.
[0041] Secondly, this application provides a data processing system for a bulk shipping global data platform, the system comprising: one or more processors and a memory;
[0042] The memory is coupled to the one or more processors. The memory is used to store computer program code, which includes computer instructions. The one or more processors call the computer instructions so that the system can implement the data processing method of the bulk shipping global data platform provided in the above embodiments, which will not be described in detail here.
[0043] Thirdly, this application provides a computer-readable storage medium including instructions that, when executed on the data processing system of the bulk shipping global data platform, enable the system to implement the data processing method of the bulk shipping global data platform provided in the above embodiments, which will not be elaborated here.
[0044] Fourthly, this application provides a computer program product, including a computer program that, when running on the data processing system of the bulk shipping global data platform, enables the system to implement the data processing method of the bulk shipping global data platform provided in the above embodiments, which will not be elaborated here.
[0045] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:
[0046] 1. The system extracts core dimensions such as business contract identifiers to reconstruct physical composite primary keys for different business models, enabling the underlying storage granularity to be precisely aligned from coarse-grained voyages to single business contract dimensions, eliminating the many-to-many Cartesian product expansion when multiple tables are joined. Furthermore, by pre-setting pipelines for pre-aggregation and diversion, the computation of dynamic nested branches, which originally had high overhead during the upper-level query period, is shifted to the model building period to complete and materialize the output, reducing the database's computational load and concurrent query latency. This transforms upper-level queries from dynamic multi-table joins and nested conditional branches during runtime to point queries or lightweight summaries of materialized indicators, thereby reducing the expansion of the execution plan tree and the occurrence of memory hash joins overflowing the disk.
[0047] 2. The system connects discrete physical flight segment records into a lease chain topology with master and slave hierarchical numbers based on the associated contract identifier. Based on the accurate decomposition of shared costs, the traditional multi-layer nested sublease revenue calculation process is reduced in dimensionality to a simple linear aggregation based on a single grouping of lease chain association keys. This greatly reduces the computational graph complexity and execution depth of the database engine when dealing with complex sublease chains, and achieves efficient second-level output of benefit indicators for complex multi-sublease links.
[0048] 3. The system eliminates duplicate comparison overhead at the front end by using breakpoint resume and soft deletion threshold filtering, ensuring the high efficiency and purity of the underlying data details. At the back end, through reversible aggregation operators, it only deducts the old historical contribution value and adds the new contribution value to complete the partial refresh for the business to which the primary key is changed, without having to perform a costly full recalculation on the global application data table. This achieves near real-time dynamic materialization maintenance of the pre-aggregated indicators of the middle platform with lightweight computational overhead, and comprehensively improves the throughput and high availability of the data middle platform. Attached Figure Description
[0049] Figure 1 This is a flowchart illustrating a data processing method for a bulk shipping global data platform according to an embodiment of this application.
[0050] Figure 2 This is a flowchart illustrating the process of data cleaning and pre-aggregation of routine operating indicators for the bulk shipping full-domain data platform in this embodiment of the application.
[0051] Figure 3 This is a flowchart illustrating the process of subletting topology calculation and pre-aggregated indicator incremental update of the bulk shipping full-domain data platform in this embodiment of the application.
[0052] Figure 4 This is a schematic diagram of the physical device structure of the data processing system of the bulk shipping global data platform in this application embodiment. Detailed Implementation
[0053] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to any or all possible combinations including one or more of the listed items.
[0054] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0055] In the bulk shipping business, the same vessel often involves multiple charters and sub-charters within a single voyage. Traditional data platforms use a single voyage number as the primary key, which leads to a mismatch between the granularity of the data tables and multiple charters. This results in data bloat when multiple tables are joined, forcing upper-level analysis to rely on high-overhead dynamic nested calculations, causing excessive database load and severe delays in high-concurrency queries.
[0056] To address this, this application provides a data processing method and system for a bulk shipping global data platform. By executing steps S101 to S105, it reconstructs physical composite primary keys that match the contract granularity, and combines this with pre-aggregation and diversion in a pre-pipeline to eliminate data bloat and reduce the database's computational load, achieving second-level response times for high-concurrency metrics. Specifically, as follows... Figure 1 The diagram shown is a flowchart illustrating a data processing method for a bulk shipping global data platform according to an embodiment of this application.
[0057] S101. Perform a difference calculation between the first record primary key set of the source database and the second record primary key set of the target database to obtain the primary key set of the deleted records.
[0058] Among them, the source database refers to the underlying database of various heterogeneous business source systems that generate raw operational data in bulk shipping business, such as the Business Management System (BMS), Enterprise Management Software (SAP), and the database of the shipping agency collaboration system; the first record primary key set refers to the set of primary key identifiers extracted from the relevant business data tables in the source database that can uniquely identify each business detail record; the target data table refers to the source-attached layer (RDL) or data import layer (ODS) data tables in the bulk shipping global data platform used to receive, synchronize, and store business data from the source; the second record primary key set refers to the set of primary key identifiers of all records currently stored in the target data table; the target record primary key is used to indicate the primary key elements in the deleted record primary key set, which only exist in the target data table and no longer exist in the source database.
[0059] Specifically, in the actual flow of bulk shipping operations, business systems (such as BMS) often contain a large amount of draft business data (such as draft voyages and draft contracts). When business personnel discard such drafts at the source end, the source system usually does not perform logical deletion, but directly performs physical deletion, causing the records to completely disappear from the source table without generating any timestamp change records. Conventional incremental synchronization solutions based on updated timestamps cannot detect such deletions, resulting in long-term residual dirty data on the target end of the middle platform. To address this, the system proactively extracts the primary key sets from the target and source ends. By performing a difference comparison calculation using the second record primary key set as the minuend and the first record primary key set as the subtrahend, it accurately identifies orphan data primary keys that have been physically erased at the source end but still exist at the target end, generating a set of deleted record primary keys.
[0060] In some embodiments, the system can use ETL scheduling jobs (such as Kettle jobs) to configure fixed batch thresholds, extract primary key fields from the business tables of the source database and the data tables of the target database in segments according to preset batches, and generate a first primary key subset and a second primary key subset for each batch; the system loads the extracted second primary key subset and the first primary key subset into the computing memory batch by batch and performs difference hash comparison calculation; if the difference calculation of a certain batch fails due to network jitter or temporary anomaly, the system triggers the breakpoint resume mechanism to automatically initiate a partial retry for the failed batch until the preset maximum number of retries is reached; the system merges and deduplicates the primary key subsets of deleted records that have successfully matched in each batch to obtain a complete set of primary key sets of deleted records.
[0061] It should be noted that the invalid records removed in step S103 are records that have been marked for deletion in previous rounds and whose retention time has exceeded the lifecycle threshold, not records that have just been marked in this round S102; the newly marked records in this round will remain in the incremental data table within their lifecycle threshold for downstream consumption of deletion events, and will be physically removed by the background asynchronous cleanup task after they expire.
[0062] S102. Based on the set of primary keys of deleted records, mark the primary key of each target record in the target data table with a deletion identifier and set the corresponding lifecycle threshold to obtain an incremental data table carrying the deletion identifier.
[0063] Among them, the deletion identifier refers to a soft deletion status flag added to the data record row to indicate that the record has been abandoned at the logical level (e.g., setting the delete field to "Y"); the lifecycle threshold refers to the upper limit parameter of the time allowed to remain in the middle platform for records with deletion identifiers (e.g., configured as one month or a specific expiration timestamp); the incremental data table refers to the incremental state data table formed after the current batch of deleted data has been tagged and lifecycle attributes injected into the target data table.
[0064] Specifically, if the middleware immediately performs hard physical deletion on the target end after detecting deleted data at the source end, it will not only cause row lock contention in high-concurrency scenarios, severely degrading the write I / O performance of the underlying database, but also prevent downstream incremental jobs that depend on this batch of data from obtaining the "deletion event," thus disrupting the temporal consistency of data flow in the middleware. Furthermore, if accidental deletion or network instability occurs at the source end, the lack of a buffer and backtracking mechanism will result in unrecoverable data. Therefore, the system locates the target record in the target data table based on the primary key set of the deleted records. Instead of immediately physically erasing it, it updates the deletion flag on the target record and sets a clear lifecycle threshold to achieve soft deletion marking and lifecycle management. This smooths out the instantaneous write load on the database and fully records the deletion event on the middleware side, facilitating the smooth consumption of the deletion status by downstream incremental tasks at each layer, resulting in an incremental data table carrying the deletion flag.
[0065] In some embodiments, the system can establish an index in the target data table based on the primary key set of deleted records to locate and lock the target record rows to be tagged in batches; the system writes a deletion identifier (e.g., sets the delete field to "Y") to the deletion field of the locked record rows, and accumulates a preset buffer lifespan period (e.g., set to one month) based on the current system timestamp to calculate the corresponding expiration timestamp and write it to the lifespan threshold field; the system persists the data state after tagged to the target storage engine (e.g., OceanBase relational table or Hive table) to form an incremental data table that can be perceived and consumed by downstream systems.
[0066] S103. Remove invalid records from the incremental data table whose retention time has exceeded the lifecycle threshold, and extract valid business data records without deletion flags from the removed incremental data table to obtain the basic detailed data table.
[0067] Among them, invalid records refer to discarded records in the incremental data table that carry a deletion flag and whose retention time has exceeded their set lifecycle threshold; valid business data records refer to business fact data rows that are currently in a real and normal flow and whose deletion flag is in a non-deleted state (e.g., the delete field is "N" or empty); basic detailed data tables refer to data detail layer (DWD) data tables built in the data platform after multi-source aggregation, dirty data removal and standard cleaning.
[0068] Specifically, as business cycles progress, if records marked for deletion remain indefinitely in the middleware table, they will not only consume valuable storage space, cause index bloat and reduce query efficiency, but also increase the computational burden of subsequent batch incremental comparisons. Furthermore, if invalid data with deletion markers is mixed into downstream detailed modeling, it will lead to distortions in shipping operation analysis and financial reconciliation. To address this, the system, on the one hand, determines the retention time of records based on lifecycle thresholds. When the retention time exceeds the threshold, indicating that the deletion event has been fully consumed downstream and the anomaly backtracking period has passed, the system completely and physically removes these invalid records to free up storage space. On the other hand, when extracting and constructing the basic detailed data layer, the system precisely filters out all data with deletion markers, extracting only valid business data records with deletion markers indicating they are not deleted, thus processing them into a clean and standardized basic detailed data table.
[0069] In some embodiments, the system can scan the incremental data table through a background asynchronous, persistent periodic cleanup task, compare the current system time with the lifecycle threshold, filter out records whose retention time exceeds the lifecycle threshold and are marked with a deletion flag, and call the database interface to perform physical cleanup on them; when synchronizing to the data detail layer, the system constructs data extraction and filtering logic, and uses conditional statements (such as setting the delete field not to be equal to "Y") to remove records that have not yet expired but have been marked with a deletion flag, and only extracts valid business data records that do not carry a deletion flag; the system performs deduplication, padding, caliber alignment and format unification cleaning on the extracted valid business data records, and writes them in a standardized manner into the data detail layer storage area to generate a basic detail data table.
[0070] S104. Extract multiple target data statistical dimension fields from the basic detailed data table, combine and reconstruct them to obtain the physical composite primary key, and construct the subject data model table based on the physical composite primary key.
[0071] Among them, the target data statistical dimension field refers to the core business attribute column in the basic detailed data table that reflects the ship entity, navigation operation and business economic attributes; the pattern identifier field refers to the business attribute field used to identify the voyage operation mode, including time charter (TC), voyage time charter (TCT), voyage charter (VC), back-to-back (BTB) and so on; the business identifier field refers to the code field used to uniquely distinguish different business economic contracts in the global scope, such as chartering contract number, voyage charter cargo contract number, etc.; the physical composite primary key refers to the composite key composed of multiple target data statistical dimension fields, which is subject to strong uniqueness constraints and has a primary key index at the underlying physical database level; the theme data model table refers to the summary or lightly summary data model table (such as DWS / DM layer table) built in the data platform around the specific business analysis theme of bulk shipping (such as voyage operation and benefit calculation theme); the record storage granularity refers to the business accounting refinement and independent accounting boundary represented by each row of physical storage records in the data model table.
[0072] Bulk shipping is a highly specialized industry, often involving complex operations where a single vessel is chartered and then subleased or chartered multiple times within a single voyage. Traditional general-purpose data platforms, following entity-relationship modeling, use only coarse-grained voyage numbers as primary keys, treating the operating method as a common attribute within the row. This design results in data table record partitioning remaining at the "voyage" level, failing to align with the actual accounting dimensions of multiple charters. When downstream processes aggregate fees and join multiple tables for details of multiple charters within the same voyage, it inevitably leads to one-to-many or even many-to-many Cartesian product data bloat. This forces upper-layer applications to write extremely complex dynamically nested CASE WHEN statements to temporarily determine the operating method, causing SQL maintenance difficulties, inconsistent definitions, and severe performance degradation.
[0073] To address this, the system extracts core statistical dimensions, including pattern identifier and business identifier fields, from the basic detailed data table. These dimensions are then combined and reconstructed to solidify into a fundamental physical composite primary key. Furthermore, the distinction between business operations is moved from "application-layer logical judgment" to "the physical structure design of the data model," resulting in a thematic data model table. This design aligns the storage granularity of each physical row record with that of a single specific contract, isolating and discretizing different chartering or freight contracts at the physical storage layer. This fundamentally eliminates data divergence and Cartesian product expansion during multi-table joins.
[0074] In some embodiments, the system identifies the value of the pattern identifier field for data records in the basic detailed data table. In response to the pattern identifier field value belonging to a preset time charter operation mode (such as TC or TCT), the system extracts the ship code field, voyage number field, operating company field, pattern identifier field, and charter contract field as a business identifier field from the basic detailed data table. The system physically binds the above-extracted five dimension fields together and declares them as a composite primary key constraint (PRIMARY KEY) in the table structure of the target domestic database (such as OceanBase). The system then combines and reconstructs the physical composite primary key to obtain a physical composite primary key. Based on the reconstructed physical composite primary key, a subject data model table is established so that multiple charter records that may exist under the same ship, voyage number, and operating company are strictly mapped to independent row records with unique physical composite primary keys according to the charter contract field. This results in a subject data model table with a storage granularity aligned with a single charter contract.
[0075] It is understandable that other methods could also be used, such as dynamically selecting cargo contract numbers and waybill instruction numbers based on different operating methods like voyage charter or self-operation, to construct a suitable physical composite primary key. This is not limited here. For example, in response to the mode identifier field value belonging to the voyage charter operating mode, the system extracts the vessel identifier field, voyage identifier field, operating entity identifier field, mode identifier field, and the voyage charter cargo contract identifier field (which serves as the business identifier field) from the basic detailed data table for combination and reconstruction. This yields a physical composite primary key for the voyage charter scenario, and based on this, constructs a thematic data model table that aligns each physical record with a single voyage charter cargo contract. This provides a contract-level isolation modeling foundation for subsequent pre-aggregation calculations of equivalent time charter records.
[0076] For ease of understanding, the abstract fields and instance fields in this application have the following correspondence: the vessel identification field corresponds to the vessel code, IMO number, or call sign; the voyage identification field corresponds to the voyage number; the operating entity identification field corresponds to the operating company code; the mode identification field corresponds to the operating method codes such as time charter (TC), voyage time charter (TCT), voyage charter (VC), and back-to-back (BTB); the business identification field corresponds to codes used to globally and uniquely distinguish business contracts, such as the charter party contract number and voyage charter cargo contract number. All instance fields appearing in each step of this application are within the scope of the above correspondence and do not constitute a limitation on the scope of protection of this application.
[0077] S105. Based on the value of the pattern identifier field in the theme data model table, call the preset data calculation pipeline branches corresponding to different voyage operation modes to perform pre-aggregation calculations on the corresponding data records, and generate an application data table with pre-aggregated indicator structure in the data platform.
[0078] Among them, the data computing pipeline branch refers to the dedicated data computing path in the data platform computing engine that is pre-fixed and encapsulated, each corresponding to specific accounting formulas and rules for different voyage operating methods; pre-aggregation computing refers to the multi-dimensional grouping and summarizing, cost aggregation, difference calculation and indicator materialization processing performed on the measurement data in the background before the end user initiates upper-level report analysis or API service calls; pre-aggregation indicator structure refers to the physical column family or field pattern that contains the calculated benefit quantification indicators (such as time charter revenue, equivalent time charter level TCE, net sublease revenue, etc.); application data table refers to the wide data table in the application data layer (ADS) of the data platform that directly provides high-performance queries for shipping operation analysis, benefit monitoring and API data services.
[0079] The economic accounting logic and cost responsibility allocation in bulk shipping vary greatly under different operating models: for example, in time chartering, the charterer charges rent based on "daily rate × number of days," and costs are shared between the shipowner and the charterer according to the contract; voyage chartering requires deducting fuel costs, port charges, and other total voyage costs from the total freight and then dividing by the voyage time to calculate the equivalent time charter rate (TCE); back-to-back or sub-chartering relies on the difference between freight and charter rates. Traditional solutions perform real-time calculations through dynamic nested branches during queries, resulting in extremely complex computational graphs and excessive instantaneous database load.
[0080] To address this, the system utilizes a thematic data model table with physically aligned dimensions. Driven by the pattern identifier field, records are routed to dedicated computational pipeline branches corresponding to different business models for pre-aggregation calculations. This pre-maps different business rules to deterministic indicator values, and finally, these values are uniformly written to the application data layer using physical composite primary keys, solidifying them into application data tables with pre-aggregated indicator structures. When upper-layer business applications initiate high-concurrency queries, they no longer need to perform time-consuming multi-table dynamic joins and dynamic conditional branch judgments. Instead, they can directly perform point queries or lightweight summaries from the application data tables, significantly reducing the computational load on the underlying database during runtime, eliminating concurrency congestion, and ensuring sub-second response times for analytical indicators.
[0081] In some embodiments, the system parses the value of the pattern identifier field in the subject data model table; in response to the pattern identifier field belonging to a preset time charter operation mode, it calls the first data calculation pipeline branch to read the daily rental rate field and the charter period days field and performs multiplication to calculate the pre-aggregated time charter revenue index; in response to the pattern identifier field belonging to a preset voyage charter operation mode, it calls the second data calculation pipeline branch to read the freight summary field and deducts the total voyage cost summary field including fuel surcharges and port charges, and then divides it by the total operating time days to obtain the equivalent time charter pre-aggregated index (TCE); the time charter revenue pre-aggregated index output by the first pipeline branch and the equivalent time charter pre-aggregated index output by the second pipeline branch are aligned and wide-table-assembled with the aggregated port charges, fuel surcharges and other cost indicators according to the physical composite primary key; the system writes the assembled full index records into the application data layer deployed in a domestic database (such as OceanBase), generates an application data table with a pre-aggregated index structure, and publishes the service to the outside world through a standardized API interface.
[0082] In the data processing system of the bulk shipping full-domain data platform, in order to further solve the problem of instantaneous memory surge and fault tolerance when comparing massive primary keys, avoid repeated invalid comparisons of soft-deleted records, and achieve physical decoupling between contract-level accounting granularity and pre-aggregation pipeline under the two typical business models of time charter and voyage charter, the system further refines and executes steps S201 to S206.
[0083] By executing steps S201 to S206, the system establishes a complete data processing mechanism that combines batch fault-tolerant comparison, asynchronous dual-track governance with soft deletion, strong constraints on contract-level composite primary keys, and materialized aggregation of multiple pipeline branches. This effectively reduces the system's instantaneous write and computational load, ensuring second-level response and high data consistency under high-concurrency report queries. Specifically, as follows... Figure 2 The diagram shown is a flowchart illustrating the process of data cleaning and pre-aggregation of routine operating indicators for the bulk shipping full-domain data platform in this embodiment of the application.
[0084] S201. Extract primary keys according to preset batches and perform difference calculations batch by batch. If a failure occurs, resume the run at the breakpoint and retry until the upper limit is reached. Summarize to obtain the primary key set of deleted records.
[0085] Among them, the preset batch refers to the threshold of the amount of data processed in a single batch or the data paging slice window pre-configured in the data integration scheduling task (e.g., splitting by 100,000 primary keys per batch); the difference calculation refers to the comparison operation of extracting primary keys that only exist in the target set by comparing the primary keys of the target batch with the primary keys of the source batch; the breakpoint resume refers to the fault tolerance mechanism that automatically records the execution point of the successful batch when the batch processing job is interrupted by a failure in a certain sub-batch, and skips the successful batch during retry, and only performs partial recovery and recalculation for the current batch that has an error; the deleted record primary key set refers to the aggregated set of target record primary keys that have been physically deleted at the source end and compared by all batches.
[0086] Bulk shipping involves massive amounts of detailed data, including vessel movement reports, port fee invoices, and commercial invoices. If the system reads millions of primary keys from both the source and target ends into memory at once for difference operations when identifying draft data that has been physically deleted from the source end, it will instantly exhaust the memory resources of the middleware server, easily leading to memory overflow and crashes. At the same time, if a brief network interruption or database unavailability occurs during the full comparison process, the entire comparison task will be lost and forced to be rolled back.
[0087] The system uses an ETL scheduling engine (such as a Kettle job) to divide the massive primary key set into discrete, pre-defined batches. It extracts primary keys batch by batch in a streaming manner and performs lightweight difference operations in memory. During execution, the system utilizes a log and metadata offset mechanism for full-process status tracking. Specifically, it persistently records the page start primary key offset (Offset) for each successfully processed batch in the platform's metadata table. If a specific batch fails, the system does not need to rerun the global task; instead, it automatically triggers a breakpoint resume mechanism to locally re-extract and recalculate the failed batch until success or the preset maximum number of retries (e.g., 3 retries) is reached. Finally, the system accumulates and deduplicates the differing primary keys from all batches, summing them to generate a complete set of primary keys for deleted records. This mechanism significantly reduces the peak instantaneous memory usage during the primary key comparison phase, improving the high availability and fault tolerance of the underlying data synchronization link in the platform.
[0088] S202. Filter the marked records that have not exceeded the lifecycle threshold, mark them with a deletion flag and set a new lifecycle threshold; perform physical deletion on records that exceed the lifecycle threshold according to the cleanup task on a periodic basis.
[0089] Among them, marked records refer to historical records whose identifiers have been set to valid deletion status (such as the delete field being "Y") in the target data table; lifecycle threshold refers to the maximum valid duration parameter or specific expiration timestamp that soft-deleted records are allowed to remain in the middle platform (e.g., set to one month); cleanup tasks refer to the persistent asynchronous garbage data cleanup scheduling jobs deployed in the background of the data middle platform, which are independent of business data flow.
[0090] Specifically, in the incremental synchronization mechanism, if a draft data item has been physically deleted at the source, the system will identify and mark it as soft deleted during the first round of comparison. If, in the next round or subsequent rounds of incremental comparison, the system still blindly compares all existing primary keys at the target end with those at the source, these historical records already within the soft deletion buffer period will be repeatedly identified and marked, wasting the system's comparison computing power and I / O resources. Furthermore, if long-term accumulated soft-deleted data is not physically cleaned up, it will cause storage space expansion and index fragmentation in the underlying relational databases (such as OceanBase) and big data storage (such as Hive).
[0091] To address this, the system employs a dual-track lifecycle governance mechanism: During a new round of comparison and tagging, the system sets filtering preconditions, proactively skipping records in the target database that have not exceeded their lifecycle threshold and have already been marked for deletion. Only newly discovered target records are marked for deletion on their primary keys and assigned a new lifecycle threshold. Simultaneously, a separate cleanup task performs asynchronous scanning in the background according to a set maintenance cycle (e.g., daily at midnight). For any soft-deleted records whose retention time has exceeded the lifecycle threshold, it is determined that their downstream data consumption and anomaly backtracking periods have ended, and physical deletion is performed. This physical deletion is the concrete implementation of the invalid record removal in step S103. This design effectively avoids the computational waste of repeated tagging while achieving efficient automatic reclamation of storage space and index performance.
[0092] In some embodiments, when the system extracts the second record primary key set of the target end in the next round of incremental comparison task, the system can automatically filter out the marked records whose retention time has not exceeded the life cycle threshold by using SQL conditions (such as WHERE delete_flag != 'Y' OR (delete_flag = 'Y' AND expire_time <= CURRENT_TIMESTAMP)), and obtain the second record primary key set of skipped marked records for difference comparison. Based on the deleted record primary key set calculated in this round of difference, the system writes deletion flags (such as setting delete_flag to 'Y') in batches to the corresponding records in the target end data table, and calculates a new expiration timestamp by adding the current time to the set effective retention period (such as 30 days) and writes it to the life cycle threshold field. The system background timer program starts asynchronous cleanup jobs according to the preset cleanup cycle (such as weekly or monthly), scans the records in the data table whose expiration timestamp is less than the current time, and calls the batch deletion interface (DELETE / DROP PARTITION) of the underlying database to perform physical clearing of the underlying storage blocks.
[0093] S203. In response to time charter methods, extract the vessel, voyage, operating entity, mode identifier, and charter contract identifier to reconstruct the physical composite primary key and build a thematic data model.
[0094] Among them, time charter operation refers to the business model in bulk shipping where vessels are leased or chartered in and rent is paid on an agreed-upon basis, specifically including time charter (TC) and voyage time charter (TCT); the vessel identification field refers to the code (such as vessel code, IMO number, or call sign) used to uniquely identify a single physical vessel; the voyage identification field refers to the voyage number representing the cycle of a single transport operation of the vessel; the operating entity identification field refers to the code of the legal entity or operating company that performs the operation accounting for the voyage; the charter contract identification field refers to the business agreement code used to globally and uniquely distinguish a single charter contract; the thematic data model refers to the model entity with strict data primary key constraints built by the data platform around the themes of shipping benefit calculation and voyage operation.
[0095] Time charter (TC / TCT) transactions have unique characteristics that significantly differ from traditional transportation operations: a single vessel, operating under the same entity within the same voyage cycle, may be subject to both multiple charterings and sub-charterings to aggregate capacity or mitigate freight rate fluctuations. If a general data platform uses only a single voyage number as the physical primary key, the underlying data tables will have a coarse "voyage" level of physical granularity. This makes it impossible to distinguish different charter contracts belonging to the same voyage at the row level. When downstream users attempt to link the voyage master table with specific charter payment details, stop-charter deduction details, and other tables, it will inevitably cause the many-to-many Cartesian product data to diverge and expand, resulting in a significant increase in the calculated results.
[0096] To address this, the system, responding to the fact that the schema identifier field belongs to the time charter category, breaks away from the limitations of traditional entity modeling. It extracts five core dimension fields from the data detail table: vessel identifier, voyage identifier, operating entity identifier, schema identifier, and the charter contract identifier directly representing the underlying single agreement. These fields are then jointly bound and reconstructed into the underlying physical composite primary key, upon which the thematic data model is built. This design alters the physical storage granularity of the data table, forcing each physical record to be strictly aligned with the accounting dimension under a single charter contract. This eliminates data correlation and divergence at the root of the underlying storage, ensuring the absolute clarity and independence of the time charter business accounting boundaries.
[0097] In some embodiments, during the data warehouse model construction task, the system parses the pattern identifier field of the data record. In response to the pattern identifier field value being either a charter time (TC) or a voyage time charter (TCT), it executes dedicated modeling mapping logic. The system extracts the ship code field, voyage number field, operating company field, pattern identifier field, and charter contract field from the data detail layer. By combining these fields, it creates a composite primary key index (PRIMARY KEY(ship_code, voyage_no, op_company, charter_mode, in_charter_contract_id)) in the target domestic database (such as OceanBase), and reconstructs and generates a physical composite primary key. The system merges and maps the cleaned time charter detail fact data into the database according to this physical composite primary key, so that multiple charter records of the same vessel under the same voyage are solidified into multiple isolated independent data rows, and a thematic data model with an output storage granularity aligned with a single charter contract is constructed.
[0098] S204. Call the first branch to calculate the daily rent and the number of days of the lease term to obtain the rental income indicator.
[0099] Among them, the first branch refers to the dedicated branch channel in the data computing engine of the data platform, which is specifically used for the data computing pipeline to perform the accounting of operating income of time charter business; the daily rental fee field refers to the rental fee rate attribute per unit time stipulated in the time charter contract; the charter period days field refers to the number of operating days for which the vessel actually collects rental fees under the current voyage charter contract; and the time charter income indicator refers to the quantitative measurement value that reflects the operating income of the voyage under the time charter business.
[0100] Specifically, the system calls the pre-packaged first calculation pipeline branch, which extracts the daily rent field and the number of days of the lease term from the corresponding lease record in the subject model. Within the pipeline, it automatically performs the product calculation of "daily rent × number of days of lease term," deducts the rent loss for compliant lease suspension periods, and directly calculates the deterministic lease revenue indicator. This process pre-embeds the complex economic accounting logic within the pipeline, completing the materialized aggregation calculation of the indicator in advance, greatly reducing the real-time database calculation burden during subsequent report queries.
[0101] In some embodiments, the system's data computing engine loads data slices from the thematic data model table, filters out time charter business records based on pattern identifiers, and schedules them to the first data computing pipeline branch. The first data computing pipeline branch reads the daily rental rate attribute value and the rental period days attribute value within the record row, calls the numerical computing operator to perform the product operation of the two, and generates the theoretical total rental rate. The first data computing pipeline branch retrieves the details of the associated time charter stoppage events, deducts the amount of time charter stoppage loss caused by ship failure or maintenance, outputs the final calibrated time charter revenue indicator, and temporarily stores it in the calculation channel output buffer.
[0102] It should be noted that the details of the lease suspension event refer to the detailed data recording the start and end times and deduction amounts of the lease suspension events caused by the vessel's failure, maintenance, or other reasons. These data are derived from the lease suspension / deduction documents in the source business system and are used to deduct the corresponding lease suspension losses from the total theoretical lease amount.
[0103] S205, call the second branch to obtain the equivalent time charter index based on freight and voyage cost.
[0104] The second branch refers to a dedicated revenue accounting pipeline channel within the data calculation engine specifically designed for voyage charter (VC) operations. The freight summary field refers to the total freight revenue measurement field calculated based on the volume of bulk cargo carried and the agreed freight rate under the voyage charter model. The voyage cost summary field refers to the aggregation field of direct variable costs such as port charges, fuel consumption fees, freight commissions, and miscellaneous charges borne by the carrier under the voyage charter model. The equivalent time charter index refers to the shipping industry's commonly used equivalent time charter rate level (TCE), which is calculated by dividing the net revenue after deducting the voyage cost summary from the freight summary measurement by the total number of operating days. It is a standardized core benchmark indicator for measuring the profitability of ships under different operating modes.
[0105] Specifically, voyage charter (VC) is the most typical cargo contract business model in bulk shipping. Unlike time charter, under the voyage charter model, shipowners or operators need to bear their own profits and losses and bear extremely complex voyage variable costs (such as high fuel costs, port charges at various ports of call, freight commissions, canal fees, etc.). In order to compare the actual operational advantages and disadvantages of voyage charter voyages and time charter voyages, the management of bulk shipping companies generally use "time charter equivalent level (TCE)" as a unified benchmark for overall efficiency. However, the calculation of the TCE indicator involves the aggregation of costs from multiple sources across tables, complex deductions, and time conversions. If executed during dynamic queries at the application layer, the database must traverse a massive number of port charge slips and fuel invoices, which can easily cause database computing power to crash.
[0106] To address this, the system, for records with the pattern identifier "voyage charter," invokes a dedicated second pipeline branch. Within the calculation pipeline, it automatically sums the dispersed fuel costs, port charges, and miscellaneous fees to form a total voyage cost metric. This total voyage cost is then deducted from the total freight amount and divided by the total number of actual sailing and operating days occupied by the voyage, generating a standardized equivalent time charter index in advance. This calculation logic is devolved into the pipeline branch for parallel preprocessing, completely eliminating the performance bottleneck of dynamic cross-dimensional calculations across multiple tables at the application layer.
[0107] In some embodiments, the system's data computing engine distributes and routes voyage charter (VC) business records to a second data computing pipeline branch based on the pattern identifier. The second data computing pipeline branch summarizes all fuel costs, port charges, freight commissions, fresh water charges, and channel miscellaneous charges incurred in the current voyage from the underlying cost details table to generate a voyage cost summary metric. At the same time, it reads the product of the cargo volume and the freight rate to generate a freight summary metric. The second data computing pipeline branch reads the total operating time days of the current voyage, performs mathematical conversion processing, subtracts the net revenue obtained from the voyage cost summary metric from the freight summary metric, divides it by the total operating time days, and calculates and outputs the equivalent time charter metric (TCE).
[0108] S206. Write the time rental income indicator and the equivalent time rental indicator into the application data table using the physical composite primary key to obtain the application data table with a pre-aggregated indicator structure.
[0109] Among them, the application data table refers to the application data layer (ADS) entity wide table that the data platform directly exposes to various downstream terminal applications (such as business dashboards, BI analysis platforms, and financial reconciliation systems); the pre-aggregated indicator structure refers to the column family design in the table structure that directly includes pre-calculated deterministic analysis measurement fields such as rental income, equivalent rental rent, and gross profit difference.
[0110] Specifically, in the traditional data platform architecture, every time the reporting system responds to a high-level business analysis request, it needs to submit a massive SQL statement containing multiple nested CASE WHEN statements to the database. During database runtime, it dynamically determines the business model and temporarily performs rent discounting or TCE calculations, resulting in the intertwining of multi-table Cartesian product joins and real-time dynamic filtering concurrency, causing the database CPU to be fully utilized and severe response timeouts. To address this, the system will uniformly aggregate the rental income indicator calculated in the first branch and the equivalent rental indicator calculated in the second branch, using the physical composite primary key constructed in step S203 as the anchor point, and directly materialize it into the application data table of the application data layer, generating an application wide table with a pre-aggregated indicator structure. When upper-layer business applications initiate high-concurrency queries or call API interfaces, the database engine does not need to perform any time-consuming dynamic branch judgments or large-span multi-table joins at runtime. It only needs to initiate simple point queries or directly scan column families through physical composite primary keys to return ready-made benefit indicators with significantly lower computational overhead than dynamic conversion at runtime. This alleviates data processing congestion caused by concurrent queries and fully guarantees the high throughput and high-performance service capabilities of the whole-domain data platform.
[0111] In some embodiments, the system obtains the rental income indicator set output by the first data calculation pipeline branch and the equivalent rental indicator set output by the second data calculation pipeline branch, and constructs a merged wide table record in memory with the physical composite primary key as the association alignment key; the system calls the batch write connector of a domestic relational database (such as OceanBase) and performs batch UPSERT or append write operations according to the table structure specifications defined by the application data layer; the system generates primary key indexes and key business dimension indexes for the application data table after writing, solidifies it into an application data table with a pre-aggregated indicator structure, and encapsulates it into a standardized data service API for external release.
[0112] Subleasing in bulk shipping often involves multiple contracts linked together on the same physical segment. A single freight, fuel, or port charge can be scattered across multiple records, making it impossible to accurately reconstruct the true net profit by aggregating only at the single-contract level. Furthermore, the business data changes frequently, and recalculating the entire application data table for each change would overwhelm the database. Therefore, after constructing the thematic data model table and pre-aggregating routine indicators, the system further executes steps S301 to S306: first, it restores the discrete records to a chain of leases with hierarchical numbers and breaks down shared costs, reducing the multi-layered nested subleasing calculation to a single group aggregation; then, it uses reversible operators to perform partial refreshes on changed business transactions, reducing old data and adding new data, thereby achieving second-level output of subleasing net profit and near real-time maintenance of pre-aggregated indicators.
[0113] Specifically, such as Figure 3 The diagram shown is a flowchart illustrating the process of subletting topology calculation and pre-aggregated indicator incremental update of the bulk shipping full-domain data platform in this embodiment of the application.
[0114] S301. Extract the associated contract identifier, link multiple records pointing to the same physical flight segment into a lease chain, generate a shared association key and assign a hierarchical sequence number.
[0115] Among them, the associated contract identifier refers to the contract number field in the data record that points to the previous business contract leased by the current business contract on the lease-in side in the lease chain; the physical segment refers to a cargo displacement process defined by the same vessel, the same loading and unloading port, and the same sailing cycle, and is the business boundary for determining whether several contracts belong to the same chain; the lease chain refers to the directed contract sequence formed by leasing in and leasing out level by level along the physical segment; the lease chain association key refers to the grouping key that is uniformly assigned to all records on the same lease chain and has the same value; the hierarchical sequence number refers to the sequence number assigned to each record on the chain according to the order of leasing in and leasing out, used to distinguish the previous record on the lease-in side from the next record on the lease-out side.
[0116] Specifically, the system uses the associated contract identifier as a pointer for upward backtracking and the physical flight segment as the convergence boundary. Starting from any downstream record, it finds its upstream record and continues to backtrack upward from that upstream record until the associated contract identifier of a certain record is empty, thus connecting the scattered records into a complete directed lease chain. Subsequently, lease chain association keys with the same value are generated for all records on the same chain and written into the subject data model table, so that the entire chain has a unified grouping identifier. At the same time, each record is assigned a hierarchical number according to the order of leasing in and leasing out, with the original leasing record at the head of the chain having the smallest number and increasing step by step, so that the leasing side (upstream) and leasing side (downstream) of each record can be directly distinguished in subsequent grouping.
[0117] In some embodiments, the system can construct a component directed acyclic graph (DAG) using the associated contract identifier as the directed edge and the business identifier field value of each record as the node. Starting from the head record of the chain with an empty associated contract identifier, it traverses the chain level by level in reverse along the directed edges until the tail record with an in-degree of zero, thereby identifying each lease chain. Then, a unique anchor point (such as the hash result of the business identifier value of the head record) is selected for each lease chain, a lease chain association key is generated, and it is backfilled to all records on the chain. Finally, the level sequence number of each record is calculated according to the traversal depth of the associated directed edges and stored in the database along with the association key. It is understood that this can also be achieved by using recursive query statements to expand layer by layer, or by using the component topology sorting algorithm of the graph computing engine to solve in batches, etc., which is not limited here.
[0118] It should be noted that if this topological relationship is not reconstructed in advance, subsequent calculations can only rely on repeated backtracking through multiple layers of self-associations. Each additional layer of chain length adds another layer of association, and the computational cost expands rapidly with the chain length. Pre-materializing the grouping keys and hierarchical numbers is precisely to move this backtracking overhead that increases with the chain length forward and solidify it.
[0119] S302. The shared costs on the physical flight segment are split and included in the business identifier of each record according to the preset allocation coefficient, so as to obtain the cost allocation details of each business without duplicate inclusion.
[0120] Among them, shared cost measurement refers to the cost amount that is jointly borne by multiple business contracts on the same physical flight segment and is difficult to be directly attributed to a single contract, such as fuel costs, port charges, canal passage fees, etc. for the entire flight segment; preset allocation coefficient refers to the weight ratio that is pre-set to allocate shared cost measurement to each contract, and the sum of the coefficients of each record on the same physical flight segment is one; cost allocation details refer to the cost results of shared cost measurement after being split and separately recorded in each business identification field, and the same expense is only recorded in its corresponding share on one record.
[0121] Specifically, the system first aggregates the total amount of shared cost measurement from the expense documents according to the physical flight segment, then determines the preset allocation coefficient based on the actual share borne by each contract on the flight segment, uses the coefficient to split the total amount, and writes the split results under the corresponding business identifier field of each record, so that the same shared cost is only included once and the costs between different business identifier fields do not overlap, forming a clean cost allocation detail that can be directly included in the summary.
[0122] In some embodiments, the system can read the allocation basis (such as cargo volume, charter period days, or number of ports of call) corresponding to each contract, convert it into a normalized preset allocation coefficient, and register it in the allocation rule table; then, it multiplies the total shared cost measurement by the coefficient of the corresponding record to obtain the allocation amount to be borne by that record, and writes it along with the source document number into the cost column under its business identifier field; finally, it verifies whether the sum of the allocation amounts of each record in the same flight segment is consistent with the total amount, and if the deviation exceeds the limit, it issues an alarm and rolls back to a pending confirmation status. It is understood that this can also be achieved by weighting according to the actual number of operating days of each contract within the flight segment, or by having business personnel directly specify a fixed proportion in the rule table, etc., which is not limited here.
[0123] It should be noted that the costs in the sublease chain are characterized by occurring once and being shared by multiple parties. A single trip fee only occurs once in the business, but each layer of records often carries the full amount. The initial split is precisely to avoid the same fee being deducted repeatedly during subsequent aggregation, which would lead to a systematic underestimation of net revenue.
[0124] S303. Group by lease chain association key, and within each group, subtract the cost of the previous owner from the income recorded by the current owner, and obtain the net sublease revenue indicator in a single aggregation.
[0125] Among them, the sublease operation mode refers to the business model in which the lessee first rents a vessel from another party and then leases it out to downstream users to earn the price difference. Its mode identifier field takes the value of sublease type such as back-to-back (BTB), which is different from time charter and voyage charter. The sublease net income pre-aggregation index is a quantitative measure that reflects the overall profitability of a lease chain. Its value is equal to the sum of the income measurement of the upstream and downstream records minus the sum of the cost measurement of the upstream records, and it is directly stored as a ready-made field in the application data table.
[0126] Specifically, since the grouping key and hierarchical sequence number of the chain have been materialized into the data model in S301, the system only needs to group the records once according to the lease chain association key. Within each group, the records are divided into upstream and downstream sides according to the hierarchical sequence number. That is, for each record on the chain, the revenue generated by its leasing side is included in the downstream revenue, and the cost borne by its leasing side is included in the upstream cost. The revenue measured by downstream revenue and the cost measured by upstream cost for each record are summed and then subtracted to obtain the pre-aggregated index of the sublease net income of the chain. Since the shared cost has been split by share in S302 and is not double-counted, this subtraction will not result in the same fee being deducted twice. Finally, the data is written into the application data table according to the physical composite primary key of the record at the head of the chain.
[0127] In some embodiments, the system can first filter out time lease and term lease records by the pattern identifier field through a data calculation pipeline, and then perform a grouping operation using the lease chain association key as the grouping key. Within the group, the system distinguishes between the upstream and downstream parties according to the hierarchical sequence number, and accumulates the costs and revenues respectively. After subtracting, the net revenue of the chain is output. Chains containing only a single record and without actual subleasing are skipped from the output, and chains lacking upstream records or with hierarchical gaps are marked with an anomaly. It is understood that this can also be achieved by sorting by hierarchical sequence number and then accumulating layer by layer using a window function, or by using a streaming engine to perform stateful aggregation by association key, etc., which are not limited here.
[0128] It should be noted that the relevant technology requires multi-level self-association and nested condition judgment by contract number during the query period. The depth of the computation graph increases linearly with the chain length and is prone to divergence. This step reduces its dimensionality to a single grouping and aggregation. The longer the sublease link and the more layers, the more significant the cost savings.
[0129] Furthermore, the upstream and downstream records in this application are not mutually exclusive, but rather represent the orientation of the same record relative to adjacent contracts: any record on the chain is on the downstream side relative to the previous contract it leases in, and on the upstream side relative to the next contract it leases out; therefore, for multi-level lease chains of level three or above, a record located in the middle of the chain is included in the downstream income based on its leasing-side revenue measurement, and in the upstream cost based on its leasing-in cost measurement. The "sum of downstream record revenue measurements" is the sum of the leasing-side revenue measurements of all records on the lease chain, and the "sum of upstream record cost measurements" is the sum of the leasing-in cost measurements of all records on the chain. The two are subtracted in a single group to obtain the pre-aggregated index of the net subleasing revenue of the entire chain; the level sequence number is used to mark the leasing-in and leasing-out directions of each record on the chain and to verify the integrity of the chain.
[0130] S304. Extract the set of new / modified and deleted primary keys from the source end relative to the target end, and merge them to obtain the set of modified primary keys.
[0131] Among them, the set of primary keys for newly added and modified records refers to the set of primary keys that exist only in the source database or that exist in both databases but whose content has changed during this round of comparison; the set of modified primary keys refers to the complete set of primary keys representing all affected businesses in this round, obtained by merging the set of primary keys for newly added and modified records and the set of primary keys for deleted records to remove duplicates.
[0132] Specifically, during difference set comparison, the system simultaneously collects differences in two directions: one side consists of primary keys that exist only on the target side and have disappeared on the source side (i.e., the set of primary keys for deleted records), and the other side consists of newly added primary keys that exist only on the source side, as well as primary keys that exist on both sides but whose content has changed. The system merges and deduplicates the results from both sides to form a set of changed primary keys, which serves as the driving list for this round of incremental refresh. This ensures that regardless of whether a record is added, modified, or deleted, the business affected by it will be included in the subsequent refresh scope, preventing any omissions.
[0133] In some embodiments, the system can obtain a subset of new primary keys by simultaneously calculating the difference set in the opposite direction in the same batch comparison, in addition to calculating the difference set on the deletion side; compare the primary keys that exist on both sides according to the summary value of the key business field or the last update time, and determine the inconsistent ones as changed primary keys; then merge the new and changed primary keys with the deleted primary keys to remove duplicates into a set of changed primary keys, and map them to the business identifier field and lease chain association key according to the physical composite primary key, and output a list of changed business keys.
[0134] S305. For businesses that change the primary key, use a reversible operator to deduct the old contribution value from the historical pre-aggregated metrics to obtain intermediate pre-aggregated metrics.
[0135] Among them, reversible aggregation operators refer to summation or counting aggregation operators that support inverse operations. Their aggregation results can be corrected by deducting the contribution of a record in reverse without rescanning the entire dataset. The old contribution value refers to the numerical portion of the record before the change in the historical pre-aggregation index. The intermediate pre-aggregation index refers to the transitional index value after deducting the old contribution value but before accumulating the new contribution value, and it has not yet been released to the public.
[0136] Specifically, the system first locates the corresponding aggregate record in the application data table based on the business identifier field of the changed primary key or its lease chain association key and retrieves the historical indicator value. Then, it re-determines the old contribution value based on the record content before the change or the contribution value cached when it was last stored in the database. Then, it calls the summation-type reversible operator to perform subtraction on the historical indicator, subtracting the old contribution value from the historical indicator value to obtain the intermediate pre-aggregated indicator. For the part of the indicator that contains counting operators, the count is decremented synchronously. For business consisting of irreversible operators such as average value and deduplication count, it is not deducted here, but is marked as needing full recalculation and transferred to bypass processing.
[0137] In some embodiments, the system can read the old contribution value from the snapshot of the record before the change or the contribution value cache retained at the time of the last write. If the cache is missing, the system can reverse the value according to the corresponding pipeline branch rules based on the content of the record before the change, and then perform subtraction on the aggregated record and temporarily store the intermediate pre-aggregation index in the transaction cache or intermediate result table.
[0138] It should be noted that, in order to ensure that old contribution values can be deducted correctly, records that have been soft-deleted or modified will not be physically deleted by the background cleanup task before their corresponding old contribution values are written back and deducted; if a record has expired and has been physically deleted, its corresponding business will be recalculated in a bypass manner to avoid the boundary situation where old contribution values cannot be deducted.
[0139] In addition, after the incremental refresh of this application accurately locates the affected aggregate record by physical composite primary key or lease chain association key, it only performs old-to-new operations on the record and uses index version water level control to make the same batch of changes idempotently replayable, thus distinguishing it from the conventional incremental maintenance method that requires overall recalculation or full table scan on a fixed materialized view.
[0140] S306. The new contribution value calculated by the pipeline based on the changed record is added to the intermediate pre-aggregation index to obtain the incrementally updated application data table.
[0141] The new contribution value refers to the numerical portion that should be included in the pre-aggregation index, which is recalculated based on the changed record content and the corresponding data calculation pipeline branch. For deletion-type changes, its value is zero.
[0142] Specifically, after deducting the old contribution value, the system reads the changed records that have passed the cleaning and filtering from the basic detailed data table based on the changed primary key. It routes the records to the corresponding business method's data calculation pipeline branch according to the value of the pattern identifier field to recalculate the new contribution value. For sublease-type businesses, the new contribution value needs to be re-aggregated within the lease chain group, including the initial revenue and initial cost. For deletion-type changes, the value is set to zero because there is no corresponding record. Subsequently, the system adds the new contribution value to the intermediate pre-aggregated indicators, writes it back to the application data table with the physical composite primary key as the anchor point, and simultaneously registers the consumed change points and indicator versions in this batch. This allows the entire refresh to be completed without rescanning all details and can be repeated without changing the result.
[0143] In some embodiments, the system can accumulate the new contribution values output by each branch to the intermediate pre-aggregated index obtained in S305 using a reversible operator, perform a UPSERT on the application data table according to the physical composite primary key within the same transaction, and write the version number and update watermark; then record the consumption position of the batch of changed primary key sets, and sample the write results for reconciliation. If the results are inconsistent with the sampled full recalculation results, the system will replay the data by position or trigger a full recalculation of the business. It is understood that this can also be achieved by using a message queue to drive the refresh one by one according to the changed business, or by using a stream-batch integrated engine to maintain the index state machine, etc., which is not limited here.
[0144] The data processing system of the bulk shipping global data platform in this application embodiment is applied to electronic devices. Figure 4 A schematic diagram of the architecture of an electronic device suitable for implementing embodiments of this application is shown.
[0145] It should be noted that, Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0146] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions (computer programs), or by instructions (computer programs) controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. The electronic device of this embodiment includes a storage medium and a processor, wherein the storage medium stores multiple instructions that can be loaded by the processor to execute any step of the method provided in the embodiments of this application.
[0147] Specifically, the storage medium and the processor are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more signal lines. The storage medium stores computer execution instructions that implement the data processing method of the bulk shipping global data platform of this application, including at least one software functional module that can be stored in the storage medium in the form of software or firmware. The processor executes various functional applications and data processing by running the software program and module stored in the storage medium. The storage medium can be, but is not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The storage medium is used to store the program, and the processor executes the program after receiving the execution instructions.
[0148] Furthermore, the software programs and modules within the aforementioned storage medium may also include an operating system, which may include various software components and / or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.) and can communicate with various hardware or software components to provide an operating environment for other software components. The processor may be an integrated circuit chip with signal processing capabilities. The aforementioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc., which can implement or execute the methods, steps, and logic flowcharts disclosed in this embodiment. The general-purpose processor may be a microprocessor or any conventional processor.
[0149] Since the instructions stored in the storage medium can execute the steps of any of the methods provided in the embodiments of this application, the beneficial effects of any of the methods provided in the embodiments of this application can be achieved. For details, please refer to the preceding embodiments, which will not be repeated here.
[0150] The above description is merely a preferred embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data processing method for a bulk shipping global data platform, characterized in that, The method includes: The first record primary key set of the source database and the second record primary key set of the target database are used to perform a difference calculation to obtain the primary key set of deleted records. The target record primary key of the primary key set of deleted records exists only in the target database and does not exist in the source database. Based on the set of primary keys for deleted records, a deletion identifier is marked for each primary key of the target record in the target data table, and a corresponding lifecycle threshold is set to obtain an incremental data table carrying the deletion identifier; Remove invalid records from the incremental data table whose retention time has exceeded the lifecycle threshold, and extract valid business data records without the deletion identifier from the removed incremental data table to obtain a basic detailed data table. Multiple target data statistical dimension fields are extracted from the basic detailed data table and combined and reconstructed to obtain a physical composite primary key. A thematic data model table is then constructed based on the physical composite primary key. The record storage granularity of the thematic data model table is aligned with the data statistical dimension under the value of a single target business identifier field. The target data statistical dimension fields include a mode identifier field used to identify the voyage operation mode and a business identifier field to distinguish different business contracts. Based on the value of the pattern identifier field in the topic data model table, the preset data calculation pipeline branches corresponding to different voyage operation modes are called to perform pre-aggregation calculations on the corresponding data records, generating an application data table with a pre-aggregated indicator structure in the data platform.
2. The method according to claim 1, characterized in that, The step of extracting multiple target data statistical dimension fields from the basic detailed data table, combining and reconstructing them to obtain a physical composite primary key, and constructing a subject data model table based on the physical composite primary key specifically includes: In response to the fact that the value of the mode identifier field belongs to the preset time charter operation mode, the vessel identifier field, voyage identifier field, operating entity identifier field, mode identifier field and charter contract identifier field are extracted and combined and reconstructed to obtain the physical composite primary key. The charter contract identifier field is a business identifier field used to identify a single charter vessel contract. Based on the physical composite primary key, multiple charter records under the same vessel identifier, voyage identifier, operating entity identifier, and voyage operating mode in the basic detailed data table are distinguished according to the charter contract identifier field, resulting in a thematic data model table whose record storage granularity is aligned with the data statistical dimensions under a single charter contract.
3. The method according to claim 1 or 2, characterized in that, The step of calling preset data calculation pipeline branches corresponding to different voyage operation modes to perform pre-aggregation calculations on the corresponding data records and generating application data tables with pre-aggregated indicator structures in the data platform specifically includes: In response to the fact that the value of the mode identifier field belongs to the preset lease-type business mode, the numerical calculation operator built into the first data calculation pipeline branch is called to calculate the value of the daily rent field and the value of the lease term in days of the corresponding data record, and the pre-aggregation index of lease income is determined based on the calculation results. In response to the fact that the value of the mode identifier field belongs to the preset time charter operation mode, the built-in numerical calculation operator of the second data calculation pipeline branch is called to calculate the value of the freight summary field and the voyage cost summary field of the corresponding data record, and the equivalent time charter pre-aggregation index is determined based on the calculation results. Write the pre-aggregated term rental income index and the pre-aggregated equivalent term rental index into the application data table according to the physical composite primary key to obtain the application data table with the pre-aggregated index structure.
4. The method according to claim 1, characterized in that, The step of performing a difference calculation between the first set of primary key records in the source database and the second set of primary key records in the target database to obtain the set of primary key records to be deleted specifically includes: Extract primary keys of records from the source database and the target database in a preset batch, and perform the difference calculation in batches to obtain a subset of primary keys of deleted records for each batch. If the difference calculation task in any batch fails, the failed batch will be automatically retried in the breakpoint resume mode until the preset maximum number of retries is reached, and the primary key subsets of the deleted records in each batch will be summarized to obtain the primary key set of the deleted records.
5. The method according to claim 1, characterized in that, The method further includes: When performing the next round of incremental comparison task on the source database and the target database table, before the difference calculation is performed, data records in the incremental data table that have not been retained for a period of time exceeding the life cycle threshold and carry the deletion identifier are excluded from the second record primary key set to obtain the second record primary key set that skips the marked records.
6. The method according to claim 1, characterized in that, The method further includes: Extract the associated contract identifier of each data record from the basic detailed data table, and link multiple records pointing to the same physical flight segment into a lease chain based on the associated contract identifier. The associated contract identifier is used to point to the previous business contract leased by the current business contract on the lease-in side in the lease chain. Generate a shared lease chain association key for each data record on the lease chain, and assign a hierarchical number to distinguish the upstream record from the downstream record according to the order of lease in and lease out, and write it into the subject data model table; According to the preset allocation coefficient, the shared cost measurement of the physical flight segment jointly borne by multiple business contracts is split and included in the cost measurement column corresponding to the business identifier field of each record, so as to obtain the cost allocation details that are not repeated among the cost measurement columns corresponding to each business identifier field. When calling the data calculation pipeline branch corresponding to the sublease operation mode, the data is grouped according to the lease chain association key, and the sum of the income measurement of the downstream record is subtracted from the sum of the cost measurement of the upstream record within the group. The sublease net income pre-aggregation index in the application data table is obtained by single group aggregation.
7. The method according to claim 1, characterized in that, The method further includes: The set of primary keys for newly added and modified records in the source database relative to the target database table is extracted in the difference calculation, and then merged with the set of primary keys for deleted records to obtain the set of modified primary keys; For the business identifier field and the corresponding lease chain association key to which the changed primary key set belongs, locate the corresponding historical aggregation record in the application data table, and deduct the corresponding old contribution value from the pre-aggregation index of the historical aggregation record using a reversible aggregation operator to obtain the intermediate pre-aggregation index. The reversible aggregation operator is a summation or counting aggregation operator that supports inverse operation. The old contribution value is read from the snapshot of the record before the change or the contribution value cached when it was last written. The new contribution value obtained by the data calculation pipeline branch based on the changed record is accumulated to the intermediate pre-aggregation index, and the result is written back to the application data table with the physical composite primary key as the anchor point. The change point and index version level of this batch are registered simultaneously to obtain the incrementally updated application data table without full recalculation.
8. A data processing system for a bulk shipping global data platform, characterized in that, The system includes: one or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the system to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on the data processing system of the bulk shipping global data platform, the system performs the method as described in any one of claims 1-7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program runs on the data processing system of the bulk shipping global data platform, it causes the system to perform the method as described in any one of claims 1-7.
