Files
online_sys/frontend_大健康/batch_update_resumes.py
KQL a7242f0c69 Initial commit: 教务系统在线平台
- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸
- 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB
- 配置完善的.gitignore文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 18:16:55 +08:00

99 lines
3.9 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
# 读取清理后的数据
with open('resume_updates_cleaned.json', 'r', encoding='utf-8') as f:
updates = json.load(f)
# 读取resumeInterviewMock.js
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
mock_content = f.read()
# 首先检查是否存在露营地运营行业
if '"露营地运营":' not in mock_content:
# 需要添加露营地运营行业
print("添加露营地运营行业...")
# 找到resumeTemplates的结束位置
templates_end = mock_content.find('};', mock_content.find('const resumeTemplates'))
if templates_end > 0:
# 在最后一个行业后添加露营地运营
insert_pos = mock_content.rfind(']', 0, templates_end)
if insert_pos > 0:
# 找到适合的插入位置(在最后一个行业数组的']'后)
next_brace = mock_content.find('}', insert_pos)
if next_brace > 0:
# 在最后一个行业后添加逗号和新行业
new_industry = ''',
"露营地运营": []'''
mock_content = mock_content[:next_brace] + new_industry + '\n ' + mock_content[next_brace:]
print("露营地运营行业已添加")
# 保存备份
with open('src/mocks/resumeInterviewMock.js.backup_batch_update', 'w', encoding='utf-8') as f:
f.write(mock_content)
# 为每个岗位创建更新
for update in updates:
position = update['position']
student_info = update['studentInfo']
print(f"\n处理: {position}")
# 根据岗位名称确定行业
industry_map = {
'露营地运营专员': '露营地运营',
'文创产品设计师': '文旅产品设计',
'文创产品策划师': '文旅产品设计',
'文创产品设计师助理': '文旅产品设计',
'品牌策划运营专员': '品牌运营',
'品牌公关': '品牌运营',
'品牌推广专员': '品牌运营',
'ip运营': '品牌运营',
'IP运营总监助理': '品牌运营',
'品牌公关管培生': '品牌运营'
}
industry = industry_map.get(position)
if not industry:
print(f" 警告: 未找到{position}的行业映射")
continue
# 查找该岗位是否已存在于resumeTemplates中
pattern = f'position: "{position}"'
if pattern in mock_content:
print(f" {position} 已存在于简历模板中")
# 检查是否有studentInfo
pos = mock_content.find(pattern)
# 查找这个岗位的结束位置
next_position = mock_content.find('position:', pos + len(pattern))
if next_position == -1:
next_position = len(mock_content)
section = mock_content[pos:next_position]
if 'studentInfo: null' in section or 'studentInfo: {' not in section:
print(f" 需要更新 {position} 的 studentInfo")
# 生成要插入的studentInfo JSON
student_info_json = json.dumps(student_info, ensure_ascii=False, indent=10)
# 调整缩进
student_info_json = student_info_json.replace('\n', '\n ')
# 创建更新文件
with open(f'update_{position.replace("/", "_")}.txt', 'w', encoding='utf-8') as f:
f.write(f"岗位: {position}\n")
f.write(f"行业: {industry}\n")
f.write(f"studentInfo: {student_info_json}\n")
else:
print(f" {position} 不存在于简历模板中,需要创建")
# 创建新岗位数据文件
with open(f'create_{position.replace("/", "_")}.txt', 'w', encoding='utf-8') as f:
f.write(f"岗位: {position}\n")
f.write(f"行业: {industry}\n")
f.write(f"需要在 {industry} 行业下创建新岗位\n")
print("\n已生成所有更新文件")