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",
|
||||
{ keyword: `%${body.keyword}%` },
|
||||
)
|
||||
.orWhere("CONCAT(profile.orgShortName,profile.posMasterNo) LIKE :keyword", {
|
||||
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) 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);
|
||||
// const profilesEmpToSave: SalaryProfileEmployee[] = [];
|
||||
const profilesEmpToSave: SalaryProfileEmployee[] = [];
|
||||
console.time("⏱ SalaryProfileEmployee - Total Time");
|
||||
await Promise.all(
|
||||
orgProfileEmployees.map(async (profile: any) => {
|
||||
for (const profile of orgProfileEmployees) {
|
||||
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriod.id,
|
||||
|
|
@ -2883,21 +2882,28 @@ 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 });
|
||||
// setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||
} else {
|
||||
console.warn(
|
||||
`⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrgEmployee สำหรับ rootId: ${profile.rootId}`,
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
};
|
||||
console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1135,7 +1135,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
"CONCAT(profile.prefix,profile.firstName,' ',profile.lastName) LIKE :keyword",
|
||||
{ keyword: `%${body.keyword}%` },
|
||||
)
|
||||
.orWhere("CONCAT(profile.orgShortName,profile.posMasterNo) LIKE :keyword", {
|
||||
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) LIKE :keyword", {
|
||||
keyword: `%${body.keyword}%`,
|
||||
})
|
||||
.orWhere("CONCAT(profile.orgShortName,' ',profile.posMasterNo) LIKE :keyword", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue