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 = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
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 data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด
org: record?.isLeave == false ? org : orgLeave, //สังกัด
positionField: position == null ? null : position.positionField, //สายงาน
position: record.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
posMasterNo: record.isLeave == false
position: record?.position, //ตำแหน่ง
posLevel: record?.posLevel == null ? null : record?.posLevel.posLevelName, //ระดับ
posMasterNo: record?.isLeave == false
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
: record.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
: record && record?.profileSalary.length > 0
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
posExecutive:
position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร
positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate),
dateRetireLaw: record?.dateRetireLaw ?? null,
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
govAge: await calculateGovAge(profileId, "OFFICER"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,
govAgePlus: record.govAgePlus,
reasonSameDate: record.reasonSameDate,
dateAppoint: record?.dateAppoint,
dateStart: record?.dateStart,
govAgeAbsent: record?.govAgeAbsent,
govAgePlus: record?.govAgePlus,
reasonSameDate: record?.reasonSameDate,
};
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 = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
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 data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด
org: record?.isLeave == false ? org : orgLeave, //สังกัด
positionField: position == null ? null : position.positionField, //สายงาน
position: record.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
position: record?.position, //ตำแหน่ง
posLevel: record?.posLevel == null ? null : record?.posLevel.posLevelName, //ระดับ
posMasterNo:
record.isLeave == false
record?.isLeave == false
? posMaster == null
? null
: `${orgShortName} ${posMaster.posMasterNo}`
: record?.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
: record && record.profileSalary.length > 0
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
posExecutive:
position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร
positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate),
dateRetireLaw: record?.dateRetireLaw ?? null,
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
govAge: await calculateGovAge(profileId, "OFFICER"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,
govAgePlus: record.govAgePlus,
reasonSameDate: record.reasonSameDate,
isLeave: record.isLeave
dateAppoint: record?.dateAppoint,
dateStart: record?.dateStart,
govAgeAbsent: record?.govAgeAbsent,
govAgePlus: record?.govAgePlus,
reasonSameDate: record?.reasonSameDate,
isLeave: record?.isLeave
};
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 = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
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 data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด
position: record.position, //ตำแหน่ง
org: record?.isLeave == false ? org : orgLeave, //สังกัด
position: record?.position, //ตำแหน่ง
posLevel:
record.posLevel == null
record?.posLevel == null
? null
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
posMasterNo: record.isLeave == false
posMasterNo: record?.isLeave == false
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
: record.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
: record && record?.profileSalary.length > 0
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ
dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ
dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
dateStart: record?.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record?.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
};
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 = [
posMaster == null || posMaster.orgChild4 == null ? null : posMaster.orgChild4.orgChild4Name,
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 data = {
org: record.isLeave == false ? org : orgLeave, //สังกัด
position: record.position, //ตำแหน่ง
posLevel: record.posLevel == null && record.posType == null
org: record?.isLeave == false ? org : orgLeave, //สังกัด
position: record?.position, //ตำแหน่ง
posLevel: record?.posLevel == null && record?.posType == null
? null
: `${record.posType.posTypeShortName} ${record.posLevel.posLevelName}`, //ระดับ
: `${record?.posType.posTypeShortName} ${record?.posLevel.posLevelName}`, //ระดับ
posMasterNo:
record.isLeave == false
record?.isLeave == false
? posMaster == null
? null
: `${orgShortName} ${posMaster.posMasterNo}`
: record?.profileSalary.length > 0
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
: record && record.profileSalary.length > 0
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
: null, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ
dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ
dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
dateStart: record?.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record?.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
isLeave: record.isLeave
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
isLeave: record?.isLeave
};
return new HttpSuccess(data);
}