Qeasy Cloud
Get Started

Incremental Sales Order Query Sync from Jst: A Single-Strategy Deep Dive

· 钟家寿· Integration Solutions· 34 views· 3 min read
兴宛堂Jushuitan订单查询Incremental Sync轻易云供应链集成Idempotency

What This Strategy Solves

In a retail supply-chain integration, the ERP acts as the system of record while the e-commerce mid-platform feeds it. Front-end orders land in Jst first, then flow back into the ERP for finance and inventory consolidation. The /open/orders/single/query endpoint is the primary entry for that reverse flow. We isolate this one strategy on the Qeasy data integration platform so that the downstream inventory, shipment, and reconciliation jobs stop playing catch-up.

Data Flow and Field Mapping

Overall flow: Jst → Qeasy datahub middle layer → target write point. In this strategy the target is configured as a no-op write, meaning the strategy only pulls orders into the middle layer and does not write them to the target database directly; downstream strategies consume them on demand. The benefit is that the original order fields are preserved in the middle layer for traceability.

Key field mapping (source → middle layer):

Source FieldTypeMeaningMiddle-Layer Handling
shop_idstringShop codeRequired; filter by shop when non-empty
statusstringOrder statusSuggested enums: WaitConfirm / Confirmed / Delete / Cancelled
so_idsstringSpecific online order numbersMutually exclusive with time window; used for backfill
modified_begindatetimeStart timeDefault bind `{{LAST_SYNC_TIME
modified_enddatetimeEnd timeDefault bind `{{CURRENT_TIME
date_typeintTime field typeRecommend fixing at 2, incremental by modified time
page_index / page_sizeintPagination50–100 per page, cursor-style continuation

Both id and number map to o_id, and idCheck=true is used for idempotent write-back.

How to Configure on Qeasy

First, register Jst as the source platform, fill in endpoint /open/orders/single/query, method=POST, effect=QUERY. Second, bind the request parameters to variables: modified_begin to {{LAST_SYNC_TIME|datetime}} and modified_end to {{CURRENT_TIME|datetime}}, avoiding hard-coded times. Third, use a no-op write at the target end as a placeholder so data lands in the middle-layer model first; switch to the real writer once downstream strategies are stable. Fourth, take o_id as the idempotency key and keep idCheck on, so re-runs do not duplicate.

Implementation Steps

Incremental starting point. For first-time go-live, do a one-off full backfill to pull historical orders into the middle layer, then switch to the normal incremental cadence. A common Qeasy pattern is “incremental plus full dual-track”: after the full run finishes, move LAST_SYNC_TIME forward to the last modified time, then switch to incremental.

Full trigger. Usually invoked by a one-off script that sets modified_begin to a very early date and modified_end to now, runs to completion, records the watermark, and then returns to the regular schedule.

Schedule frequency. The crontab in the source material is 1-59/30 8-19 * * *, i.e., every 30 minutes during business hours. The steady approach is to run on that cadence for one to two weeks, observe the Jst API latency and any missed orders, and then consider tightening. If order volume is high, narrow the window—pull 30 minutes per run—and add pagination in parallel.

Lessons Learned

  1. Time window passes only the start and forgets the end. A typical mistake is to bind modified_begin to a variable but hard-code or omit modified_end, which makes the API error out or return empty. The reliable approach is to bind both with variables and use the same time zone.
  2. Leaving status empty pulls cancelled orders. When the source enum is unrestricted, cancelled orders also flow back, and you only notice it during reconciliation. Fix the common statuses (e.g., WaitConfirm,Confirmed), and add Cancelled when needed.
  3. Idempotency key conflicts. If downstream strategies cannot get a stable primary key, write-back duplicates. Here o_id is the stable key and idCheck=true is the critical switch—do not turn it off.
  4. Watermark lost when switching full to incremental. After a one-off full run, forgetting to advance LAST_SYNC_TIME to the last record causes orders in between to be missed.
  5. Pagination not wired up. When Jst order volume is high, each page returns a fixed number; if the loop does not advance page_index, the run “finishes” after one page.

When It Fits and When It Doesn't

It fits: Jst orders need to flow back into an ERP or data middle platform, business hours are regular, order volume is moderate. It does not fit: scenarios requiring second-level real-time sync, strict consistency on cancel/split logic, or those that need a strong authorization proxy in front of the Jst API.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-p043c87-jushuitan-0533-n3337cbc7-b37bdaa6

Comments