หมายเหตุ ผู้ประเมิน
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue