หมายเหตุ ผู้ประเมิน
This commit is contained in:
parent
468d8d8865
commit
ae87b678d1
3 changed files with 302 additions and 0 deletions
|
|
@ -987,4 +987,207 @@ export class KpiUserEvaluationController extends Controller {
|
|||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Get("open/{id}")
|
||||
async openKpiUserEvaluation(
|
||||
@Path() id: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
kpiUserEvaluation.isOpen = true;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขสรุปผลการประเมิน (USER)
|
||||
*
|
||||
* @summary แก้ไขสรุปผลการประเมิน (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Put("reason/user/{id}")
|
||||
async updateReasonKpiUserEvaluation(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: {
|
||||
topicEvaluator?: string | null;
|
||||
developEvaluator?: string | null;
|
||||
timeEvaluator?: string | null;
|
||||
reasonEvaluator?: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const _null: any = null;
|
||||
kpiUserEvaluation.topicEvaluator =
|
||||
requestBody.topicEvaluator == null ? _null : requestBody.topicEvaluator;
|
||||
kpiUserEvaluation.developEvaluator =
|
||||
requestBody.developEvaluator == null ? _null : requestBody.developEvaluator;
|
||||
kpiUserEvaluation.timeEvaluator =
|
||||
requestBody.timeEvaluator == null ? _null : requestBody.timeEvaluator;
|
||||
kpiUserEvaluation.reasonEvaluator =
|
||||
requestBody.reasonEvaluator == null ? _null : requestBody.reasonEvaluator;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขสรุปผลการประเมินผู้บังคับบัญชาเหนือขึ้นไป (USER)
|
||||
*
|
||||
* @summary แก้ไขสรุปผลการประเมินผู้บังคับบัญชาเหนือขึ้นไป (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Put("reason/commander/{id}")
|
||||
async updateReasonKpiCommanderEvaluation(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: {
|
||||
isReason: boolean;
|
||||
reason?: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const _null: any = null;
|
||||
kpiUserEvaluation.isReasonCommander = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommander = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขสรุปผลการประเมินผู้บังคับบัญชาเหนือขึ้นไปอีกหนึ่งขั้น (USER)
|
||||
*
|
||||
* @summary แก้ไขสรุปผลการประเมินผู้บังคับบัญชาเหนือขึ้นไปอีกหนึ่งขั้น (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Put("reason/commanderHigh/{id}")
|
||||
async updateReasonKpiCommanderHighEvaluation(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: {
|
||||
isReason: boolean;
|
||||
reason?: string | null;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
const _null: any = null;
|
||||
kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดสรุปผลการประเมิน (USER)
|
||||
*
|
||||
* @summary รายละเอียดสรุปผลการประเมิน (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Get("reason/{id}")
|
||||
async getReasonKpiEvaluation(
|
||||
@Path() id: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
select: [
|
||||
"topicEvaluator",
|
||||
"developEvaluator",
|
||||
"timeEvaluator",
|
||||
"reasonEvaluator",
|
||||
"isReasonCommander",
|
||||
"reasonCommander",
|
||||
"isReasonCommanderHigh",
|
||||
"reasonCommanderHigh",
|
||||
"isOpen",
|
||||
],
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
return new HttpSuccess(kpiUserEvaluation);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดสรุปผลการประเมิน (USER)
|
||||
*
|
||||
* @summary รายละเอียดสรุปผลการประเมิน (USER)
|
||||
*
|
||||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Get("summary/{id}")
|
||||
async getSummaryKpiEvaluation(
|
||||
@Path() id: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["id", "evaluationStatus", "lastUpdateUserId", "lastUpdateFullName"],
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY";
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||
return new HttpSuccess(kpiUserEvaluation);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,75 @@ export class KpiUserEvaluation extends EntityBase {
|
|||
})
|
||||
summaryPoint: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
topicEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "วิธีการพัฒนา",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
developEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ช่วงเวลาการพัฒนา",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
timeEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ความเห็นของผู้ประเมิน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
reasonEvaluator: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไป",
|
||||
default: false,
|
||||
})
|
||||
isReasonCommander: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไป",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
reasonCommander: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง",
|
||||
default: false,
|
||||
})
|
||||
isReasonCommanderHigh: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
reasonCommanderHigh: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "การรับทราบผลการประเมิน",
|
||||
default: false,
|
||||
})
|
||||
isOpen: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableKpiUserEvalutionAddReason1719376307198 implements MigrationInterface {
|
||||
name = 'UpdateTableKpiUserEvalutionAddReason1719376307198'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`topicEvaluator\` varchar(255) NULL COMMENT 'ชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`developEvaluator\` varchar(255) NULL COMMENT 'วิธีการพัฒนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`timeEvaluator\` varchar(255) NULL COMMENT 'ช่วงเวลาการพัฒนา'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`reasonEvaluator\` varchar(255) NULL COMMENT 'ความเห็นของผู้ประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`isReasonCommander\` tinyint NULL COMMENT 'หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไป' DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`reasonCommander\` varchar(255) NULL COMMENT 'หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไป'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`isReasonCommanderHigh\` tinyint NULL COMMENT 'หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง' DEFAULT 0`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`reasonCommanderHigh\` varchar(255) NULL COMMENT 'หมายเหตุ ผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`isOpen\` tinyint NULL COMMENT 'การรับทราบผลการประเมิน' DEFAULT 0`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`isOpen\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`reasonCommanderHigh\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`isReasonCommanderHigh\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`reasonCommander\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`isReasonCommander\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`reasonEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`timeEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`developEvaluator\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`topicEvaluator\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue