merge
This commit is contained in:
parent
e1ca3c01c8
commit
99c3eb762e
1 changed files with 11 additions and 9 deletions
|
|
@ -2820,12 +2820,8 @@ export class SalaryPeriodController extends Controller {
|
||||||
console.log("mlength", orgProfileEmployees.length);
|
console.log("mlength", orgProfileEmployees.length);
|
||||||
const profilesEmpToSave: SalaryProfileEmployee[] = [];
|
const profilesEmpToSave: SalaryProfileEmployee[] = [];
|
||||||
console.time("⏱ SalaryProfileEmployee - Total Time");
|
console.time("⏱ SalaryProfileEmployee - Total Time");
|
||||||
// await Promise.all(
|
console.time("⏱ Step5: Process ProfileEmps");
|
||||||
// orgProfileEmployees.map(async (profile: any) => {
|
for (const profile of orgProfileEmployees) {
|
||||||
|
|
||||||
const batchSize = 1000;
|
|
||||||
for (let i = 0; i < orgProfileEmployees.length; i += batchSize) {
|
|
||||||
const profile = orgProfileEmployees.slice(i, i + batchSize);
|
|
||||||
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
|
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
salaryPeriodId: salaryPeriod.id,
|
salaryPeriodId: salaryPeriod.id,
|
||||||
|
|
@ -2884,12 +2880,19 @@ export class SalaryPeriodController extends Controller {
|
||||||
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
||||||
salaryProfileNew.isGood = salaryOld == null ? false : salaryOld.isGood;
|
salaryProfileNew.isGood = salaryOld == null ? false : salaryOld.isGood;
|
||||||
}
|
}
|
||||||
// profilesEmpToSave.push(salaryProfileNew);
|
profilesEmpToSave.push(salaryProfileNew);
|
||||||
|
await this.salaryProfileEmployeeRepository
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(SalaryProfileEmployee)
|
||||||
|
.values(profilesEmpToSave)
|
||||||
|
.orIgnore()
|
||||||
|
.execute();
|
||||||
//console.log(`step10`);
|
//console.log(`step10`);
|
||||||
// console.log(
|
// console.log(
|
||||||
// `✅ [SNAP: ${snapshot}] Push SalaryProfileEmployee: ${salaryProfileNew.citizenId} (${salaryProfileNew.fullName ?? "-"})`,
|
// `✅ [SNAP: ${snapshot}] Push SalaryProfileEmployee: ${salaryProfileNew.citizenId} (${salaryProfileNew.fullName ?? "-"})`,
|
||||||
// );
|
// );
|
||||||
await this.salaryProfileEmployeeRepository.save(salaryProfileNew, { data: request });
|
// await this.salaryProfileEmployeeRepository.save(salaryProfileNew, { data: request });
|
||||||
// await this.salaryProfileEmployeeRepository.save(profilesEmpToSave, { chunk: 100, data: request });
|
// await this.salaryProfileEmployeeRepository.save(profilesEmpToSave, { chunk: 100, data: request });
|
||||||
// setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
// setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2898,7 +2901,6 @@ export class SalaryPeriodController extends Controller {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// );
|
|
||||||
console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
|
console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue