From b871a2425aa449ecdacee9423f200912a8efd237 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 27 Feb 2025 14:42:35 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A2=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2=E0=B8=84=E0=B8=A3=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87=20(=E0=B9=83=E0=B8=99=E0=B8=97=E0=B8=B0=E0=B9=80?= =?UTF-8?q?=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileSalaryController.ts | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index cbba0397..d051704a 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -80,6 +80,55 @@ export class ProfileSalaryController extends Controller { return new HttpSuccess(record); } + @Get("tenure/{profileId}") + public async getPositionTenure(@Path() profileId: string, @Request() req: RequestWithUser) { + const position = await AppDataSource.query( + "CALL GetProfileSalaryPosition(?)", + [profileId] + ); + const _position = position.length > 0 ? position[0] : [] + const mapPosition = _position.length > 1 + ? _position + .slice(1) + .map((curr: any, index: number) => ({ + year: curr.Years ? Math.floor(Number(curr.Years)) : 0, + month: curr.Months ? Math.floor(Number(curr.Months)) : 0, + day: curr.Days ? Math.floor(Number(curr.Days)) : 0, + name: _position[index]?.positionName + })) + : []; + + const posLevel = [{ + year: 1, + month: 0, + day: 0, + name: "ต้น", + }]; + + const posExecutive = await AppDataSource.query( + "CALL GetProfileSalaryExecutive(?)", + [profileId] + ); + const _posExecutive = posExecutive.length > 0 ? posExecutive[0] : [] + const mapPosExecutive = _posExecutive.length > 1 + ? _posExecutive + .slice(1) + .map((curr: any, index: number) => ({ + year: curr.Years ? Math.floor(Number(curr.Years)) : 0, + month: curr.Months ? Math.floor(Number(curr.Months)) : 0, + day: curr.Days ? Math.floor(Number(curr.Days)) : 0, + name: _posExecutive[index]?.positionName + })) + : []; + + return new HttpSuccess({ + position: mapPosition, + posLevel: posLevel, + posExecutive: mapPosExecutive + }); + } + + @Get("admin/{profileId}") public async getSalaryAdmin(@Path() profileId: string, @Request() req: RequestWithUser) { let _workflow = await new permission().Workflow(req, profileId, "SYS_SALARY_OFFICER"); From 7b57a073d6645b6b95215462f81205bacd4a7fe7 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 27 Feb 2025 15:20:13 +0700 Subject: [PATCH 2/2] fix --- src/controllers/CommandController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 77888655..e70ddebd 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -5008,7 +5008,6 @@ export class CommandController extends Controller { statusReport: "DONE", })); await this.posMasterActRepository.save(data); - await Promise.all( posMasters.map(async (item) => { if (item.posMasterChild != null && item.posMasterChild.current_holderId != null) { @@ -5049,6 +5048,7 @@ export class CommandController extends Controller { createdAt: new Date(), lastUpdatedAt: new Date(), commandNo: body.refIds[0].commandNo, + refCommandNo: body.refIds[0].commandNo, commandYear: body.refIds[0].commandYear, posNo: item.posMaster.posMasterNo, posNoAbb: shortName, @@ -5058,7 +5058,7 @@ export class CommandController extends Controller { commandName: body.refIds[0].commandName, remark: body.refIds[0].remark, }; - + const dataAct = new ProfileActposition(); Object.assign(dataAct, metaAct); const historyAct = new ProfileActpositionHistory();