Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m0s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m0s
This commit is contained in:
commit
8ac7e81f95
4 changed files with 225 additions and 199 deletions
|
|
@ -500,7 +500,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||
)?.orgChild4?.id ?? null,
|
||||
};
|
||||
let pos = await this.posMasterRepository.findOne({
|
||||
let pos = await this.empPosMasterRepository.findOne({
|
||||
relations: ["current_holder"],
|
||||
where: {
|
||||
orgRevision: {
|
||||
|
|
@ -526,7 +526,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
commanderId = pos.current_holder?.id;
|
||||
commanderKeycloak = pos.current_holder?.keycloak;
|
||||
} else {
|
||||
let pos = await this.posMasterRepository.findOne({
|
||||
let pos = await this.empPosMasterRepository.findOne({
|
||||
relations: ["current_holder"],
|
||||
where: {
|
||||
orgRevision: {
|
||||
|
|
@ -551,7 +551,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
commanderId = pos.current_holder?.id;
|
||||
commanderKeycloak = pos.current_holder?.keycloak;
|
||||
} else {
|
||||
let pos = await this.posMasterRepository.findOne({
|
||||
let pos = await this.empPosMasterRepository.findOne({
|
||||
relations: ["current_holder"],
|
||||
where: {
|
||||
orgRevision: {
|
||||
|
|
@ -576,7 +576,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
commanderId = pos.current_holder?.id;
|
||||
commanderKeycloak = pos.current_holder?.keycloak;
|
||||
} else {
|
||||
let pos = await this.posMasterRepository.findOne({
|
||||
let pos = await this.empPosMasterRepository.findOne({
|
||||
relations: ["current_holder"],
|
||||
where: {
|
||||
orgRevision: {
|
||||
|
|
@ -601,7 +601,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
commanderId = pos.current_holder?.id;
|
||||
commanderKeycloak = pos.current_holder?.keycloak;
|
||||
} else {
|
||||
let pos = await this.posMasterRepository.findOne({
|
||||
let pos = await this.empPosMasterRepository.findOne({
|
||||
relations: ["current_holder"],
|
||||
where: {
|
||||
orgRevision: {
|
||||
|
|
@ -2658,9 +2658,13 @@ export class OrganizationDotnetController extends Controller {
|
|||
posLevel: profile.posLevel?.posLevelName ?? "",
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary,
|
||||
profileInsignia: profile.profileInsignias.map((x) => {
|
||||
return { ...x, insignia: x.insignia.name };
|
||||
}),
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia: profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
|
|||
|
|
@ -1664,9 +1664,13 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
posLevel: profile.posLevel?.posLevelName ?? "",
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary,
|
||||
profileInsignia: profile.profileInsignias.map((x) => {
|
||||
return { ...x, insignia: x.insignia.name };
|
||||
}),
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia: profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
|
|||
|
|
@ -10821,114 +10821,124 @@ export class ProfileController extends Controller {
|
|||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||
}
|
||||
|
||||
let findProfile: any;
|
||||
let total: any;
|
||||
const skip = (page - 1) * pageSize;
|
||||
const take = pageSize;
|
||||
let queryLike = "1=1";
|
||||
switch (body.fieldName) {
|
||||
case "citizenId":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
citizenId: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
queryLike = "profile.citizenId LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "fullName":
|
||||
[findProfile, total] = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.where("profile.keycloak IS NULL")
|
||||
.andWhere(
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword",
|
||||
{ keyword: `%${body.keyword}%` }
|
||||
)
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
.getManyAndCount();
|
||||
queryLike =
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "firstname":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
firstName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
case "firstName":
|
||||
queryLike = "profile.firstName LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "lastname":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
lastName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
case "lastName":
|
||||
queryLike = "profile.lastName LIKE :keyword";
|
||||
break;
|
||||
|
||||
default:
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
queryLike = "1=1";
|
||||
break;
|
||||
}
|
||||
|
||||
let query = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.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")
|
||||
.where("profile.keycloak IS NULL")
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
||||
}),
|
||||
);
|
||||
|
||||
const [findProfile, total] = await query
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
const mapDataProfile = await Promise.all(
|
||||
findProfile.map(async (item: Profile) => {
|
||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
||||
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}`
|
||||
let shortName = null;
|
||||
let root = null;
|
||||
let posMasterNo = null;
|
||||
if (item.isLeave == false) {
|
||||
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)?.orgChild3 !=
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
||||
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)?.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)
|
||||
?.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)?.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)
|
||||
?.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 &&
|
||||
?.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)
|
||||
?.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 root =
|
||||
item.current_holders.length == 0 ||
|
||||
(item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
const posMasterNo = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.posMasterNo;
|
||||
?.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;
|
||||
root =
|
||||
item.current_holders.length == 0 ||
|
||||
(item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
root = root == null ? null : root.orgRootName;
|
||||
posMasterNo = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.posMasterNo;
|
||||
}
|
||||
else {
|
||||
const profileSalary = await this.salaryRepo
|
||||
.createQueryBuilder("s")
|
||||
.where("s.profileId = :profileId", { profileId: item.id })
|
||||
.andWhere("s.commandCode IN (:...codes)", {
|
||||
codes: ["0","9","1","2","3","4","8","10","11","12","13","14","15","16"],
|
||||
})
|
||||
.orderBy("s.order", "DESC")
|
||||
.addOrderBy("s.createdAt", "DESC")
|
||||
.take(2)
|
||||
.getMany();
|
||||
if (profileSalary.length > 0) {
|
||||
shortName = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? `${profileSalary[1]?.posNoAbb} ${profileSalary[1]?.posNo}`
|
||||
: `${profileSalary[0]?.posNoAbb} ${profileSalary[0]?.posNo}`
|
||||
: `${profileSalary[0]?.posNoAbb} ${profileSalary[0]?.posNo}`;
|
||||
posMasterNo = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? profileSalary[1]?.posNo
|
||||
: profileSalary[0]?.posNo
|
||||
: profileSalary[0]?.posNo;
|
||||
root = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? profileSalary[1]?.orgRoot
|
||||
: profileSalary[0]?.orgRoot
|
||||
: profileSalary[0]?.orgRoot;
|
||||
}
|
||||
}
|
||||
|
||||
const latestProfileEducation = await this.profileEducationRepo.findOne({
|
||||
where: { profileId: item.id },
|
||||
|
|
@ -10952,7 +10962,7 @@ export class ProfileController extends Controller {
|
|||
positionType: item.posTypeId,
|
||||
positionTypeName: item.posType?.posTypeName,
|
||||
posNo: shortName,
|
||||
organization: root == null ? null : root.orgRootName,
|
||||
organization: root,
|
||||
salary: item.amount,
|
||||
posMasterNo: posMasterNo ?? null,
|
||||
posTypeId: item.posTypeId,
|
||||
|
|
|
|||
|
|
@ -5735,119 +5735,127 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (!findRevision) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||
}
|
||||
|
||||
let findProfile: any;
|
||||
let total: any;
|
||||
const skip = (page - 1) * pageSize;
|
||||
const take = pageSize;
|
||||
switch (body.fieldName) {
|
||||
case "citizenId":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
citizenId: Like(`%${body.keyword}%`),
|
||||
employeeClass: "PERM",
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
|
||||
case "fullName":
|
||||
[findProfile, total] = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.where("profile.keycloak IS NULL")
|
||||
.andWhere(
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword",
|
||||
{ keyword: `%${body.keyword}%` }
|
||||
)
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
.getManyAndCount();
|
||||
break;
|
||||
|
||||
case "firstname":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
firstName: Like(`%${body.keyword}%`),
|
||||
employeeClass: "PERM",
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
|
||||
case "lastname":
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
lastName: Like(`%${body.keyword}%`),
|
||||
employeeClass: "PERM",
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
keycloak: IsNull(),
|
||||
employeeClass: "PERM",
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
let queryLike = "1=1";
|
||||
switch (body.fieldName) {
|
||||
case "citizenId":
|
||||
queryLike = "profile.citizenId LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "fullName":
|
||||
queryLike =
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "firstName":
|
||||
queryLike = "profile.firstName LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "lastName":
|
||||
queryLike = "profile.lastName LIKE :keyword";
|
||||
break;
|
||||
|
||||
default:
|
||||
queryLike = "1=1";
|
||||
break;
|
||||
}
|
||||
|
||||
let query = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.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")
|
||||
.where("profile.keycloak IS NULL")
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
||||
}),
|
||||
);
|
||||
|
||||
const [findProfile, total] = await query
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
const mapDataProfile = await Promise.all(
|
||||
findProfile.map(async (item: ProfileEmployee) => {
|
||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
||||
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}`
|
||||
let shortName = null;
|
||||
let root = null;
|
||||
let posMasterNo = null;
|
||||
if (item.isLeave == false) {
|
||||
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)?.orgChild3 !=
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
||||
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)?.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)
|
||||
?.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)?.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)
|
||||
?.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 &&
|
||||
?.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)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: null;
|
||||
?.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 root =
|
||||
item.current_holders.length == 0 ||
|
||||
(item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
const posMasterNo = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.posMasterNo;
|
||||
root =
|
||||
item.current_holders.length == 0 ||
|
||||
(item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
root = root == null ? null : root.orgRootName;
|
||||
posMasterNo = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.posMasterNo;
|
||||
}
|
||||
else {
|
||||
const profileSalary = await this.salaryRepo
|
||||
.createQueryBuilder("s")
|
||||
.where("s.profileEmployeeId = :profileId", { profileId: item.id })
|
||||
.andWhere("s.commandCode IN (:...codes)", {
|
||||
codes: ["0","9","1","2","3","4","8","10","11","12","13","14","15","16"],
|
||||
})
|
||||
.orderBy("s.order", "DESC")
|
||||
.addOrderBy("s.createdAt", "DESC")
|
||||
.take(2)
|
||||
.getMany();
|
||||
if (profileSalary.length > 0) {
|
||||
shortName = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? `${profileSalary[1]?.posNoAbb} ${profileSalary[1]?.posNo}`
|
||||
: `${profileSalary[0]?.posNoAbb} ${profileSalary[0]?.posNo}`
|
||||
: `${profileSalary[0]?.posNoAbb} ${profileSalary[0]?.posNo}`;
|
||||
posMasterNo = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? profileSalary[1]?.posNo
|
||||
: profileSalary[0]?.posNo
|
||||
: profileSalary[0]?.posNo;
|
||||
root = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? profileSalary[1]?.orgRoot
|
||||
: profileSalary[0]?.orgRoot
|
||||
: profileSalary[0]?.orgRoot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const latestProfileEducation = await this.profileEducationRepo.findOne({
|
||||
where: { profileEmployeeId: item.id },
|
||||
|
|
@ -5871,7 +5879,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
positionType: item.posTypeId,
|
||||
positionTypeName: item.posType?.posTypeName,
|
||||
posNo: shortName,
|
||||
organization: root == null ? null : root.orgRootName,
|
||||
organization: root,
|
||||
salary: item.amount,
|
||||
posMasterNo: posMasterNo ?? null,
|
||||
posTypeId: item.posTypeId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue