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;
|
requestBody.posExecutiveId = _null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestBody.posExecutiveId != null && requestBody.posExecutiveId != "" ) {
|
if (requestBody.posExecutiveId != null && requestBody.posExecutiveId != "") {
|
||||||
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
|
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
|
||||||
where: { id: requestBody.posExecutiveId },
|
where: { id: requestBody.posExecutiveId },
|
||||||
});
|
});
|
||||||
|
|
@ -1611,7 +1611,7 @@ export class PositionController extends Controller {
|
||||||
orgRootId: org.id,
|
orgRootId: org.id,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
orgChild1Id: IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMaster != null)
|
if (_posMaster != null)
|
||||||
|
|
@ -1646,7 +1646,7 @@ export class PositionController extends Controller {
|
||||||
orgChild1Id: org.id,
|
orgChild1Id: org.id,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
orgChild2Id: IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMaster != null)
|
if (_posMaster != null)
|
||||||
|
|
@ -1680,7 +1680,7 @@ export class PositionController extends Controller {
|
||||||
orgChild2Id: org.id,
|
orgChild2Id: org.id,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
orgChild3Id: IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMaster != null)
|
if (_posMaster != null)
|
||||||
|
|
@ -1713,7 +1713,7 @@ export class PositionController extends Controller {
|
||||||
orgChild3Id: org.id,
|
orgChild3Id: org.id,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
orgChild4Id: IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMaster != null)
|
if (_posMaster != null)
|
||||||
|
|
@ -1740,7 +1740,7 @@ export class PositionController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
orgChild4Id: org.id,
|
orgChild4Id: org.id,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMaster != null)
|
if (_posMaster != null)
|
||||||
|
|
@ -1781,7 +1781,7 @@ export class PositionController extends Controller {
|
||||||
orgRootId: r.id,
|
orgRootId: r.id,
|
||||||
orgChild1Id: IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMasterRoot != null) {
|
if (_posMasterRoot != null) {
|
||||||
|
|
@ -1808,7 +1808,7 @@ export class PositionController extends Controller {
|
||||||
orgChild1Id: c1.id,
|
orgChild1Id: c1.id,
|
||||||
orgChild2Id: IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMasterChild1 != null) {
|
if (_posMasterChild1 != null) {
|
||||||
|
|
@ -1835,7 +1835,7 @@ export class PositionController extends Controller {
|
||||||
orgChild2Id: c2.id,
|
orgChild2Id: c2.id,
|
||||||
orgChild3Id: IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMasterChild2 != null) {
|
if (_posMasterChild2 != null) {
|
||||||
|
|
@ -1862,7 +1862,7 @@ export class PositionController extends Controller {
|
||||||
orgChild3Id: c3.id,
|
orgChild3Id: c3.id,
|
||||||
orgChild4Id: IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMasterChild3 != null) {
|
if (_posMasterChild3 != null) {
|
||||||
|
|
@ -1888,7 +1888,7 @@ export class PositionController extends Controller {
|
||||||
orgRevisionId: orgRevision?.id,
|
orgRevisionId: orgRevision?.id,
|
||||||
orgChild4Id: c4.id,
|
orgChild4Id: c4.id,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
id: Not(In(requestBody.positionMaster))
|
id: Not(In(requestBody.positionMaster)),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (_posMasterChild4 != null) {
|
if (_posMasterChild4 != null) {
|
||||||
|
|
@ -2483,7 +2483,7 @@ export class PositionController extends Controller {
|
||||||
node: number;
|
node: number;
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
position: string;
|
position: string;
|
||||||
typeCommand: string;
|
typeCommand: string | null;
|
||||||
posType: string;
|
posType: string;
|
||||||
posLevel: string;
|
posLevel: string;
|
||||||
isAll: boolean;
|
isAll: boolean;
|
||||||
|
|
|
||||||
|
|
@ -563,9 +563,9 @@ export class ProfileController extends Controller {
|
||||||
async searchProfileOrg(
|
async searchProfileOrg(
|
||||||
@Body()
|
@Body()
|
||||||
requestBody: {
|
requestBody: {
|
||||||
position?: string;
|
position?: string | null;
|
||||||
posLevelId?: string;
|
posLevelId?: string | null;
|
||||||
posTypeId?: string;
|
posTypeId?: string | null;
|
||||||
page: number;
|
page: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
|
|
@ -934,6 +934,122 @@ export class ProfileController extends Controller {
|
||||||
return new HttpSuccess(_profile);
|
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 ค้นหาข้อมูลทะเบียนประวัติ
|
* API ค้นหาข้อมูลทะเบียนประวัติ
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue