Files
ALL-teach_sys/frontend_化工/verify_positions_update.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

88 lines
3.2 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 re
def verify_positions_update():
"""验证所有项目的岗位列表是否已正确更新"""
# 读取化工项目案例数据
with open('网页未导入数据/化工产业/化工项目案例.json', 'r', encoding='utf-8') as f:
source_data = json.load(f)
# 读取更新后的mock文件
with open('src/mocks/projectLibraryMock.js', 'r', encoding='utf-8') as f:
mock_content = f.read()
print("=" * 80)
print("岗位列表更新验证报告")
print("=" * 80)
all_correct = True
total_positions_expected = 0
total_positions_found = 0
for i, project in enumerate(source_data, 1):
project_name = project.get('案例名称', '')
positions_str = project.get('适用岗位', '')
# 期望的岗位列表
if positions_str:
expected_positions = [p.strip() for p in positions_str.replace('', ',').split(',') if p.strip()]
else:
expected_positions = []
total_positions_expected += len(expected_positions)
print(f"\n项目 {i}: {project_name}")
print(f" 期望岗位数: {len(expected_positions)}")
# 在mock文件中查找该项目的岗位
# 查找项目ID后的positions数组
# 需要更精确的模式因为positions可能跨多行
pattern = rf'"id":\s*{i}[^{{]*?"positions":\s*\[((?:[^[\]]|\[[^]]*\])*?)\]'
match = re.search(pattern, mock_content, re.DOTALL)
if match:
positions_block = match.group(1)
# 提取所有岗位名称
position_matches = re.findall(r'"position":\s*"([^"]+)"', positions_block)
total_positions_found += len(position_matches)
if len(position_matches) == len(expected_positions):
# 检查每个岗位是否匹配
missing = []
for exp_pos in expected_positions:
if exp_pos not in position_matches:
missing.append(exp_pos)
if missing:
print(f" ❌ 岗位不匹配,缺少: {', '.join(missing)}")
all_correct = False
else:
print(f" ✅ 所有 {len(expected_positions)} 个岗位已正确更新")
else:
print(f" ❌ 岗位数量不匹配: 实际 {len(position_matches)},期望 {len(expected_positions)}")
print(f" 期望: {', '.join(expected_positions)}")
print(f" 实际: {', '.join(position_matches)}")
all_correct = False
else:
print(f" ❌ 未找到项目的positions数组")
all_correct = False
print("\n" + "=" * 80)
print("汇总统计")
print("=" * 80)
print(f"总期望岗位数: {total_positions_expected}")
print(f"总实际岗位数: {total_positions_found}")
if all_correct and total_positions_expected == total_positions_found:
print("\n✅ 所有项目的岗位列表已完全正确更新!")
else:
print("\n❌ 存在更新问题,请检查上述错误信息")
return all_correct
if __name__ == "__main__":
verify_positions_update()