Merge branch 'develop' into adiDev
This commit is contained in:
commit
5f7ed72261
3 changed files with 108 additions and 38 deletions
|
|
@ -2617,7 +2617,9 @@ export class CommandController extends Controller {
|
|||
if(_posMasterCommission) {
|
||||
_data.push({
|
||||
citizenId: _posMasterCommission?.current_holder.citizenId ?? _null,
|
||||
fullName: `${_posMasterCommission?.current_holder.prefix ?? ""}${_posMasterCommission?.current_holder.firstName ?? ""} ${_posMasterCommission?.current_holder.lastName ?? ""}`,
|
||||
prefix: _posMasterCommission?.current_holder.prefix,
|
||||
firstName: _posMasterCommission?.current_holder.firstName,
|
||||
lastName: _posMasterCommission?.current_holder.lastName,
|
||||
organizationName: _posMasterCommission.orgRoot
|
||||
? _posMasterCommission.orgRoot.orgRootName
|
||||
: _null,
|
||||
|
|
@ -2642,7 +2644,9 @@ export class CommandController extends Controller {
|
|||
if(_posMasterOfficer) {
|
||||
_data.push({
|
||||
citizenId: _posMasterOfficer?.current_holder.citizenId ?? _null,
|
||||
fullName: `${_posMasterOfficer?.current_holder.prefix ?? ""}${_posMasterOfficer?.current_holder.firstName ?? ""} ${_posMasterOfficer?.current_holder.lastName ?? ""}`,
|
||||
prefix: _posMasterOfficer?.current_holder.prefix,
|
||||
firstName: _posMasterOfficer?.current_holder.firstName,
|
||||
lastName: _posMasterOfficer?.current_holder.lastName,
|
||||
organizationName: _posMasterOfficer.orgRoot
|
||||
? _posMasterOfficer.orgRoot.orgRootName
|
||||
: _null,
|
||||
|
|
@ -2741,7 +2745,9 @@ export class CommandController extends Controller {
|
|||
_posMaster.forEach((x:any) => {
|
||||
_data.push({
|
||||
citizenId: x?.current_holder.citizenId ?? _null,
|
||||
fullName: `${x?.current_holder.prefix ?? ""}${x?.current_holder.firstName ?? ""} ${x?.current_holder.lastName ?? ""}`,
|
||||
prefix: x?.current_holder.prefix,
|
||||
firstName: x?.current_holder.firstName,
|
||||
lastName: x?.current_holder.lastName,
|
||||
organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null,
|
||||
positionName: x?.current_holder.position ?? _null,
|
||||
profileId: x?.current_holder.id ?? _null
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ import { EmployeePosition } from "../entities/EmployeePosition";
|
|||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
||||
import { AuthRole } from "../entities/AuthRole";
|
||||
import { PosType } from "../entities/PosType";
|
||||
import { PosLevel } from "../entities/PosLevel";
|
||||
|
||||
@Route("api/v1/org")
|
||||
@Tags("Organization")
|
||||
|
|
@ -60,6 +62,8 @@ export class OrganizationController extends Controller {
|
|||
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
||||
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
|
||||
private employeeTempPosMasterRepository = AppDataSource.getRepository(EmployeeTempPosMaster);
|
||||
private posTypeRepository = AppDataSource.getRepository(PosType);
|
||||
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||
|
||||
/**
|
||||
* API ล้างข้อมูล
|
||||
|
|
@ -152,14 +156,17 @@ export class OrganizationController extends Controller {
|
|||
data: {
|
||||
requestBody: requestBody,
|
||||
request: request.user,
|
||||
revision: revision
|
||||
revision: revision,
|
||||
},
|
||||
}
|
||||
};
|
||||
try {
|
||||
await sendToQueueOrgDraft(msg);
|
||||
return new HttpSuccess ('Draft is being created... Processing in the background.');
|
||||
} catch (error:any) {
|
||||
return new HttpError (HttpStatusCode.NOT_FOUND,'Failed to process the draft. Please try again later.');
|
||||
return new HttpSuccess("Draft is being created... Processing in the background.");
|
||||
} catch (error: any) {
|
||||
return new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"Failed to process the draft. Please try again later.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7544,4 +7551,34 @@ export class OrganizationController extends Controller {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลำดับโครงสร้าง
|
||||
*
|
||||
* @summary - ลำดับโครงสร้าง (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Get("root/search/sort")
|
||||
async searchSortRootLevelType(@Request() request: RequestWithUser) {
|
||||
const root = await this.orgRootRepository.find({
|
||||
where: {
|
||||
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||
},
|
||||
order: { isDeputy: "DESC", orgRootOrder: "ASC" },
|
||||
select: ["orgRootName"],
|
||||
});
|
||||
const posType = await this.posTypeRepository.find({
|
||||
order: { posTypeRank: "DESC" },
|
||||
select: ["posTypeName"],
|
||||
});
|
||||
const posLevel = await this.posLevelRepository.find({
|
||||
order: { posLevelRank: "DESC" },
|
||||
select: ["posLevelName"],
|
||||
});
|
||||
return new HttpSuccess({
|
||||
root: root.map((x) => x.orgRootName),
|
||||
posTypeNameOrder: posType.map((x) => x.posTypeName),
|
||||
posLevelNameOrder: posLevel.map((x) => x.posLevelName),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,17 +263,18 @@ export class ProfileEmployeeController extends Controller {
|
|||
: null,
|
||||
position: Extension.ToThaiNumber(
|
||||
Extension.ToThaiNumber(
|
||||
`${item.positionName != null ? item.positionName : "-"} ${item.positionType == null ? (item.positionCee??"") : (item.positionType == "อำนวยการ" || item.positionType == "บริหาร" ? item.positionType : "") + item.positionLevel}`,
|
||||
`${item.positionName != null ? item.positionName : "-"} ${item.positionType == null ? item.positionCee ?? "" : (item.positionType == "อำนวยการ" || item.positionType == "บริหาร" ? item.positionType : "") + item.positionLevel}`,
|
||||
),
|
||||
),
|
||||
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : "",
|
||||
orgRoot: item.orgRoot != null ? Extension.ToThaiNumber( item.orgRoot) : "",
|
||||
orgChild1: item.orgChild1 != null ? Extension.ToThaiNumber( item.orgChild1) : "",
|
||||
orgChild2: item.orgChild2 != null ? Extension.ToThaiNumber( item.orgChild2) : "",
|
||||
orgChild3: item.orgChild3 != null ? Extension.ToThaiNumber( item.orgChild3) : "",
|
||||
orgChild4: item.orgChild4 != null ? Extension.ToThaiNumber( item.orgChild4) : "",
|
||||
positionCee: item.positionCee != null ? Extension.ToThaiNumber( item.positionCee) : "",
|
||||
positionExecutive: item.positionExecutive != null ? Extension.ToThaiNumber( item.positionExecutive) : "",
|
||||
orgRoot: item.orgRoot != null ? Extension.ToThaiNumber(item.orgRoot) : "",
|
||||
orgChild1: item.orgChild1 != null ? Extension.ToThaiNumber(item.orgChild1) : "",
|
||||
orgChild2: item.orgChild2 != null ? Extension.ToThaiNumber(item.orgChild2) : "",
|
||||
orgChild3: item.orgChild3 != null ? Extension.ToThaiNumber(item.orgChild3) : "",
|
||||
orgChild4: item.orgChild4 != null ? Extension.ToThaiNumber(item.orgChild4) : "",
|
||||
positionCee: item.positionCee != null ? Extension.ToThaiNumber(item.positionCee) : "",
|
||||
positionExecutive:
|
||||
item.positionExecutive != null ? Extension.ToThaiNumber(item.positionExecutive) : "",
|
||||
}))
|
||||
: [
|
||||
{
|
||||
|
|
@ -350,7 +351,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
salary_raw.length > 0 && salary_raw[0].positionName != null
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiNumber(
|
||||
`${salary_raw[0].positionName != null ? salary_raw[0].positionName : "-"} ${salary_raw[0].positionType == null ? (salary_raw[0].positionCee??"") : (salary_raw[0].positionType == "อำนวยการ" || salary_raw[0].positionType == "บริหาร" ? salary_raw[0].positionType : "") + salary_raw[0].positionLevel}`,
|
||||
`${salary_raw[0].positionName != null ? salary_raw[0].positionName : "-"} ${salary_raw[0].positionType == null ? salary_raw[0].positionCee ?? "" : (salary_raw[0].positionType == "อำนวยการ" || salary_raw[0].positionType == "บริหาร" ? salary_raw[0].positionType : "") + salary_raw[0].positionLevel}`,
|
||||
),
|
||||
)
|
||||
: "",
|
||||
|
|
@ -2461,20 +2462,20 @@ export class ProfileEmployeeController extends Controller {
|
|||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.where(
|
||||
requestBody.keyword != null && requestBody.keyword != ""
|
||||
requestBody.keyword != null && requestBody.keyword != ""
|
||||
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere(
|
||||
requestBody.keyword != null && requestBody.keyword != ""
|
||||
? "profileEmployee.citizenId LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
},
|
||||
);
|
||||
},
|
||||
).orWhere(
|
||||
requestBody.keyword != null && requestBody.keyword != ""
|
||||
? "profileEmployee.citizenId LIKE :keyword"
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
},
|
||||
);
|
||||
}),
|
||||
)
|
||||
.andWhere(
|
||||
|
|
@ -2779,7 +2780,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
const _profile = {
|
||||
const _profile: any = {
|
||||
profileId: profile.id,
|
||||
prefix: profile.prefix,
|
||||
rank: profile.rank,
|
||||
|
|
@ -2838,6 +2839,32 @@ export class ProfileEmployeeController extends Controller {
|
|||
? `${root?.orgRootShortName}${posMaster?.posMasterNo}`
|
||||
: "",
|
||||
};
|
||||
if (_profile.child4Id != null) {
|
||||
_profile.node = 4;
|
||||
_profile.nodeId = _profile.child4Id;
|
||||
_profile.nodeDnaId = _profile.child4DnaId;
|
||||
_profile.nodeShortName = _profile.child4ShortName;
|
||||
} else if (_profile.child3Id != null) {
|
||||
_profile.node = 3;
|
||||
_profile.nodeId = _profile.child3Id;
|
||||
_profile.nodeDnaId = _profile.child3DnaId;
|
||||
_profile.nodeShortName = _profile.child3ShortName;
|
||||
} else if (_profile.child2Id != null) {
|
||||
_profile.node = 2;
|
||||
_profile.nodeId = _profile.child2Id;
|
||||
_profile.nodeDnaId = _profile.child2DnaId;
|
||||
_profile.nodeShortName = _profile.child2ShortName;
|
||||
} else if (_profile.child1Id != null) {
|
||||
_profile.node = 1;
|
||||
_profile.nodeId = _profile.child1Id;
|
||||
_profile.nodeDnaId = _profile.child1DnaId;
|
||||
_profile.nodeShortName = _profile.child1ShortName;
|
||||
} else if (_profile.rootId != null) {
|
||||
_profile.node = 0;
|
||||
_profile.nodeId = _profile.rootId;
|
||||
_profile.nodeDnaId = _profile.rootDnaId;
|
||||
_profile.nodeShortName = _profile.rootShortName;
|
||||
}
|
||||
return new HttpSuccess(_profile);
|
||||
}
|
||||
|
||||
|
|
@ -4455,7 +4482,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
let _null:any = null;
|
||||
let _null: any = null;
|
||||
profile.isLeave = requestBody.isLeave;
|
||||
profile.leaveReason = requestBody.leaveReason;
|
||||
profile.dateLeave = requestBody.dateLeave;
|
||||
|
|
@ -5062,14 +5089,14 @@ export class ProfileEmployeeController extends Controller {
|
|||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||
}
|
||||
|
||||
const permissionProflile = await this.permissionProflileRepository.findOne({
|
||||
relations : ["orgRootTree"],
|
||||
where:{
|
||||
const permissionProflile = await this.permissionProflileRepository.findOne({
|
||||
relations: ["orgRootTree"],
|
||||
where: {
|
||||
profileId: id,
|
||||
orgRootTree:{
|
||||
orgRevisionId: orgRevisionPublish.id
|
||||
}
|
||||
}
|
||||
orgRootTree: {
|
||||
orgRevisionId: orgRevisionPublish.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
const posMaster =
|
||||
profile.current_holders == null ||
|
||||
|
|
@ -5181,8 +5208,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}`
|
||||
: "-",
|
||||
statusCheckEdit: profile.statusCheckEdit,
|
||||
isEdit: permissionProflile?.isEdit??false,
|
||||
isCheck: permissionProflile?.isCheck??false,
|
||||
isEdit: permissionProflile?.isEdit ?? false,
|
||||
isCheck: permissionProflile?.isCheck ?? false,
|
||||
};
|
||||
|
||||
if (_profile.child4Id != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue