A cross-border e-commerce full-link middle platform and intelligent operation system based on a micro-service architecture
Patent Information
- Application Number
- CN202610889389.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-09-11
AI Technical Summary
[0011]为实现上述目的,本申请提供如下技术方案:本发明公开了一种基于微服务架构的跨境电商全链路数据中台与智能经营系统,旨在解决现有技术中数据孤岛、财务核算滞后、广告与供应链归因断层、运营效率低下及架构扩展性差等问题
[0038] In view of the shortcomings of the prior art, the beneficial effects of the present invention are as follows:
Smart Images

Figure CN122736728A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cross-border e-commerce technology, and in particular to a cross-border e-commerce end-to-end platform and intelligent operation system based on a microservice architecture. Background Technology
[0002] In the current operational system of cross-border e-commerce and DTC brand overseas expansion, a common technical architecture model is "multi-platform independent operation + fragmented tool assistance": front-end sales rely on SaaS e-commerce platforms, back-end supply chain management relies on third-party ERP systems, and traffic acquisition relies on advertising platforms. Data interaction between these systems mainly relies on basic plugins built into the platforms or manual offline processing via periodically exported Excel spreadsheets.
[0003] Specifically, in existing technical solutions, sales order data is stored in Shopify's cloud database, procurement and inventory cost data is stored in the ERP system's private cloud or SaaS database, and advertising spending data is scattered across the backends of various media channels. When merchants need to uniformly list products, they must export relevant information from the ERP system and match it with Shopify's upload spreadsheet. When merchants need to handle logistics fulfillment, they typically export spreadsheets from the ERP system and upload them manually, or push logistics tracking numbers to Shopify via a simple API interface. When financial accounting is required, finance personnel must export files from the three systems mentioned above and use Excel for matching and summarizing. Some companies with certain technical capabilities have attempted to build simple data pipelines using Python scripts or low-code platforms, but these are mostly point-to-point, single-threaded tasks, lacking unified data cleaning, exception handling, and transaction consistency guarantee mechanisms, and have not formed a closed-loop automated system from "product listing - advertising distribution - order acquisition - logistics fulfillment - financial accounting - decision analysis".
[0004] Disadvantages of existing technology
[0005] 1. The silo effect of multi-source heterogeneous data is significant, leading to fragmented decision-making. Sales data, supply chain cost data, and advertising data are stored in physically isolated databases such as Shopify, ERP, and advertising platforms, lacking a unified Master Data Management (MDM) mechanism. Merchants cannot obtain a complete picture of "product-traffic-funds" in real time from a single view, resulting in operational decisions based on only one dimension of data, making it difficult to achieve refined end-to-end operations.
[0006] 2. Inaccurate financial accounting and delayed profit analysis. Because average costs in the ERP system cannot be synchronized to the sales end in real time, and advertising spending data is scattered, finance personnel can only rely on manually exported data for static estimations. This delayed accounting method prevents merchants from obtaining the true net profit per SKU in real time, making it difficult to identify unprofitable products and adjust budgets promptly on the day of advertising, severely impacting cash flow efficiency.
[0007] 3. Disconnect between advertising data and supply chain data attribution. Advertising spending on the traffic side is typically aggregated by ad group, while procurement costs on the supply chain side are managed by SKU. There is a lack of automated mapping and allocation mechanisms between the two. Current technology cannot construct a complete funnel model of "impression-click-conversion-cost-net profit," making it difficult for merchants to identify falsely popular products with high advertising returns but low net profit, resulting in wasted marketing budgets.
[0008] 4. Inefficient product listing and information maintenance. In multi-platform operation scenarios, basic product information and inventory pricing strategies often need to be repeatedly entered between ERP and Shopify or manually matched and uploaded through complex spreadsheets. The lack of automated synchronization and mapping tools results in long new product listing cycles and is prone to inconsistencies in pricing or inventory information due to human error, leading to transaction risks.
[0009] The system architecture suffers from poor scalability and a lack of closed-loop guarantee mechanisms. Existing script-based or low-code tools are mostly point-to-point, single-threaded tasks, lacking task queues and transaction consistency guarantees. When faced with a surge in data volume or fluctuations in API interfaces, they are highly susceptible to data loss, synchronization blockage, or system crashes, and cannot be elastically scaled, making it difficult to form a stable and reliable closed-loop automated system for "product-marketing-finance". Summary of the Invention
[0010] The purpose of this application is to provide a cross-border e-commerce full-chain middleware and intelligent operation system based on microservice architecture to solve the problems mentioned in the background technology.
[0011] To achieve the above objectives, this application provides the following technical solution: This invention discloses a cross-border e-commerce end-to-end data platform and intelligent operation system based on a microservice architecture, aiming to solve problems such as data silos, lagging financial accounting, disconnect between advertising and supply chain attribution, low operational efficiency, and poor architectural scalability in existing technologies. The system adopts a multi-layered microservice architecture to achieve intelligent closed-loop management of the entire chain from data collection and processing to business decision-making.
[0012] The system's complete technical solution adopts a five-layer architecture design: "application presentation layer → business logic layer → data integration layer → data storage layer → infrastructure layer".
[0013] 1. Application Presentation Layer
[0014] As the user interaction entry point, this single-page application, developed using the React / Next.js framework, provides a visual decision-making interface. Core functionalities include:
[0015] Operational data dashboard: Integrates ECharts to display real-time gross merchandise volume (GMV), dynamic gross profit margin, net profit margin trend charts, and advertising return on investment (ROAS) heatmap in multiple dimensions.
[0016] Financial Statement Center: Supports profit and loss statement perspective analysis by time, store, standard product unit (SPU), inventory quantity unit (SKU), and traffic channel, and supports asynchronous export of large amounts of data.
[0017] The management backend provides encrypted storage of API keys, role-based access control (RBAC) permission management, time-based one-time password (TOTP) secondary authentication, and an entry point for monitoring the running status and handling exceptions of background asynchronous tasks.
[0018] 2. Business Logic Layer
[0019] The core algorithm engine is encapsulated, specifically including:
[0020] Dynamic Profit Calculation Engine: It calls the ERP interface in real time to obtain the moving weighted average cost of inventory batches at the current moment as the cost of goods sold (COGS), and retrieves the actual freight cost including surcharges from the ERP based on the logistics tracking number. It automatically calculates platform commissions and payment handling fees, and generates an accurate profit statement for each product.
[0021] Ad attribution engine: Employs a hybrid allocation algorithm. For ads directly associated with product IDs, direct attribution is used; for general ads, weighted allocation is applied to each SKU based on SKU sales revenue share or traffic source share, enabling accurate calculation of ROI.
[0022] Product synchronization engine: Builds standardized product models. When a user edits product information once within the system, the engine automatically converts it into the target e-commerce platform's API format and pushes it. It supports batch editing, overwrite updates, and differential updates.
[0023] 3. Data Integration Layer
[0024] Supports unified access and cleaning of multi-source heterogeneous data, and builds an independent data adapter module based on the Python FastAPI framework:
[0025] E-commerce adapter: Encapsulates Shopify GraphQL Client, efficiently retrieves order and product data through nested GraphQL queries and cursor pagination technology, and supports real-time Webhook monitoring and breakpoint resume.
[0026] Supply Chain Adapter: Enables OAuth2.0 authentication with the ERP system, periodically retrieves SKU information, inventory and costs through a two-way ID mapping engine, and provides a visual, human-assisted matching interface.
[0027] Ad adapter: Retrieves ad spend, impressions, and click data by tier through the Google Ads API and Meta Ads API, and parses UTM parameters.
[0028] 4. Data storage layer
[0029] Adopting a hybrid storage architecture:
[0030] PostgreSQL relational database: Stores core business entities such as store configuration, product models, and order models, and directly stores complex nested JSON data returned by APIs using its JSONB field feature.
[0031] Redis high-performance caching and queues: TTL caching of hot KPI metrics; acting as a Broker for Celery distributed task queues, storing pending API synchronization and data computation tasks.
[0032] 5. Infrastructure Layer
[0033] Ensure continuous integration and system stability:
[0034] Containerized deployment: Package the backend and frontend into images using Dockerfile, and use Docker Compose for service orchestration.
[0035] Asynchronous task scheduling: The Celery framework is introduced to build an asynchronous task cluster, and time-consuming tasks are stripped to background worker nodes for parallel processing.
[0036] Rate limiting and circuit breaking: Rate control is implemented for the token bucket algorithm built into third-party APIs, and a circuit breaking mechanism is triggered when the API is abnormal, automatically retrying or pausing the task.
[0037] In summary, the technical effects and advantages of this invention are as follows:
[0038] In view of the shortcomings of the prior art, the beneficial effects of the present invention are as follows:
[0039] 1. Achieve unified management and real-time closed-loop control of cross-border e-commerce data across the entire supply chain: Based on the Python FastAPI microservice architecture, it realizes unified access and ID mapping for multiple heterogeneous data sources such as Shopify, ERP, and Google Ads, completely breaking down the data silos of "sales-supply chain-marketing". Data consistency and synchronization timeliness are improved by more than 95%, effectively solving the pain points of inconsistent data standards and lagging inventory and price updates in existing technologies;
[0040] 2. Significantly improves the accuracy and timeliness of financial accounting: Abandoning the traditional static cost estimation model, by integrating the ERP real-time inventory moving weighted average cost (MWAC) with the actual invoice interface of logistics providers, and with the efficient read and write of PostgreSQL databases by SQLAlchemy, the error rate of net profit calculation per SKU is reduced to less than 1%; the time for generating financial statements is shortened from "monthly closing T+30" to "real-time T+0", and managers can obtain accurate ROI data instantly, supporting rapid decisions on funding and advertising budgets;
[0041] 3. Not only did it reduce operating costs, but it also enabled refined marketing attribution: Through fully automated product synchronization and advertising cost allocation algorithms, it freed operations staff from tedious Excel matching work, improving efficiency by more than 80%; at the same time, the advertising attribution model based on "sales share" bridged the gap between traffic data and supply chain costs, helping companies accurately identify risky products with "high ROAS but low net profit", and significantly reducing the waste of ineffective advertising budgets;
[0042] 4. Supports high-concurrency business scenarios and high system availability: Utilizing an architecture combining FastAPI asynchronous processing, Redis caching, and Celery task queues, coupled with Docker containerized deployment, the system effectively addresses the rate limiting of third-party platform APIs through a "token bucket" algorithm. Even under peak traffic conditions during promotional events, the system maintains zero task loss and elastic scaling of services, resolving the problems of existing script-based tools being prone to blocking and lacking disaster recovery capabilities.
[0043] 5. Enhancing the security and value of enterprise data assets: Utilizing a Next.js front-end / back-end separation architecture and a hybrid storage system of PostgreSQL + Redis, combined with OAuth2.0 authentication and encrypted data transmission, the security of core operational data is ensured. Dispersed raw transaction records are transformed into standardized balance sheets and profit and loss statements, providing a solid data foundation for subsequent financing audits and inventory turnover optimization. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a diagram of the microservice data platform and business system architecture;
[0046] Figure 2 This is a demonstration diagram illustrating the specific implementation of this application. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Example: This invention provides a cross-border e-commerce full-chain middleware and intelligent operation system based on microservice architecture. The complete technical solution of the system adopts a five-layer architecture design of "application presentation layer → business logic layer → data integration layer → data storage layer → infrastructure layer".
[0049] 1. Application Presentation Layer
[0050] As the user interaction entry point, this single-page application, developed using the React / Next.js framework, provides a visual decision-making interface. Core functionalities include:
[0051] Operational data dashboard: Integrates ECharts to display real-time gross merchandise volume (GMV), dynamic gross profit margin, net profit margin trend charts, and advertising return on investment (ROAS) heatmap in multiple dimensions.
[0052] Financial Statement Center: Supports profit and loss statement perspective analysis by time, store, standard product unit (SPU), inventory quantity unit (SKU), and traffic channel, and supports asynchronous export of large amounts of data.
[0053] The management backend provides encrypted storage of API keys, role-based access control (RBAC) permission management, time-based one-time password (TOTP) secondary authentication, and an entry point for monitoring the running status and handling exceptions of background asynchronous tasks.
[0054] 2. Business Logic Layer
[0055] The core algorithm engine is encapsulated, specifically including:
[0056] Dynamic Profit Calculation Engine: It calls the ERP interface in real time to obtain the moving weighted average cost of inventory batches at the current moment as the cost of goods sold (COGS), and retrieves the actual freight cost including surcharges from the ERP based on the logistics tracking number. It automatically calculates platform commissions and payment handling fees, and generates an accurate profit statement for each product.
[0057] Ad attribution engine: Employs a hybrid allocation algorithm. For ads directly associated with product IDs, direct attribution is used; for general ads, weighted allocation is applied to each SKU based on SKU sales revenue share or traffic source share, enabling accurate calculation of ROI.
[0058] Product synchronization engine: Builds standardized product models. When a user edits product information once within the system, the engine automatically converts it into the target e-commerce platform's API format and pushes it. It supports batch editing, overwrite updates, and differential updates.
[0059] 3. Data Integration Layer
[0060] Supports unified access and cleaning of multi-source heterogeneous data, and builds an independent data adapter module based on the Python FastAPI framework:
[0061] E-commerce adapter: Encapsulates Shopify GraphQL Client, efficiently retrieves order and product data through nested GraphQL queries and cursor pagination technology, and supports real-time Webhook monitoring and breakpoint resume.
[0062] Supply Chain Adapter: Enables OAuth2.0 authentication with the ERP system, periodically retrieves SKU information, inventory and costs through a two-way ID mapping engine, and provides a visual, human-assisted matching interface.
[0063] Ad adapter: Retrieves ad spend, impressions, and click data by tier through the Google Ads API and Meta Ads API, and parses UTM parameters.
[0064] 4. Data storage layer
[0065] Adopting a hybrid storage architecture:
[0066] PostgreSQL relational database: Stores core business entities such as store configuration, product models, and order models, and directly stores complex nested JSON data returned by APIs using its JSONB field feature.
[0067] Redis high-performance caching and queues: TTL caching of hot KPI metrics; acting as a Broker for Celery distributed task queues, storing pending API synchronization and data computation tasks.
[0068] 5. Infrastructure Layer
[0069] Ensure continuous integration and system stability:
[0070] Containerized deployment: Package the backend and frontend into images using Dockerfile, and use Docker Compose for service orchestration.
[0071] Asynchronous task scheduling: The Celery framework is introduced to build an asynchronous task cluster, and time-consuming tasks are stripped to background worker nodes for parallel processing.
[0072] Rate limiting and circuit breaking: Rate control is implemented for the token bucket algorithm built into third-party APIs, and a circuit breaking mechanism is triggered when the API is abnormal, automatically retrying or pausing the task.
[0073] Scenario 1: New product launch and simultaneous launch on multiple platforms
[0074] In the system's "Product Management" module, operations staff create a new product. They only need to fill in the product's title, description, images, price, and custom metadata once. After saving, the product synchronization engine is triggered. The engine first converts the user-input data into a JSON structure required by the Shopify platform API, according to a predefined "attribute mapping template." Subsequently, the system uses the e-commerce adapter to call Shopify's GraphQL API to push the product information to the designated Shopify store. Simultaneously, the system can synchronize the cost and inventory information of the same product to the ERP system via the supply chain adapter, based on preset rules. The entire process is automated, eliminating the need for manual data entry or Excel spreadsheet processing across multiple systems, significantly improving efficiency and avoiding the risk of information inconsistencies.
[0075] Scenario 2: Order-level real-time profit calculation and decision-making
[0076] When a new order is generated in a Shopify store, the e-commerce adapter receives the order creation event in real time via a webhook. The system immediately initiates the profit calculation process:
[0077] The dynamic profit calculation engine parses orders and retrieves SKU information from them.
[0078] The engine uses the supply chain adapter to query the latest moving weighted average cost (MWAC) of the SKU in the ERP system in real time, and uses it as the cost of goods sold for the order.
[0079] Based on the logistics service provider and destination information in the order, the engine uses the ERP's logistics billing module interface to retrieve the actual shipping cost (including fuel surcharges, etc.) for that order.
[0080] The engine combines transaction flow information from Shopify orders to calculate platform commissions and payment gateway fees.
[0081] Finally, the system calculates the net profit of the order in real time (sales revenue - cost of goods sold - actual freight - commission - handling fee) and updates it to the financial statement center.
[0082] Finance and operations staff can immediately see the real-time profit margin of an order or SKU on the dashboard. If a SKU's profit turns negative due to rising costs or a surge in shipping expenses, the advertising department can be notified immediately to adjust the advertising budget for that SKU, enabling agile decision-making based on true profit.
[0083] Scenario 3: Automated Allocation of Advertising Costs and ROI Analysis
[0084] At the beginning of each month, the ad adapter automatically pulls spending data from all ad campaigns of the previous month via the Google Ads API and Meta Ads API. The ad attribution engine then begins working:
[0085] For Google Shopping ads, because they are directly associated with product IDs (such as g:product_id), the engine can directly attribute ad spending to specific SKUs.
[0086] For generic ads that are not directly related to products, such as search or display ads, the engine uses a "sales revenue weighted allocation algorithm." For example, a search ad group for the brand keyword "ABC Shoes" spends $1,000 in a month, generating a total sales revenue of $5,000, with SKU-A generating $2,000 and SKU-B generating $3,000. The engine will automatically allocate $400 ($1,000 * 2,000 / 5,000) to SKU-A and $600 to SKU-B.
[0087] After the allocation is completed, the system associates the advertising cost allocated to each SKU with the net profit calculated by the dynamic profit accounting engine for that SKU, and accurately calculates the advertising return on investment (ROAS) and return on investment (ROI) for each SKU.
[0088] Operations staff can clearly identify which SKUs are "high ROAS but low net profit" falsely booming products in the "Ad Analytics" dashboard, thereby optimizing the allocation of advertising budgets and focusing funds on products that can truly generate profits.
[0089] Scenario 4: Stability assurance during high-concurrency promotional periods
[0090] During the "Black Friday" sales event, the number of orders surged, putting the system under high concurrency pressure.
[0091] Data synchronization: The e-commerce adapter, based on the cursor pagination mechanism and breakpoint resume function, can stably and efficiently traverse massive new orders without crashing or missing data due to excessive data volume.
[0092] Asynchronous processing: All time-consuming tasks such as order retrieval, profit calculation, and report generation are published as Celery tasks to a Redis queue, where they are consumed and processed in parallel by multiple worker nodes in the background, ensuring that the front-end HTTP interface responds quickly and is not blocked.
[0093] API Circuit Breaker: When a Shopify or ERP third-party API experiences slow response or a high error rate due to excessive traffic, the system's built-in rate limiting and circuit breaker mechanism will be triggered. The token bucket algorithm controls the request frequency to avoid exceeding platform limits; when the error rate reaches a threshold, the circuit breaker will temporarily stop calls to the API and arrange retries according to an exponential backoff strategy to prevent the entire system from collapsing due to the unavailability of a single external service.
[0094] Through the above mechanism, the system successfully coped with traffic surges, ensuring high availability of data flow and business continuity.
[0095] Finally, it should be noted that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A cross-border e-commerce end-to-end middleware and intelligent operation system based on microservice architecture, characterized in that: The system adopts a five-layer architecture design, including an application presentation layer, a business logic layer, a data integration layer, a data storage layer, and an infrastructure layer. The application presentation layer is used to provide a visual data dashboard and user interface; The business logic layer encapsulates a dynamic profit calculation engine, an advertising attribution engine, and a product synchronization engine. The data integration layer includes a multi-source heterogeneous data adapter for connecting e-commerce platforms, supply chain systems, and advertising platforms; The data storage layer adopts a hybrid storage scheme of PostgreSQL and Redis; The infrastructure layer is based on containerization and asynchronous task scheduling technologies to ensure system deployment and high availability.
2. The system according to claim 1, characterized in that, The dynamic profit calculation engine is configured to: obtain the moving weighted average cost of inventory from the supply chain system in real time as the cost of goods sold, and combine it with actual logistics costs, platform commissions and payment processing fees to calculate the net profit per order or per SKU.
3. The system according to claim 1, characterized in that, The advertising attribution engine is configured to use a hybrid allocation algorithm: advertising expenditures directly associated with product identifiers are directly attributed; for general advertising expenditures not directly associated with product identifiers, a weighted allocation is performed based on the percentage of SKU sales revenue or the percentage of traffic source, so as to allocate advertising expenses to specific SKUs.
4. The system according to claim 1, characterized in that, The product synchronization engine is configured to: build a standardized product model, automatically convert the product information edited by the user once into the application programming interface (API) format of the target e-commerce platform according to the attribute mapping template, and push it, supporting batch operation, overwrite update and differential update modes.
5. The system according to claim 1, characterized in that, The e-commerce adapter in the data integration layer specifically uses GraphQL nested queries and cursor-based pagination technology to retrieve data from the e-commerce platform, and supports Webhook event listening and breakpoint resume mechanism.
6. The system according to claim 1, characterized in that, In the data storage layer, the PostgreSQL database uses the JSONB field to store complex nested JSON data from the e-commerce platform API; Redis is used to cache hot key performance indicator (KPI) data and acts as the broker for the Celery distributed task queue.
7. The system according to claim 1, characterized in that, The infrastructure layer specifically includes: The containerized deployment module is used to encapsulate the system's front-end and back-end services into Docker images and orchestrate them; The asynchronous task scheduling module, based on the Celery framework, delegates time-consuming tasks to background Worker nodes for processing. The rate limiting and circuit breaker module uses the token bucket algorithm to control the frequency of calls to third-party APIs and triggers the circuit breaker mechanism when an API fails.
8. A cross-border e-commerce data processing method based on the system described in any one of claims 1-7, characterized in that, include: Through the data integration layer, multi-source heterogeneous data is acquired in real time or periodically from e-commerce sales platforms, supply chain management systems, and advertising platforms. The dynamic profit calculation engine of the business logic layer calculates profits based on the real-time acquired mobile weighted average cost and actual logistics costs. The advertising attribution engine in the business logic layer is used to attribute and allocate advertising expenditures at the SKU level. The product synchronization engine in the business logic layer enables automated synchronization of product information across platforms. The application presentation layer visualizes the processed profit data, attribution results, and business status.
9. The method according to claim 8, characterized in that, The profit calculation steps specifically include: for each sales order, querying the moving weighted average cost of each SKU contained therein at the current moment, querying the actual logistics cost of the order, and calculating the net profit of the order or SKU by combining the order amount, platform commission and payment processing fee.
10. The method according to claim 8, characterized in that, The steps for attributing and allocating advertising expenditures at the SKU level specifically include: identifying whether the advertising expenditures are directly associated with product identifiers; if so, attributing them directly to the corresponding SKU; if not, allocating the advertising expenditures to each SKU based on the proportion of sales revenue of each SKU in the total sales revenue generated by the advertising expenditures, or based on the weight of traffic sources.