add api key
This commit is contained in:
parent
94ea64247f
commit
f111132184
13 changed files with 291 additions and 4666 deletions
|
|
@ -149,36 +149,16 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
|
||||
// ค้นหา profile ก่อน
|
||||
const record = await this.profileEmployeeRepo.findOne({
|
||||
where: {
|
||||
id: profileEmployeeId,
|
||||
// profileSalary: {
|
||||
// commandCode: In([
|
||||
// "0",
|
||||
// "9",
|
||||
// "1",
|
||||
// "2",
|
||||
// "3",
|
||||
// "4",
|
||||
// "8",
|
||||
// "10",
|
||||
// "11",
|
||||
// "12",
|
||||
// "13",
|
||||
// "14",
|
||||
// "15",
|
||||
// "16",
|
||||
// ]),
|
||||
// }
|
||||
},
|
||||
relations: ["posType", "posLevel"/*, "profileSalary"*/],
|
||||
// order: {
|
||||
// profileSalary: {
|
||||
// order: "DESC",
|
||||
// createdAt: "DESC"
|
||||
// }
|
||||
// }
|
||||
where: { id: profileEmployeeId },
|
||||
relations: ["posType", "posLevel"],
|
||||
});
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล profile");
|
||||
}
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevisionId: orgRevision?.id,
|
||||
|
|
@ -217,10 +197,10 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
||||
}
|
||||
}
|
||||
let _OrgLeave:any = []
|
||||
let orgLeave:string = ""
|
||||
let posNoLeave:string = ""
|
||||
let _profileSalary:any = null;
|
||||
let _OrgLeave: any = [];
|
||||
let orgLeave: string = "";
|
||||
let posNoLeave: string = "";
|
||||
let _profileSalary: any = null;
|
||||
if (record?.isLeave /*&& record?.profileSalary.length > 0*/) {
|
||||
const profileSalary = await this.salaryRepo.find({
|
||||
select: [
|
||||
|
|
@ -230,7 +210,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
"orgChild3",
|
||||
"orgChild4",
|
||||
"posNoAbb",
|
||||
"posNo"
|
||||
"posNo",
|
||||
],
|
||||
where: {
|
||||
profileEmployeeId: profileEmployeeId,
|
||||
|
|
@ -253,8 +233,8 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
},
|
||||
order: {
|
||||
order: "DESC",
|
||||
createdAt: "DESC"
|
||||
}
|
||||
createdAt: "DESC",
|
||||
},
|
||||
});
|
||||
// _OrgLeave = [
|
||||
// profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
|
||||
|
|
@ -264,15 +244,14 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
// profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
|
||||
// ];
|
||||
if (record.leaveType == "RETIRE") {
|
||||
_profileSalary = profileSalary.length > 1
|
||||
? profileSalary[1]
|
||||
: profileSalary.length > 0
|
||||
? profileSalary[0]
|
||||
: null;
|
||||
_profileSalary =
|
||||
profileSalary.length > 1
|
||||
? profileSalary[1]
|
||||
: profileSalary.length > 0
|
||||
? profileSalary[0]
|
||||
: null;
|
||||
} else {
|
||||
_profileSalary = profileSalary.length > 0
|
||||
? profileSalary[0]
|
||||
: null
|
||||
_profileSalary = profileSalary.length > 0 ? profileSalary[0] : null;
|
||||
}
|
||||
if (_profileSalary) {
|
||||
_OrgLeave = [
|
||||
|
|
@ -285,10 +264,9 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
} else {
|
||||
_OrgLeave = [];
|
||||
}
|
||||
orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
|
||||
posNoLeave = _profileSalary != null
|
||||
? `${_profileSalary.posNoAbb} ${_profileSalary.posNo}`
|
||||
: ""
|
||||
orgLeave = _OrgLeave.filter((x: any) => x !== undefined && x !== null).join("\n");
|
||||
posNoLeave =
|
||||
_profileSalary != null ? `${_profileSalary.posNoAbb} ${_profileSalary.posNo}` : "";
|
||||
}
|
||||
const data = {
|
||||
org: record?.isLeave == false ? org : orgLeave, //สังกัด
|
||||
|
|
@ -297,9 +275,12 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
record?.posLevel == null
|
||||
? null
|
||||
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
|
||||
posMasterNo: record?.isLeave == false
|
||||
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
|
||||
: posNoLeave/*record && record?.profileSalary.length > 0
|
||||
posMasterNo:
|
||||
record?.isLeave == false
|
||||
? posMaster == null
|
||||
? null
|
||||
: `${orgShortName} ${posMaster.posMasterNo}`
|
||||
: posNoLeave /*record && record?.profileSalary.length > 0
|
||||
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
|
||||
: null*/, //เลขที่ตำแหน่ง
|
||||
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
|
||||
|
|
@ -326,34 +307,16 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
|
||||
// ค้นหา profile ก่อน
|
||||
const record = await this.profileEmployeeRepo.findOne({
|
||||
where: {
|
||||
id: profileEmployeeId,
|
||||
// profileSalary:{
|
||||
// commandCode: In([
|
||||
// "0",
|
||||
// "9",
|
||||
// "1",
|
||||
// "2",
|
||||
// "3",
|
||||
// "4",
|
||||
// "8",
|
||||
// "10",
|
||||
// "11",
|
||||
// "12",
|
||||
// "13",
|
||||
// "14",
|
||||
// "15",
|
||||
// "16",
|
||||
// ]),
|
||||
// }
|
||||
},
|
||||
relations: {
|
||||
posType: true,
|
||||
posLevel: true,
|
||||
// profileSalary: true
|
||||
},
|
||||
where: { id: profileEmployeeId },
|
||||
relations: ["posType", "posLevel"],
|
||||
});
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล profile");
|
||||
}
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevisionId: orgRevision?.id,
|
||||
|
|
@ -392,10 +355,10 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
||||
}
|
||||
}
|
||||
let _OrgLeave:any = []
|
||||
let orgLeave:string = ""
|
||||
let posNoLeave:string = ""
|
||||
let _profileSalary:any = null;
|
||||
let _OrgLeave: any = [];
|
||||
let orgLeave: string = "";
|
||||
let posNoLeave: string = "";
|
||||
let _profileSalary: any = null;
|
||||
if (record?.isLeave /*&& record?.profileSalary.length > 0*/) {
|
||||
const profileSalary = await this.salaryRepo.find({
|
||||
select: [
|
||||
|
|
@ -405,7 +368,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
"orgChild3",
|
||||
"orgChild4",
|
||||
"posNoAbb",
|
||||
"posNo"
|
||||
"posNo",
|
||||
],
|
||||
where: {
|
||||
profileEmployeeId: profileEmployeeId,
|
||||
|
|
@ -428,8 +391,8 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
},
|
||||
order: {
|
||||
order: "DESC",
|
||||
createdAt: "DESC"
|
||||
}
|
||||
createdAt: "DESC",
|
||||
},
|
||||
});
|
||||
// _OrgLeave = [
|
||||
// profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
|
||||
|
|
@ -439,15 +402,14 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
// profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
|
||||
// ];
|
||||
if (record.leaveType == "RETIRE") {
|
||||
_profileSalary = profileSalary.length > 1
|
||||
? profileSalary[1]
|
||||
: profileSalary.length > 0
|
||||
? profileSalary[0]
|
||||
: null;
|
||||
_profileSalary =
|
||||
profileSalary.length > 1
|
||||
? profileSalary[1]
|
||||
: profileSalary.length > 0
|
||||
? profileSalary[0]
|
||||
: null;
|
||||
} else {
|
||||
_profileSalary = profileSalary.length > 0
|
||||
? profileSalary[0]
|
||||
: null;
|
||||
_profileSalary = profileSalary.length > 0 ? profileSalary[0] : null;
|
||||
}
|
||||
if (_profileSalary) {
|
||||
_OrgLeave = [
|
||||
|
|
@ -460,23 +422,23 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
} else {
|
||||
_OrgLeave = [];
|
||||
}
|
||||
orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
|
||||
posNoLeave = _profileSalary != null
|
||||
? `${_profileSalary.posNoAbb} ${_profileSalary.posNo}`
|
||||
: ""
|
||||
orgLeave = _OrgLeave.filter((x: any) => x !== undefined && x !== null).join("\n");
|
||||
posNoLeave =
|
||||
_profileSalary != null ? `${_profileSalary.posNoAbb} ${_profileSalary.posNo}` : "";
|
||||
}
|
||||
const data = {
|
||||
org: record?.isLeave == false ? org : orgLeave, //สังกัด
|
||||
position: record?.position, //ตำแหน่ง
|
||||
posLevel: record?.posLevel == null && record?.posType == null
|
||||
? null
|
||||
: `${record?.posType.posTypeShortName} ${record?.posLevel.posLevelName}`, //ระดับ
|
||||
posMasterNo:
|
||||
record?.isLeave == false
|
||||
? posMaster == null
|
||||
? null
|
||||
posLevel:
|
||||
record?.posLevel == null && record?.posType == null
|
||||
? null
|
||||
: `${record?.posType.posTypeShortName} ${record?.posLevel.posLevelName}`, //ระดับ
|
||||
posMasterNo:
|
||||
record?.isLeave == false
|
||||
? posMaster == null
|
||||
? null
|
||||
: `${orgShortName} ${posMaster.posMasterNo}`
|
||||
: posNoLeave/*record && record.profileSalary.length > 0
|
||||
: posNoLeave /*record && record.profileSalary.length > 0
|
||||
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
|
||||
: null*/, //เลขที่ตำแหน่ง
|
||||
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
|
||||
|
|
@ -490,7 +452,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
|
||||
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
|
||||
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
|
||||
isLeave: record?.isLeave
|
||||
isLeave: record?.isLeave,
|
||||
};
|
||||
return new HttpSuccess(data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue