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