รายงาน กก.1 เพิ่มเครื่องราช, การลา
This commit is contained in:
parent
014301dcc4
commit
f5eb3c8e86
1 changed files with 97 additions and 12 deletions
|
|
@ -56,6 +56,7 @@ import Extension from "../interfaces/extension";
|
|||
import { Prefixe } from "../entities/Prefixe";
|
||||
import { ProfileInsignia } from "../entities/ProfileInsignia";
|
||||
import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory";
|
||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||
|
||||
@Route("api/v1/org/profile")
|
||||
@Tags("Profile")
|
||||
|
|
@ -93,6 +94,7 @@ export class ProfileController extends Controller {
|
|||
private profileInsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||
private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
|
||||
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
|
||||
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
|
||||
/**
|
||||
* report ประวัติแบบย่อ ข้าราชการ
|
||||
*
|
||||
|
|
@ -236,17 +238,22 @@ export class ProfileController extends Controller {
|
|||
@Get("kk1/{id}")
|
||||
public async getKk1(@Path() id: string) {
|
||||
const profiles = await this.profileRepo.findOne({
|
||||
select: [
|
||||
"citizenId",
|
||||
"prefix",
|
||||
"firstName",
|
||||
"lastName",
|
||||
"birthDate",
|
||||
"currentAddress",
|
||||
"currentDistrictId",
|
||||
"currentProvinceId",
|
||||
"telephoneNumber",
|
||||
"avatar",
|
||||
// select: [
|
||||
// "citizenId",
|
||||
// "prefix",
|
||||
// "firstName",
|
||||
// "lastName",
|
||||
// "birthDate",
|
||||
// "currentAddress",
|
||||
// "currentDistrictId",
|
||||
// "currentProvinceId",
|
||||
// "telephoneNumber",
|
||||
// "avatar",
|
||||
// ],
|
||||
relations: [
|
||||
"currentSubDistrict",
|
||||
"currentDistrict",
|
||||
"currentProvince",
|
||||
],
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -359,7 +366,12 @@ export class ProfileController extends Controller {
|
|||
District: "",
|
||||
Area: "",
|
||||
Province: "",
|
||||
Telephone: profiles?.telephoneNumber ?? null,
|
||||
Telephone:
|
||||
profiles.telephoneNumber != null
|
||||
? Extension.ToThaiNumber(
|
||||
profiles.telephoneNumber
|
||||
)
|
||||
: "",
|
||||
CoupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
|
||||
CouplePrefix: profileFamilyCouple?.couplePrefix ?? "",
|
||||
CoupleFullName:
|
||||
|
|
@ -394,6 +406,22 @@ export class ProfileController extends Controller {
|
|||
profiles.dateRetireLaw != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateRetireLaw))
|
||||
: "",
|
||||
CurrentAddress:
|
||||
profiles.currentAddress != null
|
||||
? Extension.ToThaiNumber(profiles.currentAddress)
|
||||
: "",
|
||||
CurrentSubDistrict:
|
||||
profiles.currentSubDistrict != null
|
||||
? Extension.ToThaiNumber(profiles.currentSubDistrict.name)
|
||||
: "",
|
||||
CurrentDistrict:
|
||||
profiles.currentDistrict != null
|
||||
? Extension.ToThaiNumber(profiles.currentDistrict.name)
|
||||
: "",
|
||||
CurrentProvince:
|
||||
profiles.currentProvince != null
|
||||
? Extension.ToThaiNumber(profiles.currentProvince.name)
|
||||
: "",
|
||||
// AvatarId: profiles?.avatar ?? null,
|
||||
};
|
||||
|
||||
|
|
@ -497,6 +525,61 @@ export class ProfileController extends Controller {
|
|||
FullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
}));
|
||||
|
||||
const insignias = await this.profileInsigniaRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
insigniaType: true,
|
||||
},
|
||||
},
|
||||
where: { profileId: id },
|
||||
order: { receiveDate: "ASC" },
|
||||
});
|
||||
const Insignia = insignias.map((item) => ({
|
||||
ReceiveDate: item.receiveDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.receiveDate))
|
||||
: "",
|
||||
InsigniaName: item.insignia.name,
|
||||
InsigniaShortName: item.insignia.shortName,
|
||||
InsigniaTypeName: item.insignia.insigniaType.name,
|
||||
No: item.no
|
||||
? Extension.ToThaiNumber(item.no)
|
||||
: "",
|
||||
Issue: item.issue
|
||||
? item.issue
|
||||
: "",
|
||||
VolumeNo: item.volumeNo
|
||||
? Extension.ToThaiNumber(item.volumeNo)
|
||||
: "",
|
||||
Volume: item.volume
|
||||
? Extension.ToThaiNumber(item.volume)
|
||||
: "",
|
||||
Section: item.section
|
||||
? Extension.ToThaiNumber(item.section)
|
||||
: "",
|
||||
Page: item.page
|
||||
? Extension.ToThaiNumber(item.page)
|
||||
: "",
|
||||
RefCommandDate: item.refCommandDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
|
||||
: "",
|
||||
}));
|
||||
|
||||
const leaves = await this.profileLeaveRepository.find({
|
||||
relations: { leaveType: true },
|
||||
where: { profileId: id },
|
||||
order: { dateLeaveStart: "ASC" },
|
||||
});
|
||||
const Leave = leaves.map((item) => ({
|
||||
LeaveTypeName: item.leaveType.name,
|
||||
DateLeaveStart: item.dateLeaveStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart))
|
||||
: "",
|
||||
LeaveDays: item.leaveDays
|
||||
? Extension.ToThaiNumber(item.leaveDays.toString())
|
||||
: "",
|
||||
}));
|
||||
|
||||
return new HttpSuccess({
|
||||
Profile: [Profile],
|
||||
Cert,
|
||||
|
|
@ -504,6 +587,8 @@ export class ProfileController extends Controller {
|
|||
Discipline,
|
||||
Education,
|
||||
Salary,
|
||||
Insignia,
|
||||
Leave
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue