Practical Guide to Syncing Ungenerated Bills from DiDi Enterprise Edition to MySQL
What This Strategy Solves
An enterprise needs to retain ungenerated bill details from a business travel platform in a local MySQL database for financial reconciliation, expense analysis, and downstream processing. Results can span multiple billing cycles, while repeated retrieval or concurrent writes can create duplicates. In addition, base bill information and business-association information are often stored in separate steps. We use Qeasy and the Qeasy Data Integration Platform to configure a document synchronization strategy. The source is queried by date segments, base data is written first, and the associated business number is then enriched through a business identifier.
Data Flow and Field Mapping
The data flow is: DiDi Enterprise Edition (query) → Qeasy intermediate layer (cleaning, deduplication, and association) → MySQL (detail table). The key fields are:
| Source field | Target field | Processing rule |
|---|---|---|
| unique_key | unique_key | Used as the primary key and checked before insertion |
| order_id | order_id | Retains the business order identifier |
| bill_type | bill_type | Maps the bill type |
| data | data | Stores source detail data |
| exinfo01 | exinfo01 | Serves as the business association identifier |
| Association result | ks_num | Updated after matching the process instance by business identifier |
The source interface uses a GET query. The business type is set to 201 by default, and the date range is controlled by start_date and end_date. The target side writes details through parameterized SQL, then uses unique_key to locate the record and copy the business number from the process instance to ks_num. Do not concatenate SQL with business data; bind every value through parameters.
How to Configure It in Qeasy
Create an “Ungenerated Bill Synchronization” strategy in the Qeasy Data Integration Platform. Select DiDi Enterprise Edition as the source connector and MySQL as the target connector, and configure the strategy for private deployment.
Configure a query action on the source: set the business type to 201, use a segmented start_date and end_date range, use order_id to identify the record count, and use unique_key to identify each returned record. Enable required-field validation, type conversion, and primary-key deduplication in the intermediate layer. Qeasy commonly supports centralized code mapping. Dates, bill types, null values, and status values can therefore be maintained within the current strategy instead of being scattered across scripts.
On the target side, insert the detail first and then perform the association update. The update is located by unique_key, connects the process instance table through exinfo01, and writes the resulting business number to ks_num. We recommend a unique constraint on unique_key. Check the number of affected rows after each write; if it is zero, record an alert instead of treating the step as successful. Grant the database account only the minimum permissions required for the target and necessary association tables, and keep credentials in the platform’s secure configuration.
Implementation Steps
Phase 1: Define the incremental starting point. For initial rollout, first determine the historical backfill range, then use a complete date window as the incremental start, such as the confirmed business activation date. Record the task batch ID, query date range, successful records, failed records, and completion time for traceability.
Phase 2: Trigger the full synchronization. Split the full task into date windows to avoid an overly large request. Write each window to MySQL as soon as it completes. Windows may be retried, but inserts must remain idempotent through unique_key. Association updates can follow a staged header/body pattern: persist the details first, then enrich associations. The second step should depend on successful completion of the first step.
Phase 3: Configure the schedule. The source material provides daily query schedules at 7:30, 13:30, and 17:30, with the target write task running 20 minutes later. In Qeasy, configure the same time windows and establish a dependency so that writing starts only after querying finishes. If tasks overlap or exceed their window, queue them and prohibit concurrent writes to the same target table.
Phase 4: Validate and release. Sample-check the date range, order count, bill type, and associated business number between the source and MySQL. Also inspect duplicate counts, null rates, and association-match rates. After several stable cycles, move the strategy into routine scheduling. Exceptional records should enter a review queue and must not automatically overwrite original details.
Lessons Learned
- The date window is too large. A typical mistake is querying too much historical data at once, causing slow responses, timeouts, or incomplete pagination. Use fixed daily or multi-day windows and retain window cursors.
- Idempotency relies only on application checks. A pre-insert query alone cannot prevent concurrent duplicates. Create a unique constraint on
unique_keyin MySQL so the database is the final idempotency barrier. - Association failures are silently ignored. Continuing after a zero-row update makes a task look successful while leaving missing data. Record an alert and retry the association in a later window.
- Source fields are directly concatenated into SQL. Special characters in order numbers or remarks can break the statement structure. Bind parameters and standardize dates, types, and null values.
- Full and incremental runs overwrite each other. A safer pattern is to use separate incremental and full tracks: use small-window increments for daily operation and auditable full batches for historical repair, with explicit batch identifiers and no unconditional overwrite.
Suitable and Unsuitable Scenarios
This strategy is suitable for a private deployment where ungenerated business-travel bill details must be synchronized to MySQL, enriched with process numbers through a business identifier, and used for financial reconciliation or detail queries. It is not suitable when real-time per-order delivery is required, the source does not support stable pagination, or the target requires complex approval before posting. In those cases, use an event-stream design or build an intermediate business table.