import excel
This commit is contained in:
parent
022cc04e7b
commit
bfce5ba1ce
1 changed files with 41 additions and 41 deletions
|
|
@ -121,7 +121,7 @@ export class ImportDataController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await this.profileRepo.save(profiles);
|
await this.profileRepo.save(profiles);
|
||||||
return new HttpSuccess(getProFile);
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -173,7 +173,7 @@ export class ImportDataController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await this.profileEmpRepo.save(profiles);
|
await this.profileEmpRepo.save(profiles);
|
||||||
return new HttpSuccess(getProFile);
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -223,7 +223,7 @@ export class ImportDataController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await this.salaryRepository.save(profileSalarys);
|
await this.salaryRepository.save(profileSalarys);
|
||||||
return new HttpSuccess(profileSalarys);
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -273,7 +273,7 @@ export class ImportDataController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await this.salaryRepository.save(profileSalarys);
|
await this.salaryRepository.save(profileSalarys);
|
||||||
return new HttpSuccess(profileSalarys);
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -346,13 +346,13 @@ export class ImportDataController extends Controller {
|
||||||
couples: couples,
|
couples: couples,
|
||||||
};
|
};
|
||||||
|
|
||||||
// await Promise.all([
|
await Promise.all([
|
||||||
// this.profileFamilyFatherRepository.save(fathers),
|
this.profileFamilyFatherRepository.save(fathers),
|
||||||
// this.profileFamilyMotherRepository.save(mothers),
|
this.profileFamilyMotherRepository.save(mothers),
|
||||||
// this.profileFamilyCoupleRepository.save(couples)
|
this.profileFamilyCoupleRepository.save(couples)
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
return new HttpSuccess(result);
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -425,42 +425,42 @@ export class ImportDataController extends Controller {
|
||||||
couples: couples,
|
couples: couples,
|
||||||
};
|
};
|
||||||
|
|
||||||
// await Promise.all([
|
await Promise.all([
|
||||||
// this.profileFamilyFatherRepository.save(fathers),
|
this.profileFamilyFatherRepository.save(fathers),
|
||||||
// this.profileFamilyMotherRepository.save(mothers),
|
this.profileFamilyMotherRepository.save(mothers),
|
||||||
// this.profileFamilyCoupleRepository.save(couples)
|
this.profileFamilyCoupleRepository.save(couples)
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
return new HttpSuccess(result);
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* @summary Import Education Code
|
// * @summary Import Education Code
|
||||||
*/
|
// */
|
||||||
@Post("uploadEducation-Code")
|
// @Post("uploadEducation-Code")
|
||||||
@UseInterceptors(FileInterceptor("file"))
|
// @UseInterceptors(FileInterceptor("file"))
|
||||||
async UploadFileSQLEducationCode(
|
// async UploadFileSQLEducationCode(
|
||||||
@UploadedFile() file: Express.Multer.File,
|
// @UploadedFile() file: Express.Multer.File,
|
||||||
@Request() request: { user: Record<string, any> },
|
// @Request() request: { user: Record<string, any> },
|
||||||
) {
|
// ) {
|
||||||
const workbook = xlsx.read(file.buffer, { type: "buffer" });
|
// const workbook = xlsx.read(file.buffer, { type: "buffer" });
|
||||||
const sheetName = workbook.SheetNames[0]
|
// const sheetName = workbook.SheetNames[0]
|
||||||
const sheet = workbook.Sheets[sheetName];
|
// const sheet = workbook.Sheets[sheetName];
|
||||||
const getExcel = xlsx.utils.sheet_to_json(sheet);
|
// const getExcel = xlsx.utils.sheet_to_json(sheet);
|
||||||
let educationMis_: any = [];
|
// let educationMis_: any = [];
|
||||||
|
|
||||||
await Promise.all(
|
// await Promise.all(
|
||||||
getExcel.map(async (item: any) => {
|
// getExcel.map(async (item: any) => {
|
||||||
const educationMis = new EducationMis();
|
// const educationMis = new EducationMis();
|
||||||
educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
|
// educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
|
||||||
educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
|
// educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
|
||||||
educationMis_.push(educationMis);
|
// educationMis_.push(educationMis);
|
||||||
|
|
||||||
}),
|
// }),
|
||||||
);
|
// );
|
||||||
await this.educationMisRepo.save(educationMis_);
|
// await this.educationMisRepo.save(educationMis_);
|
||||||
return new HttpSuccess(educationMis_);
|
// return new HttpSuccess(educationMis_);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * API upload EDU
|
// * API upload EDU
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue