Qeasy Cloud
Get Started

Practical Tutorial: Syncing Kingdee Cloud User Profiles to MySQL via Qeasy

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

What This Strategy Solves (Scenario & Value)

In a private deployment where Kingdee Cloud and a sidecar MySQL coexist, user profiles must stay consistent on both sides. Login accounts, names, forbid status, phone numbers, and user types — any drift and downstream approval flows, document ownership, and mobile login start breaking. In one real project, the business team reconciled HR changes at 12:00 and 18:00 every day; missing those windows affected MES and downstream documents. We used the Qeasy Data Integration Platform to keep things simple: on a fixed schedule, pull the latest user profiles from Kingdee Cloud and persist them reliably and traceably into a MySQL table.

Data Flow & Field Mapping

The flow is "Kingdee Cloud (source) → Qeasy integration layer (middleware) → MySQL (target)". The canonical mapping is:

Business meaningKingdee source fieldMySQL target fieldHandling
Entity primary keyFUserIDFUserIDPrimary key, used for deduplication and idempotency
User accountFUserAccountFUserAccountDirect mapping
User nameFNameFNameDirect mapping
Forbid statusFForbidStatusFForbidStatusDirect mapping
Mobile phoneFPhoneFPhoneDirect mapping
User typeFUserTypeFUserTypeDirect mapping
Registered flagFIsRegisterFIsRegisterDirect mapping
Application orgFAppGroupFAppGroupDirect mapping

The middleware handles type conversion, null cleaning, and light renaming. On the target side, a single INSERT INTO KingDee_User (...) VALUES (...) ON DUPLICATE KEY UPDATE ... covers both insert and update, so downstream code does not have to branch on operation type.

Configuring on Qeasy

For the source, use Kingdee's executeBillQuery with a POST call against the FUserAccount form; the primary key FUserID comes back in the response. In Qeasy's source model, pick the needed fields and let autoFillResponse do the work — no extra modeling required.

For the target, pick MySQL's WebAPI execute channel with api=execute and idCheck=true. The important pattern is to put the SQL into main_sql and the parameterized placeholders into main_params; the platform binds them by field name. This keeps SQL in one place. A pattern we see across Qeasy deployments is centralized code mapping — all platform fields and their descriptions live in strategy metadata, so when Kingdee renames or adds a column you only edit the source model.

Implementation Steps

Step 1 — environment check. The private Qeasy node must be reachable to both the Kingdee API gateway and MySQL, with credentials that can query user profiles and read/write the target table.

Step 2 — full trigger first. Run a full pass once to land all currently active users and verify fields, charset, and null handling. Do not skip this. A classic failure mode is going live with increment-only logic and assuming the table is populated — it is not.

Step 3 — switch to an increment baseline. Let Kingdee's query filter handle increment detection; the platform side just executes and persists.

Step 4 — schedule. In the source material the source crontab is 1 12,18 * * * and the target is 3 12,18 * * * — twice a day, with the target delayed by two minutes to avoid contention. The two windows cover the customer's HR reconciliation moments.

Step 5 — verification and monitoring. After the first run, compare row counts on both sides and keep the delta within a known range. Then watch Qeasy execution logs to make sure each round actually lands data and does not fail silently.

Lessons From the Field

  • Nulls and forbid status semantics: Kingdee returns FForbidStatus as a string; mirror that on the MySQL side. Implicit type conversion is a common pitfall.
  • Update scope on duplicate key: In ON DUPLICATE KEY UPDATE, only refresh the columns involved in this sync. Refreshing every column with values() overwrites un-synced columns with NULL — the classic "more sync, more bugs" trap.
  • Schedule jitter: Source and target running at the exact same minute cause brief pressure spikes; a two-to-three-minute delay is the safe choice.
  • Charset and rare characters in names: CJK extended characters appear in real names. Make sure the MySQL table is utf8mb4, otherwise a single insert fails hard.
  • Forbid vs delete: Kingdee's forbid status is not a delete. Treating it as delete breaks rehire cases and breaks matching later.

When This Fits (and When It Doesn't)

It fits when user profiles need periodic sync, you are on a private deployment, the source is Kingdee Cloud, the target is a relational MySQL database, and you do not need second-level real time. It does not fit when changes are extremely high frequency, when true real time is required, or when the target is not a relational database — those need a messaging or event-streaming design instead.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mysql-kingdee-cloud-2246-user-5c3c055a

Comments