map data
This commit is contained in:
parent
970ae04afd
commit
096b008741
1 changed files with 109 additions and 1 deletions
|
|
@ -799,8 +799,116 @@ export class OrganizationDotnetController extends Controller {
|
||||||
async GetProfileWithKeycloak() {
|
async GetProfileWithKeycloak() {
|
||||||
const profile = await this.profileRepo.find({
|
const profile = await this.profileRepo.find({
|
||||||
where: { keycloak: Not(IsNull()) || Not("") },
|
where: { keycloak: Not(IsNull()) || Not("") },
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
"profileSalary"
|
||||||
|
],
|
||||||
|
order: {
|
||||||
|
profileSalary: {
|
||||||
|
order: "DESC",
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new HttpSuccess(profile);
|
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
const profile_ = await Promise.all(
|
||||||
|
profile.map((item: Profile) => {
|
||||||
|
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 {
|
||||||
|
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,
|
||||||
|
reasonSameDate: item.reasonSameDate,
|
||||||
|
ethnicity: item.ethnicity,
|
||||||
|
telephoneNumber: item.telephoneNumber,
|
||||||
|
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.profileSalary.length > 0
|
||||||
|
? item.profileSalary[0].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo: shortName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
return new HttpSuccess(profile_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue