snap and #1741
This commit is contained in:
parent
3c92e500fe
commit
f0ba4c8bfc
2 changed files with 16 additions and 10 deletions
|
|
@ -1611,7 +1611,7 @@ export class SalaryPeriodController extends Controller {
|
||||||
"CONCAT(profile.prefix,profile.firstName,' ',profile.lastName) LIKE :keyword",
|
"CONCAT(profile.prefix,profile.firstName,' ',profile.lastName) LIKE :keyword",
|
||||||
{ keyword: `%${body.keyword}%` },
|
{ keyword: `%${body.keyword}%` },
|
||||||
)
|
)
|
||||||
.orWhere("CONCAT(profile.orgShortName,profile.posMasterNo) LIKE :keyword", {
|
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) LIKE :keyword", {
|
||||||
keyword: `%${body.keyword}%`,
|
keyword: `%${body.keyword}%`,
|
||||||
})
|
})
|
||||||
// .orWhere("profile.citizenId LIKE :keyword", { keyword: `%${body.keyword}%` })
|
// .orWhere("profile.citizenId LIKE :keyword", { keyword: `%${body.keyword}%` })
|
||||||
|
|
@ -2821,10 +2821,9 @@ 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(
|
for (const profile of orgProfileEmployees) {
|
||||||
orgProfileEmployees.map(async (profile: any) => {
|
|
||||||
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
|
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
salaryPeriodId: salaryPeriod.id,
|
salaryPeriodId: salaryPeriod.id,
|
||||||
|
|
@ -2883,21 +2882,28 @@ 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 {
|
||||||
console.warn(
|
console.warn(
|
||||||
`⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrgEmployee สำหรับ rootId: ${profile.rootId}`,
|
`⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrgEmployee สำหรับ rootId: ${profile.rootId}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}),
|
};
|
||||||
);
|
|
||||||
console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
|
console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1135,7 +1135,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
"CONCAT(profile.prefix,profile.firstName,' ',profile.lastName) LIKE :keyword",
|
"CONCAT(profile.prefix,profile.firstName,' ',profile.lastName) LIKE :keyword",
|
||||||
{ keyword: `%${body.keyword}%` },
|
{ keyword: `%${body.keyword}%` },
|
||||||
)
|
)
|
||||||
.orWhere("CONCAT(profile.orgShortName,profile.posMasterNo) LIKE :keyword", {
|
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) LIKE :keyword", {
|
||||||
keyword: `%${body.keyword}%`,
|
keyword: `%${body.keyword}%`,
|
||||||
})
|
})
|
||||||
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) LIKE :keyword", {
|
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) LIKE :keyword", {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue