Qeasy Cloud
Get Started

Kingdee Payment Request Query Strategy: From Kingdee Cloud to DingTalk Financial Sync in Practice

· 尹春锐· Integration Solutions· 14 views· 5 min read

What This Strategy Solves

In one retail enterprise, expense reimbursement and payment request flows run on DingTalk approvals, while actual disbursement and general ledger postings remain in Kingdee Cloud. After approval, finance needs approved payment requests synced back into Kingdee Cloud to serve as the basis for generating payment vouchers and recording cash movements. At first glance, this is just "pulling one document over", but the three things that trip teams in real projects are: "approval just passed but the document isn't persisted yet", "code mapping doesn't line up", and "duplicate pushes causing duplicate vouchers". This article focuses on a single concrete strategy: querying the payment request from Kingdee Cloud and delivering it to the DingTalk side for distribution and reconciliation.

Data Flow and Field Mapping

The overall flow is Kingdee Cloud → Qeasy DataHub (datahub) → DingTalk distribution. On the Kingdee side we call the executeBillQuery WebAPI to retrieve both the header and entries of the payment request in one call. The middle layer, Qeasy, handles protocol conversion, field rewrites, incremental start-point control and placeholder writes; the DingTalk side then receives the structured payload and drives the approval flow and distribution.

Key field mapping (header fields):

Business MeaningKingdee Cloud FieldQeasy Middle Layer FieldDingTalk Distribution Field
Internal IDFIDidbiz_id
Bill NumberFBillNobill_noflow_no
Document StatusFDOCUMENTSTATUSdoc_statusstatus
CreatorFCREATORIDcreator_idoriginator
ApproverFAPPROVERIDapprover_idapprover
Creation DateFCREATEDATEcreate_dateapply_date

The entries typically carry applied amount, payment method, payee, and the cost-bearing department. Naming style matches Kingdee; the middle layer applies camelCase or snake_case conversion before sending downstream, sparing the consumer another round of dirty-data cleanup.

How to Configure on Qeasy

Source side (datahub calling Kingdee Cloud) configuration essentials:

  • Protocol: WebAPI, method POST, effect QUERY.
  • API: hardcode executeBillQuery, which is Kingdee Cloud's standard bill query endpoint.
  • Idempotency key: idCheck=true, using FID as the idempotency basis to avoid duplicate records on reruns.
  • Key fields: number=FBillNo, id=FID, so the middle layer can correctly identify what is new.
  • Auto response fill: autoFillResponse=true, letting Qeasy drop the Kingdee response into the intermediate table per the field model — half less scripting during configuration.

Target side (DingTalk distribution) configuration essentials:

  • Use a placeholder "write null operation" (api=写入空操作, effect=EXECUTE) in the template and switch to the real downstream API once it's stable. This is a common Qeasy customer pattern: wire the link first, swap the API later, avoiding being blocked by the downstream's field contract from day one.
  • Also enable idCheck=true, carrying the upstream FBillNo as the business key through the entire chain.

Centralized code mapping is one of the common Qeasy customer patterns. Mapping Kingdee's FCREATORID / FAPPROVERID to DingTalk's originator / approver is best maintained in a single mapping table rather than scattered across per-strategy scripts.

Implementation Steps

In one real project we split it into three phases:

Phase 1: Incremental start point. Use FCREATEDATE >= today 00:00 as the initial query condition to pull all historically approved but un-synced payment requests in one full baseline. Declare FID / FBillNo / FDOCUMENTSTATUS / FCREATORID / FAPPROVERID / FCREATEDATE up front in the request array so you don't have to re-edit the config later to add fields.

Phase 2: Schedule frequency. On the Kingdee source side, set crontab to 0-59/10 8-22 * * * — every 10 minutes from 08:00 to 22:00 on workdays — to catch payment requests that have just been approved. On the target side run a reconciliation batch at 23 2 * * * so even if the middle layer queues up, the overnight job backfills. Incremental + full reconciliation on parallel tracks is a stable pattern many Qeasy customers adopt: incremental follows the approval rhythm during the day, and a second incremental catch-up runs at dawn to close gaps.

Phase 3: Upstream/downstream orchestration. This strategy sits at sequence B in the overall plan and depends on sequence A (the DingTalk distribution link being live), so explicitly declare depends_on in Qeasy's orchestration. Otherwise, data pulled from Kingdee will accumulate because the downstream channel is not yet ready.

Pitfalls and Lessons Learned

  1. Approved but not yet persisted. There is a window of a few to tens of seconds between Kingdee's "approve" action and the document becoming visible to external queries. The classic mistake is to query the moment approval completes. The safer approach is to add a post-condition on the source side like FAPPROVERID IS NOT NULL AND FDOCUMENTSTATUS='Approved' — better to be one cycle late than to miss.
  2. Mixing FID and FBillNo. FID is the DB internal ID and changes across environments; FBillNo is the business number and is stable across booksets. Always use FBillNo as the idempotency key; treat FID as internal linkage only. Once this goes wrong, troubleshooting is painful.
  3. Pushing raw internal user IDs downstream. Sending the raw FCREATORID to DingTalk leaves finance staring at meaningless numbers. Always complete the user-code mapping in the Qeasy middle layer before delivery.
  4. Querying header and entries in one shot. Kingdee's executeBillQuery supports returning both at once, but large payment requests can time out. The stable approach is staged: pull the header first, then pull entries by FID linkage.
  5. Ignoring statuses beyond "Approved". Some enterprises have "re-approved", "revived after cancellation" and similar states. Filtering only FDOCUMENTSTATUS='Approved' misses re-approval cases. Maintain a status whitelist in Qeasy rather than hardcoding strings.

Applicable and Non-Applicable Scenarios

Applicable: approvals live in DingTalk, accounting lives in Kingdee, and payment requests follow a hybrid model — either entered in Kingdee and approved in DingTalk, or initiated in DingTalk, synced to Kingdee, then written back with the approval result. This strategy is especially suited to the "approval done → write back to Kingdee → finance disburses" leg.

Not applicable: scenarios that are purely Kingdee-internal approval, purely DingTalk-internal approval, or do not require write-back to Kingdee's general ledger. It is also not suited to scenarios demanding strict real-time (sub-second) write-back, since executeBillQuery is a periodic pull model, not an event push.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-kingdee-cloud-dingtalk-9407-nb00a2398-58a0857d

Comments