no message
This commit is contained in:
parent
826337c8d7
commit
000d1d6260
2 changed files with 261 additions and 1 deletions
|
|
@ -2619,6 +2619,266 @@ export class OrganizationDotnetController extends Controller {
|
|||
return new HttpSuccess(profile_);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||
*
|
||||
* @summary 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||
*
|
||||
*/
|
||||
@Get("keycloak-employee")
|
||||
async GetProfileWithKeycloakEmployee() {
|
||||
const profile = await this.profileEmpRepo.find({
|
||||
where: { keycloak: Not(IsNull()) || Not("") },
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
"profileSalary",
|
||||
],
|
||||
order: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
||||
const profile_ = await Promise.all(
|
||||
profile.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 ?? new Date(),
|
||||
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,
|
||||
dutyTimeId: item.dutyTimeId,
|
||||
dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
|
||||
positionLevel: item.profileSalary.length > 0 ? item.profileSalary[0].positionLevel : null,
|
||||
posNo: shortName,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(profile_);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||
*
|
||||
* @summary 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||
*
|
||||
*/
|
||||
@Get("keycloak-all-officer")
|
||||
async GetProfileWithKeycloakAllOfficer() {
|
||||
const profile = await this.profileRepo.find({
|
||||
where: { keycloak: Not(IsNull()) || Not(""), isLeave: false },
|
||||
relations: [
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
});
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
||||
const profile_ = await Promise.all(
|
||||
profile.map((item: Profile) => {
|
||||
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 {
|
||||
id: item.id,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
keycloak: item.keycloak,
|
||||
posNo: shortName,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(profile_);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||
*
|
||||
* @summary 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||
*
|
||||
*/
|
||||
@Get("keycloak-all-employee")
|
||||
async GetProfileWithKeycloakAllEmployee() {
|
||||
const profile = await this.profileEmpRepo.find({
|
||||
where: { keycloak: Not(IsNull()) || Not(""), isLeave: false },
|
||||
relations: [
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
});
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
||||
const profile_ = await Promise.all(
|
||||
profile.map((item: ProfileEmployee) => {
|
||||
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 {
|
||||
id: item.id,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: item.citizenId,
|
||||
keycloak: item.keycloak,
|
||||
posNo: shortName,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(profile_);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. API Update รอบการลงเวลา ในตาราง profile
|
||||
*
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ export class WorkflowController extends Controller {
|
|||
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
|
||||
|
||||
if (state.stateUserComments.filter((x) => x.profileId == body.profileId).length > 0)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "มีผู้ใช้งานนี้อยู่แล้ว");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถเลือกซ้ำได้");
|
||||
|
||||
const stateUserComment = new StateUserComment();
|
||||
stateUserComment.order = state.stateUserComments.length + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue