Files
online_sys/frontend_大健康/replace_interview_status.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

88 lines
3.3 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.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
print("替换岗位面试状态数据...")
# 读取全产业面试状态数据
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/网页未导入数据/岗位面试状态(全产业).json', 'r', encoding='utf-8') as f:
all_status_data = json.load(f)
# 筛选大健康产业的数据
health_status_data = [item for item in all_status_data if item['所属产业'] == '大健康']
# 转换为前端需要的格式
converted_data = []
for item in health_status_data:
# 根据流程标签和内容确定面试状态显示文本
status_text = item['内容']
# 组装阶段日期信息
stage_date = f"{item['流程标签']}{item['流程时间']}"
converted_item = {
"查询岗位名称": item['查询岗位名称'],
"阶段日期": stage_date,
"面试状态": status_text
}
converted_data.append(converted_item)
print(f"筛选出 {len(converted_data)} 条大健康产业的面试状态数据")
# 备份原文件
original_file = '/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/data/interviewStatus.json'
backup_file = '/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/data/interviewStatus.json.backup_before_health_replace'
with open(original_file, 'r', encoding='utf-8') as f:
original_content = f.read()
with open(backup_file, 'w', encoding='utf-8') as f:
f.write(original_content)
print(f"原文件已备份为: {backup_file}")
# 写入新数据
with open(original_file, 'w', encoding='utf-8') as f:
json.dump(converted_data, f, ensure_ascii=False, indent=2)
print("✓ 面试状态数据替换完成!")
# 处理状态图片文件
status_images_map = {
"简历筛选未通过": "1-off_初筛未通过.json",
"面试未通过": "2-off_面试未通过.json",
"未参与面试": "3-off_未参与面试.json",
"Offer已拒绝": "4-off_拒绝Offer.json",
"Offer已接收": "4-on_收到Offer.json",
"已收到Offer": "4-on_收到Offer.json"
}
# 创建状态图片映射配置
public_images_dir = '/Users/apple/Documents/cursor/教务系统/frontend_大健康/public/images/interview-status/'
status_files_dir = '/Users/apple/Documents/cursor/教务系统/frontend_大健康/网页未导入数据/岗位面试状态/'
# 确保目标目录存在
os.makedirs(public_images_dir, exist_ok=True)
print("\n处理状态展开内容文件...")
# 为每个状态创建对应的展开内容JSON文件
status_details_map = {}
for status_key, json_filename in status_images_map.items():
json_path = os.path.join(status_files_dir, json_filename)
if os.path.exists(json_path):
with open(json_path, 'r', encoding='utf-8') as f:
status_details_map[status_key] = json.load(f)
print(f"✓ 读取状态详情文件: {json_filename}")
# 创建一个合并的状态详情文件
merged_status_file = '/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/data/interviewStatusDetails.json'
with open(merged_status_file, 'w', encoding='utf-8') as f:
json.dump(status_details_map, f, ensure_ascii=False, indent=2)
print(f"\n✓ 创建合并的状态详情文件: interviewStatusDetails.json")
print("\n面试状态数据替换完成!")
print("注意:状态图片文件需要手动复制到 public/images/interview-status/ 目录")