no message
This commit is contained in:
parent
9d05e065b3
commit
16751b960a
2 changed files with 131 additions and 15 deletions
|
|
@ -288,7 +288,7 @@ export class PositionController extends Controller {
|
|||
requestBody.posExecutiveId = _null;
|
||||
}
|
||||
|
||||
if (requestBody.posExecutiveId != null && requestBody.posExecutiveId != "" ) {
|
||||
if (requestBody.posExecutiveId != null && requestBody.posExecutiveId != "") {
|
||||
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
|
||||
where: { id: requestBody.posExecutiveId },
|
||||
});
|
||||
|
|
@ -1611,7 +1611,7 @@ export class PositionController extends Controller {
|
|||
orgRootId: org.id,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
orgChild1Id: IsNull() || "",
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMaster != null)
|
||||
|
|
@ -1646,7 +1646,7 @@ export class PositionController extends Controller {
|
|||
orgChild1Id: org.id,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
orgChild2Id: IsNull() || "",
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMaster != null)
|
||||
|
|
@ -1680,7 +1680,7 @@ export class PositionController extends Controller {
|
|||
orgChild2Id: org.id,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
orgChild3Id: IsNull() || "",
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMaster != null)
|
||||
|
|
@ -1713,7 +1713,7 @@ export class PositionController extends Controller {
|
|||
orgChild3Id: org.id,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
orgChild4Id: IsNull() || "",
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMaster != null)
|
||||
|
|
@ -1740,7 +1740,7 @@ export class PositionController extends Controller {
|
|||
where: {
|
||||
orgChild4Id: org.id,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMaster != null)
|
||||
|
|
@ -1781,7 +1781,7 @@ export class PositionController extends Controller {
|
|||
orgRootId: r.id,
|
||||
orgChild1Id: IsNull() || "",
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMasterRoot != null) {
|
||||
|
|
@ -1808,7 +1808,7 @@ export class PositionController extends Controller {
|
|||
orgChild1Id: c1.id,
|
||||
orgChild2Id: IsNull() || "",
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMasterChild1 != null) {
|
||||
|
|
@ -1835,7 +1835,7 @@ export class PositionController extends Controller {
|
|||
orgChild2Id: c2.id,
|
||||
orgChild3Id: IsNull() || "",
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMasterChild2 != null) {
|
||||
|
|
@ -1862,7 +1862,7 @@ export class PositionController extends Controller {
|
|||
orgChild3Id: c3.id,
|
||||
orgChild4Id: IsNull() || "",
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMasterChild3 != null) {
|
||||
|
|
@ -1888,7 +1888,7 @@ export class PositionController extends Controller {
|
|||
orgRevisionId: orgRevision?.id,
|
||||
orgChild4Id: c4.id,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
id: Not(In(requestBody.positionMaster))
|
||||
id: Not(In(requestBody.positionMaster)),
|
||||
},
|
||||
});
|
||||
if (_posMasterChild4 != null) {
|
||||
|
|
@ -2483,7 +2483,7 @@ export class PositionController extends Controller {
|
|||
node: number;
|
||||
nodeId: string;
|
||||
position: string;
|
||||
typeCommand: string;
|
||||
typeCommand: string | null;
|
||||
posType: string;
|
||||
posLevel: string;
|
||||
isAll: boolean;
|
||||
|
|
|
|||
|
|
@ -563,9 +563,9 @@ export class ProfileController extends Controller {
|
|||
async searchProfileOrg(
|
||||
@Body()
|
||||
requestBody: {
|
||||
position?: string;
|
||||
posLevelId?: string;
|
||||
posTypeId?: string;
|
||||
position?: string | null;
|
||||
posLevelId?: string | null;
|
||||
posTypeId?: string | null;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
keyword?: string;
|
||||
|
|
@ -934,6 +934,122 @@ export class ProfileController extends Controller {
|
|||
return new HttpSuccess(_profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ข้อมูลทะเบียนประวัติตาม profileid
|
||||
*
|
||||
* @summary ORG_065 - ข้อมูลทะเบียนประวัติตาม profileid (ADMIN) #70
|
||||
*
|
||||
*/
|
||||
@Get("profileempid/position/{id}")
|
||||
async getProfileEmpByProfileid(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Path() id: string,
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||
}
|
||||
|
||||
const orgRevisionPublish = await this.orgRevisionRepo
|
||||
.createQueryBuilder("orgRevision")
|
||||
.where("orgRevision.orgRevisionIsDraft = false")
|
||||
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
||||
.getOne();
|
||||
if (!orgRevisionPublish) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||
}
|
||||
|
||||
const posMaster =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.length == 0 ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
||||
const root =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
|
||||
const child1 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1;
|
||||
const child2 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2;
|
||||
const child3 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3;
|
||||
const child4 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
|
||||
const _profile: any = {
|
||||
profileId: profile.id,
|
||||
prefix: profile.prefix,
|
||||
rank: profile.rank,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
position: profile.position,
|
||||
posMasterNo: posMaster == null ? null : posMaster.posMasterNo,
|
||||
posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName,
|
||||
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
|
||||
posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
|
||||
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||
rootId: root == null ? null : root.id,
|
||||
root: root == null ? null : root.orgRootName,
|
||||
rootShortName: root == null ? null : root.orgRootShortName,
|
||||
child1Id: child1 == null ? null : child1.id,
|
||||
child1: child1 == null ? null : child1.orgChild1Name,
|
||||
child1ShortName: child1 == null ? null : child1.orgChild1ShortName,
|
||||
child2Id: child2 == null ? null : child2.id,
|
||||
child2: child2 == null ? null : child2.orgChild2Name,
|
||||
child2ShortName: child2 == null ? null : child2.orgChild2ShortName,
|
||||
child3Id: child3 == null ? null : child3.id,
|
||||
child3: child3 == null ? null : child3.orgChild3Name,
|
||||
child3ShortName: child3 == null ? null : child3.orgChild3ShortName,
|
||||
child4Id: child4 == null ? null : child4.id,
|
||||
child4: child4 == null ? null : child4.orgChild4Name,
|
||||
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
|
||||
node: null,
|
||||
nodeId: null,
|
||||
};
|
||||
|
||||
if (_profile.child4Id != null) {
|
||||
_profile.node = 4;
|
||||
_profile.nodeId = _profile.child4Id;
|
||||
} else if (_profile.child3Id != null) {
|
||||
_profile.node = 3;
|
||||
_profile.nodeId = _profile.child3Id;
|
||||
} else if (_profile.child2Id != null) {
|
||||
_profile.node = 2;
|
||||
_profile.nodeId = _profile.child2Id;
|
||||
} else if (_profile.child1Id != null) {
|
||||
_profile.node = 1;
|
||||
_profile.nodeId = _profile.child1Id;
|
||||
} else if (_profile.rootId != null) {
|
||||
_profile.node = 0;
|
||||
_profile.nodeId = _profile.rootId;
|
||||
}
|
||||
return new HttpSuccess(_profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ค้นหาข้อมูลทะเบียนประวัติ
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue