Qeasy Cloud
Get Started

After-Sales Reship Order Sync Strategy: From Banniu Reconciliation to MySQL with Goods Code Correction

· 吕修远· Integration Solutions· 11 views· 4 min read

What This Strategy Solves

In the after-sales chain of a retail enterprise, the customer-service work-order system (here, Banniu as an example) continuously produces "reship/reissue orders" — the merchant agrees to send a replacement item to the consumer, and the work order records the goods, quantity, and reason. However, the goods codes on the work-order side follow customer-service conventions; if they flow directly into the back-end SRM database (MySQL in this example), they will not align with purchasing and inventory standards, and within three months the numbers on both sides will diverge.

This strategy pulls the reship orders back as header + detail, performs code and field mapping, writes them stably to the business detail tables, and corrects erroneous goods codes before insertion.

Data Flow and Field Mapping

The overall flow is reconciliation system (Banniu, GET task.list, QUERY) → Qeasy middle layer → business database (MySQL, POST executeReturn, EXECUTE).

Key field comparison (only error-prone fields are listed; the full set follows the platform configuration):

Business meaningReconciliation-side fieldMiddle-layer handlingMySQL target field (main / extend table)
Bill numberbill_noPass-throughsupplier_after_sale_send.bill_no
SolutionsolutionPass-throughsupplier_after_sale_send.solution
Responsible partyresponsible_party / _detailPass-throughsupplier_after_sale_send.responsible_party
Online trade no.online_trade_noPass-throughsupplier_after_sale_send.online_trade_no
Goods codegoods_noCentrally managed code mapping, failures routed to exception queuesupplier_after_sale_send_detail.goods_no
Goods namegoods_nameFallback filled from mapping tablesupplier_after_sale_send_detail.goods_name
Barcodebar_codePass-throughsupplier_after_sale_send_detail.bar_code
Specificationspec_namePass-throughsupplier_after_sale_send_detail.spec_name
Reship quantitysend_quantityNumeric validation, non-positive discardedsupplier_after_sale_send_detail.send_quantity
Costcost / financial_costNumeric validationsupplier_after_sale_send_detail.cost

The header writes to supplier_after_sale_send, and the detail writes to supplier_after_sale_send_detail. The two SQL segments are tied into one transaction through lastInsertId.

How to Configure on Qeasy

In one real project, we used the Qeasy data integration platform to carry this link. The typical configuration points are as follows.

  • Source platform: Choose the reconciliation system; interface task.list (GET). Pagination parameters: page_size=50, page_num increments via expression, and the time window uses star_modified as the incremental cursor.
  • Target platform: Choose the MySQL data source; interface executeReturn (POST). Set buildModel=true, so the platform constructs the request body from the SQL template.
  • Execution SQL: Split into main_sql (main-table INSERT) and extend_sql_1 (1:1 extend-table INSERT). The extend table receives multiple goods-detail rows via the extend_params_1 array.
  • Code mapping: Maintain the "reconciliation-side goods code → SRM goods code" mapping table in Qeasy's Mapping Center, managed centrally rather than hard-coded in each strategy. This is one of the common patterns used by Qeasy customers.
  • Failure handling: Records with unmapped codes, overlong fields, or invalid numbers go to the platform's exception queue and are reprocessed manually, rather than aborting the entire batch.

Implementation Steps

The cadence of after-sales reship orders is not very dense, so we use the "incremental as the main flow, full load as fallback" dual-track approach — another common pattern among Qeasy customers.

  1. Establish incremental starting point: For the first run, take all records after the last 7 days of star_modified as the starting point, avoiding one-shot backfills that overwhelm the target database.
  2. Configure full-load trigger: Keep a one-time full-load task that runs manually only after "code mapping rules change" or "target table structure changes"; it does not run daily.
  3. Daily scheduling: Set CRON to */30 8-23 * * *, pulling every 30 minutes during business hours and pausing overnight, aligning with the customer-service shift rhythm.
  4. Two-phase header/detail writing: First insert the main table to obtain lastInsertId, then batch-insert the extend table. If either stage fails, roll back the main table to avoid orphan records.
  5. Monitoring and reconciliation: Monitor success rate and latency on the platform side; the business side samples 5 records daily to compare bill_no, and immediately investigates the exception queue on any anomaly.

Pitfall Review

  • Pitfall 1: "Fix afterwards" for erroneous goods codes. Customer-service entries in goods_no often carry suffixes or typos; passing them through directly produces invalid keys in the target table. The robust approach is to look up the mapping center before insertion, and route misses to the exception queue rather than write first and clean later.
  • Pitfall 2: Reversed header/detail order. extend_sql_1 depends on the main table's lastInsertId; the main table must commit first.
  • Pitfall 3: Unthrottled full-load tasks. Pulling tens of thousands of records at once exhausts the MySQL connection pool and drags down subsequent incremental runs.
  • Pitfall 4: send_quantity of 0 or negative written as-is, skewing downstream cost aggregation. This is a common crash point; the robust approach is to add numeric validation in the middle layer.
  • Pitfall 5: Running every 30 minutes overnight as well. With very few records generated after hours, this wastes API quota; restricting to the 8-23 window is more economical.

Applicable and Non-Applicable Scenarios

Applicable: After-sales reship / reissue / exchange orders that need to flow from a reconciliation-side representation into SRM, ERP, or data-warehouse detail tables, with code or standard-conversion requirements.

Not applicable: Second-level real-time inventory linkage (use a message queue instead); and scenarios where the target database is itself on the reconciliation side and does not need a separate copy.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mysql-p887249-0089-bds-543102ee

Comments