You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
2.2 KiB

4 days ago
# 11 — 商机模块客户接口对接(切真源)
**What to build:** 把 crm-opportunity 里之前 A4 未建时的降级 stub 全部切到真实 customer 数据源,让商机侧「关联客户 / 关键联系人 / 客户搜索 / 快速建客户」真正打通客户模块;同时接上 customer 侧「关联商机」页签的反查 port。这是清偿 A4 未建时留下的技术债。
**Blocked by:** 02 — 客户主表 CRUD + 查重校验;03 — 联系人子表;06 — 客户详情页(关联商机 port 定义)
**Status:** ready-for-agent
**背景**:A4 未建期间 crm-opportunity 用了多处降级 stub(返回空列表/仅存引用 id)。customer 建成后需切真源,签名不变。依赖方向只走 `opportunity → customer` 单向;customer 侧「关联商机」反查通过 customer 定义、opportunity 实现的出站 port 解耦(ADR-0029 范式),不形成 Maven 循环。
- [ ] `crm-opportunity/pom.xml` 增加依赖 `crm-customer`(单向,`opportunity → customer`)
- [ ] `OpportunitySubController` / `IOpportunitySubService#listCustomerContacts(customerId)`:stub 返回空列表 → 改调 customer `GET /api/customer/{id}/contacts` 真源;`CustomerContactDTO` 由 stub 字段占位 → 真源填充(签名不变)
- [ ] `searchCustomers(param)`:票 04 D-02「候选客户池降级=取关联客户快照去重」→ 切 customer `POST /api/customer/search`(四维模糊+分页)真源
- [ ] `OpportunityCustomer.customerId`("客户模块 A4 未建:引用 id + 名快照并存"):确认关联真实 customer 记录;`customer_name_snapshot` 免 join 展示保留(快照口径不变)
- [ ] `POST /api/customer/quick-create`(商机弹窗快速建客户入口)真源接线
- [ ] **customer 侧「关联商机」页签**(票 06 定义的 `CustomerOpportunityQueryPort`):在 crm-opportunity 实现该 port(按 customer_id 反查该客户全部商机:名称/编号/阶段/预计金额/负责人/最近更新),供客户详情页签只读展示
- [ ] 回归:切真源后 crm-opportunity 原有关联客户/联系人相关测试仍绿;跨模块调用无循环依赖、`mvn compile` 全绿
- [ ] 清理 stub 上遗留的"A4 未建/降级"注释,改为正式实现说明