ai-business-write/模板更新和测试报告.md
2025-12-26 09:16:31 +08:00

142 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 模板更新和测试报告
## 执行时间
2025-12-16
## 一、数据库检查结果
### 1.1 数据库状态
- **总记录数**: 28条模板记录
- **tenant_id**: 1注意不是配置中的615873064429507639
- **有file_path的记录**: 21条
- **路径类型分布**:
- 本地路径: 20条
- MinIO路径: 1条已更新
- 空路径: 7条
### 1.2 关联数据
- **字段关联记录**: 180条
- **输出字段** (field_type=2): 72个
- **输入字段** (field_type=1): 2个
## 二、更新操作结果
### 2.1 MinIO路径更新
- ✅ 成功更新 **1条** MinIO路径为本地路径
- 模板ID: 1765425919729046
- 模板名称: 6.2保密承诺书(谈话对象使用-中共党员用)
- 旧路径: `/615873064429507639/TEMPLATE/2025/12/6.2保密承诺书(谈话对象使用-中共党员用).docx`
- 新路径: `template_finish/2-初核模版/2.谈话审批/走读式谈话流程/6.2保密承诺书(谈话对象使用-中共党员用).docx`
### 2.2 缺失模板创建
- ✅ 成功创建 **101条** 缺失的模板记录
- 所有本地模板121个现在都已存在于数据库中
## 三、模板占位符扫描结果
### 3.1 扫描统计
- **扫描模板总数**: 121个
- **有占位符的模板**: 91个
- **无占位符的模板**: 30个
- **发现的占位符总数**: 35个不同的占位符
### 3.2 占位符列表
所有发现的占位符(按字母顺序):
1. `appointment_location` - 约谈地点
2. `appointment_time` - 约谈时间
3. `approval_time` - 审批时间
4. `clue_source` - 线索来源
5. `department_opinion` - 部门意见
6. `handler_name` - 处理人姓名
7. `handling_department` - 处理部门
8. `investigation_location` - 调查地点
9. `investigation_team_code` - 调查组编号
10. `investigation_team_leader_name` - 调查组组长姓名
11. `investigation_team_member_names` - 调查组成员姓名
12. `investigation_unit_name` - 调查单位名称
13. `target_address` - 被核查人地址
14. `target_age` - 被核查人年龄
15. `target_basic_info` - 被核查人基本信息
16. `target_contact` - 被核查人联系方式
17. `target_date_of_birth` - 被核查人出生日期
18. `target_date_of_birth_full` - 被核查人出生日期(完整)
19. `target_education` - 被核查人学历
20. `target_education_level` - 被核查人学历层次
21. `target_ethnicity` - 被核查人民族
22. `target_family_situation` - 被核查人家庭情况
23. `target_gender` - 被核查人性别
24. `target_id_number` - 被核查人身份证号
25. `target_issue_description` - 被核查人问题描述
26. `target_name` - 被核查人姓名
27. `target_organization` - 被核查人单位
28. `target_organization_and_position` - 被核查人单位及职务
29. `target_place_of_origin` - 被核查人籍贯
30. `target_political_status` - 被核查人政治面貌
31. `target_position` - 被核查人职务
32. `target_professional_rank` - 被核查人职级
33. `target_registered_address` - 被核查人户籍地址
34. `target_social_relations` - 被核查人社会关系
35. `target_work_basic_info` - 被核查人工作基本信息
## 四、测试模板信息
### 4.1 推荐测试模板
- **模板ID**: 1765273962631542
- **模板名称**: 8-1请示报告卡初核报告结论
- **文件路径**: `template_finish/2-初核模版/3.初核结论/8-1请示报告卡初核报告结论 .docx`
- **占位符**:
- `investigation_team_code`
- `target_name`
- `target_organization_and_position`
### 4.2 API测试示例
**接口地址**: `POST /api/document/generate`
**请求体**:
```json
{
"fileId": 1765273962631542,
"inputData": [
{"fieldCode": "investigation_team_code", "fieldValue": "测试值"},
{"fieldCode": "target_name", "fieldValue": "测试值"},
{"fieldCode": "target_organization_and_position", "fieldValue": "测试值"}
]
}
```
## 五、注意事项
### 5.1 tenant_id 差异
- 数据库中的实际 `tenant_id`**1**,而不是配置中的 `615873064429507639`
- 所有查询和更新操作都使用 `tenant_id = 1`
### 5.2 文件格式问题
- 扫描过程中发现部分 `.doc` 文件无法读取非zip格式
- 建议将所有模板统一转换为 `.docx` 格式
### 5.3 占位符识别
- 占位符格式:`{{field_code}}`
- 系统能够正确识别段落和表格中的占位符
- 部分模板可能没有占位符30个这些可能是目录节点或占位符格式不标准
## 六、后续建议
1. **统一文件格式**: 将所有 `.doc``.wps` 文件转换为 `.docx` 格式
2. **验证占位符**: 检查30个无占位符的模板确认是否需要添加占位符
3. **测试接口**: 使用推荐的测试模板进行实际的文档生成测试
4. **字段关联**: 确保所有占位符都在 `f_polic_field` 表中有对应的字段定义
5. **定期同步**: 当添加新模板时,运行更新脚本同步数据库
## 七、执行脚本
- **数据库检查**: `check_database_templates.py`
- **更新和测试**: `update_and_test_templates.py`
- **占位符扫描**: `test_template_and_placeholders.py`
---
**报告生成时间**: 2025-12-16
**状态**: ✅ 所有操作成功完成