This commit is contained in:
AdisakKanthawilang 2025-07-30 10:46:01 +07:00
parent b89599e8ca
commit ace9962a6f
2 changed files with 69 additions and 69 deletions

View file

@ -213,7 +213,7 @@ export class ProfileGovernmentHistoryController extends Controller {
}, },
}); });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); // if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const fullNameParts = [ const fullNameParts = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name, posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name, posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name,
@ -248,31 +248,31 @@ export class ProfileGovernmentHistoryController extends Controller {
} }
const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n"); const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
const data = { const data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด org: record?.isLeave == false ? org : orgLeave, //สังกัด
positionField: position == null ? null : position.positionField, //สายงาน positionField: position == null ? null : position.positionField, //สายงาน
position: record.position, //ตำแหน่ง position: record?.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ posLevel: record?.posLevel == null ? null : record?.posLevel.posLevelName, //ระดับ
posMasterNo: record.isLeave == false posMasterNo: record?.isLeave == false
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}` ? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
: record.profileSalary.length > 0 : record && record?.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}` ? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง : null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
posExecutive: posExecutive:
position == null || position.posExecutive == null position == null || position.posExecutive == null
? null ? null
: position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร : position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร
positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null, dateRetireLaw: record?.dateRetireLaw ?? null,
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), // govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
govAge: await calculateGovAge(profileId, "OFFICER"), govAge: await calculateGovAge(profileId, "OFFICER"),
dateAppoint: record.dateAppoint, dateAppoint: record?.dateAppoint,
dateStart: record.dateStart, dateStart: record?.dateStart,
govAgeAbsent: record.govAgeAbsent, govAgeAbsent: record?.govAgeAbsent,
govAgePlus: record.govAgePlus, govAgePlus: record?.govAgePlus,
reasonSameDate: record.reasonSameDate, reasonSameDate: record?.reasonSameDate,
}; };
return new HttpSuccess(data); return new HttpSuccess(data);
@ -349,7 +349,7 @@ export class ProfileGovernmentHistoryController extends Controller {
}, },
}); });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); // if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const fullNameParts = [ const fullNameParts = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name, posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name, posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name,
@ -384,35 +384,35 @@ export class ProfileGovernmentHistoryController extends Controller {
} }
const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n"); const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
const data = { const data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด org: record?.isLeave == false ? org : orgLeave, //สังกัด
positionField: position == null ? null : position.positionField, //สายงาน positionField: position == null ? null : position.positionField, //สายงาน
position: record.position, //ตำแหน่ง position: record?.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ posLevel: record?.posLevel == null ? null : record?.posLevel.posLevelName, //ระดับ
posMasterNo: posMasterNo:
record.isLeave == false record?.isLeave == false
? posMaster == null ? posMaster == null
? null ? null
: `${orgShortName} ${posMaster.posMasterNo}` : `${orgShortName} ${posMaster.posMasterNo}`
: record?.profileSalary.length > 0 : record && record.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}` ? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง : null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
posExecutive: posExecutive:
position == null || position.posExecutive == null position == null || position.posExecutive == null
? null ? null
: position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร : position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร
positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null, dateRetireLaw: record?.dateRetireLaw ?? null,
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), // govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
govAge: await calculateGovAge(profileId, "OFFICER"), govAge: await calculateGovAge(profileId, "OFFICER"),
dateAppoint: record.dateAppoint, dateAppoint: record?.dateAppoint,
dateStart: record.dateStart, dateStart: record?.dateStart,
govAgeAbsent: record.govAgeAbsent, govAgeAbsent: record?.govAgeAbsent,
govAgePlus: record.govAgePlus, govAgePlus: record?.govAgePlus,
reasonSameDate: record.reasonSameDate, reasonSameDate: record?.reasonSameDate,
isLeave: record.isLeave isLeave: record?.isLeave
}; };
return new HttpSuccess(data); return new HttpSuccess(data);

View file

@ -192,7 +192,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
}, },
}); });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); // if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const fullNameParts = [ const fullNameParts = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name, posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name, posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name,
@ -227,28 +227,28 @@ export class ProfileGovernmentEmployeeController extends Controller {
} }
const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n"); const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
const data = { const data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด org: record?.isLeave == false ? org : orgLeave, //สังกัด
position: record.position, //ตำแหน่ง position: record?.position, //ตำแหน่ง
posLevel: posLevel:
record.posLevel == null record?.posLevel == null
? null ? null
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ : `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
posMasterNo: record.isLeave == false posMasterNo: record?.isLeave == false
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}` ? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
: record.profileSalary.length > 0 : record && record?.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}` ? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง : null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ dateStart: record?.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน reasonSameDate: record?.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ // govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"), govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
}; };
return new HttpSuccess(data); return new HttpSuccess(data);
} }
@ -305,7 +305,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
}, },
}); });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); // if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const fullNameParts = [ const fullNameParts = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name, posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name, posMaster == null || posMaster.orgChild3 == null ? null : posMaster.orgChild3.orgChild3Name,
@ -340,31 +340,31 @@ export class ProfileGovernmentEmployeeController extends Controller {
} }
const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n"); const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
const data = { const data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด org: record?.isLeave == false ? org : orgLeave, //สังกัด
position: record.position, //ตำแหน่ง position: record?.position, //ตำแหน่ง
posLevel: record.posLevel == null && record.posType == null posLevel: record?.posLevel == null && record?.posType == null
? null ? null
: `${record.posType.posTypeShortName} ${record.posLevel.posLevelName}`, //ระดับ : `${record?.posType.posTypeShortName} ${record?.posLevel.posLevelName}`, //ระดับ
posMasterNo: posMasterNo:
record.isLeave == false record?.isLeave == false
? posMaster == null ? posMaster == null
? null ? null
: `${orgShortName} ${posMaster.posMasterNo}` : `${orgShortName} ${posMaster.posMasterNo}`
: record?.profileSalary.length > 0 : record && record.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}` ? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง : null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ dateStart: record?.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน reasonSameDate: record?.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ // govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"), govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
isLeave: record.isLeave isLeave: record?.isLeave
}; };
return new HttpSuccess(data); return new HttpSuccess(data);
} }