fix snapshot
This commit is contained in:
parent
ffca4ee36d
commit
a569d88694
2 changed files with 29 additions and 16 deletions
|
|
@ -2496,23 +2496,25 @@ export class SalaryPeriodController extends Controller {
|
|||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee, { data: request });
|
||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee, { data: request });
|
||||
let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
|
||||
let total = 100;
|
||||
let _orgProfiles = await new CallAPI().PostData(request, "/org/unauthorize/salary/gen", {
|
||||
let total = 10000;
|
||||
// let _orgProfiles = await new CallAPI().PostData(request, "/org/unauthorize/salary/gen", {
|
||||
let _orgProfiles = await new CallAPI().PostData(request, "/org/unauthorize/new-salary/gen", {
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
pageSize: 10000,
|
||||
keyword: "",
|
||||
year: salaryPeriod.year,
|
||||
period: salaryPeriod.period,
|
||||
});
|
||||
let orgProfiles = _orgProfiles.data;
|
||||
total = _orgProfiles.total;
|
||||
if (total > 100) {
|
||||
const page = Math.ceil(total / 100);
|
||||
if (total > 10000) {
|
||||
const page = Math.ceil(total / 10000);
|
||||
for (let index = 2; index <= page; index++) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "/org/unauthorize/salary/gen", {
|
||||
// .PostData(request, "/org/unauthorize/salary/gen", {
|
||||
.PostData(request, "/org/unauthorize/new-salary/gen", {
|
||||
page: index,
|
||||
pageSize: 100,
|
||||
pageSize: 10000,
|
||||
keyword: "",
|
||||
year: salaryPeriod.year,
|
||||
period: salaryPeriod.period,
|
||||
|
|
@ -2522,14 +2524,15 @@ export class SalaryPeriodController extends Controller {
|
|||
});
|
||||
}
|
||||
}
|
||||
total = 100;
|
||||
total = 10000;
|
||||
let orgProfileEmployees: any;
|
||||
let _orgProfileEmployees = await new CallAPI().PostData(
|
||||
request,
|
||||
"/org/unauthorize/salary/employee/gen",
|
||||
// "/org/unauthorize/salary/employee/gen",
|
||||
"/org/unauthorize/new-salary/employee/gen",
|
||||
{
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
pageSize: 10000,
|
||||
keyword: "",
|
||||
year: salaryPeriod.year,
|
||||
period: salaryPeriod.period,
|
||||
|
|
@ -2537,13 +2540,14 @@ export class SalaryPeriodController extends Controller {
|
|||
);
|
||||
orgProfileEmployees = _orgProfileEmployees.data;
|
||||
total = _orgProfileEmployees.total;
|
||||
if (total > 100) {
|
||||
const page = Math.ceil(total / 100);
|
||||
if (total > 10000) {
|
||||
const page = Math.ceil(total / 10000);
|
||||
for (let index = 2; index <= page; index++) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "/org/unauthorize/salary/employee/gen", {
|
||||
// .PostData(request, "/org/unauthorize/salary/employee/gen", {
|
||||
.PostData(request, "/org/unauthorize/new-salary/employee/gen", {
|
||||
page: index,
|
||||
pageSize: 100,
|
||||
pageSize: 10000,
|
||||
keyword: "",
|
||||
year: salaryPeriod.year,
|
||||
period: salaryPeriod.period,
|
||||
|
|
@ -2585,7 +2589,7 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.group = "GROUP1";
|
||||
await this.salaryOrgRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
|
||||
console.log(`✅ [SNAP: ${snapshot}] บันทึก salaryOrgNew: ${salaryOrgNew.id}`);
|
||||
if (salaryPeriod.period != "SPECIAL") {
|
||||
delete salaryOrgNew.id;
|
||||
salaryOrgNew.group = "GROUP2";
|
||||
|
|
@ -2616,7 +2620,7 @@ export class SalaryPeriodController extends Controller {
|
|||
salaryOrgNew.lastUpdatedAt = new Date();
|
||||
await this.salaryOrgEmployeeRepository.save(salaryOrgNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryOrgNew, after: salaryOrgNew });
|
||||
|
||||
console.log(`✅ [SNAP: ${snapshot}] บันทึก salaryOrgEmployeeNew: ${salaryOrgNew.id}`);
|
||||
if (salaryPeriod.period != "SPECIAL") {
|
||||
delete salaryOrgNew.id;
|
||||
salaryOrgNew.group = "GROUP2";
|
||||
|
|
@ -2686,6 +2690,9 @@ export class SalaryPeriodController extends Controller {
|
|||
}
|
||||
await this.salaryProfileRepository.save(salaryProfileNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||
console.log(`✅ [SNAP: ${snapshot}] บันทึก SalaryProfile: ${salaryProfileNew.citizenId} (${salaryProfileNew.fullName ?? "-"})`);
|
||||
}else{
|
||||
console.warn(`⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrg สำหรับ rootId: ${profile.rootId}`);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -2738,6 +2745,9 @@ export class SalaryPeriodController extends Controller {
|
|||
}
|
||||
await this.salaryProfileEmployeeRepository.save(salaryProfileNew, { data: request });
|
||||
setLogDataDiff(request, { before: beforeSalaryProfileNew, after: salaryProfileNew });
|
||||
console.log(`✅ [SNAP: ${snapshot}] บันทึก SalaryProfileEmployee: ${salaryProfileNew.citizenId} (${salaryProfileNew.fullName ?? "-"})`);
|
||||
}else{
|
||||
console.warn(`⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrgEmployee สำหรับ rootId: ${profile.rootId}`);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue