forked from wangziqi/gongxue-base
feat: add college archive fields
This commit is contained in:
@@ -16,10 +16,19 @@ describe('student import workbook', () => {
|
||||
'课堂回访',
|
||||
]);
|
||||
expect(students?.rowCount).toBe(2);
|
||||
const headerRow = students?.getRow(1);
|
||||
const columnByHeader = new Map<string, number>();
|
||||
headerRow?.eachCell((cell, colNumber) => columnByHeader.set(String(cell.value), colNumber));
|
||||
expect(students?.getRow(2).getCell(1).value).toBe('13800138000');
|
||||
expect(students?.getRow(2).getCell(19).value).toBe('pending');
|
||||
expect(students?.getRow(2).getCell(20).value || '').toBe('');
|
||||
expect(students?.getRow(2).getCell(21).value || '').toBe('');
|
||||
expect(students?.getRow(2).getCell(columnByHeader.get('大专院校') || 0).value).toBe(
|
||||
'北京职业技术学院',
|
||||
);
|
||||
expect(students?.getRow(2).getCell(columnByHeader.get('大专专业') || 0).value).toBe(
|
||||
'软件技术',
|
||||
);
|
||||
expect(students?.getRow(2).getCell(columnByHeader.get('录取状态') || 0).value).toBe('pending');
|
||||
expect(students?.getRow(2).getCell(columnByHeader.get('录取院校') || 0).value || '').toBe('');
|
||||
expect(students?.getRow(2).getCell(columnByHeader.get('录取专业') || 0).value || '').toBe('');
|
||||
expect(workbook.getWorksheet('报读班型')?.rowCount).toBe(1);
|
||||
expect(workbook.getWorksheet('考试成绩')?.rowCount).toBe(1);
|
||||
expect(workbook.getWorksheet('课堂回访')?.rowCount).toBe(1);
|
||||
@@ -32,11 +41,22 @@ describe('student import workbook', () => {
|
||||
'手机号*',
|
||||
'姓名*',
|
||||
'目标院校',
|
||||
'大专院校',
|
||||
'大专专业',
|
||||
'建档日期',
|
||||
'文化课最终分',
|
||||
'录取状态',
|
||||
]);
|
||||
students.addRow(['13800138000', '张三', '北京大学', '2024/9/1', 620, 'pending']);
|
||||
students.addRow([
|
||||
'13800138000',
|
||||
'张三',
|
||||
'北京大学',
|
||||
'北京职业技术学院',
|
||||
'软件技术',
|
||||
'2024/9/1',
|
||||
620,
|
||||
'pending',
|
||||
]);
|
||||
|
||||
const enrollments = workbook.addWorksheet('报读班型');
|
||||
enrollments.addRow(['手机号*', '课程类别*', '班型*', '班级名称']);
|
||||
@@ -57,6 +77,8 @@ describe('student import workbook', () => {
|
||||
phone: '13800138000',
|
||||
name: '张三',
|
||||
targetCollege: '北京大学',
|
||||
collegeSchool: '北京职业技术学院',
|
||||
collegeMajor: '软件技术',
|
||||
profileDate: '2024-09-01',
|
||||
cultureFinalScore: 620,
|
||||
admissionStatus: 'pending',
|
||||
|
||||
@@ -14,6 +14,8 @@ export interface StudentImportRow {
|
||||
organizationId?: number;
|
||||
targetCollege?: string;
|
||||
targetMajor?: string;
|
||||
collegeSchool?: string;
|
||||
collegeMajor?: string;
|
||||
subjectDirection?: string;
|
||||
grade?: string;
|
||||
profileDate?: string;
|
||||
@@ -89,6 +91,8 @@ export const STUDENT_IMPORT_COLUMNS: ColumnDef<StudentImportRow>[] = [
|
||||
{ header: '负责人', key: 'supervisor', width: 15, aliases: ['负责人/班主任'] },
|
||||
{ header: '目标院校', key: 'targetCollege', width: 18 },
|
||||
{ header: '目标专业', key: 'targetMajor', width: 22 },
|
||||
{ header: '大专院校', key: 'collegeSchool', width: 18 },
|
||||
{ header: '大专专业', key: 'collegeMajor', width: 22 },
|
||||
{ header: '选科方向', key: 'subjectDirection', width: 14 },
|
||||
{ header: '年级', key: 'grade', width: 10 },
|
||||
{ header: '建档日期', key: 'profileDate', width: 14, kind: 'date' },
|
||||
@@ -302,6 +306,8 @@ export function createStudentImportTemplateWorkbook(): ExcelJS.Workbook {
|
||||
supervisor: '李老师',
|
||||
targetCollege: '北京大学',
|
||||
targetMajor: '计算机科学与技术',
|
||||
collegeSchool: '北京职业技术学院',
|
||||
collegeMajor: '软件技术',
|
||||
subjectDirection: '物化生',
|
||||
grade: '高三',
|
||||
profileDate: '2024-09-01',
|
||||
|
||||
@@ -126,6 +126,8 @@ export class StudentsController {
|
||||
supervisor: s.supervisor || '',
|
||||
targetCollege: profile?.targetCollege || '',
|
||||
targetMajor: profile?.targetMajor || '',
|
||||
collegeSchool: profile?.collegeSchool || '',
|
||||
collegeMajor: profile?.collegeMajor || '',
|
||||
subjectDirection: profile?.subjectDirection || '',
|
||||
grade: profile?.grade || '',
|
||||
profileDate: profile?.profileDate || '',
|
||||
|
||||
@@ -50,7 +50,11 @@ describe('StudentsService — archive lifecycle boundaries', () => {
|
||||
|
||||
it('builds export archive maps from profile and result rows', async () => {
|
||||
const profileRepo = {
|
||||
find: jest.fn().mockResolvedValue([{ studentId: 1, targetCollege: '北京大学' }]),
|
||||
find: jest.fn().mockResolvedValue([{
|
||||
studentId: 1,
|
||||
targetCollege: '北京大学',
|
||||
collegeSchool: '北京职业技术学院',
|
||||
}]),
|
||||
};
|
||||
const resultRepo = {
|
||||
find: jest.fn().mockResolvedValue([{ studentId: 1, admissionStatus: 'pending' }]),
|
||||
@@ -72,6 +76,7 @@ describe('StudentsService — archive lifecycle boundaries', () => {
|
||||
const maps = await service.getArchiveExportMaps([1]);
|
||||
|
||||
expect(maps.profiles.get(1)?.targetCollege).toBe('北京大学');
|
||||
expect(maps.profiles.get(1)?.collegeSchool).toBe('北京职业技术学院');
|
||||
expect(maps.results.get(1)?.admissionStatus).toBe('pending');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -333,6 +333,8 @@ export class StudentsService {
|
||||
return [
|
||||
row.targetCollege,
|
||||
row.targetMajor,
|
||||
row.collegeSchool,
|
||||
row.collegeMajor,
|
||||
row.subjectDirection,
|
||||
row.grade,
|
||||
row.profileDate,
|
||||
@@ -391,6 +393,8 @@ export class StudentsService {
|
||||
const entity = (await this.profileRepo.findOne({ where: { studentId } })) || this.profileRepo.create({ studentId });
|
||||
if (row.targetCollege?.trim()) entity.targetCollege = row.targetCollege.trim();
|
||||
if (row.targetMajor?.trim()) entity.targetMajor = row.targetMajor.trim();
|
||||
if (row.collegeSchool?.trim()) entity.collegeSchool = row.collegeSchool.trim();
|
||||
if (row.collegeMajor?.trim()) entity.collegeMajor = row.collegeMajor.trim();
|
||||
if (row.subjectDirection?.trim()) entity.subjectDirection = row.subjectDirection.trim();
|
||||
if (row.grade?.trim()) entity.grade = row.grade.trim();
|
||||
if (row.profileDate?.trim()) entity.profileDate = row.profileDate.trim();
|
||||
|
||||
Reference in New Issue
Block a user