增加项目侧重构文档

This commit is contained in:
strepsiades
2026-03-12 14:54:48 +08:00
parent 758b1c4f77
commit 84b3b7652a
16 changed files with 1485 additions and 458 deletions
+74
View File
@@ -125,3 +125,77 @@
3. 统一 `35KV/XT``CYJD/CBJDB``SVG/SX``ECPG/ECXT` 这类命名差异。
4. 明确 `status``supply_status` 的职责边界。
5.`material_type` 在 schema 层增加统一校验入口。
## 5. 按本轮要求的改造落点
material 是本轮最需要针对性改造的领域之一,因为它当前同时存在:
- 初始化来源分叉
- create 校验分叉
- 下拉来源分叉
### 5.1 初始化
当前 material 初始化不是单源:
- 候选项来自 `contract_config` 里的 product 合同
- 单位和部分展示信息来自 `material_contract_{project_type}` dict
而且 `unit` 现在还挂在 dict `remark` 上。
本轮目标是:
- 明确 `material.material_type` 的正式配置来源
-`label``unit``parts` 等附属字段纳入正式 config 结构
- 去掉“从 dict remark 补单位”这种不适当用法
### 5.2 Create 校验
当前 create 路径里:
- `material_type` 入参本身没有正式 config 校验
- `show_name``unit``contract_product_type_list` 反查
- 随后又会调用合同创建,由合同 service 再做一层 code 白名单校验
这说明 material create 现在不是单一入口校验。
本轮目标是:
-`MaterialService.create()` 开头基于 config 校验 `material_type`
-`get_field_option_map()` 之类的方法直接拿 `label``unit``parts`
- 不再依赖 `contract_product_type_list` 和默认兜底值
### 5.3 下拉列表
当前物资下拉已经部分走 config:
- `/material/material-types``material_types`
- `/material-detail/contract-product-type/list` 也读 `material_types`
但模块里仍保留了旧的硬编码路径:
- `get_material_info_by_code()`
- `get_kit_options()`
- `contract_product_type_list`
本轮目标是:
- 让物资类型和部件列表统一从新的 config 工具返回
- 下拉、初始化、create 校验全部围绕同一套 `material_type` 配置
### 5.4 清理项
material 领域这轮改造完成后,应优先清理:
- `material_contract_*` 中用 `remark` 承载单位的旧逻辑
- `contract_product_type_list` 里只服务于 `material_type` 真源的旧定义
- `get_material_info_by_code()` 这类旧反查入口
## 6. 测试关注点
material 领域 service 层集成测试至少覆盖:
1. 初始化:项目初始化后 material 的 `material_type``show_name``unit` 是否来自目标 config。
2. 下拉:物资类型和部件列表是否来自同一 config,且与初始化同源。
3. Create:合法 `material_type` 能创建,非法 `material_type` 明确报错,不再依赖默认兜底。