Qeasy Cloud
Get Started

Risk Supplier Onboarding Reminder Strategy: Full Configuration from Kingdee Cloud Cosmos Query Filtering to DingTalk Message Routing

· 何海波· Integration Solutions· 40 views· 4 min read

What This Strategy Solves

A manufacturing client uses "risk supplier" as a temporary classification: a risk supplier is frozen in the ERP for 92 days, after which it is auto-disabled if not onboarded. In practice, the business team only remembered to file the onboarding approval around day 85–90, so suppliers were disabled right on the deadline and purchasing was disrupted. We used Qeasy (the data integration platform) to do one focused thing: every morning, query Kingdee Cloud Cosmos for active risk suppliers created more than 80 days but less than 92 days ago, route them by purchasing organization to the corresponding DingTalk groups, and attach remaining days plus action instructions — pushing the onboarding flow forward into the warning window.

Data Flow and Field Mapping

Data flow: Kingdee Cloud Cosmos (QUERY) → Qeasy middleware (filter + compute + assemble) → DingTalk robot (EXECUTE).

Key field mapping:

Target FieldSource Field / RuleMapping Type
robotCodeDingTalk robot code constantCONSTANT
userIdsBranched on F_PUROrgId (purchasing org)TRANSFORM (_function case)
msgKeysampleMarkdownCONSTANT
msgParam.title供应商转正CONSTANT
msgParam.textFNumber/FName/F_PUROrgId/FCreateDate/FAuditDate + remaining-days calculationTRANSFORM (_function CONCAT)

The source FilterString is the heart of this strategy: FUseOrgId.fnumber limits the org, FDocumentStatus='C' for audited, FForbidStatus='A' for active, FCreateDate<=DATEADD(DAY,-80,GETDATE()) and FCreateDate>DATEADD(DAY,-91,GETDATE()) locks the 80–91 day window, and FSupplierClassify.fnumber='03' locks the risk classification.

How to Configure in Qeasy

Source side: pick the Kingdee Cloud Cosmos connector, select the executeBillQuery API on form BD_Supplier, paste the FilterString above verbatim, set primary key FSupplierId and business number FNumber.

Target side: pick the DingTalk connector, API oToMessages/batchSend, four fields in the request body: robotCode as constant, msgKey as constant sampleMarkdown. For userIds, use _function case '{{F_PUROrgId}}' when 'OrgA' then '[...]' when 'OrgB' then '[...]' else '[default]' end — a pattern Qeasy customers often use to centralize org-dimension code mappings rather than configuring each record individually.

Message body: use _function CONCAT to build Markdown. date() formats FCreateDate/FAuditDate into readable dates, and 92-DATEDIFF(date(now()),date('{{FCreateDate}}')) computes remaining days. The concatenated output is a valid JSON string which DingTalk renders as sampleMarkdown.

Implementation Steps

Step 1, confirm FilterString hit count: run the source query manually and check how many suppliers fall in the 80–91 day window. On one client site, the result came back at over 200 — turned out the "risk" classification had been wrongly attached to ordinary suppliers, and after cleanup the count returned to a sensible level.

Step 2, configure target mapping and dry-run: enable the strategy in Qeasy but do not actually send messages; instead print msgParam to manually verify formatting and the remaining-day calculation.

Step 3, schedule it: source crontab 10 7 * * *, target 20 8 * * *. The source runs one hour earlier to leave buffer for data landing and computation. This is a simplified version of the "incremental + full dual-track" pattern common among Qeasy customers — since this strategy itself is a window-based "incremental" filter, there is no need for a separate full sync.

Step 4, observe for a week and tune the threshold: if the daily hit count stabilizes at 5–10 within the window, the window boundaries are reasonable.

Lessons Learned from the Field

  1. FilterString boundary < vs <=: boundary conditions are the easiest place to break things. The window is 80–91 days inclusive of 80, exclusive of 92. Get the boundary wrong and the day-92 batch is missed, the supplier is disabled that day, no reminder is sent to the DingTalk group, and the business team explodes.

  2. Missing else in _function case: suppliers outside the listed orgs get NULL for userIds, the DingTalk API silently drops them, no error is raised. The safe approach is to always provide an else default list as a fallback.

  3. DATEDIFF unit confusion: in SQL DATEDIFF defaults to days, which matches the "remaining days" semantics here. But if the logic ever changes to compute hours and the unit is forgotten, the remaining-day count balloons into the thousands.

  4. msgParam not serialized as a JSON string: CONCAT output must be a valid JSON string with proper double-quote nesting; otherwise DingTalk returns 400. Always debug-print inside Qeasy first.

  5. Robot disabled or group disbanded without notice: when a DingTalk robot is disabled, the API returns a business-code failure but the strategy may retry and treat it as success. Recommend routing target-side failures to alerts and inspecting weekly.

When This Applies and When It Doesn't

Applies: multi-organization enterprises that need to route window-based business objects to different recipients by dimension, with dynamically computed values (such as remaining days) embedded in the message.

Does not apply: pure master-data push, cross-system CRUD sync, or single-organization enterprises — the latter can simply attach a warning inside the ERP without building a message bridge.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-kingdee-cloud-dingtalk-2624-mom-fxgys-80-92-18a93e10

Comments