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.

54 lines
1.8 KiB

# 02 商机建档内部契约 + 深模块透传
Type: task
Status: resolved
## 目标
把 01 票新增的字段贯通 `OpportunityIntakeSpec``OpportunityIntakeImpl`,让两条入口共享的深模块能落这些字段。
## 改动
### 1. `OpportunityIntakeSpec`(`crm-opportunity/.../intake/OpportunityIntakeSpec.java`)
record 新增组件:
- `BigDecimal projectAmount`
- `String address`
- `String customerRole`
- `Integer isPrimaryIntended`
- `Long keyContactId`
- `String keyContactName`
- `String keyContactCompany`
同步更新 javadoc 的 `@param` 列表。
### 2. `OpportunityIntakeImpl.buildOpportunity`
把新字段 set 进 `Opportunity`
- `projectAmount` / `address` / `keyContactId` / `keyContactNameSnapshot` / `keyContactCompanySnapshot` 直接 set
- `customerRole` / `isPrimaryIntended` 不落主表(它们是 `opportunity_customer` 子表字段)
### 3. `OpportunityIntakeImpl.linkPrimaryCustomer`
现在硬编码 `ROLE_INTENDED` + `isPrimaryIntended=1`,改为按 spec 取值:
- `customerRole`:spec 非空则用,空则回退 `ROLE_INTENDED`(保持线索转入路径兼容)
- `isPrimaryIntended`:spec 非空则用(1 或 0),空则回退 1
**主表冗余刷写按是否主要分支**:
- `isPrimaryIntended == 1` → 刷 `primaryCustomerId` / `primaryCustomerNameSnapshot`
- `isPrimaryIntended == 0` → **不刷**主表主要客户冗余(留空,普通关联不占主客户锚点)
### 4. 调用点同步
`OpportunityCreateServiceImpl``OpportunityCreationPortImpl` 两个 adapter 构造 spec 的位置都要跟上 record 新组件(本票只保证编译通过 + 传 null 或默认值;业务接线在 03 票)。
## 完成标准
- [ ] spec record 扩展 + 两 adapter 编译通过
- [ ] `linkPrimaryCustomer``isPrimaryIntended` 分支刷主表冗余
- [ ] `mvn -pl crm-opportunity compile` 通过