93 lines
2.9 KiB
JavaScript
93 lines
2.9 KiB
JavaScript
|
|
import fs from 'fs';
|
|||
|
|
|
|||
|
|
// 读取财经日历数据
|
|||
|
|
const data = JSON.parse(fs.readFileSync('src/data/financeCalendar.json', 'utf-8'));
|
|||
|
|
|
|||
|
|
// 找出所有AI课程和营销能力课
|
|||
|
|
const aiCourses = [];
|
|||
|
|
const marketingCourses = [];
|
|||
|
|
|
|||
|
|
data.forEach((course, index) => {
|
|||
|
|
if (course['课程阶段(公共课)'] === '终生学习系统') {
|
|||
|
|
aiCourses.push({
|
|||
|
|
index: index,
|
|||
|
|
date: course['日期'],
|
|||
|
|
name: course['公共课'],
|
|||
|
|
time: course['上课时间'],
|
|||
|
|
teacher: course['导师姓名查询']
|
|||
|
|
});
|
|||
|
|
} else if (course['课程阶段(公共课)'] === '营销能力课') {
|
|||
|
|
marketingCourses.push({
|
|||
|
|
index: index,
|
|||
|
|
date: course['日期'],
|
|||
|
|
name: course['公共课'],
|
|||
|
|
time: course['上课时间'],
|
|||
|
|
teacher: course['导师姓名查询']
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 按日期分组
|
|||
|
|
const groupByDate = (courses) => {
|
|||
|
|
const dateMap = {};
|
|||
|
|
courses.forEach(course => {
|
|||
|
|
if (!dateMap[course.date]) {
|
|||
|
|
dateMap[course.date] = [];
|
|||
|
|
}
|
|||
|
|
dateMap[course.date].push(course);
|
|||
|
|
});
|
|||
|
|
return dateMap;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
const aiByDate = groupByDate(aiCourses);
|
|||
|
|
const marketingByDate = groupByDate(marketingCourses);
|
|||
|
|
|
|||
|
|
console.log('=== AI课程(终生学习系统)日期分析 ===');
|
|||
|
|
console.log(`总数:${aiCourses.length}条`);
|
|||
|
|
console.log('\n每个日期的课程:');
|
|||
|
|
Object.keys(aiByDate).sort().forEach(date => {
|
|||
|
|
const courses = aiByDate[date];
|
|||
|
|
if (courses.length > 1) {
|
|||
|
|
console.log(`${date}: ${courses.length}个课程(重复!)`);
|
|||
|
|
courses.forEach(c => {
|
|||
|
|
console.log(` - [${c.index}] ${c.name} (${c.time}) - ${c.teacher}`);
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
console.log(`${date}: ${courses[0].name}`);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
console.log('\n=== 营销能力课日期分析 ===');
|
|||
|
|
console.log(`总数:${marketingCourses.length}条`);
|
|||
|
|
console.log('\n每个日期的课程:');
|
|||
|
|
Object.keys(marketingByDate).sort().forEach(date => {
|
|||
|
|
const courses = marketingByDate[date];
|
|||
|
|
if (courses.length > 1) {
|
|||
|
|
console.log(`${date}: ${courses.length}个课程(重复!)`);
|
|||
|
|
courses.forEach(c => {
|
|||
|
|
console.log(` - [${c.index}] ${c.name} (${c.time}) - ${c.teacher}`);
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
console.log(`${date}: ${courses[0].name}`);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 查找是否有同一天既有AI课程又有营销能力课
|
|||
|
|
console.log('\n=== 同一天有多种类型课程的日期 ===');
|
|||
|
|
const allDates = new Set([...Object.keys(aiByDate), ...Object.keys(marketingByDate)]);
|
|||
|
|
allDates.forEach(date => {
|
|||
|
|
const aiCount = aiByDate[date]?.length || 0;
|
|||
|
|
const marketingCount = marketingByDate[date]?.length || 0;
|
|||
|
|
|
|||
|
|
if (aiCount > 0 && marketingCount > 0) {
|
|||
|
|
console.log(`${date}:`);
|
|||
|
|
console.log(` - AI课程:${aiCount}个`);
|
|||
|
|
if (aiByDate[date]) {
|
|||
|
|
aiByDate[date].forEach(c => console.log(` * ${c.name}`));
|
|||
|
|
}
|
|||
|
|
console.log(` - 营销能力课:${marketingCount}个`);
|
|||
|
|
if (marketingByDate[date]) {
|
|||
|
|
marketingByDate[date].forEach(c => console.log(` * ${c.name}`));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|