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) {
|
if(_posMasterCommission) {
|
||||||
_data.push({
|
_data.push({
|
||||||
citizenId: _posMasterCommission?.current_holder.citizenId ?? _null,
|
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
|
organizationName: _posMasterCommission.orgRoot
|
||||||
? _posMasterCommission.orgRoot.orgRootName
|
? _posMasterCommission.orgRoot.orgRootName
|
||||||
: _null,
|
: _null,
|
||||||
|
|
@ -2642,7 +2644,9 @@ export class CommandController extends Controller {
|
||||||
if(_posMasterOfficer) {
|
if(_posMasterOfficer) {
|
||||||
_data.push({
|
_data.push({
|
||||||
citizenId: _posMasterOfficer?.current_holder.citizenId ?? _null,
|
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
|
organizationName: _posMasterOfficer.orgRoot
|
||||||
? _posMasterOfficer.orgRoot.orgRootName
|
? _posMasterOfficer.orgRoot.orgRootName
|
||||||
: _null,
|
: _null,
|
||||||
|
|
@ -2741,7 +2745,9 @@ export class CommandController extends Controller {
|
||||||
_posMaster.forEach((x:any) => {
|
_posMaster.forEach((x:any) => {
|
||||||
_data.push({
|
_data.push({
|
||||||
citizenId: x?.current_holder.citizenId ?? _null,
|
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,
|
organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null,
|
||||||
positionName: x?.current_holder.position ?? _null,
|
positionName: x?.current_holder.position ?? _null,
|
||||||
profileId: x?.current_holder.id ?? _null
|
profileId: x?.current_holder.id ?? _null
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ import { EmployeePosition } from "../entities/EmployeePosition";
|
||||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||||
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
||||||
import { AuthRole } from "../entities/AuthRole";
|
import { AuthRole } from "../entities/AuthRole";
|
||||||
|
import { PosType } from "../entities/PosType";
|
||||||
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
|
|
||||||
@Route("api/v1/org")
|
@Route("api/v1/org")
|
||||||
@Tags("Organization")
|
@Tags("Organization")
|
||||||
|
|
@ -60,6 +62,8 @@ export class OrganizationController extends Controller {
|
||||||
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
||||||
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
|
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
|
||||||
private employeeTempPosMasterRepository = AppDataSource.getRepository(EmployeeTempPosMaster);
|
private employeeTempPosMasterRepository = AppDataSource.getRepository(EmployeeTempPosMaster);
|
||||||
|
private posTypeRepository = AppDataSource.getRepository(PosType);
|
||||||
|
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ล้างข้อมูล
|
* API ล้างข้อมูล
|
||||||
|
|
@ -152,14 +156,17 @@ export class OrganizationController extends Controller {
|
||||||
data: {
|
data: {
|
||||||
requestBody: requestBody,
|
requestBody: requestBody,
|
||||||
request: request.user,
|
request: request.user,
|
||||||
revision: revision
|
revision: revision,
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
try {
|
try {
|
||||||
await sendToQueueOrgDraft(msg);
|
await sendToQueueOrgDraft(msg);
|
||||||
return new HttpSuccess ('Draft is being created... Processing in the background.');
|
return new HttpSuccess("Draft is being created... Processing in the background.");
|
||||||
} catch (error:any) {
|
} catch (error: any) {
|
||||||
return new HttpError (HttpStatusCode.NOT_FOUND,'Failed to process the draft. Please try again later.');
|
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,
|
: null,
|
||||||
position: Extension.ToThaiNumber(
|
position: Extension.ToThaiNumber(
|
||||||
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) : "",
|
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : "",
|
||||||
orgRoot: item.orgRoot != null ? Extension.ToThaiNumber( item.orgRoot) : "",
|
orgRoot: item.orgRoot != null ? Extension.ToThaiNumber(item.orgRoot) : "",
|
||||||
orgChild1: item.orgChild1 != null ? Extension.ToThaiNumber( item.orgChild1) : "",
|
orgChild1: item.orgChild1 != null ? Extension.ToThaiNumber(item.orgChild1) : "",
|
||||||
orgChild2: item.orgChild2 != null ? Extension.ToThaiNumber( item.orgChild2) : "",
|
orgChild2: item.orgChild2 != null ? Extension.ToThaiNumber(item.orgChild2) : "",
|
||||||
orgChild3: item.orgChild3 != null ? Extension.ToThaiNumber( item.orgChild3) : "",
|
orgChild3: item.orgChild3 != null ? Extension.ToThaiNumber(item.orgChild3) : "",
|
||||||
orgChild4: item.orgChild4 != null ? Extension.ToThaiNumber( item.orgChild4) : "",
|
orgChild4: item.orgChild4 != null ? Extension.ToThaiNumber(item.orgChild4) : "",
|
||||||
positionCee: item.positionCee != null ? Extension.ToThaiNumber( item.positionCee) : "",
|
positionCee: item.positionCee != null ? Extension.ToThaiNumber(item.positionCee) : "",
|
||||||
positionExecutive: item.positionExecutive != null ? Extension.ToThaiNumber( item.positionExecutive) : "",
|
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
|
salary_raw.length > 0 && salary_raw[0].positionName != null
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
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(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(
|
||||||
requestBody.keyword != null && requestBody.keyword != ""
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
|
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
})
|
},
|
||||||
.orWhere(
|
).orWhere(
|
||||||
requestBody.keyword != null && requestBody.keyword != ""
|
requestBody.keyword != null && requestBody.keyword != ""
|
||||||
? "profileEmployee.citizenId LIKE :keyword"
|
? "profileEmployee.citizenId LIKE :keyword"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
@ -2779,7 +2780,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const _profile = {
|
const _profile: any = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
prefix: profile.prefix,
|
prefix: profile.prefix,
|
||||||
rank: profile.rank,
|
rank: profile.rank,
|
||||||
|
|
@ -2838,6 +2839,32 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? `${root?.orgRootShortName}${posMaster?.posMasterNo}`
|
? `${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);
|
return new HttpSuccess(_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4455,7 +4482,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
where: { id: id },
|
where: { id: id },
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
let _null:any = null;
|
let _null: any = null;
|
||||||
profile.isLeave = requestBody.isLeave;
|
profile.isLeave = requestBody.isLeave;
|
||||||
profile.leaveReason = requestBody.leaveReason;
|
profile.leaveReason = requestBody.leaveReason;
|
||||||
profile.dateLeave = requestBody.dateLeave;
|
profile.dateLeave = requestBody.dateLeave;
|
||||||
|
|
@ -5062,14 +5089,14 @@ export class ProfileEmployeeController extends Controller {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
|
||||||
}
|
}
|
||||||
|
|
||||||
const permissionProflile = await this.permissionProflileRepository.findOne({
|
const permissionProflile = await this.permissionProflileRepository.findOne({
|
||||||
relations : ["orgRootTree"],
|
relations: ["orgRootTree"],
|
||||||
where:{
|
where: {
|
||||||
profileId: id,
|
profileId: id,
|
||||||
orgRootTree:{
|
orgRootTree: {
|
||||||
orgRevisionId: orgRevisionPublish.id
|
orgRevisionId: orgRevisionPublish.id,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
const posMaster =
|
const posMaster =
|
||||||
profile.current_holders == null ||
|
profile.current_holders == null ||
|
||||||
|
|
@ -5181,8 +5208,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}`
|
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}`
|
||||||
: "-",
|
: "-",
|
||||||
statusCheckEdit: profile.statusCheckEdit,
|
statusCheckEdit: profile.statusCheckEdit,
|
||||||
isEdit: permissionProflile?.isEdit??false,
|
isEdit: permissionProflile?.isEdit ?? false,
|
||||||
isCheck: permissionProflile?.isCheck??false,
|
isCheck: permissionProflile?.isCheck ?? false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_profile.child4Id != null) {
|
if (_profile.child4Id != null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue