fix
This commit is contained in:
parent
8278d9ddff
commit
293effa89a
1 changed files with 454 additions and 454 deletions
|
|
@ -395,477 +395,477 @@ export class ProfileController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * รายงาน ก.ก.1 (ข้าราชการ)
|
* รายงาน ก.ก.1 (ข้าราชการ)
|
||||||
// *
|
*
|
||||||
// * @summary รายงาน ก.ก.1 (ข้าราชการ)
|
* @summary รายงาน ก.ก.1 (ข้าราชการ)
|
||||||
// *
|
*
|
||||||
// * @param {string} id Id โปรไฟล์
|
* @param {string} id Id โปรไฟล์
|
||||||
// */
|
*/
|
||||||
// @Get("kk1/{id}")
|
@Get("kk1/{id}")
|
||||||
// public async getKk1(@Path() id: string, @Request() req: RequestWithUser) {
|
public async getKk1(@Path() id: string, @Request() req: RequestWithUser) {
|
||||||
// const profiles = await this.profileRepo.findOne({
|
const profiles = await this.profileRepo.findOne({
|
||||||
// relations: ["currentSubDistrict", "currentDistrict", "currentProvince", "profileAvatars"],
|
relations: ["currentSubDistrict", "currentDistrict", "currentProvince", "profileAvatars"],
|
||||||
// order: {
|
order: {
|
||||||
// profileAvatars: { createdAt: "ASC" },
|
profileAvatars: { createdAt: "ASC" },
|
||||||
// },
|
},
|
||||||
// where: { id: id },
|
where: { id: id },
|
||||||
// });
|
});
|
||||||
// if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
// let ImgUrl: any = null;
|
let ImgUrl: any = null;
|
||||||
// let _ImgUrl: any = [];
|
let _ImgUrl: any = [];
|
||||||
// if (profiles?.avatar != null && profiles?.avatarName != null) {
|
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
||||||
// // await new CallAPI()
|
// await new CallAPI()
|
||||||
// // .GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
// .GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||||
// // .then(async (x) => {
|
// .then(async (x) => {
|
||||||
// // ImgUrl = x.downloadUrl;
|
// ImgUrl = x.downloadUrl;
|
||||||
// // })
|
// })
|
||||||
// // .catch();
|
// .catch();
|
||||||
|
|
||||||
// let req_: any = req;
|
let req_: any = req;
|
||||||
// const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");
|
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");
|
||||||
|
|
||||||
// await Promise.all(
|
await Promise.all(
|
||||||
// await profiles.profileAvatars.slice(-7).map(async (x, i) => {
|
await profiles.profileAvatars.slice(-7).map(async (x, i) => {
|
||||||
// if (x == null) {
|
if (x == null) {
|
||||||
// _ImgUrl[i] = null;
|
_ImgUrl[i] = null;
|
||||||
// } else {
|
} else {
|
||||||
// const url = process.env.API_URL + `/salary/file/${x?.avatar}/${x?.avatarName}`;
|
const url = process.env.API_URL + `/salary/file/${x?.avatar}/${x?.avatarName}`;
|
||||||
// try {
|
try {
|
||||||
// const response_ = await axios.get(url, {
|
const response_ = await axios.get(url, {
|
||||||
// headers: {
|
headers: {
|
||||||
// Authorization: `${token_}`,
|
Authorization: `${token_}`,
|
||||||
// "Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
// api_key: process.env.API_KEY,
|
api_key: process.env.API_KEY,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// _ImgUrl[i] = response_.data.downloadUrl;
|
_ImgUrl[i] = response_.data.downloadUrl;
|
||||||
// } catch {}
|
} catch {}
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
// );
|
);
|
||||||
// const url = process.env.API_URL + `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`;
|
const url = process.env.API_URL + `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`;
|
||||||
// try {
|
try {
|
||||||
// const response_ = await axios.get(url, {
|
const response_ = await axios.get(url, {
|
||||||
// headers: {
|
headers: {
|
||||||
// Authorization: `${token_}`,
|
Authorization: `${token_}`,
|
||||||
// "Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
// api_key: process.env.API_KEY,
|
api_key: process.env.API_KEY,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// ImgUrl = response_.data.downloadUrl;
|
ImgUrl = response_.data.downloadUrl;
|
||||||
// } catch {}
|
} catch {}
|
||||||
// }
|
}
|
||||||
// const profileOc = await this.profileRepo.findOne({
|
const profileOc = await this.profileRepo.findOne({
|
||||||
// relations: [
|
relations: [
|
||||||
// "current_holders",
|
"current_holders",
|
||||||
// "current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
// "current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
// "current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
// "current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
// "current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
// ],
|
],
|
||||||
// where: { id: id },
|
where: { id: id },
|
||||||
// });
|
});
|
||||||
// if (!profileOc) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profileOc) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
// const orgRevision = await this.orgRevisionRepo.findOne({
|
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||||
// where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// const profileFamilyCouple = await this.profileFamilyCoupleRepository.findOne({
|
const profileFamilyCouple = await this.profileFamilyCoupleRepository.findOne({
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// select: ["couplePrefix", "coupleFirstName", "coupleLastName", "coupleLastNameOld"],
|
select: ["couplePrefix", "coupleFirstName", "coupleLastName", "coupleLastNameOld"],
|
||||||
// order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// const profileFamilyMother = await this.profileFamilyMotherRepository.findOne({
|
const profileFamilyMother = await this.profileFamilyMotherRepository.findOne({
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// select: ["motherPrefix", "motherFirstName", "motherLastName"],
|
select: ["motherPrefix", "motherFirstName", "motherLastName"],
|
||||||
// order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// const profileFamilyFather = await this.profileFamilyFatherRepository.findOne({
|
const profileFamilyFather = await this.profileFamilyFatherRepository.findOne({
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// select: ["fatherPrefix", "fatherFirstName", "fatherLastName"],
|
select: ["fatherPrefix", "fatherFirstName", "fatherLastName"],
|
||||||
// order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// const root =
|
const root =
|
||||||
// profileOc.current_holders == null ||
|
profileOc.current_holders == null ||
|
||||||
// profileOc.current_holders.length == 0 ||
|
profileOc.current_holders.length == 0 ||
|
||||||
// profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
||||||
// ? null
|
? null
|
||||||
// : profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot;
|
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot;
|
||||||
|
|
||||||
// const child1 =
|
const child1 =
|
||||||
// profileOc.current_holders == null ||
|
profileOc.current_holders == null ||
|
||||||
// profileOc.current_holders.length == 0 ||
|
profileOc.current_holders.length == 0 ||
|
||||||
// profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
||||||
// ? null
|
? null
|
||||||
// : profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1;
|
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1;
|
||||||
|
|
||||||
// const child2 =
|
const child2 =
|
||||||
// profileOc.current_holders == null ||
|
profileOc.current_holders == null ||
|
||||||
// profileOc.current_holders.length == 0 ||
|
profileOc.current_holders.length == 0 ||
|
||||||
// profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
||||||
// ? null
|
? null
|
||||||
// : profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2;
|
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2;
|
||||||
|
|
||||||
// const child3 =
|
const child3 =
|
||||||
// profileOc.current_holders == null ||
|
profileOc.current_holders == null ||
|
||||||
// profileOc.current_holders.length == 0 ||
|
profileOc.current_holders.length == 0 ||
|
||||||
// profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
||||||
// ? null
|
? null
|
||||||
// : profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3;
|
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3;
|
||||||
|
|
||||||
// const child4 =
|
const child4 =
|
||||||
// profileOc.current_holders == null ||
|
profileOc.current_holders == null ||
|
||||||
// profileOc.current_holders.length == 0 ||
|
profileOc.current_holders.length == 0 ||
|
||||||
// profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) == null
|
||||||
// ? null
|
? null
|
||||||
// : profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
|
: profileOc.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
|
||||||
|
|
||||||
// // Construct org path
|
// Construct org path
|
||||||
// const _root = root ? `${root.orgRootName}` : "";
|
const _root = root ? `${root.orgRootName}` : "";
|
||||||
// const _child1 = child1 ? `${child1.orgChild1Name}/` : "";
|
const _child1 = child1 ? `${child1.orgChild1Name}/` : "";
|
||||||
// const _child2 = child2 ? `${child2.orgChild2Name}/` : "";
|
const _child2 = child2 ? `${child2.orgChild2Name}/` : "";
|
||||||
// const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
|
const _child3 = child3 ? `${child3.orgChild3Name}/` : "";
|
||||||
// const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
const _child4 = child4 ? `${child4.orgChild4Name}/` : "";
|
||||||
|
|
||||||
// const cert_raw = await this.certificateRepository.find({
|
const cert_raw = await this.certificateRepository.find({
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// select: ["certificateType", "issuer", "certificateNo", "issueDate"],
|
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
|
||||||
// order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
// });
|
});
|
||||||
// const certs =
|
const certs =
|
||||||
// cert_raw.length > 0
|
cert_raw.length > 0
|
||||||
// ? cert_raw.slice(-2).map((item) => ({
|
? cert_raw.slice(-2).map((item) => ({
|
||||||
// certificateType: item.certificateType ?? null,
|
certificateType: item.certificateType ?? null,
|
||||||
// issuer: item.issuer ?? null,
|
issuer: item.issuer ?? null,
|
||||||
// certificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null,
|
certificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null,
|
||||||
// issueDate: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate)) ?? null,
|
issueDate: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate)) ?? null,
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// certificateType: "-",
|
certificateType: "-",
|
||||||
// issuer: "-",
|
issuer: "-",
|
||||||
// certificateNo: "-",
|
certificateNo: "-",
|
||||||
// issueDate: "-",
|
issueDate: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
// const training_raw = await this.trainingRepository.find({
|
const training_raw = await this.trainingRepository.find({
|
||||||
// select: ["startDate", "endDate", "place", "department", "name"],
|
select: ["startDate", "endDate", "place", "department", "name"],
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
// });
|
});
|
||||||
// const trainings =
|
const trainings =
|
||||||
// training_raw.length > 0
|
training_raw.length > 0
|
||||||
// ? training_raw.slice(-2).map((item) => ({
|
? training_raw.slice(-2).map((item) => ({
|
||||||
// institute: item.department ?? "",
|
institute: item.department ?? "",
|
||||||
// start:
|
start:
|
||||||
// item.startDate == null
|
item.startDate == null
|
||||||
// ? ""
|
? ""
|
||||||
// : Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)),
|
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate)),
|
||||||
// end:
|
end:
|
||||||
// item.endDate == null
|
item.endDate == null
|
||||||
// ? ""
|
? ""
|
||||||
// : Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)),
|
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate)),
|
||||||
// date:
|
date:
|
||||||
// item.startDate && item.endDate
|
item.startDate && item.endDate
|
||||||
// ? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
||||||
// : "",
|
: "",
|
||||||
// level: "",
|
level: "",
|
||||||
// degree: item.name,
|
degree: item.name,
|
||||||
// field: "",
|
field: "",
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// institute: "-",
|
institute: "-",
|
||||||
// start: "-",
|
start: "-",
|
||||||
// end: "-",
|
end: "-",
|
||||||
// date: "-",
|
date: "-",
|
||||||
// level: "-",
|
level: "-",
|
||||||
// degree: "-",
|
degree: "-",
|
||||||
// field: "-",
|
field: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// const discipline_raw = await this.disciplineRepository.find({
|
const discipline_raw = await this.disciplineRepository.find({
|
||||||
// select: ["refCommandDate", "refCommandNo", "detail"],
|
select: ["refCommandDate", "refCommandNo", "detail"],
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
// });
|
});
|
||||||
// const disciplines =
|
const disciplines =
|
||||||
// discipline_raw.length > 0
|
discipline_raw.length > 0
|
||||||
// ? discipline_raw.slice(-2).map((item) => ({
|
? discipline_raw.slice(-2).map((item) => ({
|
||||||
// disciplineYear:
|
disciplineYear:
|
||||||
// Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ??
|
Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ??
|
||||||
// null,
|
null,
|
||||||
// disciplineDetail: item.detail ?? null,
|
disciplineDetail: item.detail ?? null,
|
||||||
// refNo: Extension.ToThaiNumber(item.refCommandNo) ?? null,
|
refNo: Extension.ToThaiNumber(item.refCommandNo) ?? null,
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// disciplineYear: "-",
|
disciplineYear: "-",
|
||||||
// disciplineDetail: "-",
|
disciplineDetail: "-",
|
||||||
// refNo: "-",
|
refNo: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// const education_raw = await this.profileEducationRepo.find({
|
const education_raw = await this.profileEducationRepo.find({
|
||||||
// select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// // order: { lastUpdatedAt: "DESC" },
|
// order: { lastUpdatedAt: "DESC" },
|
||||||
// order: { level: "ASC" },
|
order: { level: "ASC" },
|
||||||
// });
|
});
|
||||||
// const educations =
|
const educations =
|
||||||
// education_raw.length > 0
|
education_raw.length > 0
|
||||||
// ? education_raw.slice(-2).map((item) => ({
|
? education_raw.slice(-2).map((item) => ({
|
||||||
// institute: item.institute,
|
institute: item.institute,
|
||||||
// start:
|
start:
|
||||||
// item.startDate == null
|
item.startDate == null
|
||||||
// ? ""
|
? ""
|
||||||
// : Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()),
|
: Extension.ToThaiNumber(new Date(item.startDate).getFullYear().toString()),
|
||||||
// end:
|
end:
|
||||||
// item.endDate == null
|
item.endDate == null
|
||||||
// ? ""
|
? ""
|
||||||
// : Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()),
|
: Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()),
|
||||||
// date:
|
date:
|
||||||
// item.startDate && item.endDate
|
item.startDate && item.endDate
|
||||||
// ? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
||||||
// : "",
|
: "",
|
||||||
// level: item.educationLevel ?? "",
|
level: item.educationLevel ?? "",
|
||||||
// degree: item.degree ? `${item.degree} ${item.field ? item.field : ""}` : "",
|
degree: item.degree ? `${item.degree} ${item.field ? item.field : ""}` : "",
|
||||||
// field: item.field ?? "-",
|
field: item.field ?? "-",
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// institute: "-",
|
institute: "-",
|
||||||
// start: "-",
|
start: "-",
|
||||||
// end: "-",
|
end: "-",
|
||||||
// date: "-",
|
date: "-",
|
||||||
// level: "-",
|
level: "-",
|
||||||
// degree: "-",
|
degree: "-",
|
||||||
// field: "-",
|
field: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
// const salary_raw = await this.salaryRepo.find({
|
const salary_raw = await this.salaryRepo.find({
|
||||||
// select: [
|
select: [
|
||||||
// "commandDateAffect",
|
"commandDateAffect",
|
||||||
// "positionName",
|
"positionName",
|
||||||
// "posNo",
|
"posNo",
|
||||||
// "positionType",
|
"positionType",
|
||||||
// "positionLevel",
|
"positionLevel",
|
||||||
// "positionSalaryAmount",
|
"positionSalaryAmount",
|
||||||
// "commandNo",
|
"commandNo",
|
||||||
// "amount",
|
"amount",
|
||||||
// "remark",
|
"remark",
|
||||||
// ],
|
],
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// order: { order: "ASC" },
|
order: { order: "ASC" },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// const salarys =
|
const salarys =
|
||||||
// salary_raw.length > 0
|
salary_raw.length > 0
|
||||||
// ? salary_raw.map((item) => ({
|
? salary_raw.map((item) => ({
|
||||||
// salaryDate: item.commandDateAffect
|
salaryDate: item.commandDateAffect
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||||
// : null,
|
: null,
|
||||||
// position: item.positionName != null ? Extension.ToThaiNumber(item.positionName) : null,
|
position: item.positionName != null ? Extension.ToThaiNumber(item.positionName) : null,
|
||||||
// posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||||
// salary:
|
salary:
|
||||||
// item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
||||||
// rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||||
// refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
||||||
// positionLevel:
|
positionLevel:
|
||||||
// item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||||
// positionType: item.positionType ?? null,
|
positionType: item.positionType ?? null,
|
||||||
// positionAmount:
|
positionAmount:
|
||||||
// item.positionSalaryAmount == null
|
item.positionSalaryAmount == null
|
||||||
// ? null
|
? null
|
||||||
// : Extension.ToThaiNumber(item.positionSalaryAmount.toLocaleString()),
|
: Extension.ToThaiNumber(item.positionSalaryAmount.toLocaleString()),
|
||||||
// fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||||
// ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// salaryDate: "-",
|
salaryDate: "-",
|
||||||
// position: "-",
|
position: "-",
|
||||||
// posNo: "-",
|
posNo: "-",
|
||||||
// salary: "-",
|
salary: "-",
|
||||||
// rank: "-",
|
rank: "-",
|
||||||
// refAll: "-",
|
refAll: "-",
|
||||||
// positionLevel: "-",
|
positionLevel: "-",
|
||||||
// positionType: "-",
|
positionType: "-",
|
||||||
// positionAmount: "-",
|
positionAmount: "-",
|
||||||
// fullName: "-",
|
fullName: "-",
|
||||||
// ocFullPath: "-",
|
ocFullPath: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// const insignia_raw = await this.profileInsigniaRepo.find({
|
const insignia_raw = await this.profileInsigniaRepo.find({
|
||||||
// relations: {
|
relations: {
|
||||||
// insignia: {
|
insignia: {
|
||||||
// insigniaType: true,
|
insigniaType: true,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// order: { receiveDate: "ASC" },
|
order: { receiveDate: "ASC" },
|
||||||
// });
|
});
|
||||||
// const insignias =
|
const insignias =
|
||||||
// insignia_raw.length > 0
|
insignia_raw.length > 0
|
||||||
// ? insignia_raw.map((item) => ({
|
? insignia_raw.map((item) => ({
|
||||||
// receiveDate: item.receiveDate
|
receiveDate: item.receiveDate
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.receiveDate))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.receiveDate))
|
||||||
// : "",
|
: "",
|
||||||
// insigniaName: item.insignia.name,
|
insigniaName: item.insignia.name,
|
||||||
// insigniaShortName: item.insignia.shortName,
|
insigniaShortName: item.insignia.shortName,
|
||||||
// insigniaTypeName: item.insignia.insigniaType.name,
|
insigniaTypeName: item.insignia.insigniaType.name,
|
||||||
// no: item.no ? Extension.ToThaiNumber(item.no) : "",
|
no: item.no ? Extension.ToThaiNumber(item.no) : "",
|
||||||
// issue: item.issue ? item.issue : "",
|
issue: item.issue ? item.issue : "",
|
||||||
// volumeNo: item.volumeNo ? Extension.ToThaiNumber(item.volumeNo) : "",
|
volumeNo: item.volumeNo ? Extension.ToThaiNumber(item.volumeNo) : "",
|
||||||
// volume: item.volume ? Extension.ToThaiNumber(item.volume) : "",
|
volume: item.volume ? Extension.ToThaiNumber(item.volume) : "",
|
||||||
// section: item.section ? Extension.ToThaiNumber(item.section) : "",
|
section: item.section ? Extension.ToThaiNumber(item.section) : "",
|
||||||
// page: item.page ? Extension.ToThaiNumber(item.page) : "",
|
page: item.page ? Extension.ToThaiNumber(item.page) : "",
|
||||||
// refCommandDate: item.refCommandDate
|
refCommandDate: item.refCommandDate
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
|
||||||
// : "",
|
: "",
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// receiveDate: "-",
|
receiveDate: "-",
|
||||||
// insigniaName: "-",
|
insigniaName: "-",
|
||||||
// insigniaShortName: "-",
|
insigniaShortName: "-",
|
||||||
// insigniaTypeName: "-",
|
insigniaTypeName: "-",
|
||||||
// no: "-",
|
no: "-",
|
||||||
// issue: "-",
|
issue: "-",
|
||||||
// volumeNo: "-",
|
volumeNo: "-",
|
||||||
// volume: "-",
|
volume: "-",
|
||||||
// section: "-",
|
section: "-",
|
||||||
// page: "-",
|
page: "-",
|
||||||
// refCommandDate: "-",
|
refCommandDate: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// const leave_raw = await this.profileLeaveRepository.find({
|
const leave_raw = await this.profileLeaveRepository.find({
|
||||||
// relations: { leaveType: true },
|
relations: { leaveType: true },
|
||||||
// where: { profileId: id },
|
where: { profileId: id },
|
||||||
// order: { dateLeaveStart: "ASC" },
|
order: { dateLeaveStart: "ASC" },
|
||||||
// });
|
});
|
||||||
// const leaves =
|
const leaves =
|
||||||
// leave_raw.length > 0
|
leave_raw.length > 0
|
||||||
// ? leave_raw.map((item) => ({
|
? leave_raw.map((item) => ({
|
||||||
// leaveTypeName: item.leaveType.name,
|
leaveTypeName: item.leaveType.name,
|
||||||
// dateLeaveStart: item.dateLeaveStart
|
dateLeaveStart: item.dateLeaveStart
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart))
|
||||||
// : "",
|
: "",
|
||||||
// leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "",
|
leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "",
|
||||||
// }))
|
}))
|
||||||
// : [
|
: [
|
||||||
// {
|
{
|
||||||
// leaveTypeName: "-",
|
leaveTypeName: "-",
|
||||||
// dateLeaveStart: "-",
|
dateLeaveStart: "-",
|
||||||
// leaveDays: "-",
|
leaveDays: "-",
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// const data = {
|
const data = {
|
||||||
// fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||||
// prefix: profiles?.prefix != null ? profiles.prefix : "",
|
prefix: profiles?.prefix != null ? profiles.prefix : "",
|
||||||
// firstName: profiles?.firstName != null ? profiles.firstName : "",
|
firstName: profiles?.firstName != null ? profiles.firstName : "",
|
||||||
// lastName: profiles?.lastName != null ? profiles.lastName : "",
|
lastName: profiles?.lastName != null ? profiles.lastName : "",
|
||||||
// ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
// birthDate: profiles?.birthDate
|
birthDate: profiles?.birthDate
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
|
||||||
// : "",
|
: "",
|
||||||
// retireDate:
|
retireDate:
|
||||||
// profiles.dateRetireLaw != null
|
profiles.dateRetireLaw != null
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
|
||||||
// : "",
|
: "",
|
||||||
// appointDate: profiles?.dateAppoint
|
appointDate: profiles?.dateAppoint
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
|
||||||
// : "",
|
: "",
|
||||||
// citizenId:
|
citizenId:
|
||||||
// profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
profiles.citizenId != null ? Extension.ToThaiNumber(profiles.citizenId.toString()) : "",
|
||||||
// fatherFullName:
|
fatherFullName:
|
||||||
// profileFamilyFather?.fatherPrefix ||
|
profileFamilyFather?.fatherPrefix ||
|
||||||
// profileFamilyFather?.fatherFirstName ||
|
profileFamilyFather?.fatherFirstName ||
|
||||||
// profileFamilyFather?.fatherLastName
|
profileFamilyFather?.fatherLastName
|
||||||
// ? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
|
||||||
// : null,
|
: null,
|
||||||
// motherFullName:
|
motherFullName:
|
||||||
// profileFamilyMother?.motherPrefix ||
|
profileFamilyMother?.motherPrefix ||
|
||||||
// profileFamilyMother?.motherFirstName ||
|
profileFamilyMother?.motherFirstName ||
|
||||||
// profileFamilyMother?.motherLastName
|
profileFamilyMother?.motherLastName
|
||||||
// ? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
|
||||||
// : null,
|
: null,
|
||||||
// coupleFullName:
|
coupleFullName:
|
||||||
// profileFamilyCouple?.couplePrefix ||
|
profileFamilyCouple?.couplePrefix ||
|
||||||
// profileFamilyCouple?.coupleFirstName ||
|
profileFamilyCouple?.coupleFirstName ||
|
||||||
// profileFamilyCouple?.coupleLastNameOld
|
profileFamilyCouple?.coupleLastNameOld
|
||||||
// ? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastName ?? ""}`.trim()
|
? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastName ?? ""}`.trim()
|
||||||
// : null,
|
: null,
|
||||||
// coupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
coupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||||
// currentAddress:
|
currentAddress:
|
||||||
// profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
|
profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
|
||||||
// currentSubDistrict:
|
currentSubDistrict:
|
||||||
// profiles.currentSubDistrict != null
|
profiles.currentSubDistrict != null
|
||||||
// ? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
|
? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
|
||||||
// : "",
|
: "",
|
||||||
// currentDistrict:
|
currentDistrict:
|
||||||
// profiles.currentDistrict != null
|
profiles.currentDistrict != null
|
||||||
// ? Extension.ToThaiNumber(profiles.currentDistrict.name)
|
? Extension.ToThaiNumber(profiles.currentDistrict.name)
|
||||||
// : "",
|
: "",
|
||||||
// currentProvince:
|
currentProvince:
|
||||||
// profiles.currentProvince != null
|
profiles.currentProvince != null
|
||||||
// ? Extension.ToThaiNumber(profiles.currentProvince.name)
|
? Extension.ToThaiNumber(profiles.currentProvince.name)
|
||||||
// : "",
|
: "",
|
||||||
// telephone:
|
telephone:
|
||||||
// profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
||||||
// url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_MGT}`,
|
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_MGT}`,
|
||||||
// url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
||||||
// yearUpload1: profiles.profileAvatars[0]
|
yearUpload1: profiles.profileAvatars[0]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// url2: _ImgUrl[1] ? _ImgUrl[1] : null,
|
url2: _ImgUrl[1] ? _ImgUrl[1] : null,
|
||||||
// yearUpload2: profiles.profileAvatars[1]
|
yearUpload2: profiles.profileAvatars[1]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[1].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// url3: _ImgUrl[2] ? _ImgUrl[2] : null,
|
url3: _ImgUrl[2] ? _ImgUrl[2] : null,
|
||||||
// yearUpload3: profiles.profileAvatars[2]
|
yearUpload3: profiles.profileAvatars[2]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[2].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// url4: _ImgUrl[3] ? _ImgUrl[3] : null,
|
url4: _ImgUrl[3] ? _ImgUrl[3] : null,
|
||||||
// yearUpload4: profiles.profileAvatars[3]
|
yearUpload4: profiles.profileAvatars[3]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[3].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// url5: _ImgUrl[4] ? _ImgUrl[4] : null,
|
url5: _ImgUrl[4] ? _ImgUrl[4] : null,
|
||||||
// yearUpload5: profiles.profileAvatars[4]
|
yearUpload5: profiles.profileAvatars[4]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[4].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// url6: _ImgUrl[5] ? _ImgUrl[5] : null,
|
url6: _ImgUrl[5] ? _ImgUrl[5] : null,
|
||||||
// yearUpload6: profiles.profileAvatars[5]
|
yearUpload6: profiles.profileAvatars[5]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[5].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// url7: _ImgUrl[6] ? _ImgUrl[6] : null,
|
url7: _ImgUrl[6] ? _ImgUrl[6] : null,
|
||||||
// yearUpload7: profiles.profileAvatars[6]
|
yearUpload7: profiles.profileAvatars[6]
|
||||||
// ? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt))
|
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[6].createdAt))
|
||||||
// : null,
|
: null,
|
||||||
// insignias,
|
insignias,
|
||||||
// leaves,
|
leaves,
|
||||||
// certs,
|
certs,
|
||||||
// trainings,
|
trainings,
|
||||||
// disciplines,
|
disciplines,
|
||||||
// educations,
|
educations,
|
||||||
// salarys,
|
salarys,
|
||||||
// };
|
};
|
||||||
|
|
||||||
// return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
// template: "kk1",
|
template: "kk1",
|
||||||
// reportName: "docx-report",
|
reportName: "docx-report",
|
||||||
// data: data,
|
data: data,
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* รายงาน ก.ก.1 (ข้าราชการ) ใหม่
|
* รายงาน ก.ก.1 (ข้าราชการ) ใหม่
|
||||||
|
|
@ -874,8 +874,8 @@ export class ProfileController extends Controller {
|
||||||
*
|
*
|
||||||
* @param {string} id Id โปรไฟล์
|
* @param {string} id Id โปรไฟล์
|
||||||
*/
|
*/
|
||||||
@Get("kk1/{id}")
|
@Get("kk1new/{id}")
|
||||||
public async getKk1(@Path() id: string, @Request() req: RequestWithUser) {
|
public async getKk1new(@Path() id: string, @Request() req: RequestWithUser) {
|
||||||
const profiles = await this.profileRepo.findOne({
|
const profiles = await this.profileRepo.findOne({
|
||||||
relations: ["currentSubDistrict", "currentDistrict", "currentProvince","registrationSubDistrict", "registrationDistrict", "registrationProvince", "profileAvatars"],
|
relations: ["currentSubDistrict", "currentDistrict", "currentProvince","registrationSubDistrict", "registrationDistrict", "registrationProvince", "profileAvatars"],
|
||||||
order: {
|
order: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue