主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
243 lines
8.7 KiB
Python
243 lines
8.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
将现有图片资源复制到 doc/订单班文档资料 目录
|
|
并统一命名格式
|
|
"""
|
|
|
|
import os
|
|
import shutil
|
|
import json
|
|
from pathlib import Path
|
|
|
|
def copy_and_organize_images():
|
|
"""复制并组织图片资源"""
|
|
|
|
# 源目录和目标目录
|
|
source_base = Path("/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/web_frontend/data")
|
|
target_base = Path("/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/doc/订单班文档资料")
|
|
|
|
# 创建目标基础目录
|
|
target_base.mkdir(parents=True, exist_ok=True)
|
|
|
|
# 订单班映射(源目录名 -> 目标目录名)
|
|
order_mapping = {
|
|
"会展策划 notion文稿": "文旅",
|
|
"化妆品电商全链路运营一体化方案 notion文稿": "财经商贸",
|
|
"中高端个性化轻食店铺经营方案 notion文稿": "食品",
|
|
"在线教育平台开发项目 notion文稿": "智能开发",
|
|
"物流输送线节拍优化的PLC与机器人联合调试 notion文稿": "智能制造",
|
|
"同里农文旅宣传片策划案 notion文稿": "视觉设计",
|
|
"某冷链智慧共配中心「百车级」AGV全局交通管制与充电调度系统设计 notion文稿": "交通物流",
|
|
"宁川市滨河防洪堤加固及生态修复工程(一期)投标方案 notion文稿": "土木",
|
|
"心理咨询实务中的AI辅助建议方案 notion文稿": "大健康",
|
|
"光伏晶硅电池片印后AOI检测与分拣单元 notion文稿": "能源",
|
|
"半导体材料综合检测方案拟定与分析报告撰写 notion文稿": "化工",
|
|
"某地表水环境质量考核断面水质采样方案撰写 notion文稿": "环保"
|
|
}
|
|
|
|
processed_count = 0
|
|
|
|
for source_name, target_name in order_mapping.items():
|
|
source_dir = source_base / source_name
|
|
|
|
# 检查源目录是否存在
|
|
if not source_dir.exists():
|
|
print(f"⚠ 源目录不存在: {source_dir}")
|
|
# 尝试其他可能的路径
|
|
alt_source = source_base.parent / "web_result" / "data" / source_name
|
|
if alt_source.exists():
|
|
source_dir = alt_source
|
|
print(f" 使用备用路径: {alt_source}")
|
|
else:
|
|
continue
|
|
|
|
# 创建目标目录结构
|
|
target_dir = target_base / target_name
|
|
target_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
# 创建子目录
|
|
notion_dir = target_dir / "notion文稿"
|
|
notion_dir.mkdir(exist_ok=True)
|
|
|
|
image_dir = notion_dir / "image"
|
|
image_dir.mkdir(exist_ok=True)
|
|
|
|
agent_dir = target_dir / "agent头像"
|
|
agent_dir.mkdir(exist_ok=True)
|
|
|
|
prompt_dir = target_dir / "Agent_prompt"
|
|
prompt_dir.mkdir(exist_ok=True)
|
|
|
|
print(f"\n处理: {source_name} -> {target_name}")
|
|
|
|
# 复制图片文件
|
|
source_image_dir = source_dir / "image"
|
|
if source_image_dir.exists():
|
|
images = list(source_image_dir.glob("*.jpg")) + \
|
|
list(source_image_dir.glob("*.jpeg")) + \
|
|
list(source_image_dir.glob("*.png"))
|
|
|
|
# 分类计数器
|
|
counters = {
|
|
"设计图": 0,
|
|
"展示图": 0,
|
|
"效果图": 0,
|
|
"流程图": 0,
|
|
"场景图": 0,
|
|
"其他": 0
|
|
}
|
|
|
|
image_mapping = {}
|
|
|
|
for img in sorted(images):
|
|
old_name = img.name
|
|
new_name = generate_clean_name(old_name, target_name, counters)
|
|
|
|
target_path = image_dir / new_name
|
|
shutil.copy2(img, target_path)
|
|
|
|
if old_name != new_name:
|
|
image_mapping[old_name] = new_name
|
|
|
|
print(f" ✓ {old_name} -> {new_name}")
|
|
processed_count += 1
|
|
|
|
# 保存映射文件
|
|
if image_mapping:
|
|
mapping_file = notion_dir / "图片映射.json"
|
|
with open(mapping_file, 'w', encoding='utf-8') as f:
|
|
json.dump(image_mapping, f, ensure_ascii=False, indent=2)
|
|
print(f" ✓ 保存映射文件: {mapping_file.name}")
|
|
|
|
# 复制Markdown文件
|
|
md_files = list(source_dir.glob("*.md"))
|
|
for md_file in md_files:
|
|
target_md = notion_dir / md_file.name
|
|
|
|
# 读取内容并更新图片引用
|
|
content = md_file.read_text(encoding='utf-8')
|
|
|
|
# 更新图片路径
|
|
if image_mapping:
|
|
for old_name, new_name in image_mapping.items():
|
|
# 替换各种可能的引用格式
|
|
content = content.replace(f"({old_name})", f"({new_name})")
|
|
content = content.replace(f"(./image/{old_name})", f"(./image/{new_name})")
|
|
content = content.replace(f"(image/{old_name})", f"(image/{new_name})")
|
|
|
|
# 保存更新后的文件
|
|
target_md.write_text(content, encoding='utf-8')
|
|
print(f" ✓ 复制Markdown: {md_file.name}")
|
|
|
|
# 创建图片索引
|
|
create_index(notion_dir, target_name)
|
|
|
|
print(f"\n✅ 完成!共处理 {processed_count} 张图片")
|
|
|
|
def generate_clean_name(filename: str, order_class: str, counters: dict) -> str:
|
|
"""生成规范的文件名"""
|
|
name = Path(filename).stem
|
|
ext = Path(filename).suffix.lower()
|
|
|
|
# 统一扩展名
|
|
if ext == '.jpeg':
|
|
ext = '.jpg'
|
|
|
|
# 特殊处理文旅订单班的Whisk图片
|
|
if order_class == "文旅" and 'Whisk' in name:
|
|
counters["设计图"] += 1
|
|
return f"设计图_{counters['设计图']:02d}{ext}"
|
|
|
|
# 根据关键词分类
|
|
if any(kw in name.lower() for kw in ['设计', 'design', 'whisk', 'cad', '3d', '三维']):
|
|
counters["设计图"] += 1
|
|
return f"设计图_{counters['设计图']:02d}{ext}"
|
|
elif any(kw in name.lower() for kw in ['展示', 'display', 'show', '展台', '展位']):
|
|
counters["展示图"] += 1
|
|
return f"展示图_{counters['展示图']:02d}{ext}"
|
|
elif any(kw in name.lower() for kw in ['效果', 'effect', 'render', '渲染']):
|
|
counters["效果图"] += 1
|
|
return f"效果图_{counters['效果图']:02d}{ext}"
|
|
elif any(kw in name.lower() for kw in ['流程', 'flow', 'process', '步骤']):
|
|
counters["流程图"] += 1
|
|
return f"流程图_{counters['流程图']:02d}{ext}"
|
|
elif any(kw in name.lower() for kw in ['场景', 'scene', '展会', '博览', '会场', '现场']):
|
|
counters["场景图"] += 1
|
|
return f"场景图_{counters['场景图']:02d}{ext}"
|
|
elif name[0].isdigit():
|
|
# 数字开头的文件通常是展示图
|
|
counters["展示图"] += 1
|
|
return f"展示图_{counters['展示图']:02d}{ext}"
|
|
else:
|
|
# 保留有意义的中文名或归类为其他
|
|
if len(name) <= 10 and all(c.isalpha() or c in '、,。' for c in name):
|
|
# 短的纯中文名称保留
|
|
return f"{name}{ext}"
|
|
else:
|
|
counters["其他"] += 1
|
|
return f"图片_{counters['其他']:02d}{ext}"
|
|
|
|
def create_index(notion_dir: Path, order_class: str):
|
|
"""创建图片索引文档"""
|
|
image_dir = notion_dir / "image"
|
|
if not image_dir.exists():
|
|
return
|
|
|
|
images = sorted(list(image_dir.glob("*.jpg")) + list(image_dir.glob("*.png")))
|
|
|
|
if not images:
|
|
return
|
|
|
|
# 分类统计
|
|
categories = {
|
|
"设计图": [],
|
|
"展示图": [],
|
|
"效果图": [],
|
|
"流程图": [],
|
|
"场景图": [],
|
|
"其他": []
|
|
}
|
|
|
|
for img in images:
|
|
name = img.name
|
|
added = False
|
|
for category in ["设计图", "展示图", "效果图", "流程图", "场景图"]:
|
|
if name.startswith(category):
|
|
categories[category].append(name)
|
|
added = True
|
|
break
|
|
if not added:
|
|
categories["其他"].append(name)
|
|
|
|
# 生成索引内容
|
|
content = f"# {order_class}订单班 - 图片资源索引\n\n"
|
|
content += f"**图片总数**: {len(images)} 张\n"
|
|
content += f"**更新时间**: 2025-09-28\n\n"
|
|
|
|
for category, files in categories.items():
|
|
if files:
|
|
content += f"## {category} ({len(files)}张)\n\n"
|
|
for file in files:
|
|
content += f"- {file}\n"
|
|
content += "\n"
|
|
|
|
content += """## 使用说明
|
|
|
|
### Markdown引用格式
|
|
```markdown
|
|

|
|
```
|
|
|
|
### HTML引用格式
|
|
```html
|
|
<img src="./notion文稿/image/设计图_01.jpg" alt="设计图">
|
|
```
|
|
"""
|
|
|
|
# 保存索引文件
|
|
index_file = notion_dir / "图片索引.md"
|
|
index_file.write_text(content, encoding='utf-8')
|
|
print(f" ✓ 创建图片索引: {index_file.name}")
|
|
|
|
if __name__ == "__main__":
|
|
copy_and_organize_images() |