no message

This commit is contained in:
kittapath 2024-11-18 17:23:40 +07:00
parent 3c9698f606
commit 9e78cf7345

View file

@ -514,7 +514,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
amountd: profile.amount, amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
root: root:
profile?.current_holders?.find( profile?.current_holders?.find(
(x) => (x) =>
@ -749,7 +751,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
amountd: profile.amount, amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
root: root:
profile?.current_holders?.find( profile?.current_holders?.find(
(x) => (x) =>
@ -1043,7 +1047,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
amountd: profile.amount, amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
root: root:
profile?.current_holders?.find( profile?.current_holders?.find(
(x) => (x) =>
@ -1308,7 +1314,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
amountd: profile.amount, amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
root: root:
profile?.current_holders?.find( profile?.current_holders?.find(
(x) => (x) =>
@ -1632,7 +1640,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
amountd: profile.amount, amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
root: root:
profile?.current_holders?.find( profile?.current_holders?.find(
(x) => (x) =>
@ -1897,7 +1907,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
amountd: profile.amount, amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
root: root:
profile?.current_holders?.find( profile?.current_holders?.find(
(x) => (x) =>
@ -1979,12 +1991,20 @@ export class OrganizationDotnetController extends Controller {
@Get("root/officer/{rootId}") @Get("root/officer/{rootId}")
async GetProfileByRootIdAsync(@Path() rootId: string) { async GetProfileByRootIdAsync(@Path() rootId: string) {
const profiles = await this.profileRepo.find({ const profiles = await this.profileRepo.find({
relations: { relations: [
posLevel: true, "posLevel",
posType: true, "posType",
profileSalary: true, "profileSalary",
profileInsignias: true, "profileInsignias",
}, "profileInsignias.insignia",
"current_holders",
"current_holders.orgRevision",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
],
where: { current_holders: { orgRootId: rootId } }, where: { current_holders: { orgRootId: rootId } },
order: { order: {
profileSalary: { profileSalary: {
@ -1995,55 +2015,107 @@ export class OrganizationDotnetController extends Controller {
}, },
}, },
}); });
// if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = profiles.map((profile) => ({ const findRevision = await this.orgRevisionRepo.findOne({
id: profile.id, where: { orgRevisionIsCurrent: true },
avatar: profile.avatar, });
avatarName: profile.avatarName,
rank: profile.rank, const mapProfile = profiles.map((profile) => {
prefix: profile.prefix, const shortName =
firstName: profile.firstName, profile.current_holders.length == 0
lastName: profile.lastName, ? null
citizenId: profile.citizenId, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
position: profile.position, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
posLevelId: profile.posLevelId, null
email: profile.email, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
phone: profile.phone, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
keycloak: profile.keycloak, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
isProbation: profile.isProbation, ?.orgChild3 != null
isLeave: profile.isLeave, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
leaveReason: profile.leaveReason, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
dateRetire: profile.dateRetire, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
dateAppoint: profile.dateAppoint, ?.orgChild2 != null
dateRetireLaw: profile.dateRetireLaw, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
dateStart: profile.dateStart, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
govAgeAbsent: profile.govAgeAbsent, null &&
govAgePlus: profile.govAgePlus, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
birthDate: profile.birthDate, ?.orgChild1 != null
reasonSameDate: profile.reasonSameDate, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
telephoneNumber: profile.telephoneNumber, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
nationality: profile.nationality, null &&
gender: profile.gender, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
relationship: profile.relationship, ?.orgRoot != null
religion: profile.religion, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
bloodGroup: profile.bloodGroup, : null;
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId, return {
registrationDistrictId: profile.registrationDistrictId, id: profile.id,
registrationSubDistrictId: profile.registrationSubDistrictId, avatar: profile.avatar,
registrationZipCode: profile.registrationZipCode, avatarName: profile.avatarName,
currentAddress: profile.currentAddress, rank: profile.rank,
currentProvinceId: profile.currentProvinceId, prefix: profile.prefix,
currentSubDistrictId: profile.currentSubDistrictId, firstName: profile.firstName,
currentZipCode: profile.currentZipCode, lastName: profile.lastName,
dutyTimeId: profile.dutyTimeId, citizenId: profile.citizenId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, position: profile.position,
posLevel: profile.posLevel ? profile.posLevel : null, posLevelId: profile.posLevelId,
posType: profile.posType ? profile.posType : null, posTypeId: profile.posTypeId,
profileSalary: profile.profileSalary, email: profile.email,
profileInsignia: profile.profileInsignias, phone: profile.phone,
})); keycloak: profile.keycloak,
isProbation: profile.isProbation,
isLeave: profile.isLeave,
leaveReason: profile.leaveReason,
dateRetire: profile.dateRetire,
dateAppoint: profile.dateAppoint,
dateRetireLaw: profile.dateRetireLaw,
dateStart: profile.dateStart,
govAgeAbsent: profile.govAgeAbsent,
govAgePlus: profile.govAgePlus,
birthDate: profile.birthDate,
reasonSameDate: profile.reasonSameDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId,
registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId,
currentSubDistrictId: profile.currentSubDistrictId,
currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary,
profileInsignia: profile.profileInsignias.map((x) => {
return { ...x, insignia: x.insignia.name };
}),
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
profileType: "OFFICER",
root:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRoot?.orgRootName ?? null,
rootId:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRootId ?? null,
posNo: shortName,
};
});
return new HttpSuccess(mapProfile); return new HttpSuccess(mapProfile);
} }
@ -2058,12 +2130,20 @@ export class OrganizationDotnetController extends Controller {
@Get("root/employee/{rootId}") @Get("root/employee/{rootId}")
async GetProfileByRootIdEmpAsync(@Path() rootId: string) { async GetProfileByRootIdEmpAsync(@Path() rootId: string) {
const profiles = await this.profileEmpRepo.find({ const profiles = await this.profileEmpRepo.find({
relations: { relations: [
posLevel: true, "posLevel",
posType: true, "posType",
profileSalary: true, "profileSalary",
profileInsignias: true, "profileInsignias",
}, "profileInsignias.insignia",
"current_holders",
"current_holders.orgRevision",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
],
where: { current_holders: { orgRootId: rootId } }, where: { current_holders: { orgRootId: rootId } },
order: { order: {
profileSalary: { profileSalary: {
@ -2074,55 +2154,105 @@ export class OrganizationDotnetController extends Controller {
}, },
}, },
}); });
// if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = profiles.map((profile) => ({ const findRevision = await this.orgRevisionRepo.findOne({
id: profile.id, where: { orgRevisionIsCurrent: true },
avatar: profile.avatar, });
avatarName: profile.avatarName,
rank: profile.rank, const mapProfile = profiles.map((profile) => {
prefix: profile.prefix, const shortName =
firstName: profile.firstName, profile.current_holders.length == 0
lastName: profile.lastName, ? null
citizenId: profile.citizenId, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
position: profile.position, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
posLevelId: profile.posLevelId, null
email: profile.email, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
phone: profile.phone, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
keycloak: profile.keycloak, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
isProbation: profile.isProbation, ?.orgChild3 != null
isLeave: profile.isLeave, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
leaveReason: profile.leaveReason, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
dateRetire: profile.dateRetire, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
dateAppoint: profile.dateAppoint, ?.orgChild2 != null
dateRetireLaw: profile.dateRetireLaw, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
dateStart: profile.dateStart, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
govAgeAbsent: profile.govAgeAbsent, null &&
govAgePlus: profile.govAgePlus, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
birthDate: profile.birthDate, ?.orgChild1 != null
reasonSameDate: profile.reasonSameDate, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
telephoneNumber: profile.telephoneNumber, : profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
nationality: profile.nationality, null &&
gender: profile.gender, profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
relationship: profile.relationship, ?.orgRoot != null
religion: profile.religion, ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
bloodGroup: profile.bloodGroup, : null;
registrationAddress: profile.registrationAddress, return {
registrationProvinceId: profile.registrationProvinceId, id: profile.id,
registrationDistrictId: profile.registrationDistrictId, avatar: profile.avatar,
registrationSubDistrictId: profile.registrationSubDistrictId, avatarName: profile.avatarName,
registrationZipCode: profile.registrationZipCode, rank: profile.rank,
currentAddress: profile.currentAddress, prefix: profile.prefix,
currentProvinceId: profile.currentProvinceId, firstName: profile.firstName,
currentSubDistrictId: profile.currentSubDistrictId, lastName: profile.lastName,
currentZipCode: profile.currentZipCode, citizenId: profile.citizenId,
// dutyTimeId: profile.dutyTimeId, position: profile.position,
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, posLevelId: profile.posLevelId,
posLevel: profile.posLevel ? profile.posLevel : null, email: profile.email,
posType: profile.posType ? profile.posType : null, phone: profile.phone,
profileSalary: profile.profileSalary, keycloak: profile.keycloak,
profileInsignia: profile.profileInsignias, isProbation: profile.isProbation,
})); isLeave: profile.isLeave,
leaveReason: profile.leaveReason,
dateRetire: profile.dateRetire,
dateAppoint: profile.dateAppoint,
dateRetireLaw: profile.dateRetireLaw,
dateStart: profile.dateStart,
govAgeAbsent: profile.govAgeAbsent,
govAgePlus: profile.govAgePlus,
birthDate: profile.birthDate,
reasonSameDate: profile.reasonSameDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId,
registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId,
currentSubDistrictId: profile.currentSubDistrictId,
currentZipCode: profile.currentZipCode,
// dutyTimeId: profile.dutyTimeId,
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary,
profileInsignia: profile.profileInsignias.map((x) => {
return { ...x, insignia: x.insignia.name };
}),
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
profileType: "OFFICER",
root:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRoot?.orgRootName ?? null,
rootId:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRootId ?? null,
posNo: shortName,
};
});
return new HttpSuccess(mapProfile); return new HttpSuccess(mapProfile);
} }