48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
|
|
import fs from 'fs';
|
|||
|
|
import path from 'path';
|
|||
|
|
import { fileURLToPath } from 'url';
|
|||
|
|
|
|||
|
|
const __filename = fileURLToPath(import.meta.url);
|
|||
|
|
const __dirname = path.dirname(__filename);
|
|||
|
|
|
|||
|
|
// 读取财经商贸日历课程表数据
|
|||
|
|
const financeCalendarData = JSON.parse(
|
|||
|
|
fs.readFileSync(path.join(__dirname, '网页未导入数据/财经商贸产业/财经商贸日历课程表.json'), 'utf-8')
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
// 备份当前文件
|
|||
|
|
const backupPath = path.join(__dirname, 'src/data', `intelligentManufacturingCalendar.json.backup_${new Date().toISOString().replace(/[:.]/g, '-')}`);
|
|||
|
|
fs.copyFileSync(
|
|||
|
|
path.join(__dirname, 'src/data/intelligentManufacturingCalendar.json'),
|
|||
|
|
backupPath
|
|||
|
|
);
|
|||
|
|
console.log(`备份已创建: ${backupPath}`);
|
|||
|
|
|
|||
|
|
// 移除"就业管家"字段,保持数据结构一致
|
|||
|
|
const cleanedData = financeCalendarData.map(item => {
|
|||
|
|
const { "就业管家": _, ...restItem } = item;
|
|||
|
|
return restItem;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 写入清理后的数据
|
|||
|
|
fs.writeFileSync(
|
|||
|
|
path.join(__dirname, 'src/data/intelligentManufacturingCalendar.json'),
|
|||
|
|
JSON.stringify(cleanedData, null, 2),
|
|||
|
|
'utf-8'
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
console.log(`成功恢复财经商贸日历课程表原始导师分配,共 ${cleanedData.length} 条记录`);
|
|||
|
|
|
|||
|
|
// 统计导师分配情况
|
|||
|
|
const teacherStats = {};
|
|||
|
|
cleanedData.forEach(item => {
|
|||
|
|
if (item["导师姓名查询"] && item["个人课程表"]) {
|
|||
|
|
const teacher = item["导师姓名查询"];
|
|||
|
|
teacherStats[teacher] = (teacherStats[teacher] || 0) + 1;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
console.log('\n导师课程分配统计:');
|
|||
|
|
Object.entries(teacherStats).forEach(([teacher, count]) => {
|
|||
|
|
console.log(` ${teacher}: ${count} 门课程`);
|
|||
|
|
});
|