Merge branch 'develop'
This commit is contained in:
commit
6ba554d78d
8 changed files with 345 additions and 172 deletions
|
|
@ -22,6 +22,7 @@ import { Not, Brackets } from "typeorm";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import { setLogDataDiff } from "../interfaces/utils";
|
import { setLogDataDiff } from "../interfaces/utils";
|
||||||
|
import { evaluation_directors_director } from "../entities/evaluation_directors_director";
|
||||||
@Route("api/v1/evaluation/director")
|
@Route("api/v1/evaluation/director")
|
||||||
@Tags("director")
|
@Tags("director")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -32,6 +33,9 @@ import { setLogDataDiff } from "../interfaces/utils";
|
||||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||||
export class DirectorController {
|
export class DirectorController {
|
||||||
private directorRepository = AppDataSource.getRepository(Director);
|
private directorRepository = AppDataSource.getRepository(Director);
|
||||||
|
private evaluation_directors_directorRepository = AppDataSource.getRepository(
|
||||||
|
evaluation_directors_director,
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API สำหรับแสดงรายการกรรมการ
|
* API สำหรับแสดงรายการกรรมการ
|
||||||
|
|
@ -200,10 +204,14 @@ export class DirectorController {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Put("duty/{id}")
|
@Put("duty/{id}")
|
||||||
async updateDuty(@Path() id: string, @Body() body:{duty: string} , @Request() request: RequestWithUser) {
|
async updateDuty(
|
||||||
|
@Path() id: string,
|
||||||
|
@Body() body: { duty: string },
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
await new permission().PermissionUpdate(request, "SYS_EVA_INFO");
|
await new permission().PermissionUpdate(request, "SYS_EVA_INFO");
|
||||||
let director = await this.directorRepository.findOneBy({ id });
|
let director = await this.evaluation_directors_directorRepository.findOneBy({ id });
|
||||||
if (!director) {
|
if (!director) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรรมการ");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรรมการ");
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +220,7 @@ export class DirectorController {
|
||||||
director.lastUpdateUserId = request.user.sub;
|
director.lastUpdateUserId = request.user.sub;
|
||||||
director.lastUpdateFullName = request.user.name;
|
director.lastUpdateFullName = request.user.name;
|
||||||
director.lastUpdatedAt = new Date();
|
director.lastUpdatedAt = new Date();
|
||||||
await this.directorRepository.save(director, { data: request });
|
await this.evaluation_directors_directorRepository.save(director, { data: request });
|
||||||
setLogDataDiff(request, { before, after: director });
|
setLogDataDiff(request, { before, after: director });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import Extension from "../interfaces/extension";
|
||||||
import { Portfolio } from "../entities/Portfolio";
|
import { Portfolio } from "../entities/Portfolio";
|
||||||
import { Performance } from "../entities/Performance";
|
import { Performance } from "../entities/Performance";
|
||||||
import { AnnounceTemplate } from "../entities/AnnounceTemplate";
|
import { AnnounceTemplate } from "../entities/AnnounceTemplate";
|
||||||
|
import { evaluation_directors_director } from "../entities/evaluation_directors_director";
|
||||||
|
|
||||||
@Route("api/v1/evaluation")
|
@Route("api/v1/evaluation")
|
||||||
@Tags("evaluation")
|
@Tags("evaluation")
|
||||||
|
|
@ -58,6 +59,9 @@ export class EvaluationController {
|
||||||
private directorRepository = AppDataSource.getRepository(Director);
|
private directorRepository = AppDataSource.getRepository(Director);
|
||||||
private meetingRepository = AppDataSource.getRepository(Meeting);
|
private meetingRepository = AppDataSource.getRepository(Meeting);
|
||||||
private announceTemplateRepository = AppDataSource.getRepository(AnnounceTemplate);
|
private announceTemplateRepository = AppDataSource.getRepository(AnnounceTemplate);
|
||||||
|
private evaluation_directors_directorRepository = AppDataSource.getRepository(
|
||||||
|
evaluation_directors_director,
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ล้างข้อมูล
|
* API ล้างข้อมูล
|
||||||
|
|
@ -79,29 +83,41 @@ export class EvaluationController {
|
||||||
@Get("performance/user")
|
@Get("performance/user")
|
||||||
async listPerformance(@Request() request: RequestWithUser) {
|
async listPerformance(@Request() request: RequestWithUser) {
|
||||||
const list = await AppDataSource.getRepository(Evaluation)
|
const list = await AppDataSource.getRepository(Evaluation)
|
||||||
.createQueryBuilder("evaluation")
|
.createQueryBuilder("evaluation")
|
||||||
.where("evaluation.userId = :userId", { userId: request.user.sub })
|
.where("evaluation.userId = :userId", { userId: request.user.sub })
|
||||||
.andWhere("evaluation.step = :step", { step: "DONE" })
|
.andWhere("evaluation.step = :step", { step: "DONE" })
|
||||||
.andWhere("evaluation.evaluationResult IN (:...evaluationResult)", {
|
.andWhere("evaluation.evaluationResult IN (:...evaluationResult)", {
|
||||||
evaluationResult: ["PASS", "NOTPASS"],
|
evaluationResult: ["PASS", "NOTPASS"],
|
||||||
})
|
})
|
||||||
.select([
|
.select([
|
||||||
"evaluation.id",
|
"evaluation.id",
|
||||||
"evaluation.type",
|
"evaluation.type",
|
||||||
"evaluation.subject",
|
"evaluation.subject",
|
||||||
"evaluation.evaluationResult",
|
"evaluation.evaluationResult",
|
||||||
"evaluation.lastUpdatedAt",
|
"evaluation.lastUpdatedAt",
|
||||||
])
|
])
|
||||||
.orderBy("evaluation.lastUpdatedAt", "ASC")
|
.orderBy("evaluation.lastUpdatedAt", "ASC")
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
const performance = list.map((item) => ({
|
const performance = list.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
year: item.lastUpdatedAt?Extension.ToThaiYear(item.lastUpdatedAt.getFullYear()):null,
|
year: item.lastUpdatedAt ? Extension.ToThaiYear(item.lastUpdatedAt.getFullYear()) : null,
|
||||||
type: item.type == "EXPERT" ? "ชำนาญการ" : item.type == "EXPERTISE" ? "เชียวชาญ" : item.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ": null,
|
type:
|
||||||
subject: item.subject?item.subject[0]:null,
|
item.type == "EXPERT"
|
||||||
evaluationResult: item.evaluationResult == "PASS" ? "ผ่าน" : item.evaluationResult == "NOTPASS" ? "ไม่ผ่าน" : null,
|
? "ชำนาญการ"
|
||||||
}));
|
: item.type == "EXPERTISE"
|
||||||
|
? "เชียวชาญ"
|
||||||
|
: item.type == "SPECIAL_EXPERT"
|
||||||
|
? "ชำนาญการพิเศษ"
|
||||||
|
: null,
|
||||||
|
subject: item.subject ? item.subject[0] : null,
|
||||||
|
evaluationResult:
|
||||||
|
item.evaluationResult == "PASS"
|
||||||
|
? "ผ่าน"
|
||||||
|
: item.evaluationResult == "NOTPASS"
|
||||||
|
? "ไม่ผ่าน"
|
||||||
|
: null,
|
||||||
|
}));
|
||||||
|
|
||||||
return new HttpSuccess(performance);
|
return new HttpSuccess(performance);
|
||||||
}
|
}
|
||||||
|
|
@ -134,6 +150,12 @@ export class EvaluationController {
|
||||||
try {
|
try {
|
||||||
// await new permission().PermissionList(request, "SYS_EVA_REQ");
|
// await new permission().PermissionList(request, "SYS_EVA_REQ");
|
||||||
let _data = await new permission().PermissionOrgList(request, "SYS_EVA_REQ");
|
let _data = await new permission().PermissionOrgList(request, "SYS_EVA_REQ");
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "/org/finddna", _data)
|
||||||
|
.then((x) => {
|
||||||
|
_data = x;
|
||||||
|
})
|
||||||
|
.catch((x) => {});
|
||||||
const [evaluation, total] = await AppDataSource.getRepository(Evaluation)
|
const [evaluation, total] = await AppDataSource.getRepository(Evaluation)
|
||||||
.createQueryBuilder("evaluation")
|
.createQueryBuilder("evaluation")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
|
|
@ -254,16 +276,18 @@ export class EvaluationController {
|
||||||
.createQueryBuilder("evaluation")
|
.createQueryBuilder("evaluation")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.andWhere(
|
if (
|
||||||
body.status == undefined ||
|
body.status == undefined ||
|
||||||
body.status == null ||
|
body.status == null ||
|
||||||
body.status.every((s) => s === "ALL")
|
body.status.every((s) => s === "ALL")
|
||||||
? "1=1"
|
) {
|
||||||
: `evaluation.step In (:status)`,
|
qb.andWhere("1=1");
|
||||||
{
|
} else {
|
||||||
|
qb.andWhere("evaluation.step IN (:...status)", {
|
||||||
status: body.status,
|
status: body.status,
|
||||||
},
|
});
|
||||||
).andWhere("evaluation.createdUserId = :createdUserId", {
|
}
|
||||||
|
qb.andWhere("evaluation.createdUserId = :createdUserId", {
|
||||||
createdUserId: request.user.sub,
|
createdUserId: request.user.sub,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
@ -347,18 +371,21 @@ export class EvaluationController {
|
||||||
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API get template ประกาศคัดเลือก
|
* API get template ประกาศคัดเลือก
|
||||||
*
|
*
|
||||||
* @summary get template ประกาศคัดเลือก (ADMIN)
|
* @summary get template ประกาศคัดเลือก (ADMIN)
|
||||||
*
|
*
|
||||||
* @param {string} id id ข้อมูลการประเมิน
|
* @param {string} id id ข้อมูลการประเมิน
|
||||||
*/
|
*/
|
||||||
@Get("get-announce-template/{id}")
|
@Get("get-announce-template/{id}")
|
||||||
async getAnnounceTemp(@Path() id: string, @Request() request: RequestWithUser) {
|
async getAnnounceTemp(@Path() id: string, @Request() request: RequestWithUser) {
|
||||||
try {
|
try {
|
||||||
const evaluation = await this.evaluationRepository.findOne({ where: { id } , select: ["id","detailAnnounceStep5Body","detailAnnounceStep5Footer"]});
|
const evaluation = await this.evaluationRepository.findOne({
|
||||||
|
where: { id },
|
||||||
|
select: ["id", "detailAnnounceStep5Body", "detailAnnounceStep5Footer"],
|
||||||
|
});
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน");
|
||||||
}
|
}
|
||||||
|
|
@ -368,7 +395,7 @@ export class EvaluationController {
|
||||||
throw error;
|
throw error;
|
||||||
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ดึงข้อมูลรายละเอียด step การขอประเมิน
|
* ดึงข้อมูลรายละเอียด step การขอประเมิน
|
||||||
|
|
@ -508,24 +535,41 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
return `not found data`;
|
return `not found data`;
|
||||||
}
|
}
|
||||||
let _code = requestBody.type == "EXPERT" ? "ST05-1" : requestBody.type == "EXPERTISE" ? "ST05-1" : requestBody.type == "SPECIAL_EXPERT" ? "ST05-2" : "ST05-1";
|
let _code =
|
||||||
|
requestBody.type == "EXPERT"
|
||||||
|
? "ST05-1"
|
||||||
|
: requestBody.type == "EXPERTISE"
|
||||||
|
? "ST05-1"
|
||||||
|
: requestBody.type == "SPECIAL_EXPERT"
|
||||||
|
? "ST05-2"
|
||||||
|
: "ST05-1";
|
||||||
const announceTemplate5 = await this.announceTemplateRepository.findOne({
|
const announceTemplate5 = await this.announceTemplateRepository.findOne({
|
||||||
where:{
|
where: {
|
||||||
code : _code
|
code: _code,
|
||||||
},
|
},
|
||||||
select: ["detailBody","detailFooter"]
|
select: ["detailBody", "detailFooter"],
|
||||||
})
|
});
|
||||||
const before = null;
|
const before = null;
|
||||||
|
let typeTh =
|
||||||
|
requestBody.type == "EXPERT"
|
||||||
|
? "ชำนาญการ"
|
||||||
|
: requestBody.type == "EXPERTISE"
|
||||||
|
? "เชียวชาญ"
|
||||||
|
: requestBody.type == "SPECIAL_EXPERT"
|
||||||
|
? "ชำนาญการพิเศษ"
|
||||||
|
: "";
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
|
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
|
||||||
.then(async (x) => {
|
.then(async (x) => {
|
||||||
evaluation.rootDnaId = x.rootDnaId;
|
evaluation.rootDnaId = x.rootDnaId;
|
||||||
evaluation.child1DnaId = x.child1DnaId;
|
evaluation.child1DnaId = x.child1DnaId;
|
||||||
evaluation.child2DnaId = x.child2DnaId;
|
evaluation.child2DnaId = x.child2DnaId;
|
||||||
evaluation.child3DnaId = x.child3DnaId;
|
evaluation.child3DnaId = x.child3DnaId;
|
||||||
evaluation.child4DnaId = x.child4DnaId;
|
evaluation.child4DnaId = x.child4DnaId;
|
||||||
})
|
})
|
||||||
.catch();
|
.catch();
|
||||||
|
evaluation.assignedPosition = requestBody.position ? requestBody.position : _null;
|
||||||
|
evaluation.assignedPosLevel = typeTh;
|
||||||
evaluation.step = "PREPARE_DOC_V1";
|
evaluation.step = "PREPARE_DOC_V1";
|
||||||
evaluation.type = requestBody.type == "EXPERT" ? "EXPERT" : "SPECIAL_EXPERT";
|
evaluation.type = requestBody.type == "EXPERT" ? "EXPERT" : "SPECIAL_EXPERT";
|
||||||
evaluation.fullName = requestBody.fullName;
|
evaluation.fullName = requestBody.fullName;
|
||||||
|
|
@ -536,10 +580,16 @@ export class EvaluationController {
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
evaluation.lastUpdatedAt = new Date();
|
evaluation.lastUpdatedAt = new Date();
|
||||||
evaluation.userId = request.user.sub;
|
evaluation.userId = request.user.sub;
|
||||||
evaluation.detailAnnounceStep5Body = announceTemplate5?.detailBody??_null;
|
evaluation.detailAnnounceStep5Body = announceTemplate5?.detailBody ?? _null;
|
||||||
evaluation.detailAnnounceStep5Footer = announceTemplate5?.detailFooter??_null;
|
evaluation.detailAnnounceStep5Footer = announceTemplate5?.detailFooter ?? _null;
|
||||||
evaluation.positionArea = requestBody.positionArea && requestBody.positionArea !== "" ? requestBody.positionArea : _null;
|
evaluation.positionArea =
|
||||||
evaluation.posExecutive = requestBody.posExecutive && requestBody.posExecutive !== "" ? requestBody.posExecutive : _null;
|
requestBody.positionArea && requestBody.positionArea !== ""
|
||||||
|
? requestBody.positionArea
|
||||||
|
: _null;
|
||||||
|
evaluation.posExecutive =
|
||||||
|
requestBody.posExecutive && requestBody.posExecutive !== ""
|
||||||
|
? requestBody.posExecutive
|
||||||
|
: _null;
|
||||||
await this.evaluationRepository.save(evaluation, { data: request });
|
await this.evaluationRepository.save(evaluation, { data: request });
|
||||||
setLogDataDiff(request, { before, after: evaluation });
|
setLogDataDiff(request, { before, after: evaluation });
|
||||||
|
|
||||||
|
|
@ -661,7 +711,7 @@ export class EvaluationController {
|
||||||
salaries.lastUpdateUserId = request.user.sub;
|
salaries.lastUpdateUserId = request.user.sub;
|
||||||
salaries.lastUpdateFullName = request.user.name;
|
salaries.lastUpdateFullName = request.user.name;
|
||||||
salaries.lastUpdatedAt = new Date();
|
salaries.lastUpdatedAt = new Date();
|
||||||
|
|
||||||
await this.salaryRepository.save(salaries, { data: request });
|
await this.salaryRepository.save(salaries, { data: request });
|
||||||
setLogDataDiff(request, { before, after: salaries });
|
setLogDataDiff(request, { before, after: salaries });
|
||||||
});
|
});
|
||||||
|
|
@ -712,7 +762,7 @@ export class EvaluationController {
|
||||||
await this.assessmentRepository.save(assessment, { data: request });
|
await this.assessmentRepository.save(assessment, { data: request });
|
||||||
setLogDataDiff(request, { before, after: assessment });
|
setLogDataDiff(request, { before, after: assessment });
|
||||||
});
|
});
|
||||||
|
|
||||||
//Portfolio
|
//Portfolio
|
||||||
if (requestBody.portfolios != null)
|
if (requestBody.portfolios != null)
|
||||||
requestBody.portfolios.forEach(async (pfo) => {
|
requestBody.portfolios.forEach(async (pfo) => {
|
||||||
|
|
@ -728,7 +778,7 @@ export class EvaluationController {
|
||||||
portfolio.evaluation = evaluation;
|
portfolio.evaluation = evaluation;
|
||||||
await this.portfolioRepository.save(portfolio, { data: request });
|
await this.portfolioRepository.save(portfolio, { data: request });
|
||||||
setLogDataDiff(request, { before, after: portfolio });
|
setLogDataDiff(request, { before, after: portfolio });
|
||||||
});
|
});
|
||||||
|
|
||||||
//Performance
|
//Performance
|
||||||
if (requestBody.performances != null)
|
if (requestBody.performances != null)
|
||||||
|
|
@ -747,8 +797,8 @@ export class EvaluationController {
|
||||||
performance.evaluation = evaluation;
|
performance.evaluation = evaluation;
|
||||||
await this.performanceRepository.save(performance, { data: request });
|
await this.performanceRepository.save(performance, { data: request });
|
||||||
setLogDataDiff(request, { before, after: performance });
|
setLogDataDiff(request, { before, after: performance });
|
||||||
});
|
});
|
||||||
|
|
||||||
//EvaluationLogs
|
//EvaluationLogs
|
||||||
const evaluationLogs = new EvaluationLogs();
|
const evaluationLogs = new EvaluationLogs();
|
||||||
evaluationLogs.step = (await ConvertToThaiStep("PREPARE_DOC_V1")) ?? _null;
|
evaluationLogs.step = (await ConvertToThaiStep("PREPARE_DOC_V1")) ?? _null;
|
||||||
|
|
@ -797,6 +847,7 @@ export class EvaluationController {
|
||||||
const evaluation = Object.assign(new Evaluation(), requestBody);
|
const evaluation = Object.assign(new Evaluation(), requestBody);
|
||||||
const before = null;
|
const before = null;
|
||||||
let org: any;
|
let org: any;
|
||||||
|
const __null: any = null;
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
|
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
|
||||||
.then(async (x) => {
|
.then(async (x) => {
|
||||||
|
|
@ -806,9 +857,12 @@ export class EvaluationController {
|
||||||
evaluation.child2DnaId = x.child2DnaId;
|
evaluation.child2DnaId = x.child2DnaId;
|
||||||
evaluation.child3DnaId = x.child3DnaId;
|
evaluation.child3DnaId = x.child3DnaId;
|
||||||
evaluation.child4DnaId = x.child4DnaId;
|
evaluation.child4DnaId = x.child4DnaId;
|
||||||
|
evaluation.positionLevel = x.posLevelName;
|
||||||
})
|
})
|
||||||
.catch();
|
.catch();
|
||||||
//Evaluation
|
//Evaluation
|
||||||
|
evaluation.assignedPosition = requestBody.position ? requestBody.position : __null;
|
||||||
|
evaluation.assignedPosLevel = "เชียวชาญ";
|
||||||
evaluation.oc = org;
|
evaluation.oc = org;
|
||||||
evaluation.step = "DONE";
|
evaluation.step = "DONE";
|
||||||
evaluation.type = "EXPERTISE";
|
evaluation.type = "EXPERTISE";
|
||||||
|
|
@ -919,13 +973,15 @@ export class EvaluationController {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
return new HttpSuccess(evaluation);
|
return new HttpSuccess(evaluation);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error instanceof HttpError) {
|
if (error instanceof HttpError) {
|
||||||
throw error;
|
throw error;
|
||||||
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
}
|
||||||
|
console.error("Unexpected error:", error);
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถดําเนินการได้");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1803,21 +1859,20 @@ export class EvaluationController {
|
||||||
})
|
})
|
||||||
.catch((x) => {});
|
.catch((x) => {});
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
_director.map((director:any) => {
|
_director.map((director: any) => {
|
||||||
return new CallAPI()
|
return new CallAPI()
|
||||||
.PostData(request, "/placement/noti/keycloak", {
|
.PostData(request, "/placement/noti/keycloak", {
|
||||||
subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
|
subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
|
||||||
body: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
|
body: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
|
||||||
receiverUserId: director.keycloak,
|
receiverUserId: director.keycloak,
|
||||||
payload: "",
|
payload: "",
|
||||||
isSendMail: true,
|
isSendMail: true,
|
||||||
isSendInbox: true,
|
isSendInbox: true,
|
||||||
isSendNotification: true,
|
isSendNotification: true,
|
||||||
})
|
})
|
||||||
.then((x) => {
|
.then((x) => {})
|
||||||
})
|
.catch((x) => {});
|
||||||
.catch((x) => {});
|
}),
|
||||||
})
|
|
||||||
);
|
);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
@ -2111,39 +2166,43 @@ export class EvaluationController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API แก้ไข template ประกาศคัดเลือก
|
* API แก้ไข template ประกาศคัดเลือก
|
||||||
*
|
*
|
||||||
* @summary แก้ไข template ประกาศคัดเลือก (ADMIN)
|
* @summary แก้ไข template ประกาศคัดเลือก (ADMIN)
|
||||||
*
|
*
|
||||||
* @param {string} id id ข้อมูลการประเมิน
|
* @param {string} id id ข้อมูลการประเมิน
|
||||||
*/
|
*/
|
||||||
@Put("edit-announce-template/{id}")
|
@Put("edit-announce-template/{id}")
|
||||||
async editAnnounceTemp(@Path() id: string, @Request() request: RequestWithUser, @Body() body: {detailBody: string, detailFooter: string}) {
|
async editAnnounceTemp(
|
||||||
try {
|
@Path() id: string,
|
||||||
await new permission().PermissionUpdate(request, "SYS_EVA_REQ");
|
@Request() request: RequestWithUser,
|
||||||
|
@Body() body: { detailBody: string; detailFooter: string },
|
||||||
const evaluation = await this.evaluationRepository.findOne({ where: { id } });
|
) {
|
||||||
if (!evaluation) {
|
try {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
await new permission().PermissionUpdate(request, "SYS_EVA_REQ");
|
||||||
}
|
|
||||||
const before = structuredClone(evaluation);
|
const evaluation = await this.evaluationRepository.findOne({ where: { id } });
|
||||||
|
if (!evaluation) {
|
||||||
evaluation.detailAnnounceStep5Body = body.detailBody;
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
evaluation.detailAnnounceStep5Footer = body.detailFooter;
|
}
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
const before = structuredClone(evaluation);
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
|
||||||
evaluation.lastUpdatedAt = new Date();
|
evaluation.detailAnnounceStep5Body = body.detailBody;
|
||||||
await this.evaluationRepository.save(evaluation, { data: request });
|
evaluation.detailAnnounceStep5Footer = body.detailFooter;
|
||||||
setLogDataDiff(request, { before, after: evaluation });
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
return new HttpSuccess();
|
evaluation.lastUpdatedAt = new Date();
|
||||||
} catch (error: any) {
|
await this.evaluationRepository.save(evaluation, { data: request });
|
||||||
if (error instanceof HttpError) {
|
setLogDataDiff(request, { before, after: evaluation });
|
||||||
throw error;
|
|
||||||
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
return new HttpSuccess();
|
||||||
}
|
} catch (error: any) {
|
||||||
}
|
if (error instanceof HttpError) {
|
||||||
|
throw error;
|
||||||
|
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API บันทึกแจ้งผลการประกาศคัดเลือก
|
* API บันทึกแจ้งผลการประกาศคัดเลือก
|
||||||
|
|
@ -2176,11 +2235,11 @@ export class EvaluationController {
|
||||||
setLogDataDiff(request, { before: null, after: evaluationLogs });
|
setLogDataDiff(request, { before: null, after: evaluationLogs });
|
||||||
}
|
}
|
||||||
const before = structuredClone(evaluation);
|
const before = structuredClone(evaluation);
|
||||||
|
|
||||||
evaluation.step = "PREPARE_DOC_V2";
|
evaluation.step = "PREPARE_DOC_V2";
|
||||||
evaluation.subjectDoc2 = evaluation.subject;
|
evaluation.subjectDoc2 = evaluation.subject;
|
||||||
evaluation.authorDoc2 = evaluation.author;
|
evaluation.authorDoc2 = evaluation.author;
|
||||||
evaluation.assignedPosition = evaluation.position;
|
evaluation.assignedPosition = evaluation.assignedPosition;
|
||||||
|
evaluation.assignedPosLevel = evaluation.assignedPosLevel;
|
||||||
evaluation.commanderFullnameDoc2 = evaluation.commanderFullname;
|
evaluation.commanderFullnameDoc2 = evaluation.commanderFullname;
|
||||||
evaluation.commanderPositionDoc2 = evaluation.commanderPosition;
|
evaluation.commanderPositionDoc2 = evaluation.commanderPosition;
|
||||||
evaluation.commanderAboveFullnameDoc2 = evaluation.commanderAboveFullname;
|
evaluation.commanderAboveFullnameDoc2 = evaluation.commanderAboveFullname;
|
||||||
|
|
@ -2192,7 +2251,7 @@ export class EvaluationController {
|
||||||
evaluation.commanderAboveOrgDoc2 = evaluation.commanderAboveOrg;
|
evaluation.commanderAboveOrgDoc2 = evaluation.commanderAboveOrg;
|
||||||
evaluation.commanderAboveOrgOldDoc2 = evaluation.commanderAboveOrgOld;
|
evaluation.commanderAboveOrgOldDoc2 = evaluation.commanderAboveOrgOld;
|
||||||
evaluation.commanderAbovePositionOldDoc2 = evaluation.commanderAbovePositionOld;
|
evaluation.commanderAbovePositionOldDoc2 = evaluation.commanderAbovePositionOld;
|
||||||
|
|
||||||
evaluation.datePrepareDoc2 = new Date();
|
evaluation.datePrepareDoc2 = new Date();
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
|
|
@ -2437,12 +2496,23 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
if (!evaluation.directors) {
|
if (!evaluation.evaluation_directors_director) {
|
||||||
evaluation.directors = [];
|
evaluation.evaluation_directors_director = [];
|
||||||
}
|
}
|
||||||
body.directors.forEach(async (directorId) => {
|
body.directors.forEach(async (directorId) => {
|
||||||
const director = await this.directorRepository.findOne({ where: { id: directorId } });
|
const director = await this.directorRepository.findOne({ where: { id: directorId } });
|
||||||
if (director != null) evaluation.directors.push(director);
|
if (director != null) {
|
||||||
|
await this.evaluation_directors_directorRepository.save({
|
||||||
|
directorId: director.id,
|
||||||
|
evaluationId: evaluation.id,
|
||||||
|
createdUserId: request.user.sub,
|
||||||
|
createdFullName: request.user.name,
|
||||||
|
lastUpdateUserId: request.user.sub,
|
||||||
|
lastUpdateFullName: request.user.name,
|
||||||
|
createdAt: new Date(),
|
||||||
|
lastUpdatedAt: new Date(),
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
|
|
@ -2539,20 +2609,24 @@ export class EvaluationController {
|
||||||
|
|
||||||
const evaluation = await this.evaluationRepository.findOne({
|
const evaluation = await this.evaluationRepository.findOne({
|
||||||
where: { id },
|
where: { id },
|
||||||
relations: ["directors", "meetings"],
|
relations: [
|
||||||
|
"evaluation_directors_director",
|
||||||
|
"evaluation_directors_director.director",
|
||||||
|
"meetings",
|
||||||
|
],
|
||||||
});
|
});
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
const directors = evaluation.directors.map((director) => ({
|
const directors = evaluation.evaluation_directors_director.map((director) => ({
|
||||||
id: director.id,
|
id: director.id,
|
||||||
prefix: director.prefix,
|
prefix: director.director.prefix,
|
||||||
firstName: director.firstName,
|
firstName: director.director.firstName,
|
||||||
lastName: director.lastName,
|
lastName: director.director.lastName,
|
||||||
position: director.position,
|
position: director.director.position,
|
||||||
positionName: null,
|
positionName: null,
|
||||||
email: director.email,
|
email: director.director.email,
|
||||||
phone: director.phone,
|
phone: director.director.phone,
|
||||||
duty: director.duty,
|
duty: director.duty,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -2766,7 +2840,7 @@ export class EvaluationController {
|
||||||
"commanderAbovePositionOld",
|
"commanderAbovePositionOld",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
|
|
@ -2835,6 +2909,7 @@ export class EvaluationController {
|
||||||
"authorDoc2",
|
"authorDoc2",
|
||||||
"subjectDoc2",
|
"subjectDoc2",
|
||||||
"assignedPosition",
|
"assignedPosition",
|
||||||
|
"assignedPosLevel",
|
||||||
"commanderFullnameDoc2",
|
"commanderFullnameDoc2",
|
||||||
"commanderOrgDoc2",
|
"commanderOrgDoc2",
|
||||||
"commanderOrgOldDoc2",
|
"commanderOrgOldDoc2",
|
||||||
|
|
@ -2879,6 +2954,7 @@ export class EvaluationController {
|
||||||
"authorDoc2",
|
"authorDoc2",
|
||||||
"subjectDoc2",
|
"subjectDoc2",
|
||||||
"assignedPosition",
|
"assignedPosition",
|
||||||
|
"assignedPosLevel",
|
||||||
"commanderFullnameDoc2",
|
"commanderFullnameDoc2",
|
||||||
"commanderOrgDoc2",
|
"commanderOrgDoc2",
|
||||||
"commanderOrgOldDoc2",
|
"commanderOrgOldDoc2",
|
||||||
|
|
@ -2947,19 +3023,19 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
const _null:any = null;
|
const _null: any = null;
|
||||||
evaluation.author = body.author;
|
evaluation.author = body.author;
|
||||||
evaluation.subject = body.subject;
|
evaluation.subject = body.subject;
|
||||||
evaluation.commanderFullname = body.commanderFullname;
|
evaluation.commanderFullname = body.commanderFullname;
|
||||||
evaluation.commanderOrg = body.commanderOrg??_null;
|
evaluation.commanderOrg = body.commanderOrg ?? _null;
|
||||||
evaluation.commanderOrgOld = body.commanderOrgOld??_null;
|
evaluation.commanderOrgOld = body.commanderOrgOld ?? _null;
|
||||||
evaluation.commanderPosition = body.commanderPosition;
|
evaluation.commanderPosition = body.commanderPosition;
|
||||||
evaluation.commanderPositionOld = body.commanderPositionOld??_null;
|
evaluation.commanderPositionOld = body.commanderPositionOld ?? _null;
|
||||||
evaluation.commanderAboveFullname = body.commanderAboveFullname;
|
evaluation.commanderAboveFullname = body.commanderAboveFullname;
|
||||||
evaluation.commanderAboveOrg = body.commanderAboveOrg??_null;
|
evaluation.commanderAboveOrg = body.commanderAboveOrg ?? _null;
|
||||||
evaluation.commanderAboveOrgOld = body.commanderAboveOrgOld??_null;
|
evaluation.commanderAboveOrgOld = body.commanderAboveOrgOld ?? _null;
|
||||||
evaluation.commanderAbovePosition = body.commanderAbovePosition;
|
evaluation.commanderAbovePosition = body.commanderAbovePosition;
|
||||||
evaluation.commanderAbovePositionOld = body.commanderAbovePositionOld??_null;
|
evaluation.commanderAbovePositionOld = body.commanderAbovePositionOld ?? _null;
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
evaluation.lastUpdatedAt = new Date();
|
evaluation.lastUpdatedAt = new Date();
|
||||||
|
|
@ -2988,6 +3064,7 @@ export class EvaluationController {
|
||||||
authorDoc2: "string",
|
authorDoc2: "string",
|
||||||
subjectDoc2: "string",
|
subjectDoc2: "string",
|
||||||
assignedPosition: "string",
|
assignedPosition: "string",
|
||||||
|
assignedPosLevel: "string",
|
||||||
commanderFullnameDoc2: "string",
|
commanderFullnameDoc2: "string",
|
||||||
commanderPositionDoc2: "string",
|
commanderPositionDoc2: "string",
|
||||||
commanderAboveFullnameDoc2: "string",
|
commanderAboveFullnameDoc2: "string",
|
||||||
|
|
@ -3001,6 +3078,7 @@ export class EvaluationController {
|
||||||
authorDoc2: string;
|
authorDoc2: string;
|
||||||
subjectDoc2: string[];
|
subjectDoc2: string[];
|
||||||
assignedPosition: string;
|
assignedPosition: string;
|
||||||
|
assignedPosLevel?: string;
|
||||||
commanderFullnameDoc2: string;
|
commanderFullnameDoc2: string;
|
||||||
commanderPositionDoc2: string;
|
commanderPositionDoc2: string;
|
||||||
commanderAboveFullnameDoc2: string;
|
commanderAboveFullnameDoc2: string;
|
||||||
|
|
@ -3020,20 +3098,21 @@ export class EvaluationController {
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
const _null:any = null;
|
const _null: any = null;
|
||||||
evaluation.authorDoc2 = body.authorDoc2;
|
evaluation.authorDoc2 = body.authorDoc2;
|
||||||
evaluation.subjectDoc2 = body.subjectDoc2;
|
evaluation.subjectDoc2 = body.subjectDoc2;
|
||||||
evaluation.assignedPosition = body.assignedPosition;
|
evaluation.assignedPosition = body.assignedPosition;
|
||||||
|
evaluation.assignedPosLevel = body.assignedPosLevel ? body.assignedPosLevel : evaluation.assignedPosLevel;
|
||||||
evaluation.commanderFullnameDoc2 = body.commanderFullnameDoc2;
|
evaluation.commanderFullnameDoc2 = body.commanderFullnameDoc2;
|
||||||
evaluation.commanderOrgDoc2 = body.commanderOrgDoc2??_null;
|
evaluation.commanderOrgDoc2 = body.commanderOrgDoc2 ?? _null;
|
||||||
evaluation.commanderOrgOldDoc2 = body.commanderOrgOldDoc2??_null;
|
evaluation.commanderOrgOldDoc2 = body.commanderOrgOldDoc2 ?? _null;
|
||||||
evaluation.commanderPositionDoc2 = body.commanderPositionDoc2;
|
evaluation.commanderPositionDoc2 = body.commanderPositionDoc2;
|
||||||
evaluation.commanderPositionOldDoc2 = body.commanderPositionOldDoc2??_null;
|
evaluation.commanderPositionOldDoc2 = body.commanderPositionOldDoc2 ?? _null;
|
||||||
evaluation.commanderAboveFullnameDoc2 = body.commanderAboveFullnameDoc2;
|
evaluation.commanderAboveFullnameDoc2 = body.commanderAboveFullnameDoc2;
|
||||||
evaluation.commanderAboveOrgDoc2 = body.commanderAboveOrgDoc2??_null;
|
evaluation.commanderAboveOrgDoc2 = body.commanderAboveOrgDoc2 ?? _null;
|
||||||
evaluation.commanderAboveOrgOldDoc2 = body.commanderAboveOrgOldDoc2??_null;
|
evaluation.commanderAboveOrgOldDoc2 = body.commanderAboveOrgOldDoc2 ?? _null;
|
||||||
evaluation.commanderAbovePositionDoc2 = body.commanderAbovePositionDoc2;
|
evaluation.commanderAbovePositionDoc2 = body.commanderAbovePositionDoc2;
|
||||||
evaluation.commanderAbovePositionOldDoc2 = body.commanderAbovePositionOldDoc2??_null;
|
evaluation.commanderAbovePositionOldDoc2 = body.commanderAbovePositionOldDoc2 ?? _null;
|
||||||
evaluation.isUpdated = true;
|
evaluation.isUpdated = true;
|
||||||
evaluation.lastUpdateUserId = request.user.sub;
|
evaluation.lastUpdateUserId = request.user.sub;
|
||||||
evaluation.lastUpdateFullName = request.user.name;
|
evaluation.lastUpdateFullName = request.user.name;
|
||||||
|
|
@ -3063,7 +3142,7 @@ export class EvaluationController {
|
||||||
// await new permission().PermissionDelete(request, "SYS_EVA_REQ");
|
// await new permission().PermissionDelete(request, "SYS_EVA_REQ");
|
||||||
const evaluation = await this.evaluationRepository.findOne({
|
const evaluation = await this.evaluationRepository.findOne({
|
||||||
where: { id },
|
where: { id },
|
||||||
relations: ["meetings", "directors"],
|
relations: ["meetings", "evaluation_directors_director"],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!evaluation) {
|
if (!evaluation) {
|
||||||
|
|
@ -3084,11 +3163,7 @@ export class EvaluationController {
|
||||||
this.meetingRepository.remove(meeting, { data: request }),
|
this.meetingRepository.remove(meeting, { data: request }),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await Promise.all(
|
await this.evaluation_directors_directorRepository.delete({ evaluationId: id });
|
||||||
evaluation.directors.map((director) =>
|
|
||||||
this.directorRepository.remove(director, { data: request }),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
await this.evaluationRepository.delete({ id });
|
await this.evaluationRepository.delete({ id });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,9 @@ export class ReoportController {
|
||||||
"evaluation.commanderAbovePositionOld",
|
"evaluation.commanderAbovePositionOld",
|
||||||
"evaluation.commanderAboveOrg",
|
"evaluation.commanderAboveOrg",
|
||||||
"evaluation.commanderAboveOrgOld",
|
"evaluation.commanderAboveOrgOld",
|
||||||
|
"evaluation.root",
|
||||||
|
"evaluation.assignedPosition",
|
||||||
|
"evaluation.assignedPosLevel",
|
||||||
|
|
||||||
"education.educationLevel",
|
"education.educationLevel",
|
||||||
"education.institute",
|
"education.institute",
|
||||||
|
|
@ -318,7 +321,7 @@ export class ReoportController {
|
||||||
lastOneYear: Extension.ToThaiNumber((thaiYear - 1).toString()),
|
lastOneYear: Extension.ToThaiNumber((thaiYear - 1).toString()),
|
||||||
currentYear: Extension.ToThaiNumber(thaiYear.toString()),
|
currentYear: Extension.ToThaiNumber(thaiYear.toString()),
|
||||||
};
|
};
|
||||||
let _orgNoNewLine = (org ? org : "-").replace(/\n/g, " ");
|
let _orgNoNewLine = (evaluation.oc ? evaluation.oc : "-").replace(/\n/g, " ");
|
||||||
let topic10 = evaluation.type == "EXPERT" || evaluation.type == "EXPERTISE" ? "หน่วยงาน" : evaluation.type == "SPECIAL_EXPERT" ? "กรุงเทพมหานคร" : "หน่วยงาน";
|
let topic10 = evaluation.type == "EXPERT" || evaluation.type == "EXPERTISE" ? "หน่วยงาน" : evaluation.type == "SPECIAL_EXPERT" ? "กรุงเทพมหานคร" : "หน่วยงาน";
|
||||||
let footer10 = evaluation.type == "EXPERT" || evaluation.type == "EXPERTISE" ? "หัวหน้าหน่วยงาน" : evaluation.type == "SPECIAL_EXPERT" ? "ปลัดกรุงเทพมหานคร" : "หัวหน้าหน่วยงาน";
|
let footer10 = evaluation.type == "EXPERT" || evaluation.type == "EXPERTISE" ? "หัวหน้าหน่วยงาน" : evaluation.type == "SPECIAL_EXPERT" ? "ปลัดกรุงเทพมหานคร" : "หัวหน้าหน่วยงาน";
|
||||||
let typeTh = evaluation.type == "EXPERT" ? "ชำนาญการ" : evaluation.type == "EXPERTISE" ? "เชียวชาญ" : evaluation.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ":"";
|
let typeTh = evaluation.type == "EXPERT" ? "ชำนาญการ" : evaluation.type == "EXPERTISE" ? "เชียวชาญ" : evaluation.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ":"";
|
||||||
|
|
@ -335,16 +338,25 @@ export class ReoportController {
|
||||||
prefix: evaluation.prefix,
|
prefix: evaluation.prefix,
|
||||||
fullName: evaluation.fullName ? `${evaluation.fullName}` : "",
|
fullName: evaluation.fullName ? `${evaluation.fullName}` : "",
|
||||||
position: evaluation.position ? evaluation.position : "",
|
position: evaluation.position ? evaluation.position : "",
|
||||||
|
// ตำแหน่งเดิม,
|
||||||
posAndPosLevel: (evaluation.position ? `${evaluation.position}` : "") + (evaluation.positionLevel ? `${evaluation.positionLevel}` : ""),
|
posAndPosLevel: (evaluation.position ? `${evaluation.position}` : "") + (evaluation.positionLevel ? `${evaluation.positionLevel}` : ""),
|
||||||
posAndTypeTh: (evaluation.position ? `${evaluation.position}` : "" ) + (typeTh ? `${typeTh}` : ""),
|
// ตำแหน่งใหม่
|
||||||
|
posAndTypeTh: (evaluation.assignedPosition ? `${evaluation.assignedPosition}` : "" ) + (evaluation.assignedPosLevel ? `${evaluation.assignedPosLevel}` : `${typeTh??""}`),
|
||||||
|
posLevel: evaluation.assignedPosLevel ?? "-", //ระดับที่ขอประเมิน
|
||||||
posNo: evaluation.posNo ? Extension.ToThaiNumber(evaluation.posNo) : "",
|
posNo: evaluation.posNo ? Extension.ToThaiNumber(evaluation.posNo) : "",
|
||||||
posNoWithSym: evaluation.posNo ? `(${Extension.ToThaiNumber(evaluation.posNo)})` : "",
|
posNoWithSym: evaluation.posNo ? `(${Extension.ToThaiNumber(evaluation.posNo)})` : "",
|
||||||
oc: evaluation.oc ? evaluation.oc : "-",
|
oc: evaluation.oc ? evaluation.oc.replace(/\n/g, " ") : "-",
|
||||||
org: org ? org : "-", //สังกัด
|
org: org ? org : "-", //สังกัด
|
||||||
orgNoNewLine: _orgNoNewLine ? _orgNoNewLine : "-", //สังกัดแบบไม่เว้นวรรค
|
orgNoNewLine: _orgNoNewLine ? _orgNoNewLine : "-", //สังกัดแบบไม่เว้นวรรค
|
||||||
root: root ? root : "-", //หน่วยงาน
|
root: evaluation.salaries.length > 0 ? evaluation.salaries[0].orgRoot : "-", //หน่วยงาน
|
||||||
salary: evaluation.salary ? Extension.ToThaiNumber(evaluation.salary) : "-",
|
child1: evaluation.salaries.length > 0 // กอง / ศูนย์ / ส่วน
|
||||||
salaryWithPrefix: evaluation.salary ? "อัตราเงินเดือนปัจจุบัน" +" "+ Extension.ToThaiNumber(evaluation.salary) : "-",
|
? evaluation.salaries[0].orgChild1
|
||||||
|
: "-",
|
||||||
|
child432: evaluation.salaries.length > 0 // งาน / ฝ่าย / กลุ่ม
|
||||||
|
? `${evaluation.salaries[0].orgChild4 ?? ""} ${evaluation.salaries[0].orgChild3 ?? ""} ${evaluation.salaries[0].orgChild2 ?? ""}`.trim()
|
||||||
|
: "-",
|
||||||
|
salary: evaluation.salary ? Extension.ToThaiNumber(Number(evaluation.salary).toLocaleString()) : "-",
|
||||||
|
salaryWithPrefix: evaluation.salary ? "อัตราเงินเดือนปัจจุบัน" +" "+ Extension.ToThaiNumber(Number(evaluation.salary).toLocaleString()) : "-",
|
||||||
positionLevel: evaluation.positionLevel ? evaluation.positionLevel : "",
|
positionLevel: evaluation.positionLevel ? evaluation.positionLevel : "",
|
||||||
detailAnnounceStep5Body: evaluation.detailAnnounceStep5Body,
|
detailAnnounceStep5Body: evaluation.detailAnnounceStep5Body,
|
||||||
detailAnnounceStep5Footer: evaluation.detailAnnounceStep5Footer,
|
detailAnnounceStep5Footer: evaluation.detailAnnounceStep5Footer,
|
||||||
|
|
@ -521,9 +533,9 @@ export class ReoportController {
|
||||||
commanderAboveOrg: evaluation.commanderAboveOrg ? evaluation.commanderAboveOrg : "-",
|
commanderAboveOrg: evaluation.commanderAboveOrg ? evaluation.commanderAboveOrg : "-",
|
||||||
commanderAboveOrgOld: evaluation.commanderAboveOrgOld ? evaluation.commanderAboveOrgOld : "-",
|
commanderAboveOrgOld: evaluation.commanderAboveOrgOld ? evaluation.commanderAboveOrgOld : "-",
|
||||||
commanderPositionSign: (evaluation.commanderPosition ? evaluation.commanderPosition : "") + (evaluation.commanderOrg ? " " + evaluation.commanderOrg : "")
|
commanderPositionSign: (evaluation.commanderPosition ? evaluation.commanderPosition : "") + (evaluation.commanderOrg ? " " + evaluation.commanderOrg : "")
|
||||||
+ (evaluation.commanderPosition || evaluation.commanderOrg ? `\n` + "ขณะดำรงตำแหน่ง" : "") + (evaluation.commanderPositionOld ? " " + evaluation.commanderPositionOld:"") + (evaluation.commanderOrgOld ? " " + evaluation.commanderOrgOld : ""),
|
+ (evaluation.commanderPosition || evaluation.commanderOrg ? `\n` : "") + (evaluation.commanderPositionOld ? `ขณะดำรงตำแหน่ง ${evaluation.commanderPositionOld}` : "") + (evaluation.commanderOrgOld ? " " + evaluation.commanderOrgOld : ""),
|
||||||
commanderAbovePositionSign: (evaluation.commanderAbovePosition ? evaluation.commanderAbovePosition : "") + (evaluation.commanderAboveOrg ? " " + evaluation.commanderAboveOrg : "")
|
commanderAbovePositionSign: (evaluation.commanderAbovePosition ? evaluation.commanderAbovePosition : "") + (evaluation.commanderAboveOrg ? " " + evaluation.commanderAboveOrg : "")
|
||||||
+ (evaluation.commanderAbovePosition || evaluation.commanderAboveOrg ? `\n` + "ขณะดำรงตำแหน่ง" : "") + (evaluation.commanderAbovePositionOld ? " " + evaluation.commanderAbovePositionOld: "") + (evaluation.commanderAboveOrgOld ? " " + evaluation.commanderAboveOrgOld : ""),
|
+ (evaluation.commanderAbovePosition || evaluation.commanderAboveOrg ? `\n`: "") + (evaluation.commanderAbovePositionOld ? `ขณะดำรงตำแหน่ง ${evaluation.commanderAbovePositionOld}` : "") + (evaluation.commanderAboveOrgOld ? " " + evaluation.commanderAboveOrgOld : ""),
|
||||||
years: years,
|
years: years,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
import {
|
import { Entity, Column, ManyToMany, OneToMany, JoinTable } from "typeorm";
|
||||||
Entity,
|
|
||||||
Column,
|
|
||||||
ManyToMany,
|
|
||||||
} from "typeorm";
|
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
import { Evaluation } from "./Evaluation";
|
import { Evaluation } from "./Evaluation";
|
||||||
|
import { evaluation_directors_director } from "./evaluation_directors_director";
|
||||||
@Entity("director")
|
@Entity("director")
|
||||||
export class Director extends EntityBase {
|
export class Director extends EntityBase {
|
||||||
@Column({ nullable: true, comment: "คำนำหน้าชื่อ" })
|
@Column({ nullable: true, comment: "คำนำหน้าชื่อ" })
|
||||||
|
|
@ -25,11 +22,18 @@ export class Director extends EntityBase {
|
||||||
@Column({ nullable: true, comment: "ตำแหน่ง" })
|
@Column({ nullable: true, comment: "ตำแหน่ง" })
|
||||||
position: string;
|
position: string;
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "หน้าที่" })
|
// @Column({ nullable: true, comment: "หน้าที่" })
|
||||||
duty: string;
|
// duty: string;
|
||||||
|
|
||||||
@ManyToMany(() => Evaluation, (evaluation) => evaluation.directors)
|
// @ManyToMany(() => Evaluation, (evaluation) => evaluation.directors)
|
||||||
evaluations: Evaluation[];
|
// evaluations: Evaluation[];
|
||||||
|
|
||||||
|
@OneToMany(
|
||||||
|
() => evaluation_directors_director,
|
||||||
|
(evaluation_directors_director) => evaluation_directors_director.director,
|
||||||
|
)
|
||||||
|
@JoinTable()
|
||||||
|
evaluation_directors_director: evaluation_directors_director[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateDirector {
|
export class CreateDirector {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { Director } from "./Director";
|
||||||
import { Meeting } from "./Meeting";
|
import { Meeting } from "./Meeting";
|
||||||
import { Portfolio } from "./Portfolio";
|
import { Portfolio } from "./Portfolio";
|
||||||
import { Performance } from "./Performance";
|
import { Performance } from "./Performance";
|
||||||
|
import { evaluation_directors_director } from "./evaluation_directors_director";
|
||||||
|
|
||||||
@Entity("evaluation")
|
@Entity("evaluation")
|
||||||
export class Evaluation extends EntityBase {
|
export class Evaluation extends EntityBase {
|
||||||
|
|
@ -201,7 +202,6 @@ export class Evaluation extends EntityBase {
|
||||||
@Column({ nullable: true, comment: "ตำแหน่ง ผู้บังคับบัญชาชั้นต้น (จัดเตรียมเอกสารเล่ม 2)" })
|
@Column({ nullable: true, comment: "ตำแหน่ง ผู้บังคับบัญชาชั้นต้น (จัดเตรียมเอกสารเล่ม 2)" })
|
||||||
commanderPositionDoc2: string;
|
commanderPositionDoc2: string;
|
||||||
|
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "สังกัดปัจุบัน ผู้บังคับบัญชาชั้นต้น" })
|
@Column({ nullable: true, comment: "สังกัดปัจุบัน ผู้บังคับบัญชาชั้นต้น" })
|
||||||
commanderOrg: string;
|
commanderOrg: string;
|
||||||
@Column({ nullable: true, comment: "สังกัดเดิม ผู้บังคับบัญชาชั้นต้น" })
|
@Column({ nullable: true, comment: "สังกัดเดิม ผู้บังคับบัญชาชั้นต้น" })
|
||||||
|
|
@ -256,32 +256,33 @@ export class Evaluation extends EntityBase {
|
||||||
@Column({ nullable: true, comment: "ชื่อเจ้าของผลงาน" })
|
@Column({ nullable: true, comment: "ชื่อเจ้าของผลงาน" })
|
||||||
author: string;
|
author: string;
|
||||||
|
|
||||||
@Column({ type: 'json', nullable: true, comment: 'ชื่อผลงาน' })
|
@Column({ type: "json", nullable: true, comment: "ชื่อผลงาน" })
|
||||||
subject: string[];
|
subject: string[];
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "ชื่อเจ้าของผลงาน2" })
|
@Column({ nullable: true, comment: "ชื่อเจ้าของผลงาน2" })
|
||||||
authorDoc2: string;
|
authorDoc2: string;
|
||||||
|
|
||||||
@Column({ type: 'json', nullable: true, comment: "ชื่อผลงาน2" })
|
@Column({ type: "json", nullable: true, comment: "ชื่อผลงาน2" })
|
||||||
subjectDoc2: string[];
|
subjectDoc2: string[];
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "ตำแหน่งที่ได้รับมอบหมาย" })
|
@Column({ nullable: true, comment: "ตำแหน่งที่ได้รับมอบหมาย" })
|
||||||
assignedPosition: string;
|
assignedPosition: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, comment: "ระดับที่ได้รับมอบหมาย" })
|
||||||
|
assignedPosLevel: string;
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "ผลการประเมิน", default: "PENDING" }) //PENDING,PASS,NOTPASS
|
@Column({ nullable: true, comment: "ผลการประเมิน", default: "PENDING" }) //PENDING,PASS,NOTPASS
|
||||||
evaluationResult: string;
|
evaluationResult: string;
|
||||||
|
|
||||||
@Column({ type: 'text', nullable: true, comment: 'รายละเอียดประกาศ(STEP5)'})
|
@Column({ type: "text", nullable: true, comment: "รายละเอียดประกาศ(STEP5)" })
|
||||||
detailAnnounceStep5Body: string;
|
detailAnnounceStep5Body: string;
|
||||||
|
|
||||||
@Column({ type: 'text', nullable: true, comment: 'รายละเอียดส่วนท้าย(STEP5)'})
|
@Column({ type: "text", nullable: true, comment: "รายละเอียดส่วนท้าย(STEP5)" })
|
||||||
detailAnnounceStep5Footer: string;
|
detailAnnounceStep5Footer: string;
|
||||||
|
|
||||||
@Column({ default: false, comment: 'สถานะเช็คการอัพเดทชื่อผลงาน (STEP6)'})
|
@Column({ default: false, comment: "สถานะเช็คการอัพเดทชื่อผลงาน (STEP6)" })
|
||||||
isUpdated: boolean;
|
isUpdated: boolean;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(() => EvaluationLogs, (evaluationLogs) => evaluationLogs.evaluation)
|
@OneToMany(() => EvaluationLogs, (evaluationLogs) => evaluationLogs.evaluation)
|
||||||
evaluationLogs: EvaluationLogs[];
|
evaluationLogs: EvaluationLogs[];
|
||||||
|
|
||||||
|
|
@ -306,15 +307,20 @@ export class Evaluation extends EntityBase {
|
||||||
@OneToMany(() => Performance, (performance) => performance.evaluation)
|
@OneToMany(() => Performance, (performance) => performance.evaluation)
|
||||||
performances: Performance[];
|
performances: Performance[];
|
||||||
|
|
||||||
@ManyToMany(() => Director, (director) => director.evaluations)
|
// @ManyToMany(() => Director, (director) => director.evaluations)
|
||||||
@JoinTable()
|
// @JoinTable()
|
||||||
directors: Director[];
|
// directors: Director[];
|
||||||
|
|
||||||
@ManyToMany(() => Meeting, (meeting) => meeting.evaluations)
|
@ManyToMany(() => Meeting, (meeting) => meeting.evaluations)
|
||||||
@JoinTable()
|
@JoinTable()
|
||||||
meetings: Meeting[];
|
meetings: Meeting[];
|
||||||
|
|
||||||
|
@OneToMany(
|
||||||
|
() => evaluation_directors_director,
|
||||||
|
(evaluation_directors_director) => evaluation_directors_director.evaluation,
|
||||||
|
)
|
||||||
|
@JoinTable()
|
||||||
|
evaluation_directors_director: evaluation_directors_director[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateEvaluation {
|
export class CreateEvaluation {
|
||||||
|
|
@ -596,7 +602,7 @@ export class CreateEvaluationExpertise {
|
||||||
author?: string | null;
|
author?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
subject?: string | null;
|
subject?: string[] | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
commanderFullname?: string | null;
|
commanderFullname?: string | null;
|
||||||
|
|
@ -612,7 +618,7 @@ export class CreateEvaluationExpertise {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
oc?: string | null;
|
oc?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
citizenId?: string | null;
|
citizenId?: string | null;
|
||||||
|
|
||||||
|
|
@ -639,7 +645,6 @@ export class CreateEvaluationExpertise {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
govAge?: string | null;
|
govAge?: string | null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateEvaluation = Partial<Evaluation>;
|
export type UpdateEvaluation = Partial<Evaluation>;
|
||||||
|
|
|
||||||
35
src/entities/evaluation_directors_director.ts
Normal file
35
src/entities/evaluation_directors_director.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { Entity, Column, ManyToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||||
|
import { EntityBase } from "./base/Base";
|
||||||
|
import { Evaluation } from "./Evaluation";
|
||||||
|
import { Director } from "./Director";
|
||||||
|
@Entity("evaluation_directors_director")
|
||||||
|
export class evaluation_directors_director extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
comment: "Id การทำรายการระบบประเมิน",
|
||||||
|
length: 40,
|
||||||
|
default: "00000000-0000-0000-0000-000000000000",
|
||||||
|
})
|
||||||
|
directorId: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "Id การทำรายการระบบประเมิน",
|
||||||
|
length: 40,
|
||||||
|
default: "00000000-0000-0000-0000-000000000000",
|
||||||
|
})
|
||||||
|
evaluationId: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "หน้าที่",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
duty: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => Director, (Director) => Director.evaluation_directors_director)
|
||||||
|
@JoinColumn({ name: "directorId" })
|
||||||
|
director: Director;
|
||||||
|
|
||||||
|
@ManyToOne(() => Evaluation, (Evaluation) => Evaluation.evaluation_directors_director)
|
||||||
|
@JoinColumn({ name: "evaluationId" })
|
||||||
|
evaluation: Evaluation;
|
||||||
|
}
|
||||||
20
src/migration/1749798550561-update30062025603.ts
Normal file
20
src/migration/1749798550561-update30062025603.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class Update300620256031749798550561 implements MigrationInterface {
|
||||||
|
name = 'Update300620256031749798550561'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`CREATE TABLE \`evaluation_directors_director\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`directorId\` varchar(40) NOT NULL COMMENT 'Id การทำรายการระบบประเมิน' DEFAULT '00000000-0000-0000-0000-000000000000', \`evaluationId\` varchar(40) NOT NULL COMMENT 'Id การทำรายการระบบประเมิน' DEFAULT '00000000-0000-0000-0000-000000000000', \`duty\` varchar(255) NULL COMMENT 'หน้าที่', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`director\` DROP COLUMN \`duty\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`evaluation_directors_director\` ADD CONSTRAINT \`FK_a1b902762a4a2410a10b6728065\` FOREIGN KEY (\`directorId\`) REFERENCES \`director\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`evaluation_directors_director\` ADD CONSTRAINT \`FK_aee4e7f5076bf5ff10190ddb79b\` FOREIGN KEY (\`evaluationId\`) REFERENCES \`evaluation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`evaluation_directors_director\` DROP FOREIGN KEY \`FK_aee4e7f5076bf5ff10190ddb79b\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`evaluation_directors_director\` DROP FOREIGN KEY \`FK_a1b902762a4a2410a10b6728065\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`director\` ADD \`duty\` varchar(255) NULL COMMENT 'หน้าที่'`);
|
||||||
|
await queryRunner.query(`DROP TABLE \`evaluation_directors_director\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
src/migration/1749811430532-add_field_assignedPosLevel.ts
Normal file
14
src/migration/1749811430532-add_field_assignedPosLevel.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class AddFieldAssignedPosLevel1749811430532 implements MigrationInterface {
|
||||||
|
name = 'AddFieldAssignedPosLevel1749811430532'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`assignedPosLevel\` varchar(255) NULL COMMENT 'ระดับที่ได้รับมอบหมาย'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`assignedPosLevel\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue