Sync of After-Sales Refund Orders from Jushuitan to DingTalk Return-and-Photo Confirmation Form with Waybill Echo
What This Strategy Solves
"Ship a sample, then return it" is a common after-sales flow in e-commerce: the customer returns the goods, the warehouse confirms, and operations must run a Return-and-Photo Confirmation form through DingTalk, then echo the final waybill number back to the after-sales order in Jushuitan. Running two systems by hand easily leads to missed or mistyped entries. This strategy is delivered on the Qeasy data-integration platform. It uses one single link to incrementally pull after-sales refund orders from Jushuitan into a DingTalk approval instance and then closes the loop by writing the waybill number back.
Data Flow and Field Mapping
The overall direction is: Jushuitan (after-sales order) → Qeasy middleware layer → DingTalk (Return-and-Photo Confirmation process instance), followed by a second hop that echoes the waybill number back to Jushuitan. The source endpoint is /open/refund/single/query (POST, paginated with a time window). The target endpoint is topapi/process/instance/comment/add (POST, DingTalk approval flow comment / field update).
Key field mapping table:
| Business meaning | Jushuitan field | DingTalk carrier | Notes |
|---|---|---|---|
| Document unique id | as_id (number) | processInstanceId | Qeasy idempotency |
| Modified begin | modified_begin | Schedule var DAYS_AGO_1 | Increment anchor |
| Modified end | modified_end | Schedule var CURRENT_TIME | One-shot window |
| Pagination | page_index / page_size | — | 50 per page |
| Time type | date_type=0 | — | By modified time |
| Waybill echo | DingTalk comment / field value | Jushuitan after-sales order custom field | Close the loop |
How to Configure It on Qeasy
- Source collector: pick the Jushuitan "after-sales order query" interface. Set
page_sizeto 50,date_typeto 0, and bindmodified_begin/modified_endto the Qeasy date variables{{DAYS_AGO_1|datetime}}and{{CURRENT_TIME|datetime}}instead of hard-coded values. - Target executor: pick DingTalk's "process instance comment / field write" action. Configure the approval template code and pass the after-sales order id and line items as the request object.
- Centralized code mapping: keep product codes, warehouse codes, and customer codes in a single mapping table that Qeasy can reference inside the strategy, instead of scattering them across many strategies.
- Echo executor: once the DingTalk approval reaches the "shipped" node, Qeasy either listens to a DingTalk callback or polls again on schedule and writes the waybill number back into the extension field of the Jushuitan after-sales order.
- Idempotency switch: turn on the
idCheck=trueflag from the source metadata. Qeasy will deduplicate byas_idto avoid creating duplicate process instances. - Header vs. lines in stages: this strategy first creates the process instance from the header, then appends the line-item fields through comments. Qeasy's "staged write" option lets you toggle the two phases separately.
Implementation Steps
We split the rollout into four steps to avoid crushing the warehouse and approvers with one big full sync.
- Initialize the increment anchor: run a full pull once and pin
modified_beginto 00:00 of the previous day. Historical documents only generate DingTalk process instances, no waybill echo. - Configure a gray launch: start with one to three warehouses or one customer-service group to validate that process instances are correct and the echo fields align.
- Turn on the production schedule: source at
1-59/9 7-23 * * *(every 9 minutes), target at1-59/10 7-23 * * *(offset by one minute to avoid write spikes); stop running at night to reduce noise. - Full recheck and echo backfill: on a fixed day every month, run a full reconciliation script that scans for unclosed documents and backfills missing waybill numbers. Keep increment and full-recheck running as twin tracks.
Lessons from the Field
- Source rejects windows longer than 7 days: when
modified_beginandmodified_endare more than 7 days apart, the Jushuitan endpoint errors out. The safe pattern is to add a "window validation" pre-node inside Qeasy so oversized windows are auto-chunked. - Forgetting to lock date_type causes missed documents: the default is modified time, but operations staff editing fields in Jushuitan can refresh that timestamp. Switch to created time or confirmation time when needed and expose it as a parameterized config in Qeasy.
- Duplicate DingTalk process instances: without deduplication, the same after-sales order is re-fetched every 9 minutes and a new process is created each time. Always enable
idCheckand let Qeasy's storage layer useas_idas the unique key. - Echoing the waybill too early: if you echo the waybill before the DingTalk approval reaches the "shipped" node, Jushuitan will receive an empty value. The safe pattern is to drive the echo from an event-based DingTalk status callback, not by polling for status.
- Public cloud rate limits: a 9-minute interval feels sparse, but when several warehouses run in parallel the cumulative QPS can still trip the source rate limiter. Qeasy recommends staggering multiple strategies across the hour and lowering
page_sizewhen necessary.
When to Use It and When Not To
Use it when: an e-commerce retail after-sales order must bind tightly to an external approval or logistics receipt; the document schema is stable and the modification frequency is controllable; you need a lightweight close-the-loop (waybill echo). Do not use it when: the after-sales schema changes often, the source endpoint is rate-limited and yet you need near real-time, or the approval form is complex and needs humans to fill in fields before the echo — in that case clean up the master data first, then integrate.