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);
|
||||
const profilesEmpToSave: SalaryProfileEmployee[] = [];
|
||||
console.time("⏱ SalaryProfileEmployee - Total Time");
|
||||
// await Promise.all(
|
||||
// orgProfileEmployees.map(async (profile: any) => {
|
||||
|
||||
const batchSize = 1000;
|
||||
for (let i = 0; i < orgProfileEmployees.length; i += batchSize) {
|
||||
const profile = orgProfileEmployees.slice(i, i + batchSize);
|
||||
console.time("⏱ Step5: Process ProfileEmps");
|
||||
for (const profile of orgProfileEmployees) {
|
||||
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriod.id,
|
||||
|
|
@ -2884,12 +2880,19 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryProfileNew.isRetired = salaryOld == null ? false : salaryOld.isRetired;
|
||||
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(
|
||||
// `✅ [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 });
|
||||
// setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||
} else {
|
||||
|
|
@ -2898,7 +2901,6 @@ export class SalaryPeriodController extends Controller {
|
|||
);
|
||||
}
|
||||
}
|
||||
// );
|
||||
console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue