Files
ALL-teach_sys/frontend_食品/convert_food_projects.py
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含12个产业的完整教务系统前端代码
- 智能启动脚本 (start-industry.sh)
- 可视化产业导航页面 (index.html)
- 项目文档 (README.md)

优化内容:
- 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB
- 添加.gitignore文件避免上传不必要的文件
- 自动依赖管理和智能启动系统

产业列表:
1. 文旅产业 (5150)
2. 智能制造 (5151)
3. 智能开发 (5152)
4. 财经商贸 (5153)
5. 视觉设计 (5154)
6. 交通物流 (5155)
7. 大健康 (5156)
8. 土木水利 (5157)
9. 食品产业 (5158)
10. 化工产业 (5159)
11. 能源产业 (5160)
12. 环保产业 (5161)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:14:14 +08:00

100 lines
3.9 KiB
Python
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.

import json
# 读取食品项目案例数据
with open('网页未导入数据/食品产业/食品项目案例.json', 'r', encoding='utf-8') as f:
food_projects = json.load(f)
# 创建项目列表数据(用于班级项目库)
projects_list = []
# 垂直方向分类映射
direction_map = {
"现代食品工程": "现代食品工程",
"营养配餐与新营养经济店铺经营": "营养配餐与新营养经济店铺经营"
}
for idx, project in enumerate(food_projects, 1):
# 创建列表项
list_item = {
"id": idx,
"name": project["案例名称"],
"description": project.get("所属垂直方向", ""),
"positions": project.get("对应个人简历名称", "").split(",") if project.get("对应个人简历名称") else [],
"unit": project.get("对应单元名称(垂直能力课)", "").split(",")[0] if project.get("对应单元名称(垂直能力课)") else "",
"direction": project.get("所属垂直方向", ""),
"category": "食品产业"
}
projects_list.append(list_item)
# 创建详情数据
projects_details = {}
for idx, project in enumerate(food_projects, 1):
# 解析项目内容
content = project.get("项目案例内容", "")
# 提取概述
overview = ""
if "# 一、项目概述" in content:
overview_start = content.find("# 一、项目概述") + len("# 一、项目概述")
overview_end = content.find("# 二、") if "# 二、" in content else len(content)
overview = content[overview_start:overview_end].strip()
# 提取流程
process = ""
if "# 二、项目整体流程介绍" in content:
process_start = content.find("# 二、项目整体流程介绍") + len("# 二、项目整体流程介绍")
process_end = content.find("# 三、") if "# 三、" in content else len(content)
process = content[process_start:process_end].strip()
# 提取关键技术点
keyPoints = ""
if "# 三、项目案例关键技术点" in content:
keyPoints_start = content.find("# 三、项目案例关键技术点") + len("# 三、项目案例关键技术点")
keyPoints = content[keyPoints_start:].strip()
# 处理岗位信息
positions_str = project.get("对应个人简历名称", "")
positions = []
if positions_str:
for pos in positions_str.split(","):
positions.append({
"level": "技术骨干岗",
"position": pos.strip()
})
detail = {
"id": idx,
"name": project["案例名称"],
"positions": positions,
"unit": project.get("对应单元名称(垂直能力课)", "").split(",")[0] if project.get("对应单元名称(垂直能力课)") else "",
"overview": overview[:2000] if overview else "本项目暂无详细概述",
"process": process[:5000] if process else "本项目暂无流程介绍",
"keyPoints": keyPoints[:3000] if keyPoints else "本项目暂无关键技术点"
}
projects_details[idx] = detail
# 输出统计信息
print(f"共处理 {len(food_projects)} 个食品项目案例")
print(f"生成 {len(projects_list)} 个列表项")
print(f"生成 {len(projects_details)} 个详情项")
# 保存处理后的数据
output = {
"projects_list": projects_list,
"projects_details": projects_details
}
with open('food_projects_converted.json', 'w', encoding='utf-8') as f:
json.dump(output, f, ensure_ascii=False, indent=2)
print("数据已保存到 food_projects_converted.json")
# 显示前3个项目作为示例
print("\n前3个项目示例")
for i in range(min(3, len(projects_list))):
print(f"\n项目 {i+1}:")
print(f" 名称: {projects_list[i]['name']}")
print(f" 方向: {projects_list[i]['direction']}")
print(f" 单元: {projects_list[i]['unit']}")
print(f" 岗位数: {len(projects_list[i]['positions'])}")