no message
This commit is contained in:
parent
28a457eaf9
commit
1e5ab2d08d
1 changed files with 104 additions and 2 deletions
|
|
@ -106,7 +106,15 @@ export class OrganizationDotnetController extends Controller {
|
|||
const queryBuilder = profileRepository
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.posType", "posType");
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.orderBy("profileSalarys.order", "DESC");
|
||||
|
||||
if (body.citizenId || body.firstName || body.lastName) {
|
||||
queryBuilder.where(
|
||||
|
|
@ -123,8 +131,102 @@ export class OrganizationDotnetController extends Controller {
|
|||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const profileEmp = await queryBuilder.getMany();
|
||||
return new HttpSuccess(profileEmp);
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
||||
const profileEmp_ = await Promise.all(
|
||||
profileEmp.map((item: ProfileEmployee) => {
|
||||
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,
|
||||
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,
|
||||
posLevel: item.posLevel,
|
||||
posType: item.posType,
|
||||
posNo: shortName
|
||||
}
|
||||
})
|
||||
);
|
||||
return new HttpSuccess(profileEmp_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue