Merge branch 'develop' into adiDev

# Conflicts:
#	src/controllers/ReportController.ts
This commit is contained in:
AdisakKanthawilang 2025-02-25 15:05:57 +07:00
commit e1034f6aca

View file

@ -1112,7 +1112,6 @@ export class ReportController extends Controller {
isActive: true,
},
});
// console.log(">>>>3",salaryPeriodIncrease2_APR);
let salaryOrg2_APR = null;
if (salaryPeriodIncrease2_APR) {
salaryOrg2_APR = await this.salaryOrgRepository.findOne({
@ -1585,7 +1584,7 @@ export class ReportController extends Controller {
: item.type === "FULLHAFT"
? "หนึ่งขั้นครึ่ง"
: "-",
score1: item.result??"-", //ผลการประเมินฯ ครั้งที่ 1
score1: item.result ?? "-", //ผลการประเมินฯ ครั้งที่ 1
score2: "-", //ผลการประเมินฯ ครั้งที่ 2
}))
: null,
@ -1665,7 +1664,7 @@ export class ReportController extends Controller {
: item.type === "FULLHAFT"
? "หนึ่งขั้นครึ่ง"
: "-",
score1: item.result??"-", //ผลการประเมินฯ ครั้งที่ 1
score1: item.result ?? "-", //ผลการประเมินฯ ครั้งที่ 1
score2: "-", //ผลการประเมินฯ ครั้งที่ 2
}))
: null,
@ -2254,7 +2253,7 @@ export class ReportController extends Controller {
},
},
isRetired: true, // เฉพาะคนที่เกษียณ
type: Not(In(["NONE","PENDING"])),
type: Not(In(["NONE", "PENDING"])),
},
order: {
type: "DESC",
@ -4602,7 +4601,7 @@ export class ReportController extends Controller {
const matchingProfile = aprPreviousYearProfileCurrent.find(
(profileAPR) => profileAPR.citizenId === profile.citizenId,
);
if (!matchingProfile) return false;
if (!matchingProfile) return false;
const typeMatch = checkTypeMatch(matchingProfile.type, profile.type);
return typeMatch;
})
@ -4904,7 +4903,7 @@ export class ReportController extends Controller {
amountSpecial: profile.amountSpecial
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
: "-",
score: profile.result??"-",
score: profile.result ?? "-",
reason: null,
};
});
@ -6590,326 +6589,327 @@ export class ReportController extends Controller {
});
}
/**
* API 33
*
* @summary 33
*
* @param {string} id Guid, *Id
*/
@Post("command/33/resume")
async SalaryReport33Resume(
@Body()
body: {
result: {
id: string;
refCommandNo: string;
templateDoc: string;
mpCee?: string | null;
refCommandCode?: string | null;
refCommandName?: string | null;
}[];
},
@Request() request: RequestWithUser,
) {
await Promise.all(
body.result.map(async (v) => {
const salary = await this.salaryProfileRepository.findOne({
where: {
id: v.id,
},
});
// /**
// * API ออกคำสั่ง 33
// *
// * @summary ออกคำสั่ง 33
// *
// * @param {string} id Guid, *Id ผังเงินเดือน
// */
// @Post("command/33/resume")
// async SalaryReport33Resume(
// @Body()
// body: {
// result: {
// id: string;
// refCommandNo: string;
// templateDoc: string;
// mpCee?: string | null;
// refCommandCode?: string | null;
// refCommandName?: string | null;
// }[];
// },
// @Request() request: RequestWithUser,
// ) {
// await Promise.all(
// body.result.map(async (v) => {
// const salary = await this.salaryProfileRepository.findOne({
// where: {
// id: v.id,
// },
// });
if (salary != null) {
await new CallAPI()
.PostData(request, "/org/profile/salary", {
profileId: salary.profileId,
date: new Date(),
amount: salary.positionSalaryAmount,
positionSalaryAmount: salary.amountSpecial,
mouthSalaryAmount: null,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
positionLine: null,
positionPathSide: null,
positionExecutive: salary.posExecutive,
positionType: salary.posType,
positionLevel: salary.posLevel,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
})
.then(async () => {
const before = null;
salary.status = "DONE";
salary.lastUpdateUserId = request.user.sub;
salary.lastUpdateFullName = request.user.name;
salary.lastUpdatedAt = new Date();
await this.salaryProfileRepository.save(salary, { data: request });
setLogDataDiff(request, { before, after: salary });
});
}
}),
);
return new HttpSuccess();
}
// if (salary != null) {
// await new CallAPI()
// .PostData(request, "/org/profile/salary", {
// profileId: salary.profileId,
/**
* API 34
*
* @summary 34
*
* @param {string} id Guid, *Id
*/
@Post("command/34/resume")
async SalaryReport34Resume(
@Body()
body: {
result: {
id: string;
refCommandNo: string;
templateDoc: string;
mpCee?: string | null;
refCommandCode?: string | null;
refCommandName?: string | null;
}[];
},
@Request() request: RequestWithUser,
) {
await Promise.all(
body.result.map(async (v) => {
const salary = await this.salaryProfileRepository.findOne({
where: {
id: v.id,
},
});
if (salary != null) {
await new CallAPI()
.PostData(request, "/org/profile/salary", {
profileId: salary.profileId,
date: new Date(),
amount: salary.positionSalaryAmount,
positionSalaryAmount: salary.amountSpecial,
mouthSalaryAmount: null,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
positionLine: null,
positionPathSide: null,
positionExecutive: salary.posExecutive,
positionType: salary.posType,
positionLevel: salary.posLevel,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
})
.then(async () => {
const before = null;
salary.status = "DONE";
salary.lastUpdateUserId = request.user.sub;
salary.lastUpdateFullName = request.user.name;
salary.lastUpdatedAt = new Date();
await this.salaryProfileRepository.save(salary, { data: request });
setLogDataDiff(request, { before, after: salary });
});
}
}),
);
return new HttpSuccess();
}
// date: new Date(),
// amount: salary.positionSalaryAmount,
// positionSalaryAmount: salary.amountSpecial,
// mouthSalaryAmount: null,
// posNo: salary.orgShortName + salary.posMasterNo,
// position: salary.position,
// positionLine: null,
// positionPathSide: null,
// positionExecutive: salary.posExecutive,
// positionType: salary.posType,
// positionLevel: salary.posLevel,
// refCommandNo: v.refCommandNo,
// templateDoc: v.templateDoc,
// refCommandCode: v.refCommandCode,
// refCommandName: v.refCommandName,
// })
// .then(async () => {
// const before = null;
// salary.status = "DONE";
// salary.lastUpdateUserId = request.user.sub;
// salary.lastUpdateFullName = request.user.name;
// salary.lastUpdatedAt = new Date();
// await this.salaryProfileRepository.save(salary, { data: request });
// setLogDataDiff(request, { before, after: salary });
// });
// }
// }),
// );
// return new HttpSuccess();
// }
/**
* API 35
*
* @summary 35
*
* @param {string} id Guid, *Id
*/
@Post("command/35/resume")
async SalaryReport35Resume(
@Body()
body: {
result: {
id: string;
refCommandNo: string;
templateDoc: string;
mpCee?: string | null;
refCommandCode?: string | null;
refCommandName?: string | null;
}[];
},
@Request() request: RequestWithUser,
) {
await Promise.all(
body.result.map(async (v) => {
const salary = await this.salaryProfileRepository.findOne({
where: {
id: v.id,
},
});
if (salary != null) {
await new CallAPI()
.PostData(request, "/org/profile/salary", {
profileId: salary.profileId,
date: new Date(),
amount: salary.positionSalaryAmount,
positionSalaryAmount: salary.amountSpecial,
mouthSalaryAmount: null,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
positionLine: null,
positionPathSide: null,
positionExecutive: salary.posExecutive,
positionType: salary.posType,
positionLevel: salary.posLevel,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
})
.then(async () => {
const before = null;
salary.status = "DONE";
salary.lastUpdateUserId = request.user.sub;
salary.lastUpdateFullName = request.user.name;
salary.lastUpdatedAt = new Date();
await this.salaryProfileRepository.save(salary, { data: request });
setLogDataDiff(request, { before, after: salary });
});
}
}),
);
return new HttpSuccess();
}
// /**
// * API ออกคำสั่ง 34
// *
// * @summary ออกคำสั่ง 34
// *
// * @param {string} id Guid, *Id ผังเงินเดือน
// */
// @Post("command/34/resume")
// async SalaryReport34Resume(
// @Body()
// body: {
// result: {
// id: string;
// refCommandNo: string;
// templateDoc: string;
// mpCee?: string | null;
// refCommandCode?: string | null;
// refCommandName?: string | null;
// }[];
// },
// @Request() request: RequestWithUser,
// ) {
// await Promise.all(
// body.result.map(async (v) => {
// const salary = await this.salaryProfileRepository.findOne({
// where: {
// id: v.id,
// },
// });
// if (salary != null) {
// await new CallAPI()
// .PostData(request, "/org/profile/salary", {
// profileId: salary.profileId,
// date: new Date(),
// amount: salary.positionSalaryAmount,
// positionSalaryAmount: salary.amountSpecial,
// mouthSalaryAmount: null,
// posNo: salary.orgShortName + salary.posMasterNo,
// position: salary.position,
// positionLine: null,
// positionPathSide: null,
// positionExecutive: salary.posExecutive,
// positionType: salary.posType,
// positionLevel: salary.posLevel,
// refCommandNo: v.refCommandNo,
// templateDoc: v.templateDoc,
// refCommandCode: v.refCommandCode,
// refCommandName: v.refCommandName,
// })
// .then(async () => {
// const before = null;
// salary.status = "DONE";
// salary.lastUpdateUserId = request.user.sub;
// salary.lastUpdateFullName = request.user.name;
// salary.lastUpdatedAt = new Date();
// await this.salaryProfileRepository.save(salary, { data: request });
// setLogDataDiff(request, { before, after: salary });
// });
// }
// }),
// );
// return new HttpSuccess();
// }
/**
* API 36
*
* @summary 36
*
* @param {string} id Guid, *Id
*/
@Post("command/36/resume")
async SalaryReport36Resume(
@Body()
body: {
result: {
id: string;
refCommandNo: string;
templateDoc: string;
mpCee?: string | null;
refCommandCode?: string | null;
refCommandName?: string | null;
}[];
},
@Request() request: RequestWithUser,
) {
await Promise.all(
body.result.map(async (v) => {
const salary = await this.salaryProfileEmployeeRepository.findOne({
where: {
id: v.id,
},
});
if (salary != null) {
await new CallAPI()
.PostData(request, "/org/profile-employee/salary", {
profileEmployeeId: salary.profileId,
date: new Date(),
amount: salary.positionSalaryAmount,
positionSalaryAmount: salary.amountSpecial,
mouthSalaryAmount: null,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
// positionLine: null,
// positionPathSide: null,
// positionExecutive: null,
positionType: salary.posType,
positionLevel: salary.posLevel ? String(salary.posLevel) : null,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
})
.then(async () => {
const before = null;
salary.status = "DONE";
salary.lastUpdateUserId = request.user.sub;
salary.lastUpdateFullName = request.user.name;
salary.lastUpdatedAt = new Date();
await this.salaryProfileEmployeeRepository.save(salary, { data: request });
setLogDataDiff(request, { before, after: salary });
});
}
}),
);
return new HttpSuccess();
}
// /**
// * API ออกคำสั่ง 35
// *
// * @summary ออกคำสั่ง 35
// *
// * @param {string} id Guid, *Id ผังเงินเดือน
// */
// @Post("command/35/resume")
// async SalaryReport35Resume(
// @Body()
// body: {
// result: {
// id: string;
// refCommandNo: string;
// templateDoc: string;
// mpCee?: string | null;
// refCommandCode?: string | null;
// refCommandName?: string | null;
// }[];
// },
// @Request() request: RequestWithUser,
// ) {
// await Promise.all(
// body.result.map(async (v) => {
// const salary = await this.salaryProfileRepository.findOne({
// where: {
// id: v.id,
// },
// });
// if (salary != null) {
// await new CallAPI()
// .PostData(request, "/org/profile/salary", {
// profileId: salary.profileId,
// date: new Date(),
// amount: salary.positionSalaryAmount,
// positionSalaryAmount: salary.amountSpecial,
// mouthSalaryAmount: null,
// posNo: salary.orgShortName + salary.posMasterNo,
// position: salary.position,
// positionLine: null,
// positionPathSide: null,
// positionExecutive: salary.posExecutive,
// positionType: salary.posType,
// positionLevel: salary.posLevel,
// refCommandNo: v.refCommandNo,
// templateDoc: v.templateDoc,
// refCommandCode: v.refCommandCode,
// refCommandName: v.refCommandName,
// })
// .then(async () => {
// const before = null;
// salary.status = "DONE";
// salary.lastUpdateUserId = request.user.sub;
// salary.lastUpdateFullName = request.user.name;
// salary.lastUpdatedAt = new Date();
// await this.salaryProfileRepository.save(salary, { data: request });
// setLogDataDiff(request, { before, after: salary });
// });
// }
// }),
// );
// return new HttpSuccess();
// }
/**
* API 37
*
* @summary 37
*
* @param {string} id Guid, *Id
*/
@Post("command/37/resume")
async SalaryReport37Resume(
@Body()
body: {
result: {
id: string;
refCommandNo: string;
templateDoc: string;
mpCee?: string | null;
refCommandCode?: string | null;
refCommandName?: string | null;
}[];
},
@Request() request: RequestWithUser,
) {
await Promise.all(
body.result.map(async (v) => {
const salary = await this.salaryProfileEmployeeRepository.findOne({
where: {
id: v.id,
},
});
if (salary != null) {
await new CallAPI()
.PostData(request, "/org/profile-employee/salary", {
profileEmployeeId: salary.profileId,
date: new Date(),
amount: salary.positionSalaryAmount,
positionSalaryAmount: salary.amountSpecial,
mouthSalaryAmount: null,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
positionLine: null,
positionPathSide: null,
positionExecutive: null,
positionType: salary.posType,
positionLevel: salary.posLevel,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
})
.then(async () => {
const before = null;
salary.status = "DONE";
salary.lastUpdateUserId = request.user.sub;
salary.lastUpdateFullName = request.user.name;
salary.lastUpdatedAt = new Date();
await this.salaryProfileEmployeeRepository.save(salary, { data: request });
setLogDataDiff(request, { before, after: salary });
});
}
}),
);
return new HttpSuccess();
}
// /**
// * API ออกคำสั่ง 36
// *
// * @summary ออกคำสั่ง 36
// *
// * @param {string} id Guid, *Id ผังเงินเดือน
// */
// @Post("command/36/resume")
// async SalaryReport36Resume(
// @Body()
// body: {
// result: {
// id: string;
// refCommandNo: string;
// templateDoc: string;
// mpCee?: string | null;
// refCommandCode?: string | null;
// refCommandName?: string | null;
// }[];
// },
// @Request() request: RequestWithUser,
// ) {
// await Promise.all(
// body.result.map(async (v) => {
// const salary = await this.salaryProfileEmployeeRepository.findOne({
// where: {
// id: v.id,
// },
// });
// if (salary != null) {
// await new CallAPI()
// .PostData(request, "/org/profile-employee/salary", {
// profileEmployeeId: salary.profileId,
// date: new Date(),
// amount: salary.positionSalaryAmount,
// positionSalaryAmount: salary.amountSpecial,
// mouthSalaryAmount: null,
// posNo: salary.orgShortName + salary.posMasterNo,
// position: salary.position,
// // positionLine: null,
// // positionPathSide: null,
// // positionExecutive: null,
// positionType: salary.posType,
// positionLevel: salary.posLevel ? String(salary.posLevel) : null,
// refCommandNo: v.refCommandNo,
// templateDoc: v.templateDoc,
// refCommandCode: v.refCommandCode,
// refCommandName: v.refCommandName,
// })
// .then(async () => {
// const before = null;
// salary.status = "DONE";
// salary.lastUpdateUserId = request.user.sub;
// salary.lastUpdateFullName = request.user.name;
// salary.lastUpdatedAt = new Date();
// await this.salaryProfileEmployeeRepository.save(salary, { data: request });
// setLogDataDiff(request, { before, after: salary });
// });
// }
// }),
// );
// return new HttpSuccess();
// }
// /**
// * API ออกคำสั่ง 37
// *
// * @summary ออกคำสั่ง 37
// *
// * @param {string} id Guid, *Id ผังเงินเดือน
// */
// @Post("command/37/resume")
// async SalaryReport37Resume(
// @Body()
// body: {
// result: {
// id: string;
// refCommandNo: string;
// templateDoc: string;
// mpCee?: string | null;
// refCommandCode?: string | null;
// refCommandName?: string | null;
// }[];
// },
// @Request() request: RequestWithUser,
// ) {
// await Promise.all(
// body.result.map(async (v) => {
// const salary = await this.salaryProfileEmployeeRepository.findOne({
// where: {
// id: v.id,
// },
// });
// if (salary != null) {
// await new CallAPI()
// .PostData(request, "/org/profile-employee/salary", {
// profileEmployeeId: salary.profileId,
// date: new Date(),
// amount: salary.positionSalaryAmount,
// positionSalaryAmount: salary.amountSpecial,
// mouthSalaryAmount: null,
// posNo: salary.orgShortName + salary.posMasterNo,
// position: salary.position,
// positionLine: null,
// positionPathSide: null,
// positionExecutive: null,
// positionType: salary.posType,
// positionLevel: salary.posLevel,
// refCommandNo: v.refCommandNo,
// templateDoc: v.templateDoc,
// refCommandCode: v.refCommandCode,
// refCommandName: v.refCommandName,
// })
// .then(async () => {
// const before = null;
// salary.status = "DONE";
// salary.lastUpdateUserId = request.user.sub;
// salary.lastUpdateFullName = request.user.name;
// salary.lastUpdatedAt = new Date();
// await this.salaryProfileEmployeeRepository.save(salary, { data: request });
// setLogDataDiff(request, { before, after: salary });
// });
// }
// }),
// );
// return new HttpSuccess();
// }
/**
* API 33
@ -7944,16 +7944,16 @@ export class ReportController extends Controller {
// commandAffectDate: Date | null;//เก่า
commandDateAffect: Date | null; //ใหม่ (ปรับตาม rabbitMQ ORG)
commandNo: string | null;
commandId?: string | null;
commandYear: number;
templateDoc: string | null;
commandYear: number | null;
commandId: string | null;
remark: string | null;
amount: Double | null;
amountSpecial: Double | null;
amountSpecial?: Double | null;
positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null;
mpCee?: string | null;
refCommandCode?: string | null;
refCommandName?: string | null;
commandCode?: string | null;
commandName?: string | null;
commandDateSign: Date | null;
}[];
},
@Request() request: RequestWithUser,
@ -7970,23 +7970,29 @@ export class ReportController extends Controller {
await new CallAPI()
.PostData(request, "/org/profile/salary/update", {
profileId: salary.profileId,
date: new Date(),
commandDateAffect: v.commandDateAffect,
commandDateSign: v.commandDateSign,
amount: v.amount,
amountSpecial: v.amountSpecial,
commandId: v.commandId,
positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
positionLine: null,
positionPathSide: null,
posNo: salary.posMasterNo.toString(),
posNoAbb: salary.orgShortName,
positionName: salary.position,
positionExecutive: salary.posExecutive,
positionType: salary.posType,
positionLevel: salary.posLevel,
refCommandNo: `${v.commandNo}/${Extension.ToThaiYear(v.commandYear)}`,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
commandId: v.commandId,
remark: v.remark,
orgRoot: salary.root,
orgChild1: salary.child1,
orgChild2: salary.child2,
orgChild3: salary.child3,
orgChild4: salary.child4,
commandCode: v.commandCode,
commandName: v.commandName,
commandNo: v.commandNo,
commandYear: v.commandYear,
})
.then(async () => {
const before = null;
@ -8020,13 +8026,13 @@ export class ReportController extends Controller {
commandDateAffect: Date | null; //ใหม่ (ปรับตาม rabbitMQ ORG)
commandDateSign?: Date | null
commandNo: string | null;
commandYear: number | null;
commandId: string | null;
commandYear: number;
commandCode?: string | null;
commandName?: string | null;
templateDoc?: string | null;
amount: Double | null;
amountSpecial: Double | null;
amountSpecial?: Double | null;
positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null;
mpCee?: string | null;
@ -8048,20 +8054,28 @@ export class ReportController extends Controller {
await new CallAPI()
.PostData(request, "/org/profile-employee/salary/update", {
profileEmployeeId: salary.profileId,
date: new Date(),
commandDateAffect: v.commandDateAffect,
commandDateSign: v.commandDateSign,
amount: v.amount,
amountSpecial: v.amountSpecial,
commandId: v.commandId,
positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount,
posNo: salary.orgShortName + salary.posMasterNo,
position: salary.position,
posNo: salary.posMasterNo.toString(),
posNoAbb: salary.orgShortName,
positionName: salary.position,
positionType: salary.posType,
positionLevel: salary.posLevel ? String(salary.posLevel) : null,
refCommandNo: `${v.commandNo}/${Extension.ToThaiYear(v.commandYear)}`,
templateDoc: v.templateDoc,
refCommandCode: v.refCommandCode,
refCommandName: v.refCommandName,
positionLevel: salary.posLevel,
commandId: v.commandId,
remark: v.remark,
orgRoot: salary.root,
orgChild1: salary.child1,
orgChild2: salary.child2,
orgChild3: salary.child3,
orgChild4: salary.child4,
commandCode: v.commandCode,
commandName: v.commandName,
commandNo: v.commandNo,
commandYear: v.commandYear,
})
.then(async () => {
const before = null;