- 包含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>
210 lines
7.3 KiB
JavaScript
210 lines
7.3 KiB
JavaScript
// 修复智能制造数据问题
|
||
|
||
import fs from 'fs';
|
||
|
||
// 读取智能制造岗位简历数据
|
||
const manufacturingData = JSON.parse(
|
||
fs.readFileSync('网页未导入数据/智能制造产业/智能制造岗位简历.json', 'utf8')
|
||
);
|
||
|
||
// 按岗位群分组
|
||
const groupedData = {};
|
||
manufacturingData.forEach(item => {
|
||
const groupName = item['简历岗位群'];
|
||
if (!groupedData[groupName]) {
|
||
groupedData[groupName] = [];
|
||
}
|
||
groupedData[groupName].push(item);
|
||
});
|
||
|
||
// 转换为industries格式,添加avatar字段
|
||
const industries = Object.entries(groupedData).map(([groupName, positions], index) => {
|
||
const groupId = `manufacturing_${index + 1}`;
|
||
|
||
const positionList = positions.map((pos, posIndex) => ({
|
||
id: `${groupId}_${posIndex + 1}`,
|
||
title: pos['岗位名称'],
|
||
level: pos['岗位等级标签'],
|
||
avatar: pos['简历头像url'] || "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/img/butler_position_avatar/recuPFXZhkWje7.jpeg", // 添加avatar字段
|
||
department: groupName,
|
||
type: "全职",
|
||
experience: getExperienceByLevel(pos['岗位等级标签']),
|
||
education: "大专",
|
||
salary: pos['岗位等级标签'] === '技术骨干岗' ? "8-15K" : "5-10K",
|
||
location: "苏州",
|
||
updateTime: "2024-01-20",
|
||
description: `负责${pos['岗位名称']}相关工作,包括${extractMainTasks(pos['简历内容'])}`,
|
||
requirements: extractRequirements(pos['简历内容'])
|
||
}));
|
||
|
||
const questions = extractQuestions(positions[0]['面试题内容']);
|
||
|
||
return {
|
||
id: groupId,
|
||
name: groupName,
|
||
positions: positionList,
|
||
questions: questions
|
||
};
|
||
});
|
||
|
||
// 根据岗位等级获取经验要求
|
||
function getExperienceByLevel(level) {
|
||
switch(level) {
|
||
case '技术骨干岗': return "2-5年";
|
||
case '基础岗': return "0-2年";
|
||
default: return "1-3年";
|
||
}
|
||
}
|
||
|
||
// 提取主要任务描述
|
||
function extractMainTasks(resumeContent) {
|
||
const taskMatch = resumeContent.match(/### (五)岗位职责[::]?\s*([\s\S]*?)(?=# 二、|$)/);
|
||
if (taskMatch) {
|
||
const tasks = taskMatch[1].split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.slice(0, 3)
|
||
.map(line => line.replace(/^\d+\.\s*/, '').split(',')[0])
|
||
.join('、');
|
||
return tasks || "相关技术工作";
|
||
}
|
||
return "相关技术工作";
|
||
}
|
||
|
||
// 提取岗位要求
|
||
function extractRequirements(resumeContent) {
|
||
const coreMatch = resumeContent.match(/### (一)核心能力\s*([\s\S]*?)(?=###|$)/);
|
||
if (coreMatch) {
|
||
const lines = coreMatch[1].split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.slice(0, 4)
|
||
.map(line => line.replace(/^\d+\.\s*/, '').trim());
|
||
return lines.length > 0 ? lines : ["熟悉相关岗位工作", "具有良好的沟通能力", "有相关工作经验优先"];
|
||
}
|
||
return ["熟悉相关岗位工作", "具有良好的沟通能力", "有相关工作经验优先"];
|
||
}
|
||
|
||
// 提取面试题
|
||
function extractQuestions(questionContent) {
|
||
if (!questionContent) return [];
|
||
|
||
const sections = questionContent.split(/# \w+、/).filter(s => s.trim());
|
||
const questions = [];
|
||
|
||
sections.forEach((section, sectionIndex) => {
|
||
const lines = section.split('\n').filter(line => line.trim());
|
||
const title = lines[0] || `面试题组${sectionIndex + 1}`;
|
||
const subQuestions = [];
|
||
|
||
for (let i = 1; i < lines.length; i++) {
|
||
if (lines[i].match(/^\d+\./)) {
|
||
const question = lines[i].replace(/^\d+\.\s*/, '').trim();
|
||
let answer = "请根据实际情况回答";
|
||
|
||
// 查找答案
|
||
for (let j = i + 1; j < lines.length && j < i + 5; j++) {
|
||
if (lines[j].includes('示例答案') || lines[j].includes('答案:')) {
|
||
answer = lines[j].replace(/.*?示例答案[::]?\s*/, '').replace(/.*?答案[::]?\s*/, '').trim();
|
||
break;
|
||
}
|
||
}
|
||
|
||
subQuestions.push({
|
||
id: `q${sectionIndex}_${subQuestions.length + 1}`,
|
||
question: question,
|
||
answer: answer
|
||
});
|
||
}
|
||
}
|
||
|
||
if (subQuestions.length > 0) {
|
||
questions.push({
|
||
id: `group_q${sectionIndex + 1}`,
|
||
question: title,
|
||
subQuestions: subQuestions.slice(0, 8)
|
||
});
|
||
}
|
||
});
|
||
|
||
return questions;
|
||
}
|
||
|
||
// 生成正确格式的简历模板数据
|
||
const resumeTemplates = {};
|
||
manufacturingData.forEach((item) => {
|
||
const posId = findPositionId(item['岗位名称'], industries);
|
||
if (posId) {
|
||
// 提取项目经历
|
||
const projectMatch = item['简历内容'].match(/### (一)项目名称[::]?\s*(.+)/);
|
||
const positionMatch = item['简历内容'].match(/### (二)实习岗位[::]?\s*(.+)/);
|
||
const timeMatch = item['简历内容'].match(/### (三)实习时间[::]?\s*(.+)/);
|
||
const companyMatch = item['简历内容'].match(/### (四)实习单位[::]?\s*(.+)/);
|
||
const dutiesMatch = item['简历内容'].match(/### (五)岗位职责[::]?\s*([\s\S]*?)(?=# 二、|$)/);
|
||
|
||
// 提取技能
|
||
const coreSkillsMatch = item['简历内容'].match(/### (一)核心能力\s*([\s\S]*?)(?=###|$)/);
|
||
const compoundSkillsMatch = item['简历内容'].match(/### (二)复合能力\s*([\s\S]*?)(?=# 三、|$)/);
|
||
|
||
// 提取个人总结
|
||
const summaryMatch = item['简历内容'].match(/# 三、个人总结\s*([\s\S]*?)$/);
|
||
|
||
resumeTemplates[posId] = {
|
||
resumeContent: item['简历内容'],
|
||
avatar: item['简历头像url'],
|
||
studentInfo: {
|
||
project_experience: {
|
||
project_name: projectMatch ? projectMatch[1].trim() : "智能制造项目",
|
||
position: positionMatch ? positionMatch[1].trim() : item['岗位名称'],
|
||
time_period: timeMatch ? timeMatch[1].trim() : "2023.09 - 2024.01",
|
||
company: companyMatch ? companyMatch[1].trim() : "苏州智能制造有限公司",
|
||
description: dutiesMatch ?
|
||
dutiesMatch[1].trim()
|
||
.split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.map(line => line.replace(/^\d+\.\s*/, ''))
|
||
.join(';\n') : ""
|
||
},
|
||
core_skills: coreSkillsMatch ?
|
||
coreSkillsMatch[1].split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.map(line => line.replace(/^\d+\.\s*/, '').trim()) : [],
|
||
compound_skills: compoundSkillsMatch ?
|
||
compoundSkillsMatch[1].split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.map(line => line.replace(/^\d+\.\s*/, '').trim()) : [],
|
||
personal_summary: summaryMatch ? summaryMatch[1].trim() : ""
|
||
}
|
||
};
|
||
}
|
||
});
|
||
|
||
// 查找岗位ID
|
||
function findPositionId(positionName, industries) {
|
||
for (const industry of industries) {
|
||
const position = industry.positions.find(p => p.title === positionName);
|
||
if (position) return position.id;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
// 输出结果
|
||
const output = {
|
||
industries,
|
||
resumeTemplates,
|
||
totalPositions: industries.reduce((sum, ind) => sum + ind.positions.length, 0),
|
||
totalGroups: industries.length
|
||
};
|
||
|
||
// 写入文件
|
||
fs.writeFileSync('fixedManufacturingData.json', JSON.stringify(output, null, 2), 'utf8');
|
||
|
||
console.log(`修复完成!
|
||
- 岗位群数量: ${output.totalGroups}
|
||
- 岗位总数: ${output.totalPositions}
|
||
- 简历模板数: ${Object.keys(resumeTemplates).length}
|
||
|
||
修复内容:
|
||
- ✅ 添加了岗位avatar字段
|
||
- ✅ 优化了岗位描述和经验要求
|
||
- ✅ 修复了简历模板数据结构
|
||
- ✅ 完善了面试题数据
|
||
`); |