Incremental Sales Order Query Sync from Jst: A Single-Strategy Deep Dive
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 Field | Type | Meaning | Middle-Layer Handling |
|---|---|---|---|
shop_id | string | Shop code | Required; filter by shop when non-empty |
status | string | Order status | Suggested enums: WaitConfirm / Confirmed / Delete / Cancelled |
so_ids | string | Specific online order numbers | Mutually exclusive with time window; used for backfill |
modified_begin | datetime | Start time | Default bind `{{LAST_SYNC_TIME |
modified_end | datetime | End time | Default bind `{{CURRENT_TIME |
date_type | int | Time field type | Recommend fixing at 2, incremental by modified time |
page_index / page_size | int | Pagination | 50–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
- Time window passes only the start and forgets the end. A typical mistake is to bind
modified_beginto a variable but hard-code or omitmodified_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. - Leaving
statusempty 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 addCancelledwhen needed. - Idempotency key conflicts. If downstream strategies cannot get a stable primary key, write-back duplicates. Here
o_idis the stable key andidCheck=trueis the critical switch—do not turn it off. - Watermark lost when switching full to incremental. After a one-off full run, forgetting to advance
LAST_SYNC_TIMEto the last record causes orders in between to be missed. - 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.