From 4f30ea9c6ba6a8195342e82ee24535ca2d64bbe8 Mon Sep 17 00:00:00 2001 From: Adisak Date: Wed, 26 Nov 2025 09:42:43 +0700 Subject: [PATCH 1/5] #2036 --- src/controllers/ProfileController.ts | 25 ++++---------------- src/controllers/ProfileEmployeeController.ts | 10 ++------ src/interfaces/extension.ts | 5 +--- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 120a7fa5..6558f0ee 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -3302,10 +3302,7 @@ export class ProfileController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; if (citizenIdDigits[12] !== chkDigit) { throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); @@ -3338,10 +3335,7 @@ export class ProfileController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; // else if(chkDigit === 11){ // chkDigit = cal % 10; // } @@ -3416,10 +3410,7 @@ export class ProfileController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; if (citizenIdDigits[12] !== chkDigit) { throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); @@ -3484,10 +3475,7 @@ export class ProfileController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; if (citizenIdDigits[12] !== chkDigit) { throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); @@ -5249,10 +5237,7 @@ export class ProfileController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; if (citizenIdDigits[12] !== chkDigit) { throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index cdbac600..ac5523bb 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1891,10 +1891,7 @@ export class ProfileEmployeeController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; if (citizenIdDigits[12] !== chkDigit) { throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); @@ -1983,10 +1980,7 @@ export class ProfileEmployeeController extends Controller { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; if (citizenIdDigits[12] !== chkDigit) { throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index c81e66c0..4a5dc5a3 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -275,10 +275,7 @@ class Extension { citizenIdDigits[10] * 3 + citizenIdDigits[11] * 2; const calStp2 = cal % 11; - let chkDigit = 11 - calStp2; - if (chkDigit >= 10) { - chkDigit = 0; - } + const chkDigit = (11 - calStp2) % 10; // if (citizenIdDigits[12] !== chkDigit) { // throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); From a0f18b858feb22f6c6dd0d5ded3a03bfd99b9e2c Mon Sep 17 00:00:00 2001 From: Adisak Date: Wed, 26 Nov 2025 09:47:12 +0700 Subject: [PATCH 2/5] =?UTF-8?q?fix=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=8A?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B9=80=E0=B8=A5?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99=E0=B9=80=E0=B8=87=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99=20(isPun?= =?UTF-8?q?ish)=20salary/gen=20=E0=B9=80=E0=B8=AA=E0=B9=89=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=81=E0=B9=88=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/OrganizationUnauthorizeController.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/OrganizationUnauthorizeController.ts b/src/controllers/OrganizationUnauthorizeController.ts index 4510351c..c72b600f 100644 --- a/src/controllers/OrganizationUnauthorizeController.ts +++ b/src/controllers/OrganizationUnauthorizeController.ts @@ -280,8 +280,8 @@ export class OrganizationUnauthorizeController extends Controller { `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, ) <= datePeriodEnd, ).length > 0 - ? true - : false, + ? false + : true, isSuspension: item.current_holder.dateRetire == null ? false : true, isAbsent: item.current_holder.profileDisciplines.length > 0 ? true : false, isLeave: item.current_holder.profileLeaves.length > 0 ? true : false, @@ -740,8 +740,8 @@ export class OrganizationUnauthorizeController extends Controller { `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, ) <= datePeriodEnd, ).length > 0 - ? true - : false, + ? false + : true, isSuspension: item.current_holder.dateRetire == null ? false : true, isAbsent: item.current_holder.profileDisciplines.length > 0 ? true : false, isLeave: item.current_holder.profileLeaves.length > 0 ? true : false, From 4ba71ff83036bb03264a6abb6edc5c8f3e730e03 Mon Sep 17 00:00:00 2001 From: harid Date: Wed, 26 Nov 2025 16:20:11 +0700 Subject: [PATCH 3/5] =?UTF-8?q?=E0=B9=80=E0=B8=89=E0=B8=9E=E0=B8=B2?= =?UTF-8?q?=E0=B8=B0=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= =?UTF-8?q?=20C-PM-10=20=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=94=20receiverUserId=20=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B8=AA=E0=B9=88=E0=B8=87=20noti=20=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B9=81=E0=B8=A3=E0=B8=81=E0=B8=AD?= =?UTF-8?q?=E0=B8=AD=E0=B8=81=20#1995?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/rabbitmq.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index dd57d886..74df4dc0 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -445,7 +445,11 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise isSendNotification: true, })) : []; - + /*เฉพาะคำสั่ง C-PM-10 ให้ตัด receiverUserId ที่ส่ง noti ครั้งแรกออก*/ + if (command && command.commandType && ["C-PM-10"].includes(command.commandType.code)) { + const firstNotiIds = profiles.map((p:any) => p.receiverUserId); + profilesSend = profilesSend.filter((x:any) => !firstNotiIds.includes(x.receiverUserId)); + } const payloadStr = await PayloadSendNoti(command.id); const profilesSendRequest = new CallAPI() .PostData( From 4bdf1ad7b49f3fa10469e789f323049ecc0212fc Mon Sep 17 00:00:00 2001 From: harid Date: Wed, 26 Nov 2025 16:48:35 +0700 Subject: [PATCH 4/5] =?UTF-8?q?=E0=B9=80=E0=B8=89=E0=B8=9E=E0=B8=B2?= =?UTF-8?q?=E0=B8=B0=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= =?UTF-8?q?=20C-PM-10=20=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=94=20profilesNotiRequest=20=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B8=AA=E0=B9=88=E0=B8=87=20noti=20=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B9=81=E0=B8=A3=E0=B8=81=E0=B8=AD?= =?UTF-8?q?=E0=B8=AD=E0=B8=81=20=E0=B9=80=E0=B8=9E=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=B0=20UI=20=E0=B8=9B=E0=B8=B4=E0=B8=94=20Tab=20=E0=B8=99?= =?UTF-8?q?=E0=B8=B5=E0=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/rabbitmq.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index 74df4dc0..0c18117c 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -445,11 +445,6 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise isSendNotification: true, })) : []; - /*เฉพาะคำสั่ง C-PM-10 ให้ตัด receiverUserId ที่ส่ง noti ครั้งแรกออก*/ - if (command && command.commandType && ["C-PM-10"].includes(command.commandType.code)) { - const firstNotiIds = profiles.map((p:any) => p.receiverUserId); - profilesSend = profilesSend.filter((x:any) => !firstNotiIds.includes(x.receiverUserId)); - } const payloadStr = await PayloadSendNoti(command.id); const profilesSendRequest = new CallAPI() .PostData( @@ -479,7 +474,14 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise console.error("Full error object:", error); }); - await Promise.all([profilesNotiRequest, profilesSendRequest]); + /*เฉพาะคำสั่ง C-PM-10 ให้ตัด profilesNotiRequest ที่ส่ง noti ครั้งแรกออก*/ + if (command && command.commandType && ["C-PM-10"].includes(command.commandType.code)) { + await Promise.all([profilesSendRequest]); + } + else { + await Promise.all([profilesNotiRequest, profilesSendRequest]); + } + console.log("[AMQ] Send Notification Success"); return true; From 072d9a6880d2b49f746412e7a347b48449ba7187 Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 27 Nov 2025 19:28:38 +0700 Subject: [PATCH 5/5] migrate #2043 --- src/controllers/EducationLevelController.ts | 4 ++++ src/entities/EducationLevel.ts | 21 +++++++++++++++++++ ...-update_table_educationLeave_add_fields.ts | 16 ++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 src/migration/1764244579743-update_table_educationLeave_add_fields.ts diff --git a/src/controllers/EducationLevelController.ts b/src/controllers/EducationLevelController.ts index eecdbda0..f99214a9 100644 --- a/src/controllers/EducationLevelController.ts +++ b/src/controllers/EducationLevelController.ts @@ -132,6 +132,8 @@ export class EducationLevelController extends Controller { "id", "name", "rank", + "educationLevel", + "isHigh", "createdAt", "lastUpdatedAt", "createdFullName", @@ -157,6 +159,8 @@ export class EducationLevelController extends Controller { "id", "name", "rank", + "educationLevel", + "isHigh", "createdAt", "lastUpdatedAt", "createdFullName", diff --git a/src/entities/EducationLevel.ts b/src/entities/EducationLevel.ts index 631c5a9d..cc291e90 100644 --- a/src/entities/EducationLevel.ts +++ b/src/entities/EducationLevel.ts @@ -17,6 +17,21 @@ export class EducationLevel extends EntityBase { default: null, }) rank: number; + + @Column({ + nullable: true, + comment: "ขีดจำกัดวุฒิการศึกษา", + length: 50, + default: null, + }) + educationLevel?: string; + + @Column({ + nullable: true, + comment: "วุฒิการศึกษาสูงสุด", + default: null, + }) + isHigh?: boolean; } export class CreateEducationLevel { @@ -25,6 +40,12 @@ export class CreateEducationLevel { @Column() rank: number; + + @Column() + educationLevel?: string; + + @Column() + isHigh?: boolean; } export type UpdateEducationLevel = Partial; diff --git a/src/migration/1764244579743-update_table_educationLeave_add_fields.ts b/src/migration/1764244579743-update_table_educationLeave_add_fields.ts new file mode 100644 index 00000000..0453ff63 --- /dev/null +++ b/src/migration/1764244579743-update_table_educationLeave_add_fields.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableEducationLeaveAddFields1764244579743 implements MigrationInterface { + name = 'UpdateTableEducationLeaveAddFields1764244579743' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`educationLevel\` ADD \`educationLevel\` varchar(50) NULL COMMENT 'ขีดจำกัดวุฒิการศึกษา'`); + await queryRunner.query(`ALTER TABLE \`educationLevel\` ADD \`isHigh\` tinyint NULL COMMENT 'วุฒิการศึกษาสูงสุด'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`educationLevel\` DROP COLUMN \`isHigh\``); + await queryRunner.query(`ALTER TABLE \`educationLevel\` DROP COLUMN \`educationLevel\``); + } + +}