เพิ่มเวลาลูกจ้าง

This commit is contained in:
kittapath 2024-11-07 15:55:23 +07:00
parent b1c365a4da
commit 2c1e1dd8ff
9 changed files with 390 additions and 244 deletions

View file

@ -252,7 +252,6 @@ export class ImportDataController extends Controller {
@Post("uploadProfileSalary-Officer")
async UploadFileSQLSalary(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let profileSalarys: any = [];
let null_: any = null;
const [profiles, total] = await AppDataSource.getRepository(Profile)
@ -291,7 +290,6 @@ export class ImportDataController extends Controller {
],
});
// profileSalarys = await [];
await Promise.all(
existingProfile.map(async (item) => {
rowCount++;
@ -322,21 +320,12 @@ export class ImportDataController extends Controller {
profileSalary.lastUpdateFullName = request.user.name;
profileSalary.createdAt = new Date();
profileSalary.lastUpdatedAt = new Date();
// profileSalarys.push(profileSalary);
// await this.salaryRepository.save(profileSalary);
// if (profileSalarys.length === BATCH_SIZE) {
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
await this.salaryRepository.save(profileSalary);
// profileSalarys = await [];
// }
}),
);
// await this.salaryRepository.save(profileSalarys);
// profileSalarys = await [];
}),
);
// await this.salaryRepository.save(profileSalarys);
// }
console.log(rowCount);
return new HttpSuccess();
}
@ -347,7 +336,6 @@ export class ImportDataController extends Controller {
@Post("uploadProfileSalary-Employee")
async UploadFileSQLSalaryEmp(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let profileSalarys: any = [];
let null_: any = null;
const [profiles, total] = await AppDataSource.getRepository(ProfileEmployee)
@ -386,7 +374,6 @@ export class ImportDataController extends Controller {
],
});
profileSalarys = await [];
await Promise.all(
existingProfile.map(async (item) => {
rowCount++;
@ -417,21 +404,13 @@ export class ImportDataController extends Controller {
profileSalary.lastUpdateFullName = request.user.name;
profileSalary.createdAt = new Date();
profileSalary.lastUpdatedAt = new Date();
// profileSalarys.push(profileSalary);
// await this.salaryRepository.save(profileSalary);
// if (profileSalarys.length === BATCH_SIZE) {
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
await this.salaryRepository.save(profileSalary);
// profileSalarys = await [];
// }
}),
);
// await this.salaryRepository.save(profileSalarys);
// profileSalarys = await [];
}),
);
// }
// await this.salaryRepository.save(profileSalarys);
console.log(rowCount);
return new HttpSuccess();
}