เผยแพร่ข้อมูลโครงสร้าง
This commit is contained in:
parent
4f8bc677a0
commit
149be41373
3 changed files with 118 additions and 19 deletions
|
|
@ -1680,22 +1680,22 @@ export class OrganizationController extends Controller {
|
|||
: item != null && item?.orgRoot != null
|
||||
? `${item.orgRoot.orgRootShortName}${item.posMasterNo}`
|
||||
: null;
|
||||
// await new CallAPI().PostData(request, "org/profile/salary", {
|
||||
// profileId: item.next_holderId,
|
||||
// date: new Date(),
|
||||
// amount: profileSalary?.amount ?? null,
|
||||
// positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null,
|
||||
// mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null,
|
||||
// posNo: shortName,
|
||||
// position: position?.positionName ?? _null,
|
||||
// positionLine: position?.positionField ?? _null,
|
||||
// positionPathSide: position?.positionArea ?? _null,
|
||||
// positionExecutive: position?.posExecutive?.posExecutiveName ?? _null,
|
||||
// positionType: position?.posType?.posTypeName ?? _null,
|
||||
// positionLevel: position?.posLevel?.posLevelName ?? _null,
|
||||
// refCommandNo: null,
|
||||
// templateDoc: "ปรับโครงสร้าง",
|
||||
// });
|
||||
await new CallAPI().PostData(request, "org/profile/salary", {
|
||||
profileId: item.next_holderId,
|
||||
date: new Date(),
|
||||
amount: profileSalary?.amount ?? null,
|
||||
positionSalaryAmount: profileSalary?.positionSalaryAmount ?? null,
|
||||
mouthSalaryAmount: profileSalary?.mouthSalaryAmount ?? null,
|
||||
posNo: shortName,
|
||||
position: position?.positionName ?? _null,
|
||||
positionLine: position?.positionField ?? _null,
|
||||
positionPathSide: position?.positionArea ?? _null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? _null,
|
||||
positionType: position?.posType?.posTypeName ?? _null,
|
||||
positionLevel: position?.posLevel?.posLevelName ?? _null,
|
||||
refCommandNo: null,
|
||||
templateDoc: "ปรับโครงสร้าง",
|
||||
});
|
||||
}
|
||||
item.current_holderId = item.next_holderId;
|
||||
item.next_holderId = null;
|
||||
|
|
|
|||
|
|
@ -239,6 +239,84 @@ export class OrganizationDotnetController extends Controller {
|
|||
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
/**
|
||||
* 3. API Get Profile จาก profile id
|
||||
*
|
||||
* @summary 3. API Get Profile จาก profile id
|
||||
*
|
||||
* @param {string} profileId Id profile
|
||||
*/
|
||||
@Get("profile/{profileId}")
|
||||
async GetProfileByProfileIdAsync(@Path() profileId: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { id: profileId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const mapProfile = {
|
||||
id: profile.id,
|
||||
avatar: profile.avatar,
|
||||
avatarName: profile.avatarName,
|
||||
rank: profile.rank,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
position: profile.position,
|
||||
posLevelId: profile.posLevelId,
|
||||
email: profile.email,
|
||||
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,
|
||||
};
|
||||
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
/**
|
||||
* 3. API Get Profile จาก keycloak id
|
||||
*
|
||||
|
|
|
|||
|
|
@ -178,6 +178,20 @@ export class ProfileController extends Controller {
|
|||
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
|
||||
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
|
||||
|
||||
const educations = await this.educationRepository.find({
|
||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
|
||||
where: { profileId: id },
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
const Education = educations.map((item) => ({
|
||||
Institute: item.institute,
|
||||
Date:
|
||||
item.startDate && item.endDate
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.endDate))}`
|
||||
: "",
|
||||
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "",
|
||||
}));
|
||||
|
||||
const mapData = {
|
||||
Id: profile.id,
|
||||
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
||||
|
|
@ -199,7 +213,7 @@ export class ProfileController extends Controller {
|
|||
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
||||
: "",
|
||||
Education: profile.profileEducations,
|
||||
Education: Education,
|
||||
AppointText:
|
||||
profile.dateAppoint != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
|
||||
|
|
@ -498,7 +512,7 @@ export class ProfileController extends Controller {
|
|||
@Get("placement/{id}")
|
||||
async getProfilePlacement(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: request.user.sub },
|
||||
where: { id: id },
|
||||
});
|
||||
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
|
|
@ -4989,7 +5003,14 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Get("salarym/zxczxcsa")
|
||||
async zxczxczxczxczxc() {
|
||||
const profile = await this.profileRepo.find({ relations: ["current_holders", "next_holders"] });
|
||||
const [profile, total] = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("profile.next_holders", "next_holders")
|
||||
.skip(1)
|
||||
.take(50)
|
||||
.getManyAndCount();
|
||||
|
||||
const profiles = await Promise.all(
|
||||
profile.map(async (_data) => {
|
||||
if (_data.current_holders.length == 0 && _data.next_holders.length == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue