tuning api (ตัด profileSalary เส้นที่ไม่ได้ใช้งาน)
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m8s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m8s
This commit is contained in:
parent
ca433d5711
commit
987f8ef81a
1 changed files with 211 additions and 116 deletions
|
|
@ -4122,16 +4122,28 @@ export class OrganizationDotnetController extends Controller {
|
|||
async getAllProfileByKeycloak(@Path() keycloakId: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: keycloakId },
|
||||
relations: [
|
||||
"profileSalary",
|
||||
"profileEducations",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
// relations: [
|
||||
// "profileSalary",
|
||||
// "profileEducations",
|
||||
// "current_holders",
|
||||
// "current_holders.orgRoot",
|
||||
// "current_holders.orgChild1",
|
||||
// "current_holders.orgChild2",
|
||||
// "current_holders.orgChild3",
|
||||
// "current_holders.orgChild4",
|
||||
// ],
|
||||
relations:{
|
||||
posType: true,
|
||||
posLevel: true,
|
||||
current_holders: {
|
||||
orgRevision: true,
|
||||
orgRoot: true,
|
||||
orgChild1: true,
|
||||
orgChild2: true,
|
||||
orgChild3: true,
|
||||
orgChild4: true,
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||
|
|
@ -4292,7 +4304,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
@Get("keycloak")
|
||||
async GetProfileWithKeycloak() {
|
||||
const profile = await this.profileRepo.find({
|
||||
where: { keycloak: Not(IsNull()) || Not("") },
|
||||
where: { keycloak: Not(IsNull()) },
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -4302,111 +4314,194 @@ export class OrganizationDotnetController extends Controller {
|
|||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
"profileSalary",
|
||||
// "profileSalary",
|
||||
],
|
||||
order: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
// order: {
|
||||
// profileSalary: {
|
||||
// order: "DESC",
|
||||
// },
|
||||
// },
|
||||
});
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
||||
const profile_ = await Promise.all(
|
||||
profile.map((item: Profile) => {
|
||||
const rootName =
|
||||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
||||
?.orgRootName;
|
||||
const shortName =
|
||||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
// const profile_ = await Promise.all(
|
||||
// profile.map((item: Profile) => {
|
||||
// const rootName =
|
||||
// item.current_holders.length == 0
|
||||
// ? null
|
||||
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
||||
// ?.orgRootName;
|
||||
// const shortName =
|
||||
// item.current_holders.length == 0
|
||||
// ? null
|
||||
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
// null
|
||||
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
// ?.orgChild3 != null
|
||||
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
// ?.orgChild2 != null
|
||||
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
// ?.orgChild1 != null
|
||||
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
// : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
// null &&
|
||||
// item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
// ?.orgRoot != null
|
||||
// ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
// : null;
|
||||
|
||||
return {
|
||||
oc: rootName,
|
||||
id: item.id,
|
||||
createdAt: item.createdAt,
|
||||
createdUserId: item.createdUserId,
|
||||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
lastUpdateUserId: item.lastUpdateUserId,
|
||||
createdFullName: item.createdFullName,
|
||||
lastUpdateFullName: item.lastUpdateFullName,
|
||||
avatar: item.avatar,
|
||||
avatarName: item.avatarName,
|
||||
rank: item.rank,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: item.citizenId,
|
||||
position: item.position,
|
||||
posLevelId: item.posLevelId,
|
||||
posTypeId: item.posTypeId,
|
||||
email: item.email,
|
||||
phone: item.phone,
|
||||
keycloak: item.keycloak,
|
||||
isProbation: item.isProbation,
|
||||
isLeave: item.isLeave,
|
||||
leaveReason: item.leaveReason,
|
||||
dateLeave: item.dateLeave,
|
||||
dateRetire: item.dateRetire,
|
||||
dateAppoint: item.dateAppoint,
|
||||
dateRetireLaw: item.dateRetireLaw,
|
||||
dateStart: item.dateStart,
|
||||
govAgeAbsent: item.govAgeAbsent,
|
||||
govAgePlus: item.govAgePlus,
|
||||
birthDate: item.birthDate ?? new Date(),
|
||||
reasonSameDate: item.reasonSameDate,
|
||||
ethnicity: item.ethnicity,
|
||||
telephoneNumber: item.phone,
|
||||
nationality: item.nationality,
|
||||
gender: item.gender,
|
||||
relationship: item.relationship,
|
||||
religion: item.religion,
|
||||
bloodGroup: item.bloodGroup,
|
||||
registrationAddress: item.registrationAddress,
|
||||
registrationProvinceId: item.registrationProvinceId,
|
||||
registrationDistrictId: item.registrationDistrictId,
|
||||
registrationSubDistrictId: item.registrationSubDistrictId,
|
||||
registrationZipCode: item.registrationZipCode,
|
||||
currentAddress: item.currentAddress,
|
||||
currentProvinceId: item.currentProvinceId,
|
||||
currentDistrictId: item.currentDistrictId,
|
||||
currentSubDistrictId: item.currentSubDistrictId,
|
||||
currentZipCode: item.currentZipCode,
|
||||
dutyTimeId: item.dutyTimeId,
|
||||
dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
||||
positionLevel: item.posLevel?.posLevelName ?? null,
|
||||
positionType: item.posType?.posTypeName ?? null,
|
||||
posNo: shortName,
|
||||
};
|
||||
}),
|
||||
);
|
||||
// return {
|
||||
// oc: rootName,
|
||||
// id: item.id,
|
||||
// createdAt: item.createdAt,
|
||||
// createdUserId: item.createdUserId,
|
||||
// lastUpdatedAt: item.lastUpdatedAt,
|
||||
// lastUpdateUserId: item.lastUpdateUserId,
|
||||
// createdFullName: item.createdFullName,
|
||||
// lastUpdateFullName: item.lastUpdateFullName,
|
||||
// avatar: item.avatar,
|
||||
// avatarName: item.avatarName,
|
||||
// rank: item.rank,
|
||||
// prefix: item.prefix,
|
||||
// firstName: item.firstName,
|
||||
// lastName: item.lastName,
|
||||
// citizenId: item.citizenId,
|
||||
// position: item.position,
|
||||
// posLevelId: item.posLevelId,
|
||||
// posTypeId: item.posTypeId,
|
||||
// email: item.email,
|
||||
// phone: item.phone,
|
||||
// keycloak: item.keycloak,
|
||||
// isProbation: item.isProbation,
|
||||
// isLeave: item.isLeave,
|
||||
// leaveReason: item.leaveReason,
|
||||
// dateLeave: item.dateLeave,
|
||||
// dateRetire: item.dateRetire,
|
||||
// dateAppoint: item.dateAppoint,
|
||||
// dateRetireLaw: item.dateRetireLaw,
|
||||
// dateStart: item.dateStart,
|
||||
// govAgeAbsent: item.govAgeAbsent,
|
||||
// govAgePlus: item.govAgePlus,
|
||||
// birthDate: item.birthDate ?? new Date(),
|
||||
// reasonSameDate: item.reasonSameDate,
|
||||
// ethnicity: item.ethnicity,
|
||||
// telephoneNumber: item.phone,
|
||||
// nationality: item.nationality,
|
||||
// gender: item.gender,
|
||||
// relationship: item.relationship,
|
||||
// religion: item.religion,
|
||||
// bloodGroup: item.bloodGroup,
|
||||
// registrationAddress: item.registrationAddress,
|
||||
// registrationProvinceId: item.registrationProvinceId,
|
||||
// registrationDistrictId: item.registrationDistrictId,
|
||||
// registrationSubDistrictId: item.registrationSubDistrictId,
|
||||
// registrationZipCode: item.registrationZipCode,
|
||||
// currentAddress: item.currentAddress,
|
||||
// currentProvinceId: item.currentProvinceId,
|
||||
// currentDistrictId: item.currentDistrictId,
|
||||
// currentSubDistrictId: item.currentSubDistrictId,
|
||||
// currentZipCode: item.currentZipCode,
|
||||
// dutyTimeId: item.dutyTimeId,
|
||||
// dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
||||
// positionLevel: item.posLevel?.posLevelName ?? null,
|
||||
// positionType: item.posType?.posTypeName ?? null,
|
||||
// posNo: shortName,
|
||||
// };
|
||||
// }),
|
||||
// );
|
||||
const profile_ = profile.map((item: Profile) => {
|
||||
const holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId === findRevision?.id,
|
||||
);
|
||||
|
||||
const rootName = holder?.orgRoot?.orgRootName ?? null;
|
||||
|
||||
let shortName: string | null = null;
|
||||
|
||||
if (holder) {
|
||||
const posNo = holder.posMasterNo;
|
||||
|
||||
if (holder.orgChild4) {
|
||||
shortName = `${holder.orgChild4.orgChild4ShortName} ${posNo}`;
|
||||
} else if (holder.orgChild3) {
|
||||
shortName = `${holder.orgChild3.orgChild3ShortName} ${posNo}`;
|
||||
} else if (holder.orgChild2) {
|
||||
shortName = `${holder.orgChild2.orgChild2ShortName} ${posNo}`;
|
||||
} else if (holder.orgChild1) {
|
||||
shortName = `${holder.orgChild1.orgChild1ShortName} ${posNo}`;
|
||||
} else if (holder.orgRoot) {
|
||||
shortName = `${holder.orgRoot.orgRootShortName} ${posNo}`;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
oc: rootName,
|
||||
id: item.id,
|
||||
createdAt: item.createdAt,
|
||||
createdUserId: item.createdUserId,
|
||||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
lastUpdateUserId: item.lastUpdateUserId,
|
||||
createdFullName: item.createdFullName,
|
||||
lastUpdateFullName: item.lastUpdateFullName,
|
||||
avatar: item.avatar,
|
||||
avatarName: item.avatarName,
|
||||
rank: item.rank,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: item.citizenId,
|
||||
position: item.position,
|
||||
posLevelId: item.posLevelId,
|
||||
posTypeId: item.posTypeId,
|
||||
email: item.email,
|
||||
phone: item.phone,
|
||||
keycloak: item.keycloak,
|
||||
isProbation: item.isProbation,
|
||||
isLeave: item.isLeave,
|
||||
leaveReason: item.leaveReason,
|
||||
dateLeave: item.dateLeave,
|
||||
dateRetire: item.dateRetire,
|
||||
dateAppoint: item.dateAppoint,
|
||||
dateRetireLaw: item.dateRetireLaw,
|
||||
dateStart: item.dateStart,
|
||||
govAgeAbsent: item.govAgeAbsent,
|
||||
govAgePlus: item.govAgePlus,
|
||||
birthDate: item.birthDate ?? new Date(),
|
||||
reasonSameDate: item.reasonSameDate,
|
||||
ethnicity: item.ethnicity,
|
||||
telephoneNumber: item.phone,
|
||||
nationality: item.nationality,
|
||||
gender: item.gender,
|
||||
relationship: item.relationship,
|
||||
religion: item.religion,
|
||||
bloodGroup: item.bloodGroup,
|
||||
registrationAddress: item.registrationAddress,
|
||||
registrationProvinceId: item.registrationProvinceId,
|
||||
registrationDistrictId: item.registrationDistrictId,
|
||||
registrationSubDistrictId: item.registrationSubDistrictId,
|
||||
registrationZipCode: item.registrationZipCode,
|
||||
currentAddress: item.currentAddress,
|
||||
currentProvinceId: item.currentProvinceId,
|
||||
currentDistrictId: item.currentDistrictId,
|
||||
currentSubDistrictId: item.currentSubDistrictId,
|
||||
currentZipCode: item.currentZipCode,
|
||||
dutyTimeId: item.dutyTimeId,
|
||||
dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
||||
positionLevel: item.posLevel?.posLevelName ?? null,
|
||||
positionType: item.posType?.posTypeName ?? null,
|
||||
posNo: shortName,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess(profile_);
|
||||
}
|
||||
|
|
@ -4430,13 +4525,13 @@ export class OrganizationDotnetController extends Controller {
|
|||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
"profileSalary",
|
||||
// "profileSalary",
|
||||
],
|
||||
order: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
// order: {
|
||||
// profileSalary: {
|
||||
// order: "DESC",
|
||||
// },
|
||||
// },
|
||||
});
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
|
|
@ -7114,7 +7209,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
if (type.trim().toLocaleUpperCase() == "OFFICER") {
|
||||
profile = await this.profileRepo.find({
|
||||
relations: [
|
||||
"profileSalary",
|
||||
// "profileSalary",
|
||||
"profileInsignias",
|
||||
"profileDisciplines",
|
||||
"profileAssessments",
|
||||
|
|
@ -7124,7 +7219,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
} else {
|
||||
profile = await this.profileEmpRepo.find({
|
||||
relations: [
|
||||
"profileSalary",
|
||||
// "profileSalary",
|
||||
"profileInsignias",
|
||||
"profileDisciplines",
|
||||
"profileAssessments",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue