Compare commits

...

5 commits

Author SHA1 Message Date
664f5153da Merge branch 'develop' into adiDev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m3s
2026-06-04 09:25:29 +07:00
219a2908a3 แก้ format ฟิว posMasterNo (5) สำหรับบันทึกลงระบบที่พัฒนาบน .net
1.ปรับระดับชั้นงาน-ย้ายลูกจ้าง (เลข Prefix / Suffix ไม่แสดง)
2.รายการอื่นๆ (เลข Prefix / Suffix ไม่แสดง)
3.รายการลาออก (เลข Prefix / Suffix ไม่แสดง)
4.รายการลาออกลูกจ้างฯ (เลข Prefix / Suffix ไม่แสดง)
5.เรื่องร้องเรียน (เลข Prefix / Suffix ไม่แสดง)
6.สืบสวนฯ (เลข Prefix / Suffix ไม่แสดง)
7.สอบสวนฯ (เลข Prefix / Suffix ไม่แสดง)
8.สรุปผลการพิจารณาฯ (เลข Prefix / Suffix ไม่แสดง)
2026-06-04 09:25:01 +07:00
harid
b0cfbc7036 fix #2510
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m5s
2026-05-29 17:37:19 +07:00
185aedc53f remove log success 2026-05-29 17:23:45 +07:00
20c6c412b8 remove log success 2026-05-29 14:24:50 +07:00
5 changed files with 61 additions and 93 deletions

View file

@ -4312,11 +4312,8 @@ export class CommandController extends Controller {
body.data.map(async (item) => {
const profile = await this.profileRepository.findOne({
where: { id: item.profileId },
// relations: ["roleKeycloaks"],
relations: {
roleKeycloaks: true,
posType: true,
posLevel: true,
roleKeycloaks: true
},
});
if (!profile) {
@ -4612,6 +4609,8 @@ export class CommandController extends Controller {
await this.positionRepository.save(positionNew, { data: req });
}
await CreatePosMasterHistoryOfficer(posMaster.id, req);
profile.posMasterNo = getPosMasterNo(posMaster);
profile.org = getOrgFullName(posMaster);
}
const newMapProfileSalary = {
profileId: profile.id,

View file

@ -2372,7 +2372,7 @@ export class OrganizationDotnetController extends Controller {
@Security("internalAuth")
async GetProfileForProcessCheckInAsync(@Path() keycloakId: string) {
try {
console.log(`[check-keycloak] START - keycloakId=${keycloakId}`);
// console.log(`[check-keycloak] START - keycloakId=${keycloakId}`);
/* =========================
* 1. Load profile (Officer)
@ -2447,14 +2447,14 @@ export class OrganizationDotnetController extends Controller {
child4DnaId: currentHolder?.orgChild4?.ancestorDNA ?? null,
};
console.log(
`[check-keycloak] SUCCESS_EMPLOYEE - keycloakId=${keycloakId}, profileType=EMPLOYEE`,
);
// console.log(
// `[check-keycloak] SUCCESS_EMPLOYEE - keycloakId=${keycloakId}, profileType=EMPLOYEE`,
// );
return new HttpSuccess(mapProfile);
}
console.log(`[check-keycloak] OFFICER_FOUND - keycloakId=${keycloakId}`);
// console.log(`[check-keycloak] OFFICER_FOUND - keycloakId=${keycloakId}`);
/* =========================================
* 2. current holder (Officer)
@ -2494,9 +2494,9 @@ export class OrganizationDotnetController extends Controller {
child4DnaId: currentHolder?.orgChild4?.ancestorDNA ?? null,
};
console.log(
`[check-keycloak] SUCCESS_OFFICER - keycloakId=${keycloakId}, profileType=OFFICER`,
);
// console.log(
// `[check-keycloak] SUCCESS_OFFICER - keycloakId=${keycloakId}, profileType=OFFICER`,
// );
return new HttpSuccess(mapProfile);
} catch (error: any) {

View file

@ -7951,40 +7951,38 @@ export class ProfileController extends Controller {
privacyUser: profile.privacyUser,
privacyMgt: profile.privacyMgt,
isDeputy: root?.isDeputy ?? false,
// root?.orgRootShortName && posMaster?.posMasterNo
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
// : "",
};
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeDnaId = _profile.child4DnaId;
_profile.nodeShortName = _profile.child4ShortName;
_profile.posNo = `${_profile.child4ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeDnaId = _profile.child3DnaId;
_profile.nodeShortName = _profile.child3ShortName;
_profile.posNo = `${_profile.child3ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeDnaId = _profile.child2DnaId;
_profile.nodeShortName = _profile.child2ShortName;
_profile.posNo = `${_profile.child2ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeDnaId = _profile.child1DnaId;
_profile.nodeShortName = _profile.child1ShortName;
_profile.posNo = `${_profile.child1ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeDnaId = _profile.rootDnaId;
_profile.nodeShortName = _profile.rootShortName;
_profile.posNo = `${_profile.rootShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
}
return new HttpSuccess(_profile);
}
@ -8124,41 +8122,39 @@ export class ProfileController extends Controller {
privacyUser: profile.privacyUser,
privacyMgt: profile.privacyMgt,
isDeputy: root?.isDeputy ?? false,
// root?.orgRootShortName && posMaster?.posMasterNo
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
// : "",
};
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeDnaId = _profile.child4DnaId;
_profile.nodeShortName = _profile.child4ShortName;
_profile.posNo = `${_profile.child4ShortName} ${posMaster?.posMasterNo}`;
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeDnaId = _profile.child3DnaId;
_profile.nodeShortName = _profile.child3ShortName;
_profile.posNo = `${_profile.child3ShortName} ${posMaster?.posMasterNo}`;
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeDnaId = _profile.child2DnaId;
_profile.nodeShortName = _profile.child2ShortName;
_profile.posNo = `${_profile.child2ShortName} ${posMaster?.posMasterNo}`;
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeDnaId = _profile.child1DnaId;
_profile.nodeShortName = _profile.child1ShortName;
_profile.posNo = `${_profile.child1ShortName} ${posMaster?.posMasterNo}`;
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeDnaId = _profile.rootDnaId;
_profile.nodeShortName = _profile.rootShortName;
_profile.posNo = `${_profile.rootShortName} ${posMaster?.posMasterNo}`;
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
}
return new HttpSuccess(_profile);
}
@ -9329,26 +9325,32 @@ export class ProfileController extends Controller {
: "-",
};
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
}
return new HttpSuccess(_profile);
}
@ -9529,38 +9531,28 @@ export class ProfileController extends Controller {
const mapDataProfile = await Promise.all(
findProfile.map(async (item: Profile) => {
const fullName = `${item.prefix}${item.firstName} ${item.lastName}`;
const shortName =
item.current_holders.length == 0
const holder = item.current_holders?.find((x) => x.orgRevisionId == findRevision.id);
const _numPart = holder ? [holder.posMasterNoPrefix, holder.posMasterNo, holder.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
const shortName = !holder
? null
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 !=
null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild2 != null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild1 != null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) !=
null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
?.orgRoot != null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: holder.orgChild4 != null
? `${holder.orgChild4.orgChild4ShortName} ${_numPart}`
: holder.orgChild3 != null
? `${holder.orgChild3.orgChild3ShortName} ${_numPart}`
: holder.orgChild2 != null
? `${holder.orgChild2.orgChild2ShortName} ${_numPart}`
: holder.orgChild1 != null
? `${holder.orgChild1.orgChild1ShortName} ${_numPart}`
: holder.orgRoot != null
? `${holder.orgRoot.orgRootShortName} ${_numPart}`
: null;
const root =
item.current_holders.length == 0 ||
(item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
(holder != null &&
holder?.orgRoot == null)
? null
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
: holder?.orgRoot;
const rootHolder = item.current_holders?.find(
(x) => x.orgRevisionId == findRevision.id,

View file

@ -4021,40 +4021,38 @@ export class ProfileEmployeeController extends Controller {
salary: profile ? profile.amount : null,
amountSpecial: profile ? profile.amountSpecial : null,
posNo: null,
// root?.orgRootShortName && posMaster?.posMasterNo
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
// : "",
};
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeDnaId = _profile.child4DnaId;
_profile.nodeShortName = _profile.child4ShortName;
_profile.posNo = `${_profile.child4ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeDnaId = _profile.child3DnaId;
_profile.nodeShortName = _profile.child3ShortName;
_profile.posNo = `${_profile.child3ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeDnaId = _profile.child2DnaId;
_profile.nodeShortName = _profile.child2ShortName;
_profile.posNo = `${_profile.child2ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeDnaId = _profile.child1DnaId;
_profile.nodeShortName = _profile.child1ShortName;
_profile.posNo = `${_profile.child1ShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeDnaId = _profile.rootDnaId;
_profile.nodeShortName = _profile.rootShortName;
_profile.posNo = `${_profile.rootShortName} ${_profile.posMasterNo}`;
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
}
return new HttpSuccess(_profile);
}
@ -6462,33 +6460,7 @@ export class ProfileEmployeeController extends Controller {
null
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
const shortName =
profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild4 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4.orgChild4ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild3 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3.orgChild3ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2.orgChild2ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1.orgChild1ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName} ${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: null;
const _numPart = posMaster ? [posMaster.posMasterNoPrefix, posMaster.posMasterNo, posMaster.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
const _profile: any = {
profileId: profile.id,
prefix: profile.prefix,
@ -6530,7 +6502,7 @@ export class ProfileEmployeeController extends Controller {
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
posNo: shortName,
posNo: null,
salary: profile.amount,
education:
profile && profile.profileEducations.length > 0
@ -6545,22 +6517,27 @@ export class ProfileEmployeeController extends Controller {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
_profile.posNo = `${_profile.child4ShortName} ${_numPart}`;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
_profile.posNo = `${_profile.child3ShortName} ${_numPart}`;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
_profile.posNo = `${_profile.child2ShortName} ${_numPart}`;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
_profile.posNo = `${_profile.child1ShortName} ${_numPart}`;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
_profile.posNo = `${_profile.rootShortName} ${_numPart}`;
}
return new HttpSuccess(_profile);
}

View file

@ -19,7 +19,7 @@ export async function handleInternalAuth(request: express.Request) {
throw new HttpError(HttpStatus.UNAUTHORIZED, "Invalid API Key");
}
console.log(`[InternalAuth] Authentication successful`);
// console.log(`[InternalAuth] Authentication successful`);
return {
sub: "internal_service",