add วันที่มีผลคำสั่ง
This commit is contained in:
parent
a61825eb57
commit
dbdf136d97
1 changed files with 160 additions and 136 deletions
|
|
@ -27,9 +27,7 @@ import { Insignia } from "../entities/Insignia";
|
||||||
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
|
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
|
||||||
import { PosMaster } from "../entities/PosMaster";
|
import { PosMaster } from "../entities/PosMaster";
|
||||||
import { EmployeePosDict } from "../entities/EmployeePosDict";
|
import { EmployeePosDict } from "../entities/EmployeePosDict";
|
||||||
import {
|
import { calculateRetireLaw } from "../interfaces/utils";
|
||||||
calculateRetireLaw
|
|
||||||
} from "../interfaces/utils";
|
|
||||||
import Extension from "../interfaces/extension";
|
import Extension from "../interfaces/extension";
|
||||||
@Route("api/v1/org/dotnet")
|
@Route("api/v1/org/dotnet")
|
||||||
@Tags("Dotnet")
|
@Tags("Dotnet")
|
||||||
|
|
@ -2012,27 +2010,32 @@ export class OrganizationDotnetController extends Controller {
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild4Id ?? null,
|
)?.orgChild4Id ?? null,
|
||||||
rootDnaId: profile?.current_holders?.find(
|
rootDnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgRoot?.ancestorDNA ?? null,
|
)?.orgRoot?.ancestorDNA ?? null,
|
||||||
child1DnaId: profile?.current_holders?.find(
|
child1DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild1?.ancestorDNA ?? null,
|
)?.orgChild1?.ancestorDNA ?? null,
|
||||||
child2DnaId: profile?.current_holders?.find(
|
child2DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild2?.ancestorDNA ?? null,
|
)?.orgChild2?.ancestorDNA ?? null,
|
||||||
child3DnaId: profile?.current_holders?.find(
|
child3DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild3?.ancestorDNA ?? null,
|
)?.orgChild3?.ancestorDNA ?? null,
|
||||||
child4DnaId: profile?.current_holders?.find(
|
child4DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
|
@ -2304,27 +2307,32 @@ export class OrganizationDotnetController extends Controller {
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild4Id ?? null,
|
)?.orgChild4Id ?? null,
|
||||||
rootDnaId: profile?.current_holders?.find(
|
rootDnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgRoot?.ancestorDNA ?? null,
|
)?.orgRoot?.ancestorDNA ?? null,
|
||||||
child1DnaId: profile?.current_holders?.find(
|
child1DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild1?.ancestorDNA ?? null,
|
)?.orgChild1?.ancestorDNA ?? null,
|
||||||
child2DnaId: profile?.current_holders?.find(
|
child2DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild2?.ancestorDNA ?? null,
|
)?.orgChild2?.ancestorDNA ?? null,
|
||||||
child3DnaId: profile?.current_holders?.find(
|
child3DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild3?.ancestorDNA ?? null,
|
)?.orgChild3?.ancestorDNA ?? null,
|
||||||
child4DnaId: profile?.current_holders?.find(
|
child4DnaId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
|
@ -2819,7 +2827,9 @@ export class OrganizationDotnetController extends Controller {
|
||||||
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||||
posLevel: profile.posLevel?.posLevelName ?? "",
|
posLevel: profile.posLevel?.posLevelName ?? "",
|
||||||
posType: profile.posType?.posTypeName ?? "",
|
posType: profile.posType?.posTypeName ?? "",
|
||||||
profileSalary: profile.profileSalary,
|
profileSalary: profile.profileSalary.map((x) => {
|
||||||
|
return { ...x, date: x.commandDateAffect ?? new Date() };
|
||||||
|
}),
|
||||||
profileInsignia: profile.profileInsignias.map((x) => {
|
profileInsignia: profile.profileInsignias.map((x) => {
|
||||||
return { ...x, insignia: x.insignia.name };
|
return { ...x, insignia: x.insignia.name };
|
||||||
}),
|
}),
|
||||||
|
|
@ -4215,8 +4225,8 @@ export class OrganizationDotnetController extends Controller {
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
profileEducations: {
|
profileEducations: {
|
||||||
level: "ASC"
|
level: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -4242,8 +4252,8 @@ export class OrganizationDotnetController extends Controller {
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
profileEducations: {
|
profileEducations: {
|
||||||
level: "ASC"
|
level: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -4267,31 +4277,40 @@ export class OrganizationDotnetController extends Controller {
|
||||||
oc = `${_profileCurrent.orgChild4?.orgChild4Name}`;
|
oc = `${_profileCurrent.orgChild4?.orgChild4Name}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [profile.id]);
|
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [
|
||||||
|
profile.id,
|
||||||
|
]);
|
||||||
const _position = position.length > 0 ? position[0] : [];
|
const _position = position.length > 0 ? position[0] : [];
|
||||||
|
|
||||||
const mapEmpProfile = {
|
const mapEmpProfile = {
|
||||||
birthDate: profile.birthDate ?? "-",
|
birthDate: profile.birthDate ?? "-",
|
||||||
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-",
|
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-",
|
||||||
govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-",
|
govAge: profile.dateAppoint
|
||||||
|
? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี`
|
||||||
|
: "-",
|
||||||
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-",
|
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-",
|
||||||
dateAppoint: profile.dateAppoint,
|
dateAppoint: profile.dateAppoint,
|
||||||
dateCurrent: new Date(),
|
dateCurrent: new Date(),
|
||||||
amount: profile.amount ?? "-",
|
amount: profile.amount ?? "-",
|
||||||
telephoneNumber: profile.telephoneNumber ?? "-",
|
telephoneNumber: profile.telephoneNumber ?? "-",
|
||||||
positionName: profile.position ?? "-",
|
positionName: profile.position ?? "-",
|
||||||
posLevel: profile.posType && profile.posLevel
|
posLevel:
|
||||||
|
profile.posType && profile.posLevel
|
||||||
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
|
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
|
||||||
: "-",
|
: "-",
|
||||||
posType: profile.posType?.posTypeName ?? "-",
|
posType: profile.posType?.posTypeName ?? "-",
|
||||||
currentAddress: profile && profile.currentAddress
|
currentAddress:
|
||||||
|
profile && profile.currentAddress
|
||||||
? profile.currentAddress +
|
? profile.currentAddress +
|
||||||
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
||||||
? " ตำบล/แขวง " + profile.currentSubDistrict.name : "") +
|
? " ตำบล/แขวง " + profile.currentSubDistrict.name
|
||||||
|
: "") +
|
||||||
(profile.currentDistrict && profile.currentDistrict.name
|
(profile.currentDistrict && profile.currentDistrict.name
|
||||||
? " อำเภอ/เขต " + profile.currentDistrict.name : "") +
|
? " อำเภอ/เขต " + profile.currentDistrict.name
|
||||||
|
: "") +
|
||||||
(profile.currentProvince && profile.currentProvince.name
|
(profile.currentProvince && profile.currentProvince.name
|
||||||
? " จังหวัด " + profile.currentProvince.name : "") +
|
? " จังหวัด " + profile.currentProvince.name
|
||||||
|
: "") +
|
||||||
profile.currentZipCode
|
profile.currentZipCode
|
||||||
: "-",
|
: "-",
|
||||||
oc: oc ?? "-",
|
oc: oc ?? "-",
|
||||||
|
|
@ -4325,10 +4344,9 @@ export class OrganizationDotnetController extends Controller {
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild4?.orgChild4Name ?? null,
|
)?.orgChild4?.orgChild4Name ?? null,
|
||||||
positions: _position && _position.length > 0
|
positions:
|
||||||
? _position
|
_position && _position.length > 0
|
||||||
.slice(0, -1)
|
? _position.slice(0, -1).map((x: any, idx: number) => ({
|
||||||
.map((x:any, idx: number) => ({
|
|
||||||
positionName: x.positionName,
|
positionName: x.positionName,
|
||||||
dateStart: x.commandDateAffect ?? null,
|
dateStart: x.commandDateAffect ?? null,
|
||||||
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
||||||
|
|
@ -4341,21 +4359,21 @@ export class OrganizationDotnetController extends Controller {
|
||||||
orgChild4: x.orgChild4,
|
orgChild4: x.orgChild4,
|
||||||
}))
|
}))
|
||||||
: [],
|
: [],
|
||||||
educations: profile.profileEducations && profile.profileEducations.length > 0
|
educations:
|
||||||
? profile.profileEducations.map(x => ({
|
profile.profileEducations && profile.profileEducations.length > 0
|
||||||
|
? profile.profileEducations.map((x) => ({
|
||||||
educationLevel: x.educationLevel,
|
educationLevel: x.educationLevel,
|
||||||
institute: x.institute ?? "-",
|
institute: x.institute ?? "-",
|
||||||
country: x.country ?? "-",
|
country: x.country ?? "-",
|
||||||
finishDate: x.finishDate,
|
finishDate: x.finishDate,
|
||||||
}))
|
}))
|
||||||
: []
|
: [],
|
||||||
};
|
};
|
||||||
return new HttpSuccess(mapEmpProfile);
|
return new HttpSuccess(mapEmpProfile);
|
||||||
}
|
}
|
||||||
const _profileCurrent = profile?.current_holders?.find(
|
const _profileCurrent = profile?.current_holders?.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.orgRevision?.orgRevisionIsDraft === false &&
|
x.orgRevision?.orgRevisionIsDraft === false && x.orgRevision?.orgRevisionIsCurrent === true,
|
||||||
x.orgRevision?.orgRevisionIsCurrent === true,
|
|
||||||
);
|
);
|
||||||
let oc = "";
|
let oc = "";
|
||||||
if (_profileCurrent != null) {
|
if (_profileCurrent != null) {
|
||||||
|
|
@ -4377,7 +4395,9 @@ export class OrganizationDotnetController extends Controller {
|
||||||
const mapProfile = {
|
const mapProfile = {
|
||||||
birthDate: profile.birthDate ?? "-",
|
birthDate: profile.birthDate ?? "-",
|
||||||
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-",
|
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-",
|
||||||
govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-",
|
govAge: profile.dateAppoint
|
||||||
|
? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี`
|
||||||
|
: "-",
|
||||||
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-",
|
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-",
|
||||||
dateAppoint: profile.dateAppoint,
|
dateAppoint: profile.dateAppoint,
|
||||||
dateCurrent: new Date(),
|
dateCurrent: new Date(),
|
||||||
|
|
@ -4386,14 +4406,18 @@ export class OrganizationDotnetController extends Controller {
|
||||||
positionName: profile.position ?? "-",
|
positionName: profile.position ?? "-",
|
||||||
posLevel: profile.posLevel?.posLevelName ?? "-",
|
posLevel: profile.posLevel?.posLevelName ?? "-",
|
||||||
posType: profile.posType?.posTypeName ?? "-",
|
posType: profile.posType?.posTypeName ?? "-",
|
||||||
currentAddress: profile && profile.currentAddress
|
currentAddress:
|
||||||
|
profile && profile.currentAddress
|
||||||
? profile.currentAddress +
|
? profile.currentAddress +
|
||||||
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
||||||
? " ตำบล/แขวง " + profile.currentSubDistrict.name : "") +
|
? " ตำบล/แขวง " + profile.currentSubDistrict.name
|
||||||
|
: "") +
|
||||||
(profile.currentDistrict && profile.currentDistrict.name
|
(profile.currentDistrict && profile.currentDistrict.name
|
||||||
? " อำเภอ/เขต " + profile.currentDistrict.name : "") +
|
? " อำเภอ/เขต " + profile.currentDistrict.name
|
||||||
|
: "") +
|
||||||
(profile.currentProvince && profile.currentProvince.name
|
(profile.currentProvince && profile.currentProvince.name
|
||||||
? " จังหวัด " + profile.currentProvince.name : "") +
|
? " จังหวัด " + profile.currentProvince.name
|
||||||
|
: "") +
|
||||||
profile.currentZipCode
|
profile.currentZipCode
|
||||||
: "-",
|
: "-",
|
||||||
oc: oc ?? "-",
|
oc: oc ?? "-",
|
||||||
|
|
@ -4427,10 +4451,9 @@ export class OrganizationDotnetController extends Controller {
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild4?.orgChild4Name ?? null,
|
)?.orgChild4?.orgChild4Name ?? null,
|
||||||
positions: _position && _position.length > 0
|
positions:
|
||||||
? _position
|
_position && _position.length > 0
|
||||||
.slice(0, -1)
|
? _position.slice(0, -1).map((x: any, idx: number) => ({
|
||||||
.map((x:any, idx: number) => ({
|
|
||||||
positionName: x.positionName,
|
positionName: x.positionName,
|
||||||
dateStart: x.commandDateAffect ?? null,
|
dateStart: x.commandDateAffect ?? null,
|
||||||
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
||||||
|
|
@ -4443,14 +4466,15 @@ export class OrganizationDotnetController extends Controller {
|
||||||
orgChild4: x.orgChild4,
|
orgChild4: x.orgChild4,
|
||||||
}))
|
}))
|
||||||
: [],
|
: [],
|
||||||
educations: profile.profileEducations && profile.profileEducations.length > 0
|
educations:
|
||||||
? profile.profileEducations.map(x => ({
|
profile.profileEducations && profile.profileEducations.length > 0
|
||||||
|
? profile.profileEducations.map((x) => ({
|
||||||
educationLevel: x.educationLevel,
|
educationLevel: x.educationLevel,
|
||||||
institute: x.institute ?? "-",
|
institute: x.institute ?? "-",
|
||||||
country: x.country ?? "-",
|
country: x.country ?? "-",
|
||||||
finishDate: x.finishDate,
|
finishDate: x.finishDate,
|
||||||
}))
|
}))
|
||||||
: []
|
: [],
|
||||||
};
|
};
|
||||||
return new HttpSuccess(mapProfile);
|
return new HttpSuccess(mapProfile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue