Merge branch 'develop' into adiDev
This commit is contained in:
commit
ba00ce14d2
5 changed files with 199 additions and 133 deletions
|
|
@ -58,6 +58,17 @@ 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ล้างข้อมูล
|
||||||
|
*
|
||||||
|
* @summary ล้างข้อมูล
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("clear-db")
|
||||||
|
async ClearDb() {
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายการประวัติโครงสร้าง
|
* API รายการประวัติโครงสร้าง
|
||||||
*
|
*
|
||||||
|
|
@ -2665,7 +2676,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
||||||
}),
|
}),
|
||||||
|
|
@ -2789,7 +2805,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -2923,7 +2944,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -3064,7 +3090,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -5896,7 +5927,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
posMaster: await Promise.all(
|
posMaster: await Promise.all(
|
||||||
orgChild1.posMasters
|
orgChild1.posMasters
|
||||||
.filter(
|
.filter(
|
||||||
|
|
@ -5946,7 +5982,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
posMaster: await Promise.all(
|
posMaster: await Promise.all(
|
||||||
orgChild2.posMasters
|
orgChild2.posMasters
|
||||||
.filter(
|
.filter(
|
||||||
|
|
@ -6003,7 +6044,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
posMaster: await Promise.all(
|
posMaster: await Promise.all(
|
||||||
orgChild3.posMasters
|
orgChild3.posMasters
|
||||||
.filter(
|
.filter(
|
||||||
|
|
@ -6067,7 +6113,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
posMaster: await Promise.all(
|
posMaster: await Promise.all(
|
||||||
orgChild4.posMasters
|
orgChild4.posMasters
|
||||||
.filter(
|
.filter(
|
||||||
|
|
@ -6474,7 +6525,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id },
|
||||||
}),
|
}),
|
||||||
|
|
@ -6598,7 +6654,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -6710,29 +6771,34 @@ export class OrganizationController extends Controller {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
responsibility: orgChild3.responsibility,
|
responsibility: orgChild3.responsibility,
|
||||||
labelName:
|
labelName:
|
||||||
orgChild3.orgChild3Name +
|
orgChild3.orgChild3Name +
|
||||||
" " +
|
" " +
|
||||||
orgRoot.orgRootCode +
|
orgRoot.orgRootCode +
|
||||||
orgChild3.orgChild3Code +
|
orgChild3.orgChild3Code +
|
||||||
" " +
|
" " +
|
||||||
orgChild3.orgChild3ShortName +
|
orgChild3.orgChild3ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgChild2.orgChild2Name +
|
orgChild2.orgChild2Name +
|
||||||
" " +
|
" " +
|
||||||
orgRoot.orgRootCode +
|
orgRoot.orgRootCode +
|
||||||
orgChild2.orgChild2Code +
|
orgChild2.orgChild2Code +
|
||||||
" " +
|
" " +
|
||||||
orgChild2.orgChild2ShortName +
|
orgChild2.orgChild2ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgChild1.orgChild1Name +
|
orgChild1.orgChild1Name +
|
||||||
" " +
|
" " +
|
||||||
orgRoot.orgRootCode +
|
orgRoot.orgRootCode +
|
||||||
orgChild1.orgChild1Code +
|
orgChild1.orgChild1Code +
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
@ -6873,7 +6939,12 @@ export class OrganizationController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
orgChild1.orgChild1ShortName +
|
orgChild1.orgChild1ShortName +
|
||||||
"/" +
|
"/" +
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootCode +
|
||||||
|
"00" +
|
||||||
|
" " +
|
||||||
|
orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
|
|
|
||||||
|
|
@ -6017,7 +6017,6 @@ export class ProfileController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -6062,7 +6061,6 @@ export class ProfileController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -6117,7 +6115,6 @@ export class ProfileController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -6143,7 +6140,6 @@ export class ProfileController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -6169,7 +6165,6 @@ export class ProfileController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -6192,7 +6187,6 @@ export class ProfileController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -6248,17 +6242,6 @@ export class ProfileController extends Controller {
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
let salary: any = "";
|
|
||||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
|
||||||
let _salary: any = item.profileSalary.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
|
||||||
);
|
|
||||||
if (_salary.length > 0) {
|
|
||||||
salary = _salary[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const rootHolder = item.current_holders?.find(
|
const rootHolder = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
)?.orgRoot;
|
)?.orgRoot;
|
||||||
|
|
@ -6301,7 +6284,7 @@ export class ProfileController extends Controller {
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: item.amount,
|
||||||
root: rootHolder?.orgRootName ?? null,
|
root: rootHolder?.orgRootName ?? null,
|
||||||
rootId: rootHolder?.id ?? null,
|
rootId: rootHolder?.id ?? null,
|
||||||
rootShortName: rootHolder?.orgRootShortName ?? null,
|
rootShortName: rootHolder?.orgRootShortName ?? null,
|
||||||
|
|
@ -7712,7 +7695,7 @@ export class ProfileController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
citizenId: Like(`%${body.keyword}%`),
|
citizenId: Like(`%${body.keyword}%`),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -7724,7 +7707,7 @@ export class ProfileController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
firstName: Like(`%${body.keyword}%`),
|
firstName: Like(`%${body.keyword}%`),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -7736,7 +7719,7 @@ export class ProfileController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
lastName: Like(`%${body.keyword}%`),
|
lastName: Like(`%${body.keyword}%`),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -7747,7 +7730,7 @@ export class ProfileController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -7797,17 +7780,6 @@ export class ProfileController extends Controller {
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
let salary: any = "";
|
|
||||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
|
||||||
let _salary: any = item.profileSalary.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
|
||||||
);
|
|
||||||
if (_salary.length > 0) {
|
|
||||||
salary = _salary[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const posMasterNo = item.current_holders?.find(
|
const posMasterNo = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
)?.posMasterNo;
|
)?.posMasterNo;
|
||||||
|
|
@ -7834,8 +7806,8 @@ export class ProfileController extends Controller {
|
||||||
positionType: item.posTypeId,
|
positionType: item.posTypeId,
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootShortName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: item.amount,
|
||||||
posMasterNo: posMasterNo ?? null,
|
posMasterNo: posMasterNo ?? null,
|
||||||
posTypeId: item.posTypeId,
|
posTypeId: item.posTypeId,
|
||||||
posTypeName: item.posType?.posTypeName,
|
posTypeName: item.posType?.posTypeName,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import {
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import { DevelopmentProject } from "../entities/DevelopmentProject";
|
import { DevelopmentProject } from "../entities/DevelopmentProject";
|
||||||
import { In, Brackets } from "typeorm";
|
import { In, Brackets } from "typeorm";
|
||||||
|
import { DevelopmentRequest } from "../entities/DevelopmentRequest";
|
||||||
@Route("api/v1/org/profile/development")
|
@Route("api/v1/org/profile/development")
|
||||||
@Tags("ProfileDevelopment")
|
@Tags("ProfileDevelopment")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -35,6 +36,7 @@ export class ProfileDevelopmentController extends Controller {
|
||||||
private developmentRepository = AppDataSource.getRepository(ProfileDevelopment);
|
private developmentRepository = AppDataSource.getRepository(ProfileDevelopment);
|
||||||
private developmentHistoryRepository = AppDataSource.getRepository(ProfileDevelopmentHistory);
|
private developmentHistoryRepository = AppDataSource.getRepository(ProfileDevelopmentHistory);
|
||||||
private developmentProjectRepository = AppDataSource.getRepository(DevelopmentProject);
|
private developmentProjectRepository = AppDataSource.getRepository(DevelopmentProject);
|
||||||
|
private developmentRequestRepository = AppDataSource.getRepository(DevelopmentRequest);
|
||||||
|
|
||||||
@Get("user")
|
@Get("user")
|
||||||
public async getDevelopmentUser(@Request() request: { user: Record<string, any> }) {
|
public async getDevelopmentUser(@Request() request: { user: Record<string, any> }) {
|
||||||
|
|
@ -121,6 +123,75 @@ export class ProfileDevelopmentController extends Controller {
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get("registry/{type}/{developmentId}")
|
||||||
|
public async developmentDetail(
|
||||||
|
@Path() developmentId: string,
|
||||||
|
@Path() type: string,
|
||||||
|
@Request() req: RequestWithUser
|
||||||
|
) {
|
||||||
|
const data = await this.developmentRequestRepository.findOne({
|
||||||
|
where: { id: developmentId },
|
||||||
|
relations: ["developmentProjects"],
|
||||||
|
});
|
||||||
|
if (!data)
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบรายการพัฒนารายบุคคลดังกล่าว");
|
||||||
|
|
||||||
|
if (type.trim().toLocaleUpperCase() == "OFFICER") {
|
||||||
|
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_OFFICER");
|
||||||
|
if (_workflow == false)
|
||||||
|
await new permission().PermissionOrgUserGet(
|
||||||
|
req,
|
||||||
|
"SYS_REGISTRY_OFFICER",
|
||||||
|
data.profileId,
|
||||||
|
);
|
||||||
|
} else if (type.trim().toLocaleUpperCase() == "EMPLOYEE") {
|
||||||
|
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_EMP");
|
||||||
|
if (_workflow == false)
|
||||||
|
await new permission().PermissionOrgUserGet(
|
||||||
|
req,
|
||||||
|
"SYS_REGISTRY_EMP",
|
||||||
|
data.profileEmployeeId,
|
||||||
|
);
|
||||||
|
} else if (type.trim().toLocaleUpperCase() == "TEMP") {
|
||||||
|
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_TEMP");
|
||||||
|
if (_workflow == false)
|
||||||
|
await new permission().PermissionOrgUserGet(
|
||||||
|
req,
|
||||||
|
"SYS_REGISTRY_TEMP",
|
||||||
|
data.profileEmployeeId,
|
||||||
|
);
|
||||||
|
} else if (type.trim().toLocaleUpperCase() == "USER") {
|
||||||
|
} else {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถเข้าถึงข้อมูลนี้ได้");
|
||||||
|
}
|
||||||
|
|
||||||
|
const _mapData = {
|
||||||
|
id: data.id,
|
||||||
|
evaluationId: null,
|
||||||
|
target: data.developmentTarget,
|
||||||
|
summary: null,
|
||||||
|
point: null,
|
||||||
|
name: data.name,
|
||||||
|
achievement10: "มีผลการพัฒนาและมีการดำเนินการตามเป้าหมายการนำไปพัฒนางาน1",
|
||||||
|
achievement5: "มีผลการพัฒนาแต่ยังไม่ได้ดำเนินการตามเป้าหมายการนำไปพัฒนางาน",
|
||||||
|
achievement0: "ไม่ได้ดำเนินการพัฒนา",
|
||||||
|
isDevelopment70: data.isDevelopment70,
|
||||||
|
isDevelopment20: data.isDevelopment20,
|
||||||
|
isDevelopment10: data.isDevelopment10,
|
||||||
|
reasonDevelopment70: data.reasonDevelopment70,
|
||||||
|
reasonDevelopment20: data.reasonDevelopment20,
|
||||||
|
reasonDevelopment10: data.reasonDevelopment10,
|
||||||
|
selectType: null,
|
||||||
|
selectTypeYear: null,
|
||||||
|
selectTypeId: null
|
||||||
|
}
|
||||||
|
const _data = {
|
||||||
|
..._mapData,
|
||||||
|
developmentProjects: data.developmentProjects.map((x) => x.name),
|
||||||
|
};
|
||||||
|
return new HttpSuccess(_data);
|
||||||
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
public async newDevelopment(
|
public async newDevelopment(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
|
|
|
||||||
|
|
@ -2351,17 +2351,6 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
let salary: any = "";
|
|
||||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
|
||||||
let _salary: any = item.profileSalary.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
|
||||||
);
|
|
||||||
if (_salary.length > 0) {
|
|
||||||
salary = _salary[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const rootHolder = item.current_holders?.find(
|
const rootHolder = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
)?.orgRoot;
|
)?.orgRoot;
|
||||||
|
|
@ -2404,7 +2393,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: item.amount,
|
||||||
root: rootHolder?.orgRootName ?? null,
|
root: rootHolder?.orgRootName ?? null,
|
||||||
rootId: rootHolder?.id ?? null,
|
rootId: rootHolder?.id ?? null,
|
||||||
rootShortName: rootHolder?.orgRootShortName ?? null,
|
rootShortName: rootHolder?.orgRootShortName ?? null,
|
||||||
|
|
@ -3927,7 +3916,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
citizenId: Like(`%${body.keyword}%`),
|
citizenId: Like(`%${body.keyword}%`),
|
||||||
employeeClass: "PREM",
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3940,7 +3929,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
firstName: Like(`%${body.keyword}%`),
|
firstName: Like(`%${body.keyword}%`),
|
||||||
employeeClass: "PREM",
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3953,7 +3942,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
lastName: Like(`%${body.keyword}%`),
|
lastName: Like(`%${body.keyword}%`),
|
||||||
employeeClass: "PREM",
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3965,7 +3954,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
employeeClass: "PREM",
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -4015,17 +4004,6 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
let salary: any = "";
|
|
||||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
|
||||||
let _salary: any = item.profileSalary.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
|
||||||
);
|
|
||||||
if (_salary.length > 0) {
|
|
||||||
salary = _salary[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const posMasterNo = item.current_holders?.find(
|
const posMasterNo = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
)?.posMasterNo;
|
)?.posMasterNo;
|
||||||
|
|
@ -4052,8 +4030,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
positionType: item.posTypeId,
|
positionType: item.posTypeId,
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootShortName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: item.amount,
|
||||||
posMasterNo: posMasterNo ?? null,
|
posMasterNo: posMasterNo ?? null,
|
||||||
posTypeId: item.posTypeId,
|
posTypeId: item.posTypeId,
|
||||||
posTypeName: item.posType?.posTypeName,
|
posTypeName: item.posType?.posTypeName,
|
||||||
|
|
|
||||||
|
|
@ -1899,7 +1899,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -1918,7 +1917,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -1937,7 +1935,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -1955,7 +1952,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"profileSalary",
|
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
|
|
@ -2011,17 +2007,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
let salary: any = "";
|
|
||||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
|
||||||
let _salary: any = item.profileSalary.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
|
||||||
);
|
|
||||||
if (_salary.length > 0) {
|
|
||||||
salary = _salary[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const rootHolder = item.current_holders?.find(
|
const rootHolder = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
)?.orgRoot;
|
)?.orgRoot;
|
||||||
|
|
@ -2063,8 +2048,8 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
positionType: item.posTypeId,
|
positionType: item.posTypeId,
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootShortName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: item.amount,
|
||||||
root: rootHolder?.orgRootName ?? null,
|
root: rootHolder?.orgRootName ?? null,
|
||||||
rootId: rootHolder?.id ?? null,
|
rootId: rootHolder?.id ?? null,
|
||||||
rootShortName: rootHolder?.orgRootShortName ?? null,
|
rootShortName: rootHolder?.orgRootShortName ?? null,
|
||||||
|
|
@ -3479,7 +3464,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
citizenId: Like(`%${body.keyword}%`),
|
citizenId: Like(`%${body.keyword}%`),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3491,7 +3476,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
firstName: Like(`%${body.keyword}%`),
|
firstName: Like(`%${body.keyword}%`),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3503,7 +3488,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
lastName: Like(`%${body.keyword}%`),
|
lastName: Like(`%${body.keyword}%`),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3514,7 +3499,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders"],
|
||||||
skip,
|
skip,
|
||||||
take,
|
take,
|
||||||
});
|
});
|
||||||
|
|
@ -3564,17 +3549,6 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
? null
|
? null
|
||||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
let salary: any = "";
|
|
||||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
|
||||||
let _salary: any = item.profileSalary.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
|
||||||
);
|
|
||||||
if (_salary.length > 0) {
|
|
||||||
salary = _salary[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const posMasterNo = item.current_holders?.find(
|
const posMasterNo = item.current_holders?.find(
|
||||||
(x) => x.orgRevisionId == findRevision.id,
|
(x) => x.orgRevisionId == findRevision.id,
|
||||||
)?.posMasterNo;
|
)?.posMasterNo;
|
||||||
|
|
@ -3601,8 +3575,8 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
positionType: item.posTypeId,
|
positionType: item.posTypeId,
|
||||||
positionTypeName: item.posType?.posTypeName,
|
positionTypeName: item.posType?.posTypeName,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
organization: root == null ? null : root.orgRootShortName,
|
organization: root == null ? null : root.orgRootName,
|
||||||
salary: salary == "" ? "" : salary.amount,
|
salary: item.amount,
|
||||||
posMasterNo: posMasterNo ?? null,
|
posMasterNo: posMasterNo ?? null,
|
||||||
posTypeId: item.posTypeId,
|
posTypeId: item.posTypeId,
|
||||||
posTypeName: item.posType?.posTypeName,
|
posTypeName: item.posType?.posTypeName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue