Files
ALL-teach_sys/frontend_食品/update_project_positions.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

81 lines
2.9 KiB
Python

import json
# 读取食品岗位简历数据,建立岗位等级映射
with open('网页未导入数据/食品产业/食品岗位简历.json', 'r', encoding='utf-8') as f:
resumes = json.load(f)
# 创建岗位名称到等级的映射
position_level_map = {}
for resume in resumes:
position_name = resume.get('岗位名称', '')
level = resume.get('等级', '技术骨干岗') # 默认为技术骨干岗
if position_name:
position_level_map[position_name] = level
print(f"共找到 {len(position_level_map)} 个岗位等级映射")
print("\n岗位等级分布:")
level_counts = {}
for pos, level in position_level_map.items():
level_counts[level] = level_counts.get(level, 0) + 1
for level, count in sorted(level_counts.items()):
print(f" {level}: {count} 个岗位")
# 读取项目库mock数据
with open('src/mocks/projectLibraryMock.js', 'r', encoding='utf-8') as f:
mock_content = f.read()
# 读取转换后的食品项目数据
with open('food_projects_converted.json', 'r', encoding='utf-8') as f:
converted_data = json.load(f)
# 更新项目详情中的岗位等级
updated_details = {}
for project_id, detail in converted_data['projects_details'].items():
updated_positions = []
for pos_info in detail.get('positions', []):
position_name = pos_info.get('position', '')
# 查找对应的等级
if position_name in position_level_map:
level = position_level_map[position_name]
else:
# 如果找不到精确匹配,保持原有等级
level = pos_info.get('level', '技术骨干岗')
print(f"警告:岗位 '{position_name}' 未在简历数据中找到,使用默认等级: {level}")
updated_positions.append({
"position": position_name,
"level": level
})
detail['positions'] = updated_positions
updated_details[project_id] = detail
# 同时更新列表数据中的岗位信息
updated_list = []
for item in converted_data['projects_list']:
# 从详情中获取对应的岗位等级信息
detail = updated_details.get(str(item['id']), {})
positions_with_levels = detail.get('positions', [])
# 更新列表项
updated_item = item.copy()
updated_item['positionsWithLevels'] = positions_with_levels
updated_list.append(updated_item)
# 保存更新后的数据
updated_output = {
"projects_list": updated_list,
"projects_details": updated_details
}
with open('food_projects_with_levels.json', 'w', encoding='utf-8') as f:
json.dump(updated_output, f, ensure_ascii=False, indent=2)
print(f"\n已生成更新后的项目数据文件: food_projects_with_levels.json")
# 显示几个示例
print("\n示例项目岗位等级更新:")
for i, (pid, detail) in enumerate(list(updated_details.items())[:3]):
print(f"\n项目 {pid}: {detail['name']}")
for pos in detail['positions'][:3]:
print(f" - {pos['position']}: {pos['level']}")