# 关联业务导入接口自动补入实体库回测记录 ## 基本信息 - 回测日期:2026-05-06 - 回测范围:员工亲属实体关联、信贷客户实体关联、中介实体关联、招投标供应商四个导入接口 - 文档保存路径:`docs/reports/implementation/2026-05-06-enterprise-autofill-import-retrotest.md` - 测试文件目录:`output/spreadsheet/import-retrotest/` - SQL 文件目录:`output/sql/` ## 回测准备 1. 使用 `sh bin/restart_java_backend.sh restart` 启动后端,后端运行端口为 `62318`。 2. 使用 `bin/mysql_utf8_exec.sh output/sql/2026-05-06-enterprise-autofill-import-retrotest-seed.sql` 写入前置数据。 3. 通过 `/login/test` 获取 `admin` 登录态。 4. 从真实后端接口下载当前导入模板,并基于模板填充第 2 行测试数据: - `/ccdi/staffEnterpriseRelation/importTemplate` - `/ccdi/custEnterpriseRelation/importTemplate` - `/ccdi/intermediary/importEnterpriseRelationTemplate` - `/ccdi/purchaseTransaction/importTemplate` ## 导入接口回测结果 | 类型 | 导入接口 | 任务 ID | 状态 | 成功数 | 失败数 | | --- | --- | --- | --- | --- | --- | | 员工亲属 | `/ccdi/staffEnterpriseRelation/importData` | `934cf8b8-de56-4478-be9c-e2261652c993` | `SUCCESS` | 1 | 0 | | 信贷客户 | `/ccdi/custEnterpriseRelation/importData` | `5f21cd94-307e-4681-9659-64f3d270ef0a` | `SUCCESS` | 1 | 0 | | 中介 | `/ccdi/intermediary/importEnterpriseRelationData` | `9738837f-d657-4078-9d1d-6269ac35ecdc` | `SUCCESS` | 1 | 0 | | 供应商 | `/ccdi/purchaseTransaction/importData` | `0cc37465-98b6-4c98-88be-8b28cbe0f8db` | `SUCCESS` | 1 | 0 | 四个接口均使用 multipart `file` 参数上传基于真实模板生成的 Excel 文件,并轮询对应 `importStatus` 接口至最终状态。 ## 实体库回查结果 使用 `bin/mysql_utf8_exec.sh output/sql/2026-05-06-enterprise-autofill-import-retrotest-verify.sql` 回查实体库与业务表。 | 统一社会信用代码 | 企业名称 | 企业来源 | 数据来源 | 风险等级 | 创建人 | | --- | --- | --- | --- | --- | --- | | `91330100RT20260601` | 导入回测员工亲属自动补入企业 | `EMP_RELATION` | `IMPORT` | `NULL` | `admin` | | `91330100RT20260602` | 导入回测信贷客户自动补入企业 | `CREDIT_CUSTOMER` | `IMPORT` | `NULL` | `admin` | | `91330100RT20260603` | `NULL` | `INTERMEDIARY` | `IMPORT` | `1` | `admin` | | `91330100RT20260604` | 导入回测供应商自动补入企业 | `SUPPLIER` | `IMPORT` | `NULL` | `admin` | 业务表回查结果: | 检查项 | 记录数 | | --- | --- | | `staff_relation` | 1 | | `cust_relation` | 1 | | `intermediary_relation` | 1 | | `purchase_supplier` | 1 | ## 清理结果 使用 `bin/mysql_utf8_exec.sh output/sql/2026-05-06-enterprise-autofill-import-retrotest-cleanup.sql` 删除本轮导入数据、实体库补入数据和测试前置数据。 | 检查项 | 剩余记录数 | | --- | --- | | `enterprise_base_info` | 0 | | `staff_relation` | 0 | | `cust_relation` | 0 | | `intermediary_relation` | 0 | | `purchase_supplier` | 0 | | `purchase_transaction` | 0 | | `staff_family_seed` | 0 | | `intermediary_seed` | 0 | ## 保留导入数据复测 按用户要求保留导入 Excel 模板文件与导入数据后,重新执行一轮导入。本轮没有执行清理 SQL。 1. 确认 `output/spreadsheet/import-retrotest/` 下模板文件和导入文件均保留。 2. 使用 `bin/mysql_utf8_exec.sh output/sql/2026-05-06-enterprise-autofill-import-retrotest-seed-keep-data.sql` 仅补充导入所需前置数据,该脚本不包含删除语句。 3. 复用已保留的四个导入 Excel 文件上传导入接口。 4. 使用 `bin/mysql_utf8_exec.sh output/sql/2026-05-06-enterprise-autofill-import-retrotest-verify.sql` 回查实体库与业务表,确认导入数据保留。 | 类型 | 导入接口 | 任务 ID | 状态 | 成功数 | 失败数 | | --- | --- | --- | --- | --- | --- | | 员工亲属 | `/ccdi/staffEnterpriseRelation/importData` | `da75f851-bc25-4930-8e0f-81dbfeb7e658` | `SUCCESS` | 1 | 0 | | 信贷客户 | `/ccdi/custEnterpriseRelation/importData` | `7eaa18da-aa69-41f6-90f5-acb74d63d1e6` | `SUCCESS` | 1 | 0 | | 中介 | `/ccdi/intermediary/importEnterpriseRelationData` | `ed9931f2-950e-4778-bf5d-d57d702015b8` | `SUCCESS` | 1 | 0 | | 供应商 | `/ccdi/purchaseTransaction/importData` | `0582c091-785c-4c71-af24-9f03375b86ea` | `SUCCESS` | 1 | 0 | 当前保留数据回查结果: | 统一社会信用代码 | 企业名称 | 企业来源 | 数据来源 | 风险等级 | 创建人 | | --- | --- | --- | --- | --- | --- | | `91330100RT20260601` | 导入回测员工亲属自动补入企业 | `EMP_RELATION` | `IMPORT` | `NULL` | `admin` | | `91330100RT20260602` | 导入回测信贷客户自动补入企业 | `CREDIT_CUSTOMER` | `IMPORT` | `NULL` | `admin` | | `91330100RT20260603` | `NULL` | `INTERMEDIARY` | `IMPORT` | `1` | `admin` | | `91330100RT20260604` | 导入回测供应商自动补入企业 | `SUPPLIER` | `IMPORT` | `NULL` | `admin` | | 检查项 | 当前记录数 | | --- | --- | | `staff_relation` | 1 | | `cust_relation` | 1 | | `intermediary_relation` | 1 | | `purchase_supplier` | 1 | ## 结论 员工亲属、信贷客户、中介、供应商四个导入接口均可以正常触发实体库自动补入。实体库来源、数据来源和风险等级与当前实现一致。按最新要求,导入 Excel 模板文件与导入数据已保留。