Qeasy Cloud
Get Started

Practical Tutorial: Querying LingXing Transaction Details (refund & principal)

· 王浩宇· Integration Solutions· 28 views· 4 min read
Kingdee CloudERP供应链集成源端查询策略跨境电商对账轻易云

What This Strategy Solves (Scenario & Value)

In cross-border e-commerce finance reconciliation, refund and principal transaction details are often scattered across the settlement module of the ERP. Business teams need to pull them into a middle layer on time, so they can feed cost accounting, reconciliation reports, and voucher generation in Kingdee Cloud Cosmic (金蝶云星空). In one real project, the customer initially had developers write scripts to call the source API directly, and quickly ran into three headaches: cross-month queries being silently truncated, id field duplication causing downstream primary key conflicts, and no way to tell whether an empty run was a source-side or target-side issue.

The core value of this strategy is to wrap "source-side query + middle-layer landing" into an observable, schedulable, and replayable strategy unit. It does not write target business documents (the target is configured as a "write no-op"); it only stably pulls transaction details from LingXing ERP, preparing data for subsequent sales outbound orders and settlement syncs.

Data Flow & Field Mapping (Source → Middle Layer → Target)

The whole chain is one-way pulling: LingXing ERP (Source) → Qeasy Data Integration Platform (middle layer datahub) → Write No-Op (Target).

The source API is POST /bd/sp/api/open/settlement/transaction/detail/list. Two key request parameters:

Source FieldMeaningValue Notes
startDateStart dateFixed at 2000-01-01, used for the initial full pull
endDateEnd dateDynamically computed as yesterday 23:59:59; cross-month not allowed

The source response is auto-expanded via autoFillResponse: true. Common return fields include type, accountType, and eventType, which identify refund type, account type, and event type respectively. The middle layer stores them in their original structure without business transformation.

The target is intentionally configured as Write No-Op (WebAPI / EXECUTE / empty request and response). Its role is to give the strategy an "observable endpoint" — successful execution means source data has landed, failure triggers an alert.

How to Configure on Qeasy

We use the Qeasy Data Integration Platform (轻易云数据集成平台) to host this. Typical configuration has four parts:

  1. Source platform registration: Select the LingXing adapter, fill in the platform_id and authorization info, and confirm that /bd/sp/api/open/settlement/transaction/detail/list is reachable.
  2. Request parameter orchestration: Hard-code startDate as 2000-01-01. Build endDate using the platform's built-in date function: CONCAT(YEAR(DATE_SUB(NOW(), INTERVAL 1 DAY)),'-',MONTH(...),'-',DAY(...),' 23:59:59') to assemble yesterday's last second. The "cross-month not allowed" restriction is a key constraint for later scheduling.
  3. Response modeling: buildModel: false paired with autoFillResponse: true to auto-build tables; fields follow the source API, with no semantic transformation in the middle layer.
  4. Target no-op write: type=WebAPI, effect=EXECUTE, request=[], response=[], used as the strategy's "placeholder endpoint", so the Qeasy monitoring page shows a complete start/finish status.

For code mapping, we apply the "centralized code mapping management" pattern that Qeasy customers commonly use: enum values such as refund type and account type are maintained centrally in the Qeasy mapping table. Subsequent strategies that actually write Kingdee sales outbound orders reference the same mapping, avoiding one-change-multiple-out-of-sync situations.

Implementation Steps

We split the scheduling into three phases to ensure steady progress:

  • Incremental start point: On first go-live, set startDate to the required business starting point (2000-01-01), set endDate to the day before go-live, trigger manually once to backfill historical data.
  • Full trigger at month boundary: When crossing months (e.g. from January to February), because the source API forbids cross-month queries, you must run once at the end of January and once at the start of February to capture the boundary data on both sides.
  • Schedule frequency: The crontab is currently a placeholder 1 1 1 1 1. In production, change it to run daily in the early morning, with endDate always equal to "yesterday 23:59:59". This avoids cross-month issues while ensuring no data is missed.

Pitfall Review

  1. Cross-month queries silently truncated: The source API explicitly forbids cross-month queries, but if the date function expression is wrong, the response may look complete while only returning a partial month. This is a common pitfall. The safe approach is to add an assertion in Qeasy that halts and alerts whenever startDate and endDate span different months.
  2. Duplicate ids causing downstream conflicts: idCheck: true must be kept. The source id is the transaction detail primary key; disabling it leads to one-to-many issues when downstream systems link vouchers.
  3. No-op target mistakenly deleted: A teammate once thought the target was a no-op and removed it, resulting in a "no target endpoint" error in Qeasy. The placeholder cannot be removed — it provides the "execution complete" signal.
  4. Time zone shift causing one-day data loss: In cross-time-zone projects, the NOW in DATE_SUB(NOW(), INTERVAL 1 DAY) must be explicitly computed in the source system's time zone, otherwise the data for the 1st of each month will lose a day.
  5. Missing fields from auto-built tables: buildModel: false paired with autoFillResponse: true is a normal combination, but if the source returns fields not yet declared, the middle layer will silently drop them. It is recommended to enable "unknown field alerting" in Qeasy.

Applicable and Non-Applicable Scenarios

Applicable: Stable daily pulling of cross-border refund and principal details; providing a "clean middle result set" for downstream Kingdee voucher generation; teams wanting minimal-coupling source-side observability. Not applicable: Scenarios that need to directly generate sales outbound orders or settlement documents (use sync-type strategies instead); scenarios requiring store-level aggregation before writing (the middle layer does not transform); one-time large-scale cross-fiscal-year backfills (should use an offline full-pull channel, not daily scheduling).

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-kingdee-cloud-erp-6274-refund-principal-659c9c9e

Comments