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/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, 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/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/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, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"); 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\``); + } + +} diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index dd57d886..0c18117c 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -445,7 +445,6 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise isSendNotification: true, })) : []; - const payloadStr = await PayloadSendNoti(command.id); const profilesSendRequest = new CallAPI() .PostData( @@ -475,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;